Author: athimel Date: 2012-05-10 11:49:18 +0200 (Thu, 10 May 2012) New Revision: 2470 Url: http://nuiton.org/repositories/revision/topia/2470 Log: A little bit of cleanning in TopiaContextTimpl Added: trunk/topia-persistence/src/site/rst/devel/Topia3Migration.rst Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaTagValues.java trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -111,12 +111,12 @@ Class<E> interfaceService); /** - * Return the service. This service must be valid with public static final + * Return the service. This service must be valid with a public static final * SERVICE_NAME property. * - * @param <E> type of service + * @param <E> type of service that extends {@link TopiaService} * @param interfaceService class of the service - * @return the service + * @return the service instance * @throws TopiaNotFoundException if service can't be retrieved */ <E extends TopiaService> E getService(Class<E> interfaceService) @@ -130,7 +130,7 @@ void createSchema() throws TopiaException; /** - * Permet d'afficher les requetes SQL de creation de base. + * Permet d'afficher les requêtes SQL de création de base. * * @throws TopiaException if any exception */ @@ -334,6 +334,15 @@ void backup(File file, boolean compress) throws TopiaException; /** + * l'inverse de la methode {@link #backup(File,boolean)}. + * + * @param file le fichier ou prendre les informations, il peut-etre + * compressé avec gzip ou non. + * @throws TopiaException if any exception + */ + void restore(File file) throws TopiaException; + + /** * Supprime toutes les tables et autres elements de la database. * * @param dropDatabase si vrai alors supprime aussi la base de données si la @@ -345,25 +354,17 @@ void clear(boolean dropDatabase) throws TopiaException; /** - * l'inverse de la methode {@link #backup(File,boolean)}. + * Closes the context. All the child contexts will be closed in the same + * time. * - * @param file le fichier ou prendre les informations, il peut-etre - * compressé avec gzip ou non. * @throws TopiaException if any exception */ - void restore(File file) throws TopiaException; - - /** - * Ferme le contexte. - * - * @throws TopiaException if any exception - */ void closeContext() throws TopiaException; /** - * Indique si le contexte a ete ferme. + * Indique si le contexte a ete fermé. * - * @return {@code true} si le context est ferme, {@code false} autrement + * @return {@code true} si le context est fermé, {@code false} autrement */ boolean isClosed(); Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -25,13 +25,12 @@ package org.nuiton.topia.framework; +import com.google.common.base.Splitter; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; //import org.hibernate.EntityMode; -//import org.hibernate.FlushMode; //import org.hibernate.ReplicationMode; -//import org.hibernate.cfg.Configuration; //import org.hibernate.event.PostDeleteEventListener; //import org.hibernate.event.PostInsertEventListener; //import org.hibernate.event.PostLoadEventListener; @@ -89,19 +88,19 @@ import static org.nuiton.i18n.I18n._; /** - * Le TopiaContextImpl est le point d'entre pour acceder aux donnees. Il est - * configurer par un fichier de propriete + * Le TopiaContextImpl est le point d'entrée pour accéder aux données. Il est + * configuré par un fichier de propriétés. * <p/> - * List des proprietes disponible <dl> <dt> topia.persistence.properties.file - * <dd> le fichier de propriété a utiliser pour configurer hibernate + * Liste des propriétés disponibles <dl> <dt> topia.persistence.properties.file + * <dd> le fichier de propriétés à utiliser pour configurer hibernate * <p/> - * <dt> topia.persistence.directories <dd> la liste des repertoires contenant - * les mappings hibernates (.hbm.xml) la liste de repertoire est separer par des + * <dt> topia.persistence.directories <dd> la liste des répertoires contenant + * les mappings hibernates (.hbm.xml) les répertoires sont separés par des * virgules ',' * <p/> - * <dt> topia.persistence.classes <dd> la liste des classes que doit géré + * <dt> topia.persistence.classes <dd> la liste des classes que doit gérer * hibernate. On peut tres bien utiliser topia.persistence.directories pour un - * ensemble d'entié du meme repertoire et topia.persistence.classes pour + * ensemble d'entités du même répertoire et topia.persistence.classes pour * d'autres classes </dl> * <p/> * TopiaContextImpl.java @@ -119,22 +118,36 @@ /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(TopiaContextImpl.class); - /** Le pere de ce context, les contexts initaux n'ont pas de context pere */ + /** + * This context's parent. Root contexts does not have a parent context + */ protected TopiaContextImplementor parentContext; - /** L'objet configuration utilisé pour la creation de la factory JPA */ + /** + * The configuration Map used for the JPA EntityManagerFactory creation. + * JPA Configuration is shared with the parent, don't instantiate by default + */ protected Map<String, Object> jpaConfiguration; /** - * la factory permettant de recuperer la session hibernate. Seul les - * TopiaContextImpl initiaux contiennent un entityManagerFactory + * The EntityManagerFactory that allows to get/create an EntityManager. + * Only root contexts contains an EntityManagerFactory, this object will + * be null on child contexts (don't instantiate by default). */ protected EntityManagerFactory entityManagerFactory; - /** La session utilisé par le TopiaContextImpl */ - protected EntityManager hibernate; + /** + * The EntityManager used by this instance. Each TopiaContext instance will + * have its own EntityManager. + * A new EntityManager is created when a new TopiaContext is created + * (#beginTransaction). Inside a given TopiaContext, the EntityManager will + * be replaced only if the transaction is rollbacked (#rollbackTransaction) + */ + protected EntityManager entityManager; - /** Indique si le contexte a ete ferme */ + /** + * Holds if the context is closed or not. + */ protected boolean closed; /** @@ -152,10 +165,16 @@ */ protected boolean useFlushMode = true; - /** Propriete de configuration */ + /** + * Contains this context's configuration. Config is shared with the parent, + * don't instantiate by default. + */ protected Properties config; - /** cache des DAO deja chargé pour ce context */ + /** + * Cache containing this context's already loaded DAOs. The cache is + * specific to this instance, and will not be shared with the child contexts + */ protected Map<Class<? extends TopiaEntity>, TopiaDAO<? extends TopiaEntity>> daoCache = new HashMap<Class<? extends TopiaEntity>, @@ -163,28 +182,41 @@ /** * Set of child context created with {@link #beginTransaction()}. We are - * listener on these context. A WeakHashMap is used to remove old context - * automically when it's not used anymore. The {@link #finalize} method will - * be executed when Garbage collector is called when reference is removed. - * The set is synchronized in case of using multi-threading. + * listener on these contexts. A WeakHashMap is used to remove old context + * automatically when it's not used anymore. The {@link #finalize} method + * will be executed when Garbage Collector is called when reference is + * removed. The set is synchronized in case of multi-threading usage. * * @see Collections#synchronizedSet(Set) * @see Collections#newSetFromMap(Map) */ - protected final Set<TopiaContextImplementor> childContext = + protected final Set<TopiaContextImplementor> childContexts = Collections.synchronizedSet( Collections.newSetFromMap( new WeakHashMap<TopiaContextImplementor, Boolean>())); - /** key: service name; value: service instance */ + /** + * Map containing the services + * <dl> + * <dt>key</dt> <dd>service name</dd> + * <dt>value</dt> <dd>service instance</dd> + * </dl> + * This map is shared with the parent context, don't instantiate by default. + */ protected Map<String, TopiaService> services; + /** + * In charge of the event management + */ protected TopiaFiresSupport firesSupport = new TopiaFiresSupport(); - /** Liste des classes perssitance */ - protected Set<Class<?>> persistenceClasses = new LinkedHashSet<Class<?>>(); + /** + * Retains the list of the managed entities. The list is shared with the + * parent context, don't instantiate by default. + */ + protected Set<Class<?>> persistenceClasses; - /** Default constructor, useful for tests. */ + /** Default constructor, To be used for tests only. */ protected TopiaContextImpl() { } @@ -200,17 +232,17 @@ this.config = config; services = loadServices(config); preInitServices(services); -// getHibernateConfiguration(); // force mapping loading + getJPAConfiguration(); // Force configuration loading postInitServices(services); } + /* -------------------- SERVICES MANAGMENT -------------------------------*/ + protected String getProperExceptionMessage(Throwable eee) { return eee.getClass().getSimpleName() + " : " + eee.getMessage(); } - /* -------------------- SERVICES MANAGMENT -------------------------------*/ - protected Map<String, TopiaService> loadServices(Properties config) { Map<String, TopiaService> result = new HashMap<String, TopiaService>(); // recherche des services present dans la config @@ -305,14 +337,6 @@ return result; } - /** - * Take one service, this service must be valid service interface with - * public static final SERVICE_NAME declaration. - * - * @param <E> type of the service that extends {@link TopiaService} - * @throws TopiaNotFoundException if an error appears or service not found. - * @see #getServiceName(Class) - */ @Override public <E extends TopiaService> E getService(Class<E> interfaceService) throws TopiaNotFoundException { @@ -366,26 +390,26 @@ } @Override - public Set<TopiaContextImplementor> getChildContext() { + public Set<TopiaContextImplementor> getChildContexts() { // fdesbois-20100421 : Ano #546 - // Copy the childContext into a new set + // Copy the childContexts into a new set Set<TopiaContextImplementor> values; // Synchronize copy to be thread-safe during iteration - synchronized (childContext) { - values = new HashSet<TopiaContextImplementor>(childContext); + synchronized (childContexts) { + values = new HashSet<TopiaContextImplementor>(childContexts); } return values; } protected void addChildContext(TopiaContextImplementor child) { - childContext.add(child); + childContexts.add(child); } @Override public void removeChildContext(TopiaContextImplementor child) { // Remove child only if this context is not already closed. if (!closed) { - childContext.remove(child); + childContexts.remove(child); } } @@ -474,11 +498,11 @@ @Override public EntityManager getEntityManager() throws TopiaException { - if (hibernate == null) { + if (entityManager == null) { throw new TopiaException( _("topia.persistence.error.no.hibernate.session")); } - return hibernate; + return entityManager; } @Override @@ -488,7 +512,8 @@ entityManagerFactory = getParentContext().getEntityManagerFactory(); } else { Map params = getJPAConfiguration(); - entityManagerFactory = Persistence.createEntityManagerFactory("topia", params); + entityManagerFactory = Persistence.createEntityManagerFactory( + TopiaPersistenceProvider.TOPIA_PERSISTENCE_UNIT_NAME, params); } } return entityManagerFactory; @@ -499,54 +524,62 @@ if (getParentContext() != null) { jpaConfiguration = getParentContext().getJPAConfiguration(); } else { + jpaConfiguration = new HashMap<String, Object>(); + persistenceClasses = new LinkedHashSet<Class<?>>(); - // Ajout des classes persistantes + // Load service provided persistent classes for (TopiaService service : getServices().values()) { Class<?>[] classes = service.getPersistenceClasses(); - // Certains services n'ont pas de classe persistantes + // Some services don't have persistent classes if (classes != null) { - // sletellier 20110411 : http://www.nuiton.org/issues/show/1454 - this.persistenceClasses.addAll(Arrays.asList(classes)); + persistenceClasses.addAll(Arrays.asList(classes)); } } String listPersistenceClasses = getConfig().getProperty( TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, ""); - String[] classes = listPersistenceClasses.split(","); - for (String classname : classes) { - classname = classname.trim(); - if (StringUtils.isNotEmpty(classname)) { + Iterable<String> classes = Splitter.on(",") + .trimResults() + .omitEmptyStrings() + .split(listPersistenceClasses); + + for (String className : classes) { + className = className.trim(); + + if (StringUtils.isNotEmpty(className)) { if (log.isDebugEnabled()) { - log.debug("Load persistent class : " + classname); + log.debug("Load persistent class : " + className); } // XXX echatellier 20111007 ce cqui est dommage ici, c'est // la definition de cette classe ne sert a rien (apart security) // car pour hibernate hibernateConfiguration.addClass(persistanceClass) // il ne se sert pas de la classe en fait et fait seulement - // un classname.replace( '.', '/' ) + ".hbm.xml"; + // un className.replace( '.', '/' ) + ".hbm.xml"; // pour obtenir le mapping et la reinstancier ensuite Class<?> clazz; try { - clazz = Class.forName(classname); + clazz = Class.forName(className); } catch (ClassNotFoundException eee) { - if (log.isDebugEnabled()) { - log.debug("Class " + classname + " not found"); + String message = String.format( + "Persistent class %s not found", + className); + if (log.isWarnEnabled()) { + log.warn(message); } - throw new TopiaNotFoundException( - _("topia.persistence.error.class.not.found", - classname)); + throw new TopiaNotFoundException(message, eee); } - this.persistenceClasses.add(clazz); + persistenceClasses.add(clazz); } } + jpaConfiguration.put("topia.entities", persistenceClasses); // TODO AThimel 10/05/2012 Push topia.entities to constants - jpaConfiguration.put("topia.entities", this.persistenceClasses); + // FIXME AThimel 10/05/2012 Don't push all the configuration, maybe only a part of it ? for (Map.Entry<Object, Object> entry : getConfig().entrySet()) { Object key = entry.getKey(); if (key instanceof String) { @@ -809,12 +842,12 @@ TopiaContextImpl result = new TopiaContextImpl(this); EntityManagerFactory factory = getEntityManagerFactory(); - result.hibernate = factory.createEntityManager(); // TODO AThimel 07/05/2012 Maybe provide a Map ? cf Configuration + result.entityManager = factory.createEntityManager(); // TODO AThimel 07/05/2012 Maybe provide a Map ? cf Configuration // new TopiaInterceptor(result)); // on ne synchronise jamais les données avec la base tant que // l'utilisateur n'a pas fait de commit du context - result.hibernate.setFlushMode(FlushModeType.COMMIT); // TODO AThimel 07/05/2012 Was MANUAL + result.entityManager.setFlushMode(FlushModeType.COMMIT); // TODO AThimel 07/05/2012 Was MANUAL // tchemit 2010-12-06 propagates the value of the flag result.useFlushMode = useFlushMode; @@ -826,16 +859,16 @@ // fermé ce qui pose des problemes de lock sur les tables. try { // result.hibernate.beginTransaction(); - result.hibernate.getTransaction().begin(); + result.entityManager.getTransaction().begin(); } catch (Exception eee) { // on a pas pu ouvrir la transaction, on faut donc tout fermer // et declancher une exception try { - result.hibernate.close(); + result.entityManager.close(); } catch (PersistenceException e1) { if (log.isErrorEnabled()) { - log.error("Could not close hibernate session", e1); + log.error("Could not close entityManager session", e1); } } @@ -867,8 +900,8 @@ // // TODO-fdesbois-20100507 : need to be removed for 2.5 version // dao.commitTransaction(); // } - EntityTransaction tx = hibernate.getTransaction(); - hibernate.flush(); + EntityTransaction tx = entityManager.getTransaction(); + entityManager.flush(); tx.commit(); getFiresSupport().fireOnPostCommit(this); @@ -878,7 +911,7 @@ } // hibernate.beginTransaction(); - hibernate.getTransaction().begin(); + entityManager.getTransaction().begin(); // it's seem necessary to change session after commit // NON, NON, NON, il ne faut surtout pas le faire, ca pose plein de @@ -904,17 +937,17 @@ // // TODO-fdesbois-20100507 : need to be removed for 2.5 version // dao.rollbackTransaction(); // } - EntityTransaction tx = hibernate.getTransaction(); - hibernate.clear(); + EntityTransaction tx = entityManager.getTransaction(); + entityManager.clear(); tx.rollback(); - hibernate.close(); + entityManager.close(); // it's very important to change the session after rollback // otherwize there are many error during next Entity's modification - hibernate = getEntityManagerFactory().createEntityManager(); // TODO AThimel 07/05/2012 Maybe provide a Map ? cf Configuration - hibernate.setFlushMode(FlushModeType.COMMIT); // TODO AThimel 07/05/2012 Was MANUAL + entityManager = getEntityManagerFactory().createEntityManager(); // TODO AThimel 07/05/2012 Maybe provide a Map ? cf Configuration + entityManager.setFlushMode(FlushModeType.COMMIT); // TODO AThimel 07/05/2012 Was MANUAL // hibernate.beginTransaction(); - hibernate.getTransaction().begin(); + entityManager.getTransaction().begin(); getFiresSupport().fireOnPostRollback(this); TopiaContextImplementor parent = getParentContext(); @@ -934,14 +967,14 @@ // Throw exception if context is already closed checkClosed(_("topia.persistence.error.context.already.closed")); - // FD-20100421 : Ano #546 : no need to copy childContext, the + // FD-20100421 : Ano #546 : no need to copy childContexts, the // {@link #getChildContext()} provides a thread-safe copy to iterate // on it. -// TopiaContextImplementor[] children = childContext.toArray( -// new TopiaContextImplementor[childContext.size()]); +// TopiaContextImplementor[] children = childContexts.toArray( +// new TopiaContextImplementor[childContexts.size()]); // Remove all children context - for (TopiaContextImplementor child : getChildContext()) { + for (TopiaContextImplementor child : getChildContexts()) { // Avoid to have exception from checkClosed method on child if (!child.isClosed()) { child.closeContext(); @@ -952,7 +985,7 @@ // on est pas le root context if (!equals(getRootContext())) { closed = true; - hibernate.close(); + entityManager.close(); getParentContext().removeChildContext(this); } else { if (entityManagerFactory != null) { @@ -1416,6 +1449,9 @@ @Override public Set<Class<?>> getPersistenceClasses() { + if (getParentContext() != null) { + return getParentContext().getPersistenceClasses(); + } return persistenceClasses; } @@ -1639,5 +1675,6 @@ // } // } // } + } //TopiaContextImpl Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImplementor.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -25,7 +25,6 @@ package org.nuiton.topia.framework; -//import org.hibernate.cfg.Configuration; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaNotFoundException; @@ -34,7 +33,6 @@ import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; -import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; @@ -54,13 +52,14 @@ /** * Retrieve a thread-safe copy of children context set. * - * @return Returns the childContext. + * @return Returns the childContexts. */ - Set<TopiaContextImplementor> getChildContext(); + Set<TopiaContextImplementor> getChildContexts(); - /** @return Returns the parentContext. */ + /** @return Returns the parentContext. May be null if the context is root */ TopiaContextImplementor getParentContext(); + /** @return Returns the rootContext (the only one without parent). */ TopiaContextImplementor getRootContext(); /** @return Returns the config. */ Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -570,11 +570,11 @@ TopiaContextImplementor parent, EntityManager hibernate) { TopiaContextImplementor result = null; - // FD-20100421 : Ano #546 : no need to copy childContext, the + // FD-20100421 : Ano #546 : no need to copy childContexts, the // {@link #getChildContext()} provides a thread-safe copy to iterate // on it. // Set<TopiaContextImplementor> contextChilds = new HashSet<TopiaContextImplementor>(parent.getChildContext()); - for (TopiaContextImplementor context : parent.getChildContext()) { + for (TopiaContextImplementor context : parent.getChildContexts()) { // by sletellier 24/09/09 : Fix concurent acces error // ArrayList<TopiaContextImplementor> children = new ArrayList(parent.getChildContext()); Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaPersistenceProvider.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -20,13 +20,15 @@ */ public abstract class TopiaPersistenceProvider implements PersistenceProvider { + public static final String TOPIA_PERSISTENCE_UNIT_NAME = "topia"; + public abstract EntityManagerFactory configureSpecific(String emName, Map<String, Object> map, Set<Class<?>> entities); @Override public EntityManagerFactory createEntityManagerFactory(String emName, Map map) { EntityManagerFactory result = null; - if ("topia".equals(emName)) { + if (TOPIA_PERSISTENCE_UNIT_NAME.equals(emName)) { // Use PersistenceProvider of the underlying JPA library Map<String, Object> properties = (Map<String, Object>)map; @@ -36,7 +38,7 @@ throw new TopiaRuntimeException("topia.entities list must be provided"); } - result = configureSpecific(emName, properties, entityClasses); + result = configureSpecific(TOPIA_PERSISTENCE_UNIT_NAME, properties, entityClasses); } return result; } Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaTagValues.java =================================================================== --- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaTagValues.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaTagValues.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -313,7 +313,7 @@ * @since 2.5 */ @TagValueDefinition(target = {ObjectModelAttribute.class}, - documentation = "Sets the hibernate type of an attribute (Hibernate mapping)") + documentation = "Sets the entityManager type of an attribute (Hibernate mapping)") String TAG_TYPE = "type"; /** Modified: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties =================================================================== --- trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties 2012-05-10 09:49:18 UTC (rev 2470) @@ -1,4 +1,3 @@ -topia.persistence.error.class.not.found=Persistence class %1$s not found topia.persistence.error.context.already.closed=Context was alredy closed topia.persistence.error.context.is.closed=Context is closed, no operation is possible. topia.persistence.error.create.schema=Schema could not be created for following reason \: %1$s Modified: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties =================================================================== --- trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties 2012-05-10 09:49:18 UTC (rev 2470) @@ -1,5 +1,4 @@ -topia.persistence.error.class.not.found=No ha sido encontrada la clase persistente %1$s -topia.persistence.error.context.already.closed=El contexto ya ha sido cerrado +topia.persistence.error.context.already.closed=El contexto ya ha sido cerrado topia.persistence.error.context.is.closed=Este contexto ya ha sido cerrado, no se puede comenzar una transacción topia.persistence.error.create.schema=No se puede crear el esquema debido a la razón siguiente \: %2$s topia.persistence.error.empty.doc=Documento vacío Modified: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties =================================================================== --- trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties 2012-05-10 09:49:18 UTC (rev 2470) @@ -1,4 +1,3 @@ -topia.persistence.error.class.not.found=La classe persistante %1$s n'a pas été trouvée topia.persistence.error.context.already.closed=Ce contexte a deja ete ferme topia.persistence.error.context.is.closed=Ce contexte a ete ferme, impossible de commencer une transaction topia.persistence.error.create.schema=Le schéma n'a pas pu être crée pour la raison suivante \: %2$s Added: trunk/topia-persistence/src/site/rst/devel/Topia3Migration.rst =================================================================== --- trunk/topia-persistence/src/site/rst/devel/Topia3Migration.rst (rev 0) +++ trunk/topia-persistence/src/site/rst/devel/Topia3Migration.rst 2012-05-10 09:49:18 UTC (rev 2470) @@ -0,0 +1,11 @@ +List of notable changes +======================= + +TopiaContextImplementor +----------------------- + +#getHibernate() is renamed to #getEntityManager() +#getHibernateFactory() is renamed to #getEntityManagerFactory() +#getHibernateConfiguration() is renamed to #getJPAConfiguration() + +#getChildContext() is renamed to #getChildContexts() Modified: trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java =================================================================== --- trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java 2012-05-10 08:18:19 UTC (rev 2469) +++ trunk/topia-persistence-tck/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java 2012-05-10 09:49:18 UTC (rev 2470) @@ -224,22 +224,22 @@ TopiaContextImpl test2 = new TopiaContextImpl(properties); TopiaContextImpl child2 = new TopiaContextImpl(); test2.addChildContext(child2); - Assert.assertEquals(1, test2.childContext.size()); + Assert.assertEquals(1, test2.childContexts.size()); if (log.isInfoEnabled()) { log.info("test 3 : removeChildContext"); } TopiaContextImpl test3 = new TopiaContextImpl(properties); TopiaContextImpl child3 = new TopiaContextImpl(test3); - test3.childContext.add(child3); + test3.childContexts.add(child3); test3.removeChildContext(child3); - Assert.assertEquals(0, test3.childContext.size()); + Assert.assertEquals(0, test3.childContexts.size()); // No remove if context is closed - test3.childContext.add(child3); + test3.childContexts.add(child3); test3.closed = true; test3.removeChildContext(child3); - Assert.assertEquals(1, test3.childContext.size()); + Assert.assertEquals(1, test3.childContexts.size()); if (log.isInfoEnabled()) { log.info("test 4 : getRootContext");