Index: topia2/src/java/org/codelutin/topia/TopiaContext.java diff -u topia2/src/java/org/codelutin/topia/TopiaContext.java:1.24 topia2/src/java/org/codelutin/topia/TopiaContext.java:1.25 --- topia2/src/java/org/codelutin/topia/TopiaContext.java:1.24 Mon Jan 15 13:38:51 2007 +++ topia2/src/java/org/codelutin/topia/TopiaContext.java Mon Apr 2 10:49:52 2007 @@ -23,9 +23,9 @@ * Created: 3 janv. 2006 21:18:34 * * @author poussin - * @version $Revision: 1.24 $ + * @version $Revision: 1.25 $ * - * Last update: $Date: 2007/01/15 13:38:51 $ + * Last update: $Date: 2007/04/02 10:49:52 $ * by : $Author: bpoussin $ */ @@ -41,6 +41,7 @@ import org.codelutin.topia.event.TopiaEntityVetoable; import org.codelutin.topia.event.TopiaTransactionListener; import org.codelutin.topia.event.TopiaTransactionVetoable; +import org.codelutin.topia.framework.TopiaService; import org.codelutin.topia.persistence.TopiaEntity; /** @@ -69,6 +70,23 @@ public void removePropertyChangeListener(PropertyChangeListener listener); /** + * Return true if specific service is available + * @param + * @param interfaceService + * @return + */ + public boolean serviceEnabled(Class interfaceService); + + /** + * Return the service + * @param + * @param interfaceService + * @return + * @throws TopiaNotFoundException if service is can't be retrieved + */ + public E getService(Class interfaceService) throws TopiaNotFoundException; + + /** * Permet de créer le schema de la base de données * @throws TopiaException */ Index: topia2/src/java/org/codelutin/topia/TopiaContextFactory.java diff -u topia2/src/java/org/codelutin/topia/TopiaContextFactory.java:1.2 topia2/src/java/org/codelutin/topia/TopiaContextFactory.java:1.3 --- topia2/src/java/org/codelutin/topia/TopiaContextFactory.java:1.2 Tue Oct 17 13:02:52 2006 +++ topia2/src/java/org/codelutin/topia/TopiaContextFactory.java Mon Apr 2 10:49:52 2007 @@ -23,9 +23,9 @@ * Created: 3 janv. 2006 21:19:37 * * @author poussin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Last update: $Date: 2006/10/17 13:02:52 $ + * Last update: $Date: 2007/04/02 10:49:52 $ * by : $Author: bpoussin $ */ @@ -72,14 +72,16 @@ /** * Methode static permettant de recuperer un context. Si on donne plusieurs * fois le meme objet config, on obtient la meme instance de TopiaContextImpl. + * Si le context qui devrait etre retourné est ferme, alors un nouveau est + * creer et retourné * * @param config - * @return + * @return Un TopiaContext ouvert * @throws TopiaNotFoundException */ static public TopiaContext getContext(Properties config) throws TopiaNotFoundException { TopiaContextImpl result = contextCache.get(config); - if (result == null) { + if (result == null || result.isClosed()) { result = new TopiaContextImpl(config); contextCache.put((Properties) config.clone(), result); }