Topia-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 4806 discussions
r2837 - in trunk/topia-persistence/src/main/java/org/nuiton/topia: . framework generator
by bleny@users.nuiton.org 11 Oct '13
by bleny@users.nuiton.org 11 Oct '13
11 Oct '13
Author: bleny
Date: 2013-10-11 16:40:39 +0200 (Fri, 11 Oct 2013)
New Revision: 2837
Url: http://nuiton.org/projects/topia/repository/revisions/2837
Log:
move some methods around ApplicationContext and PersistenceContext recode instanciation of business PersistenceContext
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/AbstractTopiaContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -28,14 +28,22 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.hibernate.tool.hbm2ddl.SchemaUpdate;
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.event.TopiaSchemaListener;
import org.nuiton.topia.event.TopiaTransactionListener;
import org.nuiton.topia.event.TopiaTransactionVetoable;
+import org.nuiton.topia.framework.TopiaFiresSupport;
import org.nuiton.topia.framework.TopiaService;
+import org.nuiton.topia.framework.TopiaUtil;
import org.nuiton.topia.persistence.DefaultTopiaIdFactory;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaIdFactory;
@@ -55,13 +63,15 @@
*/
public abstract class AbstractTopiaApplicationContext<K extends TopiaPersistenceContext> implements TopiaReplicationSupport, TopiaListenableSupport, TopiaServiceSupport {
+ private static final Log log = LogFactory.getLog(AbstractTopiaApplicationContext.class);
+
protected TopiaIdFactory topiaIdFactory;
protected ImmutableMap<String, String> configuration;
protected TopiaReplicationSupport topiaReplicationSupport;
- protected TopiaListenableSupport topiaListenableSupport;
+ protected TopiaFiresSupport topiaFiresSupport = new TopiaFiresSupport();
protected TopiaServiceSupport topiaServiceSupport;
@@ -105,8 +115,7 @@
}
protected TopiaListenableSupport getTopiaListenableSupport() {
- // TODO brendan 11/10/13 instancier
- return topiaListenableSupport;
+ return topiaFiresSupport;
}
protected ImmutableMap<String, String> getConfiguration() {
@@ -157,92 +166,92 @@
@Override
public void addTopiaEntityListener(TopiaEntityListener listener) {
- topiaListenableSupport.addTopiaEntityListener(listener);
+ topiaFiresSupport.addTopiaEntityListener(listener);
}
@Override
public void addTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) {
- topiaListenableSupport.addTopiaEntityListener(entityClass, listener);
+ topiaFiresSupport.addTopiaEntityListener(entityClass, listener);
}
@Override
public void removeTopiaEntityListener(TopiaEntityListener listener) {
- topiaListenableSupport.removeTopiaEntityListener(listener);
+ topiaFiresSupport.removeTopiaEntityListener(listener);
}
@Override
public void removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) {
- topiaListenableSupport.removeTopiaEntityListener(entityClass, listener);
+ topiaFiresSupport.removeTopiaEntityListener(entityClass, listener);
}
@Override
public void addTopiaEntityVetoable(TopiaEntityVetoable vetoable) {
- topiaListenableSupport.addTopiaEntityVetoable(vetoable);
+ topiaFiresSupport.addTopiaEntityVetoable(vetoable);
}
@Override
public void addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) {
- topiaListenableSupport.addTopiaEntityVetoable(entityClass, vetoable);
+ topiaFiresSupport.addTopiaEntityVetoable(entityClass, vetoable);
}
@Override
public void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable) {
- topiaListenableSupport.removeTopiaEntityVetoable(vetoable);
+ topiaFiresSupport.removeTopiaEntityVetoable(vetoable);
}
@Override
public void removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) {
- topiaListenableSupport.removeTopiaEntityVetoable(entityClass, vetoable);
+ topiaFiresSupport.removeTopiaEntityVetoable(entityClass, vetoable);
}
@Override
public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
- topiaListenableSupport.addTopiaEntitiesVetoable(vetoable);
+ topiaFiresSupport.addTopiaEntitiesVetoable(vetoable);
}
@Override
public void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
- topiaListenableSupport.removeTopiaEntitiesVetoable(vetoable);
+ topiaFiresSupport.removeTopiaEntitiesVetoable(vetoable);
}
@Override
public void addTopiaTransactionListener(TopiaTransactionListener listener) {
- topiaListenableSupport.addTopiaTransactionListener(listener);
+ topiaFiresSupport.addTopiaTransactionListener(listener);
}
@Override
public void removeTopiaTransactionListener(TopiaTransactionListener listener) {
- topiaListenableSupport.removeTopiaTransactionListener(listener);
+ topiaFiresSupport.removeTopiaTransactionListener(listener);
}
@Override
public void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) {
- topiaListenableSupport.addTopiaTransactionVetoable(vetoable);
+ topiaFiresSupport.addTopiaTransactionVetoable(vetoable);
}
@Override
public void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) {
- topiaListenableSupport.removeTopiaTransactionVetoable(vetoable);
+ topiaFiresSupport.removeTopiaTransactionVetoable(vetoable);
}
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
- topiaListenableSupport.addPropertyChangeListener(listener);
+ topiaFiresSupport.addPropertyChangeListener(listener);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
- topiaListenableSupport.removePropertyChangeListener(listener);
+ topiaFiresSupport.removePropertyChangeListener(listener);
}
@Override
public void addTopiaSchemaListener(TopiaSchemaListener listener) {
- topiaListenableSupport.addTopiaSchemaListener(listener);
+ topiaFiresSupport.addTopiaSchemaListener(listener);
}
@Override
public void removeTopiaSchemaListener(TopiaSchemaListener listener) {
- topiaListenableSupport.removeTopiaSchemaListener(listener);
+ topiaFiresSupport.removeTopiaSchemaListener(listener);
}
@Override
@@ -259,4 +268,93 @@
public Map<String, TopiaService> getServices() {
return topiaServiceSupport.getServices();
}
+
+ public List<Class<?>> getPersistenceClasses() {
+ return null; // TODO AThimel 27/09/13 May be moved to TopiaHibernateSupport ?
+ }
+
+ public boolean isSchemaEmpty() {
+ Configuration configuration = getHibernateProvider().getHibernateConfiguration();
+ boolean result = TopiaUtil.isSchemaEmpty(configuration);
+ return result;
+ }
+
+ public boolean isTableExists(Class<?> clazz) {
+ Configuration configuration = getHibernateProvider().getHibernateConfiguration();
+ boolean result = TopiaUtil.isSchemaExist(configuration, clazz.getName());
+ return result;
+ }
+
+ public String getSchemaName() {
+ // TODO AThimel 02/08/13 I absolutely don't know if it works
+ return getConfiguration().get(TopiaContextFactory.CONFIG_DEFAULT_SCHEMA);
+ }
+
+ public void createSchema() {
+ try {
+ boolean showSchema = false;
+ if (log.isDebugEnabled()) {
+ showSchema = true;
+ }
+ // TODO brendan 11/10/13 reable event
+ // topiaFiresSupport.firePreCreateSchema(this);
+ new SchemaExport(getHibernateProvider().getHibernateConfiguration()).execute(showSchema, true, false, true);
+ // TODO brendan 11/10/13 reable event
+ // topiaFiresSupport.firePostCreateSchema(this);
+ } catch (HibernateException eee) {
+ throw new TopiaException(
+ String.format("Could not create schema for reason: %s",
+ eee.getMessage()), eee);
+ }
+ }
+
+ public void showCreateSchema() {
+ try {
+ new SchemaExport(getHibernateProvider().getHibernateConfiguration()).
+ execute(true, false, false, true);
+ } catch (HibernateException eee) {
+ throw new TopiaException(
+ String.format("Could not show create schema for reason: %s",
+ eee.getMessage()), eee);
+ }
+
+ }
+
+ public void updateSchema() {
+ try {
+ boolean showSchema = false;
+ if (log.isDebugEnabled()) {
+ showSchema = true;
+ }
+
+ // TODO brendan 11/10/13 reable event
+ // topiaFiresSupport.firePreUpdateSchema(this);
+ new SchemaUpdate(getHibernateProvider().getHibernateConfiguration()).execute(showSchema,
+ true);
+ // topiaFiresSupport.firePostUpdateSchema(this);
+ } catch (HibernateException eee) {
+ throw new TopiaException(
+ String.format("Could not update schema for reason: %s",
+ eee.getMessage()), eee);
+ }
+ }
+
+ public void dropSchema() {
+ try {
+ boolean showSchema = false;
+ if (log.isDebugEnabled()) {
+ showSchema = true;
+ }
+
+ // TODO brendan 11/10/13 reable event
+ // topiaFiresSupport.firePreDropSchema(this);
+ new SchemaExport(getHibernateProvider().getHibernateConfiguration()).execute(showSchema, true, true, false);
+// topiaFiresSupport.firePostDropSchema(this);
+ } catch (HibernateException eee) {
+ throw new TopiaException(
+ String.format("Could not drop schema for reason: %s",
+ eee.getMessage()), eee);
+ }
+ }
+
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -59,11 +59,6 @@
private static final Log log = LogFactory.getLog(AbstractTopiaPersistenceContext.class);
/**
- * List of persistent classes
- */
- protected List<Class<?>> persistenceClasses = Lists.newArrayList();
-
- /**
* Already loaded DAO cache within this persistence context
*/
protected Map<Class<? extends TopiaEntity>, TopiaDAO<? extends TopiaEntity>> daoCache = Maps.newHashMap(); // TODO AThimel 27/09/13 Concurrent map ?
@@ -105,12 +100,11 @@
// * @param config
*/
public AbstractTopiaPersistenceContext(HibernateProvider hibernateProvider,
- TopiaSqlSupport sqlSupport,
TopiaListenableSupport listenableSupport,
TopiaIdFactory topiaIdFactory) {
this.hibernateSupport = new InternalTopiaHibernateSupport(hibernateProvider);
- this.sqlSupport = sqlSupport;
+ // TODO brendan 11/10/13 init this.sqlSupport
this.listenableSupport = listenableSupport;
this.topiaIdFactory = topiaIdFactory;
// this.config = config;
@@ -181,11 +175,6 @@
return topiaIdFactory;
}
- @Override
- public List<Class<?>> getPersistenceClasses() {
- return null; // TODO AThimel 27/09/13 May be moved to TopiaHibernateSupport ?
- }
-
// @Override
// public Properties getConfig() {
// return config;
@@ -255,94 +244,6 @@
}
@Override
- public boolean isSchemaEmpty() {
- Configuration configuration = hibernateSupport.getHibernateConfiguration();
- boolean result = TopiaUtil.isSchemaEmpty(configuration);
- return result;
- }
-
- @Override
- public boolean isTableExists(Class<?> clazz) {
- checkClosed();
-
- Configuration configuration = hibernateSupport.getHibernateConfiguration();
- boolean result = TopiaUtil.isSchemaExist(configuration, clazz.getName());
- return result;
- }
-
- @Override
- public String getSchemaName() {
- // TODO AThimel 02/08/13 I absolutely don't know if it works
- return getConfig().getProperty(TopiaContextFactory.CONFIG_DEFAULT_SCHEMA);
- }
-
- @Override
- public void createSchema() {
- try {
- boolean showSchema = false;
- if (log.isDebugEnabled()) {
- showSchema = true;
- }
- getFiresSupport().firePreCreateSchema(this);
- new SchemaExport(hibernateSupport.getHibernateConfiguration()).execute(showSchema, true, false, true);
- getFiresSupport().firePostCreateSchema(this);
- } catch (HibernateException eee) {
- throw new TopiaException(
- String.format("Could not create schema for reason: %s",
- eee.getMessage()), eee);
- }
-
- }
-
- @Override
- public void showCreateSchema() {
- try {
- new SchemaExport(hibernateSupport.getHibernateConfiguration()).
- execute(true, false, false, true);
- } catch (HibernateException eee) {
- throw new TopiaException(
- String.format("Could not show create schema for reason: %s",
- eee.getMessage()), eee);
- }
-
- }
-
- @Override
- public void updateSchema() {
- try {
- boolean showSchema = false;
- if (log.isDebugEnabled()) {
- showSchema = true;
- }
- getFiresSupport().firePreUpdateSchema(this);
- new SchemaUpdate(hibernateSupport.getHibernateConfiguration()).execute(showSchema,
- true);
- getFiresSupport().firePostUpdateSchema(this);
- } catch (HibernateException eee) {
- throw new TopiaException(
- String.format("Could not update schema for reason: %s",
- eee.getMessage()), eee);
- }
- }
-
- @Override
- public void dropSchema() {
- try {
- boolean showSchema = false;
- if (log.isDebugEnabled()) {
- showSchema = true;
- }
- getFiresSupport().firePreDropSchema(this);
- new SchemaExport(hibernateSupport.getHibernateConfiguration()).execute(showSchema, true, true, false);
- getFiresSupport().firePostDropSchema(this);
- } catch (HibernateException eee) {
- throw new TopiaException(
- String.format("Could not drop schema for reason: %s",
- eee.getMessage()), eee);
- }
- }
-
- @Override
public void commitTransaction() {
//To change body of implemented methods use File | Settings | File Templates.
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -27,9 +27,6 @@
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaIdFactory;
-import java.util.List;
-import java.util.Properties;
-
/**
* This API provides all methods related to persistence :
* <ul>
@@ -67,61 +64,4 @@
*/
TopiaIdFactory getTopiaIdFactory();
- /**
- * @return the list of classes managed by this TopiaPersistenceContext
- */
- List<Class<?>> getPersistenceClasses();
-
- /**
- * @return Returns the config.
- */
- Properties getConfig(); // TODO AThimel 02/08/13 Change type ?
-
- /**
- * Detects if the db associated to the current context contains at least one
- * entity table.
- *
- * @return {@code true} if there is no schema for any of the dealed entities,
- * {@code false} otherwise.
- * @since 3.0
- */
- boolean isSchemaEmpty();
-
- /**
- * Detects if the table is created on storage for a given persistent class.
- *
- * @param clazz the researched class
- * @return true if the table exists on storage
- * @since 3.0
- */
- boolean isTableExists(Class<?> clazz);
-
- /**
- * @return the current schema name
- * @since 3.0
- */
- String getSchemaName();
-
- /**
- * Triggers database schema creation
- */
- void createSchema();
-
- /**
- * Displays the SQL queries that would be used for a schema creation
- */
- void showCreateSchema();
-
- /**
- * Triggers database schema update
- */
- void updateSchema();
-
- /**
- * Triggers database schema drop
- *
- * @since 3.0
- */
- void dropSchema();
-
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/AbstractTopiaContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/AbstractTopiaContext.java 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/AbstractTopiaContext.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -539,7 +539,6 @@
}
}
- @Override
public void dropSchema() throws TopiaException {
try {
boolean showSchema = false;
@@ -1329,13 +1328,11 @@
return isTableExists(clazz);
}
- @Override
public boolean isSchemaEmpty() {
// TODO AThimel 02/08/13 Implement
throw new UnsupportedOperationException("Not yet implemented");
}
- @Override
public boolean isTableExists(Class<?> clazz) {
checkClosed(String.format("This context is closed, it is not possible to release the operation '%1$s'",
"replicateEntity"));
@@ -1343,7 +1340,6 @@
return result;
}
- @Override
public String getSchemaName() {
// TODO AThimel 02/08/13 I absolutely don't know if it works
return getConfig().getProperty(TopiaContextFactory.CONFIG_DEFAULT_SCHEMA);
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 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaFiresSupport.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -25,16 +25,6 @@
package org.nuiton.topia.framework;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.beans.VetoableChangeSupport;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.commons.collections.map.IdentityMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -63,6 +53,7 @@
import org.nuiton.topia.TopiaDAOSupplier;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.TopiaJpaSupport;
+import org.nuiton.topia.TopiaListenableSupport;
import org.nuiton.topia.TopiaPersistenceContext;
import org.nuiton.topia.TopiaVetoException;
import org.nuiton.topia.event.TopiaContextEvent;
@@ -82,6 +73,16 @@
import org.nuiton.util.CategorisedListenerSet;
import org.nuiton.util.ListenerSet;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.beans.VetoableChangeSupport;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* TODO-fdesbois-20100507 : Need translation of javadoc.
* <p/>
@@ -91,7 +92,7 @@
* @author jruchaud <jruchaud(a)codelutin.com>
* @version $Id$
*/
-public class TopiaFiresSupport {
+public class TopiaFiresSupport implements TopiaListenableSupport {
static private Log log = LogFactory.getLog(TopiaFiresSupport.class);
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -174,7 +174,7 @@
addAnnotation(output, op, Override.class);
setOperationBody(op, ""
/*{
- return new <%=persistenceContextConcreteName%>();
+ return new <%=persistenceContextConcreteName%>(getHibernateProvider(), getTopiaListenableSupport(), getTopiaIdFactory());
}*/
);
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java 2013-10-11 14:18:51 UTC (rev 2836)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java 2013-10-11 14:40:39 UTC (rev 2837)
@@ -35,8 +35,10 @@
import org.nuiton.eugene.models.object.ObjectModelJavaModifier;
import org.nuiton.eugene.models.object.ObjectModelOperation;
import org.nuiton.topia.AbstractTopiaPersistenceContext;
-import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.HibernateProvider;
+import org.nuiton.topia.TopiaListenableSupport;
import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaIdFactory;
import org.nuiton.topia.persistence.util.EntityOperator;
import org.nuiton.topia.persistence.util.EntityOperatorStore;
@@ -140,19 +142,16 @@
addImport(output, EntityOperatorStore.class);
}
- // add context field
- addAttribute(output, "context", TopiaContext.class, null,
- ObjectModelJavaModifier.PROTECTED);
-
// add public constructor
ObjectModelOperation constructor = addConstructor(
output,
ObjectModelJavaModifier.PUBLIC);
- addParameter(constructor, TopiaContext.class, "context");
+ addParameter(constructor, HibernateProvider.class, "hibernateProvider");
+ addParameter(constructor, TopiaListenableSupport.class, "listenableSupport");
+ addParameter(constructor, TopiaIdFactory.class, "topiaIdFactory");
setOperationBody(constructor, ""
/*{
- super(context, context, context, context.getTopiaIdFactory(), context.getConfig());
- this.context = context;
+ super(hibernateProvider, listenableSupport, topiaIdFactory);
}*/
);
@@ -282,10 +281,12 @@
ObjectModelOperation constructor = addConstructor(
output,
ObjectModelJavaModifier.PUBLIC);
- addParameter(constructor, TopiaContext.class, "context");
+ addParameter(constructor, HibernateProvider.class, "hibernateProvider");
+ addParameter(constructor, TopiaListenableSupport.class, "listenableSupport");
+ addParameter(constructor, TopiaIdFactory.class, "topiaIdFactory");
setOperationBody(constructor, ""
- /*{
- super(context);
+/*{
+ super(hibernateProvider, listenableSupport, topiaIdFactory);
}*/
);
1
0
r2836 - trunk/topia-persistence/src/main/java/org/nuiton/topia
by athimel@users.nuiton.org 11 Oct '13
by athimel@users.nuiton.org 11 Oct '13
11 Oct '13
Author: athimel
Date: 2013-10-11 16:18:51 +0200 (Fri, 11 Oct 2013)
New Revision: 2836
Url: http://nuiton.org/projects/topia/repository/revisions/2836
Log:
Add missing hibernateProvider constructor
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 14:16:48 UTC (rev 2835)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 14:18:51 UTC (rev 2836)
@@ -95,7 +95,7 @@
protected HibernateProvider getHibernateProvider() {
if (hibernateProvider == null) {
- hibernateProvider = new HibernateProvider();
+ hibernateProvider = new HibernateProvider(configuration, topiaServiceSupport);
}
return hibernateProvider;
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java 2013-10-11 14:16:48 UTC (rev 2835)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java 2013-10-11 14:18:51 UTC (rev 2836)
@@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -45,7 +46,6 @@
import org.nuiton.topia.framework.TopiaService;
import org.nuiton.topia.framework.TopiaUtil;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
/**
@@ -58,7 +58,7 @@
protected SessionFactory hibernateSessionFactory;
protected Configuration hibernateConfiguration;
- protected ImmutableMap<String, String> configuration;
+ protected Map<String, String> configuration;
protected TopiaServiceSupport topiaServiceSupport;
/**
@@ -66,6 +66,11 @@
*/
protected List<Class<?>> persistentClasses = Lists.newArrayList();
+ public HibernateProvider(Map<String, String> configuration, TopiaServiceSupport topiaServiceSupport) {
+ this.configuration = configuration;
+ this.topiaServiceSupport = topiaServiceSupport;
+ }
+
protected String getProperty(String key) {
return getProperty(key, null);
}
1
0
r2835 - in trunk/topia-persistence/src: main/java/org/nuiton/topia main/java/org/nuiton/topia/persistence test/java/org/nuiton/topia test/java/org/nuiton/topia/persistence
by athimel@users.nuiton.org 11 Oct '13
by athimel@users.nuiton.org 11 Oct '13
11 Oct '13
Author: athimel
Date: 2013-10-11 16:16:48 +0200 (Fri, 11 Oct 2013)
New Revision: 2835
Url: http://nuiton.org/projects/topia/repository/revisions/2835
Log:
Introduce HibernateProvider in order to create Hibernate's Configuration and SessionFactory
Added:
trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 13:46:24 UTC (rev 2834)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -65,10 +65,10 @@
protected TopiaServiceSupport topiaServiceSupport;
+ protected HibernateProvider hibernateProvider;
+
public abstract K newPersistenceContext();
- public abstract Properties getConfig();
-
public AbstractTopiaApplicationContext(Properties properties) {
// TODO arnaud 11/10/13 vérifier le comportement
this((Map) ImmutableMap.copyOf(properties));
@@ -93,8 +93,15 @@
this.configuration = ImmutableMap.copyOf(configurationCopy);
}
+ protected HibernateProvider getHibernateProvider() {
+ if (hibernateProvider == null) {
+ hibernateProvider = new HibernateProvider();
+ }
+ return hibernateProvider;
+ }
+
protected SessionFactory getSessionFactory() {
- throw new UnsupportedOperationException();
+ return getHibernateProvider().getSessionFactory();
}
protected TopiaListenableSupport getTopiaListenableSupport() {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 13:46:24 UTC (rev 2834)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -30,6 +30,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
+import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
@@ -71,7 +72,7 @@
protected TopiaFiresSupport firesSupport;
// TODO AThimel 27/09/13 Javadoc
- protected TopiaHibernateSupport hibernateSupport;
+ protected InternalTopiaHibernateSupport hibernateSupport;
// TODO AThimel 27/09/13 Javadoc
protected TopiaJpaSupport jpaSupport;
@@ -89,27 +90,60 @@
*/
protected TopiaIdFactory topiaIdFactory;
+// /**
+// * Current context configuration
+// */
+// protected Properties config;
+
/**
- * Current context configuration
+ * Creating a new TopiaPersistenceContext is equivalent to creating a new transaction
+ *
+ * @param hibernateProvider
+ * @param sqlSupport
+ * @param listenableSupport
+ * @param topiaIdFactory
+// * @param config
*/
- protected Properties config;
-
- public AbstractTopiaPersistenceContext(TopiaHibernateSupport hibernateSupport,
+ public AbstractTopiaPersistenceContext(HibernateProvider hibernateProvider,
TopiaSqlSupport sqlSupport,
TopiaListenableSupport listenableSupport,
- TopiaIdFactory topiaIdFactory,
- Properties config) {
- this.hibernateSupport = hibernateSupport;
+ TopiaIdFactory topiaIdFactory) {
+
+ this.hibernateSupport = new InternalTopiaHibernateSupport(hibernateProvider);
this.sqlSupport = sqlSupport;
this.listenableSupport = listenableSupport;
this.topiaIdFactory = topiaIdFactory;
- this.config = config;
+// this.config = config;
this.firesSupport = new TopiaFiresSupport();
this.jpaSupport = new HibernateTopiaJpaSupport(hibernateSupport, firesSupport);
}
+ protected class InternalTopiaHibernateSupport implements TopiaHibernateSupport {
+
+ protected HibernateProvider hibernateProvider;
+
+ protected InternalTopiaHibernateSupport(HibernateProvider hibernateProvider) {
+ this.hibernateProvider = hibernateProvider;
+ }
+
+ @Override
+ public Session getHibernateSession() {
+ return null;
+ }
+
+ @Override
+ public SessionFactory getHibernateFactory() {
+ return hibernateProvider.getSessionFactory();
+ }
+
+ @Override
+ public Configuration getHibernateConfiguration() {
+ return hibernateProvider.getHibernateConfiguration();
+ }
+ }
+
protected void checkClosed() throws TopiaException {
// TODO AThimel 27/09/13 IS it still useful ?
// if (closed) {
@@ -152,10 +186,10 @@
return null; // TODO AThimel 27/09/13 May be moved to TopiaHibernateSupport ?
}
- @Override
- public Properties getConfig() {
- return config;
- }
+// @Override
+// public Properties getConfig() {
+// return config;
+// }
@Override
public <E extends TopiaEntity> TopiaDAO<E> getDAO(Class<E> entityClass) {
Added: trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java (rev 0)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,214 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.engine.spi.SessionFactoryImplementor;
+import org.hibernate.event.service.spi.EventListenerRegistry;
+import org.hibernate.event.spi.EventType;
+import org.hibernate.service.ServiceRegistry;
+import org.hibernate.service.ServiceRegistryBuilder;
+import org.nuiton.topia.framework.TopiaFiresSupport;
+import org.nuiton.topia.framework.TopiaService;
+import org.nuiton.topia.framework.TopiaUtil;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class HibernateProvider {
+
+ private static final Log log = LogFactory.getLog(HibernateProvider.class);
+
+ protected SessionFactory hibernateSessionFactory;
+ protected Configuration hibernateConfiguration;
+
+ protected ImmutableMap<String, String> configuration;
+ protected TopiaServiceSupport topiaServiceSupport;
+
+ /**
+ * List of persistent classes
+ */
+ protected List<Class<?>> persistentClasses = Lists.newArrayList();
+
+ protected String getProperty(String key) {
+ return getProperty(key, null);
+ }
+
+ protected String getProperty(String key, String defaultValue) {
+ String result = defaultValue;
+ if (configuration.containsKey(key)) {
+ result = configuration.get(key);
+ }
+
+ return result;
+ }
+
+ public Configuration getHibernateConfiguration() {
+ if (hibernateConfiguration == null) {
+ hibernateConfiguration = new Configuration();
+
+ // ajout des repertoires contenant les mappings hibernate
+ String[] dirs = getProperty(
+ TopiaContextFactory.CONFIG_PERSISTENCE_DIRECTORIES, "").split(",");
+ for (String dir : dirs) {
+ dir = dir.trim();
+ if (StringUtils.isNotEmpty(dir)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Load persistence from dir : " + dir);
+ }
+ hibernateConfiguration.addDirectory(new File(dir));
+ }
+ }
+
+ // ajout des classes dites persistentes
+ Set<Class<?>> hibernatePersistanceClasses = new HashSet<Class<?>>();
+ for (TopiaService service : topiaServiceSupport.getServices().values()) {
+ Class<?>[] classes = service.getPersistenceClasses();
+
+ // certains service n'ont pas de classe persistantes
+ if (classes != null) {
+ // sletellier 20110411 : http://www.nuiton.org/issues/show/1454
+ hibernatePersistanceClasses.addAll(Arrays.asList(classes));
+// for (Class<?> clazz : classes) {
+// hibernateConfiguration.addClass(clazz);
+// }
+ }
+ }
+
+ String listPersistenceClasses = getProperty(
+ TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, "");
+
+ String[] classes = listPersistenceClasses.split(",");
+ for (String classname : classes) {
+ classname = classname.trim();
+ if (StringUtils.isNotEmpty(classname)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Load persistent class : " + classname);
+ }
+
+ // XXX echatellier 20111007 ce qui 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";
+ // pour obtenir le mapping et la reinstancier ensuite
+
+ Class<?> clazz;
+ try {
+ clazz = Class.forName(classname);
+ } catch (ClassNotFoundException eee) {
+ if (log.isDebugEnabled()) {
+ log.debug("Class " + classname + " not found");
+ }
+ throw new TopiaNotFoundException(
+ String.format("Persistence class %1$s not found",
+ classname));
+ }
+ persistentClasses.add(clazz);
+
+ // sletellier 20110411 : http://www.nuiton.org/issues/show/1454
+// hibernateConfiguration.addClass(clazz);
+ hibernatePersistanceClasses.add(clazz);
+ }
+ }
+
+ // sletellier 20110411 : http://www.nuiton.org/issues/show/1454
+ // Add persistance classes in hibernate config
+ for (Class<?> persistanceClass : hibernatePersistanceClasses) {
+ hibernateConfiguration.addClass(persistanceClass);
+ }
+
+ Properties prop = new Properties();
+ prop.putAll(hibernateConfiguration.getProperties());
+ prop.putAll(configuration);
+
+ // Strange behavior, all properties are already loaded from
+ // constructor. Difficult to use this behavior, need to have
+ // TOPIA_PERSISTENCE_PROPERTIES_FILE in config.
+ Properties propertiesFromClasspath =
+ TopiaUtil.getProperties(getProperty(TopiaContextFactory.CONFIG_PERSISTENCE_PROPERTIES_FILE));
+
+ if (!propertiesFromClasspath.isEmpty()) {
+ if (log.isDebugEnabled()) {
+ log.debug("Load properties from file : " +
+ propertiesFromClasspath);
+ }
+ prop.putAll(propertiesFromClasspath);
+ }
+
+ hibernateConfiguration.setProperties(prop);
+
+ // tchemit 2011-05-26 When using hibernate > 3.3, need to make sure all mappings are loaded (the one from directory files are not still done).
+ hibernateConfiguration.buildMappings();
+ }
+ return hibernateConfiguration;
+ }
+
+ public SessionFactory getSessionFactory() {
+
+ if (hibernateSessionFactory == null) {
+
+ // init service registry
+ ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(
+ getHibernateConfiguration().getProperties()).buildServiceRegistry();
+
+ hibernateSessionFactory = getHibernateConfiguration().buildSessionFactory(serviceRegistry);
+
+ // we can't reuse original serviceRegistry instance
+ // we must call getServiceRegistry on factory to get a working one
+ ServiceRegistry serviceRegistryInit = ((SessionFactoryImplementor) hibernateSessionFactory).getServiceRegistry();
+ EventListenerRegistry eventListenerRegistry = serviceRegistryInit.getService(EventListenerRegistry.class);
+// TopiaFiresSupport.TopiaHibernateEvent listener = new TopiaFiresSupport.TopiaHibernateEvent(this);
+ TopiaFiresSupport.TopiaHibernateEvent listener = new TopiaFiresSupport.TopiaHibernateEvent(null); // FIXME AThimel 11/10/13 Give a correct instance
+ eventListenerRegistry.appendListeners(EventType.PRE_INSERT, listener);
+ eventListenerRegistry.appendListeners(EventType.PRE_LOAD, listener);
+ eventListenerRegistry.appendListeners(EventType.PRE_UPDATE, listener);
+ eventListenerRegistry.appendListeners(EventType.PRE_DELETE, listener);
+ eventListenerRegistry.appendListeners(EventType.POST_INSERT, listener);
+ eventListenerRegistry.appendListeners(EventType.POST_LOAD, listener);
+ eventListenerRegistry.appendListeners(EventType.POST_UPDATE, listener);
+ eventListenerRegistry.appendListeners(EventType.POST_DELETE, listener);
+
+ // following listeners must be called before hibernate
+ eventListenerRegistry.prependListeners(EventType.SAVE_UPDATE, listener);
+ }
+ return hibernateSessionFactory;
+ }
+
+}
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/HibernateProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java 2013-10-11 13:46:24 UTC (rev 2834)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -1,5 +1,29 @@
package org.nuiton.topia;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaDAOSupplier.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2013-10-11 13:46:24 UTC (rev 2834)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/HqlAndParametersBuilder.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,33 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import org.nuiton.topiatest.Employe;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public abstract class AbstractEmployeTopiaDao<E extends Employe> extends GeneratedEmployeeTopiaDao<E> {
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractEmployeTopiaDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,34 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import org.nuiton.topiatest.Personne;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public abstract class AbstractPersonneTopiaDao<E extends Personne> extends GeneratedPersonneTopiaDao<E> {
+
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/AbstractPersonneTopiaDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,42 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.List;
+
+import org.nuiton.topiatest.Employe;
+import org.nuiton.topiatest.Personne;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class EmployeTopiaDao extends AbstractEmployeTopiaDao<Employe> {
+
+ @Override
+ public List<Personne> findAllPersonnesByXAndY(int x, int y) {
+ return null;
+ }
+
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeTopiaDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,31 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public interface EmployeeDao {
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/EmployeeDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,33 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import org.nuiton.topiatest.Employe;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public abstract class GeneratedEmployeeTopiaDao<E extends Employe> extends AbstractPersonneTopiaDao<E> {
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedEmployeeTopiaDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,60 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.List;
+import java.util.Map;
+
+import org.nuiton.topia.persistence.AbstractTopiaDAO;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaEntityEnum;
+import org.nuiton.topiatest.Personne;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public abstract class GeneratedPersonneTopiaDao<E extends Personne> extends AbstractTopiaDAO<E> implements PersonneDao {
+
+ @Override
+ public TopiaEntityEnum getTopiaEntityEnum() {
+ return null;
+ }
+
+ @Override
+ public <R extends TopiaEntity> List<R> findUsages(Class<R> type, E entity) throws TopiaException {
+ return null;
+ }
+
+ @Override
+ public Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity) throws TopiaException {
+ return null;
+ }
+
+ @Override
+ public Class<E> getEntityClass() {
+ return null;
+ }
+
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/GeneratedPersonneTopiaDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,38 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.List;
+
+import org.nuiton.topiatest.Personne;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public interface PersonneDao {
+
+ List<Personne> findAllPersonnesByXAndY(int x, int y);
+
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java (rev 0)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -0,0 +1,41 @@
+package org.nuiton.topia;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.List;
+
+import org.nuiton.topiatest.Personne;
+
+/**
+ * @author Arnaud Thimel <thimel(a)codelutin.com>
+ */
+public class PersonneTopiaDao extends AbstractPersonneTopiaDao<Personne> {
+
+ @Override
+ public List<Personne> findAllPersonnesByXAndY(int x, int y) {
+ return null;
+ }
+
+}
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/PersonneTopiaDao.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java 2013-10-11 13:46:24 UTC (rev 2834)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java 2013-10-11 14:16:48 UTC (rev 2835)
@@ -1,5 +1,29 @@
package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import org.junit.Assert;
import org.junit.Test;
Property changes on: trunk/topia-persistence/src/test/java/org/nuiton/topia/persistence/HqlAndParametersBuilderTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r2834 - in trunk: . topia-persistence/src/main/java/org/nuiton/topia topia-persistence/src/main/java/org/nuiton/topia/generator
by bleny@users.nuiton.org 11 Oct '13
by bleny@users.nuiton.org 11 Oct '13
11 Oct '13
Author: bleny
Date: 2013-10-11 15:46:24 +0200 (Fri, 11 Oct 2013)
New Revision: 2834
Url: http://nuiton.org/projects/topia/repository/revisions/2834
Log:
introduce generation of PersistenceContext and ApplicationContext
Added:
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java
Modified:
trunk/pom.xml
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-10-10 16:14:22 UTC (rev 2833)
+++ trunk/pom.xml 2013-10-11 13:46:24 UTC (rev 2834)
@@ -204,7 +204,6 @@
<module>topia-persistence</module>
<module>topia-service-replication</module>
<module>topia-service-migration</module>
- <module>topia-service-security</module>
</modules>
<scm>
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-10 16:14:22 UTC (rev 2833)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaApplicationContext.java 2013-10-11 13:46:24 UTC (rev 2834)
@@ -24,12 +24,11 @@
* #L%
*/
-import java.beans.PropertyChangeListener;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
+import org.hibernate.SessionFactory;
import org.nuiton.topia.event.TopiaEntitiesVetoable;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
@@ -41,7 +40,10 @@
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaIdFactory;
-import com.google.common.base.Preconditions;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
/**
* The application context is the main class in ToPIA usage. This class is a kind of equivalent of the RootTopiaContext.
@@ -55,19 +57,59 @@
protected TopiaIdFactory topiaIdFactory;
+ protected ImmutableMap<String, String> configuration;
+
+ protected TopiaReplicationSupport topiaReplicationSupport;
+
+ protected TopiaListenableSupport topiaListenableSupport;
+
+ protected TopiaServiceSupport topiaServiceSupport;
+
public abstract K newPersistenceContext();
-// {
-// // TODO AThimel 27/09/13 Instantiate project specific TopiaPersistenceContext
-// return null;
-// }
public abstract Properties getConfig();
+ public AbstractTopiaApplicationContext(Properties properties) {
+ // TODO arnaud 11/10/13 vérifier le comportement
+ this((Map) ImmutableMap.copyOf(properties));
+ }
+
+ protected abstract Class<? extends TopiaEntity>[] getImplementationClasses();
+
+ protected String getImplementationClassesAsString() {
+ StringBuilder buffer = new StringBuilder();
+ for (Class<? extends TopiaEntity> aClass : getImplementationClasses()) {
+ buffer.append(',').append(aClass.getName());
+ }
+ return buffer.substring(1);
+ }
+
+ public AbstractTopiaApplicationContext(Map<String, String> configuration) {
+ Map<String, String> configurationCopy = Maps.newHashMap();
+ configurationCopy.putAll(configuration);
+ if ( ! configuration.containsKey(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES)) {
+ configurationCopy.put(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES, getImplementationClassesAsString());
+ }
+ this.configuration = ImmutableMap.copyOf(configurationCopy);
+ }
+
+ protected SessionFactory getSessionFactory() {
+ throw new UnsupportedOperationException();
+ }
+
+ protected TopiaListenableSupport getTopiaListenableSupport() {
+ // TODO brendan 11/10/13 instancier
+ return topiaListenableSupport;
+ }
+
+ protected ImmutableMap<String, String> getConfiguration() {
+ return configuration;
+ }
+
protected TopiaIdFactory getTopiaIdFactory() {
if (topiaIdFactory == null) {
-
String topiaIdFactoryClassName =
- getConfig().getProperty(TopiaContextFactory.CONFIG_PERSISTENCE_TOPIA_ID_FACTORY_CLASS_NAME, "");
+ getConfiguration().get(TopiaContextFactory.CONFIG_PERSISTENCE_TOPIA_ID_FACTORY_CLASS_NAME);
if (StringUtils.isEmpty(topiaIdFactoryClassName)) {
topiaIdFactory = new DefaultTopiaIdFactory();
} else {
@@ -91,103 +133,123 @@
return topiaIdFactory;
}
+ @Override
+ public void replicate(TopiaContext destinationContext, Object... entityAndCondition) throws IllegalArgumentException {
+ topiaReplicationSupport.replicate(destinationContext, entityAndCondition);
+ }
@Override
+ public <T extends TopiaEntity> void replicateEntity(TopiaContext destinationContext, T entity) throws IllegalArgumentException {
+ topiaReplicationSupport.replicateEntity(destinationContext, entity);
+ }
+
+ @Override
+ public <T extends TopiaEntity> void replicateEntities(TopiaContext destinationContext, List<T> entities) throws IllegalArgumentException {
+ topiaReplicationSupport.replicateEntities(destinationContext, entities);
+ }
+
+ @Override
public void addTopiaEntityListener(TopiaEntityListener listener) {
+ topiaListenableSupport.addTopiaEntityListener(listener);
}
@Override
public void addTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) {
+ topiaListenableSupport.addTopiaEntityListener(entityClass, listener);
}
@Override
public void removeTopiaEntityListener(TopiaEntityListener listener) {
+ topiaListenableSupport.removeTopiaEntityListener(listener);
}
@Override
public void removeTopiaEntityListener(Class<? extends TopiaEntity> entityClass, TopiaEntityListener listener) {
+ topiaListenableSupport.removeTopiaEntityListener(entityClass, listener);
}
@Override
public void addTopiaEntityVetoable(TopiaEntityVetoable vetoable) {
+ topiaListenableSupport.addTopiaEntityVetoable(vetoable);
}
@Override
public void addTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) {
+ topiaListenableSupport.addTopiaEntityVetoable(entityClass, vetoable);
}
@Override
public void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable) {
+ topiaListenableSupport.removeTopiaEntityVetoable(vetoable);
}
@Override
public void removeTopiaEntityVetoable(Class<? extends TopiaEntity> entityClass, TopiaEntityVetoable vetoable) {
+ topiaListenableSupport.removeTopiaEntityVetoable(entityClass, vetoable);
}
@Override
public void addTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
+ topiaListenableSupport.addTopiaEntitiesVetoable(vetoable);
}
@Override
public void removeTopiaEntitiesVetoable(TopiaEntitiesVetoable vetoable) {
+ topiaListenableSupport.removeTopiaEntitiesVetoable(vetoable);
}
@Override
public void addTopiaTransactionListener(TopiaTransactionListener listener) {
+ topiaListenableSupport.addTopiaTransactionListener(listener);
}
@Override
public void removeTopiaTransactionListener(TopiaTransactionListener listener) {
+ topiaListenableSupport.removeTopiaTransactionListener(listener);
}
@Override
public void addTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) {
+ topiaListenableSupport.addTopiaTransactionVetoable(vetoable);
}
@Override
public void removeTopiaTransactionVetoable(TopiaTransactionVetoable vetoable) {
+ topiaListenableSupport.removeTopiaTransactionVetoable(vetoable);
}
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
+ topiaListenableSupport.addPropertyChangeListener(listener);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
+ topiaListenableSupport.removePropertyChangeListener(listener);
}
@Override
public void addTopiaSchemaListener(TopiaSchemaListener listener) {
+ topiaListenableSupport.addTopiaSchemaListener(listener);
}
@Override
public void removeTopiaSchemaListener(TopiaSchemaListener listener) {
+ topiaListenableSupport.removeTopiaSchemaListener(listener);
}
@Override
- public void replicate(TopiaContext destinationContext, Object... entityAndCondition) throws IllegalArgumentException {
- }
-
- @Override
- public <T extends TopiaEntity> void replicateEntity(TopiaContext destinationContext, T entity) throws IllegalArgumentException {
- }
-
- @Override
- public <T extends TopiaEntity> void replicateEntities(TopiaContext destinationContext, List<T> entities) throws IllegalArgumentException {
- }
-
- @Override
public <E extends TopiaService> boolean serviceEnabled(Class<E> interfaceService) {
- return false;
+ return topiaServiceSupport.serviceEnabled(interfaceService);
}
@Override
public <E extends TopiaService> E getService(Class<E> interfaceService) throws TopiaNotFoundException {
- return null;
+ return topiaServiceSupport.getService(interfaceService);
}
@Override
public Map<String, TopiaService> getServices() {
- return null;
+ return topiaServiceSupport.getServices();
}
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-10 16:14:22 UTC (rev 2833)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/AbstractTopiaPersistenceContext.java 2013-10-11 13:46:24 UTC (rev 2834)
@@ -308,4 +308,23 @@
}
}
+ @Override
+ public void commitTransaction() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void rollbackTransaction() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void closeContext() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public boolean isClosed() {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java 2013-10-10 16:14:22 UTC (rev 2833)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/TopiaPersistenceContext.java 2013-10-11 13:46:24 UTC (rev 2834)
@@ -41,7 +41,7 @@
* @author Arnaud Thimel <thimel(a)codelutin.com>
* @since 3.0
*/
-public interface TopiaPersistenceContext extends TopiaDAOSupplier {
+public interface TopiaPersistenceContext extends TopiaDAOSupplier, TopiaTransaction {
/**
* Retrieve {@link org.nuiton.topia.persistence.TopiaEntity} using its unique {@code topiaId}.
Copied: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java (from rev 2809, trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java)
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java (rev 0)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ApplicationContextTransformer.java 2013-10-11 13:46:24 UTC (rev 2834)
@@ -0,0 +1,310 @@
+package org.nuiton.topia.generator;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/*{generator option: parentheses = false}*/
+
+/*{generator option: writeString = +}*/
+
+import org.nuiton.eugene.java.ObjectModelTransformerToJava;
+import org.nuiton.eugene.models.object.ObjectModel;
+import org.nuiton.eugene.models.object.ObjectModelClass;
+import org.nuiton.eugene.models.object.ObjectModelJavaModifier;
+import org.nuiton.eugene.models.object.ObjectModelOperation;
+import org.nuiton.topia.AbstractTopiaApplicationContext;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.util.EntityOperator;
+import org.nuiton.topia.persistence.util.EntityOperatorStore;
+
+import java.lang.reflect.Array;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * To generate PersistenceHelper
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.topia.generator.ApplicationContextTransformer"
+ * @since 3.0
+ */
+public class ApplicationContextTransformer extends ObjectModelTransformerToJava {
+
+ @Override
+ public void transformFromModel(ObjectModel input) {
+
+ String packageName = TopiaGeneratorUtil.getApplicationContextPackage(this, model);
+
+ String applicationContextAbstractName = TopiaGeneratorUtil.getApplicationContextAbstractName(model);
+
+ String applicationContextConcreteName = TopiaGeneratorUtil.getApplicationContextConcreteName(model);
+
+ boolean generateAbstract = !isInClassPath(packageName, applicationContextAbstractName);
+
+ boolean generateConcrete = !isInClassPath(packageName, applicationContextConcreteName);
+
+
+ if (generateAbstract) {
+
+ generateAbstract(packageName,
+ applicationContextAbstractName);
+ }
+
+ if (generateConcrete) {
+
+ generateImpl(packageName,
+ applicationContextAbstractName,
+ applicationContextConcreteName);
+ }
+
+ }
+
+ protected void generateAbstract(String packageName,
+ String className) {
+
+ // try to find a super class by tag-value
+// String superClass = TopiaGeneratorUtil.getPersistenceContextSuperClassTagValue(model);
+ String superClass = null;
+
+ if (superClass == null) {
+
+ // no super-class, use default one
+ superClass = AbstractTopiaApplicationContext.class.getName();
+ }
+
+ ObjectModelClass output = createAbstractClass(className, packageName);
+
+ String persistenceContextConcreteName = TopiaGeneratorUtil.getPersistenceContextConcreteName(model);
+ setSuperClass(output, superClass + "<" + persistenceContextConcreteName + ">");
+
+ // detect if there is a contract to set on abstract
+ String contractName = TopiaGeneratorUtil.getPersistenceContextInterfaceName(model);
+
+// addInterface(output, TopiaPersistenceContext.class);
+
+ boolean addPersistenceContextContract = isInClassPath(packageName, contractName);
+
+ if (addPersistenceContextContract) {
+ addInterface(output, packageName + "." + contractName);
+ }
+
+ String modelName = model.getName();
+ String daoHelperClazzName = modelName + "DAOHelper";
+
+ String entityEnumName = modelName + "EntityEnum";
+
+ List<ObjectModelClass> entityClasses =
+ TopiaGeneratorUtil.getEntityClasses(model, true);
+
+ boolean generateOperator =
+ TopiaGeneratorUtil.shouldGenerateOperatorForDAOHelper(model);
+
+ boolean generateStandaloneEnum =
+ TopiaGeneratorUtil.shouldGenerateStandaloneEnumForDAOHelper(model);
+
+ if (!generateStandaloneEnum) {
+
+ addImport(output, packageName + "." + daoHelperClazzName + "." + entityEnumName);
+
+ }
+
+// addImport(output, TopiaDAO.class);
+ addImport(output, TopiaEntity.class);
+// addImport(output, TopiaContext.class);
+ addImport(output, Array.class);
+ addImport(output, Array.class);
+
+ if (generateOperator) {
+ addImport(output, EntityOperator.class);
+ addImport(output, EntityOperatorStore.class);
+ }
+
+ // add context field
+ addAttribute(output, "context", TopiaContext.class, null,
+ ObjectModelJavaModifier.PROTECTED);
+
+ // add public constructor
+ ObjectModelOperation constructor = addConstructor(
+ output,
+ ObjectModelJavaModifier.PUBLIC);
+ addParameter(constructor, Properties.class, "properties");
+ setOperationBody(constructor, ""
+/*{
+ super(properties);
+ }*/
+ );
+
+ constructor = addConstructor(
+ output,
+ ObjectModelJavaModifier.PUBLIC);
+ addParameter(constructor, "java.util.Map<String, String>", "configuration");
+ setOperationBody(constructor, ""
+/*{
+ super(configuration);
+ }*/
+ );
+
+ ObjectModelOperation op;
+
+ // getModelVersion method
+ op = addOperation(output, "newPersistenceContext", persistenceContextConcreteName, ObjectModelJavaModifier.PUBLIC);
+ addAnnotation(output, op, Override.class);
+ setOperationBody(op, ""
+/*{
+ return new <%=persistenceContextConcreteName%>();
+ }*/
+ );
+
+ // getModelVersion method
+ String modelVersion = model.getVersion();
+ op = addOperation(output, "getModelVersion", "String", ObjectModelJavaModifier.PUBLIC);
+ setOperationBody(op, ""
+/*{
+ return "<%=modelVersion%>";
+ }*/
+ );
+
+ // getModelName method
+ op = addOperation(output, "getModelName", "String", ObjectModelJavaModifier.PUBLIC);
+ setOperationBody(op, ""
+/*{
+ return "<%=modelName%>";
+ }*/
+ );
+
+ // getContractClass method
+ op = addOperation(output, "getContractClass", "<T extends TopiaEntity> Class<T>", ObjectModelJavaModifier.PUBLIC);
+ addParameter(op, "Class<T>", "klass");
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
+ return (Class<T>) constant.getContract();
+ }*/
+ );
+
+ // getImplementationClass method
+ op = addOperation(output, "getImplementationClass", "<T extends TopiaEntity> Class<T>", ObjectModelJavaModifier.PUBLIC);
+ addParameter(op, "Class<T>", "klass");
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
+ return (Class<T>) constant.getImplementation();
+ }*/
+ );
+
+ // getContractClasses method
+ op = addOperation(output, "getContractClasses", "Class<? extends TopiaEntity>[]", ObjectModelJavaModifier.PUBLIC);
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%>[] values = <%=entityEnumName%>.values();
+ Class<? extends TopiaEntity>[] result = (Class<? extends TopiaEntity>[]) Array.newInstance(Class.class, values.length);
+ for (int i = 0; i < values.length; i++) {
+ result[i] = values[i].getContract();
+ }
+ return result;
+ }*/
+ );
+
+ // getImplementationClasses method
+ op = addOperation(output, "getImplementationClasses", "Class<? extends TopiaEntity>[]", ObjectModelJavaModifier.PUBLIC);
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%>[] values = <%=entityEnumName%>.values();
+ Class<? extends TopiaEntity>[] result = (Class<? extends TopiaEntity>[]) Array.newInstance(Class.class, values.length);
+ for (int i = 0; i < values.length; i++) {
+ result[i] = values[i].getImplementation();
+ }
+ return result;
+ }*/
+ );
+
+ // getImplementationClassesAsString method
+ op = addOperation(output, "getImplementationClassesAsString", "String", ObjectModelJavaModifier.PUBLIC);
+ setOperationBody(op, ""
+/*{
+ StringBuilder buffer = new StringBuilder();
+ for (Class<? extends TopiaEntity> aClass : getImplementationClasses()) {
+ buffer.append(',').append(aClass.getName());
+ }
+ return buffer.substring(1);
+ }*/
+ );
+
+ // getContracts method
+ op = addOperation(output, "getContracts", entityEnumName + "[]", ObjectModelJavaModifier.PUBLIC);
+ setOperationBody(op, ""
+/*{
+ return <%=entityEnumName%>.values();
+ }*/
+ );
+
+ if (generateOperator) {
+ // getOperator method
+ op = addOperation(output, "getOperator", "<T extends TopiaEntity> EntityOperator<T>", ObjectModelJavaModifier.PUBLIC);
+ addParameter(op, "Class<T>", "klass");
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
+ return EntityOperatorStore.getOperator(constant);
+ }*/
+ );
+ }
+
+ }
+
+ protected ObjectModelClass generateImpl(String packageName,
+ String applicationContextAbstractName,
+ String applicationContextConcreteName) {
+
+ ObjectModelClass output = createClass(applicationContextConcreteName, packageName);
+
+ setSuperClass(output, applicationContextAbstractName);
+
+ // add public constructor
+ ObjectModelOperation constructor = addConstructor(
+ output,
+ ObjectModelJavaModifier.PUBLIC);
+ addParameter(constructor, Properties.class, "properties");
+ setOperationBody(constructor, ""
+/*{
+ super(properties);
+ }*/
+ );
+
+ constructor = addConstructor(
+ output,
+ ObjectModelJavaModifier.PUBLIC);
+ addParameter(constructor, "java.util.Map<String, String>", "configuration");
+ setOperationBody(constructor, ""
+/*{
+ super(configuration);
+ }*/
+ );
+
+ return output;
+ }
+
+}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2013-10-10 16:14:22 UTC (rev 2833)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2013-10-11 13:46:24 UTC (rev 2834)
@@ -134,6 +134,14 @@
return packageName;
}
+ public static String getApplicationContextPackage(ObjectModelTransformerToJava transformer,
+ ObjectModel model) {
+
+ String result = transformer.getDefaultPackageName();
+
+ return result;
+ }
+
public static String getPersistenceContextPackage(ObjectModelTransformerToJava transformer,
ObjectModel model) {
@@ -151,12 +159,24 @@
return result;
}
+ public static String getApplicationContextInterfaceName(ObjectModel model) {
+ return model.getName() + "ApplicationContext";
+ }
+
+ public static String getApplicationContextAbstractName(ObjectModel model) {
+ return "Abstract" + model.getName() + "TopiaApplicationContext";
+ }
+
+ public static String getApplicationContextConcreteName(ObjectModel model) {
+ return model.getName() + "TopiaApplicationContext";
+ }
+
public static String getPersistenceContextAbstractName(ObjectModel model) {
- return "AbstractTopia" + model.getName() + "PersistenceContext";
+ return "Abstract" + model.getName() + "TopiaPersistenceContext";
}
public static String getPersistenceContextConcreteName(ObjectModel model) {
- return "Topia" + model.getName() + "PersistenceContext";
+ return model.getName() + "TopiaPersistenceContext";
}
public static String getPersistenceContextInterfaceName(ObjectModel model) {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java 2013-10-10 16:14:22 UTC (rev 2833)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java 2013-10-11 13:46:24 UTC (rev 2834)
@@ -61,6 +61,7 @@
// );
setTemplateTypes(
+ ApplicationContextTransformer.class,
PersistenceContextTransformer.class,
EntityTransformer.class,
EntityDAOTransformer.class,
1
0
r2833 - in branches/topia-2.8.1.1: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 10 Oct '13
by maven-release@users.nuiton.org 10 Oct '13
10 Oct '13
Author: maven-release
Date: 2013-10-10 18:14:22 +0200 (Thu, 10 Oct 2013)
New Revision: 2833
Url: http://nuiton.org/projects/topia/repository/revisions/2833
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
branches/topia-2.8.1.1/pom.xml
branches/topia-2.8.1.1/topia-persistence/pom.xml
branches/topia-2.8.1.1/topia-service-migration/pom.xml
branches/topia-2.8.1.1/topia-service-replication/pom.xml
branches/topia-2.8.1.1/topia-service-security/pom.xml
Modified: branches/topia-2.8.1.1/pom.xml
===================================================================
--- branches/topia-2.8.1.1/pom.xml 2013-10-10 16:14:20 UTC (rev 2832)
+++ branches/topia-2.8.1.1/pom.xml 2013-10-10 16:14:22 UTC (rev 2833)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.8.1.3</version>
+ <version>2.8.1.4-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
@@ -80,13 +80,13 @@
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.8.1.3
+ scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.8.1.1
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.8.1.3
+ scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.8.1.1
</developerConnection>
<url>
- http://nuiton.org/projects/topia/repository/show/tags/topia-2.8.1.3
+ http://nuiton.org/projects/topia/repository/show/branches/topia-2.8.1.1
</url>
</scm>
Modified: branches/topia-2.8.1.1/topia-persistence/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-persistence/pom.xml 2013-10-10 16:14:20 UTC (rev 2832)
+++ branches/topia-2.8.1.1/topia-persistence/pom.xml 2013-10-10 16:14:22 UTC (rev 2833)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3</version>
+ <version>2.8.1.4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-migration/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-migration/pom.xml 2013-10-10 16:14:20 UTC (rev 2832)
+++ branches/topia-2.8.1.1/topia-service-migration/pom.xml 2013-10-10 16:14:22 UTC (rev 2833)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3</version>
+ <version>2.8.1.4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-replication/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-replication/pom.xml 2013-10-10 16:14:20 UTC (rev 2832)
+++ branches/topia-2.8.1.1/topia-service-replication/pom.xml 2013-10-10 16:14:22 UTC (rev 2833)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3</version>
+ <version>2.8.1.4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-security/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-security/pom.xml 2013-10-10 16:14:20 UTC (rev 2832)
+++ branches/topia-2.8.1.1/topia-service-security/pom.xml 2013-10-10 16:14:22 UTC (rev 2833)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3</version>
+ <version>2.8.1.4-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: maven-release
Date: 2013-10-10 18:14:20 +0200 (Thu, 10 Oct 2013)
New Revision: 2832
Url: http://nuiton.org/projects/topia/repository/revisions/2832
Log:
[maven-release-plugin] copy for tag topia-2.8.1.3
Added:
tags/topia-2.8.1.3/
Property changes on: tags/topia-2.8.1.3
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
atlassian-ide-plugin.xml
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0
r2831 - in branches/topia-2.8.1.1: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 10 Oct '13
by maven-release@users.nuiton.org 10 Oct '13
10 Oct '13
Author: maven-release
Date: 2013-10-10 18:14:15 +0200 (Thu, 10 Oct 2013)
New Revision: 2831
Url: http://nuiton.org/projects/topia/repository/revisions/2831
Log:
[maven-release-plugin] prepare release topia-2.8.1.3
Modified:
branches/topia-2.8.1.1/pom.xml
branches/topia-2.8.1.1/topia-persistence/pom.xml
branches/topia-2.8.1.1/topia-service-migration/pom.xml
branches/topia-2.8.1.1/topia-service-replication/pom.xml
branches/topia-2.8.1.1/topia-service-security/pom.xml
Modified: branches/topia-2.8.1.1/pom.xml
===================================================================
--- branches/topia-2.8.1.1/pom.xml 2013-10-10 16:05:35 UTC (rev 2830)
+++ branches/topia-2.8.1.1/pom.xml 2013-10-10 16:14:15 UTC (rev 2831)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.8.1.3-SNAPSHOT</version>
+ <version>2.8.1.3</version>
<modules>
<module>topia-persistence</module>
@@ -80,13 +80,13 @@
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.8.1.1
+ scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.8.1.3
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.8.1.1
+ scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.8.1.3
</developerConnection>
<url>
- http://nuiton.org/projects/topia/repository/show/branches/topia-2.8.1.1
+ http://nuiton.org/projects/topia/repository/show/tags/topia-2.8.1.3
</url>
</scm>
Modified: branches/topia-2.8.1.1/topia-persistence/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-persistence/pom.xml 2013-10-10 16:05:35 UTC (rev 2830)
+++ branches/topia-2.8.1.1/topia-persistence/pom.xml 2013-10-10 16:14:15 UTC (rev 2831)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3-SNAPSHOT</version>
+ <version>2.8.1.3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-migration/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-migration/pom.xml 2013-10-10 16:05:35 UTC (rev 2830)
+++ branches/topia-2.8.1.1/topia-service-migration/pom.xml 2013-10-10 16:14:15 UTC (rev 2831)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3-SNAPSHOT</version>
+ <version>2.8.1.3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-replication/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-replication/pom.xml 2013-10-10 16:05:35 UTC (rev 2830)
+++ branches/topia-2.8.1.1/topia-service-replication/pom.xml 2013-10-10 16:14:15 UTC (rev 2831)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3-SNAPSHOT</version>
+ <version>2.8.1.3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-security/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-security/pom.xml 2013-10-10 16:05:35 UTC (rev 2830)
+++ branches/topia-2.8.1.1/topia-service-security/pom.xml 2013-10-10 16:14:15 UTC (rev 2831)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.3-SNAPSHOT</version>
+ <version>2.8.1.3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
r2830 - branches/topia-2.8.1.1/topia-persistence/src/main/java/org/nuiton/topia/framework
by tchemit@users.nuiton.org 10 Oct '13
by tchemit@users.nuiton.org 10 Oct '13
10 Oct '13
Author: tchemit
Date: 2013-10-10 18:05:35 +0200 (Thu, 10 Oct 2013)
New Revision: 2830
Url: http://nuiton.org/projects/topia/repository/revisions/2830
Log:
fixes #2871: TopiaContext#clear call TopiaContext#finalize method :(
Modified:
branches/topia-2.8.1.1/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
Modified: branches/topia-2.8.1.1/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java
===================================================================
--- branches/topia-2.8.1.1/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-10-10 13:46:08 UTC (rev 2829)
+++ branches/topia-2.8.1.1/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java 2013-10-10 16:05:35 UTC (rev 2830)
@@ -1223,7 +1223,13 @@
Query query = tx.getHibernate().createSQLQuery(sql);
query.executeUpdate();
tx.closeContext();
- root.finalize();
+
+ // Do not invoke finalize here, we are not garbage collector...
+ // duplicate then the previous code of the finalize method
+ root.closeContext();
+ root.hibernateFactory.close();
+ root.closed = true;
+// root.finalize();
} catch (Throwable eee) {
throw new TopiaException(
_("topia.persistence.error.on.clear", eee.getMessage()), eee);
1
0
r2829 - in branches/topia-2.8.1.1: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 10 Oct '13
by maven-release@users.nuiton.org 10 Oct '13
10 Oct '13
Author: maven-release
Date: 2013-10-10 15:46:08 +0200 (Thu, 10 Oct 2013)
New Revision: 2829
Url: http://nuiton.org/projects/topia/repository/revisions/2829
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
branches/topia-2.8.1.1/pom.xml
branches/topia-2.8.1.1/topia-persistence/pom.xml
branches/topia-2.8.1.1/topia-service-migration/pom.xml
branches/topia-2.8.1.1/topia-service-replication/pom.xml
branches/topia-2.8.1.1/topia-service-security/pom.xml
Modified: branches/topia-2.8.1.1/pom.xml
===================================================================
--- branches/topia-2.8.1.1/pom.xml 2013-10-10 13:46:03 UTC (rev 2828)
+++ branches/topia-2.8.1.1/pom.xml 2013-10-10 13:46:08 UTC (rev 2829)
@@ -37,7 +37,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>2.8.1.2</version>
+ <version>2.8.1.3-SNAPSHOT</version>
<modules>
<module>topia-persistence</module>
@@ -80,13 +80,13 @@
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.8.1.2
+ scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.8.1.1
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-2.8.1.2
+ scm:svn:http://svn.nuiton.org/svn/topia/branches/topia-2.8.1.1
</developerConnection>
<url>
- http://nuiton.org/projects/topia/repository/show/tags/topia-2.8.1.2
+ http://nuiton.org/projects/topia/repository/show/branches/topia-2.8.1.1
</url>
</scm>
Modified: branches/topia-2.8.1.1/topia-persistence/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-persistence/pom.xml 2013-10-10 13:46:03 UTC (rev 2828)
+++ branches/topia-2.8.1.1/topia-persistence/pom.xml 2013-10-10 13:46:08 UTC (rev 2829)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.2</version>
+ <version>2.8.1.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-migration/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-migration/pom.xml 2013-10-10 13:46:03 UTC (rev 2828)
+++ branches/topia-2.8.1.1/topia-service-migration/pom.xml 2013-10-10 13:46:08 UTC (rev 2829)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.2</version>
+ <version>2.8.1.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-replication/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-replication/pom.xml 2013-10-10 13:46:03 UTC (rev 2828)
+++ branches/topia-2.8.1.1/topia-service-replication/pom.xml 2013-10-10 13:46:08 UTC (rev 2829)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.2</version>
+ <version>2.8.1.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: branches/topia-2.8.1.1/topia-service-security/pom.xml
===================================================================
--- branches/topia-2.8.1.1/topia-service-security/pom.xml 2013-10-10 13:46:03 UTC (rev 2828)
+++ branches/topia-2.8.1.1/topia-service-security/pom.xml 2013-10-10 13:46:08 UTC (rev 2829)
@@ -35,7 +35,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>2.8.1.2</version>
+ <version>2.8.1.3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: maven-release
Date: 2013-10-10 15:46:03 +0200 (Thu, 10 Oct 2013)
New Revision: 2828
Url: http://nuiton.org/projects/topia/repository/revisions/2828
Log:
[maven-release-plugin] copy for tag topia-2.8.1.2
Added:
tags/topia-2.8.1.2/
Property changes on: tags/topia-2.8.1.2
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
atlassian-ide-plugin.xml
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0