Author: dcosse Date: 2014-09-25 17:25:32 +0200 (Thu, 25 Sep 2014) New Revision: 3922 Url: http://forge.chorem.org/projects/lima/repository/revisions/3922 Log: refs #1115 refactoring au tours du lancement de l'application Added: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java trunk/lima-callao/src/main/resources/db/ trunk/lima-callao/src/main/resources/db/migration/ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java Removed: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java trunk/lima-business/src/main/java/org/chorem/lima/business/migration/ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java Modified: trunk/lima-business/pom.xml trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java trunk/lima-business/src/test/resources/lima-test.properties trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java trunk/pom.xml Modified: trunk/lima-business/pom.xml =================================================================== --- trunk/lima-business/pom.xml 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/pom.xml 2014-09-25 15:25:32 UTC (rev 3922) @@ -59,7 +59,7 @@ </dependency> <dependency> <groupId>org.nuiton.topia</groupId> - <artifactId>topia-service-migration</artifactId> + <artifactId>topia-service-flyway</artifactId> </dependency> <dependency> <groupId>org.nuiton</groupId> @@ -126,6 +126,21 @@ </dependencies> <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>lima.properties</include> + </includes> + <filtering>true</filtering> + </resource> + <resource> + <directory>src/main/resources</directory> + <excludes> + <exclude>lima.properties</exclude> + </excludes> + </resource> + </resources> <pluginManagement> <plugins> <plugin> Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -1,281 +0,0 @@ -/* - * #%L - * Lima business - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.business; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaTechnicalException; -import org.chorem.lima.business.accountingrules.FranceAccountingRules; -import org.chorem.lima.business.migration.DatabaseMigrationClass; -import org.chorem.lima.entity.LimaCallaoEntityEnum; -import org.nuiton.config.ApplicationConfig; -import org.nuiton.config.ArgumentsParserException; -import org.nuiton.config.ConfigOptionDef; -import org.nuiton.topia.migration.TopiaMigrationEngine; -import org.nuiton.topia.migration.TopiaMigrationService; -import org.nuiton.topia.persistence.TopiaConfigurationConstants; - -import java.io.File; - -import static org.nuiton.i18n.I18n.n; -import static org.nuiton.i18n.I18n.t; - -/** - * Configuration pour le business. - * <p/> - * A voir comment le lier avec celui de lima swing. - * - * @author chatellier - * @version $Revision$ - * <p/> - * Last update : $Date$ - * By : $Author$ - */ -public class LimaConfig extends ApplicationConfig { - - protected static final Log log = LogFactory.getLog(LimaConfig.class); - - protected static volatile LimaConfig instance; - - protected static AccountingRules accountingRules; - - protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties"; - - protected static ApplicationConfig config = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME); - - public LimaConfig() { - try { - setOption("topia.service.migration", TopiaMigrationEngine.class.getName()); - setOption("topia.service.migration.callback", DatabaseMigrationClass.class.getName()); - - setOption(TopiaMigrationService.MIGRATION_SHOW_SQL, Boolean.TRUE.toString()); - setOption(TopiaMigrationService.MIGRATION_SHOW_PROGRESSION, Boolean.TRUE.toString()); - - LimaConfig.config.loadDefaultOptions(ServiceConfigOption.values()); - LimaConfig.config.parse(); - - } catch (ArgumentsParserException ex) { - throw new LimaTechnicalException("Can't read configuration", ex); - } - } - - public static LimaConfig getInstance() { - if (LimaConfig.instance == null) { - LimaConfig.instance = new LimaConfig(); - LimaConfig.instance.loadConfiguration(); - } - return instance; - } - - public ApplicationConfig getConfig() { - return config; - } - - /** - * Instancie la bonne classe de nationalite en fonction du fichier de configuration. - * - * L'instance est conservée en cache. - * - * @return l'instance de rule - */ - public AccountingRules getAccountingRules() { - - if (accountingRules == null) { - loadAccountingRules(); - } - - return accountingRules; - } - - protected static void loadAccountingRules() { - Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key); - if (accountingRulesClass == null) { - if (log.isErrorEnabled()) { - log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key); - } - accountingRules = new FranceAccountingRules(); - } else { - try { - accountingRules = (AccountingRules) accountingRulesClass.newInstance(); - } catch (Exception ex) { - if (log.isErrorEnabled()) { - log.error("Can't instantiate accounting rules", ex); - } - - } - } - } - - public void setAccountingRule(String accountingRule) { - LimaConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule); - // clear cache - loadAccountingRules(); - } - - public File getDataDir() { - File datadir = config.getOptionAsFile(ServiceConfigOption.DATA_DIR.getKey()); - return datadir; - } - - public File getReportsDir() { - File reportsDir = config.getOptionAsFile(ServiceConfigOption.REPORTS_DIR.getKey()); - return reportsDir; - } - - public String getAddressServer() { - String serverAddress = config.getOption(ServiceConfigOption.SERVER_ADRESS.getKey()); - return serverAddress; - } - - public int getHttpPort() { - String httpPort = config.getOption(ServiceConfigOption.HTTP_PORT.getKey()); - Integer port = Integer.valueOf(httpPort); - return port; - } - - public String getScale() { - String scale = config.getOption(ServiceConfigOption.SCALE.getKey()); - return scale; - } - - public void setScale(String locale) { - config.setOption(ServiceConfigOption.SCALE.key, locale); - config.saveForUser(); - } - - public String getVatPDFUrl() { - String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey()); - return vatPDFUrl; - } - - public void setVatPDFUrl(String url) { - config.setOption(ServiceConfigOption.VAT_PDF_URL.key, url); - config.saveForUser(); - } - - /** - * Load configuration with custom file name. - */ - protected void loadConfiguration() { - try { - config.parse(); - } catch (ArgumentsParserException ex) { - if (log.isErrorEnabled()) { - log.error("Can't read configuration", ex); - } - } - - config.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, - LimaCallaoEntityEnum.getImplementationClassesAsString()); - } - - /** - * Lima option definition. - * <p/> - * Contains all lima configuration key, with defaut value and - * information for jaxx configuration frame ({@code #type}, - * {@code #transientBoolean}, {@code #finalBoolean}...) - */ - public enum ServiceConfigOption implements ConfigOptionDef { - - CONFIG_FILE(CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima.properties", String.class, true, true), - DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), - REPORTS_DIR("lima.reports.dir", n("lima.config.reports.dir.description"), "${lima.data.dir}/reports", File.class, false, false), - RULES_NATIONALTY("lima.rules", n("lima.config.rulesnationality.description"), FranceAccountingRules.class.getName(), String.class, false, false), - HTTP_PORT("lima.httpport", n("lima.config.httpport.description"), "5462", String.class, false, false), - SERVER_ADRESS("lima.serveraddress", n("lima.config.serveraddress.description"), "", String.class, false, false), - SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false), - VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false); - - private final String key; - - private final String description; - - private String defaultValue; - - private final Class<?> type; - - private boolean transientBoolean; - - private boolean finalBoolean; - - ServiceConfigOption(String key, String description, String defaultValue, - Class<?> type, boolean transientBoolean, boolean finalBoolean) { - this.key = key; - this.description = description; - this.defaultValue = defaultValue; - this.type = type; - this.finalBoolean = finalBoolean; - this.transientBoolean = transientBoolean; - } - - @Override - public boolean isFinal() { - return finalBoolean; - } - - @Override - public void setFinal(boolean finalBoolean) { - this.finalBoolean = finalBoolean; - } - - @Override - public boolean isTransient() { - return transientBoolean; - } - - @Override - public void setTransient(boolean transientBoolean) { - this.transientBoolean = transientBoolean; - } - - @Override - public String getDefaultValue() { - return defaultValue; - } - - @Override - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - @Override - public String getDescription() { - return t(description); - } - - @Override - public String getKey() { - return key; - } - - @Override - public Class<?> getType() { - return type; - } - } - -} Added: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfigurationHelper.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -0,0 +1,47 @@ +package org.chorem.lima.business; + +import com.google.common.base.Function; +import com.google.common.collect.Maps; +import org.chorem.lima.entity.LimaCallaoEntityEnum; +import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; +import org.nuiton.topia.flyway.TopiaFlywayService; +import org.nuiton.topia.flyway.TopiaFlywayServiceImpl; +import org.nuiton.topia.persistence.TopiaConfigurationConstants; + +import java.util.Map; +import java.util.Properties; + +/** + * Created by davidcosse on 24/09/14. + */ +public class LimaConfigurationHelper { + + public static Function<Properties, LimaCallaoTopiaApplicationContext> getCreateTopiaContextFunction() { + return new Function<Properties, LimaCallaoTopiaApplicationContext>() { + @Override + public LimaCallaoTopiaApplicationContext apply(Properties input) { + LimaCallaoTopiaApplicationContext result = new LimaCallaoTopiaApplicationContext(input); + return result; + } + }; + } + + public static Properties getRootContextProperties(LimaServiceConfig serviceConfig) { + Properties result = serviceConfig.getFlatOptions(); + // add persistence classes from generated code + result.setProperty(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, LimaCallaoEntityEnum.getImplementationClassesAsString()); + + Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap(); + toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName()); + toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "true"); + toAddIfNotPresent.put(TopiaConfigurationConstants.CONFIG_PERSISTENCE_INIT_SCHEMA, "true"); + + for (Map.Entry<String, String> entry : toAddIfNotPresent.entrySet()) { + if (!result.containsKey(entry.getKey())) { + result.setProperty(entry.getKey(), entry.getValue()); + } + } + + return result; + } +} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -23,7 +23,6 @@ package org.chorem.lima.business; -import com.google.common.base.Function; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaXAResource; @@ -31,7 +30,6 @@ import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; import org.chorem.lima.entity.LimaCallaoTopiaDaoSupplier; import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; -import org.nuiton.config.ApplicationConfig; import org.nuiton.topia.persistence.TopiaApplicationContextCache; import org.nuiton.topia.persistence.TopiaException; import org.nuiton.topia.persistence.util.TopiaUtil; @@ -61,17 +59,8 @@ private static final Log log = LogFactory.getLog(LimaInterceptor.class); - public static final ThreadLocal<LimaCallaoTopiaDaoSupplier> DAO_HELPER = new ThreadLocal<LimaCallaoTopiaDaoSupplier>(); + public static final ThreadLocal<LimaCallaoTopiaDaoSupplier> DAO_HELPER = new ThreadLocal<>(); - protected static final Function<Properties, LimaCallaoTopiaApplicationContext> CREATE_CONTEXT_FUNCTION = new Function<Properties, LimaCallaoTopiaApplicationContext>() { - @Override - public LimaCallaoTopiaApplicationContext apply(Properties input) { - return new LimaCallaoTopiaApplicationContext(input); - } - }; - - protected static boolean schemaExistChecked = false; - @Resource private TransactionManager transactionManager; @@ -95,20 +84,21 @@ context.getTarget().getClass() + "#" + context.getMethod().getName()); } - ApplicationConfig config = LimaConfig.getInstance().getConfig(); + LimaServiceConfig config = LimaServiceConfig.getInstance(); - LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(config.getFlatOptions(), CREATE_CONTEXT_FUNCTION); + Properties contextProperties = LimaConfigurationHelper.getRootContextProperties(config); + LimaCallaoTopiaApplicationContext rootContext = TopiaApplicationContextCache.getContext(contextProperties, LimaConfigurationHelper.getCreateTopiaContextFunction()); LimaCallaoTopiaPersistenceContext tx = rootContext.newPersistenceContext(); // TODO DCossé 24/07/14 remove it as soon as migration service is done. - createShemaIfNeeded(rootContext, tx); + //createShemaIfNeeded(rootContext, tx); DAO_HELPER.set(tx); Transaction tr = transactionManager.getTransaction(); - // enlist topia xaresource, will will commited or rollback + // enlist topia xaresource, will commited or rollback // by container tr.enlistResource(new LimaXAResource(tx)); @@ -136,7 +126,7 @@ */ protected void createShemaIfNeeded(LimaCallaoTopiaApplicationContext applicationContext, LimaCallaoTopiaPersistenceContext tx) throws TopiaException { //LimaCallaoTopiaPersistenceContext - if (!schemaExistChecked) { + if (!applicationContext.isSchemaEmpty()) { boolean exist = TopiaUtil.isSchemaExist(tx, AccountImpl.class.getName()); if (!exist) { @@ -145,8 +135,6 @@ } applicationContext.createSchema(); } - - schemaExistChecked = true; } } Copied: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java (from rev 3921, trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java) =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -0,0 +1,293 @@ +/* + * #%L + * Lima business + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.lima.business; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaTechnicalException; +import org.chorem.lima.business.accountingrules.FranceAccountingRules; +import org.nuiton.config.ApplicationConfig; +import org.nuiton.config.ArgumentsParserException; +import org.nuiton.config.ConfigOptionDef; + +import java.io.File; +import java.util.Properties; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * Configuration pour le business. + * <p/> + * A voir comment le lier avec celui de lima swing. + * + * @author chatellier + * @version $Revision$ + * <p/> + * Last update : $Date$ + * By : $Author$ + */ +public class LimaServiceConfig { + + protected static final Log log = LogFactory.getLog(LimaServiceConfig.class); + +// protected static volatile LimaServiceConfig instance; + + protected static AccountingRules accountingRules; + + protected static final String LIMA_DEFAULT_CONF_FILENAME = "lima.properties"; + + protected static ApplicationConfig config; + + protected static volatile LimaServiceConfig instance; + + public LimaServiceConfig(String configFileName) { + try { + ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME); + defaultConfig.loadDefaultOptions(ServiceConfigOption.values()); + defaultConfig.parse(); + + if (StringUtils.isNotBlank(configFileName)) { + Properties flatOptions = defaultConfig.getFlatOptions(false); + + config = new ApplicationConfig(flatOptions, configFileName); + config.parse(); + } else { + if (log.isWarnEnabled()) { + log.warn("No specific configuration provided, using the default one"); + } + config = defaultConfig; + } + + instance = this; + } catch (ArgumentsParserException ex) { + throw new LimaTechnicalException("Can't read configuration", ex); + } + } + + public static LimaServiceConfig getInstance() { + return instance; + } + + public ApplicationConfig getConfig() { + return config; + } + + /** + * Instancie la bonne classe de nationalite en fonction du fichier de configuration. + * + * L'instance est conservée en cache. + * + * @return l'instance de rule + */ + public AccountingRules getAccountingRules() { + + if (accountingRules == null) { + loadAccountingRules(); + } + + return accountingRules; + } + + protected static void loadAccountingRules() { + Class<?> accountingRulesClass = config.getOptionAsClass(ServiceConfigOption.RULES_NATIONALTY.key); + if (accountingRulesClass == null) { + if (log.isErrorEnabled()) { + log.error("No accounting rules defined for:" + ServiceConfigOption.RULES_NATIONALTY.key); + } + accountingRules = new FranceAccountingRules(); + } else { + try { + accountingRules = (AccountingRules) accountingRulesClass.newInstance(); + } catch (Exception ex) { + if (log.isErrorEnabled()) { + log.error("Can't instantiate accounting rules", ex); + } + + } + } + } + + public Properties getFlatOptions() { + return config.getFlatOptions(); + } + + public String getApplicationVersion() { + return config.getOption(ServiceConfigOption.APPLICATION_VERSION.key); + } + + public void setAccountingRule(String accountingRule) { + LimaServiceConfig.config.setOption(ServiceConfigOption.RULES_NATIONALTY.key, accountingRule); + // clear cache + loadAccountingRules(); + } + + public File getDataDir() { + File datadir = config.getOptionAsFile(ServiceConfigOption.DATA_DIR.getKey()); + return datadir; + } + + public File getReportsDir() { + File reportsDir = config.getOptionAsFile(ServiceConfigOption.REPORTS_DIR.getKey()); + return reportsDir; + } + + public String getAddressServer() { + String serverAddress = config.getOption(ServiceConfigOption.SERVER_ADRESS.getKey()); + return serverAddress; + } + + public int getHttpPort() { + String httpPort = config.getOption(ServiceConfigOption.HTTP_PORT.getKey()); + Integer port = Integer.valueOf(httpPort); + return port; + } + + public String getScale() { + String scale = config.getOption(ServiceConfigOption.SCALE.getKey()); + return scale; + } + + public void setScale(String locale) { + config.setOption(ServiceConfigOption.SCALE.key, locale); + config.saveForUser(); + } + + public String getVatPDFUrl() { + String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey()); + return vatPDFUrl; + } + + public void setVatPDFUrl(String url) { + config.setOption(ServiceConfigOption.VAT_PDF_URL.key, url); + config.saveForUser(); + } + +// /** +// * Load configuration with custom file name. +// */ +// protected void loadConfiguration() { +// try { +// config.parse(); +// } catch (ArgumentsParserException ex) { +// if (log.isErrorEnabled()) { +// log.error("Can't read configuration", ex); +// } +// } +// +// config.setOption(TopiaConfigurationConstants.CONFIG_PERSISTENCE_CLASSES, +// LimaCallaoEntityEnum.getImplementationClassesAsString()); +// } + + /** + * Lima option definition. + * <p/> + * Contains all lima configuration key, with defaut value and + * information for jaxx configuration frame ({@code #type}, + * {@code #transientBoolean}, {@code #finalBoolean}...) + */ + public enum ServiceConfigOption implements ConfigOptionDef { + +// CONFIG_FILE(CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima.properties", String.class, true, true), + APPLICATION_VERSION("application.version", n("application.version"), null, String.class, false, false), + DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), + REPORTS_DIR("lima.reports.dir", n("lima.config.reports.dir.description"), "${lima.data.dir}/reports", File.class, false, false), + RULES_NATIONALTY("lima.rules", n("lima.config.rulesnationality.description"), FranceAccountingRules.class.getName(), String.class, false, false), + HTTP_PORT("lima.httpport", n("lima.config.httpport.description"), "5462", String.class, false, false), + SERVER_ADRESS("lima.serveraddress", n("lima.config.serveraddress.description"), "", String.class, false, false), + SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false), + VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false); + + private final String key; + + private final String description; + + private String defaultValue; + + private final Class<?> type; + + private boolean transientBoolean; + + private boolean finalBoolean; + + ServiceConfigOption(String key, String description, String defaultValue, + Class<?> type, boolean transientBoolean, boolean finalBoolean) { + this.key = key; + this.description = description; + this.defaultValue = defaultValue; + this.type = type; + this.finalBoolean = finalBoolean; + this.transientBoolean = transientBoolean; + } + + @Override + public boolean isFinal() { + return finalBoolean; + } + + @Override + public void setFinal(boolean finalBoolean) { + this.finalBoolean = finalBoolean; + } + + @Override + public boolean isTransient() { + return transientBoolean; + } + + @Override + public void setTransient(boolean transientBoolean) { + this.transientBoolean = transientBoolean; + } + + @Override + public String getDefaultValue() { + return defaultValue; + } + + @Override + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + @Override + public String getDescription() { + return t(description); + } + + @Override + public String getKey() { + return key; + } + + @Override + public Class<?> getType() { + return type; + } + } + +} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,7 @@ import org.apache.commons.lang.StringUtils; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.exceptions.AlreadyExistAccountException; import org.chorem.lima.business.exceptions.InvalidAccountNumberException; @@ -110,7 +110,7 @@ protected Account createNewAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { // check rules before create the account - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); accountingRules.createAccountRules(account); // force uppercase account number @@ -194,7 +194,7 @@ @Override public void removeAccount(Account account) throws UsedAccountException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); // Check rules for account if have entries accountingRules.removeAccountRules(account); @@ -217,7 +217,7 @@ @Override public Account updateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); // DAO AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -37,7 +37,7 @@ import org.chorem.lima.beans.GeneralEntryBooksDatas; import org.chorem.lima.beans.GeneralEntryBooksDatasImpl; import org.chorem.lima.beans.ReportsDatas; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.DocumentService; import org.chorem.lima.business.api.FinancialStatementService; import org.chorem.lima.business.api.IdentityService; @@ -100,7 +100,7 @@ protected String path; public DocumentServiceImpl() { - path = LimaConfig.getInstance().getReportsDir().getAbsolutePath(); + path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); if (log.isDebugEnabled()) { log.debug("Path : " + path); @@ -718,7 +718,7 @@ String filePath = path + File.separator + DocumentsEnum.VAT.getFileName() + ".pdf"; - String path = LimaConfig.getInstance().getReportsDir().getAbsolutePath(); + String path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); String filePathDefault = path + File.separator + DocumentsEnum.VAT.getFileName() + "_default.pdf"; @@ -726,7 +726,7 @@ PDDocument doc; InputStream reportsStream; - String vatPDFUrl = LimaConfig.getInstance().getVatPDFUrl(); + String vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl(); if (vatPDFUrl.equals("default")) { reportsStream = DocumentServiceImpl.class Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -26,7 +26,7 @@ package org.chorem.lima.business.ejb; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.exceptions.AlreadyExistEntryBookException; import org.chorem.lima.business.exceptions.UsedEntryBookException; @@ -149,7 +149,7 @@ public void removeEntryBook(EntryBook entryBook) throws UsedEntryBookException { // check rule - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); accountingRules.removeEntryBookRules(entryBook); // re-attach to current transaction Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -26,7 +26,7 @@ package org.chorem.lima.business.ejb; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.business.exceptions.NotLockedClosedPeriodicEntryBooksException; import org.chorem.lima.business.exceptions.UnbalancedFinancialTransactionsException; @@ -95,7 +95,7 @@ @Override public ClosedPeriodicEntryBook blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws UnbalancedFinancialTransactionsException, UnfilledEntriesException, WithoutEntryBookFinancialTransactionsException, NotLockedClosedPeriodicEntryBooksException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); ClosedPeriodicEntryBook result; // check rules before create the account Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -34,7 +34,7 @@ import org.chorem.lima.beans.FinancialTransactionCondition; import org.chorem.lima.beans.LetteringFilter; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; @@ -107,7 +107,7 @@ public FinancialTransaction createFinancialTransaction(FinancialTransaction financialtransaction) throws LockedFinancialPeriodException, LockedEntryBookException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); //check if the financial period is blocked accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction); @@ -315,7 +315,7 @@ } - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); //check rules accountingRules.addLetter(oldEntries); @@ -483,7 +483,7 @@ public void updateFinancialTransaction(FinancialTransaction financialTransaction) throws AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); FinancialTransactionTopiaDao transactionTopiaDao = getDaoHelper().getFinancialTransactionDao(); FinancialTransaction financialTransactionOld = transactionTopiaDao.forTopiaIdEquals(financialTransaction.getTopiaId()).findUnique(); @@ -492,9 +492,7 @@ financialTransactionOld.setEntryBook(financialTransaction.getEntryBook()); financialTransactionOld.setTransactionDate(financialTransaction.getTransactionDate()); - transactionTopiaDao.update(financialTransactionOld); - } /** @@ -506,7 +504,7 @@ throws LockedFinancialPeriodException, LockedEntryBookException { // check if the financial period is blocked - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialTransaction); FinancialTransactionTopiaDao transactionTopiaDao = getDaoHelper().getFinancialTransactionDao(); @@ -523,7 +521,7 @@ @Override public Entry createEntry(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); //check if the financial period is blocked accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( @@ -541,7 +539,7 @@ @Override public void updateEntry(Entry entry) throws LockedEntryBookException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); @@ -563,7 +561,7 @@ @Override public void removeEntry(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); FinancialTransaction financialTransaction = entry.getFinancialTransaction(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -30,7 +30,7 @@ import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.beans.ReportsDatas; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.FinancialPeriodService; @@ -115,7 +115,7 @@ FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); // fix begin date at midnight and end date at 23:59:59.999 Date beginDate = fiscalPeriod.getBeginDate(); @@ -227,7 +227,7 @@ public FiscalPeriod blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws AlreadyLockedFiscalPeriodException, LastUnlockedFiscalPeriodException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); if (fiscalPeriod.isLocked()) { throw new AlreadyLockedFiscalPeriodException(fiscalPeriod); @@ -489,7 +489,7 @@ @Override public void deleteFiscalPeriod(FiscalPeriod fiscalPeriod) throws NoEmptyFiscalPeriodException { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); //get entities with TopiaDao FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -31,7 +31,7 @@ import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.DocumentService; import org.chorem.lima.business.api.HttpServerService; @@ -89,8 +89,8 @@ private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd"); public HttpServerServiceImpl() { - path = LimaConfig.getInstance().getReportsDir().getAbsolutePath(); - port = LimaConfig.getInstance().getHttpPort(); + path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); + port = LimaServiceConfig.getInstance().getHttpPort(); } /** start the server */ @@ -129,7 +129,7 @@ public class MainServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private String serverAddressConfig = LimaConfig.getInstance().getAddressServer(); + private String serverAddressConfig = LimaServiceConfig.getInstance().getAddressServer(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -266,7 +266,7 @@ + ":" + req.getServerPort(); } else { serverAdress += serverAddressConfig + ":" - + LimaConfig.getInstance().getHttpPort(); + + LimaServiceConfig.getInstance().getHttpPort(); } Calendar calendar = Calendar.getInstance(); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -24,7 +24,7 @@ */ package org.chorem.lima.business.ejb; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.OptionsService; import javax.ejb.Remote; @@ -39,8 +39,8 @@ protected String vatPDFUrl; public OptionsServiceImpl() { - scale = LimaConfig.getInstance().getScale(); - vatPDFUrl = LimaConfig.getInstance().getVatPDFUrl(); + scale = LimaServiceConfig.getInstance().getScale(); + vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl(); } public int getScale() { @@ -52,7 +52,7 @@ } public void setScale(String scale) { - LimaConfig.getInstance().setScale(scale); + LimaServiceConfig.getInstance().setScale(scale); } public String getVatPDFUrl() { @@ -60,7 +60,7 @@ } public void setVatPDFUrl(String url) { - LimaConfig.getInstance().setVatPDFUrl(url); + LimaServiceConfig.getInstance().setVatPDFUrl(url); } } Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2014-09-25 15:25:32 UTC (rev 3922) @@ -1,3 +1,4 @@ +application.version= lima-Business.defaultaccountingrules.updateentryerror=Can't update entry \: financialperiod of this entrybook is closed lima-Business.defaultaccountingrules.updatefinancialtransactionnewperioderror=Can't update financialtransaction \: this financialperiod of new entrybook is closed lima-Business.defaultaccountingrules.updatefinancialtransactionperioderror=Can't update financialtransaction \: the new financialperiod of this entrybook is closed @@ -139,6 +140,7 @@ lima.reports.account.noaccount= lima.reports.account.noaccounttitle= lima.reports.accounts= +lima.services.application.version= lima.table.credit= lima.table.date= lima.table.debit= Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2014-09-25 15:25:32 UTC (rev 3922) @@ -1,3 +1,4 @@ +application.version= lima-Business.defaultaccountingrules.updateentryerror=Impossible de mettre à jour l'entrée \: la période financière de ce journal est bloquée lima-Business.defaultaccountingrules.updatefinancialtransactionnewperioderror=Impossible de mettre à jour la transaction \: la période financière de ce nouveau journal est bloquée lima-Business.defaultaccountingrules.updatefinancialtransactionperioderror=Impossible de mettre à jour la transaction \: la période financière de ce journal est bloquée @@ -134,6 +135,7 @@ lima.reports.account.noaccount= lima.reports.account.noaccounttitle= lima.reports.accounts= +lima.services.application.version= lima.table.credit= lima.table.date= lima.table.debit= Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,6 @@ import com.google.common.collect.Lists; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.accountingrules.TestAccountingRules; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.EntryService; @@ -88,6 +87,7 @@ }; protected static DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.ENGLISH); + protected static final String LIMA_TEST_DEFAULT_CONF_FILENAME = "lima-test.properties"; protected AccountService accountService; protected EntryBookService entryBookService; @@ -114,9 +114,9 @@ public void initAbstractTest() throws Exception { setUpLocale(); Properties options = getTestConfiguration(); - LimaConfig config = new LimaTestsConfig("/lima-test.properties", options); - initServices(config); - context = getTestContext(options); + LimaServiceConfig limaTestConfig = new LimaTestsConfig(LIMA_TEST_DEFAULT_CONF_FILENAME, options); + initServices(limaTestConfig); + context = createNewTestApplicationContext(); } protected void setUpLocale() throws Exception { @@ -127,7 +127,7 @@ * Init services after i18n#init(). * @throws java.io.IOException */ - protected void initServices(LimaConfig config) throws IOException { + protected void initServices(LimaServiceConfig config) throws IOException { if(accountService == null) { LimaServiceFactory.initFactory(config.getConfig()); accountService = LimaServiceFactory.getService(AccountService.class); @@ -158,21 +158,11 @@ // load file manually (lima.properties) Properties testProperties = new Properties(); // override somes - testProperties.setProperty(LimaConfig.ServiceConfigOption.CONFIG_FILE.getKey(), "/lima-test.properties"); String testDir = System.getProperty("java.io.tmpdir") + File.separator + "lima-business-" + UUID.randomUUID().toString(); - testProperties.setProperty(LimaConfig.ServiceConfigOption.DATA_DIR.getKey(), testDir); - testProperties.setProperty(Environment.HBM2DDL_AUTO, "update"); - testProperties.setProperty(Environment.DIALECT, "org.hibernate.dialect.H2Dialect"); - testProperties.setProperty(Environment.DRIVER, "org.h2.Driver"); - + testProperties.setProperty(LimaServiceConfig.ServiceConfigOption.DATA_DIR.getKey(), testDir); testProperties.setProperty(Environment.URL, "jdbc:h2:file:" + testDir + File.separator + "data"); - testProperties.setProperty(Environment.USER, "sa"); - testProperties.setProperty(Environment.PASS, ""); testProperties.setProperty(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread"); - - testProperties.setProperty("topia.persistence.classes", LimaCallaoEntityEnum.getImplementationClassesAsString()); - testProperties.setProperty(LimaConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), TestAccountingRules.class.getName()); return testProperties; } @@ -181,22 +171,23 @@ //context.dropSchema(); } + /** * Method to use only for class that need a context to be tester. * Only for DOA for now. * * @return a topia context */ - protected LimaCallaoTopiaApplicationContext getTestContext(Properties options) { + protected LimaCallaoTopiaApplicationContext getTestApplicationContext(Properties options) { log.info("Opening context to database : " + options.getProperty("hibernate.connection.url")); LimaCallaoTopiaApplicationContext result = TopiaApplicationContextCache.getContext(options, CREATE_CONTEXT_FUNCTION); return result; } - protected LimaCallaoTopiaApplicationContext createNewTestContext() { - Properties options = getTestConfiguration(); - LimaCallaoTopiaApplicationContext result = getTestContext(options); + protected LimaCallaoTopiaApplicationContext createNewTestApplicationContext() { + Properties options = LimaServiceConfig.getInstance().getFlatOptions(); + LimaCallaoTopiaApplicationContext result = getTestApplicationContext(options); return result; } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -32,6 +32,8 @@ import org.junit.Before; import org.junit.Test; +import java.util.List; + /** * Tests pour la gestion des timespans * <p/> @@ -48,7 +50,7 @@ @Before public void initTest() throws Exception { - initTestDatabase(); + //initTestDatabase(); } /** @@ -58,14 +60,14 @@ */ @Test public void blockClosedPeriodicEntryBookTest() throws Exception { - initTestWithFinancialTransaction(); // find one closed to close LimaCallaoTopiaPersistenceContext tcontext = context.newPersistenceContext(); ClosedPeriodicEntryBookTopiaDao dao = tcontext.getClosedPeriodicEntryBookDao(); - ClosedPeriodicEntryBook closedPeriodic = dao.findAll().get(0); + List<ClosedPeriodicEntryBook> closedPeriodics = dao.findAll(); tcontext.close(); + ClosedPeriodicEntryBook closedPeriodic = closedPeriodics.get(0); // block it Assert.assertFalse(closedPeriodic.isLocked()); Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaMiscTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -23,10 +23,12 @@ package org.chorem.lima.business; -import org.chorem.lima.business.accountingrules.FranceAccountingRules; +import org.chorem.lima.business.accountingrules.DefaultAccountingRules; import org.junit.Assert; import org.junit.Test; +import java.util.Properties; + /** * Lima misc tests. * @@ -38,14 +40,19 @@ */ public class LimaMiscTest extends AbstractLimaTest { + protected Properties getTestConfiguration() { + Properties config = super.getTestConfiguration(); + config.setProperty(LimaServiceConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), DefaultAccountingRules.class.getName()); + return config; + } /** * Test que la regles de nationnalité par defaut est Default pour * la majorité des tests. */ @Test public void testDefaultRule() { - Assert.assertFalse(LimaConfig.getInstance().getAccountingRules() - instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() + instanceof DefaultAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -22,38 +22,25 @@ * #L% */ -import org.apache.commons.lang3.StringUtils; -import org.chorem.lima.LimaTechnicalException; import org.nuiton.config.ApplicationConfig; -import org.nuiton.config.ArgumentsParserException; +import java.util.Map; import java.util.Properties; /** * Created by davidcosse on 11/06/14. */ -public class LimaTestsConfig extends LimaConfig { +public class LimaTestsConfig extends LimaServiceConfig { - public LimaTestsConfig(String configFileName, Properties properties) { - try { - accountingRules = null; - ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME); - defaultConfig.loadDefaultOptions(ServiceConfigOption.values()); - defaultConfig.parse(); - if (StringUtils.isNotBlank(configFileName)) { - Properties flatOptions = defaultConfig.getFlatOptions(false); - flatOptions.putAll(properties); - config = new ApplicationConfig(flatOptions, configFileName); - config.parse(); - } else { - if (log.isWarnEnabled()) { - log.warn("No specific configuration provided, using the default one"); - } - config = defaultConfig; - } - instance = this; - } catch (ArgumentsParserException ex) { - throw new LimaTechnicalException("Can't read configuration", ex); + public LimaTestsConfig(String configFileName, Properties limaTestConfig) { + super(configFileName); + Properties standardLimaConfig = config.getFlatOptions(); + + for (Map.Entry<Object, Object> entry : limaTestConfig.entrySet()) { + standardLimaConfig.setProperty((String)entry.getKey(),(String)entry.getValue()); } + config = new ApplicationConfig(standardLimaConfig); + instance = this; } + } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/AccountServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -24,7 +24,7 @@ package org.chorem.lima.business.accountingrules; import org.chorem.lima.business.AccountServiceImplTest; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -46,16 +46,16 @@ @Before public void installFrenchRule() throws Exception { - LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() { - Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/EntryBookServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -24,7 +24,7 @@ package org.chorem.lima.business.accountingrules; import org.chorem.lima.business.EntryBookServiceImplTest; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -46,15 +46,15 @@ @Before public void installFrenchRule() throws Exception { - LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() { - Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialPeriodServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -24,7 +24,7 @@ package org.chorem.lima.business.accountingrules; import org.chorem.lima.business.EntryBookServiceImplTest; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -46,15 +46,15 @@ @Before public void installFrenchRule() throws Exception { - LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() { - Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FinancialTransactionServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -24,7 +24,7 @@ package org.chorem.lima.business.accountingrules; import org.chorem.lima.business.FinancialTransactionServiceImplTest; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -46,15 +46,15 @@ @Before public void installFrenchRule() throws Exception { - LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() { - Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/FiscalPeriodServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -24,7 +24,7 @@ package org.chorem.lima.business.accountingrules; import org.chorem.lima.business.FiscalPeriodServiceImplTest; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -46,15 +46,15 @@ @Before public void installFrenchRule() throws Exception { - LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() { - Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -23,9 +23,9 @@ package org.chorem.lima.business.accountingrules; +import org.chorem.lima.business.AbstractLimaTest; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.ImportExportServiceTest; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.junit.Assert; import org.junit.Test; @@ -44,22 +44,21 @@ * Last update : $Date$ * By : $Author$ */ -public class ImportServiceRuleFrTest extends ImportExportServiceTest { +public class ImportServiceRuleFrTest extends AbstractLimaTest { protected Properties getTestConfiguration() { Properties config = super.getTestConfiguration(); - config.remove(LimaConfig.ServiceConfigOption.RULES_NATIONALTY.getKey()); - config.put(LimaConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), FranceAccountingRules.class.getName()); + config.setProperty(LimaServiceConfig.ServiceConfigOption.RULES_NATIONALTY.getKey(), FranceAccountingRules.class.getName()); return config; } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() throws Exception { - AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + AccountingRules accountingRules = LimaServiceConfig.getInstance().getAccountingRules(); Assert.assertTrue("accountingRules:" + accountingRules,accountingRules instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ReportServiceRuleFrTest.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -23,7 +23,7 @@ package org.chorem.lima.business.accountingrules; -import org.chorem.lima.business.LimaConfig; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.ReportServiceImplTest; import org.junit.Assert; import org.junit.BeforeClass; @@ -50,15 +50,15 @@ @BeforeClass public static void installFrenchRule() throws Exception { - LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + LimaServiceConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); } /** * Test une fois que la regles est correctement instanciée car - * elle peut être mise en cache dans {@link LimaConfig}. + * elle peut être mise en cache dans {@link org.chorem.lima.business.LimaServiceConfig}. */ @Test public void testRuleInstance() { - Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + Assert.assertTrue(LimaServiceConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); } } Modified: trunk/lima-business/src/test/resources/lima-test.properties =================================================================== --- trunk/lima-business/src/test/resources/lima-test.properties 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-business/src/test/resources/lima-test.properties 2014-09-25 15:25:32 UTC (rev 3922) @@ -31,3 +31,5 @@ hibernate.connection.password= hibernate.connection.driver_class=org.h2.Driver hibernate.hbm2ddl.auto=update +# Topia should not create the schema +topia.persistence.initSchema=false Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java (rev 0) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/LimaCallaoTopiaApplicationContext.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -0,0 +1,20 @@ +package org.chorem.lima.entity; + +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +public class LimaCallaoTopiaApplicationContext extends AbstractLimaCallaoTopiaApplicationContext { + + public LimaCallaoTopiaApplicationContext(Properties properties) { + super(properties); + } + + public LimaCallaoTopiaApplicationContext(Map<String, String> configuration) { + super(configuration); + } + + public Set<org.nuiton.topia.persistence.TopiaPersistenceContext> getPersistenceContexts() { + return persistenceContexts; + } +} //LimaCallaoTopiaApplicationContext Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -1,162 +0,0 @@ -/* - * #%L - * Lima Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima; - -import jaxx.runtime.JAXXUtil; -import jaxx.runtime.context.DefaultApplicationContext; -import jaxx.runtime.context.JAXXContextEntryDef; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.ui.LimaDecoratorProvider; -import org.chorem.lima.ui.MainView; -import org.chorem.lima.ui.MainViewHandler; -import org.nuiton.decorator.DecoratorProvider; -import org.nuiton.i18n.I18n; -import org.nuiton.i18n.init.DefaultI18nInitializer; -import org.nuiton.i18n.init.I18nInitializer; -import org.nuiton.util.StringUtil; - -import java.util.Locale; - -/** @author chemit */ -public class LimaContext extends DefaultApplicationContext { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(LimaContext.class); - - /** - * l'intance partagée accessible après un appel à la méthode - * {@link #init()} - */ - protected static LimaContext instance; - - public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class); - - public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class); - - public static JAXXContextEntryDef<LimaConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaConfig.class); - - /** - * @return <code>true</code> si le context a été initialisé via la méthode - * {@link #init()}, <ocde>false</code> autrement. - */ - public static boolean isInit() { - return instance != null; - } - - /** - * Permet l'initialisation du contexte applicatif et positionne - * l'instance partagée. - * <p/> - * Note : Cette méthode ne peut être appelée qu'une seule fois. - * - * @return l'instance partagée - * @throws IllegalStateException si un contexte applicatif a déja été positionné. - */ - public static LimaContext init() throws IllegalStateException { - if (isInit()) { - throw new IllegalStateException("there is already a application context registred."); - } - instance = new LimaContext(); - instance.setContextValue(new MainViewHandler()); - CONFIG_DEF.setContextValue(instance, LimaConfig.getInstance()); - DECORATOR_PROVIDER_DEF.setContextValue(instance, new LimaDecoratorProvider()); - return instance; - } - - /** - * Récupération du contexte applicatif. - * - * @return l'instance partagé du contexte. - * @throws IllegalStateException si le contexte n'a pas été initialisé via - * la méthode {@link #init()} - */ - public static LimaContext get() throws IllegalStateException { - if (!isInit()) { - throw new IllegalStateException("no application context registred."); - } - return instance; - } - - public LimaConfig getConfig() { - return CONFIG_DEF.getContextValue(this); - } - - public DecoratorProvider getDecoratorProvider() { - return DECORATOR_PROVIDER_DEF.getContextValue(this); - } - - public void initI18n(LimaConfig config) { - - I18n.close(); - - I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima"); - Locale locale = config.getLocale(); - I18n.init(i18nInitializer, locale); - - // Default Locale for DatePicker - Locale.setDefault(locale); - - long t00 = System.nanoTime(); - - if (log.isDebugEnabled()) { - log.debug("i18n language : " + locale); - log.debug("i18n loading time : " + - StringUtil.convertTime(t00, System.nanoTime())); - } - } - - public MainView getMainUI() { - return MAIN_UI_ENTRY_DEF.getContextValue(this); - } - - /** - * close the application's context. - * - * @throws Exception if any pb while closing - */ - public void close() throws Exception { - if (log.isDebugEnabled()) { - log.debug("closing context " + this); - } - - // fermeture du context principal - MainView mainUI = getMainUI(); - if (mainUI != null && mainUI.isVisible()) { - mainUI.setVisible(false); - mainUI.dispose(); - } - - if (log.isDebugEnabled()) { - log.debug("context closed " + this); - } - //System.exit(0); - } - - public static LimaContext getContext() { - return get(); - } -} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -72,7 +72,7 @@ } // init root context - LimaContext context = init(args); + LimaSwingApplicationContext context = init(args); // do actions config = context.getConfig(); @@ -98,7 +98,7 @@ * @return le context de l'application * @throws Exception pour toute erreur pendant l'init */ - public static LimaContext init(String... args) throws Exception { + public static LimaSwingApplicationContext init(String... args) throws Exception { // update splash splash = new LimaSplash(); @@ -111,7 +111,7 @@ Runtime.getRuntime().addShutdownHook(new ShutdownHook()); // init root context - LimaContext context = LimaContext.init(); + LimaSwingApplicationContext context = LimaSwingApplicationContext.init(); LimaConfig config = context.getConfig(); config.parse(args); context.initI18n(config); @@ -119,7 +119,7 @@ return context; } - protected static void launch(LimaContext context) throws Exception { + protected static void launch(LimaSwingApplicationContext context) throws Exception { // prepare ui look&feel and load ui properties try { @@ -182,7 +182,7 @@ @Override public void run() { try { - LimaContext.get().close(); + LimaSwingApplicationContext.get().close(); LimaServiceFactory.destroy(); // force to kill main thread Copied: trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java (from rev 3921, trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java) =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaSwingApplicationContext.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -0,0 +1,169 @@ +/* + * #%L + * Lima Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.lima; + +import jaxx.runtime.JAXXUtil; +import jaxx.runtime.context.DefaultApplicationContext; +import jaxx.runtime.context.JAXXContextEntryDef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceConfig; +import org.chorem.lima.ui.LimaDecoratorProvider; +import org.chorem.lima.ui.MainView; +import org.chorem.lima.ui.MainViewHandler; +import org.nuiton.decorator.DecoratorProvider; +import org.nuiton.i18n.I18n; +import org.nuiton.i18n.init.DefaultI18nInitializer; +import org.nuiton.i18n.init.I18nInitializer; +import org.nuiton.util.StringUtil; + +import java.util.Locale; + +/** @author chemit */ +public class LimaSwingApplicationContext extends DefaultApplicationContext { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(LimaSwingApplicationContext.class); + + /** + * l'intance partagée accessible après un appel à la méthode + * {@link #init()} + */ + protected static LimaSwingApplicationContext instance; + + public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXUtil.newContextEntryDef("mainUI", MainView.class); + + public static JAXXContextEntryDef<DecoratorProvider> DECORATOR_PROVIDER_DEF = JAXXUtil.newContextEntryDef("decoratorProvider", DecoratorProvider.class); + + public static JAXXContextEntryDef<LimaConfig> CONFIG_DEF = JAXXUtil.newContextEntryDef("limaConfig", LimaConfig.class); + + /** + * @return <code>true</code> si le context a été initialisé via la méthode + * {@link #init()}, <ocde>false</code> autrement. + */ + public static boolean isInit() { + return instance != null; + } + + /** + * Permet l'initialisation du contexte applicatif et positionne + * l'instance partagée. + * <p/> + * Note : Cette méthode ne peut être appelée qu'une seule fois. + * + * @return l'instance partagée + * @throws IllegalStateException si un contexte applicatif a déja été positionné. + */ + public static LimaSwingApplicationContext init() throws IllegalStateException { + if (isInit()) { + throw new IllegalStateException("there is already a application context registred."); + } + instance = new LimaSwingApplicationContext(); + instance.setContextValue(new MainViewHandler()); + CONFIG_DEF.setContextValue(instance, LimaConfig.getInstance()); + DECORATOR_PROVIDER_DEF.setContextValue(instance, new LimaDecoratorProvider()); + initApplicationContext(); + return instance; + } + + protected static void initApplicationContext() { + // TODO DCossé 25/09/14 revoir cette partie + new LimaServiceConfig(null); + } + + /** + * Récupération du contexte applicatif. + * + * @return l'instance partagé du contexte. + * @throws IllegalStateException si le contexte n'a pas été initialisé via + * la méthode {@link #init()} + */ + public static LimaSwingApplicationContext get() throws IllegalStateException { + if (!isInit()) { + throw new IllegalStateException("no application context registred."); + } + return instance; + } + + public LimaConfig getConfig() { + return CONFIG_DEF.getContextValue(this); + } + + public DecoratorProvider getDecoratorProvider() { + return DECORATOR_PROVIDER_DEF.getContextValue(this); + } + + public void initI18n(LimaConfig config) { + + I18n.close(); + + I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima"); + Locale locale = config.getLocale(); + I18n.init(i18nInitializer, locale); + + // Default Locale for DatePicker + Locale.setDefault(locale); + + long t00 = System.nanoTime(); + + if (log.isDebugEnabled()) { + log.debug("i18n language : " + locale); + log.debug("i18n loading time : " + + StringUtil.convertTime(t00, System.nanoTime())); + } + } + + public MainView getMainUI() { + return MAIN_UI_ENTRY_DEF.getContextValue(this); + } + + /** + * close the application's context. + * + * @throws Exception if any pb while closing + */ + public void close() throws Exception { + if (log.isDebugEnabled()) { + log.debug("closing context " + this); + } + + // fermeture du context principal + MainView mainUI = getMainUI(); + if (mainUI != null && mainUI.isVisible()) { + mainUI.setVisible(false); + mainUI.dispose(); + } + + if (log.isDebugEnabled()) { + log.debug("context closed " + this); + } + //System.exit(0); + } + + public static LimaSwingApplicationContext getContext() { + return get(); + } +} Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -26,7 +26,7 @@ import jaxx.runtime.swing.renderer.DecoratorListCellRenderer; import jaxx.runtime.swing.renderer.DecoratorProviderListCellRenderer; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.nuiton.decorator.Decorator; import org.nuiton.decorator.DecoratorProvider; @@ -41,13 +41,13 @@ public class LimaRendererUtil { public static ListCellRenderer newDecoratorProviderListCellRenderer() { - DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider(); + DecoratorProvider decoratorProvider = LimaSwingApplicationContext.get().getDecoratorProvider(); return new DecoratorProviderListCellRenderer(decoratorProvider); } public static ListCellRenderer newDecoratorListCellRenderer(Class<?> type) { - DecoratorProvider decoratorProvider = LimaContext.get().getDecoratorProvider(); + DecoratorProvider decoratorProvider = LimaSwingApplicationContext.get().getDecoratorProvider(); Decorator<?> decorator = decoratorProvider.getDecoratorByType(type); return new DecoratorListCellRenderer(decorator); } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2014-09-25 15:25:32 UTC (rev 3922) @@ -32,7 +32,7 @@ javax.swing.JButton jaxx.runtime.SwingUtil org.chorem.lima.LimaConfig - org.chorem.lima.LimaContext + org.chorem.lima.LimaSwingApplicationContext org.chorem.lima.enums.ImportExportEnum </import> @@ -43,7 +43,7 @@ } public LimaConfig getConfig() { - return LimaContext.CONFIG_DEF.getContextValue(getDelegateContext()); + return LimaSwingApplicationContext.CONFIG_DEF.getContextValue(getDelegateContext()); } public MainViewHandler getHandler() { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -31,7 +31,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaConfig; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.business.api.HttpServerService; import org.chorem.lima.enums.ImportExportEnum; import org.chorem.lima.service.LimaServiceFactory; @@ -91,13 +91,13 @@ * @param rootContext le context applicatif * @return l'ui instancie et initialisee mais non visible encore */ - public MainView initUI(LimaContext rootContext) { + public MainView initUI(LimaSwingApplicationContext rootContext) { // show main ui MainView ui = new MainView(rootContext); swingSession = new SwingSession(getLimaStateFile(), false); - LimaContext.MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui); + LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui); return ui; } @@ -119,10 +119,10 @@ config.setLocale(newLocale); // rechargement i18n - LimaContext.get().initI18n(config); + LimaSwingApplicationContext.get().initI18n(config); // on recharge l'ui - reloadUI(LimaContext.get()); + reloadUI(LimaSwingApplicationContext.get()); } /** @@ -141,7 +141,7 @@ return; } try { - LimaContext.get().close(); + LimaSwingApplicationContext.get().close(); Runtime.getRuntime().halt(0); @@ -301,16 +301,16 @@ * * @param rootContext le contexte applicatif */ - protected void reloadUI(LimaContext rootContext) { + protected void reloadUI(LimaSwingApplicationContext rootContext) { // must remove all properties listener on config - LimaContext.CONFIG_DEF.getContextValue(rootContext).removeJaxxPropertyChangeListener(); + LimaSwingApplicationContext.CONFIG_DEF.getContextValue(rootContext).removeJaxxPropertyChangeListener(); // scan main ui MainView ui = getUI(rootContext); if (ui != null) { - LimaContext.MAIN_UI_ENTRY_DEF.removeContextValue(rootContext); + LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.removeContextValue(rootContext); ui.dispose(); @@ -348,7 +348,7 @@ if (context instanceof MainView) { return (MainView) context; } - MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(context); + MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(context); return ui; } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaConfig; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import javax.swing.*; import java.awt.event.KeyEvent; @@ -81,7 +81,7 @@ BigDecimal cellEditorValue; int pointIndex = stringValue.indexOf("."); if (pointIndex != -1) { - LimaConfig config = LimaContext.getContext().getConfig(); + LimaConfig config = LimaSwingApplicationContext.getContext().getConfig(); String actualDecimals = stringValue.substring(pointIndex, stringValue.length()-1); if (config.getScale() > actualDecimals.length()) { cellEditorValue = new BigDecimal(stringValue); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -25,7 +25,7 @@ package org.chorem.lima.ui.celleditor; import org.chorem.lima.LimaConfig; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import javax.swing.*; import java.awt.*; @@ -39,7 +39,7 @@ public static String format(BigDecimal value) { - LimaConfig config = LimaContext.getContext().getConfig(); + LimaConfig config = LimaSwingApplicationContext.getContext().getConfig(); StringBuilder scale = new StringBuilder(); for (int i = 0; i < config.getScale(); i++) { scale.append("0"); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -29,7 +29,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaConfig; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.jdesktop.swingx.JXDatePicker; import javax.swing.*; @@ -61,7 +61,7 @@ /** constructor */ public DateTableCellEditor() { - datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale()); + datePicker = new JXDatePicker(LimaSwingApplicationContext.getContext().getConfig().getLocale()); datePicker.getEditor().addFocusListener(this); datePicker.getEditor().addAncestorListener(this); datePicker.setFormats( Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/AccountsPane.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ImportService; @@ -69,7 +69,7 @@ public void hyperlinkUpdate(HyperlinkEvent e) { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { if (e.getDescription().equals("#accountschart")) { - MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view); + MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view); ui.getHandler().showAccountView(ui); } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/EntryBooksPane.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.ImportService; @@ -71,7 +71,7 @@ public void hyperlinkUpdate(HyperlinkEvent e) { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { if (e.getDescription().equals("#entrybookschart")) { - MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view); + MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view); ui.getHandler().showEntryBookView(ui); } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FinancialTransactionsPane.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.FinancialTransactionService; @@ -83,10 +83,10 @@ if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { if (e.getDescription().equals("#financialtransactionunbalanced")) { - MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view); + MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view); ui.getHandler().showTransactionUnbalancedView(ui); } else if (e.getDescription().equals("#financialtransactionbalanced")) { - MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view); + MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view); ui.getHandler().showTransactionView(ui); } } Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/FiscalYearsPane.java 2014-09-25 15:25:32 UTC (rev 3922) @@ -27,7 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaContext; +import org.chorem.lima.LimaSwingApplicationContext; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.business.api.ImportService; @@ -77,7 +77,7 @@ public void hyperlinkUpdate(HyperlinkEvent e) { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { if (e.getDescription().equals("#fiscalperiodschart")) { - MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(view); + MainView ui = LimaSwingApplicationContext.MAIN_UI_ENTRY_DEF.getContextValue(view); ui.getHandler().showFiscalPeriodView(ui); } } Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2014-09-19 15:21:43 UTC (rev 3921) +++ trunk/pom.xml 2014-09-25 15:25:32 UTC (rev 3922) @@ -173,7 +173,7 @@ <!-- customized libs version --> <jettyPluginVersion>9.2.2.v20140723</jettyPluginVersion> <nuitonUtilsVersion>3.0-SNAPSHOT</nuitonUtilsVersion> - <nuitonConfigVersion>3.0-alpha-4</nuitonConfigVersion> + <nuitonConfigVersion>3.0-rc-1</nuitonConfigVersion> <nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion> <nuitonProfilingVersion>3.0</nuitonProfilingVersion> <nuitonCsvVersion>3.0-rc-4</nuitonCsvVersion> @@ -191,8 +191,8 @@ <itextVersion>4.2.1</itextVersion> <nuitonWidgetsVersion>1.1.1</nuitonWidgetsVersion> - <jaxxVersion>2.9</jaxxVersion> - <openEjbVersion>4.6.0.2</openEjbVersion> + <jaxxVersion>2.10</jaxxVersion> + <openEjbVersion>4.7.0</openEjbVersion> <slf4jVersion>1.7.7</slf4jVersion> <swingxVersion>1.6.5-1</swingxVersion> <pdfboxVersion>1.8.6</pdfboxVersion> @@ -330,9 +330,8 @@ <dependency> <groupId>org.nuiton.topia</groupId> - <artifactId>topia-service-migration</artifactId> + <artifactId>topia-service-flyway</artifactId> <version>${topiaVersion}</version> - <scope>compile</scope> </dependency> <dependency>