Index: topia/src/java/org/codelutin/topia/TopiaContextFactory.java diff -u topia/src/java/org/codelutin/topia/TopiaContextFactory.java:1.2 topia/src/java/org/codelutin/topia/TopiaContextFactory.java:1.3 --- topia/src/java/org/codelutin/topia/TopiaContextFactory.java:1.2 Fri Aug 6 17:48:52 2004 +++ topia/src/java/org/codelutin/topia/TopiaContextFactory.java Wed Sep 15 14:36:04 2004 @@ -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: 2004/09/15 14:36:04 $ + * par : $Author: pineau $ */ package org.codelutin.topia; @@ -40,39 +40,40 @@ import org.codelutin.util.Resource; /** -* Class permettant de récupérer le context de l'application. Pour un fichier -* de propriété donné, le context retourné est toujours le même. -*/ + * Class permettant de récupérer le context de l'application. Pour un fichier de + * propriété donné, le context retourné est toujours le même. + */ public class TopiaContextFactory { // TopiaContextFactory /** Static context */ protected static HashMap contexts = new HashMap(); /** - * Donne le context par defaut, c'est a dire que le fichier de propriété - * recherché est topiaContext.properties. - */ + * Donne le context par defaut, c'est a dire que le fichier de propriété + * recherché est topiaContext.properties. + */ public static TopiaContext getContext() throws TopiaException { - return getContext(((Properties)null)); + return getContext((Properties) null); } /** - * Donne le context associé au fichier de propriétés passés en argument - * Si le context n'existe pas encore, il est créé. - */ - public static TopiaContext getContext(String propertiesFileName) throws TopiaException { + * Donne le context associé au fichier de propriétés passés en argument Si + * le context n'existe pas encore, il est créé. + */ + public static TopiaContext getContext(String propertiesFileName) + throws TopiaException { if (propertiesFileName == null) { - return getContext(((Properties)null)); + return getContext((Properties) null); } return getContext(getProperties(propertiesFileName)); } /** - * Donne le context associé à l'objet propriété passé en argument - * Si le context n'existe pas encore, il est créé. - */ + * Donne le context associé à l'objet propriété passé en argument Si le + * context n'existe pas encore, il est créé. + */ public static TopiaContext getContext(Properties properties) - throws TopiaException { + throws TopiaException { TopiaContext context = (TopiaContext) contexts.get(properties); if (context == null) { if (properties == null) { @@ -86,49 +87,49 @@ } /** - * Créé le context en utilisant les propriétés. Pour savoir qu'elle - * context instancier, on utilise la valeur de application.class.context - * qui doit se trouver dans les propriétés. - */ - protected static TopiaContext createContext(Properties properties) throws TopiaNotFoundException { + * Créé le context en utilisant les propriétés. Pour savoir qu'elle context + * instancier, on utilise la valeur de application.class.context qui doit se + * trouver dans les propriétés. + */ + protected static TopiaContext createContext(Properties properties) + throws TopiaNotFoundException { TopiaContext context = null; Class contextClass = null; - String contextClassName = - properties.getProperty( - TopiaConst.CONTEXT_CLASS, - "org.codelutin.topia.TopiaContext"); - Logger.getLogger(TopiaContextFactory.class + ".createContext").log(Level.INFO, "Class used for context is " + contextClassName); + String contextClassName = properties.getProperty( + TopiaConst.CONTEXT_CLASS, "org.codelutin.topia.TopiaContext"); + Logger.getLogger(TopiaContextFactory.class + ".createContext").log( + Level.INFO, "Class used for context is " + contextClassName); try { contextClass = Class.forName(contextClassName); - Constructor constructor = contextClass.getDeclaredConstructor(new Class[] {Properties.class}); + Constructor constructor = contextClass + .getDeclaredConstructor(new Class[] { Properties.class }); constructor.setAccessible(true); - context = (TopiaContext) constructor.newInstance(new Object[] {properties}); + context = (TopiaContext) constructor + .newInstance(new Object[] { properties }); } catch (Exception eee) { throw new TopiaNotFoundException( - "TopiaContext can't be instanciated: " - + contextClassName - + " concret : " - + contextClass, - eee); + "TopiaContext can't be instanciated: " + contextClassName + + " concret : " + contextClass, eee); } return context; } - protected static Properties getProperties(String propertiesFilename) throws TopiaException { + protected static Properties getProperties(String propertiesFilename) + throws TopiaException { Properties properties = new Properties(); try { URL propURL = Resource.getURL(propertiesFilename); - Logger.getLogger(TopiaContext.class +".getDefaultProperties").log( - Level.INFO, - "Properties file used for context is: " + propURL); + Logger.getLogger(TopiaContext.class + ".getDefaultProperties").log( + Level.INFO, + "Properties file used for context is: " + propURL); properties.load(propURL.openStream()); } catch (Exception eee) { - throw new TopiaNotFoundException( - "Properties file can't be found: " + propertiesFilename, - eee); + throw new TopiaNotFoundException("Properties file can't be found: " + + propertiesFilename, eee); } return properties; } } // TopiaContextFactory +w \ No newline at end of file Index: topia/src/java/org/codelutin/topia/TopiaEntity.java diff -u topia/src/java/org/codelutin/topia/TopiaEntity.java:1.13 topia/src/java/org/codelutin/topia/TopiaEntity.java:1.14 --- topia/src/java/org/codelutin/topia/TopiaEntity.java:1.13 Thu Jul 15 13:13:12 2004 +++ topia/src/java/org/codelutin/topia/TopiaEntity.java Wed Sep 15 14:36:04 2004 @@ -23,19 +23,20 @@ * * @author Cédric Pineau * Copyright Code Lutin -* @version $Revision: 1.13 $ +* @version $Revision: 1.14 $ * -* Last update : $Date: 2004/07/15 13:13:12 $ -* by : $Author: bpoussin $ +* Last update : $Date: 2004/09/15 14:36:04 $ +* by : $Author: pineau $ */ package org.codelutin.topia; +import java.io.Serializable; import java.util.Date; /** * Top Level common interface to all topia entityes. */ -public interface TopiaEntity extends TopiaElement { // TopiaEntity +public interface TopiaEntity extends TopiaElement, Serializable{ // TopiaEntity public Class getEntityClass(); Index: topia/src/java/org/codelutin/topia/AsynchronousLoader.java diff -u /dev/null topia/src/java/org/codelutin/topia/AsynchronousLoader.java:1.1 --- /dev/null Wed Sep 15 14:36:09 2004 +++ topia/src/java/org/codelutin/topia/AsynchronousLoader.java Wed Sep 15 14:36:04 2004 @@ -0,0 +1,52 @@ +/* *##% + * 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. + *##%*/ + +/* * + * AsynchronousLoader.java + * + * Created: Sep 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/09/15 14:36:04 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia; + +import java.util.Set; + + +/** + * + */ +public interface AsynchronousLoader extends Runnable { + + public abstract void addListener(AsynchronousLoaderListener listener); + + public abstract void removeListener(AsynchronousLoaderListener listener); + + public abstract Set getListeners(); + + public abstract int size(); + + public abstract Object getObjectAt(int index); + +} \ No newline at end of file Index: topia/src/java/org/codelutin/topia/AsynchronousLoaderEvent.java diff -u /dev/null topia/src/java/org/codelutin/topia/AsynchronousLoaderEvent.java:1.1 --- /dev/null Wed Sep 15 14:36:09 2004 +++ topia/src/java/org/codelutin/topia/AsynchronousLoaderEvent.java Wed Sep 15 14:36:04 2004 @@ -0,0 +1,103 @@ +/* *##% + * 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. + *##%*/ + +/* * + * AsynchronousLoaderEvent.java + * + * Created: Sep 1, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/09/15 14:36:04 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia; + +import java.util.Date; + +/** + * + */ +public class AsynchronousLoaderEvent { + + public static int SIZE_IS_AVAILABLE = 0; + + public static int OBJECTS_LOADED = 1; + + protected AsynchronousLoader loader = null; + + protected int type = 0; + + protected int startIndex = 0; + + protected int endIndex = 0; + + protected Date date = null; + + public AsynchronousLoaderEvent(AsynchronousLoader loader, int type) { + this(loader, type, 0, 0); + } + + public AsynchronousLoaderEvent(AsynchronousLoader loader, int type, + int startIndex, int endIndex) { + this.loader = loader; + this.type = type; + this.startIndex = startIndex; + this.endIndex = endIndex; + date = new Date(System.currentTimeMillis()); + } + + /** + * @return Returns the loader. + */ + public AsynchronousLoader getLoader() { + return loader; + } + + /** + * @return Returns the endIndex. + */ + public int getEndIndex() { + return endIndex; + } + + /** + * @return Returns the startIndex. + */ + public int getStartIndex() { + return startIndex; + } + + /** + * @return Returns the type. + */ + public int getType() { + return type; + } + + /** + * Le moment ou l'event a ete créé. + */ + public Date getCreationDate() { + return date; + } + +} \ No newline at end of file Index: topia/src/java/org/codelutin/topia/AsynchronousLoaderListener.java diff -u /dev/null topia/src/java/org/codelutin/topia/AsynchronousLoaderListener.java:1.1 --- /dev/null Wed Sep 15 14:36:09 2004 +++ topia/src/java/org/codelutin/topia/AsynchronousLoaderListener.java Wed Sep 15 14:36:04 2004 @@ -0,0 +1,46 @@ +/* *##% + * 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. + *##%*/ + +/* * + * AsynchronousLoaderListener.java + * + * Created: Aug 31, 2004 + * + * @author Cédric Pineau + * @version $Revision: 1.1 $ + * + * Last update : $Date: 2004/09/15 14:36:04 $ + * by : $Author: pineau $ + */ + +package org.codelutin.topia; + +import java.util.EventListener; + +/** + * + */ +public interface AsynchronousLoaderListener extends EventListener { + + /** + * Appelé lorsque de nouvelles données ont été chargées + */ + public void dataLoaded(AsynchronousLoaderEvent event); + +}