Eugene-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1738 discussions
r765 - in trunk/maven-eugene-plugin: . src/main/java/org/nuiton/eugene/plugin src/main/java/org/nuiton/eugene/plugin/writer src/main/resources
by tchemit@users.nuiton.org 18 Dec '09
by tchemit@users.nuiton.org 18 Dec '09
18 Dec '09
Author: tchemit
Date: 2009-12-18 11:26:52 +0100 (Fri, 18 Dec 2009)
New Revision: 765
Added:
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/SmartGenerateMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseChainedFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToChainedFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ModelChainedFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelChainedFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelChainedFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoChainedFileWriter.java
trunk/maven-eugene-plugin/src/main/resources/META-INF/
Removed:
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java
Modified:
trunk/maven-eugene-plugin/pom.xml
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java
Log:
- introduce SmartGenerateMojo to remplace all new goals : one goal for everything (even the coffee :))
- add it tests
Modified: trunk/maven-eugene-plugin/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/pom.xml 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/pom.xml 2009-12-18 10:26:52 UTC (rev 765)
@@ -71,6 +71,7 @@
<defaultGoal>install</defaultGoal>
<plugins>
+
<!-- plugin plugin -->
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
@@ -91,7 +92,13 @@
<execution>
<goals>
<goal>generate-metadata</goal>
+ <!--<goal>merge-metadata</goal>-->
</goals>
+ <!--configuration>
+ <descriptors>
+ <descriptor>${maven.src.dir}/main/plexus/components.xml</descriptor>
+ </descriptors>
+ </configuration-->
</execution>
</executions>
</plugin>
@@ -116,6 +123,12 @@
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
+
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-maven-plugin</artifactId>
+ <version>1.3.8</version>
+ </plugin>
</plugins>
</reporting>
@@ -134,9 +147,10 @@
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<pomIncludes>
- <pomInclude>generate-model-files/testIncludeWithNoProtocol/pom.xml</pomInclude>
- <pomInclude>generate-model-files/testIncludeWithOnlyProtocol/pom.xml</pomInclude>
- <pomInclude>generate/generators/pom.xml</pomInclude>
+ <pomInclude>smart-generate/only-zargo/pom.xml</pomInclude>
+ <pomInclude>smart-generate/only-zargo-xmi/pom.xml</pomInclude>
+ <pomInclude>smart-generate/all/pom.xml</pomInclude>
+ <pomInclude>smart-generate/generators/pom.xml</pomInclude>
<!--<pomInclude>**/pom.xml</pomInclude>-->
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,240 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin;
-
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.settings.Settings;
-import org.nuiton.eugene.models.Model;
-import org.nuiton.plugin.AbstractPlugin;
-import org.nuiton.plugin.PluginIOContext;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Map;
-
-/**
- * User: chemit
- * Date: 23 nov. 2009
- * Time: 20:19:35
- */
-public abstract class AbstractEugeneMojo extends AbstractPlugin {
-
- /**
- * Maven project.
- *
- * @parameter default-value="${project}"
- * @readonly
- * @since 2.0.0
- */
- protected MavenProject project;
- /**
- * Le settings (pour obtenir le mode offline).
- *
- * @parameter default-value="${settings}"
- * @readonly
- * @since 2.0.0
- */
- protected Settings settings;
- /**
- * Ecrase les fichiers générés.
- *
- * @parameter expression="${eugene.overwrite}" default-value="false"
- * @since 2.0.0
- */
- protected boolean overwrite;
- /**
- * Pour activer le mode verbeux.
- *
- * @parameter expression="${eugene.verbose}" default-value="${maven.verbose}"
- * @since 2.0.0
- */
- protected boolean verbose;
- /**
- * Encoding to be used for generation of files.
- *
- * @parameter expression="${eugene.encoding}" default-value="${project.build.sourceEncoding}"
- * @since 2.0.0
- */
- protected String encoding;
- /**
- * A flag to mark the mojo to be used in a test phase. This will permits to add generated sources in test compile roots.
- *
- * @parameter expression="${eugene.testPhase}" default-value="false"
- * @since 2.0.0
- */
- protected boolean testPhase;
- /**
- * The type of model to be used.
- * <p/>
- * By default, use an {@code objectmodel}.
- *
- * @parameter expression="${eugene.modelType}" default-value="objectmodel"
- * @required
- * @since 2.0.0
- */
- protected String modelType;
- /**
- * An extra directory to be added to the classpath.
- *
- * @parameter expression="${eugene.extraClassPathDirectory}"
- * @since 2.0.0
- */
- private File extraClassPathDirectory;
- /**
- * class instance of the given {@link #modelType}
- */
- protected Class<? extends Model> modelClass;
-
- /**
- * All available models (obtain by plexus, keys are plexus roles, values are a
- * instance of corresponding model).
- *
- * @component role="org.nuiton.eugene.models.Model"
- */
- protected Map<String, Model> _models;
-
- @Override
- protected boolean init() throws Exception {
-
- // on recupere le fqn du model à traiter via le container plexus (plus pratique dans ce cas où on veut
- // pouvoir associé un nom à un type de service).
- Model model = _models.get(modelType.trim().toLowerCase());
- if (model == null) {
- throw new MojoExecutionException("No modelType named '" + modelType + "', use one of " + _models.keySet());
- }
- modelClass = model.getClass();
- return true;
- }
-
- /**
- * Build the resources data to use for a goal.
- *
- * @param resources incoming resources data (form the goal
- * @param defaultIn the default input directory
- * @param defaultOut the default output directory
- * @param defaultTestIn the default test input directory
- * @param defaultTestOut the default test output directory
- * @return the new {@link org.nuiton.plugin.PluginIOContext} to use in the goal
- */
- protected PluginIOContext initResources(PluginIOContext resources, File defaultIn, File defaultOut, File defaultTestIn, File defaultTestOut) {
-
- if (resources == null) {
- resources = new PluginIOContext();
- }
-
- // adding default inputs only if not consumed
- if (resources.getInputs() == null) {
- if (testPhase) {
- resources.setInput(defaultTestIn);
- } else {
- resources.setInput(defaultIn);
- }
- getLog().info(" using default in : " + Arrays.asList(resources.getInputs()));
- } else {
- getLog().info(" in : " + Arrays.asList(resources.getInputs()));
- }
-
- if (resources.getOutput() == null) {
- if (testPhase) {
- resources.setOutput(defaultTestOut);
- } else {
- resources.setOutput(defaultOut);
- }
- getLog().info(" using default out : " + resources.getOutput());
- } else {
- getLog().info(" out : " + resources.getOutput());
- }
-
- return resources;
- }
-
-
- @Override
- public MavenProject getProject() {
- return project;
- }
-
- public void setProject(MavenProject project) {
- this.project = project;
- }
-
- @Override
- public boolean isVerbose() {
- return verbose;
- }
-
- public void setVerbose(boolean verbose) {
- this.verbose = verbose;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- public boolean isOverwrite() {
- return overwrite;
- }
-
- public void setOverwrite(boolean overwrite) {
- this.overwrite = overwrite;
- }
-
- public Settings getSettings() {
- return settings;
- }
-
- public void setSettings(Settings settings) {
- this.settings = settings;
- }
-
- public boolean isOffline() {
- return settings.isOffline();
- }
-
- public boolean isTestPhase() {
- return testPhase;
- }
-
- public void setTestPhase(boolean testPhase) {
- this.testPhase = testPhase;
- }
-
- public Class<? extends Model> getModelClass() {
- return modelClass;
- }
-
- public void setModelClass(Class<? extends Model> modelClass) {
- this.modelClass = modelClass;
- }
-
- public File getExtraClassPathDirectory() {
- return extraClassPathDirectory;
- }
-
- public void setExtraClassPathDirectory(File extraClassPathDirectory) {
- this.extraClassPathDirectory = extraClassPathDirectory;
- }
-}
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -55,7 +55,7 @@
* by : $Author$
* @goal generate
* @requiresProject true
- * @deprecated since 2.0.0, use now the {@link GenerateFromModelsMojo}.
+ * @deprecated since 2.0.0, use now the {@link SmartGenerateMojo}.
*/
@Deprecated
public class EugenePlugin extends EugeneAbstractMojo {
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,330 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.nuiton.eugene.ModelFileWriter;
-import org.nuiton.eugene.ModelFileWriterConfiguration;
-import org.nuiton.eugene.ModelFileWriterUtil;
-import org.nuiton.eugene.plugin.writer.BaseModelFileWriter;
-import org.nuiton.eugene.plugin.writer.BaseXmiToModelFileWriter;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.*;
-
-/**
- * User: chemit
- * Date: 24 nov. 2009
- * Time: 00:22:37
- *
- * @goal generate-model-files
- * @requiresProject true
- * @requiresDependencyResolution compile
- */
-public class GeneratateModelFilesMojo extends AbstractEugeneMojo implements ModelFileWriterConfiguration {
-
- /**
- * Inputs files to used to generate the required model files.
- * </p>
- * An include has the following pattern :
- * <pre>
- * writer:
- * </pre>
- * when you want to use a specific writer with his default io values.
- * <p/>
- * Can also write :
- * <pre>
- * [writer:]directory:includes
- * </pre>
- * where {@code includes} is the pattern to find files from the directory given and must be terminated by the extension
- * of files.
- * <p/>
- * Specifying the {@code writer} can be usefull when you want to use a writer for an unknown extension
- * by any writer.
- * <p/>
- * Example :
- * <pre>
- * <inputFiles>
- * <inputFile>zargo:<inputFile>
- * <inputFile>src/main/xmi2:**\/*.zargo<inputFile>
- * <inputFile>zargo:src/main/xmi:**\/*.zargo2<inputFile>
- * </inputFiles>
- * </pre>
- *
- * @parameter expression="${eugene.inputFiles}"
- * @required
- * @since 2.0.0
- */
- protected String[] inputFiles;
- /**
- * Where to generate files.
- *
- * @parameter expression="${eugene.outputDirectory}" default-value="target/generated-sources"
- * @required
- * @since 2.0.0
- */
- protected File outputDirectory;
- /**
- * Properties to pass to writer.
- *
- * @parameter
- * @since 2.0.0
- */
- protected Map<String, Object> properties;
- /**
- * Ne génère rien, analyse juste la configuration.
- *
- * @parameter expression="${eugene.dryRun}" default-value="false"
- * @since 2.0.0
- */
- protected boolean dryRun;
- /**
- * Nom du paquetage pour les fichiers générés
- *
- * @parameter expression="${generator.fullPackagePath}" default-value="${project.groupId}.${project.artifactId}"
- * @since 2.0.0
- */
- protected String fullPackagePath;
-// /**
-// * Nom du paquetage à générer
-// *
-// * @parameter expression="${generator.extractedPackages}" default-value="${project.groupId}.${project.artifactId}"
-// * @since 2.0.0
-// */
-// protected String extractedPackages;
- /**
- * Nom du resolver a utiliser
- *
- * @parameter expression="${generator.resolver}" default-value="org.nuiton.util.ResourceResolver"
- * @since 2.0.0
- */
- protected String resolver;
- /**
- * All available writers
- *
- * @component role="org.nuiton.eugene.ModelFileWriter"
- */
- protected Map<String, ModelFileWriter> writers;
- /**
- * All available writers for the given {@link #getModelClass()}
- */
- protected Set<ModelFileWriter> availableWriters;
- /**
- * Writers to process
- */
- protected List<ModelFileWriter> plan;
-
- @Override
- protected boolean init() throws Exception {
- boolean b = super.init();
- if (!b) {
- return false;
- }
- if (inputFiles.length == 0) {
- throw new MojoExecutionException("Must specify something to include using the includes property");
- }
-
- availableWriters = ModelFileWriterUtil.filterWriterForModelType(writers, getModelClass());
-
- if (availableWriters.isEmpty()) {
- throw new MojoExecutionException("Could not find any writer in class-path.");
- }
-
- for (ModelFileWriter writer : availableWriters) {
- if (writer instanceof BaseModelFileWriter) {
- // add log support
- ((BaseModelFileWriter) writer).setLog(getLog());
- }
- }
-
- plan = new ArrayList<ModelFileWriter>();
-
- // first pass to detect top level writers
- for (String include : inputFiles) {
-
- getLog().info("Register include : " + include);
- ModelFileWriterUtil.registerInclude(this, include, plan);
- }
-
- if (properties == null) {
- properties = new TreeMap<String, Object>();
- }
- return true;
- }
-
- @Override
- protected void doAction() throws Exception {
- if (dryRun) {
- getLog().warn("dryRun property is set, no file will be generated.");
- }
- try {
- // transfert to properties
-
- ClassLoader loader = fixClassLoader();
-
- properties.put(BaseModelFileWriter.PROP_CLASS_LOADER, loader);
- properties.put(BaseXmiToModelFileWriter.PROP_FULL_PACKAGE_PATH, fullPackagePath);
- //properties.put("extractedPackages", extractedPackages);
- properties.put(BaseXmiToModelFileWriter.PROP_RESOLVER, resolver);
-
- // launch writers in incoming order of dicovering of them
- for (ModelFileWriter writer : plan) {
- int size = writer.getEntries().size();
- if (size == 1) {
- getLog().info("Process phase [" + writer.getInputProtocol() + "] for one entry.");
- } else {
- getLog().info("Process phase [" + writer.getInputProtocol() + "] for " + size + " entries.");
- }
- if (dryRun || isVerbose()) {
- for (ModelFileWriterUtil.ModelFileWriterEntry entry : writer.getEntries()) {
- getLog().info(" entry : " + entry.getInputDirectory() + " - " + entry.getIncludePattern());
- }
- if (dryRun) {
- continue;
- }
- }
- if (getLog().isDebugEnabled()) {
- getLog().debug("Generating files and copying resources...");
- }
-
- writer.generate(this);
-
- }
- } finally {
- // always clear everything to avoid side-effects in goal is invoked more than once
- properties.clear();
- for (ModelFileWriter writer : plan) {
- writer.clear();
- }
- plan.clear();
- }
- }
-
- @Override
- public File getOutputDirectory() {
- return outputDirectory;
- }
-
- @Override
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- @Override
- public Set<ModelFileWriter> getAvailableWriters() {
- return availableWriters;
- }
-
- @Override
- public File getBasedir() {
- return getProject().getBasedir();
- }
-
- /**
- * Prepare le classLoader a utiliser dans le generateur.
- * <p/>
- * Si un {@link #extraClassPathDirectory} a été renseigné, il est rajouté.
- * <p/>
- * Si des références à des sibling modules, ils seront rajoutés aussi.
- *
- * @return le class loader modifie
- * @throws MojoExecutionException if any pb
- */
- protected ClassLoader fixClassLoader() throws MojoExecutionException {
- Set<String> urlsAsString = new HashSet<String>();
- List<URL> urls = new ArrayList<URL>();
- try {
- ClassLoader loader;
- File extraClassPathDirectory = getExtraClassPathDirectory();
- if (extraClassPathDirectory != null) {
- if (verbose) {
- getLog().info("Add extra directory in generator's classLoader : " + extraClassPathDirectory);
- }
- addDirectoryToUrlsList(extraClassPathDirectory, urls, urlsAsString);
- }
- if (project.getProjectReferences() != null) {
- // this case is for multi-module when calling from a parent module
- for (Object o : project.getProjectReferences().entrySet()) {
- Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
- MavenProject relatedProject = (MavenProject) entry.getValue();
- if (verbose) {
- getLog().info("Add project reference in generator's classLoader : '" + relatedProject.getArtifact() + "'");
- }
- //TODO il faudrait peut-etre aussi ajouter les dependances ?
- addDirectoryToUrlsList(relatedProject.getArtifact().getFile(), urls, urlsAsString);
- }
- }
- if (!project.getArtifacts().isEmpty()) {
- // this is a special case when artifacts were resolved (for example in site phase)
- if (verbose) {
- getLog().info("Use resolved artifacts to build class-path");
- }
- for (Object o : project.getArtifacts()) {
- Artifact a = (Artifact) o;
- if (!a.getScope().equals("provided")) {
- addDirectoryToUrlsList(a.getFile(), urls, urlsAsString);
- }
- }
- }
- // we ask to add the directory in classloader
- loader = getClass().getClassLoader();
- if (getLog().isDebugEnabled()) {
- getLog().info("original classloader " + loader);
- }
- if (loader instanceof URLClassLoader) {
- // on reinjecte les urls de loader de base
- // car sinon on risque de ne pas retrouver les resources...
- for (URL u : ((URLClassLoader) loader).getURLs()) {
- addUrlToUrlsList(u, urls, urlsAsString);
- if (getLog().isDebugEnabled()) {
- getLog().debug("original cp entry: " + u);
- }
- }
- // et on force l'utilisation du classloader parent
- // s'il existe
- if (loader.getParent() != null) {
- loader = loader.getParent();
- }
- }
- if (!urls.isEmpty()) {
- loader = new URLClassLoader(urls.toArray(new URL[urls.size()]),
- loader);
- }
- if (getLog().isDebugEnabled()) {
- for (URL u : urls) {
- getLog().debug("cp entry: " + u);
- }
- }
- return loader;
- } catch (MalformedURLException e) {
- throw new MojoExecutionException(e.getMessage());
- } finally {
- urls.clear();
- urlsAsString.clear();
- }
-
- }
-}
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,501 +0,0 @@
-package org.nuiton.eugene.plugin;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Resource;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.nuiton.eugene.ModelReader;
-import org.nuiton.eugene.Template;
-import org.nuiton.eugene.models.Model;
-import org.nuiton.plugin.PluginHelper;
-import org.nuiton.plugin.PluginIOContext;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.*;
-
-/**
- * Created: 15 déc. 2009
- *
- * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
- * @version $Revision$
- * <p/>
- * Mise a jour: $Date$ par :
- * $Author: tchemit $
- * @goal generate-from-models
- * @requiresProject true
- * @since 2.0.0 (replace previous goal {@link EugenePlugin}).
- */
-public class GenerateFromModelsMojo extends AbstractEugeneMojo {
-
- /**
- * Les entrées sorties du plugin.
- * <p/>
- * <p/>
- * <p/>
- * En entrée on demande des répertoires où chercher les fichiers objectmodel a convertir.
- * <p/>
- * En sortie on demande le répertoire ou generer les classes java.
- * <p/>
- * Par défaut on a les valeurs suivantes :
- * </p>
- * <pre>
- * <generateResources>
- * </p>
- * <input>target/generated-sources/models</input>
- * </p>
- * <output>target/generated-sources/java</output>
- * </p>
- * </generateResources>
- * </pre>
- * </p>
- * <p/>
- * Note: si {@link #testPhase} est activée, les valeurs par défaut sont :
- * </p>
- * <pre>
- * <generateResources>
- * </p>
- * <input>target/generated-sources/test-models</input>
- * </p>
- * <output>target/generated-sources/test-java</output>
- * </p>
- * </generateResources>
- * </pre>
- *
- * @parameter
- * @since 1.0.0-rc-8
- */
- protected PluginIOContext generateResources;
- /**
- * Templates à utiliser, séparés par des virgules.
- *
- * @parameter expression="${eugene.templates}"
- * @required
- * @since 0.50
- */
- protected String templates;
- /**
- * Templates à ne pas utiliser.
- *
- * @parameter expression="${eugene.excludeTemplates}"
- * @since 0.63
- */
- protected String[] excludeTemplates;
- /**
- * Fichier à inclure.
- *
- * @parameter expression="${eugene.includes}" default-value="*.*model"
- * @since 0.50
- */
- protected String includes;
- /**
- * Nom par défaut du paquetage généré.
- *
- * @parameter expression="${eugene.defaultPackage}" default-value="${project.groupId}.${project.artifactId}"
- * @since 0.50
- */
- protected String defaultPackage;
- /**
- * List of packages to generate (comma separated).
- * <p/>
- * If the parameter is not filled, will generate all packages.
- *
- * @parameter expression="${eugene.generatedPackages}"
- * @since 1.0.0-rc-8
- */
- protected String generatedPackages;
- /**
- * To define a specific reader to use to transform input files in a Model to generate.
- * <p/>
- * If nothing is specified, will use the reader corresponding to the given {@link #modelType}.
- *
- * @parameter expression="${eugene.reader}"
- * @since 1.1.0
- */
- protected String reader;
- /**
- * All available writers
- *
- * @component role="org.nuiton.eugene.ModelReader"
- */
- protected Map<String, ModelReader<?>> availableReaders;
- /**
- * All available templates
- *
- * @component role="org.nuiton.eugene.Template"
- */
- protected Map<String, Template<?>> availableTemplates;
-
- /**
- * model reader instance
- */
- protected ModelReader<?> modelReader;
- /**
- * fixed classloader
- */
- protected ClassLoader fixedClassLoader;
- /**
- * list of templates to apply
- */
- protected List<Template<Model>> templatesList;
- /**
- * list of model files to load in the memory reader via the model reader
- */
- protected File[] modelFiles;
-
- @Override
- protected boolean init() throws Exception {
- boolean b = super.init();
- if (!b) {
- // something wrong from the super class, skip now
- return false;
- }
-
- // init goal io context
-
- generateResources = initResources();
-
- if (generateResources == null) {
- // could not be init...
- return false;
- }
-
- // init reader
-
- modelReader = getModelReader();
- if (modelReader == null) {
- // could not be init...
- return false;
- }
-
- // get templates to use
-
- templatesList = getTemplates(getFixedClassLoader());
-
- if (templatesList == null || templatesList.isEmpty()) {
- getLog().error("No template to apply.");
- return false;
- }
-
- //TODO Check excludeTemplates are sane :)
-
- // get models to treate
-
- modelFiles = getModelFiles(generateResources);
- if (modelFiles.length == 0) {
- // can skip
- getLog().warn("No model to treate.");
- return false;
- }
- return true;
- }
-
- @Override
- public void doAction() throws MojoExecutionException, MojoFailureException {
-
- getLog().info("Generating java sources from models");
- getLog().info(" reader : " + modelReader.getClass().getName());
- getLog().info(" includes : " + includes);
- getLog().info(" using template : " + templates);
- getLog().info(" using defaultPackage : " + defaultPackage);
-
- if (verbose) {
- for (File m : modelFiles) {
- getLog().info("will treate model file : " + m);
- }
- }
-
- // prepare template properties
-
- Properties templateProperties = new Properties();
- templateProperties.setProperty(Template.PROP_DEFAULT_PACKAGE, defaultPackage);
- templateProperties.setProperty(Template.PROP_OVERWRITE, String.valueOf(overwrite));
- templateProperties.setProperty(Template.PROP_ENCODING, encoding);
- templateProperties.setProperty(Template.PROP_LAST_MODIFIED_SOURCE, String.valueOf(modelReader.getLastModifiedSource()));
- if (StringUtils.isEmpty(generatedPackages)) {
- getLog().info(" generating all packages");
- } else {
- templateProperties.setProperty(Template.PROP_GENERATED_PACKAGES, generatedPackages);
- getLog().info(" generating only for packages " + generatedPackages);
- }
- templateProperties.setProperty(Template.PROP_EXCLUDE_TEMPLATES, getExcludeTemplatesAsString());
-
- // read the model
-
- Model model = modelReader.read(modelFiles);
-
- // apply all templates to the model
-
- for (Template<Model> template : templatesList) {
- getLog().info("Apply " + template.getClass().getSimpleName() + " generator");
-
- try {
-
- // init template
- template.setProperties(templateProperties);
-
- // apply template
- template.applyTemplate(model, generateResources.getOutput());
- } catch (IOException eee) {
- throw new MojoExecutionException("Generation problem", eee);
- }
- }
-
- // fix compile root sources
-
- fixCompileSourceRoots();
-
- }
-
- /**
- * Init the {@link #generateResources} io context and return it.
- * <p/>
- * <b>Note:</b> If something wrong appears, then return a {@code null} value.
- *
- * @return the io context to use for the goal, or {@code null} if something was wrong
- */
- protected PluginIOContext initResources() {
-
- File defaultIn = getFileFromBasedir("target", "generated-sources", "models");
- File defaultOut = getFileFromBasedir("target", "generated-sources", "java");
-
- File defaultTestIn = getFileFromBasedir("target", "generated-sources", "test-models");
- File defaultTestOut = getFileFromBasedir("target", "generated-sources", "test-java");
-
- PluginIOContext p = initResources(generateResources, defaultIn, defaultOut, defaultTestIn, defaultTestOut);
-
- // check context
-
- if ((p.getInputs() == null || p.getInputs().length == 0)) {
- getLog().error("no input defined");
- return null;
- }
- if (p.getOutput() == null) {
- getLog().error("no output defined");
- return null;
- }
-
- if (!p.getOutput().exists()) {
- boolean b2 = p.getOutput().mkdirs();
- if (!b2) {
- getLog().error("could not create directory " + p.getOutput());
- p = null;
- }
- }
-
- return p;
- }
-
- /**
- * Obtain the reader to use to read the model.
- * <p/>
- * <b>Note:</b> If something wrong appears, the return a {@code null} value.
- *
- * @return the model reader to use to obtain the model to treate, or {@code null} if something was wrong.
- */
- protected ModelReader<?> getModelReader() {
-
- ModelReader<?> modelReader;
-
- if (reader != null && !reader.trim().isEmpty()) {
- // try to load a specific reader
- try {
- ClassLoader fixedClassLoader = getFixedClassLoader();
- modelReader = (ModelReader<?>) Class.forName(reader, true, fixedClassLoader).newInstance();
- //TODO : should check that the reader is compatible with given modelType
- } catch (Exception eee) {
- getLog().error("could not obtain reader " + reader + " for reason : " + eee.getMessage());
- return null;
- }
- } else {
- modelReader = availableReaders.get(modelType);
- if (modelReader == null) {
- getLog().error("could not find a model reader for modelType : " + modelType + ", availables readers : " + availableReaders.values());
- return null;
- }
- }
- return modelReader;
- }
-
- /**
- * Recuperation de la liste des fichiers de modele a traite.
- *
- * @param ioContext io context
- * @return la liste des modeles a utiliser
- */
- protected File[] getModelFiles(PluginIOContext ioContext) {
-
- List<File> modelFiles = new ArrayList<File>();
- String[] includePatterns = includes.split(",");
-
- for (File srcDirGen : ioContext.getInputs()) {
-
- if (verbose) {
- getLog().info("Search for " + Arrays.toString(includePatterns) + " in " + srcDirGen.getAbsolutePath());
- }
- List<File> currentFiles = PluginHelper.getIncludedFiles(srcDirGen, includePatterns, null);
- modelFiles.addAll(currentFiles);
- }
- return modelFiles.toArray(new File[modelFiles.size()]);
- }
-
- /**
- * Obtain the list of templates to apply to model.
- * <p/>
- * <b>Note:</b> If something wrong appears, then return a {@code null} value.
- *
- * @param fixedClassLoader classloader to use to seek of templates
- * @return list of templates to apply, or {@code null} if something was wrong
- */
- protected List<Template<Model>> getTemplates(ClassLoader fixedClassLoader) {
-
- List<Template<Model>> templatesList = new ArrayList<Template<Model>>();
- String[] templatesNames = templates.split(",");
- for (String templateName : templatesNames) {
- // remove trailing spaces
- templateName = templateName.trim();
- Template<Model> template;
-
- template = (Template<Model>) availableTemplates.get(templateName);
- if (template == null) {
- getLog().warn("template [" + templateName + "] is not registred via plexus, try to load it directly");
- try {
- template = (Template<Model>) Class.forName(templateName, true, fixedClassLoader).newInstance();
- } catch (Exception e) {
- getLog().error("Can't obtain template [" + templateName + "] for reason " + e.getMessage(), e);
- return null;
- }
- // will use this template
- templatesList.add(template);
- }
- }
- return templatesList;
- }
-
- /**
- * @return the string representation of excludesTemplates (separated by comma)
- */
- protected String getExcludeTemplatesAsString() {
- String result = "";
- for (int i = 0; i < excludeTemplates.length; i++) {
- result += excludeTemplates[i];
- if (i != excludeTemplates.length - 1) {
- result += ",";
- }
- }
- return result;
- }
-
- /**
- * Prepare le classLoader a utiliser dans le generateur.
- * <p/>
- * Si un {@link #extraClassPathDirectory} a été renseigné, il est rajouté.
- * <p/>
- * Si des références à des sibling modules, ils seront rajoutés aussi.
- *
- * @return le class loader modifie
- * @throws MojoExecutionException if any pb
- */
-
- public ClassLoader getFixedClassLoader() throws MojoExecutionException {
-
- if (fixedClassLoader == null) {
-
- List<URL> urls = new ArrayList<URL>();
- Set<String> urlsAsString = new HashSet<String>();
- try {
- ClassLoader loader;
- File extraClassPathDirectory = getExtraClassPathDirectory();
- if (extraClassPathDirectory != null) {
- if (verbose) {
- getLog().info("Add extra directory in generator's classLoader : " + extraClassPathDirectory);
- }
- addDirectoryToUrlsList(extraClassPathDirectory, urls, urlsAsString);
- }
- if (project.getProjectReferences() != null) {
- // this case is for multi-module when calling from a parent module
- for (Object o : project.getProjectReferences().entrySet()) {
- Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
- MavenProject relatedProject = (MavenProject) entry.getValue();
- if (verbose) {
- getLog().info("Add project reference in generator's classLoader : '" + relatedProject.getArtifact() + "'");
- }
- //TODO il faudrait peut-etre aussi ajouter les dependances ?
- addDirectoryToUrlsList(relatedProject.getArtifact().getFile(), urls, urlsAsString);
- }
- }
- if (!project.getArtifacts().isEmpty()) {
- // this is a special case when artifacts were resolved (for example in site phase)
- if (verbose) {
- getLog().info("Use resolved artifacts to build class-path");
- }
- for (Object o : project.getArtifacts()) {
- Artifact a = (Artifact) o;
- if (!a.getScope().equals("provided")) {
- addDirectoryToUrlsList(a.getFile(), urls, urlsAsString);
- }
- }
- }
- // we ask to add the directory in classloader
- loader = getClass().getClassLoader();
- if (!urls.isEmpty()) {
- loader = new URLClassLoader(urls.toArray(new URL[urls.size()]),
- loader);
- }
- fixedClassLoader = loader;
- } catch (MalformedURLException e) {
- throw new MojoExecutionException(e.getMessage());
- } finally {
- urls.clear();
- urlsAsString.clear();
- }
- }
- return fixedClassLoader;
- }
-
- /**
- * permet d'ajout le répertoire de génération des fichiers java dans les répertoires
- * de compilation du projet Maven.
- */
- protected void fixCompileSourceRoots() {
-
- //FIXME-TC20091215 : should never have a null project, this is not normal
- if (project == null) {
- // no project defined, can not fix anything
- // this case could appears if we wanted to do some tests of the plugin
- return;
- }
-
- File destDirGen = generateResources.getOutput();
-
- //TODO-TC20091016 should use AbstractPlugin api
- if (testPhase) {
- if (!project.getTestCompileSourceRoots().contains(destDirGen.getPath())) {
- getLog().info("Add test compile source root : " + destDirGen);
- project.addTestCompileSourceRoot(destDirGen.getPath());
- Resource resources = new Resource();
- resources.setDirectory(destDirGen.getAbsolutePath());
- resources.setExcludes(Arrays.asList("**/*.java"));
- getLog().info("Add test resource root :" + resources);
- project.addTestResource(resources);
- }
- } else {
- if (!project.getCompileSourceRoots().contains(destDirGen.getPath())) {
- getLog().info("Add compile source root : " + destDirGen);
- project.addCompileSourceRoot(destDirGen.getPath());
- Resource resources = new Resource();
- resources.setDirectory(destDirGen.getAbsolutePath());
- resources.setExcludes(Arrays.asList("**/*.java"));
- getLog().info("Add resource root :" + resources);
- project.addResource(resources);
- }
- }
- }
-
-
-}
Copied: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/SmartGenerateMojo.java (from rev 763, trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java)
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/SmartGenerateMojo.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/SmartGenerateMojo.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,644 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.settings.Settings;
+import org.nuiton.eugene.ModelReader;
+import org.nuiton.eugene.Template;
+import org.nuiton.eugene.models.Model;
+import org.nuiton.eugene.plugin.writer.BaseChainedFileWriter;
+import org.nuiton.eugene.plugin.writer.BaseXmiToChainedFileWriter;
+import org.nuiton.eugene.plugin.writer.ModelChainedFileWriter;
+import org.nuiton.eugene.writer.ChainedFileWriter;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+import org.nuiton.eugene.writer.ChainedFileWriterEntry;
+import org.nuiton.eugene.writer.ChainedWriterEngine;
+import org.nuiton.plugin.AbstractPlugin;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.*;
+
+/**
+ * Smart file generator.
+ * <p/>
+ * Fill inputs and mojo will chained needed writer.
+ * <p/>
+ * User: chemit
+ * Date: 24 nov. 2009
+ * Time: 00:22:37
+ *
+ * @goal smart-generate
+ * @requiresProject true
+ * @requiresDependencyResolution compile
+ */
+public class SmartGenerateMojo extends AbstractPlugin implements ChainedFileWriterConfiguration {
+
+ /**
+ * Inputs files to used to generate the required model files.
+ * </p>
+ * An include has the following pattern :
+ * <pre>
+ * writer:
+ * </pre>
+ * when you want to use a specific writer with his default io values.
+ * <p/>
+ * Can also write :
+ * <pre>
+ * [writer:]directory:includes
+ * </pre>
+ * where {@code includes} is the pattern to find files from the directory given and must be terminated by the extension
+ * of files.
+ * <p/>
+ * Specifying the {@code writer} can be usefull when you want to use a writer for an unknown extension
+ * by any writer.
+ * <p/>
+ * Example :
+ * <pre>
+ * <inputs>
+ * <input>zargo:</input>
+ * <input>src/main/xmi2:**\/*.zargo</input>
+ * <input>zargo:src/main/xmi:**\/*.zargo2</input>
+ * </inputs>
+ * </pre>
+ *
+ * @parameter expression="${eugene.inputs}"
+ * @required
+ * @since 2.0.0
+ */
+ protected String[] inputs;
+ /**
+ * List of input (protocol) not to treate separated by comma.
+ * <p/>
+ * Example :
+ * <pre>
+ * <skipInputs>xmi</skipInputs>
+ * <skipInputs>xmi,model</skipInputs>
+ * </pre>
+ *
+ * @parameter expression="${eugene.skipInputs}"
+ * @since 2.0.0
+ */
+ protected String skipInputs;
+ /**
+ * Where to generate files.
+ *
+ * @parameter expression="${eugene.outputDirectory}" default-value="target/generated-sources"
+ * @required
+ * @since 2.0.0
+ */
+ protected File outputDirectory;
+ /**
+ * Ecrase les fichiers générés.
+ *
+ * @parameter expression="${eugene.overwrite}" default-value="false"
+ * @since 2.0.0
+ */
+ protected boolean overwrite;
+ /**
+ * Pour activer le mode verbeux.
+ *
+ * @parameter expression="${eugene.verbose}" default-value="${maven.verbose}"
+ * @since 2.0.0
+ */
+ protected boolean verbose;
+ /**
+ * Encoding to be used for generation of files.
+ *
+ * @parameter expression="${eugene.encoding}" default-value="${project.build.sourceEncoding}"
+ * @since 2.0.0
+ */
+ protected String encoding;
+ /**
+ * A flag to mark the mojo to be used in a test phase. This will permits to add generated sources in test compile roots.
+ *
+ * @parameter expression="${eugene.testPhase}" default-value="false"
+ * @since 2.0.0
+ */
+ protected boolean testPhase;
+ /**
+ * The type of model to be used.
+ * <p/>
+ * By default, use an {@code objectmodel}.
+ *
+ * @parameter expression="${eugene.modelType}" default-value="objectmodel"
+ * @required
+ * @since 2.0.0
+ */
+ protected String modelType;
+// /**
+// * An extra directory to be added to the classpath.
+// *
+ // * @parameter expression="${eugene.extraClassPathDirectory}"
+// * @since 2.0.0
+// */
+// protected File extraClassPathDirectory;
+ /**
+ * Properties to pass to writer.
+ *
+ * @parameter
+ * @since 2.0.0
+ */
+ protected Map<String, Object> properties;
+ /**
+ * Ne génère rien, analyse juste la configuration.
+ *
+ * @parameter expression="${eugene.dryRun}" default-value="false"
+ * @since 2.0.0
+ */
+ protected boolean dryRun;
+ /**
+ * Nom du paquetage pour les fichiers générés (xmi input sepcific).
+ *
+ * @parameter expression="${generator.fullPackagePath}" default-value="${project.groupId}.${project.artifactId}"
+ * @since 2.0.0
+ */
+ protected String fullPackagePath;
+// /**
+// * Nom du paquetage à générer (xmi input sepcific).
+// *
+ // * @parameter expression="${generator.extractedPackages}" default-value="${project.groupId}.${project.artifactId}"
+// * @since 2.0.0
+// */
+// protected String extractedPackages;
+ /**
+ * Nom du resolver a utiliser pour les transformations xmi vers model (xmi input sepcific).
+ *
+ * @parameter expression="${generator.resolver}" default-value="org.nuiton.util.ResourceResolver"
+ * @since 2.0.0
+ */
+ protected String resolver;
+ /**
+ * Templates à utiliser, séparés par des virgules pour les transformations depuis les models (model input sepcific).
+ *
+ * @parameter expression="${eugene.templates}"
+ * @since 0.50
+ */
+ protected String templates;
+ /**
+ * Templates à ne pas utiliser lors de la transformations des models (model input sepcific).
+ *
+ * @parameter expression="${eugene.excludeTemplates}"
+ * @since 0.63
+ */
+ protected String[] excludeTemplates;
+ /**
+ * Nom par défaut du paquetage généré (model input sepcific).
+ *
+ * @parameter expression="${eugene.defaultPackage}" default-value="${project.groupId}.${project.artifactId}"
+ * @since 0.50
+ */
+ protected String defaultPackage;
+ /**
+ * List of packages to generate (comma separated). (model input sepcific).
+ * <p/>
+ * If the parameter is not filled, will generate all packages.
+ *
+ * @parameter expression="${eugene.generatedPackages}"
+ * @since 1.0.0-rc-8
+ */
+ protected String generatedPackages;
+ /**
+ * Maven project.
+ *
+ * @parameter default-value="${project}"
+ * @readonly
+ * @since 2.0.0
+ */
+ protected MavenProject project;
+ /**
+ * Le settings (pour obtenir le mode offline).
+ *
+ * @parameter default-value="${settings}"
+ * @readonly
+ * @since 2.0.0
+ */
+ protected Settings settings;
+
+ /**
+ * All available models (obtain by plexus, keys are plexus roles, values are a
+ * instance of corresponding model).
+ *
+ * @component role="org.nuiton.eugene.models.Model"
+ */
+ protected Map<String, Model> _models;
+ /**
+ * All available writers introspects via plexus
+ *
+ * @component role="org.nuiton.eugene.writer.ChainedFileWriter"
+ */
+ protected Map<String, ChainedFileWriter> writers;
+ /**
+ * All available writers introspects via plexus
+ *
+ * @component role="org.nuiton.eugene.ModelReader"
+ */
+ protected Map<String, ModelReader<?>> modelReaders;
+ /**
+ * All available templates introspects via plexus
+ *
+ * @component role="org.nuiton.eugene.Template"
+ */
+ protected Map<String, Template<?>> modelTemplates;
+ /**
+ * The engine to compute {@link org.nuiton.eugene.writer.ChainedFileWriter} from inputs entries.
+ *
+ * @component role="org.nuiton.eugene.writer.ChainedWriterEngine"
+ */
+ protected ChainedWriterEngine engine;
+ /**
+ * class instance of the given {@link #modelType}
+ */
+ protected Class<? extends Model> modelClass;
+ /**
+ * fixed classloader
+ */
+ protected ClassLoader fixedClassLoader;
+
+ @Override
+ protected boolean init() throws Exception {
+ // on recupere le fqn du model à traiter via le container plexus (plus pratique dans ce cas où on veut
+ // pouvoir associé un nom à un type de service).
+ Model model = _models.get(modelType.trim().toLowerCase());
+ if (model == null) {
+ throw new MojoExecutionException("No modelType named '" + modelType + "', use one of " + _models.keySet());
+ }
+ modelClass = model.getClass();
+
+ if (inputs.length == 0) {
+ throw new MojoExecutionException("Must specify something to include using the includes property");
+ }
+ //FIXME-TC20091217 use a configurator in plexus ?
+ // Actually we obtain a different instance of the mojo conflit with mojo and plexus :)
+ engine.setConfiguration(this);
+
+ Set<ChainedFileWriter> availableWriters = engine.getAvailableWriters();
+
+ if (availableWriters.isEmpty()) {
+ throw new MojoExecutionException("Could not find any writer in class-path.");
+ }
+
+ for (ChainedFileWriter writer : availableWriters) {
+ if (writer instanceof BaseChainedFileWriter) {
+ // add log support
+ ((BaseChainedFileWriter) writer).setLog(getLog());
+ }
+ }
+
+ // detect top level writers
+ for (String include : inputs) {
+
+ getLog().info("Register include : " + include);
+ engine.registerInclude(include);
+ }
+
+ if (engine.getSelectedWriters().isEmpty()) {
+ getLog().warn("No phase was detected, skip the goal.");
+ return false;
+ }
+
+ if (properties == null) {
+ properties = new LinkedHashMap<String, Object>();
+ }
+
+ if (engine.containsWriter("xmi")) {
+
+ // add xmi writer support
+
+ ClassLoader loader = getFixedClassLoader();
+
+ properties.put(BaseXmiToChainedFileWriter.PROP_CLASS_LOADER, loader);
+ properties.put(BaseXmiToChainedFileWriter.PROP_FULL_PACKAGE_PATH, fullPackagePath);
+ //properties.put("extractedPackages", extractedPackages);
+ properties.put(BaseXmiToChainedFileWriter.PROP_RESOLVER, resolver);
+ }
+
+ if (engine.containsWriter("model")) {
+
+ // add model writer support
+
+ ClassLoader loader = getFixedClassLoader();
+
+ properties.put(ModelChainedFileWriter.PROP_CLASS_LOADER, loader);
+ properties.put(ModelChainedFileWriter.PROP_MODEL_TYPE, modelType);
+ properties.put(ModelChainedFileWriter.PROP_DEFAULT_PACKAGE, defaultPackage);
+ properties.put(ModelChainedFileWriter.PROP_GENERATED_PACKAGES, generatedPackages);
+ properties.put(ModelChainedFileWriter.PROP_TEMPLATES, templates);
+ properties.put(ModelChainedFileWriter.PROP_EXCLUDE_TEMPLATES, getExcludeTemplatesAsString());
+ }
+
+ return true;
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ if (dryRun) {
+ getLog().warn("dryRun property is set, no file will be generated.");
+ }
+ if (isVerbose()) {
+ if (isTestPhase()) {
+ getLog().info(" using testPhase");
+ }
+ }
+ try {
+
+ List<String> skipInputList = new ArrayList<String>();
+
+ if (!StringUtils.isEmpty(skipInputs)) {
+
+ for (String s : skipInputs.split(",")) {
+ skipInputList.add(s.trim());
+ }
+ }
+
+ // launch writers in incoming order of dicovering of them
+
+ for (ChainedFileWriter writer : engine.getSelectedWriters()) {
+ if (skipInputList.contains(writer.getInputProtocol())) {
+ getLog().info("Skip phase [" + writer.getInputProtocol() + "] as required in skipInputs configuration.");
+ continue;
+ }
+ int size = writer.getEntries().size();
+ if (size == 1) {
+ getLog().info("Process phase [" + writer.getInputProtocol() + "] for one entry.");
+ } else {
+ getLog().info("Process phase [" + writer.getInputProtocol() + "] for " + size + " entries.");
+ }
+ if (dryRun || isVerbose()) {
+ for (ChainedFileWriterEntry entry : writer.getEntries()) {
+ getLog().info(" entry : " + entry.getInputDirectory() + " - " + entry.getIncludePattern());
+ }
+ if (dryRun) {
+ continue;
+ }
+ }
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("Generating files and copying resources...");
+ }
+
+ try {
+ writer.generate(this);
+ } catch (Exception e) {
+ throw new MojoExecutionException("could not generate for writer " + writer.getInputProtocol(), e);
+ }
+
+ if ("model".equals(writer.getInputProtocol())) {
+
+ // must fix source compile roots
+ File outputDir = writer.getOutputDirectory(getOutputDirectory(), isTestPhase());
+
+ fixCompileSourceRoots(outputDir);
+ }
+ }
+
+ } finally {
+ // always clear everything to avoid side-effects in goal is invoked more than once
+ properties.clear();
+ engine.clear();
+ }
+ }
+
+ @Override
+ public File getOutputDirectory() {
+ return outputDirectory;
+ }
+
+ @Override
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ @Override
+ public MavenProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+ @Override
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+ @Override
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+ @Override
+ public String getEncoding() {
+ return encoding;
+ }
+
+ @Override
+ public boolean isOverwrite() {
+ return overwrite;
+ }
+
+ @Override
+ public boolean isOffline() {
+ return settings.isOffline();
+ }
+
+ @Override
+ public boolean isTestPhase() {
+ return testPhase;
+ }
+
+ @Override
+ public Class<? extends Model> getModelClass() {
+ return modelClass;
+ }
+
+ @Override
+ public Map<String, ChainedFileWriter> getWriters() {
+ return writers;
+ }
+
+ @Override
+ public Map<String, ModelReader<?>> getModelReaders() {
+ return modelReaders;
+ }
+
+ @Override
+ public Map<String, Template<?>> getModelTemplates() {
+ return modelTemplates;
+ }
+
+ @Override
+ public File getBasedir() {
+ return getProject().getBasedir();
+ }
+
+ /**
+ * @return the string representation of excludesTemplates (separated by comma)
+ */
+ protected String getExcludeTemplatesAsString() {
+ String result = "";
+ for (int i = 0; i < excludeTemplates.length; i++) {
+ result += excludeTemplates[i];
+ if (i != excludeTemplates.length - 1) {
+ result += ",";
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Prepare le classLoader a utiliser dans le generateur.
+ * <p/>
+ * Si le mojo est en phase de test {@link #testPhase} a été renseigné, target/classes est rajouté.
+ * <p/>
+ * Si des références à des sibling modules, ils seront rajoutés aussi.
+ *
+ * @return le class loader modifie
+ * @throws MojoExecutionException if any pb
+ */
+
+ public ClassLoader getFixedClassLoader() throws MojoExecutionException {
+ if (fixedClassLoader == null) {
+ Set<String> urlsAsString = new HashSet<String>();
+ List<URL> urls = new ArrayList<URL>();
+ try {
+ ClassLoader loader;
+
+ if (testPhase) {
+ File extraClassPathDirectory = new File(getProject().getBuild().getOutputDirectory());
+// if (verbose) {
+ getLog().info("Add in generator's classLoader : " + extraClassPathDirectory);
+// }
+ addDirectoryToUrlsList(extraClassPathDirectory, urls, urlsAsString);
+ }
+ if (project.getProjectReferences() != null) {
+ // this case is for multi-module when calling from a parent module
+ for (Object o : project.getProjectReferences().entrySet()) {
+ Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
+ MavenProject relatedProject = (MavenProject) entry.getValue();
+ if (verbose) {
+ getLog().info("Add project reference in generator's classLoader : '" + relatedProject.getArtifact() + "'");
+ }
+ //TODO il faudrait peut-etre aussi ajouter les dependances ?
+ addDirectoryToUrlsList(relatedProject.getArtifact().getFile(), urls, urlsAsString);
+ }
+ }
+ if (!project.getArtifacts().isEmpty()) {
+ // this is a special case when artifacts were resolved (for example in site phase)
+ if (verbose) {
+ getLog().info("Use resolved artifacts to build class-path");
+ }
+ for (Object o : project.getArtifacts()) {
+ Artifact a = (Artifact) o;
+ if (!a.getScope().equals("provided")) {
+ addDirectoryToUrlsList(a.getFile(), urls, urlsAsString);
+ }
+ }
+ }
+ // we ask to add the directory in classloader
+ loader = getClass().getClassLoader();
+ if (getLog().isDebugEnabled()) {
+ getLog().info("original classloader " + loader);
+ }
+ if (loader instanceof URLClassLoader) {
+ // on reinjecte les urls de loader de base
+ // car sinon on risque de ne pas retrouver les resources...
+ for (URL u : ((URLClassLoader) loader).getURLs()) {
+ addUrlToUrlsList(u, urls, urlsAsString);
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("original cp entry: " + u);
+ }
+ }
+ // et on force l'utilisation du classloader parent
+ // s'il existe
+ if (loader.getParent() != null) {
+ loader = loader.getParent();
+ }
+ }
+ if (!urls.isEmpty()) {
+ loader = new URLClassLoader(urls.toArray(new URL[urls.size()]),
+ loader);
+ }
+ if (getLog().isDebugEnabled()) {
+ for (URL u : urls) {
+ getLog().debug("cp entry: " + u);
+ }
+ }
+ fixedClassLoader = loader;
+ } catch (MalformedURLException e) {
+ throw new MojoExecutionException(e.getMessage());
+ } finally {
+ urls.clear();
+ urlsAsString.clear();
+ }
+ }
+ return fixedClassLoader;
+ }
+
+ /**
+ * permet d'ajout le répertoire de génération des fichiers java dans les répertoires
+ * de compilation du projet Maven.
+ *
+ * @param destDirGen le repertoire a traiter
+ */
+ protected void fixCompileSourceRoots(File destDirGen) {
+
+ //FIXME-TC20091215 : should never have a null project, this is not normal
+ if (project == null) {
+ // no project defined, can not fix anything
+ // this case could appears if we wanted to do some tests of the plugin
+ return;
+ }
+
+ //TODO-TC20091016 should use AbstractPlugin api
+ if (isTestPhase()) {
+ if (!project.getTestCompileSourceRoots().contains(destDirGen.getPath())) {
+ getLog().info("Add test compile source root : " + destDirGen);
+ project.addTestCompileSourceRoot(destDirGen.getPath());
+ Resource resources = new Resource();
+ resources.setDirectory(destDirGen.getAbsolutePath());
+ resources.setExcludes(Arrays.asList("**/*.java"));
+ getLog().info("Add test resource root :" + resources);
+ project.addTestResource(resources);
+ }
+ } else {
+ if (!project.getCompileSourceRoots().contains(destDirGen.getPath())) {
+ getLog().info("Add compile source root : " + destDirGen);
+ project.addCompileSourceRoot(destDirGen.getPath());
+ Resource resources = new Resource();
+ resources.setDirectory(destDirGen.getAbsolutePath());
+ resources.setExcludes(Arrays.asList("**/*.java"));
+ getLog().info("Add resource root :" + resources);
+ project.addResource(resources);
+ }
+ }
+ }
+
+
+}
\ No newline at end of file
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/SmartGenerateMojo.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Copied: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseChainedFileWriter.java (from rev 760, trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseModelFileWriter.java)
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseChainedFileWriter.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseChainedFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,87 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin.writer;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.nuiton.eugene.writer.AbstractChainedFileWriter;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Surcharge de l'implentation abstraite pour avoir le logger de la console maven.
+ *
+ * @author tchemit
+ * @since 2.0.0
+ */
+public abstract class BaseChainedFileWriter extends AbstractChainedFileWriter {
+
+ /**
+ * Logger
+ */
+ private Log log;
+
+ protected BaseChainedFileWriter(String... propertyNameAndDescriptions) {
+ super(propertyNameAndDescriptions);
+ }
+
+ public void setLog(Log log) {
+ this.log = log;
+ }
+
+ public Log getLog() {
+ if (log == null) {
+ log = new SystemStreamLog();
+ }
+
+ return log;
+ }
+
+ @Override
+ protected void initWriter(ChainedFileWriterConfiguration configuration) {
+ super.initWriter(configuration);
+
+ // log writer config
+
+ StringBuilder buffer = new StringBuilder();
+ Set<Map.Entry<String, String>> set = getAuthorizedPropertyDescriptions().entrySet();
+ if (set.isEmpty()) {
+ buffer.append("Writer [").append(getInputProtocol()).append("]").append(" does not use any specific properties.");
+ } else {
+ buffer.append("Writer [").append(getInputProtocol()).append("]").append(" use ").append(properties.size()).append(" properties :");
+ if (getLog().isInfoEnabled()) {
+ for (Map.Entry<String, String> e : set) {
+
+ String key = e.getKey();
+ Object value = properties.get(key);
+ if (value != null) {
+ buffer.append("\n").append(" [").append(key).append("] (").append(e.getValue()).append(") : ").append(value);
+ }
+ }
+ }
+ }
+ getLog().info(buffer.toString());
+ }
+
+
+}
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseModelFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,58 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin.writer;
-
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugin.logging.SystemStreamLog;
-import org.nuiton.eugene.AbstractModelFileWriter;
-
-/**
- * Surcharge de l'implentation abstraite pour avoir le logger de la console maven.
- *
- * @author tchemit
- * @since 2.0.0
- */
-public abstract class BaseModelFileWriter extends AbstractModelFileWriter {
-
- /**
- * Logger
- */
- private Log log;
- public static final String PROP_CLASS_LOADER = "classLoader";
-
- public void setLog(Log log) {
- this.log = log;
- }
-
- public Log getLog() {
- if (log == null) {
- log = new SystemStreamLog();
- }
-
- return log;
- }
-
- public ClassLoader getClassLoader() {
- return getProperty(PROP_CLASS_LOADER, ClassLoader.class);
- }
-
-
-}
Copied: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToChainedFileWriter.java (from rev 761, trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java)
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToChainedFileWriter.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToChainedFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,275 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin.writer;
+
+import org.nuiton.eugene.models.Model;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.plugin.PluginIOContext;
+import org.nuiton.util.FasterCachedResourceResolver;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.Resource;
+import org.nuiton.util.ResourceResolver;
+
+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 java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * Implentation pour les writer to type xmi (qui transforme du xmi via xsl).
+ *
+ * @author tchemit
+ * @since 2.0.0
+ */
+public abstract class BaseXmiToChainedFileWriter extends BaseChainedFileWriter {
+
+ public static final String PROP_RESOLVER = "resolver";
+ // public static final String PROP_EXTRACTED_PACKAGES = "extractedPackages";
+ public static final String PROP_FULL_PACKAGE_PATH = "fullPackagePath";
+ public static final String PROP_CLASS_LOADER = "classLoader";
+
+ public BaseXmiToChainedFileWriter() {
+ super(PROP_CLASS_LOADER, "classLoader", PROP_RESOLVER, "resolver", PROP_FULL_PACKAGE_PATH, "fullPackagePath");
+ }
+
+ /**
+ * Get style sheet.
+ *
+ * @param model the model file used to determine the stylesheet to use
+ * @return the stylesheet name
+ */
+ protected abstract String getStyleSheet(File model);
+
+ /**
+ * Get extension.
+ *
+ * @return the extension
+ */
+ protected abstract String getExtension();
+
+ @Override
+ public String getInputProtocol() {
+ return "xmi";
+ }
+
+ @Override
+ public <M extends Model> String getOutputProtocol(Class<M> modelType) {
+ // next writer : write from model files
+ return "model";
+ }
+
+ @Override
+ public boolean acceptInclude(String include) {
+ return include.startsWith("xmi:") || include.endsWith(".xmi") || include.endsWith(".uml");
+ }
+
+ @Override
+ public String getDefaultIncludes() {
+ return "**/*.xmi";
+ }
+
+ @Override
+ public String getDefaultInputDirectory() {
+ return "src/main/xmi";
+ }
+
+ @Override
+ public String getDefaultOutputDirectory() {
+ return "models";
+ }
+
+ @Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/xmi";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-models";
+ }
+
+ protected TransformerFactory transformerFactory;
+
+ protected TransformerFactory getTransformerFactory() {
+ if (transformerFactory == null) {
+ transformerFactory = TransformerFactory.newInstance();
+ }
+ return transformerFactory;
+ }
+
+ public String getFullPackagePath() {
+ return getProperty(PROP_FULL_PACKAGE_PATH, String.class);
+ }
+
+// public String getExtractedPackages() {
+// return getProperty(PROP_EXTRACTED_PACKAGES, String.class);
+// }
+
+ public String getResolver() {
+ return getProperty(PROP_RESOLVER, String.class);
+ }
+
+
+ public ClassLoader getClassLoader() {
+ return getProperty(PROP_CLASS_LOADER, ClassLoader.class);
+ }
+
+
+ @Override
+ public void generate(ChainedFileWriterConfiguration configuration, File outputDir, File inputDirectory, String includePattern) throws IOException {
+ long t0 = System.nanoTime();
+
+ boolean overwrite = configuration.isOverwrite();
+ try {
+ getLog().info("Processing XSL tranformation on " + inputDirectory + " for " + includePattern);
+
+ getLog().info(" with fullPackagePath : " + getFullPackagePath());
+// getLog().info(" with extractedPackages : " + getExtractedPackages());
+// getLog().info(" with acceptedXmiTypes : " + getFullPackagePath());
+ getLog().info(" with resolver : " + getResolver());
+
+ // recuperation des fichiers a traiter
+ List<File> files = PluginHelper.getIncludedFiles(inputDirectory, new String[]{includePattern}, null);
+
+ // lancement des traitements xsl sur les fichiers trouvés
+ // dans le repertoire
+ actionXsl(configuration, outputDir, inputDirectory, files, overwrite);
+ } finally {
+ getLog().info("xsl done in " + PluginHelper.convertTime(System.nanoTime() - t0));
+ }
+
+ getLog().info("Copy resources files");
+
+ PluginIOContext ioContext = new PluginIOContext();
+ ioContext.setInput(inputDirectory);
+ ioContext.setOutput(outputDir);
+// String[] excludes = getSuffixPattern("**/*");
+ PluginHelper.copyFiles(ioContext, null, new String[]{includePattern}, overwrite);
+ }
+
+
+ protected void actionXsl(ChainedFileWriterConfiguration configuration, File outputDir, File dir, List<File> files, boolean overwrite) throws IOException {
+
+ for (File file : files) {
+ try {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("treate file : " + file);
+ }
+ // Prepare resolver, stylesheet
+ URIResolver fileResolver = getUriResolver(configuration, file);
+ String styleSheet = getStyleSheet(file);
+ URL xsl = Resource.getURL(styleSheet);
+
+ //TC-20090820 : using recursive for xmi
+// File result = new File(destDirModel, FileUtil.basename(file,
+// acceptedSuffixes).concat(".").concat(getExtension()));
+
+ String extension = "." + FileUtil.extension(file);
+ String filename = FileUtil.basename(file, extension).concat(".").concat(getExtension());
+ String relatifPath = file.getParentFile().getAbsolutePath().substring(dir.getAbsolutePath().length());
+ File dstDir = outputDir;
+ if (!relatifPath.isEmpty()) {
+ dstDir = new File(dstDir, relatifPath);
+ if (!dstDir.exists()) {
+ boolean b = dstDir.mkdirs();
+ if (!b) {
+ throw new IOException("could not create directory " + dstDir);
+ }
+ }
+ }
+ File result = new File(dstDir, filename);
+ if (!overwrite && file.lastModified() < result.lastModified()) {
+ getLog().info("file up-to-date : " + result);
+ continue;
+ }
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("generate " + result);
+ }
+
+ // Create the xsl transformer and set parameters
+ Transformer transformer = getTransformerFactory().newTransformer(new StreamSource(xsl.openStream()));
+
+ transformer.setParameter(PROP_FULL_PACKAGE_PATH, getFullPackagePath());
+ //transformer.setParameter("extraPackages", getExtractedPackages());
+
+ transformer.setURIResolver(fileResolver);
+ transformer.transform(new StreamSource(file), new StreamResult(
+ new FileOutputStream(result)));
+
+ } catch (Exception e) {
+ throw new IOException(e.getMessage(), e);
+ }
+ }
+ }
+
+ protected URIResolver getUriResolver(ChainedFileWriterConfiguration configuration, File model) {
+ URIResolver result = null;
+
+ try {
+ ClassLoader loader = getClassLoader();
+ Class<?> clazz = Class.forName(getResolver(), true, loader);
+
+ // Try to set the base using the constructor
+ try {
+ // Look for a constructor with a String parameter (base)
+ Constructor<?> withBaseConstructor = clazz.getConstructor(String.class);
+ // Set the xmi folder as the base
+ String base = model.getParentFile().getAbsolutePath();
+ // Instantiate
+ result = (URIResolver) withBaseConstructor.newInstance(base);
+ } catch (Exception eee) {
+ getLog().warn("Unable to instantiate resolver with String parameter",
+ eee);
+ }
+
+ // If resolver is still not created, create it using the default
+ // constructor
+ if (result == null) {
+ result = (URIResolver) clazz.newInstance();
+ }
+
+ if (result instanceof ResourceResolver) {
+ ((ResourceResolver) result).setVerbose(configuration.isVerbose());
+ ((ResourceResolver) result).setCl(loader);
+ if (result instanceof FasterCachedResourceResolver) {
+ boolean offline = configuration.isOffline();
+ getLog().debug("using offline mode ? : " + offline);
+ ((FasterCachedResourceResolver) result).setOffline(offline);
+ }
+ }
+
+ } catch (Exception eee) {
+ getLog().warn("Unable to instantiate resolver using the default constructor", eee);
+ }
+
+ return result;
+ }
+
+
+}
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,261 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin.writer;
-
-import org.nuiton.eugene.models.Model;
-import org.nuiton.plugin.PluginHelper;
-import org.nuiton.plugin.PluginIOContext;
-import org.nuiton.util.FasterCachedResourceResolver;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.Resource;
-import org.nuiton.util.ResourceResolver;
-
-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 java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.List;
-
-/**
- * Implentation pour les writer to type xmi (qui transforme du xmi via xsl).
- *
- * @author tchemit
- * @since 2.0.0
- */
-public abstract class BaseXmiToModelFileWriter extends BaseModelFileWriter {
- public static final String PROP_RESOLVER = "resolver";
-// public static final String PROP_EXTRACTED_PACKAGES = "extractedPackages";
- public static final String PROP_FULL_PACKAGE_PATH = "fullPackagePath";
-
- /**
- * Get style sheet.
- *
- * @param model the model file used to determine the stylesheet to use
- * @return the stylesheet name
- */
- protected abstract String getStyleSheet(File model);
-
- /**
- * Get extension.
- *
- * @return the extension
- */
- protected abstract String getExtension();
-
- @Override
- public String getInputProtocol() {
- return "xmi";
- }
-
- @Override
- public <M extends Model> String getOutputProtocol(Class<M> modelType) {
- // no next writer : write model files
- return null;
- }
-
- @Override
- public boolean acceptInclude(String include) {
- return include.startsWith("xmi:") || include.endsWith(".xmi") || include.endsWith(".uml");
- }
-
- @Override
- public String getDefaultIncludes() {
- return "**/*.xmi";
- }
-
- @Override
- public String getDefaultInputDirectory() {
- return "src/main/xmi";
- }
-
- @Override
- public String getDefaultOutputDirectory() {
- return "models";
- }
-
- @Override
- public String getDefaultTestInputDirectory() {
- return "src/test/xmi";
- }
-
- @Override
- public String getDefaultTestOutputDirectory() {
- return "test-models";
- }
-
- protected TransformerFactory transformerFactory;
-
- protected TransformerFactory getTransformerFactory() {
- if (transformerFactory == null) {
- transformerFactory = TransformerFactory.newInstance();
- }
- return transformerFactory;
- }
-
- public String getFullPackagePath() {
- return getProperty(PROP_FULL_PACKAGE_PATH, String.class);
- }
-
-// public String getExtractedPackages() {
-// return getProperty(PROP_EXTRACTED_PACKAGES, String.class);
-// }
-
- public String getResolver() {
- return getProperty(PROP_RESOLVER, String.class);
- }
-
-
- @Override
- public void generate(File outputDir, File inputDirectory, String includePattern, boolean overwrite) throws IOException {
- long t0 = System.nanoTime();
- try {
- getLog().info("Processing XSL tranformation on " + inputDirectory + " for " + includePattern);
-
- getLog().info(" with fullPackagePath : " + getFullPackagePath());
-// getLog().info(" with extractedPackages : " + getExtractedPackages());
-// getLog().info(" with acceptedXmiTypes : " + getFullPackagePath());
- getLog().info(" with resolver : " + getResolver());
-
- // recuperation des fichiers a traiter
- List<File> files = PluginHelper.getIncludedFiles(inputDirectory, new String[]{includePattern}, null);
-
- // lancement des traitements xsl sur les fichiers trouvés
- // dans le repertoire
- actionXsl(outputDir, inputDirectory, files, getClassLoader(), overwrite);
- } finally {
- getLog().info("xsl done in " + PluginHelper.convertTime(System.nanoTime() - t0));
- }
-
- getLog().info("Copy resources files");
-
- PluginIOContext ioContext = new PluginIOContext();
- ioContext.setInput(inputDirectory);
- ioContext.setOutput(outputDir);
-// String[] excludes = getSuffixPattern("**/*");
- PluginHelper.copyFiles(ioContext, null, new String[]{includePattern}, overwrite);
- }
-
-
- protected void actionXsl(File outputDir, File dir, List<File> files, ClassLoader fixedClassLoader, boolean overwrite) throws IOException {
-
- for (File file : files) {
- try {
- if (getLog().isDebugEnabled()) {
- getLog().debug("treate file : " + file);
- }
- // Prepare resolver, stylesheet
- URIResolver fileResolver = getUriResolver(file, fixedClassLoader);
- String styleSheet = getStyleSheet(file);
- URL xsl = Resource.getURL(styleSheet);
-
- //TC-20090820 : using recursive for xmi
-// File result = new File(destDirModel, FileUtil.basename(file,
-// acceptedSuffixes).concat(".").concat(getExtension()));
-
- String extension = "." + FileUtil.extension(file);
- String filename = FileUtil.basename(file, extension).concat(".").concat(getExtension());
- String relatifPath = file.getParentFile().getAbsolutePath().substring(dir.getAbsolutePath().length());
- File dstDir = outputDir;
- if (!relatifPath.isEmpty()) {
- dstDir = new File(dstDir, relatifPath);
- if (!dstDir.exists()) {
- boolean b = dstDir.mkdirs();
- if (!b) {
- throw new IOException("could not create directory "+dstDir);
- }
- }
- }
- File result = new File(dstDir, filename);
- if (!overwrite && file.lastModified() < result.lastModified()) {
- getLog().info("file up-to-date : " + result);
- continue;
- }
- if (getLog().isDebugEnabled()) {
- getLog().debug("generate " + result);
- }
-
- // Create the xsl transformer and set parameters
- Transformer transformer = getTransformerFactory().newTransformer(new StreamSource(xsl.openStream()));
-
- transformer.setParameter(PROP_FULL_PACKAGE_PATH, getFullPackagePath());
- //transformer.setParameter("extraPackages", getExtractedPackages());
-
- transformer.setURIResolver(fileResolver);
- transformer.transform(new StreamSource(file), new StreamResult(
- new FileOutputStream(result)));
-
- } catch (Exception e) {
- throw new IOException(e.getMessage(), e);
- }
- }
- }
-
-
- protected URIResolver getUriResolver(File model, ClassLoader cl) {
- URIResolver result = null;
-
- try {
- Class<?> clazz = Class.forName(getResolver(), true, cl);
-
- // Try to set the base using the constructor
- try {
- // Look for a constructor with a String parameter (base)
- Constructor<?> withBaseConstructor = clazz.getConstructor(String.class);
- // Set the xmi folder as the base
- String base = model.getParentFile().getAbsolutePath();
- // Instantiate
- result = (URIResolver) withBaseConstructor.newInstance(base);
- } catch (Exception eee) {
- getLog().warn("Unable to instantiate resolver with String parameter",
- eee);
- }
-
- // If resolver is still not created, create it using the default
- // constructor
- if (result == null) {
- result = (URIResolver) clazz.newInstance();
- }
-
- if (result instanceof ResourceResolver) {
- ((ResourceResolver) result).setVerbose(getConfiguration().isVerbose());
- ((ResourceResolver) result).setCl(cl);
- if (result instanceof FasterCachedResourceResolver) {
- boolean offline = getConfiguration().isOffline();
- getLog().debug("using offline mode ? : " + offline);
- ((FasterCachedResourceResolver) result).setOffline(offline);
- }
- }
-
- } catch (Exception eee) {
- getLog().warn("Unable to instantiate resolver using the default constructor", eee);
- }
-
- return result;
- }
-
-
-}
Added: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ModelChainedFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ModelChainedFileWriter.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ModelChainedFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,265 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin.writer;
+
+import org.apache.commons.lang.StringUtils;
+import org.nuiton.eugene.ModelReader;
+import org.nuiton.eugene.Template;
+import org.nuiton.eugene.models.Model;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.plugin.PluginIOContext;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * To write model files from zargo files.
+ *
+ * @author tchemit
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedFileWriter" role-hint="model2Java"
+ * @since 2.0.0
+ */
+public class ModelChainedFileWriter extends BaseChainedFileWriter {
+
+ public static final String PROP_GENERATED_PACKAGES = "generatedPackages";
+ public static final String PROP_EXCLUDE_TEMPLATES = "excludetemplates";
+ public static final String PROP_TEMPLATES = "templates";
+ public static final String PROP_TEMPLATES_LIST = "templatesList";
+ public static final String PROP_DEFAULT_PACKAGE = "defaultPackage";
+ public static final String PROP_MODEL_READER = "modelReader";
+ public static final String PROP_MODEL_TYPE = "modelType";
+ public static final String PROP_READER = "reader";
+ public static final String PROP_CLASS_LOADER = "classLoader";
+
+ public ModelChainedFileWriter() {
+ super(
+ PROP_TEMPLATES, "templates",
+ PROP_TEMPLATES_LIST, "templatesList",
+ PROP_EXCLUDE_TEMPLATES, "excludetemplates",
+ PROP_READER, "reader",
+ PROP_MODEL_TYPE, "modelType",
+ PROP_MODEL_READER, "modelReader",
+ PROP_GENERATED_PACKAGES, "generatedPackages",
+ PROP_DEFAULT_PACKAGE, "defaultPackage",
+ PROP_CLASS_LOADER, "classLoader");
+ }
+
+ @Override
+ public String getInputProtocol() {
+ return "model";
+ }
+
+ @Override
+ public <M extends Model> String getOutputProtocol(Class<M> modelType) {
+ // nothing after java files
+ return null;
+ }
+
+ @Override
+ public <M extends Model> boolean acceptModel(Class<M> modelType) {
+ // accept all models
+ return true;
+ }
+
+ @Override
+ public boolean acceptInclude(String include) {
+ return include.startsWith("model:") || include.endsWith(".objectmodel") || include.endsWith(".statemodel");
+ }
+
+ @Override
+ public String getDefaultIncludes() {
+ return "**/*.*model";
+ }
+
+ @Override
+ public String getDefaultInputDirectory() {
+ return "src/main/models";
+ }
+
+ @Override
+ public String getDefaultOutputDirectory() {
+ return "java";
+ }
+
+ @Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/models";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-java";
+ }
+
+ public String getDefaultPackage() {
+ return getProperty(PROP_DEFAULT_PACKAGE, String.class);
+ }
+
+ public String[] getExcludeTemplates() {
+ return getProperty(PROP_EXCLUDE_TEMPLATES, String[].class);
+ }
+
+ public String getGeneratedPackages() {
+ return getProperty(PROP_GENERATED_PACKAGES, String.class);
+ }
+
+ public List<Template<Model>> getTemplatesList() {
+ return getProperty(PROP_TEMPLATES_LIST, List.class);
+ }
+
+ public String getTemplates() {
+ return getProperty(PROP_TEMPLATES, String.class);
+ }
+
+ protected ModelReader<?> getModelReader() {
+ return getProperty(PROP_MODEL_READER, ModelReader.class);
+ }
+
+ protected String getReader() {
+ return getProperty(PROP_READER, String.class);
+ }
+
+ protected String getModelType() {
+ return getProperty(PROP_MODEL_TYPE, String.class);
+ }
+
+ public ClassLoader getClassLoader() {
+ return getProperty(PROP_CLASS_LOADER, ClassLoader.class);
+ }
+
+ @Override
+ protected void initWriter(ChainedFileWriterConfiguration configuration) {
+ super.initWriter(configuration);
+
+ // obtain a reader
+ ClassLoader loader = getClassLoader();
+ if (getModelReader() == null) {
+
+ if (getReader() != null) {
+ // use a specific reader
+ String reader = getReader();
+ try {
+ ClassLoader fixedClassLoader = loader;
+ ModelReader<?> modelReader = (ModelReader<?>) Class.forName(reader, true, fixedClassLoader).newInstance();
+ //TODO : should check that the reader is compatible with given modelType
+ properties.put(PROP_MODEL_READER, modelReader);
+ } catch (Exception eee) {
+ throw new IllegalStateException("could not obtain reader " + reader, eee);
+ }
+ } else {
+ String modelType = getModelType();
+ ModelReader<?> modelReader = configuration.getModelReaders().get(modelType);
+ if (modelReader == null) {
+ throw new IllegalStateException("could not find a model reader for modelType : " + modelType + ", availables readers : " + configuration.getModelReaders().values());
+ }
+ properties.put(PROP_MODEL_READER, modelReader);
+ }
+ }
+
+ Properties templateProperties = new Properties();
+ templateProperties.setProperty(Template.PROP_DEFAULT_PACKAGE, getDefaultPackage());
+ templateProperties.setProperty(Template.PROP_OVERWRITE, String.valueOf(configuration.isOverwrite()));
+ templateProperties.setProperty(Template.PROP_ENCODING, configuration.getEncoding());
+ templateProperties.setProperty(Template.PROP_LAST_MODIFIED_SOURCE, String.valueOf(getModelReader().getLastModifiedSource()));
+ String generatedPackages = getGeneratedPackages();
+ if (StringUtils.isEmpty(generatedPackages)) {
+ getLog().info(" generating all packages");
+ } else {
+ templateProperties.put(Template.PROP_GENERATED_PACKAGES, generatedPackages);
+ getLog().info(" generating only for packages " + generatedPackages);
+ }
+
+ // init templates
+
+ List<Template<Model>> templatesList = new ArrayList<Template<Model>>();
+ String[] templatesNames = getTemplates().split(",");
+ for (String templateName : templatesNames) {
+ // remove trailing spaces
+ templateName = templateName.trim();
+ Template<Model> template;
+
+ template = (Template<Model>) configuration.getModelTemplates().get(templateName);
+ if (template == null) {
+ getLog().warn("template [" + templateName + "] is not registred via plexus, try to load it directly");
+ try {
+ template = (Template<Model>) Class.forName(templateName, true, loader).newInstance();
+ } catch (Exception e) {
+ throw new IllegalStateException("Can't obtain template [" + templateName + "] for reason " + e.getMessage(), e);
+ }
+
+ // will use this template
+ templatesList.add(template);
+
+ // set the properties of the template
+ template.setProperties(templateProperties);
+ }
+ }
+
+ properties.put(PROP_TEMPLATES_LIST, templatesList);
+ }
+
+
+ @Override
+ public void generate(ChainedFileWriterConfiguration configuration, File outputDir, File inputDirectory, String includePattern) throws IOException {
+
+ PluginIOContext ioContext = new PluginIOContext();
+ ioContext.setInput(inputDirectory);
+ ioContext.setOutput(outputDir);
+
+ // obtain files
+
+ List<File> modelFiles = new ArrayList<File>();
+ String[] includePatterns = includePattern.split(",");
+
+ getLog().info("Generating from " + inputDirectory + " : " + includePattern);
+
+ for (File srcDirGen : ioContext.getInputs()) {
+
+ if (configuration.isVerbose()) {
+ getLog().info("Search for " + Arrays.toString(includePatterns) + " in " + srcDirGen.getAbsolutePath());
+ }
+ List<File> currentFiles = PluginHelper.getIncludedFiles(srcDirGen, includePatterns, null);
+ modelFiles.addAll(currentFiles);
+ }
+
+ // read the model
+
+ Model model = getModelReader().read(modelFiles.toArray(new File[modelFiles.size()]));
+
+ // apply all templates to the model
+
+ for (Template<Model> template : getTemplatesList()) {
+ getLog().info("Apply " + template.getClass().getSimpleName() + " generator");
+
+ // apply template
+ template.applyTemplate(model, ioContext.getOutput());
+
+ }
+
+
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ModelChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Copied: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelChainedFileWriter.java (from rev 761, trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java)
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelChainedFileWriter.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelChainedFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,135 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin.writer;
+
+import org.nuiton.eugene.models.Model;
+import org.nuiton.eugene.models.object.ObjectModel;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * To write a object model files from xmi files.
+ * <p/>
+ * This {@link org.nuiton.eugene.writer.ChainedFileWriter} transform xmi files to object model file.
+ *
+ * @author tchemit
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedFileWriter" role-hint="xmi2objectmodel"
+ * @since 2.0.0
+ */
+public class XmiToObjectModelChainedFileWriter extends BaseXmiToChainedFileWriter {
+
+ @Override
+ public <M extends Model> boolean acceptModel(Class<M> modelType) {
+ // accept only state models
+ return ObjectModel.class.isAssignableFrom(modelType);
+ }
+
+ @Override
+ public String getExtension() {
+ return "objectmodel";
+ }
+
+ @Override
+ protected String getStyleSheet(File model) {
+ String styleSheet = null;
+
+ String version = getXmiVersion(model);
+ if (version.startsWith("1.")) {
+ styleSheet = "xmi1.2ToObjectModel.xsl";
+ } else if (version.startsWith("2.")) {
+ styleSheet = "xmi2.1ToObjectModel.xsl";
+ } else {
+ getLog().error("Unsupported xmi version [" + version + "]");
+ }
+
+ return styleSheet;
+ }
+
+ /**
+ * Try to find xmi version on a file.
+ *
+ * @param xmiFile file to inspect
+ * @return version or null if version can't have been found
+ */
+ protected String getXmiVersion(File xmiFile) {
+ String version = null;
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+
+ try {
+ SAXParser parser = factory.newSAXParser();
+
+ XmiVersionHandler handler = new XmiVersionHandler();
+ parser.parse(xmiFile, handler);
+
+ version = handler.getVersion();
+ } catch (ParserConfigurationException e) {
+ getLog().debug("Can't parse file as xmi", e);
+ } catch (SAXException e) {
+ getLog().debug("Can't parse file as xmi", e);
+ } catch (IOException e) {
+ getLog().debug("Can't parse file as xmi", e);
+ }
+
+ return version;
+ }
+
+ /**
+ * Sax handler to find xmi version into xmi document.
+ */
+ protected class XmiVersionHandler extends DefaultHandler {
+
+ protected String version = null;
+
+ public XmiVersionHandler() {
+ super();
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException {
+
+ if (qName.equals("XMI")) {
+ version = attributes.getValue("xmi.version");
+ getLog().debug("XMI version found : " + version);
+ }
+
+ if (version == null) {
+ version = attributes.getValue("xmi:version");
+ getLog().debug("XMI version found : " + version);
+ }
+
+ }
+ }
+
+
+}
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,136 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin.writer;
-
-import org.nuiton.eugene.models.Model;
-import org.nuiton.eugene.models.object.ObjectModel;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import java.io.File;
-import java.io.IOException;
-
-/**
- * To write a object model files from xmi files.
- * <p/>
- * This {@link org.nuiton.eugene.ModelFileWriter} transform xmi files to object model file.
- *
- * @author tchemit
- * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="xmi2objectmodel"
- * @since 2.0.0
- */
-public class XmiToObjectModelFileWriter extends BaseXmiToModelFileWriter {
-
-
- @Override
- public <M extends Model> boolean acceptModel(Class<M> modelType) {
- // accept only state models
- return ObjectModel.class.isAssignableFrom(modelType);
- }
-
- @Override
- public String getExtension() {
- return "objectmodel";
- }
-
- @Override
- protected String getStyleSheet(File model) {
- String styleSheet = null;
-
- String version = getXmiVersion(model);
- if (version.startsWith("1.")) {
- styleSheet = "xmi1.2ToObjectModel.xsl";
- } else if (version.startsWith("2.")) {
- styleSheet = "xmi2.1ToObjectModel.xsl";
- } else {
- getLog().error("Unsupported xmi version [" + version + "]");
- }
-
- return styleSheet;
- }
-
- /**
- * Try to find xmi version on a file.
- *
- * @param xmiFile file to inspect
- * @return version or null if version can't have been found
- */
- protected String getXmiVersion(File xmiFile) {
- String version = null;
-
- SAXParserFactory factory = SAXParserFactory.newInstance();
-
- try {
- SAXParser parser = factory.newSAXParser();
-
- XmiVersionHandler handler = new XmiVersionHandler();
- parser.parse(xmiFile, handler);
-
- version = handler.getVersion();
- } catch (ParserConfigurationException e) {
- getLog().debug("Can't parse file as xmi", e);
- } catch (SAXException e) {
- getLog().debug("Can't parse file as xmi", e);
- } catch (IOException e) {
- getLog().debug("Can't parse file as xmi", e);
- }
-
- return version;
- }
-
- /**
- * Sax handler to find xmi version into xmi document.
- */
- protected class XmiVersionHandler extends DefaultHandler {
-
- public String version = null;
-
- public XmiVersionHandler() {
- super();
- }
-
- public String getVersion() {
- return version;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
-
- if (qName.equals("XMI")) {
- version = attributes.getValue("xmi.version");
- getLog().debug("XMI version found : " + version);
- }
-
- if (version == null) {
- version = attributes.getValue("xmi:version");
- getLog().debug("XMI version found : " + version);
- }
-
- }
- }
-
-
-}
Copied: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelChainedFileWriter.java (from rev 760, trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java)
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelChainedFileWriter.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelChainedFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,53 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin.writer;
+
+import org.nuiton.eugene.models.Model;
+import org.nuiton.eugene.models.state.StateModel;
+
+import java.io.File;
+
+/**
+ * To write state model files from xmi files.
+ *
+ * @author tchemit
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedFileWriter" role-hint="xmi2statemodel"
+ * @since 2.0.0
+ */
+public class XmiToStateModelChainedFileWriter extends BaseXmiToChainedFileWriter {
+
+ @Override
+ public <M extends Model> boolean acceptModel(Class<M> modelType) {
+ // accept only state models
+ return StateModel.class.isAssignableFrom(modelType);
+ }
+
+ @Override
+ protected String getExtension() {
+ return "statemodel";
+ }
+
+ @Override
+ protected String getStyleSheet(File model) {
+ //TODO when StateModel will be supported in 2.1, compute the version to resolve the correct stylesheet
+ return "xmi1.2ToStateModel.xsl";
+ }
+}
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,53 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin.writer;
-
-import org.nuiton.eugene.models.Model;
-import org.nuiton.eugene.models.state.StateModel;
-
-import java.io.File;
-
-/**
- * To write state model files from xmi files.
- *
- * @author tchemit
- * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="xmi2statemodel"
- * @since 2.0.0
- */
-public class XmiToStateModelFileWriter extends BaseXmiToModelFileWriter {
-
- @Override
- public <M extends Model> boolean acceptModel(Class<M> modelType) {
- // accept only state models
- return StateModel.class.isAssignableFrom(modelType);
- }
-
- @Override
- protected String getExtension() {
- return "statemodel";
- }
-
- @Override
- protected String getStyleSheet(File model) {
- //TODO when StateModel will be supported in 2.1, compute the version to resolve the correct stylesheet
- return "xmi1.2ToStateModel.xsl";
- }
-}
Copied: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoChainedFileWriter.java (from rev 761, trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java)
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoChainedFileWriter.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoChainedFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -0,0 +1,104 @@
+/*
+ * *##%
+ * EUGene :: Maven plugin
+ * Copyright (C) 2006 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.plugin.writer;
+
+import org.nuiton.eugene.models.Model;
+import org.nuiton.eugene.writer.ChainedFileWriterConfiguration;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.plugin.PluginIOContext;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * To write model files from zargo files.
+ *
+ * @author tchemit
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedFileWriter" role-hint="zargo2xmi"
+ * @since 2.0.0
+ */
+public class ZargoChainedFileWriter extends BaseChainedFileWriter {
+
+ public static final String[] XMI_FILE_FILTER = new String[]{"*.xmi", "**/*.xmi"};
+
+ @Override
+ public String getInputProtocol() {
+ return "zargo";
+ }
+
+ @Override
+ public <M extends Model> String getOutputProtocol(Class<M> modelType) {
+ // next writer to use is a xmi to model one
+ return "xmi";
+ }
+
+ @Override
+ public <M extends Model> boolean acceptModel(Class<M> modelType) {
+ // accept all models
+ return true;
+ }
+
+ @Override
+ public boolean acceptInclude(String include) {
+ return include.startsWith("zargo:") || include.endsWith(".zargo") || include.endsWith(".zuml");
+ }
+
+ @Override
+ public String getDefaultIncludes() {
+ return "**/*.zargo";
+ }
+
+ @Override
+ public String getDefaultInputDirectory() {
+ return "src/main/xmi";
+ }
+
+ @Override
+ public String getDefaultOutputDirectory() {
+ return "xmi";
+ }
+
+ @Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/xmi";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-xmi";
+ }
+
+ @Override
+ public void generate(ChainedFileWriterConfiguration configuration, File outputDir, File inputDirectory, String includePattern) throws IOException {
+
+ boolean overwrite = configuration.isOverwrite();
+
+ PluginIOContext ioContext = new PluginIOContext();
+ ioContext.setInput(inputDirectory);
+ ioContext.setOutput(outputDir);
+
+ getLog().info("Expanding xmi from " + inputDirectory + " : " + includePattern);
+ PluginHelper.expandFiles(ioContext, new String[]{includePattern}, null, XMI_FILE_FILTER, overwrite);
+
+ getLog().info("Copying resources from " + inputDirectory + " : " + includePattern);
+ PluginHelper.copyFiles(ioContext, null, new String[]{includePattern}, overwrite);
+ }
+}
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Deleted: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java 2009-12-18 10:26:52 UTC (rev 765)
@@ -1,101 +0,0 @@
-/*
- * *##%
- * EUGene :: Maven plugin
- * Copyright (C) 2006 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene.plugin.writer;
-
-import org.nuiton.eugene.models.Model;
-import org.nuiton.plugin.PluginHelper;
-import org.nuiton.plugin.PluginIOContext;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * To write model files from zargo files.
- *
- * @author tchemit
- * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="zargo2xmi"
- * @since 2.0.0
- */
-public class ZargoModelFileWriter extends BaseModelFileWriter {
-
- public static final String[] XMI_FILE_FILTER = new String[]{"*.xmi", "**/*.xmi"};
-
- @Override
- public String getInputProtocol() {
- return "zargo";
- }
-
- @Override
- public <M extends Model> String getOutputProtocol(Class<M> modelType) {
- // next writer to use is a xmi to model one
- return "xmi";
- }
-
- @Override
- public <M extends Model> boolean acceptModel(Class<M> modelType) {
- // accept all models
- return true;
- }
-
- @Override
- public boolean acceptInclude(String include) {
- return include.startsWith("zargo:") || include.endsWith(".zargo") || include.endsWith(".zuml");
- }
-
- @Override
- public String getDefaultIncludes() {
- return "**/*.zargo";
- }
-
- @Override
- public String getDefaultInputDirectory() {
- return "src/main/xmi";
- }
-
- @Override
- public String getDefaultOutputDirectory() {
- return "xmi";
- }
-
- @Override
- public String getDefaultTestInputDirectory() {
- return "src/test/xmi";
- }
-
- @Override
- public String getDefaultTestOutputDirectory() {
- return "test-xmi";
- }
-
- @Override
- public void generate(File outputDir, File inputDirectory, String includePattern, boolean overwrite) throws IOException {
-
- PluginIOContext ioContext = new PluginIOContext();
- ioContext.setInput(inputDirectory);
- ioContext.setOutput(outputDir);
-
- getLog().info("Expanding xmi from " + inputDirectory + " : " + includePattern);
- PluginHelper.expandFiles(ioContext, new String[]{includePattern}, null, XMI_FILE_FILTER, overwrite);
-
- getLog().info("Copying resources from " + inputDirectory + " : " + includePattern);
- PluginHelper.copyFiles(ioContext, null, new String[]{includePattern}, overwrite);
- }
-}
1
0
Author: tchemit
Date: 2009-12-18 11:23:09 +0100 (Fri, 18 Dec 2009)
New Revision: 764
Added:
trunk/eugene/src/main/java/org/nuiton/eugene/writer/
trunk/eugene/src/main/java/org/nuiton/eugene/writer/AbstractChainedFileWriter.java
trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriter.java
trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterConfiguration.java
trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterEntry.java
trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedWriterEngine.java
trunk/eugene/src/main/java/org/nuiton/eugene/writer/DefaultChainedWriterEngine.java
trunk/eugene/src/main/java/org/nuiton/eugene/writer/package-info.java
trunk/eugene/src/main/resolver-cache/
trunk/eugene/src/main/resolver-cache/META-INF/
trunk/eugene/src/main/resolver-cache/META-INF/cache/
trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/
trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/
trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um…
trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um…
trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um…
Removed:
trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java
trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java
trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java
trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java
Modified:
trunk/eugene/pom.xml
trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelBuilder.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelClassifierImpl.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelInterfaceImpl.java
Log:
- introduce writer package for the ChainedFileWriter api
- add a resolver-cache (for xmi resolver)
- add addBlock in JavaBuilder
Modified: trunk/eugene/pom.xml
===================================================================
--- trunk/eugene/pom.xml 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/pom.xml 2009-12-18 10:23:09 UTC (rev 764)
@@ -89,7 +89,7 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
+
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@@ -209,6 +209,12 @@
<include>**/*.xsl</include>
</includes>
</resource>
+ <resource>
+ <directory>src/main/resolver-cache</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
</resources>
<plugins>
@@ -246,6 +252,15 @@
</build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-maven-plugin</artifactId>
+ <version>1.3.8</version>
+ </plugin>
+ </plugins>
+ </reporting>
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Deleted: trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -1,154 +0,0 @@
-/*
- * *##%
- * EUGene :: EUGene
- * Copyright (C) 2004 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.nuiton.eugene.ModelFileWriterUtil.ModelFileWriterEntry;
-import org.nuiton.eugene.models.Model;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Abstract implementation of the {@link org.nuiton.eugene.ModelFileWriter}.
- *
- * @author tchemit
- * @since 2.0.0
- */
-public abstract class AbstractModelFileWriter implements ModelFileWriter {
-
- private static final Log log = LogFactory.getLog(AbstractModelFileWriter.class);
- /**
- * entries to treate
- */
- protected List<ModelFileWriterEntry> entries;
- /**
- * previous writer (can be null)
- */
- protected ModelFileWriter previousWriter;
- /**
- * next writer (can be null)
- */
- protected ModelFileWriter nextWriter;
-
- /**
- * common configuration of all writers available in generate method scope
- */
- protected ModelFileWriterConfiguration configuration;
-
- protected AbstractModelFileWriter() {
- entries = new ArrayList<ModelFileWriterEntry>();
- }
-
- /**
- * Generates some files for a given input, output and include pattern.
- *
- * @param outputDir where to generate files
- * @param inputDirectory where to pick up files
- * @param includePattern pattern of files to include
- * @param overwrite {@code true} if should regenerate even if files are up to date
- * @throws IOException for any IO pb.
- */
- protected abstract void generate(File outputDir, File inputDirectory, String includePattern, boolean overwrite) throws IOException;
-
- @Override
- public void clear() {
- entries.clear();
- }
-
- @Override
- public void addEntry(ModelFileWriterEntry entry) {
- entries.add(entry);
- }
-
- @Override
- public <T> T getProperty(String key, Class<T> type) {
- return (T) getConfiguration().getProperties().get(key);
- }
-
- @Override
- public void generate(ModelFileWriterConfiguration configuration) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("[" + getInputProtocol() + "] Start generate with writer " + this);
- }
- this.configuration = configuration;
- try {
- File outputDir = getOutputDirectory(configuration.getOutputDirectory(), configuration.isTestPhase());
-
- if (!outputDir.exists()) {
- if (log.isDebugEnabled()) {
- log.debug("[" + getInputProtocol() + "] Create output directory " + outputDir);
- }
- boolean b = outputDir.mkdirs();
- if (!b) {
- throw new IOException("Could not creat directory " + outputDir);
- }
- }
-
- for (ModelFileWriterEntry e : entries) {
- if (log.isDebugEnabled()) {
- log.debug("[" + getInputProtocol() + "] Will generate entry " + e.getInputDirectory() + " : " + e.getIncludePattern());
- }
- generate(outputDir, e.getInputDirectory(), e.getIncludePattern(), configuration.isOverwrite());
- }
- } finally {
- this.configuration = null;
- }
- }
-
- @Override
- public <M extends Model> String getInputProtocol(Class<M> modelType) {
- // input protocol is the same for all model
- return acceptModel(modelType) ? getInputProtocol() : null;
- }
-
- @Override
- public File getOutputDirectory(File outputBasedir, boolean testPhase) {
- return new File(outputBasedir, testPhase ? getDefaultTestOutputDirectory() : getDefaultOutputDirectory());
- }
-
- @Override
- public List<ModelFileWriterEntry> getEntries() {
- return entries;
- }
-
- /**
- * @return the shared configuration used by the writer
- */
- protected ModelFileWriterConfiguration getConfiguration() {
- return configuration;
- }
-
- protected ModelFileWriter getNextWriter() {
- return nextWriter;
- }
-
- protected ModelFileWriter getPreviousWriter() {
- return previousWriter;
- }
-
- protected void setNextWriter(ModelFileWriter nextWriter) {
- this.nextWriter = nextWriter;
- }
-}
\ No newline at end of file
Deleted: trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -1,151 +0,0 @@
-/*
- * *##%
- * EUGene :: EUGene
- * Copyright (C) 2004 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene;
-
-import org.nuiton.eugene.models.Model;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * Contract to generate model files from any incoming sources (zargo, xmi, ...).
- *
- * User: chemit
- * Date: 27 nov. 2009
- * Time: 11:20:39
- * @since 2.0.0
- */
-public interface ModelFileWriter {
-
- /**
- * @return the accepted incoming protocol
- */
- String getInputProtocol();
-
- /**
- * Obtain the input protocol of this writer given the passed {@code modelType}.
- *
- * @param modelType the type of model used
- * @param <M> the type of model used
- * @return the input protocol or {@code null} if this writer does not accept the type of model
- */
- <M extends Model> String getInputProtocol(Class<M> modelType);
-
- /**
- * Obtain the output protocol of this writer given the passed {@code modelType}.
- *
- * @param modelType the type of model used
- * @param <M> the type of model used
- * @return the output protocol or {@code null} if should not be chained
- */
- <M extends Model> String getOutputProtocol(Class<M> modelType);
-
- /**
- * Test if a type of model can be treated by this writer.
- *
- * @param modelType model type to test
- * @param <M> model type to test
- * @return {@code true} if this writer accept the given type of model, {@code false} otherwise.
- */
- <M extends Model> boolean acceptModel(Class<M> modelType);
-
- /**
- * Test in a entry can be treated by this writer.
- *
- * @param include the include to test
- * @return {@code true} if the writer accept the entry, {@code false} otherwise.
- */
- boolean acceptInclude(String include);
-
- /**
- * @return the default includes files to be treated by the writer (can be an ant-like expression)
- */
- String getDefaultIncludes();
-
- /**
- * @return the defalt relative path where to pick files to treate.
- */
- String getDefaultInputDirectory();
-
- /**
- * @return the defalt relative path where to pick files to treate on a test phase.
- */
- String getDefaultTestInputDirectory();
-
- /**
- * @return the default relative path to add to output basedir
- */
- String getDefaultOutputDirectory();
-
- /**
- * @return the default relative path to add to output basedir on a test phase.
- */
- String getDefaultTestOutputDirectory();
-
- /**
- * Obtain the real directory where to write files.
- * <p/>
- * //FIXME-TC20091126 make this configurable (via the properties)
- *
- * @param outputBasedir the output base directory
- * @param testPhase {@code true} if writer is used in a test phase
- * @return the real output directory where to generate for this particular writer
- */
- File getOutputDirectory(File outputBasedir, boolean testPhase);
-
- /**
- * Generates.
- *
- * @param configuration the share configuration of all writers.
- * @throws IOException if any io pb.
- */
- void generate(ModelFileWriterConfiguration configuration) throws IOException;
-
- /**
- * Clear all internal states
- */
- void clear();
-
- /**
- * Add an entry to treate.
- *
- * @param entry the entry to add to writer
- */
- void addEntry(ModelFileWriterUtil.ModelFileWriterEntry entry);
-
- /**
- * Obtain a writer extra property.
- *
- * @param key the key of required property
- * @param type the type of property
- * @param <T> the type of property
- * @return the property found or {@code null} if not found.
- */
- <T> T getProperty(String key, Class<T> type);
-
-// ModelFileWriterConfiguration getConfiguration();
-
- /**
- * @return the list of all entries registered
- */
- List<ModelFileWriterUtil.ModelFileWriterEntry> getEntries();
-}
Deleted: trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -1,87 +0,0 @@
-/*
- * *##%
- * EUGene :: EUGene
- * Copyright (C) 2004 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene;
-
-import org.nuiton.eugene.models.Model;
-
-import java.io.File;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Shared configuration of a {@link ModelFileWriter}, should be the same for all writers
- * to use at a time.
- *
- * @author tchemit
- * @since 2.0.0
- */
-public interface ModelFileWriterConfiguration {
-
- /**
- * @return the type of model used
- */
- Class<? extends Model> getModelClass();
-
- /**
- * @return project base directory
- */
- File getBasedir();
-
- /**
- * @return base directory where to generate
- */
- File getOutputDirectory();
-
- /**
- * @return {@code true} if must regenerate files even if they are up to date
- */
- boolean isOverwrite();
-
- /**
- * @return {@code true} if build is off-line and should not be able to access outside resources.
- */
- boolean isOffline();
-
- /**
- * @return {@code true} if build is verbose.
- */
- boolean isVerbose();
-
- /**
- * @return {@code true} if build is done on a test phase.
- */
- boolean isTestPhase();
- /**
- * @return encoding to use to read and write files
- */
- String getEncoding();
-
- /**
- * @return Set of all availables writers
- */
- Set<ModelFileWriter> getAvailableWriters();
-
- /**
- * @return properties to pass to writers
- */
- Map<String, Object> getProperties();
-
-}
Deleted: trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -1,331 +0,0 @@
-/*
- * *##%
- * EUGene :: EUGene
- * Copyright (C) 2004 - 2009 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>.
- * ##%*
- */
-package org.nuiton.eugene;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.eugene.models.Model;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * User: chemit
- * Date: 26 nov. 2009
- * Time: 00:18:29
- */
-public class ModelFileWriterUtil {
-
- private static final Log log = LogFactory.getLog(ModelFileWriterUtil.class);
-
- public static void registerInclude(ModelFileWriterConfiguration configuration, String include, List<ModelFileWriter> selectedWriters) {
- if (log.isDebugEnabled()) {
- log.debug(">>>>>>>>>>>>>>>>> [" + include + "]");
- log.debug("Will register include " + "[" + include + "]");
- log.debug("actual selected writers : " + selectedWriters);
- }
- ModelFileWriterEntryType selectedType = null;
- Matcher matcher = null;
-
- // obtain the good type of entry and the corresponding matcher
-
- for (ModelFileWriterEntryType type : ModelFileWriterEntryType.values()) {
- matcher = type.getMatcher(include);
- if (matcher != null) {
- // get a matcher
- selectedType = type;
- break;
- }
- }
-
- if (selectedType == null) {
- // no writer
- throw new IllegalArgumentException("could not find a writer for include pattern : " + include);
- }
-
- // obtain the writer
- ModelFileWriter writer = selectedType.getWriter(configuration, include, matcher);
-
- // create the new entry
-
- ModelFileWriterEntry writerEntry = selectedType.newEntry(configuration, include, matcher, writer);
-
- // register the new entry
-
- writer.addEntry(writerEntry);
- if (!selectedWriters.contains(writer)) {
- // register the writer as to be used
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] Associated with writer " + writer);
- }
- selectedWriters.add(writer);
- }
-
- Class<? extends Model> modelType = configuration.getModelClass();
-
- String outpoutProtocol = writer.getOutputProtocol(modelType);
-
- if (outpoutProtocol == null) {
- // nothing more to do
- if (log.isDebugEnabled()) {
- log.debug("<<<<<<<<<<<<<<<<< [" + include + "]");
- }
- return;
- }
-
- // the writer need the includes of another writer
-
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "]" + " writer " + writer.getClass().getSimpleName() + " require a next writer of protocol " + outpoutProtocol);
- }
-
- ModelFileWriter nextWriter = ((AbstractModelFileWriter)writer).getNextWriter();
- if (nextWriter == null) {
- // the next writer was not initialize, just have to add new entry
-
- nextWriter = getWriterForInputProtocole(configuration.getAvailableWriters(), outpoutProtocol, modelType);
-
- if (nextWriter == null) {
- throw new IllegalArgumentException("could not find a writer for protocole " + outpoutProtocol + " on model " + modelType);
- }
- // chain writer
- ((AbstractModelFileWriter)writer).setNextWriter(nextWriter);
- }
-
- // build the next include to do
-
- String basedirpath = configuration.getBasedir().getAbsolutePath();
-
- String outputpath = writer.getOutputDirectory(configuration.getOutputDirectory(), configuration.isTestPhase()).getAbsolutePath();
-
- String path = outputpath.substring(basedirpath.length() + 1);
-
- String newInclude = outpoutProtocol + ":" + path + ":" + nextWriter.getDefaultIncludes();
-
- registerInclude(configuration, newInclude, selectedWriters);
-
- if (log.isDebugEnabled()) {
- log.debug("<<<<<<<<<<<<<<<<< [" + include + "]");
- }
- }
-
- public static Set<ModelFileWriter> filterWriterForModelType(Map<String, ModelFileWriter> universe, Class<? extends Model> modelType) {
- Set<ModelFileWriter> result = new HashSet<ModelFileWriter>();
- for (ModelFileWriter w : universe.values()) {
- if (w.acceptModel(modelType)) {
- if (log.isDebugEnabled()) {
- log.debug("writer [" + w + "] accept model " + modelType);
- }
- result.add(w);
- }
- }
- return result;
- }
-
- public static ModelFileWriter getWriterForInputProtocole(Set<ModelFileWriter> universe, String inputProtocol, Class<? extends Model> modelType) {
- for (ModelFileWriter writer : universe) {
- if (inputProtocol.equals(writer.getInputProtocol(modelType))) {
- return writer;
- }
- }
- return null;
- }
-
- public static ModelFileWriter getWriterForInclude(Set<ModelFileWriter> universe, String include, Class<? extends Model> modelType) {
- for (ModelFileWriter w : universe) {
- if (w.acceptInclude(include)) {
- return w;
- }
- }
- return null;
- }
-
- /**
- *
- */
- public static class ModelFileWriterEntry {
-
- /**
- *
- */
- protected File inputDirectory;
- /**
- *
- */
- protected String includePattern;
-
- public ModelFileWriterEntry(File inputDirectory, String includePattern) {
- this.inputDirectory = inputDirectory;
- this.includePattern = includePattern;
- }
-
- public String getIncludePattern() {
- return includePattern;
- }
-
- public File getInputDirectory() {
- return inputDirectory;
- }
-
- }
-
- /**
- *
- */
- public enum ModelFileWriterEntryType {
-
- ONLY_PROTOCOL_PATTERN(Pattern.compile("^([a-zA-Z]+)$")) {
-
- @Override
- public ModelFileWriter getWriter(ModelFileWriterConfiguration configuration, String include, Matcher matcher) {
- Set<ModelFileWriter> universe = configuration.getAvailableWriters();
-
- String protocol = matcher.group(1).toLowerCase();
- ModelFileWriter writer = getWriterForInputProtocole(universe, protocol, configuration.getModelClass());
- if (writer == null) {
- throw new IllegalArgumentException("could not find the writer named '" + protocol + "', use one of " + universe);
- }
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] " + "writer = (" + writer + ")");
- }
- return writer;
- }
-
- @Override
- public ModelFileWriterEntry newEntry(ModelFileWriterConfiguration configuration, String include, Matcher matcher, ModelFileWriter writer) {
-
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] " + "detected pattern (" + name() + ")");
- }
-
- ModelFileWriterEntry writerEntry = new ModelFileWriterEntry(
- new File(configuration.getBasedir(), configuration.isTestPhase()?writer.getDefaultTestInputDirectory():writer.getDefaultInputDirectory()),
- writer.getDefaultIncludes()
- );
- return writerEntry;
- }
- },
-
- NO_PROTOCOL_PATTERN(Pattern.compile("^([^:]+):([^:]+)$")) {
- @Override
- public ModelFileWriter getWriter(ModelFileWriterConfiguration configuration, String include, Matcher matcher) {
- Set<ModelFileWriter> universe = configuration.getAvailableWriters();
-
- Class<? extends Model> modelType = configuration.getModelClass();
- // with no protocol pattern
- // pattern is discover from the includes
-
- // discover the writer from the given pattern
- ModelFileWriter writer = getWriterForInclude(universe, include, modelType);
- if (writer == null) {
- throw new IllegalArgumentException("could not find a writer for include " + include);
- }
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] " + "writer = (" + writer + ")");
- }
- return writer;
- }
-
- @Override
- public ModelFileWriterEntry newEntry(ModelFileWriterConfiguration configuration, String include, Matcher matcher, ModelFileWriter writer) {
- // with no protocol pattern
- // pattern is discover from the includes
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] " + "detected pattern (" + name() + ")");
- }
-
- String inputPath = matcher.group(1);
- String includes = matcher.group(2);
-
- ModelFileWriterEntry writerEntry = new ModelFileWriterEntry(
- new File(configuration.getBasedir(), inputPath),
- includes
- );
- return writerEntry;
- }
- },
-
- FULL_PATTERN(Pattern.compile("^(\\w+):([^:]+):([^:]+)$")) {
- @Override
- public ModelFileWriter getWriter(ModelFileWriterConfiguration configuration, String include, Matcher matcher) {
- // with full pattern (protocol + directory + includes)
- // pattern is discover from the includes
-
- Set<ModelFileWriter> universe = configuration.getAvailableWriters();
-
- String protocol = matcher.group(1).toLowerCase();
- ModelFileWriter writer = getWriterForInputProtocole(universe, protocol, configuration.getModelClass());
-
- if (writer == null) {
- throw new IllegalArgumentException("could not find the writer named '" + protocol + "', use one of " + universe);
- }
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] " + "writer = (" + writer + ")");
- }
- return writer;
- }
-
- @Override
- public ModelFileWriterEntry newEntry(ModelFileWriterConfiguration configuration, String include, Matcher matcher, ModelFileWriter writer) {
-
- // with full pattern (protocol + directory + includes)
- // pattern is discover from the includes
- if (log.isDebugEnabled()) {
- log.debug("[" + include + "] " + "detected pattern (" + name() + ")");
- }
-
- String inputPath = matcher.group(2);
- String includes = matcher.group(3);
- ModelFileWriterEntry writerEntry = new ModelFileWriterEntry(
- new File(configuration.getBasedir(), inputPath),
- includes
- );
- return writerEntry;
- }
- };
-
- private final Pattern pattern;
-
- ModelFileWriterEntryType(Pattern pattern) {
- this.pattern = pattern;
- }
-
- public Pattern getPattern() {
- return pattern;
- }
-
- public Matcher getMatcher(String include) {
- Matcher matcher = getPattern().matcher(include);
- return matcher.matches() ? matcher : null;
- }
-
- public abstract ModelFileWriterEntry newEntry(ModelFileWriterConfiguration configuration, String include, Matcher matcher, ModelFileWriter writer);
-
- public abstract ModelFileWriter getWriter(ModelFileWriterConfiguration configuration, String include, Matcher matcher);
- }
-
-
-}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -20,6 +20,7 @@
*/
package org.nuiton.eugene.java;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -322,6 +323,23 @@
}
/**
+ * Add a new block to a classifier.
+ *
+ * @param classifier
+ * @param modifiers
+ * @return a new ObjectModelOperation
+ * @see org.nuiton.eugene.models.object.xml.ObjectModelBuilder#addOperation(org.nuiton.eugene.models.object.ObjectModelClassifier, java.lang.String,java.lang.String, org.nuiton.eugene.models.object.ObjectModelModifier...)
+ */
+ public ObjectModelOperation addBlock(ObjectModelClassifier classifier,
+ ObjectModelModifier... modifiers) {
+ ObjectModelOperationImpl operation = (ObjectModelOperationImpl) modelBuilder.addOperation(classifier, null, null, modifiers);
+ if (Arrays.asList(modifiers).contains(ObjectModelModifier.STATIC)) {
+ operation.setStatic(true);
+ }
+ return operation;
+ }
+
+ /**
* Add a constructor to a class.
*
* @param clazz
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -95,7 +95,7 @@
public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException {
if (log.isInfoEnabled()) {
- log.info("generate class : " + clazz.getName());
+ log.info(clazz.getQualifiedName());
}
preparePrefix(clazz);
@@ -121,8 +121,8 @@
implement += ", ";
}
}
- if (log.isInfoEnabled()) {
- log.info(className+" : super : "+extend+", interfaces : "+implement);
+ if (log.isDebugEnabled()) {
+ log.debug(className+" : super : "+extend+", interfaces : "+implement);
}
generateAnnotations(output, clazz, clazz);
@@ -158,7 +158,7 @@
@Override
public void generateFromInterface(Writer output, ObjectModelInterface interfacez) throws IOException {
if (log.isInfoEnabled()) {
- log.info("generate interface : " + interfacez.getName());
+ log.info(interfacez.getQualifiedName());
}
preparePrefix(interfacez);
@@ -202,18 +202,26 @@
AnnotationsManagerExtension.class);
String[] annotations = managers.getAnnotations(clazz,element);
for (String annotation : annotations) {
- if (!annotation.startsWith("@")) {
- annotation = "@" + annotation;
+ if (!annotation.trim().startsWith("@")) {
+ // add @ prefix
+ annotation = "@" + annotation.trim();
}
-/*{<%=annotation%>
+ if (element instanceof ObjectModelOperation) {
+ annotation = " "+annotation;
+ }
+/*{
+<%=annotation%>}*/
+ }
+ if (element instanceof ObjectModelClassifier) {
+/*{
}*/
- }
+ }
}
@Override
public void generateFromEnum(Writer output, ObjectModelEnumeration enumz) throws IOException {
if (log.isInfoEnabled()) {
- log.info("generate enumeration : " + enumz.getName());
+ log.info(enumz.getQualifiedName());
}
preparePrefix(enumz);
generateHeader(output, enumz); // Imports, package et documentation
@@ -372,6 +380,10 @@
protected void generateOperations(Writer output,ObjectModelClassifier clazz, Collection<ObjectModelOperation> operations) throws IOException {
for (ObjectModelOperation op : operations) {
String opName = op.getName();
+ if (opName == null) {
+ generateBlock(output, clazz, op);
+ continue;
+ }
/*{<%=prefix%> /**
<%=prefix%> * <%=opName%> :
<%=prefix%>}*/
@@ -415,6 +427,9 @@
}
/*{ *)
+}*/
+ generateAnnotations(output, clazz, op);
+/*{
<%=prefix%> <%=opVisibility%> <%=opStatic%><%=opAbstract%><%=opReturn%><%=opName%>(}*/
String comma = "";
for (ObjectModelParameter param : params) {
@@ -433,7 +448,7 @@
}
if (!op.getBodyCode().isEmpty()) {
-/*{<%=prefix%> {<%=op.getBodyCode()%>}
+/*{<%=prefix%> {<%=op.getBodyCode()%><%=prefix%>}
}*/
} else {
@@ -444,4 +459,13 @@
}
}
+ protected void generateBlock(Writer output,ObjectModelClassifier clazz, ObjectModelOperation op) throws IOException {
+ String opStatic = op.isStatic() ? "static " : " ";
+
+/*{<%=prefix%><%=opStatic%>{
+ <%=prefix%><%=op.getBodyCode()%>
+ <%=prefix%>}
+}*/
+ }
+
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -207,4 +207,8 @@
public void addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, String annotation) {
builder.addAnnotation(classifier, element, annotation);
}
+
+ public ObjectModelOperation addBlock(ObjectModelClassifier classifier, ObjectModelModifier... modifiers) {
+ return builder.addBlock(classifier, modifiers);
+ }
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelBuilder.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelBuilder.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelBuilder.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -475,6 +475,8 @@
throw new IllegalArgumentException("can not add a none classifier type " + type);
}
inner.setName(name);
+ inner.setPackage(clazz.getPackageName() + "." + clazz.getName());
+ inner.postInit();
impl.addInnerClassifier(inner);
inner.setObjectModelImpl(impl.getModel());
return inner;
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelClassifierImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelClassifierImpl.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelClassifierImpl.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -173,7 +173,7 @@
@Override
public Collection<ObjectModelOperation> getAllInterfaceOperations(
boolean distinct) {
- Collection<ObjectModelOperation> result = null;
+ Collection<ObjectModelOperation> result;
if (distinct) {
result = new HashSet<ObjectModelOperation>();
} else {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -207,8 +207,8 @@
return null;
}
if (!hasClass(qualifiedClassName)) {
- if (log.isWarnEnabled()) {
- log.warn("Class " + qualifiedClassName + " not found in model");
+ if (log.isDebugEnabled()) {
+ log.debug("Class " + qualifiedClassName + " not found in model");
}
return null;
}
@@ -259,8 +259,8 @@
@Override
public ObjectModelInterface getInterface(String qualifiedInterfaceName) {
ObjectModelInterface result = interfaces.get(qualifiedInterfaceName);
- if (result == null && log.isWarnEnabled()) {
- log.warn("Interface " + qualifiedInterfaceName + " not found in model");
+ if (result == null && log.isDebugEnabled()) {
+ log.debug("Interface " + qualifiedInterfaceName + " not found in model");
}
return result;
}
@@ -292,8 +292,8 @@
@Override
public ObjectModelEnumeration getEnumeration(String qualifiedEnumerationName) {
ObjectModelEnumeration result = enumerations.get(qualifiedEnumerationName);
- if (result == null && log.isWarnEnabled()) {
- log.warn("Enumeration " + qualifiedEnumerationName + " not found in model");
+ if (result == null && log.isDebugEnabled()) {
+ log.debug("Enumeration " + qualifiedEnumerationName + " not found in model");
}
return result;
}
@@ -498,6 +498,12 @@
@Override
@SuppressWarnings("unchecked")
public <O> O getExtension(String reference, Class<O> extensionClass) throws RuntimeException {
+ if (reference == null) {
+ throw new NullPointerException("reference parameter can not be null in method ObjectModelImpl#getExtension");
+ }
+ if (extensionClass == null) {
+ throw new NullPointerException("extensionClass parameter can not be null in method ObjectModelImpl#getExtension.");
+ }
Object object = extensions.get(reference);
O result;
if (object != null && !extensionClass.isAssignableFrom(object.getClass())) {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelInterfaceImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelInterfaceImpl.java 2009-12-17 01:08:01 UTC (rev 763)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelInterfaceImpl.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -21,7 +21,6 @@
import java.util.Iterator;
-import org.nuiton.eugene.models.object.ObjectModelClass;
import org.nuiton.eugene.models.object.ObjectModelClassifier;
import org.nuiton.eugene.models.object.ObjectModelInterface;
Copied: trunk/eugene/src/main/java/org/nuiton/eugene/writer/AbstractChainedFileWriter.java (from rev 761, trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java)
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/AbstractChainedFileWriter.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/AbstractChainedFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,189 @@
+/*
+ * *##%
+ * EUGene :: EUGene
+ * Copyright (C) 2004 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.writer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.eugene.models.Model;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+/**
+ * Abstract implementation of the {@link ChainedFileWriter}.
+ *
+ * @author tchemit
+ * @since 2.0.0
+ */
+public abstract class AbstractChainedFileWriter implements ChainedFileWriter {
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog(AbstractChainedFileWriter.class);
+ /**
+ * entries to treate with this writer
+ */
+ protected List<ChainedFileWriterEntry> entries;
+ /**
+ * previous writer (can be null)
+ */
+ protected ChainedFileWriter previousWriter;
+ /**
+ * next writer (can be null)
+ */
+ protected ChainedFileWriter nextWriter;
+ /**
+ * universe of authorized properties (keys are property names, values are property descriptions).
+ */
+ protected final Map<String, String> authorizedPropertyDescriptions;
+ /**
+ * real properties obtained fro a configuration in {@link #initWriter(ChainedFileWriterConfiguration)} method
+ */
+ protected Map<String, Object> properties;
+
+ protected AbstractChainedFileWriter(String... propertyNameAndDescriptions) {
+ if (propertyNameAndDescriptions.length % 2 != 0) {
+ throw new IllegalArgumentException("propertyNameAndDescriptions must be couple of (property key, property description), but was " + Arrays.toString(propertyNameAndDescriptions));
+ }
+ entries = new ArrayList<ChainedFileWriterEntry>();
+ properties = new TreeMap<String, Object>();
+ Map<String, String> authorizedPropertyDescriptions = new TreeMap<String, String>();
+ for (int i = 0, max = propertyNameAndDescriptions.length / 2; i < max; i++) {
+ authorizedPropertyDescriptions.put(propertyNameAndDescriptions[2 * i], propertyNameAndDescriptions[2 * i + 1]);
+ }
+ this.authorizedPropertyDescriptions = Collections.unmodifiableMap(authorizedPropertyDescriptions);
+ }
+
+ /**
+ * Generates some files for a given input, output and include pattern.
+ *
+ * @param configuration the shared configuration for all writers
+ * @param outputDir where to generate files
+ * @param inputDirectory where to pick up files
+ * @param includePattern pattern of files to include
+ * @throws IOException for any IO pb.
+ */
+ protected abstract void generate(ChainedFileWriterConfiguration configuration, File outputDir, File inputDirectory, String includePattern) throws IOException;
+
+ @Override
+ public Map<String, String> getAuthorizedPropertyDescriptions() {
+ return authorizedPropertyDescriptions;
+ }
+
+ @Override
+ public String[] getAuthorizedPropertyNames() {
+ Set<String> keys = authorizedPropertyDescriptions.keySet();
+ return keys.toArray(new String[keys.size()]);
+ }
+
+ @Override
+ public void clear() {
+ entries.clear();
+ properties.clear();
+ }
+
+ @Override
+ public void addEntry(ChainedFileWriterEntry entry) {
+ entries.add(entry);
+ }
+
+ @Override
+ public <T> T getProperty(String key, Class<T> type) {
+ return (T) properties.get(key);
+ }
+
+ @Override
+ public void generate(ChainedFileWriterConfiguration configuration) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("[" + getInputProtocol() + "] Start generate with writer " + this);
+ }
+ initWriter(configuration);
+
+ try {
+ File outputDir = getOutputDirectory(configuration.getOutputDirectory(), configuration.isTestPhase());
+
+ if (!outputDir.exists()) {
+ if (log.isDebugEnabled()) {
+ log.debug("[" + getInputProtocol() + "] Create output directory " + outputDir);
+ }
+ boolean b = outputDir.mkdirs();
+ if (!b) {
+ throw new IOException("Could not creat directory " + outputDir);
+ }
+ }
+
+ for (ChainedFileWriterEntry e : entries) {
+ if (log.isDebugEnabled()) {
+ log.debug("[" + getInputProtocol() + "] Will generate entry " + e.getInputDirectory() + " : " + e.getIncludePattern());
+ }
+ generate(configuration, outputDir, e.getInputDirectory(), e.getIncludePattern());
+ }
+ } finally {
+ clear();
+ }
+ }
+
+ @Override
+ public <M extends Model> String getInputProtocol(Class<M> modelType) {
+ // input protocol is the same for all model
+ return acceptModel(modelType) ? getInputProtocol() : null;
+ }
+
+ @Override
+ public File getOutputDirectory(File outputBasedir, boolean testPhase) {
+ return new File(outputBasedir, testPhase ? getDefaultTestOutputDirectory() : getDefaultOutputDirectory());
+ }
+
+ @Override
+ public List<ChainedFileWriterEntry> getEntries() {
+ return entries;
+ }
+
+ protected ChainedFileWriter getNextWriter() {
+ return nextWriter;
+ }
+
+ protected ChainedFileWriter getPreviousWriter() {
+ return previousWriter;
+ }
+
+ protected void setNextWriter(ChainedFileWriter nextWriter) {
+ this.nextWriter = nextWriter;
+ }
+
+ /**
+ * Initialize the writer before the generation.
+ *
+ * @param configuration the configuration to use for int
+ */
+ protected void initWriter(ChainedFileWriterConfiguration configuration) {
+ Map<String, Object> map = configuration.getProperties();
+
+ for (String key : getAuthorizedPropertyNames()) {
+ //TODO-TC-20091217, should prefix keys by the inputProtocol to avoid collisions ?
+ if (map.containsKey(key)) {
+ // keep this property
+ properties.put(key, map.get(key));
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/writer/AbstractChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Copied: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriter.java (from rev 761, trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java)
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriter.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriter.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,162 @@
+/*
+ * *##%
+ * EUGene :: EUGene
+ * Copyright (C) 2004 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.writer;
+
+import org.nuiton.eugene.models.Model;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Contract to generate files from any incoming sources (zargo, xmi, ...) to any other ones.
+ * <p/>
+ * User: chemit
+ * Date: 27 nov. 2009
+ * Time: 11:20:39
+ *
+ * @since 2.0.0
+ */
+public interface ChainedFileWriter {
+
+ /**
+ * @return the accepted incoming protocol
+ */
+ String getInputProtocol();
+
+ /**
+ * Obtain the input protocol of this writer given the passed {@code modelType}.
+ *
+ * @param modelType the type of model used
+ * @param <M> the type of model used
+ * @return the input protocol or {@code null} if this writer does not accept the type of model
+ */
+ <M extends Model> String getInputProtocol(Class<M> modelType);
+
+ /**
+ * Obtain the output protocol of this writer given the passed {@code modelType}.
+ *
+ * @param modelType the type of model used
+ * @param <M> the type of model used
+ * @return the output protocol or {@code null} if should not be chained
+ */
+ <M extends Model> String getOutputProtocol(Class<M> modelType);
+
+ /**
+ * Test if a type of model can be treated by this writer.
+ *
+ * @param modelType model type to test
+ * @param <M> model type to test
+ * @return {@code true} if this writer accept the given type of model, {@code false} otherwise.
+ */
+ <M extends Model> boolean acceptModel(Class<M> modelType);
+
+ /**
+ * Test in a entry can be treated by this writer.
+ *
+ * @param include the include to test
+ * @return {@code true} if the writer accept the entry, {@code false} otherwise.
+ */
+ boolean acceptInclude(String include);
+
+ /**
+ * @return the default includes files to be treated by the writer (can be an ant-like expression)
+ */
+ String getDefaultIncludes();
+
+ /**
+ * @return the defalt relative path where to pick files to treate.
+ */
+ String getDefaultInputDirectory();
+
+ /**
+ * @return the defalt relative path where to pick files to treate on a test phase.
+ */
+ String getDefaultTestInputDirectory();
+
+ /**
+ * @return the default relative path to add to output basedir
+ */
+ String getDefaultOutputDirectory();
+
+ /**
+ * @return the default relative path to add to output basedir on a test phase.
+ */
+ String getDefaultTestOutputDirectory();
+
+ /**
+ * Obtain the real directory where to write files.
+ * <p/>
+ * //FIXME-TC20091126 make this configurable (via the properties)
+ *
+ * @param outputBasedir the output base directory
+ * @param testPhase {@code true} if writer is used in a test phase
+ * @return the real output directory where to generate for this particular writer
+ */
+ File getOutputDirectory(File outputBasedir, boolean testPhase);
+
+ /**
+ * Generates.
+ *
+ * @param configuration the share configuration of all writers.
+ * @throws IOException if any io pb.
+ */
+ void generate(ChainedFileWriterConfiguration configuration) throws IOException;
+
+ /**
+ * Clear all internal states
+ */
+ void clear();
+
+ /**
+ * Add an entry to treate.
+ *
+ * @param entry the entry to add to writer
+ */
+ void addEntry(ChainedFileWriterEntry entry);
+
+ /**
+ * @return the array of properties names authorized for the chanied writer.
+ */
+ String[] getAuthorizedPropertyNames();
+
+ /**
+ * @return the dictionnary of authorized property descriptions (keys are property names and
+ * values are descriptions).
+ */
+ Map<String, String> getAuthorizedPropertyDescriptions();
+
+ /**
+ * Obtain a writer extra property.
+ *
+ * @param key the key of required property
+ * @param type the type of property
+ * @param <T> the type of property
+ * @return the property found or {@code null} if not found.
+ */
+ <T> T getProperty(String key, Class<T> type);
+
+ /**
+ * @return the list of all entries registered
+ */
+ List<ChainedFileWriterEntry> getEntries();
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriter.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Copied: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterConfiguration.java (from rev 761, trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java)
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterConfiguration.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterConfiguration.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,99 @@
+/*
+ * *##%
+ * EUGene :: EUGene
+ * Copyright (C) 2004 - 2009 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>.
+ * ##%*
+ */
+package org.nuiton.eugene.writer;
+
+import org.nuiton.eugene.ModelReader;
+import org.nuiton.eugene.Template;
+import org.nuiton.eugene.models.Model;
+
+import java.io.File;
+import java.util.Map;
+
+/**
+ * Shared configuration of a {@link ChainedFileWriter}, should be the same for all writers
+ * to use at a time.
+ *
+ * @author tchemit
+ * @since 2.0.0
+ */
+public interface ChainedFileWriterConfiguration {
+
+ /**
+ * @return the type of model used
+ */
+ Class<? extends Model> getModelClass();
+
+ /**
+ * @return project base directory
+ */
+ File getBasedir();
+
+ /**
+ * @return base directory where to generate
+ */
+ File getOutputDirectory();
+
+ /**
+ * @return {@code true} if must regenerate files even if they are up to date
+ */
+ boolean isOverwrite();
+
+ /**
+ * @return {@code true} if build is off-line and should not be able to access outside resources.
+ */
+ boolean isOffline();
+
+ /**
+ * @return {@code true} if build is verbose.
+ */
+ boolean isVerbose();
+
+ /**
+ * @return {@code true} if build is done on a test phase.
+ */
+ boolean isTestPhase();
+
+ /**
+ * @return encoding to use to read and write files
+ */
+ String getEncoding();
+
+ /**
+ * @return the universe of availables writers
+ */
+ Map<String, ChainedFileWriter> getWriters();
+
+ /**
+ * @return the universe of available model readers
+ */
+ Map<String, ModelReader<?>> getModelReaders();
+
+ /**
+ * @return the universe of available model templates
+ */
+ Map<String, Template<?>> getModelTemplates();
+
+ /**
+ * @return properties to pass to writers
+ */
+ Map<String, Object> getProperties();
+
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterConfiguration.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterEntry.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterEntry.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterEntry.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,32 @@
+package org.nuiton.eugene.writer;
+
+import java.io.File;
+
+/**
+ *
+ */
+public class ChainedFileWriterEntry {
+
+ /**
+ *
+ */
+ protected File inputDirectory;
+ /**
+ *
+ */
+ protected String includePattern;
+
+ public ChainedFileWriterEntry(File inputDirectory, String includePattern) {
+ this.inputDirectory = inputDirectory;
+ this.includePattern = includePattern;
+ }
+
+ public String getIncludePattern() {
+ return includePattern;
+ }
+
+ public File getInputDirectory() {
+ return inputDirectory;
+ }
+
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedFileWriterEntry.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedWriterEngine.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedWriterEngine.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedWriterEngine.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,46 @@
+package org.nuiton.eugene.writer;
+
+import org.nuiton.eugene.models.Model;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Contract of the chained writer engine.
+ * <p/>
+ * You can register inputs via the method {@link #registerInclude(String)}.
+ * <p/>
+ * And later obtain of the selected writers for your inputs via the method {@link #getSelectedWriters()}.
+ * <p/>
+ * Created: 17 déc. 2009
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ * @since 2.0.0
+ */
+public interface ChainedWriterEngine {
+
+ ChainedFileWriterConfiguration getConfiguration();
+
+ void setConfiguration(ChainedFileWriterConfiguration configuration);
+
+ Set<ChainedFileWriter> getAvailableWriters();
+
+ List<ChainedFileWriter> getSelectedWriters();
+
+ boolean containsWriter(String inputProtocol);
+
+ Set<ChainedFileWriter> filterWriterForModelType(Map<String, ChainedFileWriter> universe, Class<? extends Model> modelType);
+
+ ChainedFileWriter getWriterForInputProtocol(Set<ChainedFileWriter> universe, String inputProtocol, Class<? extends Model> modelType);
+
+ ChainedFileWriter getWriterForInclude(Set<ChainedFileWriter> universe, String include, Class<? extends Model> modelType);
+
+ void registerInclude(String include);
+
+ void clear();
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/writer/ChainedWriterEngine.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/eugene/src/main/java/org/nuiton/eugene/writer/DefaultChainedWriterEngine.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/DefaultChainedWriterEngine.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/DefaultChainedWriterEngine.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,371 @@
+package org.nuiton.eugene.writer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.eugene.models.Model;
+
+import java.io.File;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Default implementation of the {@link org.nuiton.eugene.writer.ChainedWriterEngine}.
+ * <p/>
+ * Created: 17 déc. 2009
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ * @plexus.component role="org.nuiton.eugene.writer.ChainedWriterEngine" role-hint="default"
+ * @since 2.0.0
+ */
+public class DefaultChainedWriterEngine implements ChainedWriterEngine {
+
+ /**
+ * Logger
+ */
+ private static final Log log = LogFactory.getLog(DefaultChainedWriterEngine.class);
+ /**
+ * shared configuration
+ */
+ protected ChainedFileWriterConfiguration configuration;
+ /**
+ * available writers corresponding to the given configuration
+ */
+ protected Set<ChainedFileWriter> availableWriters;
+ /**
+ * selected writers obtain while the register phase.
+ */
+ protected List<ChainedFileWriter> selectedWriters;
+
+ @Override
+ public ChainedFileWriterConfiguration getConfiguration() {
+ return configuration;
+ }
+
+ @Override
+ public void setConfiguration(ChainedFileWriterConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ @Override
+ public List<ChainedFileWriter> getSelectedWriters() {
+ if (selectedWriters == null) {
+ checkConfiguration("getSelectedWriters");
+ selectedWriters = new ArrayList<ChainedFileWriter>();
+ }
+ return selectedWriters;
+ }
+
+ @Override
+ public boolean containsWriter(String inputProtocol) {
+ for (ChainedFileWriter w : getSelectedWriters()) {
+ if (inputProtocol.equals(w.getInputProtocol())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Set<ChainedFileWriter> getAvailableWriters() {
+ if (availableWriters == null) {
+ checkConfiguration("getAvailableWriters");
+ availableWriters = filterWriterForModelType(getConfiguration().getWriters(), getConfiguration().getModelClass());
+ }
+ return availableWriters;
+ }
+
+ @Override
+ public void registerInclude(String include) {
+ checkConfiguration("registerInclude");
+
+ List<ChainedFileWriter> selectedWriters = getSelectedWriters();
+
+ if (log.isDebugEnabled()) {
+ log.debug(">>>>>>>>>>>>>>>>> [" + include + "]");
+ log.debug("Will register include " + "[" + include + "]");
+ log.debug("actual selected writers : " + selectedWriters);
+ }
+ ModelFileWriterEntryType selectedType = null;
+ Matcher matcher = null;
+
+ // obtain the good type of entry and the corresponding matcher
+
+ for (ModelFileWriterEntryType type : ModelFileWriterEntryType.values()) {
+ matcher = type.getMatcher(include);
+ if (matcher != null) {
+ // get a matcher
+ selectedType = type;
+ break;
+ }
+ }
+
+ if (selectedType == null) {
+ // no writer
+ throw new IllegalArgumentException("could not find a writer for include pattern : " + include);
+ }
+
+ // obtain the writer
+ ChainedFileWriter writer = selectedType.getWriter(this, include, matcher);
+
+ // create the new entry
+
+ ChainedFileWriterEntry writerEntry = selectedType.newEntry(this, include, matcher, writer);
+
+ // register the new entry
+
+ writer.addEntry(writerEntry);
+ if (!selectedWriters.contains(writer)) {
+ // register the writer as to be used
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] Associated with writer " + writer);
+ }
+ selectedWriters.add(writer);
+ }
+
+ ChainedFileWriterConfiguration configuration = getConfiguration();
+
+ Class<? extends Model> modelType = configuration.getModelClass();
+
+ String outpoutProtocol = writer.getOutputProtocol(modelType);
+
+ if (outpoutProtocol == null) {
+ // nothing more to do
+ if (log.isDebugEnabled()) {
+ log.debug("<<<<<<<<<<<<<<<<< [" + include + "]");
+ }
+ return;
+ }
+
+ // the writer need the includes of another writer
+
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "]" + " writer " + writer.getClass().getSimpleName() + " require a next writer of protocol " + outpoutProtocol);
+ }
+
+ ChainedFileWriter nextWriter = ((AbstractChainedFileWriter) writer).getNextWriter();
+ if (nextWriter == null) {
+ // the next writer was not initialize, just have to add new entry
+
+ nextWriter = getWriterForInputProtocol(getAvailableWriters(), outpoutProtocol, modelType);
+
+ if (nextWriter == null) {
+ throw new IllegalArgumentException("could not find a writer for protocole " + outpoutProtocol + " on model " + modelType);
+ }
+ // chain writer
+ ((AbstractChainedFileWriter) writer).setNextWriter(nextWriter);
+ }
+
+ // build the next include to do
+
+ String basedirpath = configuration.getBasedir().getAbsolutePath();
+
+ String outputpath = writer.getOutputDirectory(configuration.getOutputDirectory(), configuration.isTestPhase()).getAbsolutePath();
+
+ String path = outputpath.substring(basedirpath.length() + 1);
+
+ String newInclude = outpoutProtocol + ":" + path + ":" + nextWriter.getDefaultIncludes();
+
+ registerInclude(newInclude);
+
+ if (log.isDebugEnabled()) {
+ log.debug("<<<<<<<<<<<<<<<<< [" + include + "]");
+ }
+ }
+
+ @Override
+ public void clear() {
+ if (selectedWriters != null) {
+ selectedWriters.clear();
+ selectedWriters = null;
+ }
+ if (availableWriters != null) {
+ availableWriters.clear();
+ availableWriters = null;
+ }
+ setConfiguration(null);
+ }
+
+ @Override
+ public Set<ChainedFileWriter> filterWriterForModelType(Map<String, ChainedFileWriter> universe, Class<? extends Model> modelType) {
+ Set<ChainedFileWriter> result = new HashSet<ChainedFileWriter>();
+ for (ChainedFileWriter w : universe.values()) {
+ if (w.acceptModel(modelType)) {
+ if (log.isDebugEnabled()) {
+ log.debug("writer [" + w + "] accept model " + modelType);
+ }
+ result.add(w);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public ChainedFileWriter getWriterForInputProtocol(Set<ChainedFileWriter> universe, String inputProtocol, Class<? extends Model> modelType) {
+ for (ChainedFileWriter writer : universe) {
+ if (inputProtocol.equals(writer.getInputProtocol(modelType))) {
+ return writer;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public ChainedFileWriter getWriterForInclude(Set<ChainedFileWriter> universe, String include, Class<? extends Model> modelType) {
+ for (ChainedFileWriter w : universe) {
+ if (w.acceptInclude(include)) {
+ return w;
+ }
+ }
+ return null;
+ }
+
+ protected void checkConfiguration(String method) throws IllegalStateException {
+ if (getConfiguration() == null) {
+ throw new IllegalStateException("can not acces to " + method + "before configuration is set!");
+ }
+ }
+
+ /**
+ *
+ */
+ public enum ModelFileWriterEntryType {
+
+ ONLY_PROTOCOL_PATTERN(Pattern.compile("^([a-zA-Z]+)$")) {
+
+ @Override
+ public ChainedFileWriter getWriter(ChainedWriterEngine engine, String include, Matcher matcher) {
+ ChainedFileWriterConfiguration configuration = engine.getConfiguration();
+ Set<ChainedFileWriter> universe = engine.getAvailableWriters();
+
+ String protocol = matcher.group(1).toLowerCase();
+ ChainedFileWriter writer = engine.getWriterForInputProtocol(universe, protocol, configuration.getModelClass());
+ if (writer == null) {
+ throw new IllegalArgumentException("could not find the writer named '" + protocol + "', use one of " + universe);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] " + "writer = (" + writer + ")");
+ }
+ return writer;
+ }
+
+ @Override
+ public ChainedFileWriterEntry newEntry(ChainedWriterEngine engine, String include, Matcher matcher, ChainedFileWriter writer) {
+ ChainedFileWriterConfiguration configuration = engine.getConfiguration();
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] " + "detected pattern (" + name() + ")");
+ }
+
+ ChainedFileWriterEntry writerEntry = new ChainedFileWriterEntry(
+ new File(configuration.getBasedir(), configuration.isTestPhase() ? writer.getDefaultTestInputDirectory() : writer.getDefaultInputDirectory()),
+ writer.getDefaultIncludes()
+ );
+ return writerEntry;
+ }
+ },
+
+ NO_PROTOCOL_PATTERN(Pattern.compile("^([^:]+):([^:]+)$")) {
+ @Override
+ public ChainedFileWriter getWriter(ChainedWriterEngine engine, String include, Matcher matcher) {
+ ChainedFileWriterConfiguration configuration = engine.getConfiguration();
+ Set<ChainedFileWriter> universe = engine.getAvailableWriters();
+
+ Class<? extends Model> modelType = configuration.getModelClass();
+ // with no protocol pattern
+ // pattern is discover from the includes
+
+ // discover the writer from the given pattern
+ ChainedFileWriter writer = engine.getWriterForInclude(universe, include, modelType);
+ if (writer == null) {
+ throw new IllegalArgumentException("could not find a writer for include " + include);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] " + "writer = (" + writer + ")");
+ }
+ return writer;
+ }
+
+ @Override
+ public ChainedFileWriterEntry newEntry(ChainedWriterEngine engine, String include, Matcher matcher, ChainedFileWriter writer) {
+ ChainedFileWriterConfiguration configuration = engine.getConfiguration();
+ // with no protocol pattern
+ // pattern is discover from the includes
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] " + "detected pattern (" + name() + ")");
+ }
+
+ String inputPath = matcher.group(1);
+ String includes = matcher.group(2);
+
+ ChainedFileWriterEntry writerEntry = new ChainedFileWriterEntry(
+ new File(configuration.getBasedir(), inputPath),
+ includes
+ );
+ return writerEntry;
+ }
+ },
+
+ FULL_PATTERN(Pattern.compile("^(\\w+):([^:]+):([^:]+)$")) {
+ @Override
+ public ChainedFileWriter getWriter(ChainedWriterEngine engine, String include, Matcher matcher) {
+ // with full pattern (protocol + directory + includes)
+ // pattern is discover from the includes
+ ChainedFileWriterConfiguration configuration = engine.getConfiguration();
+ Set<ChainedFileWriter> universe = engine.getAvailableWriters();
+
+ String protocol = matcher.group(1).toLowerCase();
+ ChainedFileWriter writer = engine.getWriterForInputProtocol(universe, protocol, configuration.getModelClass());
+
+ if (writer == null) {
+ throw new IllegalArgumentException("could not find the writer named '" + protocol + "', use one of " + universe);
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] " + "writer = (" + writer + ")");
+ }
+ return writer;
+ }
+
+ @Override
+ public ChainedFileWriterEntry newEntry(ChainedWriterEngine engine, String include, Matcher matcher, ChainedFileWriter writer) {
+ ChainedFileWriterConfiguration configuration = engine.getConfiguration();
+ // with full pattern (protocol + directory + includes)
+ // pattern is discover from the includes
+ if (log.isDebugEnabled()) {
+ log.debug("[" + include + "] " + "detected pattern (" + name() + ")");
+ }
+
+ String inputPath = matcher.group(2);
+ String includes = matcher.group(3);
+ ChainedFileWriterEntry writerEntry = new ChainedFileWriterEntry(
+ new File(configuration.getBasedir(), inputPath),
+ includes
+ );
+ return writerEntry;
+ }
+ };
+
+ private final Pattern pattern;
+
+ ModelFileWriterEntryType(Pattern pattern) {
+ this.pattern = pattern;
+ }
+
+ public Pattern getPattern() {
+ return pattern;
+ }
+
+ public Matcher getMatcher(String include) {
+ Matcher matcher = getPattern().matcher(include);
+ return matcher.matches() ? matcher : null;
+ }
+
+ public abstract ChainedFileWriterEntry newEntry(ChainedWriterEngine engine, String include, Matcher matcher, ChainedFileWriter writer);
+
+ public abstract ChainedFileWriter getWriter(ChainedWriterEngine engine, String include, Matcher matcher);
+ }
+
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/writer/DefaultChainedWriterEngine.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Copied: trunk/eugene/src/main/java/org/nuiton/eugene/writer/package-info.java (from rev 760, trunk/eugene/src/main/java/org/nuiton/eugene/package-info.java)
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/writer/package-info.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/writer/package-info.java 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,25 @@
+/*
+ * *##%
+ * EUGene :: EUGene
+ * Copyright (C) 2004 - 2009 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>.
+ * ##%*
+ */
+/**
+ * Eugene writer package : a small framework to chain writers.
+ */
+package org.nuiton.eugene.writer;
+
Added: trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um…
===================================================================
--- trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um… (rev 0)
+++ trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um… 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmi.version="1.2" xmlns:UML="org.omg.xmi.namespace.UML" timestamp="Fri May 02 13:16:12 EDT 2008">
+ <XMI.header> <XMI.documentation>
+ <XMI.exporter>ArgoUML (using Netbeans XMI Writer version 1.0)</XMI.exporter>
+ <XMI.exporterVersion>PRE-0.25.5(5) revised on $Date: 2007-05-12 02:08:08 -0400 (Sat, 12 May 2007) $ </XMI.exporterVersion>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" xmi.version="1.4"/></XMI.header>
+ <XMI.content>
+ <UML:Model xmi.id=".:000000000000087A" name="UML Profile for Java" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref="-64--88-1-3--3c483fe3:119aa9cff00:-8000:00000000000007A3"/>
+ </UML:ModelElement.stereotype>
+ <UML:ModelElement.taggedValue>
+ <UML:TaggedValue xmi.id="-64--88-1-3--3c483fe3:119aa9cff00:-8000:00000000000007A4" isSpecification="false">
+ <UML:TaggedValue.dataValue>This profile contains common Java classes and datatypes which are not contained in the UML Standard Elements profile. It only includes the basics, but may be easily extended to include anything else which is useful.</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.type>
+ <UML:TagDefinition href="http://argouml.org/profiles/uml14/default-uml14.xmi#.:000000000000087C"/>
+ </UML:TaggedValue.type>
+ </UML:TaggedValue>
+ </UML:ModelElement.taggedValue>
+ <UML:Namespace.ownedElement>
+ <UML:Package xmi.id=".:0000000000000869" name="java" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Namespace.ownedElement>
+ <UML:Package xmi.id=".:000000000000085A" name="lang" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id=".:0000000000000850" name="Object" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000851" name="Char" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000852" name="Byte" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000853" name="Boolean" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000854" name="Short" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000855" name="Integer" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000856" name="Long" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000857" name="Float" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000858" name="Double" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000859" name="String" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package xmi.id=".:0000000000000863" name="util" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id=".:000000000000085B" name="Vector" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Interface xmi.id=".:000000000000085C" name="Collection" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:Interface xmi.id=".:000000000000085D" name="Iterator" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:Interface xmi.id=".:000000000000085E" name="List" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:Class xmi.id=".:000000000000085F" name="Date" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000860" name="Time" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Interface xmi.id=".:0000000000000861" name="Set" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:Interface xmi.id=".:0000000000000862" name="SortedSet" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package xmi.id=".:0000000000000866" name="math" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id=".:0000000000000864" name="BigDecimal" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ <UML:Class xmi.id=".:0000000000000865" name="BigInteger" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package xmi.id=".:0000000000000868" name="net" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id=".:0000000000000867" name="URL" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false" isActive="false"/>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:DataType xmi.id=".:000000000000086B" name="void" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:000000000000086C" name="int" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:000000000000086D" name="short" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:000000000000086E" name="long" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:000000000000086F" name="double" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:0000000000000870" name="float" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:0000000000000871" name="char" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:0000000000000872" name="byte" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id=".:0000000000000873" name="boolean" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:Stereotype xmi.id="-64--88-1-3--3c483fe3:119aa9cff00:-8000:00000000000007A3" name="profile" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Model</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+</XMI>
\ No newline at end of file
Added: trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um…
===================================================================
--- trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um… (rev 0)
+++ trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/um… 2009-12-18 10:23:09 UTC (rev 764)
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmi.version="1.2" xmlns:UML="org.omg.xmi.namespace.UML" timestamp="Tue Aug 14 18:51:04 BRT 2007">
+ <XMI.header> <XMI.documentation>
+ <XMI.exporter>ArgoUML (using Netbeans XMI Writer version 1.0)</XMI.exporter>
+ <XMI.exporterVersion>PRE-0.25.4(5) revised on $Date: 2007-05-12 03:08:08 -0300 $ </XMI.exporterVersion>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" xmi.version="1.4"/></XMI.header>
+ <XMI.content>
+ <UML:Model xmi.id=".:000000000000087A" name="UML 1.4 Standard Elements" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:ModelElement.taggedValue>
+ <UML:TaggedValue xmi.id=".:000000000000087B" isSpecification="false">
+ <UML:TaggedValue.dataValue>This model contains the UML Standard Elements from Appendix A of the UML 1.4 specification.</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.type>
+ <UML:TagDefinition xmi.idref=".:000000000000087C"/>
+ </UML:TaggedValue.type>
+ </UML:TaggedValue>
+ </UML:ModelElement.taggedValue>
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype xmi.id=".:0000000000000821" name="access" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Permission</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000822" name="friend" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Permission</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000823" name="import" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Permission</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000824" name="association" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>AssociationEnd</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000825" name="global" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>AssociationEnd</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000826" name="local" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>AssociationEnd</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000827" name="parameter" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>AssociationEnd</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000828" name="self" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>AssociationEnd</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000829" name="become" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Flow</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000082A" name="copy" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Flow</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000082B" name="create" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Usage</UML:Stereotype.baseClass>
+ <UML:Stereotype.baseClass>BehavioralFeature</UML:Stereotype.baseClass>
+ <UML:Stereotype.baseClass>CallEvent</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000082C" name="call" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Usage</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000082D" name="instantiate" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Usage</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000082E" name="send" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Usage</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000830" name="destroy" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>BehavioralFeature</UML:Stereotype.baseClass>
+ <UML:Stereotype.baseClass>CallEvent</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000833" name="derive" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000834" name="realize" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000835" name="refine" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000836" name="trace" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000837" name="document" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000838" name="executable" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000839" name="file" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000083A" name="library" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000083B" name="table" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000083C" name="facade" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000083D" name="framework" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000083E" name="metamodel" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000083F" name="stub" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000840" name="implementation" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Generalization</UML:Stereotype.baseClass>
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000842" name="type" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000843" name="implicit" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Association</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000844" name="invariant" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Constraint</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000845" name="postcondition" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Constraint</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000846" name="precondition" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Constraint</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000847" name="metaclass" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000848" name="powertype" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000849" name="process" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Classifier</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000084A" name="thread" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Classifier</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000084B" name="utility" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Classifier</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000084C" name="requirement" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Comment</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000084D" name="responsibility" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Comment</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000084E" name="topLevel" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000084F" name="systemModel" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:000000000000086A" name="signalflow" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>ObjectFlowState</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000874" name="appliedProfile" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ <UML:Stereotype.baseClass>Dependency</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000875" name="auxiliary" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000876" name="modelLibrary" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ <UML:Stereotype.baseClass>Dependency</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000877" name="profile" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Package</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000878" name="source" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id=".:0000000000000879" name="stateInvariant" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Stereotype.baseClass>Constraint</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:TagDefinition xmi.id=".:000000000000087C" name="documentation" isSpecification="false" tagType="String">
+ <UML:TagDefinition.multiplicity>
+ <UML:Multiplicity xmi.id=".:000000000000087D">
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id=".:000000000000087E" lower="0" upper="1"/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:TagDefinition.multiplicity>
+ </UML:TagDefinition>
+ <UML:DataType xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:000000000000087C" name="Integer" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:000000000000087D" name="UnlimitedInteger" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:DataType xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:000000000000087E" name="String" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false"/>
+ <UML:Enumeration xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:0000000000000880" name="Boolean" isSpecification="false" isRoot="false" isLeaf="false" isAbstract="false">
+ <UML:Enumeration.literal>
+ <UML:EnumerationLiteral xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:0000000000000881" name="TRUE" isSpecification="false"/>
+ <UML:EnumerationLiteral xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:0000000000000882" name="FALSE" isSpecification="false"/>
+ </UML:Enumeration.literal>
+ </UML:Enumeration>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+</XMI>
\ No newline at end of file
1
0
r763 - in trunk/eugene/src/main/java/org/nuiton/eugene: . java models/object models/object/xml
by tchemit@users.nuiton.org 17 Dec '09
by tchemit@users.nuiton.org 17 Dec '09
17 Dec '09
Author: tchemit
Date: 2009-12-17 02:08:01 +0100 (Thu, 17 Dec 2009)
New Revision: 763
Added:
trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManager.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManagerExtension.java
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/GeneratorUtil.java
trunk/eugene/src/main/java/org/nuiton/eugene/ImportsManager.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/ImportsManagerExtension.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java
trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelElementImpl.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java
Log:
- no more javadoc warning :) (but still a lot to do on it...)
- introduce annotations extension and use it in JavaBuilder and the java generators api
- little improvement codes in importsManagerExtension
- comment unused assigments
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/GeneratorUtil.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/GeneratorUtil.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/GeneratorUtil.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -60,7 +60,8 @@
}
/**
- * return class name fr given fully qualified name (return given name if it is not fully qualified)
+ * @param qualifiedName the fully qualified name to test
+ * @return class name fr given fully qualified name (return given name if it is not fully qualified)
* eg : org.nuiton.eugene.models.ObjectClass -> ObjectClass
* eg : ObjectClass-> ObjectClass
*/
@@ -75,8 +76,8 @@
/**
*
- * @param qualifiedName
- * @return
+ * @param qualifiedName the fully qualified name to test
+ * @return the filename for the given qualified name.
*/
public static String getFilenameFromQualifiedName(String qualifiedName) {
return qualifiedName.replace('.', File.separatorChar);
@@ -84,8 +85,9 @@
/**
* return all classifiers belonging to the given package recursively. The Collection may be empty.
- * @param model
- * @param packageName
+ *
+ * @param model the model where to look at
+ * @param packageName the package name to set for classifiers
* @see ObjectModelClassifier
*
* @return a Collection containing all classifiers belonging to the given package recursively.
@@ -102,8 +104,8 @@
}
/**
- * @param attribute
- * @return
+ * @param attribute the attribute to test
+ * @return the type of the given attribute
* @see #getAttributeType(ObjectModelParameter, boolean)
*/
public static String getAttributeType(ObjectModelParameter attribute) {
@@ -114,8 +116,8 @@
* Retourne le type de l'attribut, c-a-d une List ou une collection
* ou le type defini si la cardinalité n'est pas multiple
*
- * @param attribute
- * @param useGenerics
+ * @param attribute the attribute to test
+ * @param useGenerics {@code true} if the attribute use a generic type
* @return attribute type
*/
public static String getAttributeType(ObjectModelParameter attribute,
@@ -123,7 +125,7 @@
String result;
if (attribute instanceof ObjectModelAttribute
&& isNMultiplicity((ObjectModelAttribute) attribute)) {
- if (((ObjectModelAttribute) attribute).isOrdered()) {
+ if (attribute.isOrdered()) {
result = "java.util.List";
} else {
result = "java.util.Collection";
@@ -139,7 +141,7 @@
/**
* Indicates if the specified attribute has a primitive type (byte, boolean, ...)
- * @param attribute
+ * @param attribute the attribute to test
* @return true if the attribute has a primitive type
*/
public static boolean isPrimitiveAttributeType(
@@ -156,7 +158,7 @@
/**
* return an init value for the specified attribute
- * @param attribute
+ * @param attribute the attribute to test
* @return a String with the corresponding attribute init value
*/
public static String getInitValue(ObjectModelAttribute attribute) {
@@ -261,7 +263,7 @@
}
/**
- * @param params
+ * @param params the paramters to treate
* @return la chaine de caractere dont on a besoin pour la declaration
* des parametres d'une methode.
*/
@@ -270,8 +272,7 @@
StringBuffer result = new StringBuffer();
for (Iterator<ObjectModelParameter> j = params.iterator(); j.hasNext();) {
ObjectModelParameter parameter = j.next();
- result.append(getAttributeType(parameter) + " "
- + parameter.getName());
+ result.append(getAttributeType(parameter)).append(" ").append(parameter.getName());
if (j.hasNext()) {
result.append(", ");
}
@@ -280,7 +281,7 @@
}
/**
- * @param params
+ * @param params the paramters to treate
* @return la chaine de caractere qui represente chaque nom de parametre
* separer par des ','.
*/
@@ -298,7 +299,7 @@
}
/**
- * @param attribute
+ * @param attribute the attribute to test
* @return vrai si la cardinalite de l'attribut est superieur a 1, c-a-d
* si MaxMultiplicity == -1 ou > 1
*/
@@ -311,22 +312,19 @@
}
/**
- * @param attribute
+ * @param attribute the attribute to test
* @return true is the multiplicity of the given attribute is exactly 1
*/
public static boolean isOneMultiplicity(ObjectModelAttribute attribute) {
- if (attribute == null) {
- return false;
- }
- return ((attribute.getMinMultiplicity() == 1) && (attribute
- .getMaxMultiplicity() == 1));
+ return attribute != null && attribute.getMinMultiplicity() == 1 &&
+ attribute.getMaxMultiplicity() == 1;
}
/**
*
* @deprecated use StringUtils.capitalize instead
- * @param word
- * @return
+ * @param word the word to capitalize
+ * @return the capitalized word
*/
@Deprecated
public static String toUpperCaseFirstLetter(String word) {
@@ -347,15 +345,15 @@
/**
*
- * @param word
- * @return
+ * @param word the word to decapitalize
+ * @return the decapitalized word
*/
public static String toLowerCaseFirstLetter(String word) {
return word.substring(0, 1).toLowerCase() + word.substring(1);
}
/**
- * @param attribute
+ * @param attribute the attribute to test
* @return true if the given attribute is a composition (composant of the reverse attribute)
*/
public static boolean isComposition(ObjectModelAttribute attribute) {
@@ -438,7 +436,7 @@
}
/**
- * @param operation
+ * @param operation the operation to look at
* @return la chaine de caractere dont on a besoin pour la declaration
* des parametres d'une methode.
*/
@@ -449,8 +447,7 @@
Collection<ObjectModelParameter> params = operation.getParameters();
for (Iterator<ObjectModelParameter> j = params.iterator(); j.hasNext();) {
ObjectModelParameter parameter = j.next();
- result.append(getAttributeType(parameter) + " "
- + parameter.getName());
+ result.append(getAttributeType(parameter)).append(" ").append(parameter.getName());
if (j.hasNext()) {
result.append(", ");
}
@@ -459,7 +456,7 @@
}
/**
- * @param operation
+ * @param operation the operation to look at
* @return la chaine de caractere qui represente chaque nom de parametre
* separer par des ','.
*/
@@ -478,7 +475,7 @@
}
/**
- * @param clazz
+ * @param clazz the class where to look at
* @return sous forme de String la liste des déclarations des attributes d'une classe donnée
*/
public static String getClassAttributesListDeclaration(
@@ -488,7 +485,7 @@
Collection<ObjectModelAttribute> params = clazz.getAttributes();
for (Iterator<ObjectModelAttribute> j = params.iterator(); j.hasNext();) {
ObjectModelAttribute attr = j.next();
- result.append(getAttributeType(attr, true) + " " + attr.getName());
+ result.append(getAttributeType(attr, true)).append(" ").append(attr.getName());
if (j.hasNext()) {
result.append(", ");
}
@@ -567,7 +564,7 @@
* serialVersionUID. Exemple, returns "123456789L".
* This id will change only if the type or the order of an attribute
* changes.
- * @param clazz
+ * @param clazz the class to use
* @return the generated serialVersionUID
*/
public static String computeSerialVersionUID(ObjectModelClass clazz) {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ImportsManager.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ImportsManager.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ImportsManager.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -34,6 +34,7 @@
* generated code.
*
* @author thimel, chemit
+ * TODO-TC20091217 Move this to java package, this is specific to java generation
*/
public class ImportsManager {
Added: trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManager.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManager.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManager.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -0,0 +1,61 @@
+package org.nuiton.eugene.java;
+
+import org.nuiton.eugene.models.object.ObjectModelElement;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * To manage annotations for any {@link org.nuiton.eugene.models.object.ObjectModelElement} of a classifier.
+ * <p/>
+ * Created: 17 déc. 2009
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ * @since 2.0.0
+ */
+public class AnnotationsManager {
+
+ protected Map<ObjectModelElement, List<String>> annotations;
+
+ /**
+ * Add the {@code annotation} for the given {@code element} of the classifier.
+ *
+ * @param element the element where to register the annotation
+ * @param annotation the annotation to register
+ */
+ public void addAnnotation(ObjectModelElement element, String annotation) {
+ Map<ObjectModelElement, List<String>> map = getAnnotations();
+ List<String> list = map.get(element);
+ if (list == null) {
+ list = new ArrayList<String>();
+ map.put(element, list);
+ }
+ list.add(annotation);
+ }
+
+ /**
+ * Obtain the array of annotations registred for a given element of the classifier.
+ *
+ * @param element the element where to search for annotations
+ * @return the annotations for the element (empty arry if none found
+ */
+ public String[] getAnnotations(ObjectModelElement element) {
+ Map<ObjectModelElement, List<String>> map = getAnnotations();
+ List<String> list = map.get(element);
+ return list == null ? new String[0] : list.toArray(new String[list.size()]);
+ }
+
+ protected Map<ObjectModelElement, List<String>> getAnnotations() {
+ if (annotations == null) {
+ annotations = new HashMap<ObjectModelElement, List<String>>();
+ }
+ return annotations;
+ }
+
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManager.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Added: trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManagerExtension.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManagerExtension.java (rev 0)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManagerExtension.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -0,0 +1,80 @@
+package org.nuiton.eugene.java;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.eugene.models.object.ObjectModelClassifier;
+import org.nuiton.eugene.models.object.ObjectModelElement;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created: 17 déc. 2009
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ */
+public class AnnotationsManagerExtension {
+
+ private static final Log log = LogFactory.getLog(AnnotationsManagerExtension.class);
+
+ /**
+ * Extension static used to identify ImportsManagerExtension in ObjectModel
+ */
+ public static final String OBJECTMODEL_EXTENSION = "annotations";
+
+ /**
+ * Map of ImportsManager with key equals to the classifier qualified name associated to
+ * the ImportsManager
+ */
+ protected Map<String, AnnotationsManager> managers;
+
+ /**
+ * Get the registred annotations for the given {@code element} in the given {@code classifier}.
+ *
+ * <b>Note:</b> The method always returns a {@code none null} value, but
+ * an empty array when no annotation when no annotation found for the element.
+ *
+ * @param classifier the classifier where is the element
+ * @param element the element on which searching annotations
+ * @return the array of annotation registred or an empty array if none.
+ */
+ public String[] getAnnotations(ObjectModelClassifier classifier, ObjectModelElement element) {
+ AnnotationsManager annotationsManager = getManager(classifier);
+ String[] result = null;
+ if (annotationsManager != null) {
+ result = annotationsManager.getAnnotations(element);
+ }
+ return result == null ? new String[]{} : result;
+ }
+
+ /**
+ * Get the ImportsManager associated to the classifier. If not exist, it will be created.
+ *
+ * @param classifier reference for the ImportsManager
+ * @return the importsManager associated to the classifier (never null)
+ */
+ public AnnotationsManager getManager(ObjectModelClassifier classifier) {
+ Map<String, AnnotationsManager> managers = getManagers();
+ String fqn = classifier.getQualifiedName();
+ AnnotationsManager manager = managers.get(fqn);
+ if (manager == null) {
+ manager = new AnnotationsManager();
+ managers.put(fqn, manager);
+ if (log.isDebugEnabled()) {
+ log.debug("Add new annotationsManager for : " + fqn);
+ }
+ }
+ return manager;
+ }
+
+ protected Map<String, AnnotationsManager> getManagers() {
+ if (managers == null) {
+ managers = new HashMap<String, AnnotationsManager>();
+ }
+ return managers;
+ }
+}
Property changes on: trunk/eugene/src/main/java/org/nuiton/eugene/java/AnnotationsManagerExtension.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/ImportsManagerExtension.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/ImportsManagerExtension.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/ImportsManagerExtension.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -21,14 +21,15 @@
package org.nuiton.eugene.java;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.eugene.ImportsManager;
import org.nuiton.eugene.models.object.ObjectModelClassifier;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* ImportsManagerExtension
*
@@ -58,24 +59,19 @@
protected Map<String, ImportsManager> managers;
/**
- * Public constructor for ImportsManagerExtension
- */
- public ImportsManagerExtension() {
- this.managers = new HashMap<String, ImportsManager>();
- }
-
- /**
* Get the ImportsManager associated to the classifier. If not exist, it will be created.
* @param classifier reference for the ImportsManager
* @return the importsManager associated to the classifier (never null)
*/
public ImportsManager getManager(ObjectModelClassifier classifier) {
- ImportsManager manager = this.managers.get(classifier.getQualifiedName());
+ Map<String, ImportsManager> managers = getManagers();
+ String fqn = classifier.getQualifiedName();
+ ImportsManager manager = managers.get(fqn);
if (manager == null) {
manager = new ImportsManager();
- this.managers.put(classifier.getQualifiedName(), manager);
+ managers.put(fqn, manager);
if (log.isDebugEnabled()) {
- log.debug("Add new importsManager for : " + classifier.getQualifiedName());
+ log.debug("Add new importsManager for : " + fqn);
}
}
return manager;
@@ -86,8 +82,15 @@
* @param classifier reference for the imports
* @return a List of String which contains all imports for the classifier
*/
- public List<String> getImports(ObjectModelClassifier classifier) throws IllegalArgumentException {
+ public List<String> getImports(ObjectModelClassifier classifier) {
ImportsManager manager = getManager(classifier);
return manager.getImports(classifier.getPackageName());
}
+
+ protected Map<String, ImportsManager> getManagers() {
+ if (managers == null) {
+ managers = new HashMap<String, ImportsManager>();
+ }
+ return managers;
+ }
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaBuilder.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -59,14 +59,20 @@
/**
* ObjectModel extension to manage imports : one ImportsManager by classifier
*/
- protected ImportsManagerExtension managers;
+ protected ImportsManagerExtension importsManagerExtension;
+ /**
+ * ObjectModel extension to manage imports : one ImportsManager by classifier
+ */
+ protected AnnotationsManagerExtension annotationsManagerExtension;
@SuppressWarnings("unchecked")
public JavaBuilder(String modelName) {
this.modelBuilder = new ObjectModelBuilder(modelName);
- this.managers = getModel().getExtension(
+ this.importsManagerExtension = getModel().getExtension(
ImportsManagerExtension.OBJECTMODEL_EXTENSION, ImportsManagerExtension.class);
+ this.annotationsManagerExtension = getModel().getExtension(
+ AnnotationsManagerExtension.OBJECTMODEL_EXTENSION, AnnotationsManagerExtension.class);
}
/**
@@ -101,7 +107,7 @@
if (imports == null) {
return;
}
- ImportsManager manager = managers.getManager(classifier);
+ ImportsManager manager = importsManagerExtension.getManager(classifier);
imports = imports.trim();
// remove ... operator
if (imports.endsWith("...")) {
@@ -116,10 +122,30 @@
}
/**
+ * Add an annotation on an element of a classifier.
+ *
+ * @param classifier where the annotation will be added.
+ * @param element element on which add annotation
+ * @param annotation annotation to add
+ */
+ public void addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, String annotation) {
+ if (annotation == null) {
+ return;
+ }
+ AnnotationsManager manager = annotationsManagerExtension.getManager(classifier);
+ annotation = annotation.trim();
+
+ manager.addAnnotation(element, annotation);
+ if (log.isDebugEnabled()) {
+ log.debug("Add annotation for <" + classifier.getQualifiedName() + ":" + element.getName() + "> : " + annotation);
+ }
+ }
+
+ /**
* Create a new class in the model.
*
* @param name
- * @param packageName
+ * @param packageName package's name of the class to create
* @return a new ObjectModelClass
* @see org.nuiton.eugene.models.object.xml.ObjectModelBuilder#createClass(java.lang.String, java.lang.String,org.nuiton.eugene.models.object.ObjectModelModifier...)
*/
@@ -131,7 +157,7 @@
* Create a new abstract class in the model.
*
* @param name
- * @param packageName
+ * @param packageName package's name of the class to create
* @return a new ObjectModelClass
* @see org.nuiton.eugene.models.object.xml.ObjectModelBuilder#createClass(java.lang.String,java.lang.String, org.nuiton.eugene.models.object.ObjectModelModifier...)
*/
@@ -143,7 +169,7 @@
* Create a new interface in the model
*
* @param name
- * @param packageName
+ * @param packageName package's name of the interface to create
* @return a new ObjectModelInterface
* @see org.nuiton.eugene.models.object.xml.ObjectModelBuilder#createInterface(java.lang.String, java.lang.String)
*/
@@ -155,7 +181,7 @@
* Create a new enumration in the model
*
* @param name
- * @param packageName
+ * @param packageName package's name of the enumeration to create
* @return a new ObjectModelEnumeration
*/
public ObjectModelEnumeration createEnumeration(String name, String packageName) {
@@ -373,6 +399,6 @@
}
public void addLiteral(ObjectModelEnumeration classifier, String name) {
- modelBuilder.addLiteral(classifier,name);
+ modelBuilder.addLiteral(classifier, name);
}
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -86,9 +86,10 @@
/**
* Generate from all classes.
+ *
* @param output Writer for generating the java file
* @param clazz Class to manage for creating an output file
- * @throws IOException
+ * @throws IOException if any pb while writing file
*/
@Override
public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException {
@@ -100,10 +101,10 @@
// Imports, package et documentation
this.generateHeader(output, clazz);
-
+
String abstractStr = clazz.isAbstract() ? " abstract " : " ";
String className = clazz.getName();
-
+
String extend = "";
Iterator<ObjectModelClass> j = clazz.getSuperclasses().iterator();
if (j.hasNext()) {
@@ -123,6 +124,7 @@
if (log.isInfoEnabled()) {
log.info(className+" : super : "+extend+", interfaces : "+implement);
}
+ generateAnnotations(output, clazz, clazz);
/*{
<%=prefix%>public<%=abstractStr%>class <%=className%>}*/
@@ -145,8 +147,8 @@
}
generateInnerClassifiers(output, clazz.getInnerClassifiers());
- generateAttributes(output, clazz.getAttributes());
- generateOperations(output, clazz.getOperations());
+ generateAttributes(output, clazz,clazz.getAttributes());
+ generateOperations(output, clazz,clazz.getOperations());
/*{
<%=prefix%>} //<%=className%>
@@ -174,6 +176,7 @@
extend += ", ";
}
}
+ generateAnnotations(output, interfacez, interfacez);
/*{
<%=prefix%>public interface <%=interfaceName%>}*/
@@ -187,13 +190,25 @@
}*/
}
- generateAttributes(output, interfacez.getAttributes());
- generateOperations(output, interfacez.getOperations());
+ generateAttributes(output, interfacez, interfacez.getAttributes());
+ generateOperations(output, interfacez, interfacez.getOperations());
/*{
<%=prefix%>} //<%=interfaceName%>
}*/
}
+ public void generateAnnotations(Writer output,ObjectModelClassifier clazz, ObjectModelElement element) throws IOException {
+ AnnotationsManagerExtension managers = getModel().getExtension(AnnotationsManagerExtension.OBJECTMODEL_EXTENSION,
+ AnnotationsManagerExtension.class);
+ String[] annotations = managers.getAnnotations(clazz,element);
+ for (String annotation : annotations) {
+ if (!annotation.startsWith("@")) {
+ annotation = "@" + annotation;
+ }
+/*{<%=annotation%>
+}*/
+ }
+ }
@Override
public void generateFromEnum(Writer output, ObjectModelEnumeration enumz) throws IOException {
@@ -211,6 +226,7 @@
ObjectModelClassifier p = j.next();
extend += GeneratorUtil.getSimpleName(p.getQualifiedName());
}
+ generateAnnotations(output, enumz, enumz);
/*{
<%=prefix%>public enum <%=enumzName%>}*/
@@ -235,8 +251,8 @@
}*/
}
}
- this.generateAttributes(output, enumz.getAttributes());
- this.generateOperations(output, enumz.getOperations());
+ this.generateAttributes(output, enumz, enumz.getAttributes());
+ this.generateOperations(output, enumz, enumz.getOperations());
/*{
<%=prefix%>} //<%=enumzName%>
}*/
@@ -280,12 +296,13 @@
}
}
-
+
/**
* Generate Header for a classifier : Package, Documentation, Imports and Classifier signature.
+ *
* @param output Writer for generating the java file
* @param classifier Classifier for generate header
- * @throws IOException
+ * @throws IOException if any pb while writing file
*/
protected void generateHeader(Writer output, ObjectModelClassifier classifier) throws IOException {
if (classifier.isInner()) {
@@ -308,11 +325,13 @@
/**
* Generate attributes from a collection of ObjectModelAttribute.
+ *
* @param output Writer for generating the java file
+ * @param clazz classifier in generation
* @param attributes Collection of ObjectModelAttribute to generate
- * @throws IOException
+ * @throws IOException if any pb while writing file
*/
- protected void generateAttributes(Writer output, Collection<ObjectModelAttribute> attributes) throws IOException {
+ protected void generateAttributes(Writer output,ObjectModelClassifier clazz, Collection<ObjectModelAttribute> attributes) throws IOException {
for (ObjectModelAttribute attr : attributes) {
@@ -344,11 +363,13 @@
/**
* Generate operations from a collection of ObjectModelOperation
+ *
* @param output Writer for generating the java file
+ * @param clazz classifier in generation
* @param operations Collection of ObjectModelOperation to generate
- * @throws IOException
+ * @throws IOException if any pb while writing file
*/
- protected void generateOperations(Writer output, Collection<ObjectModelOperation> operations) throws IOException {
+ protected void generateOperations(Writer output,ObjectModelClassifier clazz, Collection<ObjectModelOperation> operations) throws IOException {
for (ObjectModelOperation op : operations) {
String opName = op.getName();
/*{<%=prefix%> /**
@@ -372,7 +393,7 @@
String opVisibility = op.getVisibility();
String opStatic = op.isStatic() ? "static " : "";
String opAbstract = op.isAbstract() ? "abstract " : "";
-
+
ObjectModelParameter returnParam = op.getReturnParameter();
String opReturn = "";
if (returnParam != null) {
@@ -403,7 +424,7 @@
comma = ", ";
}
/*{)}*/
-
+
comma = " throws ";
for (String exception : exceptions) {
String exceptionName = GeneratorUtil.getSimpleName(exception);
@@ -422,5 +443,5 @@
}
}
}
-
+
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/ObjectModelTransformerToJava.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -203,4 +203,8 @@
public void setDocumentation(ObjectModelElement element, String documentation) {
builder.setDocumentation(element, documentation);
}
+
+ public void addAnnotation(ObjectModelClassifier classifier, ObjectModelElement element, String annotation) {
+ builder.addAnnotation(classifier, element, annotation);
+ }
}
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.List;
-import org.nuiton.eugene.ImportsManager;
import org.nuiton.eugene.models.Model;
/**
@@ -92,7 +91,7 @@
/**
* Returns the interface corresponding to the given qualified name, or null if the model contains no interface for this qualified name.
- * @param qualifiedInterfaceName - the qualified name of the interface to retrieve.
+ * @param qualifiedInterfaceName the qualified name of the interface to retrieve.
*
* @return the ObjectModelInterface of the found interface, or null if the model contains no interface for this qualified name.
*/
@@ -109,7 +108,7 @@
/**
* Return the enumeration corresponding to the given qualified name
- * @param qualifiedEnumerationName
+ * @param qualifiedEnumerationName the fully qualified name of the enumeration to retrieve.
* @return the ObjectModelEnumeration of the found enumeration or null if the model contains no enumeration for this qualified name.
*/
ObjectModelEnumeration getEnumeration(String qualifiedEnumerationName);
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelElementImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelElementImpl.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelElementImpl.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -71,7 +71,7 @@
/**
* TODO a tester
- * @return
+ * @return the objectModel
*/
protected ObjectModelImpl getModel() {
if (objectModelImpl != null) {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-12-17 00:03:00 UTC (rev 762)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-12-17 01:08:01 UTC (rev 763)
@@ -53,7 +53,10 @@
* @plexus.component role="org.nuiton.eugene.models.Model" role-hint="objectmodel"
*/
public class ObjectModelImpl implements ObjectModel {
-
+ /**
+ * logger
+ */
+ private static final Log log = LogFactory.getLog(ObjectModelImpl.class);
protected String name = null;
protected String version = null;
protected Map<String, ObjectModelClass> classes = new HashMap<String, ObjectModelClass>();
@@ -67,7 +70,6 @@
* The key defined must be unique to get the significative extension associated to
*/
private Map<String, Object> extensions = new HashMap<String, Object>();
- private static Log log = LogFactory.getLog(ObjectModelImpl.class);
public void setName(String name) {
this.name = name;
@@ -79,7 +81,7 @@
@Override
public String getVersion() {
- return this.version;
+ return version;
}
public void addClass(ObjectModelClassImpl clazz) {
@@ -104,7 +106,7 @@
// nouvelle classe et l'ajouter à la précédente si nécessaire.
mergeClasses(initialClazz, clazz);
- clazz = initialClazz;
+// clazz = initialClazz;
}
}
//return clazz;
@@ -129,14 +131,14 @@
ObjectModelAssociationClassImpl initialClazz = (ObjectModelAssociationClassImpl) initialElement;
mergeAssociationClasses(initialClazz, clazz);
- clazz = initialClazz;
+// clazz = initialClazz;
}
}
//return clazz;
}
public void addComment(String comment) {
- this.comments.add(comment);
+ comments.add(comment);
}
/**
@@ -238,7 +240,7 @@
ObjectModelInterfaceImpl initialInterfacez = (ObjectModelInterfaceImpl) initialElement;
mergeClassifiers(initialInterfacez, interfacez);
- interfacez = initialInterfacez;
+// interfacez = initialInterfacez;
}
}
//return interfacez;
1
0
17 Dec '09
Author: tchemit
Date: 2009-12-17 01:03:00 +0100 (Thu, 17 Dec 2009)
New Revision: 762
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java
Log:
javadoc + my bad move a usefull constructor...
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java 2009-12-16 23:12:41 UTC (rev 761)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java 2009-12-17 00:03:00 UTC (rev 762)
@@ -74,6 +74,9 @@
/** Logger for this class. */
private static Log log = LogFactory.getLog(ObjectModelGenerator.class);
+ public ObjectModelGenerator() {
+ super();
+ }
public ObjectModelGenerator(AbstractGenerator<ObjectModel> parent) {
super(parent);
@@ -268,7 +271,7 @@
* utiliser la methode generateFromModel il vaut mieux surcharger cette
* methode
* @param model le modele utilise
- * @return
+ * @return le nom du fichier a generer
*/
public String getFilenameForModel(ObjectModel model) {
// TODO throw exception when model.getName() == null or empty
@@ -279,8 +282,8 @@
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
* @param model le modele utilise
- * @param packageName
- * @return le nom du fichier a generer
+ * @param packageName le nom du paquetage
+ * @return le repertoire correspondant au paquetage
*/
public String getFilenameForPackage(ObjectModel model, String packageName) {
return packageName.replace('.', File.separatorChar);
@@ -290,7 +293,7 @@
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
* @param interfacez l'interface utilisee
- * @return le nom du fichier a generer
+ * @return le nom du l'interface a generer
*/
public String getFilenameForInterface(ObjectModelInterface interfacez) {
return getFilenameForClassifier(interfacez);
@@ -301,7 +304,7 @@
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
* @param clazz la classe utilisee
- * @return le nom du fichier a generer
+ * @return le nom de la classe a generer
*/
public String getFilenameForClass(ObjectModelClass clazz) {
return getFilenameForClassifier(clazz);
@@ -312,7 +315,7 @@
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
* @param classifier le classifier utilisee
- * @return le nom du fichier a generer
+ * @return le nom du classifier a generer
*/
public String getFilenameForClassifier(ObjectModelClassifier classifier) {
return classifier.getQualifiedName().replace('.', File.separatorChar);
1
0
Author: tchemit
Date: 2009-12-17 00:12:41 +0100 (Thu, 17 Dec 2009)
New Revision: 761
Added:
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.properties
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.xmi
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.zargo
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java
trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java
trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java
trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java
trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/invoker.properties
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/verify.groovy
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java
Log:
- add testPhase in ModelFileWriterConfiguration
- add test input dir and output dir in ModelFileWriter api (zeroconf in mojo configs for test phase)
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/AbstractModelFileWriter.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -94,7 +94,7 @@
}
this.configuration = configuration;
try {
- File outputDir = getOutputDirectory(configuration.getOutputDirectory());
+ File outputDir = getOutputDirectory(configuration.getOutputDirectory(), configuration.isTestPhase());
if (!outputDir.exists()) {
if (log.isDebugEnabled()) {
@@ -124,8 +124,8 @@
}
@Override
- public File getOutputDirectory(File outputBasedir) {
- return new File(outputBasedir, getDefaultOutputDirectory());
+ public File getOutputDirectory(File outputBasedir, boolean testPhase) {
+ return new File(outputBasedir, testPhase ? getDefaultTestOutputDirectory() : getDefaultOutputDirectory());
}
@Override
@@ -139,22 +139,6 @@
protected ModelFileWriterConfiguration getConfiguration() {
return configuration;
}
-//
-// protected File createOutputDirectory(File outputDir) throws IOException {
-//
-// outputDir = getOutputDirectory(outputDir);
-//
-// if (!outputDir.exists()) {
-// if (log.isDebugEnabled()) {
-// log.debug("[" + getInputProtocol() + "] Create output directory " + outputDir);
-// }
-// boolean b = outputDir.mkdirs();
-// if (!b) {
-// throw new IOException("Could not creat directory " + outputDir);
-// }
-// }
-// return outputDir;
-// }
protected ModelFileWriter getNextWriter() {
return nextWriter;
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriter.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -87,19 +87,30 @@
String getDefaultInputDirectory();
/**
+ * @return the defalt relative path where to pick files to treate on a test phase.
+ */
+ String getDefaultTestInputDirectory();
+
+ /**
* @return the default relative path to add to output basedir
*/
String getDefaultOutputDirectory();
/**
+ * @return the default relative path to add to output basedir on a test phase.
+ */
+ String getDefaultTestOutputDirectory();
+
+ /**
* Obtain the real directory where to write files.
* <p/>
* //FIXME-TC20091126 make this configurable (via the properties)
*
* @param outputBasedir the output base directory
+ * @param testPhase {@code true} if writer is used in a test phase
* @return the real output directory where to generate for this particular writer
*/
- File getOutputDirectory(File outputBasedir);
+ File getOutputDirectory(File outputBasedir, boolean testPhase);
/**
* Generates.
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterConfiguration.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -66,6 +66,10 @@
boolean isVerbose();
/**
+ * @return {@code true} if build is done on a test phase.
+ */
+ boolean isTestPhase();
+ /**
* @return encoding to use to read and write files
*/
String getEncoding();
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ModelFileWriterUtil.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -119,7 +119,7 @@
String basedirpath = configuration.getBasedir().getAbsolutePath();
- String outputpath = writer.getOutputDirectory(configuration.getOutputDirectory()).getAbsolutePath();
+ String outputpath = writer.getOutputDirectory(configuration.getOutputDirectory(), configuration.isTestPhase()).getAbsolutePath();
String path = outputpath.substring(basedirpath.length() + 1);
@@ -222,7 +222,7 @@
}
ModelFileWriterEntry writerEntry = new ModelFileWriterEntry(
- new File(configuration.getBasedir(), writer.getDefaultInputDirectory()),
+ new File(configuration.getBasedir(), configuration.isTestPhase()?writer.getDefaultTestInputDirectory():writer.getDefaultInputDirectory()),
writer.getDefaultIncludes()
);
return writerEntry;
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelGenerator.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -75,10 +75,6 @@
private static Log log = LogFactory.getLog(ObjectModelGenerator.class);
- public ObjectModelGenerator() {
- super();
- }
-
public ObjectModelGenerator(AbstractGenerator<ObjectModel> parent) {
super(parent);
}
@@ -111,9 +107,9 @@
* getFilenameFor.... La methode generateFrom... n'utilise pas le Writer
* alors le fichier n'est pas généré, si on l'utilise m?me pour ne rien
* écrire alors le fichier sera généré.
- * @param model
- * @param destDir
- * @throws IOException
+ * @param model le modele memoire a utiliser
+ * @param destDir le repertoire ou generer
+ * @throws IOException pour tout pb
*/
@Override
public void applyTemplate(ObjectModel model, File destDir) throws IOException {
@@ -271,7 +267,7 @@
* Par defaut cette methode retourne le getName du model. Si l'on souhaite
* utiliser la methode generateFromModel il vaut mieux surcharger cette
* methode
- * @param model
+ * @param model le modele utilise
* @return
*/
public String getFilenameForModel(ObjectModel model) {
@@ -282,9 +278,9 @@
/**
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- * @param model
+ * @param model le modele utilise
* @param packageName
- * @return
+ * @return le nom du fichier a generer
*/
public String getFilenameForPackage(ObjectModel model, String packageName) {
return packageName.replace('.', File.separatorChar);
@@ -293,8 +289,8 @@
/**
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- * @param interfacez
- * @return
+ * @param interfacez l'interface utilisee
+ * @return le nom du fichier a generer
*/
public String getFilenameForInterface(ObjectModelInterface interfacez) {
return getFilenameForClassifier(interfacez);
@@ -304,8 +300,8 @@
/**
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- * @param clazz
- * @return
+ * @param clazz la classe utilisee
+ * @return le nom du fichier a generer
*/
public String getFilenameForClass(ObjectModelClass clazz) {
return getFilenameForClassifier(clazz);
@@ -315,11 +311,11 @@
/**
* Par defaut cette methode retourne le QualifiedName convertie en chemin
* par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- * @param clazz
- * @return
+ * @param classifier le classifier utilisee
+ * @return le nom du fichier a generer
*/
- public String getFilenameForClassifier(ObjectModelClassifier clazz) {
- return clazz.getQualifiedName().replace('.', File.separatorChar);
+ public String getFilenameForClassifier(ObjectModelClassifier classifier) {
+ return classifier.getQualifiedName().replace('.', File.separatorChar);
}
public String getFilenameForEnumeration(ObjectModelEnumeration enumeration) {
Modified: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml 2009-12-16 23:12:41 UTC (rev 761)
@@ -64,7 +64,7 @@
<id>Zargo to object model</id>
<phase>generate-sources</phase>
<configuration>
- <modelType>objectmodel</modelType>
+ <!--<modelType>objectmodel</modelType>-->
<inputFiles>
<inputFile>src/main/zargo:**/*.zargo</inputFile>
</inputFiles>
@@ -94,7 +94,7 @@
<id>Xmi to object model</id>
<phase>generate-sources</phase>
<configuration>
- <modelType>objectmodel</modelType>
+ <!--<modelType>objectmodel</modelType>-->
<inputFiles>
<inputFile>src/main/xmi:**/*.xmi</inputFile>
</inputFiles>
Modified: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/invoker.properties
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/invoker.properties 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/invoker.properties 2009-12-16 23:12:41 UTC (rev 761)
@@ -1,6 +1,6 @@
# A comma or space separated list of goals/phases to execute, may
# specify an empty list to execute the default goal of the IT project
-invoker.goals=clean generate-sources
+invoker.goals=clean generate-test-sources
# Optionally, a list of goals to run during further invocations of Maven
#invoker.goals.2=${project.groupId}:${project.artifactId}:${project.version}:run
Modified: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml 2009-12-16 23:12:41 UTC (rev 761)
@@ -64,7 +64,7 @@
<id>Zargo to object model</id>
<phase>generate-sources</phase>
<configuration>
- <modelType>objectmodel</modelType>
+ <!--<modelType>objectmodel</modelType>-->
<inputFiles>
<inputFile>zargo</inputFile>
</inputFiles>
@@ -94,7 +94,7 @@
<id>Xmi to object model</id>
<phase>generate-sources</phase>
<configuration>
- <modelType>objectmodel</modelType>
+ <!--<modelType>objectmodel</modelType>-->
<inputFiles>
<inputFile>xmi</inputFile>
</inputFiles>
@@ -120,6 +120,70 @@
<goal>generate-model-files</goal>
</goals>
</execution>
+ <execution>
+ <id>Zargo to object model (test phase)</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <testPhase>true</testPhase>
+ <!--<modelType>objectmodel</modelType>-->
+ <inputFiles>
+ <inputFile>zargo</inputFile>
+ </inputFiles>
+ <fullPackagePath>org.nuiton.topia.test.entities</fullPackagePath>
+ <outputDirectory>target/generated-sources-zargo2ObjectModel</outputDirectory>
+ </configuration>
+ <goals>
+ <goal>generate-model-files</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>Zargo to state model (test phase)</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <testPhase>true</testPhase>
+ <modelType>statemodel</modelType>
+ <inputFiles>
+ <inputFile>zargo</inputFile>
+ </inputFiles>
+ <fullPackagePath>org.nuiton.topia.test.entities</fullPackagePath>
+ <outputDirectory>target/generated-sources-zargo2StateModel</outputDirectory>
+ </configuration>
+ <goals>
+ <goal>generate-model-files</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>Xmi to object model (test phase)</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <testPhase>true</testPhase>
+ <!--<modelType>objectmodel</modelType>-->
+ <inputFiles>
+ <inputFile>xmi</inputFile>
+ </inputFiles>
+ <fullPackagePath>org.nuiton.topia</fullPackagePath>
+ <outputDirectory>target/generated-sources-xmi2ObjectModel</outputDirectory>
+ </configuration>
+ <goals>
+ <goal>generate-model-files</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>Xmi to state model (test phase)</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <testPhase>true</testPhase>
+ <modelType>statemodel</modelType>
+ <inputFiles>
+ <inputFile>xmi</inputFile>
+ </inputFiles>
+ <fullPackagePath>org.nuiton.topia</fullPackagePath>
+ <outputDirectory>target/generated-sources-xmi2StateModel</outputDirectory>
+ </configuration>
+ <goals>
+ <goal>generate-model-files</goal>
+ </goals>
+ </execution>
</executions>
<dependencies>
<dependency>
Added: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.properties
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.properties (rev 0)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.properties 2009-12-16 23:12:41 UTC (rev 761)
@@ -0,0 +1 @@
+model.tagvalue.generateOperatorForDAOHelper=true
\ No newline at end of file
Added: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.xmi
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.xmi (rev 0)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.xmi 2009-12-16 23:12:41 UTC (rev 761)
@@ -0,0 +1,1334 @@
+<?xml version = '1.0' encoding = 'UTF-8' ?>
+<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML' timestamp = 'Mon Oct 19 15:56:54 CEST 2009'>
+ <XMI.header> <XMI.documentation>
+ <XMI.exporter>ArgoUML (using Netbeans XMI Writer version 1.0)</XMI.exporter>
+ <XMI.exporterVersion>0.28.1(6) revised on $Date: 2007-05-12 08:08:08 +0200 (Sat, 12 May 2007) $ </XMI.exporterVersion>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" xmi.version="1.4"/></XMI.header>
+ <XMI.content>
+ <UML:Model xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:000000000000077B'
+ name = 'xmiTopiaTest' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:ModelElement.taggedValue>
+ <UML:TaggedValue xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E3'
+ isSpecification = 'false'>
+ <UML:TaggedValue.dataValue>1.2</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.type>
+ <UML:TagDefinition xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E4'/>
+ </UML:TaggedValue.type>
+ </UML:TaggedValue>
+ </UML:ModelElement.taggedValue>
+ <UML:Namespace.ownedElement>
+ <UML:TagDefinition xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E4'
+ name = 'version' isSpecification = 'false' tagType = 'String'>
+ <UML:TagDefinition.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E6'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E5'
+ lower = '0' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:TagDefinition.multiplicity>
+ </UML:TagDefinition>
+ <UML:Stereotype xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'
+ name = 'entity' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Package xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:000000000000090B'
+ name = 'org' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Package xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:000000000000090C'
+ name = 'nuiton' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Package xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:000000000000090D'
+ name = 'topiatest' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DA'
+ name = 'Personne' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001020'/>
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CF9'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CFD'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CFC'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-67f6b63e:12187ee3a69:-8000:0000000000000EB0'
+ name = 'otherNames' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-67f6b63e:12187ee3a69:-8000:0000000000000EB8'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-67f6b63e:12187ee3a69:-8000:0000000000000EB7'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DE'
+ name = 'Employe' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E2'/>
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D54'
+ name = 'salary' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D5A'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D59'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086C'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E0'
+ name = 'Company' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000011BD'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000011C5'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000011C4'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008F9'
+ name = 'Address' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000903'
+ name = 'city' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CF7'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CF6'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CE8'
+ name = 'adress' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CF3'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CF2'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008FB'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008FC'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008FD'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008FE'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DA'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008FF'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000900'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000901'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008F9'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Generalization xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E2'
+ isSpecification = 'false'>
+ <UML:Generalization.child>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DE'/>
+ </UML:Generalization.child>
+ <UML:Generalization.parent>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DA'/>
+ </UML:Generalization.parent>
+ </UML:Generalization>
+ <UML:Association xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CFE'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000CFF'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:000000000000102C'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:000000000000102B'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E0'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D02'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:000000000000102A'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001029'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DE'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0B'
+ name = 'Department' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D25'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D29'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D28'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2A'
+ name = 'Product' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D37'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D3F'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D3E'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D5B'
+ name = 'Store' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D7D'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D83'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D82'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D40'
+ name = 'Type' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D4D'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D53'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D52'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:AssociationClass xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D65'
+ name = 'Bill' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D66'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D89'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D88'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E0'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D69'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D8D'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D8C'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D5B'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D6D'
+ name = 'cost' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D75'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D74'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086C'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D76'
+ name = 'date' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D7A'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D79'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000085F'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:AssociationClass>
+ <UML:Association xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D18'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D19'
+ name = 'lead' visibility = 'public' isSpecification = 'false' isNavigable = 'false'
+ ordering = 'unordered' aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D24'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D23'
+ lower = '0' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0B'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D1C'
+ name = 'leader' visibility = 'public' isSpecification = 'false' isNavigable = 'true'
+ ordering = 'unordered' aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D1D'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D1E'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DE'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0D'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0E'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'composite' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0F'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D10'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E0'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D11'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D17'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D16'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0B'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2C'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2D'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2E'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2F'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D0B'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D30'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D36'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D35'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2A'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D42'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D43'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D4C'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D4B'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2A'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D46'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D47'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D48'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D40'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E71'
+ name = 'beangen' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E72'
+ name = 'Voiture' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'true' isActive = 'false'>
+ <UML:ModelElement.clientDependency>
+ <UML:Abstraction xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E77'/>
+ </UML:ModelElement.clientDependency>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E73'/>
+ </UML:ModelElement.stereotype>
+ <UML:ModelElement.taggedValue>
+ <UML:TaggedValue xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EA1'
+ isSpecification = 'false'>
+ <UML:TaggedValue.dataValue>Doc for BeanA</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.type>
+ <UML:TagDefinition href = 'http://argouml.org/profiles/uml14/default-uml14.xmi#.:000000000000087C'/>
+ </UML:TaggedValue.type>
+ </UML:TaggedValue>
+ </UML:ModelElement.taggedValue>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E7C'
+ name = 'immatriculation' visibility = 'public' isSpecification = 'false'
+ ownerScope = 'instance' changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E7D'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E7E'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:ModelElement.taggedValue>
+ <UML:TaggedValue xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EA2'
+ isSpecification = 'false'>
+ <UML:TaggedValue.dataValue>attrA of BeanA</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.type>
+ <UML:TagDefinition href = 'http://argouml.org/profiles/uml14/default-uml14.xmi#.:000000000000087C'/>
+ </UML:TaggedValue.type>
+ </UML:TaggedValue>
+ </UML:ModelElement.taggedValue>
+ <UML:StructuralFeature.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086C'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E7F'
+ name = 'modele' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E80'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E81'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EE6'
+ name = 'proprietaire' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EE7'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EE8'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DA'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E75'
+ name = 'Roue' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E73'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Operation xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E85'
+ name = 'mount' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ isQuery = 'false' concurrency = 'sequential' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E86'
+ name = 'return' isSpecification = 'false' kind = 'return'>
+ <UML:Parameter.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086B'/>
+ </UML:Parameter.type>
+ </UML:Parameter>
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E87'
+ name = 'getModel' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ isQuery = 'false' concurrency = 'sequential' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E88'
+ name = 'return' isSpecification = 'false' kind = 'return'>
+ <UML:Parameter.type>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:0000000000000D2A'/>
+ </UML:Parameter.type>
+ </UML:Parameter>
+ <UML:Parameter xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E89'
+ name = 'id' isSpecification = 'false'>
+ <UML:Parameter.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:Parameter.type>
+ </UML:Parameter>
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Abstraction xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E77'
+ isSpecification = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E78'/>
+ </UML:ModelElement.stereotype>
+ <UML:Dependency.client>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E72'/>
+ </UML:Dependency.client>
+ <UML:Dependency.supplier>
+ <UML:Interface xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E76'/>
+ </UML:Dependency.supplier>
+ </UML:Abstraction>
+ <UML:Interface xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E76'
+ name = 'Vehicule' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false'>
+ <UML:Classifier.feature>
+ <UML:Operation xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E7A'
+ name = 'start' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ isQuery = 'false' concurrency = 'sequential' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E7B'
+ name = 'return' isSpecification = 'false' kind = 'return'>
+ <UML:Parameter.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086B'/>
+ </UML:Parameter.type>
+ </UML:Parameter>
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Interface>
+ <UML:Association xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E8A'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E8B'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'composite' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E8C'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E8D'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E72'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E8E'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED2'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED1'
+ lower = '4' upper = '4'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E75'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAB'
+ name = 'RelationDTO' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E74'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAC'
+ name = 'idCompany' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAD'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAE'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086C'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAF'
+ name = 'idDepartement' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB0'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB1'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086C'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EBB'
+ name = 'dateDebut' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EBC'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EBD'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000085F'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EA9'
+ name = 'PersonneDTO' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.clientDependency>
+ <UML:Dependency xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAA'/>
+ </UML:ModelElement.clientDependency>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E74'/>
+ </UML:ModelElement.stereotype>
+ <UML:Namespace.ownedElement>
+ <UML:Dependency xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAA'
+ isSpecification = 'false'>
+ <UML:Dependency.client>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EA9'/>
+ </UML:Dependency.client>
+ <UML:Dependency.supplier>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DA'/>
+ </UML:Dependency.supplier>
+ </UML:Dependency>
+ </UML:Namespace.ownedElement>
+ </UML:Class>
+ <UML:Association xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB2'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB3'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EBA'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB9'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EAB'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB6'
+ name = 'person' visibility = 'public' isSpecification = 'false' isNavigable = 'true'
+ ordering = 'unordered' aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB7'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EB8'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EA9'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED3'
+ name = 'Siege' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E73'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EDB'
+ name = 'noSerie' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EDC'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EDD'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:DataType href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:000000000000086C'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED4'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED5'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EE5'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EE4'
+ lower = '1' upper = '4'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED3'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED8'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'composite' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000ED9'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000EDA'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E72'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000100A'
+ name = 'deletetest' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000100B'
+ name = 'Contact2' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001019'
+ name = 'contactValue' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101A'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101B'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101C'
+ name = 'type' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101D'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101E'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Operation xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:000000000000102F'
+ name = 'findAllByCompany' visibility = 'public' isSpecification = 'false'
+ ownerScope = 'instance' isQuery = 'false' concurrency = 'sequential' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001034'/>
+ </UML:ModelElement.stereotype>
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001030'
+ name = 'return' isSpecification = 'false' kind = 'return'>
+ <UML:Parameter.type>
+ <UML:Class xmi.idref = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001032'/>
+ </UML:Parameter.type>
+ </UML:Parameter>
+ <UML:Parameter xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001033'
+ name = 'company' isSpecification = 'false'>
+ <UML:Parameter.type>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E0'/>
+ </UML:Parameter.type>
+ </UML:Parameter>
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000100C'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000100D'
+ name = 'contacts' visibility = 'public' isSpecification = 'false' isNavigable = 'true'
+ ordering = 'unordered' aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001026'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001025'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000100B'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001010'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001028'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001027'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101F'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001017'
+ name = 'Telephone2' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001018'/>
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001021'
+ name = 'prefix' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001022'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001023'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001024'
+ name = 'country' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001025'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001026'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001018'
+ isSpecification = 'false'>
+ <UML:Generalization.child>
+ <UML:Class xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001017'/>
+ </UML:Generalization.child>
+ <UML:Generalization.parent>
+ <UML:Class xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000100B'/>
+ </UML:Generalization.parent>
+ </UML:Generalization>
+ <UML:Class xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101F'
+ name = 'Party2' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Generalization xmi.id = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:0000000000001020'
+ isSpecification = 'false'>
+ <UML:Generalization.child>
+ <UML:Class xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008DA'/>
+ </UML:Generalization.child>
+ <UML:Generalization.parent>
+ <UML:Class xmi.idref = '-64--88-99-15-7b62aac4:121aaa56ef3:-8000:000000000000101F'/>
+ </UML:Generalization.parent>
+ </UML:Generalization>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000121D'
+ name = 'topia' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Package xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000121E'
+ name = 'test' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Package xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000121F'
+ name = 'entities' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001220'
+ name = 'Person' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001228'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001229'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000122A'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000122B'
+ name = 'firstname' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000122C'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000122D'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001221'
+ name = 'Pet' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001222'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001223'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001224'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ <UML:Attribute xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001225'
+ name = 'type' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001226'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001227'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001237'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001238'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001239'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000123A'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-13652238:1219c622604:-8000:0000000000001220'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000123B'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000123F'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000123E'
+ lower = '0' upper = '-1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-13652238:1219c622604:-8000:0000000000001221'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:000000000000102A'
+ name = '' isSpecification = 'false' isRoot = 'false' isLeaf = 'false' isAbstract = 'false'>
+ <UML:Association.connection>
+ <UML:AssociationEnd xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:000000000000102B'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'false' ordering = 'unordered'
+ aggregation = 'composite' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:000000000000102C'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:000000000000102D'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1-13652238:1219c622604:-8000:0000000000001221'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ <UML:AssociationEnd xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:000000000000102E'
+ visibility = 'public' isSpecification = 'false' isNavigable = 'true' ordering = 'unordered'
+ aggregation = 'none' targetScope = 'instance' changeability = 'changeable'>
+ <UML:AssociationEnd.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:000000000000102F'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:0000000000001030'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:AssociationEnd.multiplicity>
+ <UML:AssociationEnd.participant>
+ <UML:Class xmi.idref = '127-0-0-1--7876194c:121c66e8e17:-8000:0000000000001029'/>
+ </UML:AssociationEnd.participant>
+ </UML:AssociationEnd>
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:0000000000001029'
+ name = 'Race' visibility = 'public' isSpecification = 'false' isRoot = 'false'
+ isLeaf = 'false' isAbstract = 'false' isActive = 'false'>
+ <UML:ModelElement.stereotype>
+ <UML:Stereotype xmi.idref = '127-0-0-1-3f03561c:11667f969c5:-8000:00000000000008E7'/>
+ </UML:ModelElement.stereotype>
+ <UML:Classifier.feature>
+ <UML:Attribute xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:0000000000001031'
+ name = 'name' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:0000000000001032'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1--7876194c:121c66e8e17:-8000:0000000000001033'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:Class href = 'http://argouml.org/profiles/uml14/default-java.xmi#.:0000000000000859'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Stereotype xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E73'
+ name = 'bean' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E74'
+ name = 'dto' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Stereotype.baseClass>Class</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Stereotype xmi.id = '-64--88-99-15-6093e433:1215d2d04f2:-8000:0000000000000E78'
+ name = 'realize' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Stereotype.baseClass>Abstraction</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ <UML:Package xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001031'
+ name = 'java.util' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Namespace.ownedElement>
+ <UML:Class xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001032'
+ name = 'Set<Contact2>' visibility = 'public' isSpecification = 'false'
+ isRoot = 'false' isLeaf = 'false' isAbstract = 'false' isActive = 'false'/>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Stereotype xmi.id = '-64--88-99-15--164a0c3b:121af97fc30:-8000:0000000000001034'
+ name = 'dao' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ isAbstract = 'false'>
+ <UML:Stereotype.baseClass>Operation</UML:Stereotype.baseClass>
+ </UML:Stereotype>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001233'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:0000000000001234'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000123C'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-0-1-13652238:1219c622604:-8000:000000000000123D'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </XMI.content>
+</XMI>
Added: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.zargo
===================================================================
(Binary files differ)
Property changes on: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/src/test/xmi/topiatest.zargo
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/verify.groovy
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/verify.groovy 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/verify.groovy 2009-12-16 23:12:41 UTC (rev 761)
@@ -38,5 +38,47 @@
assert new File(basedir, 'target/generated-sources-xmi2StateModel/models/topiatest.properties').exists();
assert new File(basedir, 'target/generated-sources-xmi2StateModel/models/topiatest.statemodel').exists();
+//
+// Test phase
+//
+
+// Zargo to object model
+
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel').exists();
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel/test-xmi').exists();
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel/test-xmi/topiatest.properties').exists();
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel/test-xmi/topiatest.xmi').exists();
+
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel/test-models').exists();
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel/test-models/topiatest.properties').exists();
+assert new File(basedir, 'target/generated-sources-zargo2ObjectModel/test-models/topiatest.objectmodel').exists();
+
+// Zargo to state model
+
+assert new File(basedir, 'target/generated-sources-zargo2StateModel').exists();
+
+assert new File(basedir, 'target/generated-sources-zargo2StateModel/test-xmi').exists();
+assert new File(basedir, 'target/generated-sources-zargo2StateModel/test-xmi/topiatest.properties').exists();
+assert new File(basedir, 'target/generated-sources-zargo2StateModel/xmi/topiatest.xmi').exists();
+
+assert new File(basedir, 'target/generated-sources-zargo2StateModel/test-models').exists();
+assert new File(basedir, 'target/generated-sources-zargo2StateModel/test-models/topiatest.properties').exists();
+assert new File(basedir, 'target/generated-sources-zargo2StateModel/test-models/topiatest.statemodel').exists();
+
+// Xmi to object model
+
+assert new File(basedir, 'target/generated-sources-xmi2ObjectModel').exists();
+assert new File(basedir, 'target/generated-sources-xmi2ObjectModel/test-models').exists();
+assert new File(basedir, 'target/generated-sources-xmi2ObjectModel/test-models/topiatest.properties').exists();
+assert new File(basedir, 'target/generated-sources-xmi2ObjectModel/test-models/topiatest.objectmodel').exists();
+
+
+// Xmi to state model
+
+assert new File(basedir, 'target/generated-sources-xmi2StateModel').exists();
+assert new File(basedir, 'target/generated-sources-xmi2StateModel/test-models').exists();
+assert new File(basedir, 'target/generated-sources-xmi2StateModel/test-models/topiatest.properties').exists();
+assert new File(basedir, 'target/generated-sources-xmi2StateModel/test-models/topiatest.statemodel').exists();
+
return true;
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -26,7 +26,6 @@
import org.nuiton.eugene.ModelFileWriter;
import org.nuiton.eugene.ModelFileWriterConfiguration;
import org.nuiton.eugene.ModelFileWriterUtil;
-import org.nuiton.eugene.models.Model;
import org.nuiton.eugene.plugin.writer.BaseModelFileWriter;
import org.nuiton.eugene.plugin.writer.BaseXmiToModelFileWriter;
@@ -240,11 +239,6 @@
}
@Override
- public Class<? extends Model> getModelClass() {
- return modelClass;
- }
-
- @Override
public File getBasedir() {
return getProject().getBasedir();
}
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -48,7 +48,7 @@
*/
public abstract class BaseXmiToModelFileWriter extends BaseModelFileWriter {
public static final String PROP_RESOLVER = "resolver";
- public static final String PROP_EXTRACTED_PACKAGES = "extractedPackages";
+// public static final String PROP_EXTRACTED_PACKAGES = "extractedPackages";
public static final String PROP_FULL_PACKAGE_PATH = "fullPackagePath";
/**
@@ -97,6 +97,16 @@
return "models";
}
+ @Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/xmi";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-models";
+ }
+
protected TransformerFactory transformerFactory;
protected TransformerFactory getTransformerFactory() {
@@ -110,9 +120,9 @@
return getProperty(PROP_FULL_PACKAGE_PATH, String.class);
}
- public String getExtractedPackages() {
- return getProperty(PROP_EXTRACTED_PACKAGES, String.class);
- }
+// public String getExtractedPackages() {
+// return getProperty(PROP_EXTRACTED_PACKAGES, String.class);
+// }
public String getResolver() {
return getProperty(PROP_RESOLVER, String.class);
@@ -126,7 +136,7 @@
getLog().info("Processing XSL tranformation on " + inputDirectory + " for " + includePattern);
getLog().info(" with fullPackagePath : " + getFullPackagePath());
- getLog().info(" with extractedPackages : " + getExtractedPackages());
+// getLog().info(" with extractedPackages : " + getExtractedPackages());
// getLog().info(" with acceptedXmiTypes : " + getFullPackagePath());
getLog().info(" with resolver : " + getResolver());
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -44,8 +44,6 @@
public class XmiToObjectModelFileWriter extends BaseXmiToModelFileWriter {
- public static final String[] XMI_FILE_FILTER = new String[]{"*.xmi", "**/*.xmi"};
-
@Override
public <M extends Model> boolean acceptModel(Class<M> modelType) {
// accept only state models
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java 2009-12-16 20:22:40 UTC (rev 760)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java 2009-12-16 23:12:41 UTC (rev 761)
@@ -76,6 +76,16 @@
}
@Override
+ public String getDefaultTestInputDirectory() {
+ return "src/test/xmi";
+ }
+
+ @Override
+ public String getDefaultTestOutputDirectory() {
+ return "test-xmi";
+ }
+
+ @Override
public void generate(File outputDir, File inputDirectory, String includePattern, boolean overwrite) throws IOException {
PluginIOContext ioContext = new PluginIOContext();
1
0
16 Dec '09
Author: tchemit
Date: 2009-12-16 21:22:40 +0100 (Wed, 16 Dec 2009)
New Revision: 760
Modified:
trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml
Log:
by default, modelType is objectmodel
Modified: trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml 2009-12-16 20:18:32 UTC (rev 759)
+++ trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml 2009-12-16 20:22:40 UTC (rev 760)
@@ -85,7 +85,7 @@
<version>${project.version}</version>
<configuration>
<extraClassPathDirectory>target/classes</extraClassPathDirectory>
- <modelType>objectmodel</modelType>
+ <!--<modelType>objectmodel</modelType>-->
<testPhase>true</testPhase>
<generateResources>
<input>src/main/models</input>
1
0
r759 - in trunk: eugene/src/main/java/org/nuiton/eugene/java eugene/src/test/resources maven-eugene-plugin maven-eugene-plugin/src/it/generate/generators maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin
by tchemit@users.nuiton.org 16 Dec '09
by tchemit@users.nuiton.org 16 Dec '09
16 Dec '09
Author: tchemit
Date: 2009-12-16 21:18:32 +0100 (Wed, 16 Dec 2009)
New Revision: 759
Added:
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java
trunk/eugene/src/test/resources/log4j.properties
trunk/maven-eugene-plugin/pom.xml
trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml
trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanGenerator.java
trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanTransformer.java
trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/Megatron.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java
Log:
register concrete templates as plexus components, pass log to info in tests, introduce GenerateFromModels mojo
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/java/JavaGenerator.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -50,6 +50,7 @@
*
* Mise a jour: $Date$
* par : $Author$
+ * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.java.JavaGenerator"
*/
public class JavaGenerator extends ObjectModelGenerator {
Modified: trunk/eugene/src/test/resources/log4j.properties
===================================================================
--- trunk/eugene/src/test/resources/log4j.properties 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/eugene/src/test/resources/log4j.properties 2009-12-16 20:18:32 UTC (rev 759)
@@ -7,5 +7,5 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.org.nuiton.eugene=DEBUG
+log4j.logger.org.nuiton.eugene=INFO
log4j.logger.org.apache.commons.digester=INFO
\ No newline at end of file
Modified: trunk/maven-eugene-plugin/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/pom.xml 2009-12-16 20:18:32 UTC (rev 759)
@@ -100,200 +100,10 @@
<pluginManagement>
<plugins>
- <!--plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${javadoc.version}</version>
- <configuration>
- <docencoding>${project.reporting.outputEncoding}</docencoding>
- <encoding>${project.reporting.outputEncoding}</encoding>
- <charset>${project.reporting.outputEncoding}</charset>
- <quiet>true</quiet>
- <skip>${maven.javadoc.skip}</skip>
- <taglets>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>
- org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>
- org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
-
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- </taglets>
- </configuration>
- </plugin-->
-
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.4</version>
</plugin>
-
</plugins>
</pluginManagement>
@@ -306,200 +116,6 @@
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
</plugin>
-
-
- <!--plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>${javadoc.version}</version>
- <configuration>
- <quiet>true</quiet>
- <skip>${maven.javadoc.skip}</skip>
- <docencoding>${project.build.sourceEncoding}</docencoding>
- <encoding>${project.build.sourceEncoding}</encoding>
- <charset>${project.reporting.outputEncoding}</charset>
- <excludePackageNames>${maven.javadoc.excludePackageNames}</excludePackageNames>
- <taglets>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>
- org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet
- </tagletClass>
- <tagletArtifact>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-tools-javadoc</artifactId>
- <version>2.4.2</version>
- </tagletArtifact>
- </taglet>
-
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- <taglet>
- <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </taglet>
- </taglets>
- </configuration>
- <reportSets>
- <reportSet>
- <reports>
- <report>javadoc</report>
- <report>test-javadoc</report>
- </reports>
- </reportSet>
- </reportSets>
- </plugin-->
</plugins>
</reporting>
Modified: trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml 2009-12-16 20:18:32 UTC (rev 759)
@@ -75,9 +75,7 @@
</executions>
<configuration>
<includes>**/*.java</includes>
- <filters>
- org.nuiton.processor.filters.GeneratorTemplatesFilter
- </filters>
+ <filters>org.nuiton.processor.filters.GeneratorTemplatesFilter</filters>
</configuration>
</plugin>
@@ -99,12 +97,11 @@
<id>Test Regression Generator</id>
<phase>generate-test-sources</phase>
<configuration>
- <!--<reader>org.nuiton.eugene.ObjectModelReader</reader>-->
<includes>dtotest.objectmodel</includes>
<templates>org.nuiton.eugene.test.generator.BeanGenerator</templates>
</configuration>
<goals>
- <goal>generate</goal>
+ <goal>generate-from-models</goal>
</goals>
</execution>
<execution>
@@ -115,19 +112,18 @@
<templates>org.nuiton.eugene.java.JavaGenerator</templates>
</configuration>
<goals>
- <goal>generate</goal>
+ <goal>generate-from-models</goal>
</goals>
</execution>
<execution>
<id>Test Bean Transformer</id>
<phase>generate-test-sources</phase>
<configuration>
- <!--<reader>org.nuiton.eugene.ObjectModelReader</reader>-->
<includes>dtotest2.objectmodel</includes>
<templates>org.nuiton.eugene.test.generator.BeanTransformer</templates>
</configuration>
<goals>
- <goal>generate</goal>
+ <goal>generate-from-models</goal>
</goals>
</execution>
</executions>
Modified: trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanGenerator.java
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanGenerator.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanGenerator.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -27,6 +27,7 @@
*
* Mise a jour: $Date$
* par : $Author: chemit $
+* @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.topia.generator.BeanGenerator"
*/
package org.nuiton.eugene.test.generator;
@@ -63,6 +64,7 @@
/**
* DTO generator
+ * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.test.generator.BeanGenerator"
*/
public class BeanGenerator extends ObjectModelGenerator {
Modified: trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanTransformer.java
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanTransformer.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/BeanTransformer.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -42,6 +42,7 @@
* <p/>
* Mise a jour: $Date$
* par : $Author: fdesbois $
+ * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.test.generator.BeanTransformer"
*/
public class BeanTransformer extends ObjectModelTransformerToJava {
Modified: trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/Megatron.java
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/Megatron.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/it/generate/generators/src/main/java/org/nuiton/eugene/test/generator/Megatron.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -15,6 +15,7 @@
*
* Mise a jour: $Date$
* par : $Author$
+ * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.eugene.test.generator.Megatron"
*/
public class Megatron extends ObjectModelTransformerToJava {
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -84,8 +84,10 @@
protected boolean testPhase;
/**
* The type of model to be used.
+ * <p/>
+ * By default, use an {@code objectmodel}.
*
- * @parameter expression="${eugene.modelType}"
+ * @parameter expression="${eugene.modelType}" default-value="objectmodel"
* @required
* @since 2.0.0
*/
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -53,9 +53,9 @@
* <p/>
* Last update: $Date$
* by : $Author$
- * @goal generate-old
+ * @goal generate
* @requiresProject true
- * @deprecated since 2.0.0, use now the {@link GenerateMojo}.
+ * @deprecated since 2.0.0, use now the {@link GenerateFromModelsMojo}.
*/
@Deprecated
public class EugenePlugin extends EugeneAbstractMojo {
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java 2009-12-16 18:01:51 UTC (rev 758)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GeneratateModelFilesMojo.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -42,7 +42,7 @@
* Time: 00:22:37
*
* @goal generate-model-files
- * @projectRequired true
+ * @requiresProject true
* @requiresDependencyResolution compile
*/
public class GeneratateModelFilesMojo extends AbstractEugeneMojo implements ModelFileWriterConfiguration {
@@ -68,18 +68,18 @@
* <p/>
* Example :
* <pre>
- * <includes>
- * <include>zargo:<include>
- * <include>src/main/xmi2:**\/*.zargo<include>
- * <include>zargo:src/main/xmi:**\/*.zargo2<include>
- * </includes>
+ * <inputFiles>
+ * <inputFile>zargo:<inputFile>
+ * <inputFile>src/main/xmi2:**\/*.zargo<inputFile>
+ * <inputFile>zargo:src/main/xmi:**\/*.zargo2<inputFile>
+ * </inputFiles>
* </pre>
*
- * @parameter expression="${eugene.includes}"
+ * @parameter expression="${eugene.inputFiles}"
* @required
* @since 2.0.0
*/
- protected String[] includes;
+ protected String[] inputFiles;
/**
* Where to generate files.
*
@@ -109,14 +109,14 @@
* @since 2.0.0
*/
protected String fullPackagePath;
+// /**
+// * Nom du paquetage à générer
+// *
+// * @parameter expression="${generator.extractedPackages}" default-value="${project.groupId}.${project.artifactId}"
+// * @since 2.0.0
+// */
+// protected String extractedPackages;
/**
- * Nom du paquetage à générer
- *
- * @parameter expression="${generator.extractedPackages}" default-value="${project.groupId}.${project.artifactId}"
- * @since 2.0.0
- */
- protected String extractedPackages;
- /**
* Nom du resolver a utiliser
*
* @parameter expression="${generator.resolver}" default-value="org.nuiton.util.ResourceResolver"
@@ -124,25 +124,15 @@
*/
protected String resolver;
/**
- * An extra directory to be added to the classpath.
- *
- * @parameter expression="${eugene.extraClassPathDirectory}"
- * @since 2.0.0
- */
- protected File extraClassPathDirectory;
-
- /**
* All available writers
*
* @component role="org.nuiton.eugene.ModelFileWriter"
*/
protected Map<String, ModelFileWriter> writers;
-
/**
* All available writers for the given {@link #getModelClass()}
*/
protected Set<ModelFileWriter> availableWriters;
-
/**
* Writers to process
*/
@@ -151,37 +141,39 @@
@Override
protected boolean init() throws Exception {
boolean b = super.init();
- if (b) {
- if (includes.length == 0) {
- throw new MojoExecutionException("Must specify something to include using the includes property");
- }
+ if (!b) {
+ return false;
+ }
+ if (inputFiles.length == 0) {
+ throw new MojoExecutionException("Must specify something to include using the includes property");
+ }
- availableWriters = ModelFileWriterUtil.filterWriterForModelType(writers, getModelClass());
+ availableWriters = ModelFileWriterUtil.filterWriterForModelType(writers, getModelClass());
- if (availableWriters.isEmpty()) {
- throw new MojoExecutionException("Could not find any writer in class-path.");
- }
+ if (availableWriters.isEmpty()) {
+ throw new MojoExecutionException("Could not find any writer in class-path.");
+ }
- for (ModelFileWriter writer : availableWriters) {
- if (writer instanceof BaseModelFileWriter) {
- ((BaseModelFileWriter) writer).setLog(getLog());
- }
+ for (ModelFileWriter writer : availableWriters) {
+ if (writer instanceof BaseModelFileWriter) {
+ // add log support
+ ((BaseModelFileWriter) writer).setLog(getLog());
}
+ }
- plan = new ArrayList<ModelFileWriter>();
+ plan = new ArrayList<ModelFileWriter>();
- // first pass to detect top level writers
- for (String include : includes) {
+ // first pass to detect top level writers
+ for (String include : inputFiles) {
- getLog().info("Register include : " + include);
- ModelFileWriterUtil.registerInclude(this, include, plan);
- }
+ getLog().info("Register include : " + include);
+ ModelFileWriterUtil.registerInclude(this, include, plan);
+ }
- if (properties == null) {
- properties = new TreeMap<String, Object>();
- }
+ if (properties == null) {
+ properties = new TreeMap<String, Object>();
}
- return b;
+ return true;
}
@Override
@@ -272,6 +264,7 @@
List<URL> urls = new ArrayList<URL>();
try {
ClassLoader loader;
+ File extraClassPathDirectory = getExtraClassPathDirectory();
if (extraClassPathDirectory != null) {
if (verbose) {
getLog().info("Add extra directory in generator's classLoader : " + extraClassPathDirectory);
Added: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java (rev 0)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java 2009-12-16 20:18:32 UTC (rev 759)
@@ -0,0 +1,501 @@
+package org.nuiton.eugene.plugin;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.nuiton.eugene.ModelReader;
+import org.nuiton.eugene.Template;
+import org.nuiton.eugene.models.Model;
+import org.nuiton.plugin.PluginHelper;
+import org.nuiton.plugin.PluginIOContext;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.*;
+
+/**
+ * Created: 15 déc. 2009
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com> Copyright Code Lutin
+ * @version $Revision$
+ * <p/>
+ * Mise a jour: $Date$ par :
+ * $Author: tchemit $
+ * @goal generate-from-models
+ * @requiresProject true
+ * @since 2.0.0 (replace previous goal {@link EugenePlugin}).
+ */
+public class GenerateFromModelsMojo extends AbstractEugeneMojo {
+
+ /**
+ * Les entrées sorties du plugin.
+ * <p/>
+ * <p/>
+ * <p/>
+ * En entrée on demande des répertoires où chercher les fichiers objectmodel a convertir.
+ * <p/>
+ * En sortie on demande le répertoire ou generer les classes java.
+ * <p/>
+ * Par défaut on a les valeurs suivantes :
+ * </p>
+ * <pre>
+ * <generateResources>
+ * </p>
+ * <input>target/generated-sources/models</input>
+ * </p>
+ * <output>target/generated-sources/java</output>
+ * </p>
+ * </generateResources>
+ * </pre>
+ * </p>
+ * <p/>
+ * Note: si {@link #testPhase} est activée, les valeurs par défaut sont :
+ * </p>
+ * <pre>
+ * <generateResources>
+ * </p>
+ * <input>target/generated-sources/test-models</input>
+ * </p>
+ * <output>target/generated-sources/test-java</output>
+ * </p>
+ * </generateResources>
+ * </pre>
+ *
+ * @parameter
+ * @since 1.0.0-rc-8
+ */
+ protected PluginIOContext generateResources;
+ /**
+ * Templates à utiliser, séparés par des virgules.
+ *
+ * @parameter expression="${eugene.templates}"
+ * @required
+ * @since 0.50
+ */
+ protected String templates;
+ /**
+ * Templates à ne pas utiliser.
+ *
+ * @parameter expression="${eugene.excludeTemplates}"
+ * @since 0.63
+ */
+ protected String[] excludeTemplates;
+ /**
+ * Fichier à inclure.
+ *
+ * @parameter expression="${eugene.includes}" default-value="*.*model"
+ * @since 0.50
+ */
+ protected String includes;
+ /**
+ * Nom par défaut du paquetage généré.
+ *
+ * @parameter expression="${eugene.defaultPackage}" default-value="${project.groupId}.${project.artifactId}"
+ * @since 0.50
+ */
+ protected String defaultPackage;
+ /**
+ * List of packages to generate (comma separated).
+ * <p/>
+ * If the parameter is not filled, will generate all packages.
+ *
+ * @parameter expression="${eugene.generatedPackages}"
+ * @since 1.0.0-rc-8
+ */
+ protected String generatedPackages;
+ /**
+ * To define a specific reader to use to transform input files in a Model to generate.
+ * <p/>
+ * If nothing is specified, will use the reader corresponding to the given {@link #modelType}.
+ *
+ * @parameter expression="${eugene.reader}"
+ * @since 1.1.0
+ */
+ protected String reader;
+ /**
+ * All available writers
+ *
+ * @component role="org.nuiton.eugene.ModelReader"
+ */
+ protected Map<String, ModelReader<?>> availableReaders;
+ /**
+ * All available templates
+ *
+ * @component role="org.nuiton.eugene.Template"
+ */
+ protected Map<String, Template<?>> availableTemplates;
+
+ /**
+ * model reader instance
+ */
+ protected ModelReader<?> modelReader;
+ /**
+ * fixed classloader
+ */
+ protected ClassLoader fixedClassLoader;
+ /**
+ * list of templates to apply
+ */
+ protected List<Template<Model>> templatesList;
+ /**
+ * list of model files to load in the memory reader via the model reader
+ */
+ protected File[] modelFiles;
+
+ @Override
+ protected boolean init() throws Exception {
+ boolean b = super.init();
+ if (!b) {
+ // something wrong from the super class, skip now
+ return false;
+ }
+
+ // init goal io context
+
+ generateResources = initResources();
+
+ if (generateResources == null) {
+ // could not be init...
+ return false;
+ }
+
+ // init reader
+
+ modelReader = getModelReader();
+ if (modelReader == null) {
+ // could not be init...
+ return false;
+ }
+
+ // get templates to use
+
+ templatesList = getTemplates(getFixedClassLoader());
+
+ if (templatesList == null || templatesList.isEmpty()) {
+ getLog().error("No template to apply.");
+ return false;
+ }
+
+ //TODO Check excludeTemplates are sane :)
+
+ // get models to treate
+
+ modelFiles = getModelFiles(generateResources);
+ if (modelFiles.length == 0) {
+ // can skip
+ getLog().warn("No model to treate.");
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void doAction() throws MojoExecutionException, MojoFailureException {
+
+ getLog().info("Generating java sources from models");
+ getLog().info(" reader : " + modelReader.getClass().getName());
+ getLog().info(" includes : " + includes);
+ getLog().info(" using template : " + templates);
+ getLog().info(" using defaultPackage : " + defaultPackage);
+
+ if (verbose) {
+ for (File m : modelFiles) {
+ getLog().info("will treate model file : " + m);
+ }
+ }
+
+ // prepare template properties
+
+ Properties templateProperties = new Properties();
+ templateProperties.setProperty(Template.PROP_DEFAULT_PACKAGE, defaultPackage);
+ templateProperties.setProperty(Template.PROP_OVERWRITE, String.valueOf(overwrite));
+ templateProperties.setProperty(Template.PROP_ENCODING, encoding);
+ templateProperties.setProperty(Template.PROP_LAST_MODIFIED_SOURCE, String.valueOf(modelReader.getLastModifiedSource()));
+ if (StringUtils.isEmpty(generatedPackages)) {
+ getLog().info(" generating all packages");
+ } else {
+ templateProperties.setProperty(Template.PROP_GENERATED_PACKAGES, generatedPackages);
+ getLog().info(" generating only for packages " + generatedPackages);
+ }
+ templateProperties.setProperty(Template.PROP_EXCLUDE_TEMPLATES, getExcludeTemplatesAsString());
+
+ // read the model
+
+ Model model = modelReader.read(modelFiles);
+
+ // apply all templates to the model
+
+ for (Template<Model> template : templatesList) {
+ getLog().info("Apply " + template.getClass().getSimpleName() + " generator");
+
+ try {
+
+ // init template
+ template.setProperties(templateProperties);
+
+ // apply template
+ template.applyTemplate(model, generateResources.getOutput());
+ } catch (IOException eee) {
+ throw new MojoExecutionException("Generation problem", eee);
+ }
+ }
+
+ // fix compile root sources
+
+ fixCompileSourceRoots();
+
+ }
+
+ /**
+ * Init the {@link #generateResources} io context and return it.
+ * <p/>
+ * <b>Note:</b> If something wrong appears, then return a {@code null} value.
+ *
+ * @return the io context to use for the goal, or {@code null} if something was wrong
+ */
+ protected PluginIOContext initResources() {
+
+ File defaultIn = getFileFromBasedir("target", "generated-sources", "models");
+ File defaultOut = getFileFromBasedir("target", "generated-sources", "java");
+
+ File defaultTestIn = getFileFromBasedir("target", "generated-sources", "test-models");
+ File defaultTestOut = getFileFromBasedir("target", "generated-sources", "test-java");
+
+ PluginIOContext p = initResources(generateResources, defaultIn, defaultOut, defaultTestIn, defaultTestOut);
+
+ // check context
+
+ if ((p.getInputs() == null || p.getInputs().length == 0)) {
+ getLog().error("no input defined");
+ return null;
+ }
+ if (p.getOutput() == null) {
+ getLog().error("no output defined");
+ return null;
+ }
+
+ if (!p.getOutput().exists()) {
+ boolean b2 = p.getOutput().mkdirs();
+ if (!b2) {
+ getLog().error("could not create directory " + p.getOutput());
+ p = null;
+ }
+ }
+
+ return p;
+ }
+
+ /**
+ * Obtain the reader to use to read the model.
+ * <p/>
+ * <b>Note:</b> If something wrong appears, the return a {@code null} value.
+ *
+ * @return the model reader to use to obtain the model to treate, or {@code null} if something was wrong.
+ */
+ protected ModelReader<?> getModelReader() {
+
+ ModelReader<?> modelReader;
+
+ if (reader != null && !reader.trim().isEmpty()) {
+ // try to load a specific reader
+ try {
+ ClassLoader fixedClassLoader = getFixedClassLoader();
+ modelReader = (ModelReader<?>) Class.forName(reader, true, fixedClassLoader).newInstance();
+ //TODO : should check that the reader is compatible with given modelType
+ } catch (Exception eee) {
+ getLog().error("could not obtain reader " + reader + " for reason : " + eee.getMessage());
+ return null;
+ }
+ } else {
+ modelReader = availableReaders.get(modelType);
+ if (modelReader == null) {
+ getLog().error("could not find a model reader for modelType : " + modelType + ", availables readers : " + availableReaders.values());
+ return null;
+ }
+ }
+ return modelReader;
+ }
+
+ /**
+ * Recuperation de la liste des fichiers de modele a traite.
+ *
+ * @param ioContext io context
+ * @return la liste des modeles a utiliser
+ */
+ protected File[] getModelFiles(PluginIOContext ioContext) {
+
+ List<File> modelFiles = new ArrayList<File>();
+ String[] includePatterns = includes.split(",");
+
+ for (File srcDirGen : ioContext.getInputs()) {
+
+ if (verbose) {
+ getLog().info("Search for " + Arrays.toString(includePatterns) + " in " + srcDirGen.getAbsolutePath());
+ }
+ List<File> currentFiles = PluginHelper.getIncludedFiles(srcDirGen, includePatterns, null);
+ modelFiles.addAll(currentFiles);
+ }
+ return modelFiles.toArray(new File[modelFiles.size()]);
+ }
+
+ /**
+ * Obtain the list of templates to apply to model.
+ * <p/>
+ * <b>Note:</b> If something wrong appears, then return a {@code null} value.
+ *
+ * @param fixedClassLoader classloader to use to seek of templates
+ * @return list of templates to apply, or {@code null} if something was wrong
+ */
+ protected List<Template<Model>> getTemplates(ClassLoader fixedClassLoader) {
+
+ List<Template<Model>> templatesList = new ArrayList<Template<Model>>();
+ String[] templatesNames = templates.split(",");
+ for (String templateName : templatesNames) {
+ // remove trailing spaces
+ templateName = templateName.trim();
+ Template<Model> template;
+
+ template = (Template<Model>) availableTemplates.get(templateName);
+ if (template == null) {
+ getLog().warn("template [" + templateName + "] is not registred via plexus, try to load it directly");
+ try {
+ template = (Template<Model>) Class.forName(templateName, true, fixedClassLoader).newInstance();
+ } catch (Exception e) {
+ getLog().error("Can't obtain template [" + templateName + "] for reason " + e.getMessage(), e);
+ return null;
+ }
+ // will use this template
+ templatesList.add(template);
+ }
+ }
+ return templatesList;
+ }
+
+ /**
+ * @return the string representation of excludesTemplates (separated by comma)
+ */
+ protected String getExcludeTemplatesAsString() {
+ String result = "";
+ for (int i = 0; i < excludeTemplates.length; i++) {
+ result += excludeTemplates[i];
+ if (i != excludeTemplates.length - 1) {
+ result += ",";
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Prepare le classLoader a utiliser dans le generateur.
+ * <p/>
+ * Si un {@link #extraClassPathDirectory} a été renseigné, il est rajouté.
+ * <p/>
+ * Si des références à des sibling modules, ils seront rajoutés aussi.
+ *
+ * @return le class loader modifie
+ * @throws MojoExecutionException if any pb
+ */
+
+ public ClassLoader getFixedClassLoader() throws MojoExecutionException {
+
+ if (fixedClassLoader == null) {
+
+ List<URL> urls = new ArrayList<URL>();
+ Set<String> urlsAsString = new HashSet<String>();
+ try {
+ ClassLoader loader;
+ File extraClassPathDirectory = getExtraClassPathDirectory();
+ if (extraClassPathDirectory != null) {
+ if (verbose) {
+ getLog().info("Add extra directory in generator's classLoader : " + extraClassPathDirectory);
+ }
+ addDirectoryToUrlsList(extraClassPathDirectory, urls, urlsAsString);
+ }
+ if (project.getProjectReferences() != null) {
+ // this case is for multi-module when calling from a parent module
+ for (Object o : project.getProjectReferences().entrySet()) {
+ Map.Entry<?, ?> entry = (Map.Entry<?, ?>) o;
+ MavenProject relatedProject = (MavenProject) entry.getValue();
+ if (verbose) {
+ getLog().info("Add project reference in generator's classLoader : '" + relatedProject.getArtifact() + "'");
+ }
+ //TODO il faudrait peut-etre aussi ajouter les dependances ?
+ addDirectoryToUrlsList(relatedProject.getArtifact().getFile(), urls, urlsAsString);
+ }
+ }
+ if (!project.getArtifacts().isEmpty()) {
+ // this is a special case when artifacts were resolved (for example in site phase)
+ if (verbose) {
+ getLog().info("Use resolved artifacts to build class-path");
+ }
+ for (Object o : project.getArtifacts()) {
+ Artifact a = (Artifact) o;
+ if (!a.getScope().equals("provided")) {
+ addDirectoryToUrlsList(a.getFile(), urls, urlsAsString);
+ }
+ }
+ }
+ // we ask to add the directory in classloader
+ loader = getClass().getClassLoader();
+ if (!urls.isEmpty()) {
+ loader = new URLClassLoader(urls.toArray(new URL[urls.size()]),
+ loader);
+ }
+ fixedClassLoader = loader;
+ } catch (MalformedURLException e) {
+ throw new MojoExecutionException(e.getMessage());
+ } finally {
+ urls.clear();
+ urlsAsString.clear();
+ }
+ }
+ return fixedClassLoader;
+ }
+
+ /**
+ * permet d'ajout le répertoire de génération des fichiers java dans les répertoires
+ * de compilation du projet Maven.
+ */
+ protected void fixCompileSourceRoots() {
+
+ //FIXME-TC20091215 : should never have a null project, this is not normal
+ if (project == null) {
+ // no project defined, can not fix anything
+ // this case could appears if we wanted to do some tests of the plugin
+ return;
+ }
+
+ File destDirGen = generateResources.getOutput();
+
+ //TODO-TC20091016 should use AbstractPlugin api
+ if (testPhase) {
+ if (!project.getTestCompileSourceRoots().contains(destDirGen.getPath())) {
+ getLog().info("Add test compile source root : " + destDirGen);
+ project.addTestCompileSourceRoot(destDirGen.getPath());
+ Resource resources = new Resource();
+ resources.setDirectory(destDirGen.getAbsolutePath());
+ resources.setExcludes(Arrays.asList("**/*.java"));
+ getLog().info("Add test resource root :" + resources);
+ project.addTestResource(resources);
+ }
+ } else {
+ if (!project.getCompileSourceRoots().contains(destDirGen.getPath())) {
+ getLog().info("Add compile source root : " + destDirGen);
+ project.addCompileSourceRoot(destDirGen.getPath());
+ Resource resources = new Resource();
+ resources.setDirectory(destDirGen.getAbsolutePath());
+ resources.setExcludes(Arrays.asList("**/*.java"));
+ getLog().info("Add resource root :" + resources);
+ project.addResource(resources);
+ }
+ }
+ }
+
+
+}
Property changes on: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/GenerateFromModelsMojo.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL
1
0
Author: tchemit
Date: 2009-12-16 19:01:51 +0100 (Wed, 16 Dec 2009)
New Revision: 758
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java
trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java
trunk/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java
trunk/maven-eugene-plugin/pom.xml
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml
trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml
trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugeneAbstractMojo.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java
trunk/pom.xml
Log:
- there is no description tagglet for plexus components, just use the javadoc of the parameter :) (idem for mojo parameters)
- use one javadoc config for all project
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -48,7 +48,7 @@
import org.xml.sax.SAXException;
/**
- * ObjectModelReader
+ * To read object model files into an memory object model.
*
* Created: 26 oct. 2009
*
@@ -58,7 +58,7 @@
* Mise a jour: $Date$
* par : $Author$
*
- * @plexus.component role="org.nuiton.eugene.ModelReader" role-hint="objectmodel" description="Object model reader"
+ * @plexus.component role="org.nuiton.eugene.ModelReader" role-hint="objectmodel"
*/
public class ObjectModelReader extends ModelReader<ObjectModel> {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -36,7 +36,7 @@
import org.xml.sax.SAXException;
/**
- * StateModelReader
+ * To read state model files into a memory state model.
*
* Created: 26 oct. 2009
*
@@ -46,7 +46,7 @@
* Mise a jour: $Date$
* par : $Author$
*
- * @plexus.component role="org.nuiton.eugene.ModelReader" role-hint="statemodel" description="State model reader"
+ * @plexus.component role="org.nuiton.eugene.ModelReader" role-hint="statemodel"
*/
public class StateModelReader extends ModelReader<StateModel> {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -50,7 +50,7 @@
* Last update : $Date$
* by : $Author$
*
- * @plexus.component role="org.nuiton.eugene.models.Model" role-hint="objectmodel" description="Object model implementation"
+ * @plexus.component role="org.nuiton.eugene.models.Model" role-hint="objectmodel"
*/
public class ObjectModelImpl implements ObjectModel {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -29,7 +29,7 @@
import org.nuiton.eugene.models.state.StateModelStateChart;
/**
- * StateModelImpl.java
+ * Implementation of the {@link StateModel}.
*
* @author chatellier
* @version $Revision$
@@ -37,7 +37,7 @@
* Last update : $Date$
* By : $Author$
*
- * @plexus.component role="org.nuiton.eugene.models.Model" role-hint="statemodel" description="State model implementation"
+ * @plexus.component role="org.nuiton.eugene.models.Model" role-hint="statemodel"
*/
public class StateModelImpl implements StateModel {
Modified: trunk/maven-eugene-plugin/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/pom.xml 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
@@ -100,7 +100,7 @@
<pluginManagement>
<plugins>
- <plugin>
+ <!--plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.version}</version>
<configuration>
@@ -287,7 +287,7 @@
</taglet>
</taglets>
</configuration>
- </plugin>
+ </plugin-->
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
@@ -308,7 +308,7 @@
</plugin>
- <plugin>
+ <!--plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.version}</version>
<configuration>
@@ -499,7 +499,7 @@
</reports>
</reportSet>
</reportSets>
- </plugin>
+ </plugin-->
</plugins>
</reporting>
@@ -518,8 +518,10 @@
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<pomIncludes>
- <!--<pomInclude>generate/generators/pom.xml</pomInclude>-->
- <pomInclude>**/pom.xml</pomInclude>
+ <pomInclude>generate-model-files/testIncludeWithNoProtocol/pom.xml</pomInclude>
+ <pomInclude>generate-model-files/testIncludeWithOnlyProtocol/pom.xml</pomInclude>
+ <pomInclude>generate/generators/pom.xml</pomInclude>
+ <!--<pomInclude>**/pom.xml</pomInclude>-->
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath>
Modified: trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/it/generate/generators/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
@@ -85,19 +85,23 @@
<groupId>org.nuiton.eugene</groupId>
<artifactId>maven-eugene-plugin</artifactId>
<version>${project.version}</version>
+ <configuration>
+ <extraClassPathDirectory>target/classes</extraClassPathDirectory>
+ <modelType>objectmodel</modelType>
+ <testPhase>true</testPhase>
+ <generateResources>
+ <input>src/main/models</input>
+ </generateResources>
+ <defaultPackage>org.nuiton.eugene.test</defaultPackage>
+ </configuration>
<executions>
<execution>
<id>Test Regression Generator</id>
<phase>generate-test-sources</phase>
<configuration>
- <reader>org.nuiton.eugene.ObjectModelReader</reader>
+ <!--<reader>org.nuiton.eugene.ObjectModelReader</reader>-->
<includes>dtotest.objectmodel</includes>
<templates>org.nuiton.eugene.test.generator.BeanGenerator</templates>
- <defaultPackage>org.nuiton.eugene.test</defaultPackage>
- <extraClassPathDirectory>target/classes</extraClassPathDirectory>
- <generateResources>
- <input>src/main/models</input>
- </generateResources>
</configuration>
<goals>
<goal>generate</goal>
@@ -109,11 +113,6 @@
<configuration>
<reader>org.nuiton.eugene.test.generator.TestReader</reader>
<templates>org.nuiton.eugene.java.JavaGenerator</templates>
- <defaultPackage>org.nuiton.eugene.test</defaultPackage>
- <extraClassPathDirectory>target/classes</extraClassPathDirectory>
- <generateResources>
- <input>src/main/models</input>
- </generateResources>
</configuration>
<goals>
<goal>generate</goal>
@@ -123,14 +122,9 @@
<id>Test Bean Transformer</id>
<phase>generate-test-sources</phase>
<configuration>
- <reader>org.nuiton.eugene.ObjectModelReader</reader>
+ <!--<reader>org.nuiton.eugene.ObjectModelReader</reader>-->
<includes>dtotest2.objectmodel</includes>
<templates>org.nuiton.eugene.test.generator.BeanTransformer</templates>
- <defaultPackage>org.nuiton.eugene.test</defaultPackage>
- <extraClassPathDirectory>target/classes</extraClassPathDirectory>
- <generateResources>
- <input>src/main/models</input>
- </generateResources>
</configuration>
<goals>
<goal>generate</goal>
Modified: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithNoProtocol/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
@@ -65,9 +65,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>objectmodel</modelType>
- <includes>
- <include>src/main/zargo:**/*.zargo</include>
- </includes>
+ <inputFiles>
+ <inputFile>src/main/zargo:**/*.zargo</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia.test.entities</fullPackagePath>
<outputDirectory>target/generated-sources-zargo2ObjectModel</outputDirectory>
</configuration>
@@ -80,9 +80,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>statemodel</modelType>
- <includes>
- <include>src/main/zargo:**/*.zargo</include>
- </includes>
+ <inputFiles>
+ <inputFile>src/main/zargo:**/*.zargo</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia.test.entities</fullPackagePath>
<outputDirectory>target/generated-sources-zargo2StateModel</outputDirectory>
</configuration>
@@ -95,9 +95,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>objectmodel</modelType>
- <includes>
- <include>src/main/xmi:**/*.xmi</include>
- </includes>
+ <inputFiles>
+ <inputFile>src/main/xmi:**/*.xmi</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia</fullPackagePath>
<outputDirectory>target/generated-sources-xmi2ObjectModel</outputDirectory>
</configuration>
@@ -110,9 +110,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>statemodel</modelType>
- <includes>
- <include>src/main/xmi:**/*.xmi</include>
- </includes>
+ <inputFiles>
+ <inputFile>src/main/xmi:**/*.xmi</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia</fullPackagePath>
<outputDirectory>target/generated-sources-xmi2StateModel</outputDirectory>
</configuration>
Modified: trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml
===================================================================
--- trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/it/generate-model-files/testIncludeWithOnlyProtocol/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
@@ -65,9 +65,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>objectmodel</modelType>
- <includes>
- <include>zargo</include>
- </includes>
+ <inputFiles>
+ <inputFile>zargo</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia.test.entities</fullPackagePath>
<outputDirectory>target/generated-sources-zargo2ObjectModel</outputDirectory>
</configuration>
@@ -80,9 +80,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>statemodel</modelType>
- <includes>
- <include>zargo</include>
- </includes>
+ <inputFiles>
+ <inputFile>zargo</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia.test.entities</fullPackagePath>
<outputDirectory>target/generated-sources-zargo2StateModel</outputDirectory>
</configuration>
@@ -95,9 +95,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>objectmodel</modelType>
- <includes>
- <include>xmi</include>
- </includes>
+ <inputFiles>
+ <inputFile>xmi</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia</fullPackagePath>
<outputDirectory>target/generated-sources-xmi2ObjectModel</outputDirectory>
</configuration>
@@ -110,9 +110,9 @@
<phase>generate-sources</phase>
<configuration>
<modelType>statemodel</modelType>
- <includes>
- <include>xmi</include>
- </includes>
+ <inputFiles>
+ <inputFile>xmi</inputFile>
+ </inputFiles>
<fullPackagePath>org.nuiton.topia</fullPackagePath>
<outputDirectory>target/generated-sources-xmi2StateModel</outputDirectory>
</configuration>
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/AbstractEugeneMojo.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -25,7 +25,10 @@
import org.apache.maven.settings.Settings;
import org.nuiton.eugene.models.Model;
import org.nuiton.plugin.AbstractPlugin;
+import org.nuiton.plugin.PluginIOContext;
+import java.io.File;
+import java.util.Arrays;
import java.util.Map;
/**
@@ -38,14 +41,14 @@
/**
* Maven project.
*
- * @description Dépendance du projet.
* @parameter default-value="${project}"
* @readonly
* @since 2.0.0
*/
protected MavenProject project;
/**
- * @description le settings (pour obtenir le mode offline)
+ * Le settings (pour obtenir le mode offline).
+ *
* @parameter default-value="${settings}"
* @readonly
* @since 2.0.0
@@ -87,12 +90,21 @@
* @since 2.0.0
*/
protected String modelType;
-
-
+ /**
+ * An extra directory to be added to the classpath.
+ *
+ * @parameter expression="${eugene.extraClassPathDirectory}"
+ * @since 2.0.0
+ */
+ private File extraClassPathDirectory;
+ /**
+ * class instance of the given {@link #modelType}
+ */
protected Class<? extends Model> modelClass;
/**
- * All available models
+ * All available models (obtain by plexus, keys are plexus roles, values are a
+ * instance of corresponding model).
*
* @component role="org.nuiton.eugene.models.Model"
*/
@@ -111,7 +123,49 @@
return true;
}
+ /**
+ * Build the resources data to use for a goal.
+ *
+ * @param resources incoming resources data (form the goal
+ * @param defaultIn the default input directory
+ * @param defaultOut the default output directory
+ * @param defaultTestIn the default test input directory
+ * @param defaultTestOut the default test output directory
+ * @return the new {@link org.nuiton.plugin.PluginIOContext} to use in the goal
+ */
+ protected PluginIOContext initResources(PluginIOContext resources, File defaultIn, File defaultOut, File defaultTestIn, File defaultTestOut) {
+ if (resources == null) {
+ resources = new PluginIOContext();
+ }
+
+ // adding default inputs only if not consumed
+ if (resources.getInputs() == null) {
+ if (testPhase) {
+ resources.setInput(defaultTestIn);
+ } else {
+ resources.setInput(defaultIn);
+ }
+ getLog().info(" using default in : " + Arrays.asList(resources.getInputs()));
+ } else {
+ getLog().info(" in : " + Arrays.asList(resources.getInputs()));
+ }
+
+ if (resources.getOutput() == null) {
+ if (testPhase) {
+ resources.setOutput(defaultTestOut);
+ } else {
+ resources.setOutput(defaultOut);
+ }
+ getLog().info(" using default out : " + resources.getOutput());
+ } else {
+ getLog().info(" out : " + resources.getOutput());
+ }
+
+ return resources;
+ }
+
+
@Override
public MavenProject getProject() {
return project;
@@ -158,4 +212,27 @@
return settings.isOffline();
}
+ public boolean isTestPhase() {
+ return testPhase;
+ }
+
+ public void setTestPhase(boolean testPhase) {
+ this.testPhase = testPhase;
+ }
+
+ public Class<? extends Model> getModelClass() {
+ return modelClass;
+ }
+
+ public void setModelClass(Class<? extends Model> modelClass) {
+ this.modelClass = modelClass;
+ }
+
+ public File getExtraClassPathDirectory() {
+ return extraClassPathDirectory;
+ }
+
+ public void setExtraClassPathDirectory(File extraClassPathDirectory) {
+ this.extraClassPathDirectory = extraClassPathDirectory;
+ }
}
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugeneAbstractMojo.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugeneAbstractMojo.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugeneAbstractMojo.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -21,8 +21,11 @@
package org.nuiton.eugene.plugin;
import org.nuiton.plugin.PluginIOContext;
+
import java.io.File;
+import java.io.IOException;
import java.util.Arrays;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
@@ -30,7 +33,7 @@
/**
* La classe de base pour definir des mojos dans eugene.
- *
+ *
* @author chemit
* @since 1.0.0-rc-8
*/
@@ -39,14 +42,14 @@
/**
* Maven project.
*
- * @description Dépendance du projet.
* @parameter default-value="${project}"
* @readonly
* @since 1.0.0-rc-8
*/
protected MavenProject project;
/**
- * @description le settings (pour obtenir le mode offline)
+ * Le settings (pour obtenir le mode offline).
+ *
* @parameter default-value="${settings}"
* @readonly
* @since 1.0.0-rc-4
@@ -82,16 +85,13 @@
protected boolean testPhase;
/**
- *
* Note : l'objet peut etre {@code null} si la configuration ne definit
* pas la propriété associées dans l'implentation.
* <p/>
- *
* Dans tous les cas, une fois la methode {@link #initResources()} appele,
* l'objet devrait ne plus être null!
- *
+ *
* @return l'io du plugin ou {@code null} si non initialisé
- *
*/
protected abstract PluginIOContext getResources();
@@ -99,16 +99,16 @@
* Initialiser les io du plugins.
*
* @return l'io intialisé (avec les valeurs par défaut, là où rien n'a
- * été renseigné).
+ * été renseigné).
*/
protected abstract PluginIOContext initResources();
/**
* Build the {@link #getResources()} data.
*
- * @param defaultIn the default input directory
- * @param defaultOut the default output directory
- * @param defaultTestIn the default test input directory
+ * @param defaultIn the default input directory
+ * @param defaultOut the default output directory
+ * @param defaultTestIn the default test input directory
* @param defaultTestOut the default test output directory
* @return the new {@link PluginIOContext} to use in the goal
*/
@@ -158,7 +158,12 @@
throw new MojoExecutionException("no output defined");
}
- p.getOutput().mkdirs();
+ if (!p.getOutput().exists()) {
+ boolean b = p.getOutput().mkdirs();
+ if (!b) {
+ throw new IOException("could not create directory " + p.getOutput());
+ }
+ }
return true;
}
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/EugenePlugin.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -53,9 +53,11 @@
* <p/>
* Last update: $Date$
* by : $Author$
- * @goal generate
- * @projectRequired true
+ * @goal generate-old
+ * @requiresProject true
+ * @deprecated since 2.0.0, use now the {@link GenerateMojo}.
*/
+@Deprecated
public class EugenePlugin extends EugeneAbstractMojo {
/**
@@ -199,19 +201,11 @@
for (Template<M> template : templatesList) {
getLog().info("Apply " + template.getClass().getSimpleName() + " generator");
- //TC-20090829 fix when loading more than one model together...
-
try {
template.applyTemplate(model, generateResources.getOutput());
} catch (IOException eee) {
throw new MojoExecutionException("Generation problem", eee);
}
-// for (File modelFile : modelFiles) {
-// getLog().debug(" on " + modelFile.getAbsolutePath());
-//
-// // generation
-// generator.generate(modelFile, destDirGen);
-// }
}
}
@@ -254,37 +248,8 @@
return modelFiles.toArray(new File[modelFiles.size()]);
}
-// protected File[] getModelFiles() {
-// // get file to generate
-// // TODO improve this loop
-// // TODO too strange code
-// //TODO TC-20090820 use a DirectoryScanner which understand ant-like regex patterns :)
-// List<File> modelFiles = new ArrayList<File>();
-// String[] includePatterns = includes.split(",");
-// for (File srcDirGen : generateResources.getInputs()) {
-// for (String includePattern : includePatterns) {
-// includePattern = includePattern.trim();
-// boolean recursive = false;
-// if (includePattern.startsWith("**/")) {
-// recursive = true;
-// includePattern = includePattern.substring(3);
-// }
-// // transform pattern in java regex
-// includePattern = includePattern.replaceAll("\\.", "\\\\.");
-// includePattern = includePattern.replaceAll("\\*", ".*");
-// // log java regex
-// if (verbose) {
-// getLog().info("Search for " + includePattern + " in " + srcDirGen.getAbsolutePath());
-// }
-// List<File> currentFiles = FileUtil.find(srcDirGen, includePattern, recursive);
-// modelFiles.addAll(currentFiles);
-// }
-// }
-// return modelFiles.toArray(new File[modelFiles.size()]);
-// }
-
protected ModelReader<?> getReader() throws MojoFailureException, MojoExecutionException {
- ModelReader<?> modelReader = null;
+ ModelReader<?> modelReader;
try {
ClassLoader fixedClassLoader = fixClassLoader();
modelReader = (ModelReader<?>) Class.forName(reader, true, fixedClassLoader).newInstance();
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToObjectModelFileWriter.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -33,10 +33,12 @@
import java.io.IOException;
/**
+ * To write a object model files from xmi files.
+ * <p/>
* This {@link org.nuiton.eugene.ModelFileWriter} transform xmi files to object model file.
*
* @author tchemit
- * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="xmi2objectmodel" description="xmi to object model"
+ * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="xmi2objectmodel"
* @since 2.0.0
*/
public class XmiToObjectModelFileWriter extends BaseXmiToModelFileWriter {
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -26,8 +26,10 @@
import java.io.File;
/**
+ * To write state model files from xmi files.
+ *
* @author tchemit
- * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="xmi2statemodel" description="xmi to state model"
+ * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="xmi2statemodel"
* @since 2.0.0
*/
public class XmiToStateModelFileWriter extends BaseXmiToModelFileWriter {
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/ZargoModelFileWriter.java 2009-12-16 18:01:51 UTC (rev 758)
@@ -28,8 +28,10 @@
import java.io.IOException;
/**
+ * To write model files from zargo files.
+ *
* @author tchemit
- * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="zargo2xmi" description="zargo to xmi model"
+ * @plexus.component role="org.nuiton.eugene.ModelFileWriter" role-hint="zargo2xmi"
* @since 2.0.0
*/
public class ZargoModelFileWriter extends BaseModelFileWriter {
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2009-12-16 11:21:30 UTC (rev 757)
+++ trunk/pom.xml 2009-12-16 18:01:51 UTC (rev 758)
@@ -287,11 +287,398 @@
<version>1.4.0</version>
</plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>${javadoc.version}</version>
+ <configuration>
+ <docencoding>${project.reporting.outputEncoding}</docencoding>
+ <encoding>${project.reporting.outputEncoding}</encoding>
+ <charset>${project.reporting.outputEncoding}</charset>
+ <quiet>true</quiet>
+ <skip>${maven.javadoc.skip}</skip>
+ <taglets>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>
+ org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>
+ org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+
+ <taglet>
+ <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-javadoc</artifactId>
+ <version>1.3.0</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-javadoc</artifactId>
+ <version>1.3.0</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-javadoc</artifactId>
+ <version>1.3.0</version>
+ </tagletArtifact>
+ </taglet>
+ </taglets>
+ </configuration>
+ </plugin>
+
</plugins>
</pluginManagement>
</build>
+ <reporting>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>${javadoc.version}</version>
+ <configuration>
+ <quiet>true</quiet>
+ <skip>${maven.javadoc.skip}</skip>
+ <docencoding>${project.build.sourceEncoding}</docencoding>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ <charset>${project.reporting.outputEncoding}</charset>
+ <excludePackageNames>${maven.javadoc.excludePackageNames}</excludePackageNames>
+ <taglets>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>
+ org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet
+ </tagletClass>
+ <tagletArtifact>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-tools-javadoc</artifactId>
+ <version>2.5.1</version>
+ </tagletArtifact>
+ </taglet>
+
+ <taglet>
+ <tagletClass>org.codehaus.plexus.javadoc.PlexusComponentTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-javadoc</artifactId>
+ <version>1.3.0</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.codehaus.plexus.javadoc.PlexusConfigurationTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-javadoc</artifactId>
+ <version>1.3.0</version>
+ </tagletArtifact>
+ </taglet>
+ <taglet>
+ <tagletClass>org.codehaus.plexus.javadoc.PlexusRequirementTaglet</tagletClass>
+ <tagletArtifact>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-javadoc</artifactId>
+ <version>1.3.0</version>
+ </tagletArtifact>
+ </taglet>
+ </taglets>
+ </configuration>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>javadoc</report>
+ <report>test-javadoc</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
1
0
r757 - trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer
by tchemit@users.nuiton.org 16 Dec '09
by tchemit@users.nuiton.org 16 Dec '09
16 Dec '09
Author: tchemit
Date: 2009-12-16 12:21:30 +0100 (Wed, 16 Dec 2009)
New Revision: 757
Modified:
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java
trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java
Log:
improve directory creation code + optimize imports
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java 2009-12-16 11:20:18 UTC (rev 756)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/BaseXmiToModelFileWriter.java 2009-12-16 11:21:30 UTC (rev 757)
@@ -172,7 +172,12 @@
File dstDir = outputDir;
if (!relatifPath.isEmpty()) {
dstDir = new File(dstDir, relatifPath);
- dstDir.mkdirs();
+ if (!dstDir.exists()) {
+ boolean b = dstDir.mkdirs();
+ if (!b) {
+ throw new IOException("could not create directory "+dstDir);
+ }
+ }
}
File result = new File(dstDir, filename);
if (!overwrite && file.lastModified() < result.lastModified()) {
Modified: trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java
===================================================================
--- trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java 2009-12-16 11:20:18 UTC (rev 756)
+++ trunk/maven-eugene-plugin/src/main/java/org/nuiton/eugene/plugin/writer/XmiToStateModelFileWriter.java 2009-12-16 11:21:30 UTC (rev 757)
@@ -22,11 +22,8 @@
import org.nuiton.eugene.models.Model;
import org.nuiton.eugene.models.state.StateModel;
-import org.nuiton.plugin.PluginIOContext;
import java.io.File;
-import java.io.IOException;
-import java.util.Map;
/**
* @author tchemit
1
0
16 Dec '09
Author: tchemit
Date: 2009-12-16 12:20:18 +0100 (Wed, 16 Dec 2009)
New Revision: 756
Modified:
trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java
trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java
Log:
ModelReader are plexus components
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java 2009-12-14 23:50:27 UTC (rev 755)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/ObjectModelReader.java 2009-12-16 11:20:18 UTC (rev 756)
@@ -57,6 +57,8 @@
*
* Mise a jour: $Date$
* par : $Author$
+ *
+ * @plexus.component role="org.nuiton.eugene.ModelReader" role-hint="objectmodel" description="Object model reader"
*/
public class ObjectModelReader extends ModelReader<ObjectModel> {
Modified: trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java
===================================================================
--- trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java 2009-12-14 23:50:27 UTC (rev 755)
+++ trunk/eugene/src/main/java/org/nuiton/eugene/StateModelReader.java 2009-12-16 11:20:18 UTC (rev 756)
@@ -45,6 +45,8 @@
*
* Mise a jour: $Date$
* par : $Author$
+ *
+ * @plexus.component role="org.nuiton.eugene.ModelReader" role-hint="statemodel" description="State model reader"
*/
public class StateModelReader extends ModelReader<StateModel> {
1
0