Index: topia/src/java/org/codelutin/topia/generators/topia/ObjectModelToPersistenceHelperPropertiesGenerator.java diff -u /dev/null topia/src/java/org/codelutin/topia/generators/topia/ObjectModelToPersistenceHelperPropertiesGenerator.java:1.1 --- /dev/null Tue Jun 28 14:09:27 2005 +++ topia/src/java/org/codelutin/topia/generators/topia/ObjectModelToPersistenceHelperPropertiesGenerator.java Tue Jun 28 14:09:22 2005 @@ -0,0 +1,84 @@ +/* *##% + * Copyright (C) 2005 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * 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. + *##%*/ + +/* * + * ObjectModelToPersistenceHelperPropertiesGenerator.java + * + * Created: 27 juin 2005 11:59:16 CEST + * + * @author Benjamin POUSSIN + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2005/06/28 14:09:22 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.topia.generators.topia; + +import java.util.logging.Level; +import java.util.logging.Logger; +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 ObjectModelToPersistenceHelperPropertiesGenerator extends ObjectModelGenerator { // ObjectModelToPersistenceHelperPropertiesGenerator + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Logger log = Logger.getLogger("org.codelutin.topia.generators.topia.ObjectModelToPersistenceHelperPropertiesGenerator"); + + public ObjectModelToPersistenceHelperPropertiesGenerator(){ + super(); + } + + public ObjectModelToPersistenceHelperPropertiesGenerator(Generator parent){ + super(parent); + } + + public String getFilenameForModel(ObjectModel model){ + return model.getName() + "TopiaPersistenceHelper.properties"; + } + + public void generateFromModel(Writer output, ObjectModel model) throws IOException { +/*{ +# options generales +TopiaPersistenceHelper.history.depth=-1 +TopiaPersistenceHelper.converter= +TopiaPersistenceHelper.storage=org.codelutin.topia.persistence.topia.TopiaStorageSerialization + +# option serialization storage +TopiaStorageSerialization.directory=/tmp/topia/<%=model.getName()%> + +# options database storage +TopiaPersistenceHelper.database.driver=<%=getProperty("database.driver")%> +TopiaPersistenceHelper.database.URL=<%=getProperty("database.URL")%> +TopiaPersistenceHelper.database.user=<%=getProperty("database.user")%> +TopiaPersistenceHelper.database.password=<%=getProperty("database.password")%> + +}*/ + } + + +} // ObjectModelToPersistenceHelperPropertiesGenerator + Index: topia/src/java/org/codelutin/topia/generators/topia/ObjectModelToTopiaPersistenceMetaGenerator.java diff -u /dev/null topia/src/java/org/codelutin/topia/generators/topia/ObjectModelToTopiaPersistenceMetaGenerator.java:1.1 --- /dev/null Tue Jun 28 14:09:27 2005 +++ topia/src/java/org/codelutin/topia/generators/topia/ObjectModelToTopiaPersistenceMetaGenerator.java Tue Jun 28 14:09:22 2005 @@ -0,0 +1,69 @@ +/* *##% + * Copyright (C) 2005 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * 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. + *##%*/ + +/* * + * ObjectModelToTopiaPersistenceMetaGenerator.java + * + * Created: 27 juin 2005 11:54:02 CEST + * + * @author Benjamin POUSSIN + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2005/06/28 14:09:22 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.topia.generators.topia; + +import java.util.logging.Level; +import java.util.logging.Logger; +import org.codelutin.topia.generators.ObjectModelToTopiaMetaGenerator; +import org.codelutin.generator.Generator; +import org.codelutin.generator.ObjectModelGenerator; +import org.codelutin.generator.models.object.ObjectModel; +import java.io.IOException; +import java.io.File; + +public class ObjectModelToTopiaPersistenceMetaGenerator extends ObjectModelGenerator { // ObjectModelToTopiaPersistenceMetaGenerator + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Logger log = Logger.getLogger("org.codelutin.topia.generators.topia.ObjectModelToTopiaPersistenceMetaGenerator"); + + public ObjectModelToTopiaPersistenceMetaGenerator(){ + super(); + } + + public ObjectModelToTopiaPersistenceMetaGenerator(Generator parent){ + super(parent); + } + + public void generate(ObjectModel model, File destDir) throws IOException { + ObjectModelGenerator gen = null; + + log.fine("Generation de ObjectModelToTopiaMetaGenerator"); + gen = new ObjectModelToTopiaMetaGenerator(this); + gen.generate(model, destDir); + + log.fine("Generation de ObjectModelToPersistenceHelperPropertiesGenerator(topia)"); + gen = new ObjectModelToPersistenceHelperPropertiesGenerator(this); + gen.generate(model, destDir); + } + +} // ObjectModelToTopiaPersistenceMetaGenerator +