Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityGenerator.java:1.3 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityGenerator.java:1.4 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityGenerator.java:1.3 Thu Sep 16 15:55:03 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityGenerator.java Sat Feb 5 10:47:09 2005 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Mise a jour: $Date: 2004/09/16 15:55:03 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2005/02/05 10:47:09 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators; @@ -150,6 +150,30 @@ }*/ } + ////////////////////////////////////////////////////////////////////// + // O T H E R + ////////////////////////////////////////////////////////////////////// + + public void generateOther(Writer output, ObjectModelClassifier clazzifier) throws IOException { +/*{ + + /** + * Return an XML representation of this entity + *) + public String toXML(); + +}*/ + if(clazzifier instanceof ObjectModelClass){ + ObjectModelClass clazz = (ObjectModelClass)clazzifier; +/*{ + /** + * Return the model class for this entity as an entry point in the project entities model + *) + public ObjectModelClass getModelElement(); + +}*/ + } + } ////////////////////////////////////////////////////////////////////// // REMOVE ENTITY DECLARATION Index: topia/src/java/org/codelutin/topia/generators/TopiaAbstractObjectModelGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/TopiaAbstractObjectModelGenerator.java:1.3 topia/src/java/org/codelutin/topia/generators/TopiaAbstractObjectModelGenerator.java:1.4 --- topia/src/java/org/codelutin/topia/generators/TopiaAbstractObjectModelGenerator.java:1.3 Thu Sep 16 15:55:03 2004 +++ topia/src/java/org/codelutin/topia/generators/TopiaAbstractObjectModelGenerator.java Sat Feb 5 10:47:09 2005 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Mise a jour: $Date: 2004/09/16 15:55:03 $ - * par : $Author: mazelier $ + * Mise a jour: $Date: 2005/02/05 10:47:09 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators; @@ -181,6 +181,8 @@ import org.codelutin.topia.TopiaPersistenceService; import org.codelutin.topia.TopiaQuery; import org.codelutin.topia.TopiaArgument; +import org.codelutin.generator.models.object.ObjectModelClass; +import org.codelutin.generator.models.object.ObjectModelInterface; import java.util.List; import java.util.Collection; import java.util.Collections; Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToApplicationContextGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToApplicationContextGenerator.java:1.2 topia/src/java/org/codelutin/topia/generators/ObjectModelToApplicationContextGenerator.java:1.3 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToApplicationContextGenerator.java:1.2 Fri Aug 6 17:48:52 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToApplicationContextGenerator.java Sat Feb 5 10:47:09 2005 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/08/06 17:48:52 $ - * par : $Author: bpoussin $ + * Mise a jour: $Date: 2005/02/05 10:47:09 $ + * par : $Author: pineau $ */ package org.codelutin.topia.generators; @@ -84,7 +84,15 @@ } /** - * Method qui permet de recuperer un context pour l'application. + * Donne le nom du fichier de propriété client lu par defaut. + *) + static public String getClientContextPropertiesFilename(){ + String propName = "<%=model.getName()%>Context-client.properties"; + return propName; + } + + /** + * Methode qui permet de recuperer un context pour l'application. * Cette methode est en fait un appel a la factory de context. * L'avantage d'utiliser cette methode est qu'elle vous evite un cast *) @@ -94,12 +102,31 @@ } /** + * Methode qui permet de recuperer un context client pour l'application. + * Cette methode est en fait un appel a la factory de context. + * L'avantage d'utiliser cette methode est qu'elle vous evite un cast + *) + public static <%=model.getName()%>Context getClientContext() throws TopiaException { + String propName = getClientContextPropertiesFilename(); + return (<%=model.getName()%>Context)TopiaContextFactory.getClientContext(propName); + } + + /** * Method qui permet de recuperer un context pour l'application. * Cette methode est en fait un appel a la factory de context. * L'avantage d'utiliser cette methode est qu'elle vous evite un cast *) public static <%=model.getName()%>Context getContext(Properties prop) throws TopiaException { return (<%=model.getName()%>Context)TopiaContextFactory.getContext(prop); + } + + /** + * Method qui permet de recuperer un context client pour l'application. + * Cette methode est en fait un appel a la factory de context. + * L'avantage d'utiliser cette methode est qu'elle vous evite un cast + *) + public static <%=model.getName()%>Context getClientContext(Properties prop) throws TopiaException { + return (<%=model.getName()%>Context)TopiaContextFactory.getClientContext(prop); } }*/ Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java:1.7 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java:1.8 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java:1.7 Fri Dec 17 16:13:51 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityImplGenerator.java Sat Feb 5 10:47:09 2005 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ * - * Mise a jour: $Date: 2004/12/17 16:13:51 $ + * Mise a jour: $Date: 2005/02/05 10:47:09 $ * par : $Author: pineau $ */ @@ -277,7 +277,33 @@ return context; } + /** + * Return a String representation of this entity + *) + public String toString(){ + return <%=getProperty("defaultPackage")%>.<%=model.getName()%>EntitiesHelper.toString(this); + } + + /** + * Return an XML representation of this entity + *) + public String toXML(){ + return <%=getProperty("defaultPackage")%>.<%=model.getName()%>EntitiesHelper.toXML(this); + } + +}*/ + if(clazzifier instanceof ObjectModelClass){ + ObjectModelClass clazz = (ObjectModelClass)clazzifier; +/*{ + /** + * Return the model class for this entity as an entry point in the project entities model + *) + public ObjectModelClass getModelElement() { + return null; // TODO + } + }*/ + } } protected void generateSetAllFrameworkProperties(Writer output, ObjectModelClass clazz) throws IOException { Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.4 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.5 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java:1.4 Fri Dec 17 16:13:51 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceImplGenerator.java Sat Feb 5 10:47:09 2005 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * - * Mise a jour: $Date: 2004/12/17 16:13:51 $ + * Mise a jour: $Date: 2005/02/05 10:47:09 $ * par : $Author: pineau $ */ @@ -193,6 +193,17 @@ public String [] getFieldNames(){ return fielNames; } + + /** + * Return the <%=clazz.getName()%> corresponding to the given XML representation + *) + public <%=clazz.getName()%> fromXML(String entityXML) throws TopiaException { + TopiaEntity entity =(<%=clazz.getName()%>) <%=getProperty("defaultPackage")%>.<%=model.getName()%>EntitiesHelper.fromXML(entityXML); + if (! (entity instanceof <%=clazz.getName()%>)) { + throw new TopiaException("Wrong persistence service. You should use the entity related persistence service"); + } + return (<%=clazz.getName()%>) entity; + } }*/ } else { Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceGenerator.java diff -u topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceGenerator.java:1.4 topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceGenerator.java:1.5 --- topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceGenerator.java:1.4 Thu Sep 16 14:07:45 2004 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToEntityPersistenceServiceGenerator.java Sat Feb 5 10:47:09 2005 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * - * Mise a jour: $Date: 2004/09/16 14:07:45 $ + * Mise a jour: $Date: 2005/02/05 10:47:09 $ * par : $Author: pineau $ */ @@ -129,7 +129,13 @@ public <%=clazz.getName()%> create<%=clazz.getName()%>() throws TopiaException; public <%=clazz.getName()%> makePersistent(<%=clazz.getName()%> entity) throws TopiaException; + + /** + * Return the <%=clazz.getName()%> corresponding to the given XML representation + *) + public <%=clazz.getName()%> fromXML(String entityXML) throws TopiaException; }*/ + } } Index: topia/src/java/org/codelutin/topia/generators/ObjectModelToClientContextPropertiesGenerator.java diff -u /dev/null topia/src/java/org/codelutin/topia/generators/ObjectModelToClientContextPropertiesGenerator.java:1.1 --- /dev/null Sat Feb 5 10:47:14 2005 +++ topia/src/java/org/codelutin/topia/generators/ObjectModelToClientContextPropertiesGenerator.java Sat Feb 5 10:47:09 2005 @@ -0,0 +1,85 @@ +/* *##% + * Copyright (C) 2002, 2003 Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * ObjectModelToContextPropertiesGenerator.java + * + * Created: 3 juil. 2004 + * + * @author Benjamin Poussin + * Copyright Code Lutin + * @version $Revision: 1.1 $ + * + * Mise a jour: $Date: 2005/02/05 10:47:09 $ + * par : $Author: pineau $ + */ + +package org.codelutin.topia.generators; + +import java.io.IOException; +import java.io.Writer; +import java.util.Iterator; + +import org.codelutin.generator.Generator; +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModel; +import org.codelutin.generator.models.object.ObjectModelClass; +import org.codelutin.generator.models.object.ObjectModelClassifier; +import org.codelutin.topia.generators.Util; + +public class ObjectModelToClientContextPropertiesGenerator extends ObjectModelGenerator { // ObjectModelToContextPropertiesGenerator + + public ObjectModelToClientContextPropertiesGenerator(){ + super(); + } + + public ObjectModelToClientContextPropertiesGenerator(Generator parent){ + super(parent); + } + + public String getFilenameForModel(ObjectModel model){ + return model.getName() + "Context-client.properties"; + } + + public void generateFromModel(Writer output, ObjectModel model) throws IOException { +/*{ +context.class=<%=getProperty("defaultPackage")%>.<%=model.getName()%>Context +context.helper.persistence=org.codelutin.topia.persistence.DistributedPersistenceHelper +context.helper.persistence.properties.file=<%=model.getName()%>DistributedPersistenceHelper.properties +context.helper.distribution=org.codelutin.topia.distribution.JndiDistributionHelper +context.helper.hook=org.codelutin.topia.hook.DefaultHookHelper + +}*/ + for(Iterator i=model.getClassifiers().iterator(); i.hasNext();){ + ObjectModelClassifier clazz = (ObjectModelClassifier)i.next(); + if(Util.isEntity(clazz)){ +/*{mapping.implementation.<%=clazz.getQualifiedName()%>Operation=<%=clazz.getQualifiedName()%>OperationImpl +mapping.distribution.<%=clazz.getQualifiedName()%>Operation=<%=clazz.getQualifiedName()%>OperationRouter +mapping.implementation.<%=clazz.getQualifiedName()%>PersistenceService=<%=clazz.getQualifiedName()%>PersistenceServiceImpl +}*/ + } + if(Util.isService(clazz)){ +/*{mapping.implementation.<%=clazz.getQualifiedName()%>=<%=clazz.getQualifiedName()%>Impl +mapping.distribution.<%=clazz.getQualifiedName()%>=<%=clazz.getQualifiedName()%>Router +}*/ + } + } + } + +} // ObjectModelToContextPropertiesGenerator +