r764 - in trunk/eugene: . src/main src/main/java/org/nuiton/eugene src/main/java/org/nuiton/eugene/java src/main/java/org/nuiton/eugene/models/object/xml src/main/java/org/nuiton/eugene/writer src/main/resolver-cache src/main/resolver-cache/META-INF src/main/resolver-cache/META-INF/cache src/main/resolver-cache/META-INF/cache/argouml.org src/main/resolver-cache/META-INF/cache/argouml.org/profiles src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14
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/uml14/ trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14/default-java.xmi trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14/default-uml14.xmi 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@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@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/uml14/default-java.xmi =================================================================== --- trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14/default-java.xmi (rev 0) +++ trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14/default-java.xmi 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/uml14/default-uml14.xmi =================================================================== --- trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14/default-uml14.xmi (rev 0) +++ trunk/eugene/src/main/resolver-cache/META-INF/cache/argouml.org/profiles/uml14/default-uml14.xmi 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
participants (1)
-
tchemit@users.nuiton.org