r729 - in branches/eugene-2.0/eugene: . src/main/java/org/nuiton/eugene/models src/main/java/org/nuiton/eugene/models/object src/main/java/org/nuiton/eugene/models/object/xml src/main/java/org/nuiton/eugene/models/state src/main/java/org/nuiton/eugene/models/state/xml
Author: tchemit Date: 2009-11-27 10:54:35 +0100 (Fri, 27 Nov 2009) New Revision: 729 Modified: branches/eugene-2.0/eugene/pom.xml branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/Model.java branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/StateModel.java branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java Log: - ajout des marqueurs plexus sur les implantations de mod?\195?\168les - ajout des annotations Override quand n?\195?\169cessaire - nettoyage des contrats (pas d'abstract, public, static ou autre) : tout est public et toutes les variables sont static finales - ajout log4J en test Modified: branches/eugene-2.0/eugene/pom.xml =================================================================== --- branches/eugene-2.0/eugene/pom.xml 2009-11-27 09:50:19 UTC (rev 728) +++ branches/eugene-2.0/eugene/pom.xml 2009-11-27 09:54:35 UTC (rev 729) @@ -89,6 +89,12 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> </dependencies> @@ -223,6 +229,19 @@ <filters>org.nuiton.processor.filters.GeneratorTemplatesFilter</filters> </configuration> </plugin> + + <!-- expose new plexus components --> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-metadata</artifactId> + <executions> + <execution> + <goals> + <goal>generate-metadata</goal> + </goals> + </execution> + </executions> + </plugin> </plugins> </build> Modified: branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/Model.java =================================================================== --- branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/Model.java 2009-11-27 09:50:19 UTC (rev 728) +++ branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/Model.java 2009-11-27 09:54:35 UTC (rev 729) @@ -32,18 +32,23 @@ public interface Model { /** + * Plexus role name + */ + String ROLE_NAME = Model.class.getName(); + + /** * Returns the name of this model. * * @return the name of this model. */ - public abstract String getName(); + String getName(); /** * Returns the version of this model. * * @return the version of this model. */ - public abstract String getVersion(); + String getVersion(); /** * Returns the tagValues associated with this element. @@ -51,7 +56,7 @@ * * @return a Map containing all tagValues associated with this element */ - public abstract Map<String, String> getTagValues(); + Map<String, String> getTagValues(); /** * Returns the tagValue corresponding to the given name, or null if the element has no associated tagValue for this name. @@ -59,6 +64,6 @@ * @param tagValue tag value key * @return the value of the found tagValue, or null if the element has no associated tagValue for this name. */ - public abstract String getTagValue(String tagValue); + String getTagValue(String tagValue); } //Model Modified: branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java =================================================================== --- branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java 2009-11-27 09:50:19 UTC (rev 728) +++ branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/ObjectModel.java 2009-11-27 09:54:35 UTC (rev 729) @@ -47,7 +47,7 @@ * * @return a Collection containing all ObjectModelClassifier for this model. */ - public Collection<ObjectModelClassifier> getClassifiers(); + Collection<ObjectModelClassifier> getClassifiers(); /** * Returns the classifier corresponding to the given qualified name, or null if the model contains no classifier for this qualified name. @@ -55,8 +55,7 @@ * * @return the ObjectModelClassifier of the found classifier, or null if the model contains no classifier for this qualified name. */ - public ObjectModelClassifier getClassifier( - String qualifiedClassifierName); + ObjectModelClassifier getClassifier(String qualifiedClassifierName); /** * Returns all classes defined in this model. (Except innerClasses) @@ -64,7 +63,7 @@ * * @return a Collection containing all ObjectModelClass for this model. */ - public Collection<ObjectModelClass> getClasses(); + Collection<ObjectModelClass> getClasses(); /** * Returns the class corresponding to the given qualified name, or null if the model contains no class for this qualified name. @@ -72,7 +71,7 @@ * * @return the ObjectModelClass of the found class, or null if the model contains no class for this qualified name. */ - public ObjectModelClass getClass(String qualifiedClassName); + ObjectModelClass getClass(String qualifiedClassName); /** @@ -81,7 +80,7 @@ * * @return true if the class has been found. */ - public boolean hasClass(String qualifiedClassName); + boolean hasClass(String qualifiedClassName); /** * Returns all interfaces defined in this model. @@ -89,7 +88,7 @@ * * @return a Collection containing all ObjectModelInterface for this model. */ - public Collection<ObjectModelInterface> getInterfaces(); + Collection<ObjectModelInterface> getInterfaces(); /** * Returns the interface corresponding to the given qualified name, or null if the model contains no interface for this qualified name. @@ -97,8 +96,7 @@ * * @return the ObjectModelInterface of the found interface, or null if the model contains no interface for this qualified name. */ - public ObjectModelInterface getInterface( - String qualifiedInterfaceName); + ObjectModelInterface getInterface(String qualifiedInterfaceName); /** @@ -107,21 +105,21 @@ * * @return a Collection containing all ObjectModelEnumeration for this model. */ - public Collection<ObjectModelEnumeration> getEnumerations(); + Collection<ObjectModelEnumeration> getEnumerations(); /** * Return the enumeration corresponding to the given qualified name * @param qualifiedEnumerationName * @return the ObjectModelEnumeration of the found enumeration or null if the model contains no enumeration for this qualified name. */ - public ObjectModelEnumeration getEnumeration(String qualifiedEnumerationName); + ObjectModelEnumeration getEnumeration(String qualifiedEnumerationName); /** * Returns all comments not lied to a particular model element * * @return a List containing all comments for this model as Strings. */ - public List<String> getComments(); + List<String> getComments(); /** * Get the extension associated to the reference (unique) @@ -132,7 +130,7 @@ * @throws ClassCastException when extensionClass is not valid * @throws IllegalArgumentException for non existing extension with reference */ - public <O> O getExtension(String reference, Class<O> extensionClass) + <O> O getExtension(String reference, Class<O> extensionClass) throws ClassCastException, IllegalArgumentException; } //ObjectModel Modified: branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java =================================================================== --- branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-11-27 09:50:19 UTC (rev 728) +++ branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelImpl.java 2009-11-27 09:54:35 UTC (rev 729) @@ -49,6 +49,8 @@ * * Last update : $Date$ * by : $Author$ + * + * @plexus.component role="org.nuiton.eugene.models.Model" role-hint="objectmodel" description="Object model implementation" */ public class ObjectModelImpl implements ObjectModel { @@ -142,6 +144,7 @@ * * @return the name of this model. */ + @Override public String getName() { return name; } @@ -153,6 +156,7 @@ * * @return a Collection containing all ObjectModelClassifier for this model. */ + @Override public Collection<ObjectModelClassifier> getClassifiers() { return classifiers.values(); } @@ -167,6 +171,7 @@ * @return the ObjectModelClassifier of the found classifier, or null if the * model contains no classifier for this qualified name. */ + @Override public ObjectModelClassifier getClassifier(String qualifiedClassifierName) { return (qualifiedClassifierName == null ? null : (ObjectModelClassifier) classifiers.get(qualifiedClassifierName)); @@ -179,6 +184,7 @@ * * @return a Collection containing all ObjectModelClass for this model. */ + @Override public Collection<ObjectModelClass> getClasses() { return classes.values(); } @@ -207,11 +213,7 @@ return classes.get(qualifiedClassName); } - /* - * (non-Javadoc) - * - * @see org.nuiton.eugene.models.object.ObjectModel#hasClass(java.lang.String) - */ + @Override public boolean hasClass(String qualifiedClassName) { boolean hasClass = classes.containsKey(qualifiedClassName); return hasClass; @@ -252,6 +254,7 @@ * @return the ObjectModelInterface of the found interface, or null if the * model contains no interface for this qualified name. */ + @Override public ObjectModelInterface getInterface(String qualifiedInterfaceName) { ObjectModelInterface result = null; result = (ObjectModelInterface) interfaces.get(qualifiedInterfaceName); @@ -268,6 +271,7 @@ * * @return a Collection containing all ObjectModelInterface for this model. */ + @Override public Collection<ObjectModelInterface> getInterfaces() { return interfaces.values(); } @@ -297,6 +301,7 @@ * * @return a List containing all comments for this model as Strings. */ + @Override public List<String> getComments() { return comments; } @@ -427,8 +432,7 @@ private boolean contains(Collection<ObjectModelAttribute> coll, ObjectModelAttributeImpl toFind) { - for (Iterator<ObjectModelAttribute> it = coll.iterator(); it.hasNext();) { - ObjectModelAttribute attribute = it.next(); + for (ObjectModelAttribute attribute : coll) { if (attribute.getName().equals(toFind.getName())) { // Seul le nom // de l'attribut // compte @@ -463,6 +467,7 @@ * * @return a Map containing all tagValues associated with this element */ + @Override public Map<String, String> getTagValues() { return tagValues; } @@ -474,6 +479,7 @@ * @return the value of the found tagValue, or null if the element has no * associated tagValue for this name. */ + @Override public String getTagValue(String tagValue) { return (tagValue == null ? null : (String) tagValues.get(tagValue)); } Modified: branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/StateModel.java =================================================================== --- branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/StateModel.java 2009-11-27 09:50:19 UTC (rev 728) +++ branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/StateModel.java 2009-11-27 09:54:35 UTC (rev 729) @@ -40,6 +40,6 @@ * Return the collection of charts * @return collection of charts */ - public abstract List<StateModelStateChart> getStateCharts(); + List<StateModelStateChart> getStateCharts(); } Modified: branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java =================================================================== --- branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java 2009-11-27 09:50:19 UTC (rev 728) +++ branches/eugene-2.0/eugene/src/main/java/org/nuiton/eugene/models/state/xml/StateModelImpl.java 2009-11-27 09:54:35 UTC (rev 729) @@ -36,6 +36,8 @@ * * Last update : $Date$ * By : $Author$ + * + * @plexus.component role="org.nuiton.eugene.models.Model" role-hint="statemodel" description="State model implementation" */ public class StateModelImpl implements StateModel { @@ -68,9 +70,7 @@ modelTagValues = new HashMap<String, String>(); } - /* - * @see org.nuiton.eugene.models.state.StateModel#getName() - */ + @Override public String getName() { return this.name; } @@ -99,9 +99,7 @@ listStateCharts.add(chart); } - /* - * @see org.nuiton.eugene.models.state.StateModel#getStateCharts() - */ + @Override public List<StateModelStateChart> getStateCharts() { return listStateCharts; } @@ -114,9 +112,7 @@ listStateCharts.addAll(charts); } - /* - * @see org.nuiton.eugene.models.state.StateModel#getTagValues() - */ + @Override public Map<String, String> getTagValues() { return modelTagValues; } @@ -137,6 +133,7 @@ * @return the value of the found tagValue, or null if the element has no * associated tagValue for this name. */ + @Override public String getTagValue(String key) { return (key == null ? null : (String) modelTagValues.get(key)); } @@ -144,7 +141,7 @@ /** * Set model version. * - * @param name model version + * @param version model version */ public void setVersion(String version) { this.version = version;
participants (1)
-
tchemit@users.nuiton.org