Index: topia2/src/java/org/codelutin/topia/TopiaContextFactory.java diff -u topia2/src/java/org/codelutin/topia/TopiaContextFactory.java:1.3 topia2/src/java/org/codelutin/topia/TopiaContextFactory.java:1.4 --- topia2/src/java/org/codelutin/topia/TopiaContextFactory.java:1.3 Mon Apr 2 10:49:52 2007 +++ topia2/src/java/org/codelutin/topia/TopiaContextFactory.java Wed Nov 7 19:59:31 2007 @@ -23,16 +23,19 @@ * Created: 3 janv. 2006 21:19:37 * * @author poussin - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * - * Last update: $Date: 2007-04-02 10:49:52 $ + * Last update: $Date: 2007-11-07 19:59:31 $ * by : $Author: bpoussin $ */ package org.codelutin.topia; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Map.Entry; import org.apache.commons.collections.map.AbstractReferenceMap; import org.apache.commons.collections.map.ReferenceMap; @@ -57,6 +60,38 @@ AbstractReferenceMap.HARD, AbstractReferenceMap.SOFT); /** + * Permet de connaitre la liste des contexts encore en memoire, utile + * pour du debuggage + * @return la liste des urls de connexion + */ + static public List getContextOpened() { + List result = new ArrayList(); + for (Entry e : contextCache.entrySet()) { + if (e.getValue() != null) { + result.add(e.getKey().getProperty("hibernate.connection.url")); + } + } + return result; + } + + /** + * Used when TopiaContext root is closed + * @param context closed + */ + static public void removeContext(TopiaContext context) { + Properties key = null; + for (Entry e : contextCache.entrySet()) { + if (e.getValue() == context) { + key = e.getKey(); + break; + } + } + if (key != null) { + contextCache.remove(key); + } + } + + /** * Utilise par defaut le fichier de propriete TopiaContextImpl.properties * * @return