Eugene-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- 1738 discussions
[Lutingenerator-commits] r411 - lutingenerator/trunk maven-generator-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 29 Jan '09
by tchemit@users.labs.libre-entreprise.org 29 Jan '09
29 Jan '09
Author: tchemit
Date: 2009-01-29 14:22:09 +0000 (Thu, 29 Jan 2009)
New Revision: 411
Modified:
lutingenerator/trunk/changelog.txt
lutingenerator/trunk/pom.xml
maven-generator-plugin/trunk/changelog.txt
maven-generator-plugin/trunk/pom.xml
Log:
use lutinproject 3.4 (suppress javadoc plugin invocation)
Modified: lutingenerator/trunk/changelog.txt
===================================================================
--- lutingenerator/trunk/changelog.txt 2009-01-29 10:58:54 UTC (rev 410)
+++ lutingenerator/trunk/changelog.txt 2009-01-29 14:22:09 UTC (rev 411)
@@ -1,4 +1,6 @@
0.64 ?? 200812??
+ * 20090129 [thimel] renmae Util class to GeneratorUtil
+ * 20090129 [chemit] use lutinproject 3.4 (suppress javadoc plugin invocation)
0.63 chemit 20081215
* 20081215 [chemit] fix up to date regression on generation
Modified: lutingenerator/trunk/pom.xml
===================================================================
--- lutingenerator/trunk/pom.xml 2009-01-29 10:58:54 UTC (rev 410)
+++ lutingenerator/trunk/pom.xml 2009-01-29 14:22:09 UTC (rev 411)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinproject</artifactId>
- <version>3.2</version>
+ <version>3.4-SNAPSHOT</version>
</parent>
<artifactId>lutingenerator</artifactId>
@@ -93,18 +93,17 @@
<labs.project>lutingenerator</labs.project>
<!-- lutinutil version -->
- <lutinutil.version>1.0</lutinutil.version>
+ <!--lutinutil.version>1.0</lutinutil.version-->
+
+ <!-- todo pour la montee de version voir la doc -->
+ <lutingenerator.version>${project.version}</lutingenerator.version>
</properties>
<build>
- <plugins>
+
+ <defaultGoal>install</defaultGoal>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
-
- </plugins>
</build>
<!-- ************************************************************* -->
Modified: maven-generator-plugin/trunk/changelog.txt
===================================================================
--- maven-generator-plugin/trunk/changelog.txt 2009-01-29 10:58:54 UTC (rev 410)
+++ maven-generator-plugin/trunk/changelog.txt 2009-01-29 14:22:09 UTC (rev 411)
@@ -1,5 +1,6 @@
0.64 ?? 200812??
-
+ * 20090129 [chemit] - use lutinproject 3.4 (suppress javadoc plugin invocation)
+
0.63 chemit 20081215
* 20081215 [chemit] follow lutingenerator release
Modified: maven-generator-plugin/trunk/pom.xml
===================================================================
--- maven-generator-plugin/trunk/pom.xml 2009-01-29 10:58:54 UTC (rev 410)
+++ maven-generator-plugin/trunk/pom.xml 2009-01-29 14:22:09 UTC (rev 411)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.codelutin</groupId>
<artifactId>lutinpluginproject</artifactId>
- <version>3.2</version>
+ <version>3.4-SNAPSHOT</version>
</parent>
<artifactId>maven-generator-plugin</artifactId>
@@ -21,7 +21,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutingenerator</artifactId>
- <version>0.64-SNAPSHOT</version>
+ <version>${project.version}</version>
<scope>compile</scope>
</dependency>
@@ -60,12 +60,15 @@
<!-- nom du projet sur le labs -->
<labs.project>lutingenerator</labs.project>
+ <!-- todo pour la montee de version voir la doc -->
+ <lutingenerator.version>${project.version}</lutingenerator.version>
+
</properties>
<build>
- <plugins>
-
- </plugins>
+
+ <defaultGoal>install</defaultGoal>
+
</build>
1
0
[Lutingenerator-commits] r410 - in lutingenerator/trunk/src/main/java/org/codelutin/generator: . models/object models/object/xml
by thimel@users.labs.libre-entreprise.org 29 Jan '09
by thimel@users.labs.libre-entreprise.org 29 Jan '09
29 Jan '09
Author: thimel
Date: 2009-01-29 10:58:54 +0000 (Thu, 29 Jan 2009)
New Revision: 410
Added:
lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java
Removed:
lutingenerator/trunk/src/main/java/org/codelutin/generator/Util.java
Modified:
lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java
lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java
lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java
lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java
lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java
lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java
Log:
Rename Util to GeneratorUtil
Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/AbstractObjectModelGenerator.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -47,7 +47,7 @@
if(name == null){
throw new GeneratorException("L'element "+ e +" doit avoir un nom valide" );
}else{
- return Util.capitalize(name);
+ return GeneratorUtil.capitalize(name);
}
}
Added: lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java (rev 0)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/GeneratorUtil.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -0,0 +1,383 @@
+/*
+ * *##% Lutin Generator
+ * Copyright (C) 2004 - 2008 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+/* *
+ * Util.java Created: 25 ao?t 2003
+ *
+ *@author Benjamin Poussin <poussin(a)codelutin.com>
+ *
+ * Copyright Code Lutin
+ *@version $Revision: 317 $ Mise a jour: $Date: 2008-09-25 10:45:22 +0200 (jeu 25 sep 2008) $ par :
+ * $Author: thimel $
+ */
+
+package org.codelutin.generator;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.codelutin.generator.models.object.ObjectModel;
+import org.codelutin.generator.models.object.ObjectModelAttribute;
+import org.codelutin.generator.models.object.ObjectModelClass;
+import org.codelutin.generator.models.object.ObjectModelClassifier;
+import org.codelutin.generator.models.object.ObjectModelOperation;
+import org.codelutin.generator.models.object.ObjectModelParameter;
+
+/**
+ * TODO Description of the Class
+ *
+ *@author poussin
+ *@created 26 ao?t 2003
+ */
+public class GeneratorUtil {
+
+ /**
+ * return parent package of given package (return given package if it is a root package)
+ * eg : org.codelutin.generator.models -> org.codelutin.generator
+ * eg : org -> org
+ * warning : org.codelutin.generator. -> org.codelutin.generator
+ */
+ public static String getParentPackageName(String packageName) {
+ String parentPackageName = packageName;
+ int index = packageName.lastIndexOf('.');
+ if (index != -1) {
+ parentPackageName = packageName.substring(0,index);
+ }
+ return parentPackageName;
+ }
+
+ /**
+ * return class name fr given fully qualified name (return given name if it is not fully qualified)
+ * eg : org.codelutin.generator.models.ObjectClass -> ObjectClass
+ * eg : ObjectClass-> ObjectClass
+ */
+ public static String getClassNameFromQualifiedName(String qualifiedName) {
+ String className = qualifiedName;
+ int index = qualifiedName.lastIndexOf('.');
+ if (index != -1) {
+ className = qualifiedName.substring(index+1);
+ }
+ return className;
+ }
+
+ /**
+ *
+ */
+ public static String getFilenameFromQualifiedName(String qualifiedName) {
+ return qualifiedName.replace('.', File.separatorChar);
+ }
+
+
+ /**
+ * return all classifiers belonging to the given package recursively. The Collection may be empty.
+ * @see ObjectModelCassifier
+ *
+ * @return a Collection containing all classifiers belonging to the given package recursively.
+ */
+ public static Collection<ObjectModelClassifier> getClassifiers(ObjectModel model, String packageName) {
+ List<ObjectModelClassifier> classifiers = new ArrayList<ObjectModelClassifier>();
+ for (Iterator i = model.getClassifiers().iterator(); i.hasNext();) {
+ ObjectModelClassifier classifier = (ObjectModelClassifier) i.next();
+ if (classifier.getPackageName().startsWith(packageName)) {
+ classifiers.add(classifier);
+ }
+ }
+ return classifiers;
+ }
+
+ /**
+ * @see {@link #getAttributeType(ObjectModelParameter, boolean)}
+ */
+ public static String getAttributeType(ObjectModelParameter attribute) {
+ return getAttributeType(attribute, false);
+ }
+
+ /**
+ * Retourne le type de l'attribut, c-a-d une List ou une collection
+ * ou le type defini si la cardinalité n'est pas multiple
+ *
+ * @param attribute
+ * @return
+ */
+ public static String getAttributeType(ObjectModelParameter attribute, boolean useGenerics) {
+ String result;
+ if (attribute instanceof ObjectModelAttribute
+ && isNMultiplicity((ObjectModelAttribute)attribute)) {
+ if (((ObjectModelAttribute)attribute).isOrdered()) {
+ result = "java.util.List";
+ } else {
+ result = "java.util.Collection";
+ }
+ if (useGenerics) {
+ result += "<" + attribute.getType() + ">";
+ }
+ } else {
+ result = attribute.getType();
+ }
+ return result;
+ }
+
+ /**
+ * Indicates if the specified attribute has a primitive type (byte, boolean, ...)
+ * @return true if the atribute has a primitive type
+ */
+ public static boolean isPrimitiveAttributeType(ObjectModelAttribute attribute) {
+ if (isNMultiplicity(attribute))
+ return false;
+ String type = attribute.getType();
+ return ("byte".equals(type) || "short".equals(type) ||
+ "int".equals(type) || "long".equals(type) ||
+ "float".equals(type) || "double".equals(type) ||
+ "char".equals(type) || "boolean".equals(type));
+ }
+
+ /**
+ * return an init value for the specified attribute
+ * @return a String with the corresponding attribute init value
+ */
+ public static String getInitValue(ObjectModelAttribute attribute) {
+ if (isNMultiplicity(attribute)) return "new java.util.ArrayList()";
+ return getInitValue(attribute.getType());
+ }
+
+ public static String getInitValue(String type){
+ if ("byte".equals(type)) return "0";
+ if ("short".equals(type)) return "0";
+ if ("int".equals(type)) return "0";
+ if ("long".equals(type)) return "0";
+ if ("float".equals(type)) return "0";
+ if ("double".equals(type)) return "0";
+ if ("char".equals(type)) return "\u0000";
+ if ("boolean".equals(type)) return "false";
+ if ("java.lang.String".equals(type)) return null;
+ if ("java.lang.Date".equals(type)) return null;
+ return null;
+ }
+
+ public static String getCastValue(String type, String o){
+ if ("byte".equals(type)) return "((Byte)"+o+").byteValue()";
+ if ("short".equals(type)) return "((Short)"+o+").shortValue()";
+ if ("int".equals(type)) return "((Integer)"+o+").intValue()";
+ if ("long".equals(type)) return "((Long)"+o+").longValue()";
+ if ("float".equals(type)) return "((Float)"+o+").floatValue()";
+ if ("double".equals(type)) return "((Double)"+o+").doubleValue()";
+ if ("char".equals(type)) return "((Character)"+o+").charValue()";
+ if ("boolean".equals(type)) return "((Boolean)"+o+").booleanValue()";
+ if ("void".equals(type)) return "";
+ return "(" + type + ")" + o;
+ }
+
+ public static String getHashCodeExpression(String type, String o){
+ String result = o;
+ if ("byte".equals(type)) result = "new Byte("+o+")";
+ if ("short".equals(type)) result = "new Short("+o+")";
+ if ("int".equals(type)) result = "new Integer("+o+")";
+ if ("long".equals(type)) result = "new Long("+o+")";
+ if ("float".equals(type)) result = "new Float("+o+")";
+ if ("double".equals(type)) result = "new Double("+o+")";
+ if ("char".equals(type)) result = "new Character("+o+")";
+ if ("boolean".equals(type)) result = "new Boolean("+o+")";
+ return result +".hashCode()";
+ }
+
+ /**
+ * Retourne la chaine de caractere dont on a besoin pour la declaration
+ * des parametres d'une methode.
+ */
+ public static String getMethodParameterDeclaration(Collection params){
+ StringBuffer result = new StringBuffer();
+ for (Iterator j = params.iterator(); j.hasNext();){
+ ObjectModelParameter parameter = (ObjectModelParameter) j.next();
+ result.append(getAttributeType(parameter)+" "+parameter.getName());
+ if (j.hasNext()) {
+ result.append(", ");
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Retourne la chaine de caractere qui represente chaque nom de parametre
+ * separer par des ','.
+ */
+ public static String getMethodParameterListName(Collection params){
+ StringBuffer result = new StringBuffer();
+ for (Iterator j = params.iterator(); j.hasNext();){
+ ObjectModelParameter parameter = (ObjectModelParameter) j.next();
+ result.append(parameter.getName());
+ if (j.hasNext()) {
+ result.append(", ");
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ *@return vrai si la cardinalite de l'attribut est superieur a 1, c-a-d
+ * si MaxMultiplicity == -1 ou > 1
+ */
+ public static boolean isNMultiplicity(ObjectModelAttribute attribute){
+ return isNMultiplicity(attribute.getMaxMultiplicity());
+ }
+
+ public static boolean isNMultiplicity(int multiplicity){
+ return (multiplicity == -1) || (multiplicity>1);
+ }
+
+ /**
+ * @return true is the multiplicity of the given attribute is exactly 1
+ */
+ public static boolean isOneMultiplicity(ObjectModelAttribute attribute) {
+ if (attribute == null)
+ return false;
+ return ((attribute.getMinMultiplicity() == 1) && (attribute.getMaxMultiplicity() == 1));
+ }
+
+
+ /**
+ *
+ */
+ public static String toUpperCaseFirstLetter(String word) {
+ return capitalize(word);
+ }
+
+ public static String capitalize(String word){
+ return StringUtils.capitalize(word);
+ }
+
+ /**
+ *
+ */
+ public static String toLowerCaseFirstLetter(String word) {
+ return word.substring(0, 1).toLowerCase() + word.substring(1);
+ }
+
+ /**
+ * @return true if the given attribute is a composition (composant of the reverse attribute)
+ */
+ public static boolean isComposition(ObjectModelAttribute attribute) {
+ if (attribute == null)
+ return false;
+ if (attribute.getReverseAttribute() == null)
+ return false;
+ return attribute.getReverseAttribute().isComposite();
+ }
+
+
+
+
+ public static String getParsingExpression(String type, String attributeStringName){
+ if ("byte".equals(type)) return "Byte.parseByte("+attributeStringName+")";
+ if ("short".equals(type)) return "Short.parseShort("+attributeStringName+")";
+ if ("int".equals(type)) return "Integer.parseInt("+attributeStringName+")";
+ if ("long".equals(type)) return "Long.parseLong("+attributeStringName+")";
+ if ("float".equals(type)) return "Float.parseFloat("+attributeStringName+")";
+ if ("double".equals(type)) return "Double.parseDouble("+attributeStringName+")";
+ if ("char".equals(type)) return attributeStringName+".charAt(0)";
+ if ("boolean".equals(type)) return "Boolean.parseBoolean("+attributeStringName+")";
+ if ("java.lang.String".equals(type)) return attributeStringName;
+ if ("java.util.Date".equals(type)) return "dateParser.parse("+attributeStringName+")";
+ return null;
+ }
+
+ public static String getFormatingExpression(String type, String attributeStringName){
+ if ("byte".equals(type)) return "Byte.toString("+attributeStringName+")";
+ if ("short".equals(type)) return "Short.toString("+attributeStringName+")";
+ if ("int".equals(type)) return "Integer.toString("+attributeStringName+")";
+ if ("long".equals(type)) return "Long.toString("+attributeStringName+")";
+ if ("float".equals(type)) return "Float.toString("+attributeStringName+")";
+ if ("double".equals(type)) return "Double.toString("+attributeStringName+")";
+ if ("char".equals(type)) return "Character.toString("+attributeStringName+")";
+ if ("boolean".equals(type)) return "Boolean.parseBoolean("+attributeStringName+")";
+ if ("java.lang.String".equals(type)) return attributeStringName;
+ if ("java.util.Date".equals(type)) return "dateParser.format("+attributeStringName+")";
+ return null;
+ }
+
+
+
+ /**
+ * Retourne la chaine de caractere dont on a besoin pour la declaration
+ * des parametres d'une methode.
+ */
+ public static String getOperationParametersListDeclaration(ObjectModelOperation operation){
+ StringBuffer result = new StringBuffer();
+
+ Collection params = operation.getParameters();
+ for (Iterator j = params.iterator(); j.hasNext();){
+ ObjectModelParameter parameter = (ObjectModelParameter) j.next();
+ result.append(getAttributeType(parameter)+" "+parameter.getName());
+ if (j.hasNext()) {
+ result.append(", ");
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Retourne la chaine de caractere qui represente chaque nom de parametre
+ * separer par des ','.
+ */
+ public static String getOperationParametersListName(ObjectModelOperation operation) {
+ Collection params = operation.getParameters();
+ StringBuffer result = new StringBuffer();
+ for (Iterator j = params.iterator(); j.hasNext();){
+ ObjectModelParameter parameter = (ObjectModelParameter) j.next();
+ result.append(parameter.getName());
+ if (j.hasNext()) {
+ result.append(", ");
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Renvoie sous forme de String la liste des déclarations des attributes d'une classe donnée
+ */
+ public static String getClassAttributesListDeclaration(ObjectModelClass clazz) {
+ StringBuffer result = new StringBuffer();
+
+ Collection params = clazz.getAttributes();
+ for (Iterator j = params.iterator(); j.hasNext();){
+ ObjectModelAttribute attr = (ObjectModelAttribute) j.next();
+ result.append(getAttributeType(attr, true)+" "+attr.getName());
+ if (j.hasNext()) {
+ result.append(", ");
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Renvoie si l'attribut passé en paramètre est premier lexicographiquement
+ * par rapport à son attribut inverse (si celui ci existe).
+ * @param attr L'attribut dont on veut savoir s'il est le premier
+ * @return true, si l'attribut est premier (lexico ou pas de reverse attribute), false dans les autres cas
+ */
+ public static boolean isFirstAttribute(ObjectModelAttribute attr) {
+ if (attr.getReverseAttribute() == null)
+ return true;
+ return (attr.getName().compareTo(attr.getReverseAttribute().getName()) < 0);
+ }
+
+} // Util
Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/UIModelGenerator.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -175,7 +175,7 @@
if(name == null){
throw new GeneratorException("L'objet "+ o.getType() +" doit avoir un nom valide" );
}else{
- return Util.capitalize(name);
+ return GeneratorUtil.capitalize(name);
}
}
@@ -184,7 +184,7 @@
if(name == null){
throw new GeneratorException("La propriete "+ p +" doit avoir un nom valide");
}else{
- return Util.capitalize(name);
+ return GeneratorUtil.capitalize(name);
}
}
}
Deleted: lutingenerator/trunk/src/main/java/org/codelutin/generator/Util.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/Util.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/Util.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -1,383 +0,0 @@
-/*
- * *##% Lutin Generator
- * Copyright (C) 2004 - 2008 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
- */
-
-/* *
- * Util.java Created: 25 ao?t 2003
- *
- *@author Benjamin Poussin <poussin(a)codelutin.com>
- *
- * Copyright Code Lutin
- *@version $Revision$ Mise a jour: $Date$ par :
- * $Author$
- */
-
-package org.codelutin.generator;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.codelutin.generator.models.object.ObjectModel;
-import org.codelutin.generator.models.object.ObjectModelAttribute;
-import org.codelutin.generator.models.object.ObjectModelClass;
-import org.codelutin.generator.models.object.ObjectModelClassifier;
-import org.codelutin.generator.models.object.ObjectModelOperation;
-import org.codelutin.generator.models.object.ObjectModelParameter;
-
-/**
- * TODO Description of the Class
- *
- *@author poussin
- *@created 26 ao?t 2003
- */
-public class Util {
-
- /**
- * return parent package of given package (return given package if it is a root package)
- * eg : org.codelutin.generator.models -> org.codelutin.generator
- * eg : org -> org
- * warning : org.codelutin.generator. -> org.codelutin.generator
- */
- public static String getParentPackageName(String packageName) {
- String parentPackageName = packageName;
- int index = packageName.lastIndexOf('.');
- if (index != -1) {
- parentPackageName = packageName.substring(0,index);
- }
- return parentPackageName;
- }
-
- /**
- * return class name fr given fully qualified name (return given name if it is not fully qualified)
- * eg : org.codelutin.generator.models.ObjectClass -> ObjectClass
- * eg : ObjectClass-> ObjectClass
- */
- public static String getClassNameFromQualifiedName(String qualifiedName) {
- String className = qualifiedName;
- int index = qualifiedName.lastIndexOf('.');
- if (index != -1) {
- className = qualifiedName.substring(index+1);
- }
- return className;
- }
-
- /**
- *
- */
- public static String getFilenameFromQualifiedName(String qualifiedName) {
- return qualifiedName.replace('.', File.separatorChar);
- }
-
-
- /**
- * return all classifiers belonging to the given package recursively. The Collection may be empty.
- * @see ObjectModelCassifier
- *
- * @return a Collection containing all classifiers belonging to the given package recursively.
- */
- public static Collection<ObjectModelClassifier> getClassifiers(ObjectModel model, String packageName) {
- List<ObjectModelClassifier> classifiers = new ArrayList<ObjectModelClassifier>();
- for (Iterator i = model.getClassifiers().iterator(); i.hasNext();) {
- ObjectModelClassifier classifier = (ObjectModelClassifier) i.next();
- if (classifier.getPackageName().startsWith(packageName)) {
- classifiers.add(classifier);
- }
- }
- return classifiers;
- }
-
- /**
- * @see {@link #getAttributeType(ObjectModelParameter, boolean)}
- */
- public static String getAttributeType(ObjectModelParameter attribute) {
- return getAttributeType(attribute, false);
- }
-
- /**
- * Retourne le type de l'attribut, c-a-d une List ou une collection
- * ou le type defini si la cardinalité n'est pas multiple
- *
- * @param attribute
- * @return
- */
- public static String getAttributeType(ObjectModelParameter attribute, boolean useGenerics) {
- String result;
- if (attribute instanceof ObjectModelAttribute
- && isNMultiplicity((ObjectModelAttribute)attribute)) {
- if (((ObjectModelAttribute)attribute).isOrdered()) {
- result = "java.util.List";
- } else {
- result = "java.util.Collection";
- }
- if (useGenerics) {
- result += "<" + attribute.getType() + ">";
- }
- } else {
- result = attribute.getType();
- }
- return result;
- }
-
- /**
- * Indicates if the specified attribute has a primitive type (byte, boolean, ...)
- * @return true if the atribute has a primitive type
- */
- public static boolean isPrimitiveAttributeType(ObjectModelAttribute attribute) {
- if (isNMultiplicity(attribute))
- return false;
- String type = attribute.getType();
- return ("byte".equals(type) || "short".equals(type) ||
- "int".equals(type) || "long".equals(type) ||
- "float".equals(type) || "double".equals(type) ||
- "char".equals(type) || "boolean".equals(type));
- }
-
- /**
- * return an init value for the specified attribute
- * @return a String with the corresponding attribute init value
- */
- public static String getInitValue(ObjectModelAttribute attribute) {
- if (isNMultiplicity(attribute)) return "new java.util.ArrayList()";
- return getInitValue(attribute.getType());
- }
-
- public static String getInitValue(String type){
- if ("byte".equals(type)) return "0";
- if ("short".equals(type)) return "0";
- if ("int".equals(type)) return "0";
- if ("long".equals(type)) return "0";
- if ("float".equals(type)) return "0";
- if ("double".equals(type)) return "0";
- if ("char".equals(type)) return "\u0000";
- if ("boolean".equals(type)) return "false";
- if ("java.lang.String".equals(type)) return null;
- if ("java.lang.Date".equals(type)) return null;
- return null;
- }
-
- public static String getCastValue(String type, String o){
- if ("byte".equals(type)) return "((Byte)"+o+").byteValue()";
- if ("short".equals(type)) return "((Short)"+o+").shortValue()";
- if ("int".equals(type)) return "((Integer)"+o+").intValue()";
- if ("long".equals(type)) return "((Long)"+o+").longValue()";
- if ("float".equals(type)) return "((Float)"+o+").floatValue()";
- if ("double".equals(type)) return "((Double)"+o+").doubleValue()";
- if ("char".equals(type)) return "((Character)"+o+").charValue()";
- if ("boolean".equals(type)) return "((Boolean)"+o+").booleanValue()";
- if ("void".equals(type)) return "";
- return "(" + type + ")" + o;
- }
-
- public static String getHashCodeExpression(String type, String o){
- String result = o;
- if ("byte".equals(type)) result = "new Byte("+o+")";
- if ("short".equals(type)) result = "new Short("+o+")";
- if ("int".equals(type)) result = "new Integer("+o+")";
- if ("long".equals(type)) result = "new Long("+o+")";
- if ("float".equals(type)) result = "new Float("+o+")";
- if ("double".equals(type)) result = "new Double("+o+")";
- if ("char".equals(type)) result = "new Character("+o+")";
- if ("boolean".equals(type)) result = "new Boolean("+o+")";
- return result +".hashCode()";
- }
-
- /**
- * Retourne la chaine de caractere dont on a besoin pour la declaration
- * des parametres d'une methode.
- */
- public static String getMethodParameterDeclaration(Collection params){
- StringBuffer result = new StringBuffer();
- for (Iterator j = params.iterator(); j.hasNext();){
- ObjectModelParameter parameter = (ObjectModelParameter) j.next();
- result.append(getAttributeType(parameter)+" "+parameter.getName());
- if (j.hasNext()) {
- result.append(", ");
- }
- }
- return result.toString();
- }
-
- /**
- * Retourne la chaine de caractere qui represente chaque nom de parametre
- * separer par des ','.
- */
- public static String getMethodParameterListName(Collection params){
- StringBuffer result = new StringBuffer();
- for (Iterator j = params.iterator(); j.hasNext();){
- ObjectModelParameter parameter = (ObjectModelParameter) j.next();
- result.append(parameter.getName());
- if (j.hasNext()) {
- result.append(", ");
- }
- }
- return result.toString();
- }
-
- /**
- *@return vrai si la cardinalite de l'attribut est superieur a 1, c-a-d
- * si MaxMultiplicity == -1 ou > 1
- */
- public static boolean isNMultiplicity(ObjectModelAttribute attribute){
- return isNMultiplicity(attribute.getMaxMultiplicity());
- }
-
- public static boolean isNMultiplicity(int multiplicity){
- return (multiplicity == -1) || (multiplicity>1);
- }
-
- /**
- * @return true is the multiplicity of the given attribute is exactly 1
- */
- public static boolean isOneMultiplicity(ObjectModelAttribute attribute) {
- if (attribute == null)
- return false;
- return ((attribute.getMinMultiplicity() == 1) && (attribute.getMaxMultiplicity() == 1));
- }
-
-
- /**
- *
- */
- public static String toUpperCaseFirstLetter(String word) {
- return capitalize(word);
- }
-
- public static String capitalize(String word){
- return StringUtils.capitalize(word);
- }
-
- /**
- *
- */
- public static String toLowerCaseFirstLetter(String word) {
- return word.substring(0, 1).toLowerCase() + word.substring(1);
- }
-
- /**
- * @return true if the given attribute is a composition (composant of the reverse attribute)
- */
- public static boolean isComposition(ObjectModelAttribute attribute) {
- if (attribute == null)
- return false;
- if (attribute.getReverseAttribute() == null)
- return false;
- return attribute.getReverseAttribute().isComposite();
- }
-
-
-
-
- public static String getParsingExpression(String type, String attributeStringName){
- if ("byte".equals(type)) return "Byte.parseByte("+attributeStringName+")";
- if ("short".equals(type)) return "Short.parseShort("+attributeStringName+")";
- if ("int".equals(type)) return "Integer.parseInt("+attributeStringName+")";
- if ("long".equals(type)) return "Long.parseLong("+attributeStringName+")";
- if ("float".equals(type)) return "Float.parseFloat("+attributeStringName+")";
- if ("double".equals(type)) return "Double.parseDouble("+attributeStringName+")";
- if ("char".equals(type)) return attributeStringName+".charAt(0)";
- if ("boolean".equals(type)) return "Boolean.parseBoolean("+attributeStringName+")";
- if ("java.lang.String".equals(type)) return attributeStringName;
- if ("java.util.Date".equals(type)) return "dateParser.parse("+attributeStringName+")";
- return null;
- }
-
- public static String getFormatingExpression(String type, String attributeStringName){
- if ("byte".equals(type)) return "Byte.toString("+attributeStringName+")";
- if ("short".equals(type)) return "Short.toString("+attributeStringName+")";
- if ("int".equals(type)) return "Integer.toString("+attributeStringName+")";
- if ("long".equals(type)) return "Long.toString("+attributeStringName+")";
- if ("float".equals(type)) return "Float.toString("+attributeStringName+")";
- if ("double".equals(type)) return "Double.toString("+attributeStringName+")";
- if ("char".equals(type)) return "Character.toString("+attributeStringName+")";
- if ("boolean".equals(type)) return "Boolean.parseBoolean("+attributeStringName+")";
- if ("java.lang.String".equals(type)) return attributeStringName;
- if ("java.util.Date".equals(type)) return "dateParser.format("+attributeStringName+")";
- return null;
- }
-
-
-
- /**
- * Retourne la chaine de caractere dont on a besoin pour la declaration
- * des parametres d'une methode.
- */
- public static String getOperationParametersListDeclaration(ObjectModelOperation operation){
- StringBuffer result = new StringBuffer();
-
- Collection params = operation.getParameters();
- for (Iterator j = params.iterator(); j.hasNext();){
- ObjectModelParameter parameter = (ObjectModelParameter) j.next();
- result.append(getAttributeType(parameter)+" "+parameter.getName());
- if (j.hasNext()) {
- result.append(", ");
- }
- }
- return result.toString();
- }
-
- /**
- * Retourne la chaine de caractere qui represente chaque nom de parametre
- * separer par des ','.
- */
- public static String getOperationParametersListName(ObjectModelOperation operation) {
- Collection params = operation.getParameters();
- StringBuffer result = new StringBuffer();
- for (Iterator j = params.iterator(); j.hasNext();){
- ObjectModelParameter parameter = (ObjectModelParameter) j.next();
- result.append(parameter.getName());
- if (j.hasNext()) {
- result.append(", ");
- }
- }
- return result.toString();
- }
-
- /**
- * Renvoie sous forme de String la liste des déclarations des attributes d'une classe donnée
- */
- public static String getClassAttributesListDeclaration(ObjectModelClass clazz) {
- StringBuffer result = new StringBuffer();
-
- Collection params = clazz.getAttributes();
- for (Iterator j = params.iterator(); j.hasNext();){
- ObjectModelAttribute attr = (ObjectModelAttribute) j.next();
- result.append(getAttributeType(attr, true)+" "+attr.getName());
- if (j.hasNext()) {
- result.append(", ");
- }
- }
- return result.toString();
- }
-
- /**
- * Renvoie si l'attribut passé en paramètre est premier lexicographiquement
- * par rapport à son attribut inverse (si celui ci existe).
- * @param attr L'attribut dont on veut savoir s'il est le premier
- * @return true, si l'attribut est premier (lexico ou pas de reverse attribute), false dans les autres cas
- */
- public static boolean isFirstAttribute(ObjectModelAttribute attr) {
- if (attr.getReverseAttribute() == null)
- return true;
- return (attr.getName().compareTo(attr.getReverseAttribute().getName()) < 0);
- }
-
-} // Util
Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/ObjectModelElement.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -101,6 +101,13 @@
public abstract String getTagValue(String tagValue);
/**
+ * Returns whether this element has a tagValue corresponding to the given name, or not.
+ *
+ * @return a boolean indicating whether this element has a tagValue corresponding to the given name, or not.
+ */
+ public abstract boolean hasTagValue(String tagValue);
+
+ /**
* Returns all comments lied to this particular model element
*
* @return a List containing all comments for this element as Strings.
Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModeImplAssociationClassParticipant.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -19,7 +19,7 @@
import java.util.Iterator;
-import org.codelutin.generator.Util;
+import org.codelutin.generator.GeneratorUtil;
/**
*
@@ -57,7 +57,7 @@
for (Iterator i = associationClass.getParticipantsRefs().iterator(); i.hasNext();) {
ObjectModeImplAssociationClassParticipant participant = (ObjectModeImplAssociationClassParticipant)i.next();
if (participant != this) {
- attributeName = Util.toLowerCaseFirstLetter(Util.getClassNameFromQualifiedName(participant.getName()));
+ attributeName = GeneratorUtil.toLowerCaseFirstLetter(GeneratorUtil.getClassNameFromQualifiedName(participant.getName()));
break;
}
}
Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelAttributeImpl.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -29,7 +29,7 @@
package org.codelutin.generator.models.object.xml;
-import org.codelutin.generator.Util;
+import org.codelutin.generator.GeneratorUtil;
import org.codelutin.generator.models.object.ObjectModelAttribute;
import org.codelutin.generator.models.object.ObjectModelClass;
import org.codelutin.generator.models.object.ObjectModelClassifier;
@@ -56,7 +56,7 @@
public void postInit() {
if (name == null)
- name = Util.toLowerCaseFirstLetter(Util
+ name = GeneratorUtil.toLowerCaseFirstLetter(GeneratorUtil
.getClassNameFromQualifiedName(type));
super.postInit();
}
@@ -180,7 +180,7 @@
public String getReverseAttributeName() {
if ((reverseAttributeName == null)
|| ("".equals(reverseAttributeName))) {
- reverseAttributeName = Util
+ reverseAttributeName = GeneratorUtil
.toLowerCaseFirstLetter(getDeclaringElement().getName());
}
return reverseAttributeName;
@@ -188,7 +188,7 @@
public String getName() {
if ((name == null || "".equals(name)) && getClassifier() != null) {
- name = Util.toLowerCaseFirstLetter(getClassifier().getName());
+ name = GeneratorUtil.toLowerCaseFirstLetter(getClassifier().getName());
}
return name;
}
Modified: lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java 2009-01-06 13:36:31 UTC (rev 409)
+++ lutingenerator/trunk/src/main/java/org/codelutin/generator/models/object/xml/ObjectModelElementImpl.java 2009-01-29 10:58:54 UTC (rev 410)
@@ -193,6 +193,15 @@
}
/**
+ * Returns whether this element has a tagValue corresponding to the given name, or not.
+ *
+ * @return a boolean indicating whether this element has a tagValue corresponding to the given name, or not.
+ */
+ public boolean hasTagValue(String tagValue) {
+ return tagValues.containsKey(tagValue);
+ }
+
+ /**
* Returns all comments lied to this particular model element
*
* @return a List containing all comments for this element as Strings.
1
0
[Lutingenerator-commits] r409 - lutingenerator/trunk
by chatellier@users.labs.libre-entreprise.org 06 Jan '09
by chatellier@users.labs.libre-entreprise.org 06 Jan '09
06 Jan '09
Author: chatellier
Date: 2009-01-06 13:36:31 +0000 (Tue, 06 Jan 2009)
New Revision: 409
Modified:
lutingenerator/trunk/pom.xml
Log:
Update commons-digester to 2.0
Modified: lutingenerator/trunk/pom.xml
===================================================================
--- lutingenerator/trunk/pom.xml 2008-12-15 02:37:52 UTC (rev 408)
+++ lutingenerator/trunk/pom.xml 2009-01-06 13:36:31 UTC (rev 409)
@@ -28,9 +28,17 @@
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
- <version>1.8</version>
+ <version>2.0</version>
<scope>compile</scope>
</dependency>
+
+ <!-- JAXP parser impl for digester -->
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.9.1</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>commons-lang</groupId>
@@ -53,12 +61,14 @@
<scope>compile</scope>
</dependency>
+ <!-- dom4j dep -->
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
- <scope>compile</scope>
+ <scope>runtime</scope>
</dependency>
+
</dependencies>
<!-- ************************************************************* -->
1
0
[Lutingenerator-commits] r408 - lutingenerator/trunk maven-generator-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:37:52 +0000 (Mon, 15 Dec 2008)
New Revision: 408
Modified:
lutingenerator/trunk/changelog.txt
lutingenerator/trunk/pom.xml
maven-generator-plugin/trunk/pom.xml
Log:
push back scm
Modified: lutingenerator/trunk/changelog.txt
===================================================================
--- lutingenerator/trunk/changelog.txt 2008-12-15 02:32:19 UTC (rev 407)
+++ lutingenerator/trunk/changelog.txt 2008-12-15 02:37:52 UTC (rev 408)
@@ -1,3 +1,8 @@
+0.64 ?? 200812??
+
+0.63 chemit 20081215
+ * 20081215 [chemit] fix up to date regression on generation
+
0.62 chemit 20081210
* 20081210 [chemit] use lutinproject 3.2 and lutinutil 1.0
* 20081208 [chorlet] - correction bug #1737: Prise en compte du MetaModel UML dans les fichiers XMI
Modified: lutingenerator/trunk/pom.xml
===================================================================
--- lutingenerator/trunk/pom.xml 2008-12-15 02:32:19 UTC (rev 407)
+++ lutingenerator/trunk/pom.xml 2008-12-15 02:37:52 UTC (rev 408)
@@ -103,9 +103,9 @@
<!--Source control management-->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/trunk</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutingenerator/…</url>
+ <connection>${maven.scm.connection}</connection>
+ <developerConnection>${maven.scm.developerConnection}</developerConnection>
+ <url>${maven.scm.url}</url>
</scm>
</project>
Modified: maven-generator-plugin/trunk/pom.xml
===================================================================
--- maven-generator-plugin/trunk/pom.xml 2008-12-15 02:32:19 UTC (rev 407)
+++ maven-generator-plugin/trunk/pom.xml 2008-12-15 02:37:52 UTC (rev 408)
@@ -21,7 +21,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutingenerator</artifactId>
- <version>0.63</version>
+ <version>0.64-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
@@ -75,9 +75,9 @@
<!--Source control management-->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/trunk</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/trunk</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator…</url>
+ <connection>${maven.scm.connection}</connection>
+ <developerConnection>${maven.scm.developerConnection}</developerConnection>
+ <url>${maven.scm.url}</url>
</scm>
</project>
1
0
[Lutingenerator-commits] r407 - maven-generator-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:32:19 +0000 (Mon, 15 Dec 2008)
New Revision: 407
Modified:
maven-generator-plugin/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: maven-generator-plugin/trunk/pom.xml
===================================================================
--- maven-generator-plugin/trunk/pom.xml 2008-12-15 02:32:15 UTC (rev 406)
+++ maven-generator-plugin/trunk/pom.xml 2008-12-15 02:32:19 UTC (rev 407)
@@ -13,7 +13,7 @@
</parent>
<artifactId>maven-generator-plugin</artifactId>
- <version>0.63</version>
+ <version>0.64-SNAPSHOT</version>
<!-- POM Relationships : Inheritance : Dependencies -->
<dependencies>
@@ -75,9 +75,9 @@
<!--Source control management-->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/trunk</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator…</url>
</scm>
</project>
1
0
[Lutingenerator-commits] r406 - in maven-generator-plugin/tags: . 0.63 0.63/src/main/java/org/codelutin/generator/plugin
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:32:15 +0000 (Mon, 15 Dec 2008)
New Revision: 406
Added:
maven-generator-plugin/tags/0.63/
maven-generator-plugin/tags/0.63/README.txt
maven-generator-plugin/tags/0.63/changelog.txt
maven-generator-plugin/tags/0.63/pom.xml
maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java
Removed:
maven-generator-plugin/tags/0.63/changelog
maven-generator-plugin/tags/0.63/pom.xml
maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java
Log:
[maven-release-plugin] copy for tag 0.63
Copied: maven-generator-plugin/tags/0.63 (from rev 387, maven-generator-plugin/trunk)
Copied: maven-generator-plugin/tags/0.63/README.txt (from rev 389, maven-generator-plugin/trunk/README.txt)
===================================================================
--- maven-generator-plugin/tags/0.63/README.txt (rev 0)
+++ maven-generator-plugin/tags/0.63/README.txt 2008-12-15 02:32:15 UTC (rev 406)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Deleted: maven-generator-plugin/tags/0.63/changelog
===================================================================
--- maven-generator-plugin/trunk/changelog 2008-12-09 09:49:14 UTC (rev 387)
+++ maven-generator-plugin/tags/0.63/changelog 2008-12-15 02:32:15 UTC (rev 406)
@@ -1,40 +0,0 @@
-0.62-SNAPSHOT
- * 20081208 [chorlet] correction bug #1737: Prise en compte du MetaModel UML dans les fichiers XMI
- - ajout du support des fichiers default-java.xml et default-uml14.xmi
-
-0.62 chemit 200811??
- * 20081203 [chemit] add a encoding goal property to be dispatched in all generator to control file generation encoding
- * 20081118 [chemit] use lutinproject 3.1
- * 20081117 [chemit]
- - add extraClassPathDirectory parameter to can specify an extra directory to add in classLoader
- - bump lutingenerator version
-
-0.61 chatellier 20081114
- * 20081107 [chatellier]
- - add test compile dir and test resources in generation gaol
- * 20081101 [chemit]
- - add an excludeTemplates property on GeneratorPlugin to permit exclusion of generators for some composite generator
- - bump lutingenerator to 0.61
-
-0.60 chemit 20081013
- * 20081013 [chemit]
- - remove addCompileDirectory option (always done) + add dynamic resources
- - use lutingenerator 0.60
- - clean pom
-
-0.51 thimel 20080925
- * 20080925 [thimel] Refactor pom using the correct architecture
- * 20080925 [thimel] Switched License to LGPL
- * 20080723 [chemit]
- - add generated sources in maven project's compilation directories via addCompilationDirectory plugin property
-
- * 20070525 [chatellier]
- - add Xmi2StateModel goal
- - improve Xmi2Model Hierarchy
- * 20070525 [chatellier] update ant dependency to 1.7.0
- * 20070525 [chatellier] replacing lutinxml.XSLAntTask by Ant.XSLTProcess
-
-0.50 ??? ???
-
- * 20070420 [chatellier] add goal to copy a set of generated files
- * 20070420 [chatellier] update lutingenerator depencency to 0.50
Copied: maven-generator-plugin/tags/0.63/changelog.txt (from rev 404, maven-generator-plugin/trunk/changelog.txt)
===================================================================
--- maven-generator-plugin/tags/0.63/changelog.txt (rev 0)
+++ maven-generator-plugin/tags/0.63/changelog.txt 2008-12-15 02:32:15 UTC (rev 406)
@@ -0,0 +1,42 @@
+0.64 ?? 200812??
+
+0.63 chemit 20081215
+ * 20081215 [chemit] follow lutingenerator release
+
+0.62 chemit 20081210
+ * 20081210 [chemit] use lutinpluginproject 3.2
+ * 20081203 [chemit] add a encoding goal property to be dispatched in all generator to control file generation encoding
+ * 20081118 [chemit] use lutinproject 3.1
+ * 20081117 [chemit]
+ - add extraClassPathDirectory parameter to can specify an extra directory to add in classLoader
+ - bump lutingenerator version
+
+0.61 chatellier 20081114
+ * 20081107 [chatellier]
+ - add test compile dir and test resources in generation gaol
+ * 20081101 [chemit]
+ - add an excludeTemplates property on GeneratorPlugin to permit exclusion of generators for some composite generator
+ - bump lutingenerator to 0.61
+
+0.60 chemit 20081013
+ * 20081013 [chemit]
+ - remove addCompileDirectory option (always done) + add dynamic resources
+ - use lutingenerator 0.60
+ - clean pom
+
+0.51 thimel 20080925
+ * 20080925 [thimel] Refactor pom using the correct architecture
+ * 20080925 [thimel] Switched License to LGPL
+ * 20080723 [chemit]
+ - add generated sources in maven project's compilation directories via addCompilationDirectory plugin property
+
+ * 20070525 [chatellier]
+ - add Xmi2StateModel goal
+ - improve Xmi2Model Hierarchy
+ * 20070525 [chatellier] update ant dependency to 1.7.0
+ * 20070525 [chatellier] replacing lutinxml.XSLAntTask by Ant.XSLTProcess
+
+0.50 ??? ???
+
+ * 20070420 [chatellier] add goal to copy a set of generated files
+ * 20070420 [chatellier] update lutingenerator depencency to 0.50
\ No newline at end of file
Deleted: maven-generator-plugin/tags/0.63/pom.xml
===================================================================
--- maven-generator-plugin/trunk/pom.xml 2008-12-09 09:49:14 UTC (rev 387)
+++ maven-generator-plugin/tags/0.63/pom.xml 2008-12-15 02:32:15 UTC (rev 406)
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
- <parent>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinpluginproject</artifactId>
- <version>3.1</version>
- </parent>
-
- <artifactId>maven-generator-plugin</artifactId>
-
- <!-- POM Relationships : Inheritance : Dependencies -->
- <dependencies>
-
- <dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutingenerator</artifactId>
- <version>0.62-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.7.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-trax</artifactId>
- <version>1.7.1</version>
- <scope>runtime</scope>
- </dependency>
-
- </dependencies>
-
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
- <name>Plugin maven Generator</name>
- <version>0.62-SNAPSHOT</version>
- <inceptionYear>2006</inceptionYear>
- <description>maven plugin to use the lutingenerator library</description>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
- <packaging>maven-plugin</packaging>
-
- <properties>
- <!-- id du projet du labs -->
- <labs.id>39</labs.id>
-
- <!-- nom du projet sur le labs -->
- <labs.project>lutingenerator</labs.project>
-
- </properties>
-
- <build>
- <plugins>
-
- </plugins>
- </build>
-
-
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
-
- <!--Source control management-->
- <scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
- </scm>
-
-</project>
Copied: maven-generator-plugin/tags/0.63/pom.xml (from rev 405, maven-generator-plugin/trunk/pom.xml)
===================================================================
--- maven-generator-plugin/tags/0.63/pom.xml (rev 0)
+++ maven-generator-plugin/tags/0.63/pom.xml 2008-12-15 02:32:15 UTC (rev 406)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.codelutin</groupId>
+ <artifactId>lutinpluginproject</artifactId>
+ <version>3.2</version>
+ </parent>
+
+ <artifactId>maven-generator-plugin</artifactId>
+ <version>0.63</version>
+
+ <!-- POM Relationships : Inheritance : Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>lutingenerator</artifactId>
+ <version>0.63</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.7.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>Plugin maven Generator</name>
+ <inceptionYear>2006</inceptionYear>
+ <description>maven plugin to use the lutingenerator library</description>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+ <packaging>maven-plugin</packaging>
+
+ <properties>
+ <!-- id du projet du labs -->
+ <labs.id>39</labs.id>
+
+ <!-- nom du projet sur le labs -->
+ <labs.project>lutingenerator</labs.project>
+
+ </properties>
+
+ <build>
+ <plugins>
+
+ </plugins>
+ </build>
+
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <!--Source control management-->
+ <scm>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator…</url>
+ </scm>
+
+</project>
Deleted: maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java
===================================================================
--- maven-generator-plugin/trunk/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java 2008-12-09 09:49:14 UTC (rev 387)
+++ maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java 2008-12-15 02:32:15 UTC (rev 406)
@@ -1,193 +0,0 @@
-/* *##% Plugin maven Generator
- * Copyright (C) 2006 - 2008 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
-
-/* *
- * Xmi2Model.java
- *
- * Created: 14 avril 2006
- *
- * @author ruchaud
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-
-package org.codelutin.generator.plugin;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.util.List;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.tools.ant.BuildLogger;
-import org.apache.tools.ant.NoBannerLogger;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Copy;
-import org.apache.tools.ant.types.FileSet;
-import org.codelutin.generator.plugin.helper.ResourceResolver;
-import org.codelutin.util.FileUtil;
-import org.codelutin.util.Resource;
-
-/**
- * Converti les fichiers XMI en fichier Model via une transformation XSLT a
- * définir.
- *
- * Class abstraite sans feuille de style.
- */
-public abstract class Xmi2Model extends AbstractMojo {
-
- /**
- * Répertoire source des fichiers XMI
- *
- * @parameter alias="srcXmiDest"
- * @required
- */
- protected File srcDirXmi;
-
- /**
- * Répertoire cible des fichiers générés
- *
- * @parameter alias="srcGenDest"
- * @required
- */
- protected File destDirObjectModel;
-
- /**
- * Nom du paquetage pour les fichiers générés
- *
- * @parameter expression="org.codelutin.${project.artifactId}"
- */
- protected String fullPackagePath;
-
- /**
- * Nom du paquetage à généré
- *
- * @parameter
- */
- protected String extractedPackages = "";
-
- /**
- * Ecrase les fichiers générés
- *
- * @parameter default-value="false"
- */
- private boolean overwrite = false;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- actionXsl();
- actionCopy();
- }
-
- private void actionXsl() throws MojoExecutionException {
- List<File> files = FileUtil.getFilteredElements(srcDirXmi, new FileFilter() {
- public boolean accept(File pathname) {
- if (pathname != null && pathname.getName().endsWith(".xmi")) {
- return true;
- }
- return false;
- }
- }, false);
-
- destDirObjectModel.mkdirs();
-
- TransformerFactory factory = TransformerFactory.newInstance();
- URIResolver resolver = new ResourceResolver();
- for (File file : files) {
- try {
- URL xsl = Resource.getURL(getStyleSheet());
- File result = new File(destDirObjectModel, FileUtil.basename(file, ".xmi").concat(
- ".").concat(getExtension()));
-
- Transformer transformer = factory
- .newTransformer(new StreamSource(xsl.openStream()));
- transformer.setURIResolver(resolver);
- transformer.transform(new StreamSource(file), new StreamResult(
- new FileOutputStream(result)));
- transformer = null;
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new MojoExecutionException(e.getMessage());
- }
- }
- factory = null;
- resolver = null;
- }
-
- private void actionCopy() {
- /* Création d'un projet ant */
- Project project = createProject();
-
- /* Création de la tâche ant Copy */
- Copy copy = new Copy();
- copy.setProject(project);
- copy.setTaskName("Copy ressources");
-
- /* Configuration */
- copy.setTodir(destDirObjectModel);
- copy.setOverwrite(overwrite);
-
- FileSet fileSet = new FileSet();
- fileSet.setProject(project);
- fileSet.setDir(srcDirXmi);
- fileSet.setExcludes("**/*.xmi");
- copy.addFileset(fileSet);
-
- /* Execution */
- copy.execute();
- }
-
- private Project createProject() {
- /* Création d'un projet ant */
- Project project = new Project();
-
- BuildLogger logger = new NoBannerLogger();
- logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
- logger.setOutputPrintStream(System.out);
- logger.setErrorPrintStream(System.err);
-
- project.init();
- project.getBaseDir();
- project.addBuildListener(logger);
- return project;
- }
-
- /**
- * Set extention
- *
- * @return the extention
- */
- protected abstract String getExtension();
-
- /**
- * Set style sheet
- *
- * @return the stylesheet
- */
- protected abstract String getStyleSheet();
-}
Copied: maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java (from rev 400, maven-generator-plugin/trunk/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java)
===================================================================
--- maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java (rev 0)
+++ maven-generator-plugin/tags/0.63/src/main/java/org/codelutin/generator/plugin/Xmi2Model.java 2008-12-15 02:32:15 UTC (rev 406)
@@ -0,0 +1,190 @@
+/* *##% Plugin maven Generator
+ * Copyright (C) 2006 - 2008 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+
+/* *
+ * Xmi2Model.java
+ *
+ * Created: 14 avril 2006
+ *
+ * @author ruchaud
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+
+package org.codelutin.generator.plugin;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileOutputStream;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.tools.ant.BuildLogger;
+import org.apache.tools.ant.NoBannerLogger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.types.FileSet;
+import org.codelutin.generator.plugin.helper.ResourceResolver;
+import org.codelutin.util.FileUtil;
+import org.codelutin.util.Resource;
+
+/**
+ * Converti les fichiers XMI en fichier Model via une transformation XSLT a
+ * définir.
+ *
+ * Class abstraite sans feuille de style.
+ */
+public abstract class Xmi2Model extends AbstractMojo {
+
+ /**
+ * Répertoire source des fichiers XMI
+ *
+ * @parameter alias="srcXmiDest"
+ * @required
+ */
+ protected File srcDirXmi;
+
+ /**
+ * Répertoire cible des fichiers générés
+ *
+ * @parameter alias="srcGenDest"
+ * @required
+ */
+ protected File destDirObjectModel;
+
+ /**
+ * Nom du paquetage pour les fichiers générés
+ *
+ * @parameter expression="org.codelutin.${project.artifactId}"
+ */
+ protected String fullPackagePath;
+
+ /**
+ * Nom du paquetage à généré
+ *
+ * @parameter
+ */
+ protected String extractedPackages = "";
+
+ /**
+ * Ecrase les fichiers générés
+ *
+ * @parameter default-value="false"
+ */
+ private boolean overwrite = false;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ actionXsl();
+ actionCopy();
+ }
+
+ private void actionXsl() throws MojoExecutionException {
+ List<File> files = FileUtil.getFilteredElements(srcDirXmi, new FileFilter() {
+ public boolean accept(File pathname) {
+ return pathname != null && pathname.getName().endsWith(".xmi");
+ }
+ }, false);
+
+ destDirObjectModel.mkdirs();
+
+ TransformerFactory factory = TransformerFactory.newInstance();
+ URIResolver resolver = new ResourceResolver();
+ URL xsl = Resource.getURL(getStyleSheet());
+
+ for (File file : files) {
+ try {
+ File result = new File(destDirObjectModel, FileUtil.basename(file, ".xmi").concat(
+ ".").concat(getExtension()));
+ if (!overwrite && file.lastModified() < result.lastModified()) {
+ getLog().info("file up-to-date : "+result);
+ continue;
+ }
+ Transformer transformer = factory
+ .newTransformer(new StreamSource(xsl.openStream()));
+ transformer.setURIResolver(resolver);
+ transformer.transform(new StreamSource(file), new StreamResult(
+ new FileOutputStream(result)));
+
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(),e);
+ }
+ }
+ }
+
+ private void actionCopy() {
+ /* Création d'un projet ant */
+ Project project = createProject();
+
+ /* Création de la tâche ant Copy */
+ Copy copy = new Copy();
+ copy.setProject(project);
+ copy.setTaskName("Copy ressources");
+
+ /* Configuration */
+ copy.setTodir(destDirObjectModel);
+ copy.setOverwrite(overwrite);
+
+ FileSet fileSet = new FileSet();
+ fileSet.setProject(project);
+ fileSet.setDir(srcDirXmi);
+ fileSet.setExcludes("**/*.xmi");
+ copy.addFileset(fileSet);
+
+ /* Execution */
+ copy.execute();
+ }
+
+ private Project createProject() {
+ /* Création d'un projet ant */
+ Project project = new Project();
+
+ BuildLogger logger = new NoBannerLogger();
+ logger.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_INFO);
+ logger.setOutputPrintStream(System.out);
+ logger.setErrorPrintStream(System.err);
+
+ project.init();
+ project.getBaseDir();
+ project.addBuildListener(logger);
+ return project;
+ }
+
+ /**
+ * Set extention
+ *
+ * @return the extention
+ */
+ protected abstract String getExtension();
+
+ /**
+ * Set style sheet
+ *
+ * @return the stylesheet
+ */
+ protected abstract String getStyleSheet();
+}
1
0
[Lutingenerator-commits] r405 - maven-generator-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:32:11 +0000 (Mon, 15 Dec 2008)
New Revision: 405
Modified:
maven-generator-plugin/trunk/pom.xml
Log:
[maven-release-plugin] prepare release 0.63
Modified: maven-generator-plugin/trunk/pom.xml
===================================================================
--- maven-generator-plugin/trunk/pom.xml 2008-12-15 02:31:29 UTC (rev 404)
+++ maven-generator-plugin/trunk/pom.xml 2008-12-15 02:32:11 UTC (rev 405)
@@ -13,7 +13,7 @@
</parent>
<artifactId>maven-generator-plugin</artifactId>
- <version>0.63-SNAPSHOT</version>
+ <version>0.63</version>
<!-- POM Relationships : Inheritance : Dependencies -->
<dependencies>
@@ -75,9 +75,9 @@
<!--Source control management-->
<scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/maven-generator-plugin/tags/0.63</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/maven-generator…</url>
</scm>
</project>
1
0
[Lutingenerator-commits] r404 - maven-generator-plugin/trunk
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:31:29 +0000 (Mon, 15 Dec 2008)
New Revision: 404
Modified:
maven-generator-plugin/trunk/changelog.txt
maven-generator-plugin/trunk/pom.xml
Log:
prepare release
Modified: maven-generator-plugin/trunk/changelog.txt
===================================================================
--- maven-generator-plugin/trunk/changelog.txt 2008-12-15 02:16:37 UTC (rev 403)
+++ maven-generator-plugin/trunk/changelog.txt 2008-12-15 02:31:29 UTC (rev 404)
@@ -1,3 +1,8 @@
+0.64 ?? 200812??
+
+0.63 chemit 20081215
+ * 20081215 [chemit] follow lutingenerator release
+
0.62 chemit 20081210
* 20081210 [chemit] use lutinpluginproject 3.2
* 20081203 [chemit] add a encoding goal property to be dispatched in all generator to control file generation encoding
Modified: maven-generator-plugin/trunk/pom.xml
===================================================================
--- maven-generator-plugin/trunk/pom.xml 2008-12-15 02:16:37 UTC (rev 403)
+++ maven-generator-plugin/trunk/pom.xml 2008-12-15 02:31:29 UTC (rev 404)
@@ -21,7 +21,7 @@
<dependency>
<groupId>org.codelutin</groupId>
<artifactId>lutingenerator</artifactId>
- <version>${project.version}</version>
+ <version>0.63</version>
<scope>compile</scope>
</dependency>
1
0
[Lutingenerator-commits] r403 - lutingenerator/trunk
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:16:37 +0000 (Mon, 15 Dec 2008)
New Revision: 403
Modified:
lutingenerator/trunk/pom.xml
Log:
[maven-release-plugin] prepare for next development iteration
Modified: lutingenerator/trunk/pom.xml
===================================================================
--- lutingenerator/trunk/pom.xml 2008-12-15 02:16:34 UTC (rev 402)
+++ lutingenerator/trunk/pom.xml 2008-12-15 02:16:37 UTC (rev 403)
@@ -13,7 +13,7 @@
</parent>
<artifactId>lutingenerator</artifactId>
- <version>0.63</version>
+ <version>0.64-SNAPSHOT</version>
<!-- POM Relationships : Inheritance : Dependencies -->
<dependencies>
@@ -103,9 +103,9 @@
<!--Source control management-->
<scm>
- <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/tags/0.63</connection>
- <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/tags/0.63</developerConnection>
- <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutingenerator/…</url>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/trunk</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/trunk</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutingenerator/…</url>
</scm>
</project>
1
0
[Lutingenerator-commits] r402 - in lutingenerator/tags: . 0.63 0.63/src/main/java/org/codelutin/generator
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
by tchemit@users.labs.libre-entreprise.org 15 Dec '08
15 Dec '08
Author: tchemit
Date: 2008-12-15 02:16:34 +0000 (Mon, 15 Dec 2008)
New Revision: 402
Added:
lutingenerator/tags/0.63/
lutingenerator/tags/0.63/README.txt
lutingenerator/tags/0.63/changelog.txt
lutingenerator/tags/0.63/pom.xml
lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java
Removed:
lutingenerator/tags/0.63/changelog
lutingenerator/tags/0.63/pom.xml
lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java
Log:
[maven-release-plugin] copy for tag 0.63
Copied: lutingenerator/tags/0.63 (from rev 387, lutingenerator/trunk)
Copied: lutingenerator/tags/0.63/README.txt (from rev 388, lutingenerator/trunk/README.txt)
===================================================================
--- lutingenerator/tags/0.63/README.txt (rev 0)
+++ lutingenerator/tags/0.63/README.txt 2008-12-15 02:16:34 UTC (rev 402)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Deleted: lutingenerator/tags/0.63/changelog
===================================================================
--- lutingenerator/trunk/changelog 2008-12-09 09:49:14 UTC (rev 387)
+++ lutingenerator/tags/0.63/changelog 2008-12-15 02:16:34 UTC (rev 402)
@@ -1,78 +0,0 @@
-0.62-SNAPSHOT
- * 20081208 [chorlet] correction bug #1737: Prise en compte du MetaModel UML dans les fichiers XMI
- - ajout du support des fichiers default-java.xml et default-uml14.xmi
-
-0.62 chemit 200811??
- * 20081203 [chemit] add a encoding property on generator to control file generation encoding
- * 20081118 [chemit] use lutinproject 3.1
- * 20081117 [chemit] : GeneratorTask can have a dedicated classLoader to be used to instanciate generator implementations
-
-0.61 chatellier 20081114
- * 20081101 [chemit]
- - add a parent setter on ChildGenerator
- - add an excludeTemplates property on Generator and GeneratorTask to permit exclusion of generators for some composite generator
-
-0.60 chemit 20081013
- * 20081013 [chemit]
- - make tests works again
- - clean pom
-
-ver-0-51 thimel 20080925
-
- * 20080925 [thimel] super pom in version 3.0
- * 20080901 [chatellier] Maven2 layout and LGPL3
- * 20070528 [chatellier] add tag values support to stateModel
- * 20070528 [chatellier] modify defaut stateModel generation
- * 20070523 [chatellier] remove lutinxml dependency
- * 20070523 [chatellier] UIModel implementation over digester :
- - use generics
- - non tested
- - no digester rules definided (no samples available)
- * 20070523 [chatellier] change property reverveAttribute to
- reverveAttributeName to resolve conflict in objectModel model.
- * 20070522 [chatellier] modify ObjectModel implementation :
- - to use JavaBeans conventions
- - parsed with commons-digester
- - to use generics
- * 20070520 [chatellier] add stateModel (parsed with commons-digester)
- * 20070520 [chatellier] correct generic type error on objectModel interfaces
-
-ver-0-50 poussin 20070425
-
- * add associationType for all attributes
- * 20070420 [chatellier] Ajout de l'export de la version du modèle xmi dans
- xmi1.2ToObjectModel.xsl
- * 20070420 [chatellier] ajout de la DTD objectModel
-
-ver-0-31 thimel 20060825
-
- * ajout de isIndexed sur les attributs
- * isOrdered est vrai si isIndexed est vrai ou que le tagValue order-by est
- present ou que ordering fixe sur ordered
- * Ajout de validateurs de modele + impl de validateur "basiques" base sur des
- noms (attributs, classes, ...).
-
-ver-0-30 thimel 20060303
-
- * Ajout des exceptions pour les operations
- * Correction du support des interfaces et classes abstraites
- * Double compatibilite Poseidon 3.2 / 4
-
-ver-0-29 thimel 20060228
-
- * Support de l'hértage pour les classes d'association
-
-ver-0-28 thimel 20060224
-
- * Support de Poseidon4
- * Possibilite d'avoir des tagValues sur les modeles
- * Ajout de l'extraction de ordered et de la navigabilite
-
-ver-0-27 thimel 20051213
-
- * Ajout d'une methode pour avoir la liste des attributs d'une classe
- * Correction erreur de fonctionnement dans ObjectModelImpl(XML).getInterface (doit renvoyer null si non trouve)
-
-0.26
-
- * Ajout du support des stereotypes sur les attributs
Copied: lutingenerator/tags/0.63/changelog.txt (from rev 388, lutingenerator/trunk/changelog.txt)
===================================================================
--- lutingenerator/tags/0.63/changelog.txt (rev 0)
+++ lutingenerator/tags/0.63/changelog.txt 2008-12-15 02:16:34 UTC (rev 402)
@@ -0,0 +1,78 @@
+0.62 chemit 20081210
+ * 20081210 [chemit] use lutinproject 3.2 and lutinutil 1.0
+ * 20081208 [chorlet] - correction bug #1737: Prise en compte du MetaModel UML dans les fichiers XMI
+ - ajout du support des fichiers default-java.xml et default-uml14.xmi
+
+ * 20081203 [chemit] add a encoding property on generator to control file generation encoding
+ * 20081118 [chemit] use lutinproject 3.1
+ * 20081117 [chemit] : GeneratorTask can have a dedicated classLoader to be used to instanciate generator implementations
+
+0.61 chatellier 20081114
+ * 20081101 [chemit]
+ - add a parent setter on ChildGenerator
+ - add an excludeTemplates property on Generator and GeneratorTask to permit exclusion of generators for some composite generator
+
+0.60 chemit 20081013
+ * 20081013 [chemit]
+ - make tests works again
+ - clean pom
+
+ver-0-51 thimel 20080925
+
+ * 20080925 [thimel] super pom in version 3.0
+ * 20080901 [chatellier] Maven2 layout and LGPL3
+ * 20070528 [chatellier] add tag values support to stateModel
+ * 20070528 [chatellier] modify defaut stateModel generation
+ * 20070523 [chatellier] remove lutinxml dependency
+ * 20070523 [chatellier] UIModel implementation over digester :
+ - use generics
+ - non tested
+ - no digester rules definided (no samples available)
+ * 20070523 [chatellier] change property reverveAttribute to
+ reverveAttributeName to resolve conflict in objectModel model.
+ * 20070522 [chatellier] modify ObjectModel implementation :
+ - to use JavaBeans conventions
+ - parsed with commons-digester
+ - to use generics
+ * 20070520 [chatellier] add stateModel (parsed with commons-digester)
+ * 20070520 [chatellier] correct generic type error on objectModel interfaces
+
+ver-0-50 poussin 20070425
+
+ * add associationType for all attributes
+ * 20070420 [chatellier] Ajout de l'export de la version du modèle xmi dans
+ xmi1.2ToObjectModel.xsl
+ * 20070420 [chatellier] ajout de la DTD objectModel
+
+ver-0-31 thimel 20060825
+
+ * ajout de isIndexed sur les attributs
+ * isOrdered est vrai si isIndexed est vrai ou que le tagValue order-by est
+ present ou que ordering fixe sur ordered
+ * Ajout de validateurs de modele + impl de validateur "basiques" base sur des
+ noms (attributs, classes, ...).
+
+ver-0-30 thimel 20060303
+
+ * Ajout des exceptions pour les operations
+ * Correction du support des interfaces et classes abstraites
+ * Double compatibilite Poseidon 3.2 / 4
+
+ver-0-29 thimel 20060228
+
+ * Support de l'hértage pour les classes d'association
+
+ver-0-28 thimel 20060224
+
+ * Support de Poseidon4
+ * Possibilite d'avoir des tagValues sur les modeles
+ * Ajout de l'extraction de ordered et de la navigabilite
+
+ver-0-27 thimel 20051213
+
+ * Ajout d'une methode pour avoir la liste des attributs d'une classe
+ * Correction erreur de fonctionnement dans ObjectModelImpl(XML).getInterface (doit renvoyer null si non trouve)
+
+0.26
+
+ * Ajout du support des stereotypes sur les attributs
\ No newline at end of file
Deleted: lutingenerator/tags/0.63/pom.xml
===================================================================
--- lutingenerator/trunk/pom.xml 2008-12-09 09:49:14 UTC (rev 387)
+++ lutingenerator/tags/0.63/pom.xml 2008-12-15 02:16:34 UTC (rev 402)
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
- <parent>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinproject</artifactId>
- <version>3.1</version>
- </parent>
-
- <artifactId>lutingenerator</artifactId>
-
- <!-- POM Relationships : Inheritance : Dependencies -->
- <dependencies>
-
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>1.8</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- <version>1.7.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codelutin</groupId>
- <artifactId>lutinutil</artifactId>
- <version>0.31</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- <version>1.6.1</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- <version>1.1.1</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
- <name>Lutin Generator</name>
- <version>0.62-SNAPSHOT</version>
- <description>Générateurs en tout genre.</description>
- <inceptionYear>2004</inceptionYear>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
- <packaging>jar</packaging>
-
- <properties>
-
- <!-- id du projet du labs -->
- <labs.id>39</labs.id>
-
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- </plugin>
-
- </plugins>
- </build>
-
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
-
- <!--Source control management-->
- <scm>
- <connection>${maven.scm.connection}</connection>
- <developerConnection>${maven.scm.developerConnection}</developerConnection>
- <url>${maven.scm.url}</url>
- </scm>
-
-</project>
Copied: lutingenerator/tags/0.63/pom.xml (from rev 401, lutingenerator/trunk/pom.xml)
===================================================================
--- lutingenerator/tags/0.63/pom.xml (rev 0)
+++ lutingenerator/tags/0.63/pom.xml 2008-12-15 02:16:34 UTC (rev 402)
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+ <parent>
+ <groupId>org.codelutin</groupId>
+ <artifactId>lutinproject</artifactId>
+ <version>3.2</version>
+ </parent>
+
+ <artifactId>lutingenerator</artifactId>
+ <version>0.63</version>
+
+ <!-- POM Relationships : Inheritance : Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.codelutin</groupId>
+ <artifactId>lutinutil</artifactId>
+ <version>${lutinutil.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.8</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.7.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6.1</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+ <name>Lutin Generator</name>
+
+ <description>Générateurs en tout genre.</description>
+ <inceptionYear>2004</inceptionYear>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+ <packaging>jar</packaging>
+
+ <properties>
+
+ <!-- id du projet du labs -->
+ <labs.id>39</labs.id>
+
+ <!-- name du projet du labs -->
+ <labs.project>lutingenerator</labs.project>
+
+ <!-- lutinutil version -->
+ <lutinutil.version>1.0</lutinutil.version>
+
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <!--Source control management-->
+ <scm>
+ <connection>scm:svn:svn://anonymous@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/tags/0.63</connection>
+ <developerConnection>scm:svn:svn+ssh://tchemit@labs.libre-entreprise.org/svnroot/lutingenerator/lutingenerator/tags/0.63</developerConnection>
+ <url>http://labs.libre-entreprise.org/plugins/scmsvn/viewcvs.php/lutingenerator/…</url>
+ </scm>
+
+</project>
Deleted: lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java
===================================================================
--- lutingenerator/trunk/src/main/java/org/codelutin/generator/ObjectModelGenerator.java 2008-12-09 09:49:14 UTC (rev 387)
+++ lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java 2008-12-15 02:16:34 UTC (rev 402)
@@ -1,430 +0,0 @@
-/* *##% Lutin Generator
- * Copyright (C) 2004 - 2008 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
-
-/*******************************************************************************
- * ObjectModelGenerator.java
- *
- * Created: 14 mars 2004
- *
- * @author Benjamin Poussin <poussin(a)codelutin.com> Copyright Code Lutin
- *
- * @version $Revision$
- *
- * Mise a jour: $Date$ par : $Author$
- */
-
-package org.codelutin.generator;
-
-import org.apache.commons.digester.Digester;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelutin.generator.models.object.ObjectModel;
-import org.codelutin.generator.models.object.ObjectModelClass;
-import org.codelutin.generator.models.object.ObjectModelClassifier;
-import org.codelutin.generator.models.object.ObjectModelElement;
-import org.codelutin.generator.models.object.ObjectModelInterface;
-import org.codelutin.generator.models.object.xml.DigesterObjectModelRuleSet;
-import org.codelutin.generator.models.object.xml.ObjectModelClassifierImpl;
-import org.codelutin.generator.models.object.xml.ObjectModelElementImpl;
-import org.codelutin.generator.models.object.xml.ObjectModelImpl;
-import org.codelutin.generator.models.object.xml.ObjectModelImplRef;
-import org.codelutin.generator.models.object.xml.ObjectModelImplTagValue;
-import org.codelutin.util.FileUtil;
-import org.codelutin.util.RecursiveProperties;
-import org.codelutin.util.StringUtil;
-import org.xml.sax.SAXException;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Pour utiliser ce type de générateur il faut implanter au moins une des trois
- * méthodes generateFrom... et le getFilenameFor... associé si l'on souhaite un
- * nom de fichier convenable. Si dans une méthode generateFrom... on utilise pas
- * le Writer alors aucun fichier n'est généré.
- *
- * <pre>
- * public String getFilenameForClass(ObjectModelClass clazz){
- * return super.getFilenameForClass(Clazz) + "Service.java";
- * }
- *
- * public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException{
- * if(clazz.getType().equals("service")){
- * / *{
- * public class .... {
- *
- * }
- * }* /
- * }
- * }
- * </pre>
- *
- * Le nom de l'argument writer doit absolument etre output et pas autre chose si
- * vous souhaitez utiliser le processeur
- * {@link org.codelutin.processor.filters.GeneratorTemplatesFilter} pour vous
- * s'implifier l'écriture des templates.
- */
-public class ObjectModelGenerator extends ChildGenerator {
-
- /**
- * Logger for this class
- */
- private static final Log log = LogFactory
- .getLog(ObjectModelGenerator.class);
-
- protected ObjectModel model = null;
-
- /**
- *
- * l'expression réguliere match les chaines de type
- * <package.ClassName>.<class|attribute|operation>.[name].<stereotype|tagvalue>.[tag]
- * fr.isisfish.entities.Population.class.stereotype=entity
- * fr.isisfish.entities.Population.class.tagvalue.persistenceType=flatfile
- * fr.isisfish.entities.Population.attribute.name.stereotype=...
- * fr.isisfish.entities.Population.attribute.name.tagvalue.pk=topiaId
- * fr.isisfish.entities.Population.operation.getRegion.stereotype=...
- * fr.isisfish.entities.Population.operation.getRegion.tagvalue.pk=...
- */
- Pattern propertiesPattern = Pattern
- .compile("((?:[_a-zA-Z0-9]+\\.)+(?:_?[A-Z][_a-zA-Z0-9]*\\.)+)(?:(class|attribute|operation)\\.)(?:([_a-z0-9][_a-zA-Z0-9]*)\\.)?(?:(stereotype|tagvalue)\\.?)([_a-z0-9][_a-zA-Z0-9]*)?");
-
- public ObjectModelGenerator() {
- super();
- }
-
- public ObjectModelGenerator(Generator parent) {
- super(parent);
- }
-
- public ObjectModel getModel() {
- return model;
- }
-
- /**
- * @param files les noms des fichiers existant contenant du XML représentant
- * des ObjectModel. Il est automatiquement recherche un fichier de
- * propriété associé a ce fichier pour pouvoir ajouter des
- * stereotype ou des tag value sur les class, attribute ou operation
- * @param destDir le répertoire dans lequel il faudra mettre les fichiers
- * générés
- */
- public void generate(File[] files, File destDir) {
- setLastModifiedSource(files);
- ObjectModel objectModel = new ObjectModelImpl();
-
- // Digester parser configuration
- Digester digester = new Digester();
- digester.addRuleSet(new DigesterObjectModelRuleSet());
-
- for (File file : files) {
- try {
- digester.push(objectModel);
- objectModel = (ObjectModel) digester.parse(file);
- } catch (IOException e) {
- log.warn("Unable to parse ObjectModel input file : "
- + file, e);
- } catch (SAXException e) {
- log.warn("Unable to parse ObjectModel input file : "
- + file, e);
- }
-
- // recherche est charge le fichier propriete associe au modele
- File dir = file.getParentFile();
- String ext = FileUtil.extension(file);
- String name = FileUtil.basename(file, "." + ext);
- File propFile = new File(dir, name + ".properties");
- RecursiveProperties prop = new RecursiveProperties();
- if (!propFile.exists()) {
- if (log.isInfoEnabled()) {
- log.info("Pas de fichier de propriete " + propFile
- + " associé au model");
- }
- } else {
- if (log.isInfoEnabled()) {
- log.info("Lecture du fichier de propriete " + propFile
- + " associé au model");
- }
- try {
- prop.load(new FileInputStream(propFile));
- } catch (IOException eee) {
- log.warn("Impossible de lire le fichier de propriete "
- + propFile, eee);
- }
-
- // on ajoute les proprietes du fichier associe au model
- for (Enumeration e = prop.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
- String value = prop.getProperty(key);
-
- if (key.startsWith("model")) {
- if (!key.startsWith("model.tagvalue.")) {
- log.warn("only tagvalue is allowed on model in properties");
- } else {
- String tag = key.substring("model.tagvalue.".length());
-
- ObjectModelImplTagValue tagvalue = new ObjectModelImplTagValue();
- tagvalue.setName(tag);
- tagvalue.setValue(value);
- ((ObjectModelImpl) objectModel).addTagValue(tagvalue);
- }
- } else {
-
- Matcher matcher = propertiesPattern.matcher(key);
-
- if (log.isDebugEnabled()) {
- log.debug("Propriete: '" + key + "'");
- }
-
- if (matcher.find()) {
- // fqn is fully qualified name of class
- String fqn = matcher.group(1);
- fqn = StringUtil.substring(fqn, 0, -1); // remove ended
- // .
- // target is class, attribute or operation
- String target = matcher.group(2);
- String targetName = matcher.group(3);
- // type is stereotype or tagvalue
- String type = matcher.group(4);
- String tag = matcher.group(5);
-
- if (log.isDebugEnabled()) {
- log.debug("Propriete: '" + key + "' => " + "fqn:"
- + fqn + " target:" + target
- + " targetName:" + targetName + " type:"
- + type + " tag:" + tag);
- }
-
- ObjectModelClassifier omc = objectModel
- .getClassifier(fqn);
- if (omc instanceof ObjectModelClassifierImpl) {
- // on utilise une liste car il peut y avoir plusieur
- // operation avec le nom donné
- List<ObjectModelElement> elems = new ArrayList<ObjectModelElement>();
- if ("class".equals(target)) {
- elems.add((ObjectModelElementImpl) omc);
- } else if ("attribute".equals(target)) {
- ObjectModelClass classmodel = (ObjectModelClass) omc;
- elems.add((ObjectModelElementImpl) classmodel
- .getAttribute(targetName));
- } else if ("operation".equals(target)) {
- elems.addAll(omc
- .getOperations(targetName));
- }
- for (Iterator it = elems.iterator(); it.hasNext();) {
- ObjectModelElementImpl elem = (ObjectModelElementImpl) it
- .next();
- if ("stereotype".equals(type)) {
- // pour les stereotypes
- ObjectModelImplRef stereotype = new ObjectModelImplRef();
- stereotype.setName(value);
- elem.addStereotype(stereotype);
- } else if ("tagvalue".equals(type)) {
- // pour les tagvalues
- ObjectModelImplTagValue tagvalue = new ObjectModelImplTagValue();
- tagvalue.setName(tag);
- tagvalue.setValue(value);
- elem.addTagValue(tagvalue);
- }
- }
- } else {
- // TODO il faudra avoir des methodes d'acces en
- // Set sur l'interface pour eviter ce message
- log.warn("Can't add properties to model, it's not an ObjectModelClassifierImpl");
- }
- }
- }
- }
- }
- }
- try {
- generate(objectModel, destDir);
- } catch (IOException eee) {
- if (log.isWarnEnabled()) {
- log.warn("Unable to generate for file", eee);
- }
- }
- }
-
- /**
- * Par defaut la methode appelle la methode
- * {@link #generateFromModel(Writer, ObjectModel)} puis boucle sur chaque
- * class en appelant la m?thode
- * {@link #generateFromClass(Writer, ObjectModelClass)} et enfin sur chaque
- * interface en appelant a méthode
- * {@link #generateFromInterface(Writer, ObjectModelInterface)} Le nom de
- * fichier est récupérer pour chacun d'eux en appelant la méthode
- * getFilenameFor.... La methode generateFrom... n'utilise pas le Writer
- * alors le fichier n'est pas généré, si on l'utilise m?me pour ne rien
- * écrire alors le fichier sera généré.
- * @param model
- * @param destDir
- * @throws java.io.IOException
- */
- public void generate(ObjectModel model, File destDir) throws IOException {
- {
- this.model = model;
-
- String filename = getFilenameForModel(model);
- File outputFile = getDestinationFile(destDir, filename);
- if (getOverwrite() || !isNewerThanSource(outputFile)) {
- try {
- StringWriter out = new StringWriter();
- MonitorWriter monitorOut = new MonitorWriter(out);
- generateFromModel(monitorOut, model);
- write(outputFile, monitorOut);
- } catch (Exception eee) {
- log.warn("Erreur lors de la génération du fichier " + outputFile);
- throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
- }
- } else {
- Logger.getLogger(getClass().getName() + ".generate").log(
- Level.FINE, "file " + outputFile + " is up-to-date");
- }
- }
-
- for (Object o : model.getClassifiers()) {
- ObjectModelClassifier clazz = (ObjectModelClassifier) o;
-
- String filename = getFilenameForClassifier(clazz);
- File outputFile = getDestinationFile(destDir, filename);
- if (getOverwrite() || !isNewerThanSource(outputFile)) {
- try {
- StringWriter out = new StringWriter();
- MonitorWriter monitorOut = new MonitorWriter(out);
- generateFromClassifier(monitorOut, clazz);
- write(outputFile, monitorOut);
- } catch (Exception eee) {
- log.warn("Erreur lors de la génération du fichier " + outputFile);
- throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
- }
- } else {
- Logger.getLogger(getClass().getName() + ".generate").log(
- Level.FINE, "file " + outputFile + " is up-to-date");
- }
- }
-
- for (Object o : model.getInterfaces()) {
- ObjectModelInterface interfacez = (ObjectModelInterface) o;
-
- String filename = getFilenameForInterface(interfacez);
- File outputFile = getDestinationFile(destDir, filename);
- if (getOverwrite() || !isNewerThanSource(outputFile)) {
- try {
- StringWriter out = new StringWriter();
- MonitorWriter monitorOut = new MonitorWriter(out);
- generateFromInterface(monitorOut, interfacez);
- write(outputFile, monitorOut);
- } catch (Exception eee) {
- log.warn("Erreur lors de la génération du fichier " + outputFile);
- throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
- }
- } else {
- Logger.getLogger(getClass().getName() + ".generate").log(
- Level.FINE, "file " + outputFile + " is up-to-date");
- }
- }
-
- for (Object o : model.getClasses()) {
- ObjectModelClass clazz = (ObjectModelClass) o;
-
- String filename = getFilenameForClass(clazz);
- File outputFile = getDestinationFile(destDir, filename);
- if (getOverwrite() || !isNewerThanSource(outputFile)) {
- try {
- StringWriter out = new StringWriter();
- MonitorWriter monitorOut = new MonitorWriter(out);
- generateFromClass(monitorOut, clazz);
- write(outputFile, monitorOut);
- } catch (Exception eee) {
- log.warn("Erreur lors de la génération du fichier " + outputFile);
- throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
- }
- } else {
- Logger.getLogger(getClass().getName() + ".generate").log(
- Level.FINE, "file " + outputFile + " is up-to-date");
- }
- }
- }
-
- /**
- * Par defaut cette methode retourne le getName du model. Si l'on souhaite
- * utiliser la methode generateFromModel il vaut mieux surcharger cette
- * m?thode
- */
- public String getFilenameForModel(ObjectModel model) {
- return model.getName();
- }
-
- /**
- * Par defaut cette methode retourne le QualifiedName convertie en chemin
- * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- */
- public String getFilenameForPackage(ObjectModel model, String packageName) {
- return packageName.replace('.', File.separatorChar);
- }
-
- /**
- * Par defaut cette methode retourne le QualifiedName convertie en chemin
- * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- */
- public String getFilenameForInterface(ObjectModelInterface interfacez) {
- return interfacez.getQualifiedName().replace('.', File.separatorChar);
- }
-
- /**
- * Par defaut cette methode retourne le QualifiedName convertie en chemin
- * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- */
- public String getFilenameForClass(ObjectModelClass clazz) {
- return clazz.getQualifiedName().replace('.', File.separatorChar);
- }
-
- /**
- * Par defaut cette methode retourne le QualifiedName convertie en chemin
- * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
- */
- public String getFilenameForClassifier(ObjectModelClassifier clazz) {
- return clazz.getQualifiedName().replace('.', File.separatorChar);
- }
-
- public void generateFromModel(Writer output, ObjectModel model)
- throws IOException {
- }
-
- public void generateFromInterface(Writer output,
- ObjectModelInterface interfacez) throws IOException {
- }
-
- public void generateFromClass(Writer output, ObjectModelClass clazz)
- throws IOException {
- }
-
- public void generateFromClassifier(Writer output,
- ObjectModelClassifier clazz) throws IOException {
- }
-}
Copied: lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java (from rev 400, lutingenerator/trunk/src/main/java/org/codelutin/generator/ObjectModelGenerator.java)
===================================================================
--- lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java (rev 0)
+++ lutingenerator/tags/0.63/src/main/java/org/codelutin/generator/ObjectModelGenerator.java 2008-12-15 02:16:34 UTC (rev 402)
@@ -0,0 +1,451 @@
+/* *##% Lutin Generator
+ * Copyright (C) 2004 - 2008 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/
+
+/*******************************************************************************
+ * ObjectModelGenerator.java
+ *
+ * Created: 14 mars 2004
+ *
+ * @author Benjamin Poussin <poussin(a)codelutin.com> Copyright Code Lutin
+ *
+ * @version $Revision$
+ *
+ * Mise a jour: $Date$ par : $Author$
+ */
+
+package org.codelutin.generator;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.codelutin.generator.models.object.ObjectModel;
+import org.codelutin.generator.models.object.ObjectModelClass;
+import org.codelutin.generator.models.object.ObjectModelClassifier;
+import org.codelutin.generator.models.object.ObjectModelElement;
+import org.codelutin.generator.models.object.ObjectModelInterface;
+import org.codelutin.generator.models.object.xml.DigesterObjectModelRuleSet;
+import org.codelutin.generator.models.object.xml.ObjectModelClassifierImpl;
+import org.codelutin.generator.models.object.xml.ObjectModelElementImpl;
+import org.codelutin.generator.models.object.xml.ObjectModelImpl;
+import org.codelutin.generator.models.object.xml.ObjectModelImplRef;
+import org.codelutin.generator.models.object.xml.ObjectModelImplTagValue;
+import org.codelutin.util.FileUtil;
+import org.codelutin.util.RecursiveProperties;
+import org.codelutin.util.StringUtil;
+import org.xml.sax.SAXException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Pour utiliser ce type de générateur il faut implanter au moins une des trois
+ * méthodes generateFrom... et le getFilenameFor... associé si l'on souhaite un
+ * nom de fichier convenable. Si dans une méthode generateFrom... on utilise pas
+ * le Writer alors aucun fichier n'est généré.
+ *
+ * <pre>
+ * public String getFilenameForClass(ObjectModelClass clazz){
+ * return super.getFilenameForClass(Clazz) + "Service.java";
+ * }
+ *
+ * public void generateFromClass(Writer output, ObjectModelClass clazz) throws IOException{
+ * if(clazz.getType().equals("service")){
+ * / *{
+ * public class .... {
+ *
+ * }
+ * }* /
+ * }
+ * }
+ * </pre>
+ *
+ * Le nom de l'argument writer doit absolument etre output et pas autre chose si
+ * vous souhaitez utiliser le processeur
+ * org.codelutin.processor.filters.GeneratorTemplatesFilter pour vous
+ * s'implifier l'écriture des templates.
+ */
+public class ObjectModelGenerator extends ChildGenerator {
+
+ /**
+ * Logger for this class
+ */
+ private static final Log log = LogFactory
+ .getLog(ObjectModelGenerator.class);
+
+ protected ObjectModel model = null;
+
+ /**
+ *
+ * l'expression réguliere match les chaines de type
+ * <package.ClassName>.<class|attribute|operation>.[name].<stereotype|tagvalue>.[tag]
+ * fr.isisfish.entities.Population.class.stereotype=entity
+ * fr.isisfish.entities.Population.class.tagvalue.persistenceType=flatfile
+ * fr.isisfish.entities.Population.attribute.name.stereotype=...
+ * fr.isisfish.entities.Population.attribute.name.tagvalue.pk=topiaId
+ * fr.isisfish.entities.Population.operation.getRegion.stereotype=...
+ * fr.isisfish.entities.Population.operation.getRegion.tagvalue.pk=...
+ */
+ Pattern propertiesPattern = Pattern
+ .compile("((?:[_a-zA-Z0-9]+\\.)+(?:_?[A-Z][_a-zA-Z0-9]*\\.)+)(?:(class|attribute|operation)\\.)(?:([_a-z0-9][_a-zA-Z0-9]*)\\.)?(?:(stereotype|tagvalue)\\.?)([_a-z0-9][_a-zA-Z0-9]*)?");
+
+ public ObjectModelGenerator() {
+ super();
+ }
+
+ public ObjectModelGenerator(Generator parent) {
+ super(parent);
+ }
+
+ public ObjectModel getModel() {
+ return model;
+ }
+
+ /**
+ * @param files les noms des fichiers existant contenant du XML représentant
+ * des ObjectModel. Il est automatiquement recherche un fichier de
+ * propriété associé a ce fichier pour pouvoir ajouter des
+ * stereotype ou des tag value sur les class, attribute ou operation
+ * @param destDir le répertoire dans lequel il faudra mettre les fichiers
+ * générés
+ */
+ public void generate(File[] files, File destDir) {
+ setLastModifiedSource(files);
+ ObjectModel objectModel = new ObjectModelImpl();
+
+ // Digester parser configuration
+ Digester digester = new Digester();
+ digester.addRuleSet(new DigesterObjectModelRuleSet());
+
+ for (File file : files) {
+ try {
+ digester.push(objectModel);
+ objectModel = (ObjectModel) digester.parse(file);
+ } catch (IOException e) {
+ log.warn("Unable to parse ObjectModel input file : "
+ + file, e);
+ } catch (SAXException e) {
+ log.warn("Unable to parse ObjectModel input file : "
+ + file, e);
+ }
+
+ // recherche est charge le fichier propriete associe au modele
+ File dir = file.getParentFile();
+ String ext = FileUtil.extension(file);
+ String name = FileUtil.basename(file, "." + ext);
+ File propFile = new File(dir, name + ".properties");
+ RecursiveProperties prop = new RecursiveProperties();
+ if (!propFile.exists()) {
+ if (log.isInfoEnabled()) {
+ log.info("Pas de fichier de propriete " + propFile
+ + " associé au model");
+ }
+ } else {
+ if (log.isInfoEnabled()) {
+ log.info("Lecture du fichier de propriete " + propFile
+ + " associé au model");
+ }
+ try {
+ prop.load(new FileInputStream(propFile));
+ } catch (IOException eee) {
+ log.warn("Impossible de lire le fichier de propriete "
+ + propFile, eee);
+ }
+
+ // on ajoute les proprietes du fichier associe au model
+ for (Enumeration e = prop.keys(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
+ String value = prop.getProperty(key);
+
+ if (key.startsWith("model")) {
+ if (!key.startsWith("model.tagvalue.")) {
+ log.warn("only tagvalue is allowed on model in properties");
+ } else {
+ String tag = key.substring("model.tagvalue.".length());
+
+ ObjectModelImplTagValue tagvalue = new ObjectModelImplTagValue();
+ tagvalue.setName(tag);
+ tagvalue.setValue(value);
+ ((ObjectModelImpl) objectModel).addTagValue(tagvalue);
+ }
+ } else {
+
+ Matcher matcher = propertiesPattern.matcher(key);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Propriete: '" + key + "'");
+ }
+
+ if (matcher.find()) {
+ // fqn is fully qualified name of class
+ String fqn = matcher.group(1);
+ fqn = StringUtil.substring(fqn, 0, -1); // remove ended
+ // .
+ // target is class, attribute or operation
+ String target = matcher.group(2);
+ String targetName = matcher.group(3);
+ // type is stereotype or tagvalue
+ String type = matcher.group(4);
+ String tag = matcher.group(5);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Propriete: '" + key + "' => " + "fqn:"
+ + fqn + " target:" + target
+ + " targetName:" + targetName + " type:"
+ + type + " tag:" + tag);
+ }
+
+ ObjectModelClassifier omc = objectModel
+ .getClassifier(fqn);
+ if (omc instanceof ObjectModelClassifierImpl) {
+ // on utilise une liste car il peut y avoir plusieur
+ // operation avec le nom donné
+ List<ObjectModelElement> elems = new ArrayList<ObjectModelElement>();
+ if ("class".equals(target)) {
+ elems.add(omc);
+ } else if ("attribute".equals(target)) {
+ ObjectModelClass classmodel = (ObjectModelClass) omc;
+ elems.add(classmodel
+ .getAttribute(targetName));
+ } else if ("operation".equals(target)) {
+ elems.addAll(omc
+ .getOperations(targetName));
+ }
+ for (Object elem1 : elems) {
+ ObjectModelElementImpl elem = (ObjectModelElementImpl) elem1;
+ if ("stereotype".equals(type)) {
+ // pour les stereotypes
+ ObjectModelImplRef stereotype = new ObjectModelImplRef();
+ stereotype.setName(value);
+ elem.addStereotype(stereotype);
+ continue;
+ }
+
+ if ("tagvalue".equals(type)) {
+ // pour les tagvalues
+ ObjectModelImplTagValue tagvalue = new ObjectModelImplTagValue();
+ tagvalue.setName(tag);
+ tagvalue.setValue(value);
+ if (log.isDebugEnabled()) {
+ log.debug("tagValue:"+tagvalue+", tag:" + tag + ", value:" + value+", element:"+elem);
+ }
+ if (elem == null) {
+ log.warn("can not attach tagValue " + key);
+ } else {
+ elem.addTagValue(tagvalue);
+ }
+ }
+ }
+ } else {
+ // TODO il faudra avoir des methodes d'acces en
+ // Set sur l'interface pour eviter ce message
+ log.warn("Can't add properties to model, it's not an ObjectModelClassifierImpl");
+ }
+ }
+ }
+ }
+ }
+ }
+ try {
+ generate(objectModel, destDir);
+ } catch (IOException eee) {
+ if (log.isWarnEnabled()) {
+ log.warn("Unable to generate for file", eee);
+ }
+ }
+ }
+
+ /**
+ * Par defaut la methode appelle la methode
+ * {@link #generateFromModel(Writer, ObjectModel)} puis boucle sur chaque
+ * class en appelant la m?thode
+ * {@link #generateFromClass(Writer, ObjectModelClass)} et enfin sur chaque
+ * interface en appelant a méthode
+ * {@link #generateFromInterface(Writer, ObjectModelInterface)} Le nom de
+ * fichier est récupérer pour chacun d'eux en appelant la méthode
+ * getFilenameFor.... La methode generateFrom... n'utilise pas le Writer
+ * alors le fichier n'est pas généré, si on l'utilise m?me pour ne rien
+ * écrire alors le fichier sera généré.
+ * @param model
+ * @param destDir
+ * @throws java.io.IOException
+ */
+ public void generate(ObjectModel model, File destDir) throws IOException {
+ long newTime = System.currentTimeMillis();
+ {
+
+ this.model = model;
+
+ String filename = getFilenameForModel(model);
+ File outputFile = getDestinationFile(destDir, filename);
+ if (!getOverwrite() && isNewerThanSource(outputFile)) {
+ if (log.isDebugEnabled()) {
+ log.debug("file " + outputFile + " is up-to-date");
+ }
+ } else {
+ if (!outputFile.exists() && log.isDebugEnabled()) {
+ log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">");
+ }
+ try {
+ StringWriter out = new StringWriter();
+ MonitorWriter monitorOut = new MonitorWriter(out);
+ generateFromModel(monitorOut, model);
+ write(outputFile, monitorOut);
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la génération du fichier " + outputFile);
+ throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
+ }
+ }
+ }
+
+ for (ObjectModelClassifier clazz : model.getClassifiers()) {
+
+ String filename = getFilenameForClassifier(clazz);
+ File outputFile = getDestinationFile(destDir, filename);
+ if (!getOverwrite() && isNewerThanSource(outputFile)) {
+ if (log.isDebugEnabled()) {
+ log.debug("file " + outputFile + " is up-to-date");
+ }
+ continue;
+ }
+ if (!outputFile.exists() && log.isDebugEnabled()) {
+ log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">");
+ }
+ try {
+ StringWriter out = new StringWriter();
+ MonitorWriter monitorOut = new MonitorWriter(out);
+ generateFromClassifier(monitorOut, clazz);
+ write(outputFile, monitorOut);
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la génération du fichier " + outputFile);
+ throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
+ }
+ }
+
+ for (ObjectModelInterface interfacez : model.getInterfaces()) {
+
+ String filename = getFilenameForInterface(interfacez);
+ File outputFile = getDestinationFile(destDir, filename);
+ if (!getOverwrite() && isNewerThanSource(outputFile)) {
+ if (log.isDebugEnabled()) {
+ log.debug("file " + outputFile + " is up-to-date");
+ }
+ continue;
+ }
+ if (!outputFile.exists() && log.isDebugEnabled()) {
+ log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">");
+ }
+ try {
+ StringWriter out = new StringWriter();
+ MonitorWriter monitorOut = new MonitorWriter(out);
+ generateFromInterface(monitorOut, interfacez);
+ write(outputFile, monitorOut);
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la génération du fichier " + outputFile);
+ throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
+ }
+ }
+
+ for (ObjectModelClass clazz : model.getClasses()) {
+
+ String filename = getFilenameForClass(clazz);
+ File outputFile = getDestinationFile(destDir, filename);
+ if (!getOverwrite() && isNewerThanSource(outputFile)) {
+ if (log.isDebugEnabled()) {
+ log.debug("file " + outputFile + " is up-to-date");
+ }
+ continue;
+ }
+ if (!outputFile.exists() && log.isDebugEnabled()) {
+ log.debug("not up-to-date "+outputFile.lastModified()+" <"+outputFile+">");
+ }
+ try {
+ StringWriter out = new StringWriter();
+ MonitorWriter monitorOut = new MonitorWriter(out);
+ generateFromClass(monitorOut, clazz);
+ write(outputFile, monitorOut);
+ } catch (Exception eee) {
+ log.warn("Erreur lors de la génération du fichier " + outputFile);
+ throw new RuntimeException("Erreur lors de la génération du fichier " + outputFile, eee);
+ }
+ }
+ }
+
+ /**
+ * Par defaut cette methode retourne le getName du model. Si l'on souhaite
+ * utiliser la methode generateFromModel il vaut mieux surcharger cette
+ * m?thode
+ */
+ public String getFilenameForModel(ObjectModel model) {
+ return model.getName();
+ }
+
+ /**
+ * Par defaut cette methode retourne le QualifiedName convertie en chemin
+ * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
+ */
+ public String getFilenameForPackage(ObjectModel model, String packageName) {
+ return packageName.replace('.', File.separatorChar);
+ }
+
+ /**
+ * Par defaut cette methode retourne le QualifiedName convertie en chemin
+ * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
+ */
+ public String getFilenameForInterface(ObjectModelInterface interfacez) {
+ return interfacez.getQualifiedName().replace('.', File.separatorChar);
+ }
+
+ /**
+ * Par defaut cette methode retourne le QualifiedName convertie en chemin
+ * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
+ */
+ public String getFilenameForClass(ObjectModelClass clazz) {
+ return clazz.getQualifiedName().replace('.', File.separatorChar);
+ }
+
+ /**
+ * Par defaut cette methode retourne le QualifiedName convertie en chemin
+ * par exemple pour org.codelutin.Toto on aurait org/codelutin/Toto
+ */
+ public String getFilenameForClassifier(ObjectModelClassifier clazz) {
+ return clazz.getQualifiedName().replace('.', File.separatorChar);
+ }
+
+ public void generateFromModel(Writer output, ObjectModel model)
+ throws IOException {
+ }
+
+ public void generateFromInterface(Writer output,
+ ObjectModelInterface interfacez) throws IOException {
+ }
+
+ public void generateFromClass(Writer output, ObjectModelClass clazz)
+ throws IOException {
+ }
+
+ public void generateFromClassifier(Writer output,
+ ObjectModelClassifier clazz) throws IOException {
+ }
+}
1
0