Index: topia/src/java/org/codelutin/topia/ContextHelper.java diff -u topia/src/java/org/codelutin/topia/ContextHelper.java:1.1 topia/src/java/org/codelutin/topia/ContextHelper.java:1.2 --- topia/src/java/org/codelutin/topia/ContextHelper.java:1.1 Thu Jul 15 13:19:30 2004 +++ topia/src/java/org/codelutin/topia/ContextHelper.java Fri Aug 6 17:48:52 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/07/15 13:19:30 $ + * Mise a jour: $Date: 2004/08/06 17:48:52 $ * par : $Author: bpoussin $ */ @@ -135,7 +135,7 @@ * Retourne la classe qui implante réellement l'interface passé en paremètre */ public Class getImplementationClass(Class interfacez) throws TopiaNotFoundException { - String clazz = properties.getProperty(Const.MAPPING_IMPLEMENTATION + "." + interfacez.getName()); + String clazz = properties.getProperty(TopiaConst.MAPPING_IMPLEMENTATION + "." + interfacez.getName()); return Util.getClazz(clazz); } @@ -144,7 +144,7 @@ * l'interface passé en paremètre */ public Class getDistributionClass(Class interfacez) throws TopiaNotFoundException { - String clazz = properties.getProperty(Const.MAPPING_DISTRIBUTION + "." + interfacez.getName()); + String clazz = properties.getProperty(TopiaConst.MAPPING_DISTRIBUTION + "." + interfacez.getName()); return Util.getClazz(clazz); } Index: topia/src/java/org/codelutin/topia/TopiaContext.java diff -u topia/src/java/org/codelutin/topia/TopiaContext.java:1.30 topia/src/java/org/codelutin/topia/TopiaContext.java:1.31 --- topia/src/java/org/codelutin/topia/TopiaContext.java:1.30 Sun Aug 1 14:52:32 2004 +++ topia/src/java/org/codelutin/topia/TopiaContext.java Fri Aug 6 17:48:52 2004 @@ -23,10 +23,10 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.30 $ + * @version $Revision: 1.31 $ * - * Mise a jour: $Date: 2004/08/01 14:52:32 $ - * par : $Author: pineau $ + * Mise a jour: $Date: 2004/08/06 17:48:52 $ + * par : $Author: bpoussin $ */ package org.codelutin.topia; @@ -172,7 +172,7 @@ public PersistenceHelper getPersistenceHelper() throws TopiaNotFoundException { if(persistenceHelper == null){ persistenceHelper = (PersistenceHelper) - contextHelper.getHelper(Const.HELPER_PERSISTENCE); + contextHelper.getHelper(TopiaConst.HELPER_PERSISTENCE); } return persistenceHelper; } @@ -183,7 +183,7 @@ public AbstractDistributionHelper getDistributionHelper() throws TopiaNotFoundException { if(distributionHelper == null){ distributionHelper = (AbstractDistributionHelper) - contextHelper.getHelper(Const.HELPER_DISTRIBUTION); + contextHelper.getHelper(TopiaConst.HELPER_DISTRIBUTION); } return distributionHelper; @@ -195,7 +195,7 @@ public HookHelper getHookHelper() throws TopiaNotFoundException { if(hookHelper == null){ hookHelper = (HookHelper) - contextHelper.getHelper(Const.HELPER_HOOK); + contextHelper.getHelper(TopiaConst.HELPER_HOOK); } return hookHelper; Index: topia/src/java/org/codelutin/topia/TopiaContextFactory.java diff -u topia/src/java/org/codelutin/topia/TopiaContextFactory.java:1.1 topia/src/java/org/codelutin/topia/TopiaContextFactory.java:1.2 --- topia/src/java/org/codelutin/topia/TopiaContextFactory.java:1.1 Thu Jul 15 13:19:30 2004 +++ topia/src/java/org/codelutin/topia/TopiaContextFactory.java Fri Aug 6 17:48:52 2004 @@ -23,9 +23,9 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * - * Mise a jour: $Date: 2004/07/15 13:19:30 $ + * Mise a jour: $Date: 2004/08/06 17:48:52 $ * par : $Author: bpoussin $ */ @@ -76,7 +76,7 @@ TopiaContext context = (TopiaContext) contexts.get(properties); if (context == null) { if (properties == null) { - context = createContext(getProperties(Const.DEFAULT_CONTEXT_PROPERTIES_FILENAME)); + context = createContext(getProperties(TopiaConst.DEFAULT_CONTEXT_PROPERTIES_FILENAME)); } else { context = createContext(properties); } @@ -95,7 +95,7 @@ Class contextClass = null; String contextClassName = properties.getProperty( - Const.CONTEXT_CLASS, + TopiaConst.CONTEXT_CLASS, "org.codelutin.topia.TopiaContext"); Logger.getLogger(TopiaContextFactory.class + ".createContext").log(Level.INFO, "Class used for context is " + contextClassName); try { Index: topia/src/java/org/codelutin/topia/TopiaId.java diff -u topia/src/java/org/codelutin/topia/TopiaId.java:1.2 topia/src/java/org/codelutin/topia/TopiaId.java:1.3 --- topia/src/java/org/codelutin/topia/TopiaId.java:1.2 Mon Aug 2 17:57:19 2004 +++ topia/src/java/org/codelutin/topia/TopiaId.java Fri Aug 6 17:48:52 2004 @@ -23,15 +23,17 @@ * * @author Benjamin Poussin * Copyright Code Lutin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Mise a jour: $Date: 2004/08/02 17:57:19 $ + * Mise a jour: $Date: 2004/08/06 17:48:52 $ * par : $Author: bpoussin $ */ package org.codelutin.topia; import java.io.Serializable; +import java.util.logging.Logger; +import java.util.logging.Level; /** * Classe representant un Id, utilisable par JDO. Cette classe contient aussi un @@ -47,6 +49,10 @@ } public int hashCode (){ + if(_topiaId_ == null){ + Logger.getLogger(getClass().getName() + ".hashCode").log(Level.WARNING, "Use null topiaId", new Throwable()); + return 0; + } return _topiaId_.hashCode(); } @@ -71,6 +77,24 @@ public static Class getClassName(String topiaId) throws TopiaNotFoundException { String classname = topiaId.substring(0, topiaId.indexOf("#")); return Util.getClazz(classname); + } + + /** + * Verifie si l'id passé en paramètre est bien un Id topia, c-a-d si la + * forme est bien classname#timemillis#random et si le classname est + * celui d'une classe valide, c-a-d que le systeme arrive a trouver + */ + public static boolean isValidId(String topiaId){ + try{ + if(topiaId.matches(".*?#[0-9]+#[0-9.]+")){ + getClassName(topiaId); + return true; + } + return false; + }catch(Exception eee){ + Logger.getLogger(getClass().getName() + ".isValidId").log(Level.WARNING, "Error during verfication of topiaId", eee); + return false; + } } } // TopiaId