Index: topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java diff -u /dev/null topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java:1.1 --- /dev/null Fri Jul 30 16:58:03 2004 +++ topia/src/java/org/codelutin/topia/persistence/AbstractPersistenceHelper.java Fri Jul 30 16:57:58 2004 @@ -0,0 +1,97 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * 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. + *##%*/ + +/* * + * DistributedPersistenceHelper.java + * + * Created: Jul 30, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/07/30 16:57:58 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia.persistence; + +import java.util.List; +import java.util.Properties; + +import org.codelutin.topia.TopiaContext; +import org.codelutin.topia.TopiaEntity; +import org.codelutin.topia.TopiaException; +import org.codelutin.topia.TopiaQuery; +import org.codelutin.topia.persistence.jdo.AbstractLazyEntity; +import org.codelutin.topia.persistence.jdo.Util; + +public abstract class AbstractPersistenceHelper { // AbstractPersistenceHelper + + /** + * Le context a partir duquel on a recupere ce AbstractPersistenceHelper + */ + protected TopiaContext context = null; + + /** + * Les proprietes pour ce AbstractPersistenceHelper + */ + protected Properties properties = null; + + public TopiaContext getContext(){ + return context; + } + + public Properties getProperties(){ + return properties; + } + + public AbstractPersistenceHelper(TopiaContext context, Properties properties) { + this.context = context; + } + + public TopiaEntity create(Class entityClass) throws TopiaException { + Class clazz = Util.getClazz(entityClass.getName() + "Impl"); + Class lazyClass = Util.getLazyClass(entityClass); + TopiaEntity entity = (TopiaEntity) Util.getInstance(clazz); + AbstractLazyEntity lazy = (AbstractLazyEntity) Util.getInstance( + lazyClass, new Object[] { context, entity }); + return lazy; + } + + public abstract TopiaEntity makePersistent(TopiaEntity entity) throws TopiaException; + + public abstract TopiaEntity update(TopiaEntity entity) throws TopiaException; + + public abstract void delete(TopiaEntity entity) throws TopiaException; + + /** + * Permet de récupéré une liste d'objet par rapport a une requete. + * + * @param query + * la requete a executer + * @return une List d'objets + */ + public abstract List find(TopiaQuery query) throws TopiaException; + + public abstract int size(TopiaQuery query) throws TopiaException; + + protected abstract TopiaEntity findByTopiaId(String id) throws TopiaException; + +} // AbstractPersistenceHelper + Index: topia/src/java/org/codelutin/topia/persistence/DistributedPersistenceHelper.java diff -u /dev/null topia/src/java/org/codelutin/topia/persistence/DistributedPersistenceHelper.java:1.1 --- /dev/null Fri Jul 30 16:58:03 2004 +++ topia/src/java/org/codelutin/topia/persistence/DistributedPersistenceHelper.java Fri Jul 30 16:57:58 2004 @@ -0,0 +1,79 @@ +/* *##% + * Copyright (C) 2002, 2003, 2004 + * 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. + *##%*/ + +/* * + * DistributedPersistenceHelper.java + * + * Created: Jul 30, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/07/30 16:57:58 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia.persistence; + +import java.util.List; +import java.util.Properties; + +import org.codelutin.topia.TopiaContext; +import org.codelutin.topia.TopiaEntity; +import org.codelutin.topia.TopiaException; +import org.codelutin.topia.TopiaQuery; + +/** + * + */ +public class DistributedPersistenceHelper extends AbstractPersistenceHelper { + + public DistributedPersistenceHelper(TopiaContext context, Properties properties) { + super(context, properties); + } + + public TopiaEntity makePersistent(TopiaEntity entity) throws TopiaException { + return null; + } + + public TopiaEntity update(TopiaEntity entity) throws TopiaException { + return null; + } + + public void delete(TopiaEntity entity) throws TopiaException { + } + + /** + * Permet de récupéré une liste d'objet par rapport a une requete. + * @param query la requete a executer + * @return une List d'objets + */ + public List find(TopiaQuery query) throws TopiaException { + return null; + } + + public int size(TopiaQuery query) throws TopiaException { + return 0; + } + + protected TopiaEntity findByTopiaId(String id) throws TopiaException { + return null; + } + +}