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
r2271 - trunk/topia-persistence/src/main/java/org/nuiton/topia/generator
by fdesbois@users.nuiton.org 04 May '11
by fdesbois@users.nuiton.org 04 May '11
04 May '11
Author: fdesbois
Date: 2011-05-04 12:57:35 +0200 (Wed, 04 May 2011)
New Revision: 2271
Url: http://nuiton.org/repositories/revision/topia/2271
Log:
#1466 : remove noLog flag. Logs will no longer been generated.
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ServiceTransformer.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ServiceTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ServiceTransformer.java 2011-04-28 12:47:32 UTC (rev 2270)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/ServiceTransformer.java 2011-05-04 10:57:35 UTC (rev 2271)
@@ -195,14 +195,6 @@
protected String exceptionName;
- /**
- * flag to not use any logger code inside service method, globally set
- * for all the incoming model.
- *
- * @since 2.5
- */
- protected boolean noLog;
-
private static final String OP_NAME_BEGIN_TRANSACTION = "beginTransaction";
private static final String OP_NAME_COMMIT_TRANSACTION = "commitTransaction";
@@ -222,7 +214,6 @@
exceptionName =
TopiaGeneratorUtil.getExceptionClassTagValue(model);
modelName = model.getName();
- noLog = isNoLog(null, model);
}
@Override
@@ -233,14 +224,12 @@
// global transaction needed (if set to false then never use transaction)
boolean needTransaction = isTransactionNeeded(input);
- boolean noLog = this.noLog || isNoLog(input,null);
ObjectModelInterface serviceContract = createServiceContract(input);
createServiceAbstract(input,
serviceContract,
- needTransaction,
- noLog);
+ needTransaction);
}
/**
@@ -370,12 +359,10 @@
* @param source interface from model
* @param serviceContract to implement
* @param needTransaction flag to know if service globally use transaction
- * @param noLog a flag to not add any log code in body of methods
*/
protected void createServiceAbstract(ObjectModelInterface source,
ObjectModelInterface serviceContract,
- boolean needTransaction,
- boolean noLog) {
+ boolean needTransaction) {
ObjectModelClass serviceAbstract = createAbstractClass(
getServiceAbstractClassName(serviceContract.getName()),
@@ -386,23 +373,7 @@
addImport(serviceAbstract, TopiaContext.class);
}
addImport(serviceAbstract, I18n.class);
-// addImport(serviceAbstract, ArrayList.class);
-
- if (!noLog) {
- addImport(serviceAbstract, DurationFormatUtils.class);
- // Add Logger attribute
- addAttribute(serviceAbstract, "log",
- Log.class,
- "LogFactory.getLog(" + source.getName() + ".class)",
- ObjectModelModifier.PRIVATE,
- ObjectModelModifier.STATIC,
- ObjectModelModifier.FINAL);
-
- addImport(serviceAbstract, Log.class);
- addImport(serviceAbstract, LogFactory.class);
- }
-
// Implements contract interface
addInterface(serviceAbstract, serviceContract.getQualifiedName());
@@ -454,8 +425,7 @@
executeOperation,
operation,
source.getName(),
- needTransaction,
- noLog
+ needTransaction
);
}
}
@@ -522,7 +492,6 @@
* @param source ObjectModelOperation from model
* @param serviceContractName where the signature method is defined
* @param needTransaction flag to know if service globally use transaction
- * @param noLog a flag to not add any log inside method
* @see #isErrorArgsNeeded(ObjectModelOperation)
* @see #isTransactionNeeded(ObjectModelInterface)
*/
@@ -531,8 +500,7 @@
ObjectModelOperation abstOp,
ObjectModelOperation source,
String serviceContractName,
- boolean needTransaction,
- boolean noLog) {
+ boolean needTransaction) {
// boolean to specify if the method need a transaction or not
// Default set to true but can be override by a tagvalue on the
@@ -559,13 +527,6 @@
for (ObjectModelParameter param : source.getParameters()) {
String paramName = param.getName();
addParameter(implOp, param.getType(), paramName);
- if (!noLog) {
- // Prepare Log
- toStringAppend +=
- "\n\t\t\t.append(\"" + separatorLog + paramName + " = \")" +
- ".append(" + paramName + ")";
- separatorLog = " _ ";
- }
}
// Use buffer for operation body
@@ -629,43 +590,11 @@
}
String implName = StringUtils.capitalize(implOp.getName());
String first = modelName.substring(0, 1);
-
- if (!noLog) {
- buffer.append(""
- /*{
- long startTime = 0;
- if (log.isDebugEnabled()) {
- log.debug("<%=first%>:[ begin <%=implName%> ]");
- startTime = System.currentTimeMillis();
- }
- if (log.isTraceEnabled()) {
- String message = new StringBuilder("# ARGS >")<%=toStringAppend%>.
- toString();
- log.trace(message);
- }
- }*/);
- }
-
buffer.append(""
/*{
<%=abstReturnType%><%=abstName%>(<%=abstParams%>);}*/);
- if (!noLog) {
-
- buffer.append(""
- /*{
-
- if (log.isDebugEnabled()) {
- long stopTime = System.currentTimeMillis();
- Runtime runtime = Runtime.getRuntime();
- long mem = (runtime.totalMemory() - runtime.freeMemory()) / 1048576;
- log.debug("<%=first%>:[ end <%=implName%> ] Time = " +
- DurationFormatUtils.formatDurationHMS(
- stopTime - startTime) + " _ Memory = " + mem + " Mo");
- }}*/
- );
- }
if (needTransaction && isCommit(source, model)) {
// add the commit instruction
@@ -758,29 +687,6 @@
}
/**
- * boolean to specify if inside the method body we should add log informations.
- *
- * @param anInterface model element where the tagvalue is set
- * @param model model where to tagvalue can be also set
- * @return {@code true} if no log will be generated insde body's method
- * @see TopiaTagValues#TAG_NO_LOG_IN_SERVICE
- */
- protected boolean isNoLog(ObjectModelInterface anInterface,
- ObjectModel model) {
- boolean noLog = false;
-
- String tagValue = TopiaGeneratorUtil.getNoLogInServiceTagValue(
- anInterface,
- model
- );
-
- if (tagValue != null) {
- noLog = Boolean.parseBoolean(tagValue);
- }
- return noLog;
- }
-
- /**
* boolean to specify if method needs a commit after the executeXXX code invoked.
*
* @param op model element where the tagvalue is set
1
0
Author: tchemit
Date: 2011-04-28 14:47:32 +0200 (Thu, 28 Apr 2011)
New Revision: 2270
Url: http://nuiton.org/repositories/revision/topia/2270
Log:
add svn properties
Evolution #1488: Integrates spanish i18n translations
Added:
trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties
trunk/topia-service-migration/src/main/resources/i18n/topia-service-migration_es_ES.properties
trunk/topia-service-replication/src/main/resources/i18n/topia-service-replication_es_ES.properties
Modified:
trunk/pom.xml
trunk/topia-persistence/
trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties
trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties
trunk/topia-persistence/src/site/resources/ClassDiagram_BookAuthor.png
trunk/topia-persistence/src/site/resources/ClassDiagram_BookAuthorWithOperation.png
trunk/topia-persistence/src/site/rst/index.rst
trunk/topia-persistence/src/site/rst/user/continue_devel.rst
trunk/topia-persistence/src/site/rst/user/extend_model.rst
trunk/topia-persistence/src/site/rst/user/start.rst
trunk/topia-persistence/src/site/rst/user/start_using_api.rst
trunk/topia-tutorial/LICENSE.txt
trunk/topia-tutorial/README.txt
trunk/topia-tutorial/changelog.txt
trunk/topia-tutorial/pom.xml
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java
trunk/topia-tutorial/src/main/resources/library-config.properties
trunk/topia-tutorial/src/main/resources/log4j.properties
trunk/topia-tutorial/src/main/xmi/library.properties
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-16 22:15:02 UTC (rev 2269)
+++ trunk/pom.xml 2011-04-28 12:47:32 UTC (rev 2270)
@@ -257,12 +257,15 @@
<!-- libs version -->
<eugeneVersion>2.3.3</eugeneVersion>
- <nuitonUtilsVersion>2.1.1</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.2-SNAPSHOT</nuitonUtilsVersion>
<processorPluginVersion>1.2.1</processorPluginVersion>
<nuitonI18nVersion>2.3.2</nuitonI18nVersion>
<xmlrpcVersion>3.1.2</xmlrpcVersion>
<hibernateVersion>3.3.2.GA</hibernateVersion>
+ <!-- i18n configuration -->
+ <i18n.bundles>fr_FR,en_GB,es_ES</i18n.bundles>
+
</properties>
<build>
Property changes on: trunk/topia-persistence
___________________________________________________________________
Modified: svn:ignore
- *.ipr
*.iws
.classpath
.project
target
nbproject
.settings
+ *.ipr
*.iws
*.iml
.classpath
.project
target
nbproject
.settings
Modified: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties
===================================================================
--- trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties 2011-04-16 22:15:02 UTC (rev 2269)
+++ trunk/topia-persistence/src/main/resources/i18n/topia-persistence_en_GB.properties 2011-04-28 12:47:32 UTC (rev 2270)
@@ -5,14 +5,10 @@
topia.persistence.error.empty.doc=Empty document
topia.persistence.error.no.hibernate.session=No hinernate session found, you must at first, open a new transaction via 'beaginTransaction' method.
topia.persistence.error.null.param=The method '%1$s' requires a non null parameter '%2$s'.
-topia.persistence.error.on.backup=An error occurs while backup operation \: %1$s
-topia.persistence.error.on.clear=An error occurs while clear operation \: %1$s
topia.persistence.error.on.commit=An error occurs while commit operation \: %1$s
topia.persistence.error.on.export=An error occurs while export operation \: %1$s
topia.persistence.error.on.loding.xml.doc=Could not read xml document for following reason \: %1$s
topia.persistence.error.on.query=An error occurs while query operation \: %1$s
-topia.persistence.error.on.replicate=An error occurs while replicate operation \: %1$s
-topia.persistence.error.on.restore=An error occurs while restore operation \: %1$s
topia.persistence.error.on.rollback=An error occurs while rollback operation \: %1$s
topia.persistence.error.open.transaction.failed=An error occurs while asking a new transaction \: %1$s
topia.persistence.error.replicate.entity=Could not replicate entity '%1$s' pour following reason \: %2$s
@@ -23,7 +19,6 @@
topia.persistence.error.service.unknown=The service %1$s of type %2$s was not found.
topia.persistence.error.unsupported.class=The following entity type %1$s is not managed by this context, you probably forgot to declare it.
topia.persistence.error.unsupported.operation.on.closed.context=This context is closed, it is not possible to release the operation '%1$s'
-topia.persistence.error.unsupported.operation.on.root.context=Operation '%1$s' not possible on root context (use a sub transaction).
topia.persistence.error.update.schema=Schema could not be updated for following reason \: %1$s
topia.persistence.service.loaded=Service '%1$s' loaded (implementation %2$s)
topia.persistence.supported.classes.for.context=List of supported persistence classes \: %1$s
Added: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties
===================================================================
--- trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties (rev 0)
+++ trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties 2011-04-28 12:47:32 UTC (rev 2270)
@@ -0,0 +1,28 @@
+topia.persistence.error.class.not.found=No ha sido encontrada la clase persistente %1$s
+topia.persistence.error.context.already.closed=El contexto ya ha sido cerrado
+topia.persistence.error.context.is.closed=Este contexto ya ha sido cerrado, no se puede comenzar una transacci\u00F3n
+topia.persistence.error.create.schema=No se puede crear el esquema debido a la raz\u00F3n siguiente \: %2$s
+topia.persistence.error.empty.doc=Documento vac\u00EDo
+topia.persistence.error.no.hibernate.session=No se encuentra ninguna sesi\u00F3n hibernada, debe iniciar una transacci\u00F3n con el m\u00E9todo 'BeginTransaction'
+topia.persistence.error.null.param=El m\u00E9todo '%1$s' requiere un par\u00E1metro '%2$s' no nulo.
+topia.persistence.error.on.commit=Se produjo un error durante el guardado \: %1$s
+topia.persistence.error.on.export=Se produjo un error durante la exportaci\u00F3n \: %1$s
+topia.persistence.error.on.loding.xml.doc=No se puede leer el documento debido a \: %1$s
+topia.persistence.error.on.query=Se produjo un error duratne la busqueda (consulta %1$s) \: %2$s
+topia.persistence.error.on.rollback=Se produjo un error durante la vuelta a atr\u00E1s (rollback) \: %1$s
+topia.persistence.error.open.transaction.failed=
+topia.persistence.error.replicate.entity=Error de repliaci\u00F3n de la entidad %1$s\ndebido a la siguiente raz\u00F3n \: %2$s
+topia.persistence.error.replicate.on.same.context=No se puede duplicar en la misma base
+topia.persistence.error.rootContext.access=Est\u00E1 usted en la ra\u00EDz, debe abrir una transacci\u00F3n para acceder a los datos.
+topia.persistence.error.service.not.found=El servicio %1$s no est\u00E1 disponible
+topia.persistence.error.service.not.retreaved=El servicio %1$s debido a \: %2$s
+topia.persistence.error.service.unknown=El servicio '%1$s' de clase '%2$s' es desconocido
+topia.persistence.error.unsupported.class=La clase %1$n no est\u00E1 soportada por TopiaContext, puede que se halla olvidado de a\u00F1adir su mapa
+topia.persistence.error.unsupported.operation.on.closed.context=El contexto est\u00E1 cerrado, no se puede realizar la operaci\u00F3n %1$s
+topia.persistence.error.update.schema=El esquema no se puede actualizar debido a \: %2$s
+topia.persistence.service.loaded=Servicio '%1$s' cargado por '%2$s'
+topia.persistence.supported.classes.for.context=Classes support\u00E9es par ce TopiaContext \: %1$s
+topia.persistence.warn.service.not.found=El nombre del servicio '%1$s' no ha sido encontrado debido a \: %2$s
+topia.persistence.warn.service.not.loaded=Le service de cl\u00E9 '%1$s' tiene un nombre de servicio '%2$s' diferente \! (servicio desactivado)
+topia.persistence.warn.service.not.postInit=El servicio '%1$s' no puede ser inicializado (servicio desactivado)
+topia.persistence.warn.service.not.preInit=El servicio '%1$s' no puede ser inicializado (servicio desactivado)
Property changes on: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_es_ES.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties
===================================================================
--- trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties 2011-04-16 22:15:02 UTC (rev 2269)
+++ trunk/topia-persistence/src/main/resources/i18n/topia-persistence_fr_FR.properties 2011-04-28 12:47:32 UTC (rev 2270)
@@ -5,14 +5,10 @@
topia.persistence.error.empty.doc=Document vide
topia.persistence.error.no.hibernate.session=Aucune session hibernate trouv\u00E9e, vous devez d\u00E9marr\u00E9 une transaction avec la m\u00E9thode 'beginTransaction'
topia.persistence.error.null.param=La m\u00E9thode '%1$s' requi\u00E8re un param\u00E8tre '%2$s' non null.
-topia.persistence.error.on.backup=Une erreur est apparue pendant la sauvegarde \: %1$s
-topia.persistence.error.on.clear=Une erreur est apparue pendant le nettoyage \: %1$s
topia.persistence.error.on.commit=Une erreur est apparue pendant le commit \: %1$s
topia.persistence.error.on.export=Une erreur est apparue pendant l'export \: %1$s
topia.persistence.error.on.loding.xml.doc=Lecture du document impossible pour la raison suivante \: %1$s
topia.persistence.error.on.query=Une erreur est apparue pendant le recherche (requ\u00EAte %1$s) \: %2$s
-topia.persistence.error.on.replicate=Une erreur est apparue pendant la replication \: %1$s
-topia.persistence.error.on.restore=Une erreur est apparue pendant le restore \: %1$s
topia.persistence.error.on.rollback=Une erreur est apparue pendant le rollback \: %1$s
topia.persistence.error.open.transaction.failed=Une erreur est apparue pendant la demande de transaction \: %1$s
topia.persistence.error.replicate.entity=Echec de replication de l'entite %1$s\npour la raison suivante \: %2$s
@@ -23,7 +19,6 @@
topia.persistence.error.service.unknown=Le service '%1$s' ayant pour classe '%2$s' n'est pas connu
topia.persistence.error.unsupported.class=La classe %1$s n'est pas support\u00E9e par ce TopiaContext, vous avez sans doute oubli\u00E9 d'ajouter son mapping
topia.persistence.error.unsupported.operation.on.closed.context=Ce contexte a \u00E9t\u00E9 ferm\u00E9, impossible de r\u00E9aliser l'op\u00E9ration %1$s
-topia.persistence.error.unsupported.operation.on.root.context=Vous \u00EAtes sur le root context l'op\u00E9ration %1$s est impossible
topia.persistence.error.update.schema=Le sch\u00E9ma n'a pas pu \u00EAtre mis \u00E0 jour pour la raison suivante \: %2$s
topia.persistence.service.loaded=Service '%1$s' charg\u00E9 par '%2$s'
topia.persistence.supported.classes.for.context=Classes support\u00E9es par ce TopiaContext \: %1$s
Property changes on: trunk/topia-persistence/src/site/resources/ClassDiagram_BookAuthor.png
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/topia-persistence/src/site/resources/ClassDiagram_BookAuthorWithOperation.png
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-persistence/src/site/rst/index.rst
===================================================================
--- trunk/topia-persistence/src/site/rst/index.rst 2011-04-16 22:15:02 UTC (rev 2269)
+++ trunk/topia-persistence/src/site/rst/index.rst 2011-04-28 12:47:32 UTC (rev 2270)
@@ -2,8 +2,8 @@
.. * #%L
.. * ToPIA :: Persistence
.. *
-.. * $Id: index.rst 2251 2011-04-16 10:09:55Z bleny $
-.. * $HeadURL: http://svn.nuiton.org/svn/topia/trunk/topia-persistence/src/site/rst/index.… $
+.. * $Id$
+.. * $HeadURL$
.. * %%
.. * Copyright (C) 2004 - 2010 CodeLutin
.. * %%
Property changes on: trunk/topia-persistence/src/site/rst/index.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/topia-persistence/src/site/rst/user/continue_devel.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/topia-persistence/src/site/rst/user/extend_model.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/topia-persistence/src/site/rst/user/start.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/topia-persistence/src/site/rst/user/start_using_api.rst
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-service-migration/src/main/resources/i18n/topia-service-migration_es_ES.properties
===================================================================
--- trunk/topia-service-migration/src/main/resources/i18n/topia-service-migration_es_ES.properties (rev 0)
+++ trunk/topia-service-migration/src/main/resources/i18n/topia-service-migration_es_ES.properties 2011-04-28 12:47:32 UTC (rev 2270)
@@ -0,0 +1,14 @@
+topia.migration.available.versions=Versiones detectadas \: %1$s
+topia.migration.db.not.versionned=La base de datos no tiene versi\u00F3n, se considera como la versi\u00F3n 0.
+topia.migration.detected.db.version=Versi\u00F3n de la base \: %1$s
+topia.migration.end.sql=Consulta [%1$-4s/%2$-4s] ejecutada en %3$s.
+topia.migration.migrate.versions=Actualizaci\u00F3n para instalar \: %1$s
+topia.migration.migration.incomplete=\\u00a1La migraci\u00F3n de la base de datos ha fallado o se ha cancelado\!
+topia.migration.saving.db.version=Copia de seguridad de la nueva versi\u00F3n de la base \: %1$s
+topia.migration.skip.migration.db.is.empty=Base de datos vac\u00EDa, no es necesaria la migraci\u00F3n.
+topia.migration.skip.migration.db.is.up.to.date=La base est\u00E1 actualizada, no es necesaria ninguna migraci\u00F3n.
+topia.migration.skip.migration.no.version.to.apply=No hay versi\u00F3n a aplicar, no es necesaria ninguna migraci\u00F3n.
+topia.migration.start.migrate=Inicio de la actualizaci\u00F3n hacia la versi\u00F3n %1$s
+topia.migration.start.migration=Inicio del servicio de actualizaci\u00F3n - versi\u00F3n de la aplicaci\u00F3n \: %1$s, versi\u00F3n de la base \: %2$s
+topia.migration.start.sql=Ejecuci\u00F3n de la consulta [%1$-4s/%2$-4s]
+topia.migration.start.sqls=Se va a ejecutar %1$s consulta(s)...
Property changes on: trunk/topia-service-migration/src/main/resources/i18n/topia-service-migration_es_ES.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/topia-service-replication/src/main/resources/i18n/topia-service-replication_es_ES.properties
===================================================================
--- trunk/topia-service-replication/src/main/resources/i18n/topia-service-replication_es_ES.properties (rev 0)
+++ trunk/topia-service-replication/src/main/resources/i18n/topia-service-replication_es_ES.properties 2011-04-28 12:47:32 UTC (rev 2270)
@@ -0,0 +1,5 @@
+topia.replication.attachAssociation.nothing.to.do=Rien a attacher...
+topia.replication.error.operation.loadLink.illegalSource=Le noeud source de l'op\u00E9ration de chargement d'association attendait un noeud %1$s mais a trouv\u00E9 le noeud %2$s.
+topia.replication.error.operation.uncreatable=La operaci\u00F3n %1$s es interna y no puede ser creada por el API para a\u00F1adir la operaci\u00F3n.
+topia.replication.error.unkown.operation=La operaci\u00F3n %1$s es desconocida, operaciones conocidas \: %2$s
+topia.replication.error.unkown.owner.node=El nodo rattachement (de tipo %1$s) para la operaci\u00F3n %2$s no ha sido encontrado, nodos conocidos \: %3$s
Property changes on: trunk/topia-service-replication/src/main/resources/i18n/topia-service-replication_es_ES.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/LICENSE.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/README.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/changelog.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/pom.xml
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/resources/library-config.properties
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/resources/log4j.properties
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/main/xmi/library.properties
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java
___________________________________________________________________
Added: svn:eol-style
+ native
1
0
r2269 - trunk/topia-persistence/src/test/java/org/nuiton/topia/framework
by fdesbois@users.nuiton.org 16 Apr '11
by fdesbois@users.nuiton.org 16 Apr '11
16 Apr '11
Author: fdesbois
Date: 2011-04-17 00:15:02 +0200 (Sun, 17 Apr 2011)
New Revision: 2269
Url: http://nuiton.org/repositories/revision/topia/2269
Log:
Use not deprecated constants
Modified:
trunk/topia-persistence/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java
Modified: trunk/topia-persistence/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java
===================================================================
--- trunk/topia-persistence/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java 2011-04-16 22:10:21 UTC (rev 2268)
+++ trunk/topia-persistence/src/test/java/org/nuiton/topia/framework/TopiaContextImplTest.java 2011-04-16 22:15:02 UTC (rev 2269)
@@ -35,6 +35,7 @@
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.i18n.I18n;
+import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaNotFoundException;
import org.nuiton.topiatest.persistence.Entity1;
import org.nuiton.topiatest.persistence.Entity1Impl;
@@ -260,7 +261,7 @@
/** EXEC METHOD **/
log.info("test 1 : load mappings from directory");
- properties.setProperty(TopiaContextImpl.TOPIA_PERSISTENCE_DIRECTORIES,
+ properties.setProperty(TopiaContextFactory.CONFIG_PERSISTENCE_DIRECTORIES,
persistenceDir.getAbsolutePath());
context.config = properties;
@@ -282,7 +283,7 @@
properties.clear();
// use property TOPIA_PERSISTENCE_CLASSES
- properties.setProperty(TopiaContextImpl.TOPIA_PERSISTENCE_CLASSES,
+ properties.setProperty(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
Entity1Impl.class.getName());
context.config = properties;
@@ -299,7 +300,7 @@
// use property TOPIA_PERSISTENCE_PROPERTIES_FILE to add default
// properties from file
- properties.setProperty(TopiaContextImpl.TOPIA_PERSISTENCE_PROPERTIES_FILE,
+ properties.setProperty(TopiaContextFactory.CONFIG_PERSISTENCE_PROPERTIES_FILE,
resourcesDir + File.separator + "TopiaContextImpl.properties");
context.config = properties;
1
0
r2268 - in trunk/topia-tutorial: . src/main/java/org/nuiton/topia/tutorial/library src/main/java/org/nuiton/topia/tutorial/library/model src/main/java/org/nuiton/topia/tutorial/library/service src/main/resources src/main/xmi src/test/java/org/nuiton/topia/tutorial/library src/test/java/org/nuiton/topia/tutorial/library/service
by fdesbois@users.nuiton.org 16 Apr '11
by fdesbois@users.nuiton.org 16 Apr '11
16 Apr '11
Author: fdesbois
Date: 2011-04-17 00:10:21 +0200 (Sun, 17 Apr 2011)
New Revision: 2268
Url: http://nuiton.org/repositories/revision/topia/2268
Log:
- Add test with service
- Add svn:keywords and license header
Added:
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java
Modified:
trunk/topia-tutorial/LICENSE.txt
trunk/topia-tutorial/README.txt
trunk/topia-tutorial/changelog.txt
trunk/topia-tutorial/pom.xml
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java
trunk/topia-tutorial/src/main/resources/library-config.properties
trunk/topia-tutorial/src/main/resources/log4j.properties
trunk/topia-tutorial/src/main/xmi/library.properties
trunk/topia-tutorial/src/main/xmi/library.zargo
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java
Property changes on: trunk/topia-tutorial/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/topia-tutorial/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/topia-tutorial/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/topia-tutorial/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
===================================================================
--- trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java 2011-04-16 22:05:35 UTC (rev 2267)
+++ trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -1,5 +1,28 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
package org.nuiton.topia.tutorial.library;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.i18n.init.I18nInitializer;
@@ -19,6 +42,8 @@
*/
public class LibraryConfig {
+ private static final Log log = LogFactory.getLog(LibraryConfig.class);
+
protected static final String CONFIG_FILENAME = "library-config.properties";
protected ApplicationConfig config;
@@ -43,6 +68,10 @@
// Initialize I18n to display Topia log messages
I18nInitializer i18nInitializer = new DefaultI18nInitializer("library-bundle");
I18n.init(i18nInitializer, getLocale());
+
+ if (log.isDebugEnabled()) {
+ config.printConfig();
+ }
}
/**
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java
===================================================================
--- trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java (rev 0)
+++ trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -0,0 +1,48 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
+package org.nuiton.topia.tutorial.library;
+
+/**
+ * Created: 16/04/11
+ *
+ * @author fdesbois <desbois(a)codelutin.com>
+ * $Id$
+ */
+public class LibraryException extends RuntimeException {
+
+ public LibraryException() {
+ super();
+ }
+
+ public LibraryException(String message) {
+ super(message);
+ }
+
+ public LibraryException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public LibraryException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java
===================================================================
--- trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java 2011-04-16 22:05:35 UTC (rev 2267)
+++ trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -1,3 +1,24 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
package org.nuiton.topia.tutorial.library.model;
/**
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/model/AuthorImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java
===================================================================
--- trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java (rev 0)
+++ trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -0,0 +1,36 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
+package org.nuiton.topia.tutorial.library.service;
+
+import org.nuiton.topia.tutorial.library.model.Book;
+
+/**
+ * Created: 16/04/11
+ *
+ * @author fdesbois <desbois(a)codelutin.com>
+ * $Id$
+ */
+public interface BookService {
+
+ Book saveBook(Book book);
+
+}
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java
===================================================================
--- trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java (rev 0)
+++ trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -0,0 +1,168 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
+package org.nuiton.topia.tutorial.library.service;
+
+import org.apache.commons.lang.StringUtils;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.tutorial.library.LibraryConfig;
+import org.nuiton.topia.tutorial.library.LibraryException;
+import org.nuiton.topia.tutorial.library.model.Book;
+import org.nuiton.topia.tutorial.library.model.BookDAO;
+import org.nuiton.topia.tutorial.library.model.LibraryDAOHelper;
+
+/**
+ * Created: 16/04/11
+ *
+ * @author fdesbois <desbois(a)codelutin.com>
+ * $Id$
+ */
+public class BookServiceImpl implements BookService {
+
+ protected LibraryConfig config;
+
+ protected TopiaContext rootContext;
+
+ /**
+ * New BookServiceImpl with configuration injection.
+ *
+ * @param config Configuration that contains application properties needed
+ * to retrieve the TopiaContext root.
+ */
+ public BookServiceImpl(LibraryConfig config) {
+ this.config = config;
+ }
+
+ /**
+ * Get root TopiaContext using config properties.
+ *
+ * @return the TopiaContext root
+ * @throws TopiaNotFoundException if no TopiaContext can't be found
+ */
+ protected TopiaContext getRootContext() throws TopiaNotFoundException {
+ if (rootContext == null) {
+ rootContext = TopiaContextFactory.getContext(config.getProperties());
+ }
+ return rootContext;
+ }
+
+ /**
+ * Begin a new transaction with application exception encapsulation on
+ * errors.
+ *
+ * @return a new TopiaContext
+ * @throws LibraryException for any errors during beginTransaction
+ * @see TopiaContext#beginTransaction()
+ */
+ protected TopiaContext beginTransaction() throws LibraryException {
+ TopiaContext transaction;
+ try {
+ transaction = getRootContext().beginTransaction();
+ } catch (TopiaException ex) {
+ throw new LibraryException("Error on start", ex);
+ }
+ return transaction;
+ }
+
+
+ /**
+ * Close the {@code transaction} with application exception encapsulation
+ * on errors.
+ *
+ * @param transaction TopiaContext to close
+ * @throws LibraryException for any errors during closeContext
+ * @see TopiaContext#closeContext()
+ */
+ protected void closeTransaction(TopiaContext transaction) throws LibraryException {
+ if (transaction != null) {
+ try {
+ transaction.closeContext();
+ } catch (TopiaException ex) {
+ throw new LibraryException("Error on close", ex);
+ }
+ }
+ }
+
+ /**
+ * Treate {@code caught} exception and rollback {@code transaction} if
+ * necessary.
+ *
+ * @param caught Exception to treate
+ * @param transaction TopiaContext to rollback if necessary
+ * @throws LibraryException encapsulate all errors
+ */
+ protected void onException(Throwable caught, TopiaContext transaction) throws LibraryException {
+
+ if (transaction != null) {
+
+ // Rollback exception
+ try {
+ transaction.rollbackTransaction();
+ } catch (TopiaException ex) {
+ throw new LibraryException("Error on rollback", ex);
+ }
+ }
+
+ // Escape LibraryException
+ if (caught instanceof LibraryException) {
+ throw (LibraryException) caught;
+
+ } else {
+ // Encapsulate caught exception
+ throw new LibraryException("Unexpected error", caught);
+ }
+ }
+
+ @Override
+ public Book saveBook(Book book) {
+
+ Book result = null;
+
+ // Start transaction
+ TopiaContext transaction = beginTransaction();
+ try {
+ BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
+
+ // Business, create or update the book entity
+ if (StringUtils.isBlank(book.getTopiaId())) {
+ result = dao.create(book);
+ } else {
+ result = dao.update(book);
+ }
+
+ transaction.commitTransaction();
+
+ } catch (Exception ex) {
+
+ // Treate all errors
+ onException(ex, transaction);
+
+ // Always close the transaction
+ } finally {
+ closeTransaction(transaction);
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/service/BookServiceImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-tutorial/src/main/resources/library-config.properties
===================================================================
--- trunk/topia-tutorial/src/main/resources/library-config.properties 2011-04-16 22:05:35 UTC (rev 2267)
+++ trunk/topia-tutorial/src/main/resources/library-config.properties 2011-04-16 22:10:21 UTC (rev 2268)
@@ -1,3 +1,24 @@
+###
+# #%L
+# ToPIA :: Tutorial Library
+# %%
+# Copyright (C) 2011 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%
+###
# Default url to database, this path will delete the database on mvn clean
# You can override this configuration using an other properties file in user directory
# For linux system : ~/.local/library/library-config.properties
Property changes on: trunk/topia-tutorial/src/main/resources/library-config.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-tutorial/src/main/resources/log4j.properties
===================================================================
--- trunk/topia-tutorial/src/main/resources/log4j.properties 2011-04-16 22:05:35 UTC (rev 2267)
+++ trunk/topia-tutorial/src/main/resources/log4j.properties 2011-04-16 22:10:21 UTC (rev 2268)
@@ -2,8 +2,8 @@
# #%L
# ToPIA :: Persistence
#
-# $Id: log4j.properties 2245 2011-04-14 12:47:09Z tchemit $
-# $HeadURL: http://svn.nuiton.org/svn/topia/trunk/topia-persistence/src/test/resources/… $
+# $Id$
+# $HeadURL$
# %%
# Copyright (C) 2004 - 2010 CodeLutin
# %%
@@ -31,4 +31,6 @@
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
+log4j.logger.org.hibernate=INFO
log4j.logger.org.nuiton.topia=INFO
+log4j.logger.org.nuiton.topia.tutorial=DEBUG
Property changes on: trunk/topia-tutorial/src/main/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-tutorial/src/main/xmi/library.properties
===================================================================
--- trunk/topia-tutorial/src/main/xmi/library.properties 2011-04-16 22:05:35 UTC (rev 2267)
+++ trunk/topia-tutorial/src/main/xmi/library.properties 2011-04-16 22:10:21 UTC (rev 2268)
@@ -1,3 +1,24 @@
+###
+# #%L
+# ToPIA :: Tutorial Library
+# %%
+# Copyright (C) 2011 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%
+###
# Properties file used by EUGene generator.
#
# It will contains tagvalue and stereotype definitions.
Property changes on: trunk/topia-tutorial/src/main/xmi/library.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/topia-tutorial/src/main/xmi/library.zargo
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java
===================================================================
--- trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java 2011-04-16 22:05:35 UTC (rev 2267)
+++ trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -1,3 +1,24 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
package org.nuiton.topia.tutorial.library;
import org.junit.After;
Property changes on: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java
===================================================================
--- trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java (rev 0)
+++ trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java 2011-04-16 22:10:21 UTC (rev 2268)
@@ -0,0 +1,87 @@
+/*
+ * #%L
+ * ToPIA :: Tutorial Library
+ * %%
+ * Copyright (C) 2011 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%
+ */
+package org.nuiton.topia.tutorial.library.service;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.tutorial.library.LibraryConfig;
+import org.nuiton.topia.tutorial.library.model.Book;
+import org.nuiton.topia.tutorial.library.model.BookImpl;
+import org.nuiton.util.ArgumentsParserException;
+
+/**
+ * Created: 16/04/11
+ *
+ * @author fdesbois <desbois(a)codelutin.com>
+ * $Id$
+ */
+public class BookServiceImplTest {
+
+ private static final Log log = LogFactory.getLog(BookServiceImplTest.class);
+
+ protected BookServiceImpl bookService;
+
+ @Before
+ public void setUp() throws ArgumentsParserException {
+
+ log.debug("setUp configuration for test");
+
+ LibraryConfig config = new LibraryConfig();
+
+ // Instantiate new service
+ bookService = new BookServiceImpl(config);
+ }
+
+ @After
+ public void tearDown() throws TopiaException {
+
+ // Close rootContext and drop the database (Work only with H2 database)
+ TopiaContext rootContext = bookService.getRootContext();
+ rootContext.clear(true);
+ }
+
+ @Test
+ public void testSaveBook() {
+
+ // ---- PREPARE DATA ---- //
+
+ Book book = new BookImpl();
+ book.setName("Topia for dummies");
+ book.setIsbn("T12");
+
+ // ---- EXECUTE ---- //
+
+ Book bookSaved = bookService.saveBook(book);
+
+ // ---- CHECK DATA ---- //
+
+ Assert.assertNotNull(bookSaved);
+ Assert.assertNotNull(bookSaved.getTopiaId());
+ }
+
+}
Property changes on: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/service/BookServiceImplTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
16 Apr '11
Author: fdesbois
Date: 2011-04-17 00:05:35 +0200 (Sun, 17 Apr 2011)
New Revision: 2267
Url: http://nuiton.org/repositories/revision/topia/2267
Log:
Resolve syntax problems
Modified:
trunk/topia-persistence/src/site/rst/user/start_using_api.rst
Modified: trunk/topia-persistence/src/site/rst/user/start_using_api.rst
===================================================================
--- trunk/topia-persistence/src/site/rst/user/start_using_api.rst 2011-04-16 21:21:26 UTC (rev 2266)
+++ trunk/topia-persistence/src/site/rst/user/start_using_api.rst 2011-04-16 22:05:35 UTC (rev 2267)
@@ -130,35 +130,34 @@
ToPIA contient une internationnalisation des messages utilisateurs (logs).
Il est préférable d'initialiser I18n pour accélérer la recherche des messages.
-Deux choses sont nécessaire :
- * Au démarrage de l'application ::
+Au démarrage de l'application ::
- I18nInitializer i18nInitializer = new DefaultI18nInitializer("library-bundle");
- I18n.init(i18nInitializer, new Locale("fr", "FR"));
+ I18nInitializer i18nInitializer = new DefaultI18nInitializer("library-bundle");
+ I18n.init(i18nInitializer, new Locale("fr", "FR"));
- * Configuration maven ::
+Configuration maven ::
- <!-- Plugin i18n pour gérer le bundle de messages -->
- <plugin>
- <groupId>org.nuiton.i18n</groupId>
- <artifactId>maven-i18n-plugin</artifactId>
- <version>${nuitonI18nVersion}</version>
- <executions>
- <!-- Cette exécution permet de rassembler tous les messages i18n
- dans un seul 'properties bundle' nommé library-bundle
- -->
- <execution>
- <id>make-bundle</id>
- <configuration>
- <bundleOutputName>library-bundle</bundleOutputName>
- </configuration>
- <goals>
- <goal>bundle</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <!-- Plugin i18n pour gérer le bundle de messages -->
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <version>${nuitonI18nVersion}</version>
+ <executions>
+ <!-- Cette exécution permet de rassembler tous les messages i18n
+ dans un seul 'properties bundle' nommé library-bundle
+ -->
+ <execution>
+ <id>make-bundle</id>
+ <configuration>
+ <bundleOutputName>library-bundle</bundleOutputName>
+ </configuration>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
Vous pourrez également utiliser `nuiton-i18n`_ pour l'internationnalisation de
votre application.
1
0
r2266 - in trunk: . topia-persistence/src/site/rst/user topia-tutorial topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library
by fdesbois@users.nuiton.org 16 Apr '11
by fdesbois@users.nuiton.org 16 Apr '11
16 Apr '11
Author: fdesbois
Date: 2011-04-16 23:21:26 +0200 (Sat, 16 Apr 2011)
New Revision: 2266
Url: http://nuiton.org/repositories/revision/topia/2266
Log:
#1465 : Include topia-tutorial module in release build of project
Add initialization for i18n + update doc
Added:
trunk/topia-tutorial/LICENSE.txt
trunk/topia-tutorial/README.txt
trunk/topia-tutorial/changelog.txt
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java
Removed:
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java
Modified:
trunk/pom.xml
trunk/topia-persistence/src/site/rst/user/start_using_api.rst
trunk/topia-tutorial/pom.xml
trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-04-16 21:18:53 UTC (rev 2265)
+++ trunk/pom.xml 2011-04-16 21:21:26 UTC (rev 2266)
@@ -105,11 +105,13 @@
<version>1.6.1</version>
</dependency>
- <!-- hibernate-core only include api, need core -->
+ <!-- hibernate-core only include api, need implementation,
+ binding with log4j will be used
+ -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
+ <version>1.6.1</version>
<scope>test</scope>
</dependency>
@@ -260,7 +262,7 @@
<nuitonI18nVersion>2.3.2</nuitonI18nVersion>
<xmlrpcVersion>3.1.2</xmlrpcVersion>
<hibernateVersion>3.3.2.GA</hibernateVersion>
-
+
</properties>
<build>
@@ -328,6 +330,13 @@
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <prepareVerifyArgs>-Ptutorial</prepareVerifyArgs>
+ </configuration>
+ </plugin>
+
</plugins>
</pluginManagement>
@@ -338,6 +347,35 @@
<excludeDefaults>true</excludeDefaults>
</reporting>
+ <profiles>
+
+ <!-- Build tutorial -->
+ <profile>
+ <id>tutorial</id>
+ <modules>
+ <module>topia-tutorial</module>
+ </modules>
+ </profile>
+
+ <!-- This profile is here just to make more automatic release.
+ This profile will be use to do a releasse:prepare, this modules are not
+ in default build but need to be release
+ -->
+ <profile>
+ <id>extra-modules</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <modules>
+ <module>topia-tutorial</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
<!-- ************************************************************* -->
<!-- *** Build Environment ************************************** -->
<!-- ************************************************************* -->
Modified: trunk/topia-persistence/src/site/rst/user/start_using_api.rst
===================================================================
--- trunk/topia-persistence/src/site/rst/user/start_using_api.rst 2011-04-16 21:18:53 UTC (rev 2265)
+++ trunk/topia-persistence/src/site/rst/user/start_using_api.rst 2011-04-16 21:21:26 UTC (rev 2266)
@@ -12,7 +12,6 @@
nécessaire. Dans le fichier ``src/main/resources/library-config.properties``, on
définit
-
::
# Pour démarrer, on utilisera une base H2
@@ -32,7 +31,29 @@
# affiche toutes les requêtes effectuées sur la base dans la console
hibernate.show_sql=true
+Sans oublier les dépendances nécessaires à l'exécution ::
+ <dependencies>
+ ...
+
+ <!-- Implémentation pour les logger -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${sl4jVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Driver pour la base de données H2 -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2Version}</version>
+ </dependency>
+
+ </dependencies>
+
+
Développer un premier service
=============================
@@ -104,9 +125,49 @@
Suppression d'une entité.
+Configuration I18n
+------------------
+
+ToPIA contient une internationnalisation des messages utilisateurs (logs).
+Il est préférable d'initialiser I18n pour accélérer la recherche des messages.
+Deux choses sont nécessaire :
+
+ * Au démarrage de l'application ::
+
+ I18nInitializer i18nInitializer = new DefaultI18nInitializer("library-bundle");
+ I18n.init(i18nInitializer, new Locale("fr", "FR"));
+
+ * Configuration maven ::
+
+ <!-- Plugin i18n pour gérer le bundle de messages -->
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <version>${nuitonI18nVersion}</version>
+ <executions>
+ <!-- Cette exécution permet de rassembler tous les messages i18n
+ dans un seul 'properties bundle' nommé library-bundle
+ -->
+ <execution>
+ <id>make-bundle</id>
+ <configuration>
+ <bundleOutputName>library-bundle</bundleOutputName>
+ </configuration>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+Vous pourrez également utiliser `nuiton-i18n`_ pour l'internationnalisation de
+votre application.
+
+.. _nuiton-i18n: http://maven-site.nuiton.org/i18n/
+
Exemple complet
---------------
-Un exemple complet dans MainTest_.
+Un exemple complet dans StartTest_.
-.. _MainTest: http://svn.nuiton.org/svn/topia/trunk/topia-tutorial/src/test/java/org/nuit…
\ No newline at end of file
+.. _StartTest: http://svn.nuiton.org/svn/topia/trunk/topia-tutorial/src/test/java/org/nuit…
\ No newline at end of file
Added: trunk/topia-tutorial/LICENSE.txt
===================================================================
--- trunk/topia-tutorial/LICENSE.txt (rev 0)
+++ trunk/topia-tutorial/LICENSE.txt 2011-04-16 21:21:26 UTC (rev 2266)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Added: trunk/topia-tutorial/README.txt
===================================================================
--- trunk/topia-tutorial/README.txt (rev 0)
+++ trunk/topia-tutorial/README.txt 2011-04-16 21:21:26 UTC (rev 2266)
@@ -0,0 +1,3 @@
+Tutorial for topia
+
+see documentation : http://maven-site.nuiton.org/topia/topia-persistence/index.html
Added: trunk/topia-tutorial/changelog.txt
===================================================================
--- trunk/topia-tutorial/changelog.txt (rev 0)
+++ trunk/topia-tutorial/changelog.txt 2011-04-16 21:21:26 UTC (rev 2266)
@@ -0,0 +1,3 @@
+Changelog is no more maintained
+
+see nuiton.org forge for changes : http://nuiton.org/projects/show/topia
Modified: trunk/topia-tutorial/pom.xml
===================================================================
--- trunk/topia-tutorial/pom.xml 2011-04-16 21:18:53 UTC (rev 2265)
+++ trunk/topia-tutorial/pom.xml 2011-04-16 21:21:26 UTC (rev 2266)
@@ -2,55 +2,48 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>topia</artifactId>
+ <version>2.5.4-SNAPSHOT</version>
+ </parent>
+
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-tutorial</artifactId>
- <version>1.0</version>
- <packaging>jar</packaging>
- <properties>
+ <dependencies>
- <maven.compiler.source>1.6</maven.compiler.source>
- <maven.compiler.target>1.6</maven.compiler.target>
+ <dependency>
+ <groupId>org.nuiton.topia</groupId>
+ <artifactId>topia-persistence</artifactId>
+ <version>${project.version}</version>
+ </dependency>
- <topiaVersion>2.5.4-SNAPSHOT</topiaVersion>
- <eugeneVersion>2.3.3</eugeneVersion>
- <nuitonUtilsVersion>2.1.1</nuitonUtilsVersion>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
- </properties>
-
- <dependencies>
-
+ <!--Used for ApplicationConfig -->
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
- <version>${nuitonUtilsVersion}</version>
</dependency>
<dependency>
- <groupId>org.nuiton.topia</groupId>
- <artifactId>topia-persistence</artifactId>
- <version>${topiaVersion}</version>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.5.8</version>
</dependency>
- <!-- BD H2 for testing -->
+ <!-- H2 database -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.2.128</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.2</version>
- <scope>test</scope>
</dependency>
</dependencies>
@@ -97,6 +90,8 @@
<!-- *** Build Settings ****************************************** -->
<!-- ************************************************************* -->
+ <packaging>jar</packaging>
+
<build>
<plugins>
@@ -129,6 +124,24 @@
</executions>
</plugin>
+ <!-- I18n plugin to manage library bundle -->
+ <plugin>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>maven-i18n-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>make-bundle</id>
+ <configuration>
+ <bundleOutputName>library-bundle</bundleOutputName>
+ </configuration>
+ <goals>
+ <!-- This goal will simply push all existing I18n messages from nuiton to library-bundle files -->
+ <goal>bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
Modified: trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java
===================================================================
--- trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java 2011-04-16 21:18:53 UTC (rev 2265)
+++ trunk/topia-tutorial/src/main/java/org/nuiton/topia/tutorial/library/LibraryConfig.java 2011-04-16 21:21:26 UTC (rev 2266)
@@ -1,10 +1,14 @@
package org.nuiton.topia.tutorial.library;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.i18n.init.I18nInitializer;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.tutorial.library.model.LibraryDAOHelper;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
+import java.util.Locale;
import java.util.Properties;
/**
@@ -19,6 +23,8 @@
protected ApplicationConfig config;
+ protected Locale locale;
+
public LibraryConfig() throws ArgumentsParserException {
// New ApplicationConfig
@@ -33,6 +39,10 @@
// It's a prerequisite otherwise entities will be unknown
config.setOption(TopiaContextFactory.CONFIG_PERSISTENCE_CLASSES,
LibraryDAOHelper.getImplementationClassesAsString());
+
+ // Initialize I18n to display Topia log messages
+ I18nInitializer i18nInitializer = new DefaultI18nInitializer("library-bundle");
+ I18n.init(i18nInitializer, getLocale());
}
/**
@@ -42,4 +52,11 @@
return config.getFlatOptions();
}
+ public Locale getLocale() {
+ if (locale == null) {
+ locale = new Locale("en", "GB");
+ }
+ return locale;
+ }
+
}
Deleted: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java
===================================================================
--- trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java 2011-04-16 21:18:53 UTC (rev 2265)
+++ trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java 2011-04-16 21:21:26 UTC (rev 2266)
@@ -1,115 +0,0 @@
-package org.nuiton.topia.tutorial.library;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.nuiton.topia.TopiaContext;
-import org.nuiton.topia.TopiaContextFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.tutorial.library.model.Book;
-import org.nuiton.topia.tutorial.library.model.BookDAO;
-import org.nuiton.topia.tutorial.library.model.BookImpl;
-import org.nuiton.topia.tutorial.library.model.LibraryDAOHelper;
-
-/**
- * Created: 16/04/11
- *
- * @author fdesbois <desbois(a)codelutin.com>
- * $Id$
- */
-public class MainTest {
-
- protected TopiaContext rootContext;
-
- protected TopiaContext transaction;
-
- @Before
- public void setUp() throws Exception {
-
- // Retrieve config and initialize TopiaContext root with Properties
- LibraryConfig config = new LibraryConfig();
- rootContext = TopiaContextFactory.getContext(config.getProperties());
-
- // Start the transaction
- transaction = rootContext.beginTransaction();
- }
-
- @After
- public void tearDown() throws Exception {
-
- // Close the transaction
- transaction.closeContext();
-
- // Drop the database (Work only with H2 database)
- rootContext.clear(true);
- }
-
- @Test
- public void testCreateBook() throws Exception {
-
- // ---- PREPARE DATA ---- //
-
- Book book = new BookImpl();
- book.setName("Topia for dummies");
- book.setIsbn("T12");
-
- // ---- EXECUTE ---- //
-
- BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
-
- dao.create(book);
-
- // Commit current transaction to save the entity in the database
- transaction.commitTransaction();
-
- // ---- CHECK DATA ---- //
-
- // Close current transaction to ensure database result
- transaction.closeContext();
-
- // Reopen a new transaction to retrieve the previously saved book
- transaction = rootContext.beginTransaction();
- dao = LibraryDAOHelper.getBookDAO(transaction);
-
- // Retrieve the book from its topiaId (primary key)
- Book bookLoaded = dao.findByTopiaId(book.getTopiaId());
-
- // It is the same value !
- Assert.assertEquals(bookLoaded, book);
- }
-
- @Test
- public void testCreateBookUniqueConstraint() throws Exception {
-
- // ---- PREPARE DATA ---- //
-
- Book book = new BookImpl();
- book.setName("Topia for dummies");
- book.setIsbn("T12");
-
- BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
- dao.create(book);
-
- // ---- EXECUTE ---- //
-
- Book bookError = new BookImpl();
- bookError.setIsbn("T12");
- dao.create(bookError);
-
- try {
- transaction.commitTransaction();
- Assert.fail("TopiaException is expected");
- } catch (TopiaException ex) {
-
- // Rollback the transaction, the book T12 will not be persisted
- transaction.rollbackTransaction();
- }
-
- // ---- CHECK DATA ---- //
-
- // no book exists
- Assert.assertEquals(0, dao.count());
- }
-
-}
Copied: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java (from rev 2263, trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java)
===================================================================
--- trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java (rev 0)
+++ trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/StartTest.java 2011-04-16 21:21:26 UTC (rev 2266)
@@ -0,0 +1,115 @@
+package org.nuiton.topia.tutorial.library;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.tutorial.library.model.Book;
+import org.nuiton.topia.tutorial.library.model.BookDAO;
+import org.nuiton.topia.tutorial.library.model.BookImpl;
+import org.nuiton.topia.tutorial.library.model.LibraryDAOHelper;
+
+/**
+ * Created: 16/04/11
+ *
+ * @author fdesbois <desbois(a)codelutin.com>
+ * $Id$
+ */
+public class StartTest {
+
+ protected TopiaContext rootContext;
+
+ protected TopiaContext transaction;
+
+ @Before
+ public void setUp() throws Exception {
+
+ // Retrieve config and initialize TopiaContext root with Properties
+ LibraryConfig config = new LibraryConfig();
+ rootContext = TopiaContextFactory.getContext(config.getProperties());
+
+ // Start the transaction
+ transaction = rootContext.beginTransaction();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ // Close the transaction
+ transaction.closeContext();
+
+ // Close rootContext and drop the database (Work only with H2 database)
+ rootContext.clear(true);
+ }
+
+ @Test
+ public void testCreateBook() throws Exception {
+
+ // ---- PREPARE DATA ---- //
+
+ Book book = new BookImpl();
+ book.setName("Topia for dummies");
+ book.setIsbn("T12");
+
+ // ---- EXECUTE ---- //
+
+ BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
+
+ dao.create(book);
+
+ // Commit current transaction to save the entity in the database
+ transaction.commitTransaction();
+
+ // ---- CHECK DATA ---- //
+
+ // Close current transaction to ensure database result
+ transaction.closeContext();
+
+ // Reopen a new transaction to retrieve the previously saved book
+ transaction = rootContext.beginTransaction();
+ dao = LibraryDAOHelper.getBookDAO(transaction);
+
+ // Retrieve the book from its topiaId (primary key)
+ Book bookLoaded = dao.findByTopiaId(book.getTopiaId());
+
+ // It is the same value !
+ Assert.assertEquals(bookLoaded, book);
+ }
+
+ @Test
+ public void testCreateBookUniqueConstraint() throws Exception {
+
+ // ---- PREPARE DATA ---- //
+
+ Book book = new BookImpl();
+ book.setName("Topia for dummies");
+ book.setIsbn("T12");
+
+ BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
+ dao.create(book);
+
+ // ---- EXECUTE ---- //
+
+ Book bookError = new BookImpl();
+ bookError.setIsbn("T12");
+ dao.create(bookError);
+
+ try {
+ transaction.commitTransaction();
+ Assert.fail("TopiaException is expected");
+ } catch (TopiaException ex) {
+
+ // Rollback the transaction, the book T12 will not be persisted
+ transaction.rollbackTransaction();
+ }
+
+ // ---- CHECK DATA ---- //
+
+ // no book exists
+ Assert.assertEquals(0, dao.count());
+ }
+
+}
1
0
16 Apr '11
Author: fdesbois
Date: 2011-04-16 23:18:53 +0200 (Sat, 16 Apr 2011)
New Revision: 2265
Url: http://nuiton.org/repositories/revision/topia/2265
Log:
Error in doc
Modified:
trunk/topia-persistence/src/site/rst/user/start.rst
Modified: trunk/topia-persistence/src/site/rst/user/start.rst
===================================================================
--- trunk/topia-persistence/src/site/rst/user/start.rst 2011-04-16 21:18:38 UTC (rev 2264)
+++ trunk/topia-persistence/src/site/rst/user/start.rst 2011-04-16 21:18:53 UTC (rev 2265)
@@ -76,7 +76,7 @@
<!-- Corresponding to extracted package from zargo file -->
<fullPackagePath>org.nuiton.topia.tutorial.library</fullPackagePath>
<!-- DefaultPackage used for DAOHelper generation -->
- <defaultPackage>org.nuiton.topia.tutorial.library</defaultPackage>
+ <defaultPackage>org.nuiton.topia.tutorial.library.model</defaultPackage>
<templates>
org.nuiton.topia.generator.TopiaMetaTransformer
</templates>
1
0
Author: fdesbois
Date: 2011-04-16 23:18:38 +0200 (Sat, 16 Apr 2011)
New Revision: 2264
Url: http://nuiton.org/repositories/revision/topia/2264
Log:
Update changelog, redirect to nuiton.org site
Modified:
trunk/changelog.txt
Modified: trunk/changelog.txt
===================================================================
--- trunk/changelog.txt 2011-04-16 17:41:22 UTC (rev 2263)
+++ trunk/changelog.txt 2011-04-16 21:18:38 UTC (rev 2264)
@@ -1,3 +1,10 @@
+
+Since 2.2.2 changelog is no more maintained
+
+see nuiton.org forge for changes : http://nuiton.org/projects/show/topia
+
+--------------------------------------------------------------------------------
+
2.2.1 chemit 20090903
* [FIX #38] manual migration service does not work on windows OS
1
0
r2263 - trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library
by fdesbois@users.nuiton.org 16 Apr '11
by fdesbois@users.nuiton.org 16 Apr '11
16 Apr '11
Author: fdesbois
Date: 2011-04-16 19:41:22 +0200 (Sat, 16 Apr 2011)
New Revision: 2263
Url: http://nuiton.org/repositories/revision/topia/2263
Log:
Improve test with rollback
Modified:
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java
Modified: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java
===================================================================
--- trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java 2011-04-16 16:52:30 UTC (rev 2262)
+++ trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java 2011-04-16 17:41:22 UTC (rev 2263)
@@ -90,27 +90,26 @@
BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
dao.create(book);
- transaction.commitTransaction();
// ---- EXECUTE ---- //
Book bookError = new BookImpl();
bookError.setIsbn("T12");
+ dao.create(bookError);
try {
- dao.create(bookError);
transaction.commitTransaction();
Assert.fail("TopiaException is expected");
} catch (TopiaException ex) {
- // Rollback the transaction
+ // Rollback the transaction, the book T12 will not be persisted
transaction.rollbackTransaction();
}
// ---- CHECK DATA ---- //
- // Only one book exists
- Assert.assertEquals(1, dao.count());
+ // no book exists
+ Assert.assertEquals(0, dao.count());
}
}
1
0
r2262 - in trunk/topia-tutorial/src: main/xmi test/java/org/nuiton/topia/tutorial/library
by fdesbois@users.nuiton.org 16 Apr '11
by fdesbois@users.nuiton.org 16 Apr '11
16 Apr '11
Author: fdesbois
Date: 2011-04-16 18:52:30 +0200 (Sat, 16 Apr 2011)
New Revision: 2262
Url: http://nuiton.org/repositories/revision/topia/2262
Log:
Add test with naturalId (unique constraint)
Modified:
trunk/topia-tutorial/src/main/xmi/library.properties
trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java
Modified: trunk/topia-tutorial/src/main/xmi/library.properties
===================================================================
--- trunk/topia-tutorial/src/main/xmi/library.properties 2011-04-16 16:41:18 UTC (rev 2261)
+++ trunk/topia-tutorial/src/main/xmi/library.properties 2011-04-16 16:52:30 UTC (rev 2262)
@@ -12,4 +12,9 @@
model.tagvalue.notGenerateToString=true
# Prefix for all generated constants (used for property names in entities)
-model.tagvalue.constantPrefix=PROPERTY_
\ No newline at end of file
+model.tagvalue.constantPrefix=PROPERTY_
+
+# Consider isbn as Book naturalId : this will create a Unique database constraint
+# By default a naturalId can't be updated (immutable)
+# To permit mutation you need to define tagvalue.naturalIdMutable=true
+org.nuiton.topia.tutorial.library.model.Book.attribute.isbn.tagvalue.naturalId=true
\ No newline at end of file
Modified: trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java
===================================================================
--- trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java 2011-04-16 16:41:18 UTC (rev 2261)
+++ trunk/topia-tutorial/src/test/java/org/nuiton/topia/tutorial/library/MainTest.java 2011-04-16 16:52:30 UTC (rev 2262)
@@ -6,6 +6,7 @@
import org.junit.Test;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
import org.nuiton.topia.tutorial.library.model.Book;
import org.nuiton.topia.tutorial.library.model.BookDAO;
import org.nuiton.topia.tutorial.library.model.BookImpl;
@@ -78,4 +79,38 @@
Assert.assertEquals(bookLoaded, book);
}
+ @Test
+ public void testCreateBookUniqueConstraint() throws Exception {
+
+ // ---- PREPARE DATA ---- //
+
+ Book book = new BookImpl();
+ book.setName("Topia for dummies");
+ book.setIsbn("T12");
+
+ BookDAO dao = LibraryDAOHelper.getBookDAO(transaction);
+ dao.create(book);
+ transaction.commitTransaction();
+
+ // ---- EXECUTE ---- //
+
+ Book bookError = new BookImpl();
+ bookError.setIsbn("T12");
+
+ try {
+ dao.create(bookError);
+ transaction.commitTransaction();
+ Assert.fail("TopiaException is expected");
+ } catch (TopiaException ex) {
+
+ // Rollback the transaction
+ transaction.rollbackTransaction();
+ }
+
+ // ---- CHECK DATA ---- //
+
+ // Only one book exists
+ Assert.assertEquals(1, dao.count());
+ }
+
}
1
0