[Lutingenerator-commits] r406 - in maven-generator-plugin/tags: . 0.63 0.63/src/main/java/org/codelutin/generator/plugin
Author: tchemit Date: 2008-12-15 02:32:15 +0000 (Mon, 15 Dec 2008) New Revision: 406 Added: maven-generator-plugin/tags/0.63/ maven-generator-plugin/tags/0.63/README.txt maven-generator-plugin/tags/0.63/changelog.txt maven-generator-plugin/tags/0.63/pom.xml maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java Removed: maven-generator-plugin/tags/0.63/changelog maven-generator-plugin/tags/0.63/pom.xml maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java Log: [maven-release-plugin] copy for tag 0.63 Copied: maven-generator-plugin/tags/0.63 (from rev 387, maven-generator-plugin/trunk) Copied: maven-generator-plugin/tags/0.63/README.txt (from rev 389, maven-generator-plugin/trunk/README.txt) =================================================================== --- maven-generator-plugin/tags/0.63/README.txt (rev 0) +++ maven-generator-plugin/tags/0.63/README.txt 2008-12-15 02:32:15 UTC (rev 406) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Deleted: maven-generator-plugin/tags/0.63/changelog =================================================================== --- maven-generator-plugin/trunk/changelog 2008-12-09 09:49:14 UTC (rev 387) +++ maven-generator-plugin/tags/0.63/changelog 2008-12-15 02:32:15 UTC (rev 406) @@ -1,40 +0,0 @@ -0.62-SNAPSHOT - * 20081208 [chorlet] correction bug #1737: Prise en compte du MetaModel UML dans les fichiers XMI - - ajout du support des fichiers default-java.xml et default-uml14.xmi - -0.62 chemit 200811?? - * 20081203 [chemit] add a encoding goal property to be dispatched in all generator to control file generation encoding - * 20081118 [chemit] use lutinproject 3.1 - * 20081117 [chemit] - - add extraClassPathDirectory parameter to can specify an extra directory to add in classLoader - - bump lutingenerator version - -0.61 chatellier 20081114 - * 20081107 [chatellier] - - add test compile dir and test resources in generation gaol - * 20081101 [chemit] - - add an excludeTemplates property on GeneratorPlugin to permit exclusion of generators for some composite generator - - bump lutingenerator to 0.61 - -0.60 chemit 20081013 - * 20081013 [chemit] - - remove addCompileDirectory option (always done) + add dynamic resources - - use lutingenerator 0.60 - - clean pom - -0.51 thimel 20080925 - * 20080925 [thimel] Refactor pom using the correct architecture - * 20080925 [thimel] Switched License to LGPL - * 20080723 [chemit] - - add generated sources in maven project's compilation directories via addCompilationDirectory plugin property - - * 20070525 [chatellier] - - add Xmi2StateModel goal - - improve Xmi2Model Hierarchy - * 20070525 [chatellier] update ant dependency to 1.7.0 - * 20070525 [chatellier] replacing lutinxml.XSLAntTask by Ant.XSLTProcess - -0.50 ??? ??? - - * 20070420 [chatellier] add goal to copy a set of generated files - * 20070420 [chatellier] update lutingenerator depencency to 0.50 Copied: maven-generator-plugin/tags/0.63/changelog.txt (from rev 404, maven-generator-plugin/trunk/changelog.txt) =================================================================== --- maven-generator-plugin/tags/0.63/changelog.txt (rev 0) +++ maven-generator-plugin/tags/0.63/changelog.txt 2008-12-15 02:32:15 UTC (rev 406) @@ -0,0 +1,42 @@ +0.64 ?? 200812?? + +0.63 chemit 20081215 + * 20081215 [chemit] follow lutingenerator release + +0.62 chemit 20081210 + * 20081210 [chemit] use lutinpluginproject 3.2 + * 20081203 [chemit] add a encoding goal property to be dispatched in all generator to control file generation encoding + * 20081118 [chemit] use lutinproject 3.1 + * 20081117 [chemit] + - add extraClassPathDirectory parameter to can specify an extra directory to add in classLoader + - bump lutingenerator version + +0.61 chatellier 20081114 + * 20081107 [chatellier] + - add test compile dir and test resources in generation gaol + * 20081101 [chemit] + - add an excludeTemplates property on GeneratorPlugin to permit exclusion of generators for some composite generator + - bump lutingenerator to 0.61 + +0.60 chemit 20081013 + * 20081013 [chemit] + - remove addCompileDirectory option (always done) + add dynamic resources + - use lutingenerator 0.60 + - clean pom + +0.51 thimel 20080925 + * 20080925 [thimel] Refactor pom using the correct architecture + * 20080925 [thimel] Switched License to LGPL + * 20080723 [chemit] + - add generated sources in maven project's compilation directories via addCompilationDirectory plugin property + + * 20070525 [chatellier] + - add Xmi2StateModel goal + - improve Xmi2Model Hierarchy + * 20070525 [chatellier] update ant dependency to 1.7.0 + * 20070525 [chatellier] replacing lutinxml.XSLAntTask by Ant.XSLTProcess + +0.50 ??? ??? + + * 20070420 [chatellier] add goal to copy a set of generated files + * 20070420 [chatellier] update lutingenerator depencency to 0.50 \ No newline at end of file Deleted: maven-generator-plugin/tags/0.63/pom.xml =================================================================== --- maven-generator-plugin/trunk/pom.xml 2008-12-09 09:49:14 UTC (rev 387) +++ maven-generator-plugin/tags/0.63/pom.xml 2008-12-15 02:32:15 UTC (rev 406) @@ -1,83 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <!-- ************************************************************* --> - <!-- *** POM Relationships *************************************** --> - <!-- ************************************************************* --> - <parent> - <groupId>org.codelutin</groupId> - <artifactId>lutinpluginproject</artifactId> - <version>3.1</version> - </parent> - - <artifactId>maven-generator-plugin</artifactId> - - <!-- POM Relationships : Inheritance : Dependencies --> - <dependencies> - - <dependency> - <groupId>org.codelutin</groupId> - <artifactId>lutingenerator</artifactId> - <version>0.62-SNAPSHOT</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - <version>1.7.1</version> - <scope>compile</scope> - </dependency> - - <dependency> - <groupId>org.apache.ant</groupId> - <artifactId>ant-trax</artifactId> - <version>1.7.1</version> - <scope>runtime</scope> - </dependency> - - </dependencies> - - <!-- ************************************************************* --> - <!-- *** Project Information ************************************* --> - <!-- ************************************************************* --> - <name>Plugin maven Generator</name> - <version>0.62-SNAPSHOT</version> - <inceptionYear>2006</inceptionYear> - <description>maven plugin to use the lutingenerator library</description> - - <!-- ************************************************************* --> - <!-- *** Build Settings ****************************************** --> - <!-- ************************************************************* --> - <packaging>maven-plugin</packaging> - - <properties> - <!-- id du projet du labs --> - <labs.id>39</labs.id> - - <!-- nom du projet sur le labs --> - <labs.project>lutingenerator</labs.project> - - </properties> - - <build> - <plugins> - - </plugins> - </build> - - - <!-- ************************************************************* --> - <!-- *** Build Environment ************************************** --> - <!-- ************************************************************* --> - - <!--Source control management--> - <scm> - <connection>${maven.scm.connection}</connection> - <developerConnection>${maven.scm.developerConnection}</developerConnection> - <url>${maven.scm.url}</url> - </scm> - -</project> Copied: maven-generator-plugin/tags/0.63/pom.xml (from rev 405, maven-generator-plugin/trunk/pom.xml) =================================================================== --- maven-generator-plugin/tags/0.63/pom.xml (rev 0) +++ maven-generator-plugin/tags/0.63/pom.xml 2008-12-15 02:32:15 UTC (rev 406) @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + <parent> + <groupId>org.codelutin</groupId> + <artifactId>lutinpluginproject</artifactId> + <version>3.2</version> + </parent> + + <artifactId>maven-generator-plugin</artifactId> + <version>0.63</version> + + <!-- POM Relationships : Inheritance : Dependencies --> + <dependencies> + + <dependency> + <groupId>org.codelutin</groupId> + <artifactId>lutingenerator</artifactId> + <version>0.63</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + <version>1.7.1</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant-trax</artifactId> + <version>1.7.1</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <!-- ************************************************************* --> + <!-- *** Project Information ************************************* --> + <!-- ************************************************************* --> + <name>Plugin maven Generator</name> + <inceptionYear>2006</inceptionYear> + <description>maven plugin to use the lutingenerator library</description> + + <!-- ************************************************************* --> + <!-- *** Build Settings ****************************************** --> + <!-- ************************************************************* --> + <packaging>maven-plugin</packaging> + + <properties> + <!-- id du projet du labs --> + <labs.id>39</labs.id> + + <!-- nom du projet sur le labs --> + <labs.project>lutingenerator</labs.project> + + </properties> + + <build> + <plugins> + + </plugins> + </build> + + + <!-- ************************************************************* --> + <!-- *** Build Environment ************************************** --> + <!-- ************************************************************* --> + + <!--Source control management--> + <scm> + <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</connection> + <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</developerConnection> + <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator-plugin/tags/0.63?root=lutingenerator</url> + </scm> + +</project> Deleted: maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java =================================================================== --- maven-generator-plugin/trunk/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java 2008-12-09 09:49:14 UTC (rev 387) +++ maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java 2008-12-15 02:32:15 UTC (rev 406) @@ -1,193 +0,0 @@ -/* *##% Plugin maven Generator - * Copyright (C) 2006 - 2008 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ - -/* * - * Xmi2Model.java - * - * Created: 14 avril 2006 - * - * @author ruchaud - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ - -package org.codelutin.generator.plugin; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileOutputStream; -import java.net.URL; -import java.util.List; - -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.URIResolver; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.tools.ant.BuildLogger; -import org.apache.tools.ant.NoBannerLogger; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Copy; -import org.apache.tools.ant.types.FileSet; -import org.codelutin.generator.plugin.helper.ResourceResolver; -import org.codelutin.util.FileUtil; -import org.codelutin.util.Resource; - -/** - * Converti les fichiers XMI en fichier Model via une transformation XSLT a - * définir. - * - * Class abstraite sans feuille de style. - */ -public abstract class Xmi2Model extends AbstractMojo { - - /** - * Répertoire source des fichiers XMI - * - * @parameter alias="srcXmiDest" - * @required - */ - protected File srcDirXmi; - - /** - * Répertoire cible des fichiers générés - * - * @parameter alias="srcGenDest" - * @required - */ - protected File destDirObjectModel; - - /** - * Nom du paquetage pour les fichiers générés - * - * @parameter expression="org.codelutin.${project.artifactId}" - */ - protected String fullPackagePath; - - /** - * Nom du paquetage à généré - * - * @parameter - */ - protected String extractedPackages = ""; - - /** - * Ecrase les fichiers générés - * - * @parameter default-value="false" - */ - private boolean overwrite = false; - - public void execute() throws MojoExecutionException, MojoFailureException { - actionXsl(); - actionCopy(); - } - - private void actionXsl() throws MojoExecutionException { - List<File> files = FileUtil.getFilteredElements(srcDirXmi, new FileFilter() { - public boolean accept(File pathname) { - if (pathname != null && pathname.getName().endsWith(".xmi")) { - return true; - } - return false; - } - }, false); - - destDirObjectModel.mkdirs(); - - TransformerFactory factory = TransformerFactory.newInstance(); - URIResolver resolver = new ResourceResolver(); - for (File file : files) { - try { - URL xsl = Resource.getURL(getStyleSheet()); - File result = new File(destDirObjectModel, FileUtil.basename(file, ".xmi").concat( - ".").concat(getExtension())); - - Transformer transformer = factory - .newTransformer(new StreamSource(xsl.openStream())); - transformer.setURIResolver(resolver); - transformer.transform(new StreamSource(file), new StreamResult( - new FileOutputStream(result))); - transformer = null; - - } catch (Exception e) { - e.printStackTrace(); - throw new MojoExecutionException(e.getMessage()); - } - } - factory = null; - resolver = null; - } - - private void actionCopy() { - /* Création d'un projet ant */ - Project project = createProject(); - - /* Création de la tâche ant Copy */ - Copy copy = new Copy(); - copy.setProject(project); - copy.setTaskName("Copy ressources"); - - /* Configuration */ - copy.setTodir(destDirObjectModel); - copy.setOverwrite(overwrite); - - FileSet fileSet = new FileSet(); - fileSet.setProject(project); - fileSet.setDir(srcDirXmi); - fileSet.setExcludes("**/*.xmi"); - copy.addFileset(fileSet); - - /* Execution */ - copy.execute(); - } - - private Project createProject() { - /* Création d'un projet ant */ - Project project = new Project(); - - BuildLogger logger = new NoBannerLogger(); - logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO); - logger.setOutputPrintStream(System.out); - logger.setErrorPrintStream(System.err); - - project.init(); - project.getBaseDir(); - project.addBuildListener(logger); - return project; - } - - /** - * Set extention - * - * @return the extention - */ - protected abstract String getExtension(); - - /** - * Set style sheet - * - * @return the stylesheet - */ - protected abstract String getStyleSheet(); -} Copied: maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java (from rev 400, maven-generator-plugin/trunk/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java) =================================================================== --- maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java (rev 0) +++ maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java 2008-12-15 02:32:15 UTC (rev 406) @@ -0,0 +1,190 @@ +/* *##% Plugin maven Generator + * Copyright (C) 2006 - 2008 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + +/* * + * Xmi2Model.java + * + * Created: 14 avril 2006 + * + * @author ruchaud + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ + +package org.codelutin.generator.plugin; + +import java.io.File; +import java.io.FileFilter; +import java.io.FileOutputStream; +import java.net.URL; +import java.util.List; + +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.URIResolver; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.tools.ant.BuildLogger; +import org.apache.tools.ant.NoBannerLogger; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.taskdefs.Copy; +import org.apache.tools.ant.types.FileSet; +import org.codelutin.generator.plugin.helper.ResourceResolver; +import org.codelutin.util.FileUtil; +import org.codelutin.util.Resource; + +/** + * Converti les fichiers XMI en fichier Model via une transformation XSLT a + * définir. + * + * Class abstraite sans feuille de style. + */ +public abstract class Xmi2Model extends AbstractMojo { + + /** + * Répertoire source des fichiers XMI + * + * @parameter alias="srcXmiDest" + * @required + */ + protected File srcDirXmi; + + /** + * Répertoire cible des fichiers générés + * + * @parameter alias="srcGenDest" + * @required + */ + protected File destDirObjectModel; + + /** + * Nom du paquetage pour les fichiers générés + * + * @parameter expression="org.codelutin.${project.artifactId}" + */ + protected String fullPackagePath; + + /** + * Nom du paquetage à généré + * + * @parameter + */ + protected String extractedPackages = ""; + + /** + * Ecrase les fichiers générés + * + * @parameter default-value="false" + */ + private boolean overwrite = false; + + public void execute() throws MojoExecutionException, MojoFailureException { + actionXsl(); + actionCopy(); + } + + private void actionXsl() throws MojoExecutionException { + List<File> files = FileUtil.getFilteredElements(srcDirXmi, new FileFilter() { + public boolean accept(File pathname) { + return pathname != null && pathname.getName().endsWith(".xmi"); + } + }, false); + + destDirObjectModel.mkdirs(); + + TransformerFactory factory = TransformerFactory.newInstance(); + URIResolver resolver = new ResourceResolver(); + URL xsl = Resource.getURL(getStyleSheet()); + + for (File file : files) { + try { + File result = new File(destDirObjectModel, FileUtil.basename(file, ".xmi").concat( + ".").concat(getExtension())); + if (!overwrite && file.lastModified() < result.lastModified()) { + getLog().info("file up-to-date : "+result); + continue; + } + Transformer transformer = factory + .newTransformer(new StreamSource(xsl.openStream())); + transformer.setURIResolver(resolver); + transformer.transform(new StreamSource(file), new StreamResult( + new FileOutputStream(result))); + + } catch (Exception e) { + throw new MojoExecutionException(e.getMessage(),e); + } + } + } + + private void actionCopy() { + /* Création d'un projet ant */ + Project project = createProject(); + + /* Création de la tâche ant Copy */ + Copy copy = new Copy(); + copy.setProject(project); + copy.setTaskName("Copy ressources"); + + /* Configuration */ + copy.setTodir(destDirObjectModel); + copy.setOverwrite(overwrite); + + FileSet fileSet = new FileSet(); + fileSet.setProject(project); + fileSet.setDir(srcDirXmi); + fileSet.setExcludes("**/*.xmi"); + copy.addFileset(fileSet); + + /* Execution */ + copy.execute(); + } + + private Project createProject() { + /* Création d'un projet ant */ + Project project = new Project(); + + BuildLogger logger = new NoBannerLogger(); + logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO); + logger.setOutputPrintStream(System.out); + logger.setErrorPrintStream(System.err); + + project.init(); + project.getBaseDir(); + project.addBuildListener(logger); + return project; + } + + /** + * Set extention + * + * @return the extention + */ + protected abstract String getExtension(); + + /** + * Set style sheet + * + * @return the stylesheet + */ + protected abstract String getStyleSheet(); +}
participants (1)
-
tchemit@users.labs.libre-entreprise.org