This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository observe. See https://gitlab.nuiton.org/codelutin/observe.git commit 8278ce8d4452a8b02033fc62e17e2e11b9fa723f Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Oct 7 19:08:31 2016 +0200 Use last stable of nuiton-config --- application-swing-configuration/pom.xml | 1 + .../ObserveSwingApplicationConfig.java | 82 +++++----------------- .../configuration/ObserveWebApplicationConfig.java | 37 ++-------- pom.xml | 2 +- 4 files changed, 22 insertions(+), 100 deletions(-) diff --git a/application-swing-configuration/pom.xml b/application-swing-configuration/pom.xml index f0a730a..2140dac 100644 --- a/application-swing-configuration/pom.xml +++ b/application-swing-configuration/pom.xml @@ -127,6 +127,7 @@ <id>generate-config</id> <configuration> <modelName>ObserveSwingApplication</modelName> + <generatePropertyChangeSupport>true</generatePropertyChangeSupport> </configuration> <goals> <goal>generate</goal> diff --git a/application-swing-configuration/src/main/java/fr/ird/observe/application/swing/configuration/ObserveSwingApplicationConfig.java b/application-swing-configuration/src/main/java/fr/ird/observe/application/swing/configuration/ObserveSwingApplicationConfig.java index 9d2adab..d3d8f64 100644 --- a/application-swing-configuration/src/main/java/fr/ird/observe/application/swing/configuration/ObserveSwingApplicationConfig.java +++ b/application-swing-configuration/src/main/java/fr/ird/observe/application/swing/configuration/ObserveSwingApplicationConfig.java @@ -2,7 +2,7 @@ * #%L * ObServe :: Application Swing * %% - * Copyright (C) 2008 - 2016 IRD, Codelutin, Tony Chemit + * Copyright (C) 2008 - 2016 IRD, Code Lutin, Tony Chemit * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as @@ -35,13 +35,10 @@ import org.nuiton.version.Version; import org.nuiton.version.Versions; import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.util.Arrays; import java.util.Calendar; -import java.util.Collections; import java.util.Date; import java.util.LinkedList; import java.util.List; @@ -63,15 +60,15 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat public static final String DB_NAME = "obstuna"; - static final String APPLICATION_VERSION = "application.version"; + private static final String APPLICATION_VERSION = "application.version"; - static final String VERSION = "version"; + private static final String VERSION = "version"; - static final String PROPERTY_LOCAL_STORAGE_EXIST = "localStorageExist"; + private static final String PROPERTY_LOCAL_STORAGE_EXIST = "localStorageExist"; - static final String PROPERTY_INITIAL_DUMP_EXIST = "initialDumpExist"; + private static final String PROPERTY_INITIAL_DUMP_EXIST = "initialDumpExist"; - static final String PROPERTY_MAIN_STORAGE_OPENED = "mainStorageOpened"; + private static final String PROPERTY_MAIN_STORAGE_OPENED = "mainStorageOpened"; /** Logger */ private static final Log log = LogFactory.getLog(ObserveSwingApplicationConfig.class); @@ -79,7 +76,7 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat static final String DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME = "observeSwing.conf"; /** - * un drepeau pour savoir s'il faut lancer l'interface graphique. Cette + * un drapeau pour savoir s'il faut lancer l'interface graphique. Cette * valeur peut être programmées lors des actions. */ private boolean displayMainUI = true; @@ -88,7 +85,7 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat private boolean localStorageExist; /** - * drapeau pour savoir si le dump initial a ete chargee depuis la base + * drapeau pour savoir si le dump initial a ete chargée depuis la base * centrale */ private boolean initialDumpExist; @@ -105,7 +102,7 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat /** * drapeau pour savoir si on peut utiliser des ui dans l'environnement. * - * Par defaut, on suppose qu'on peut utiliser l'environnement graphique et + * Par défaut, on suppose qu'on peut utiliser l'environnement graphique et * si on désactive explicitement ou si pas d'environnement graphique * trouvé. */ @@ -129,20 +126,18 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat ObserveSwingApplicationConfigOption.OBSTUNA_CAN_MIGRATE.getKey(), }; - protected final PropertyChangeSupport pcs; - //FIXME private final ImmutableSet<String> longlinVesselTypeIds = ImmutableSet.copyOf( Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505", - "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869", - "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1")); + "fr.ird.observe.entities.referentiel.VesselType#1239832675736#0.8708229847859869", + "fr.ird.observe.entities.referentiel.VesselType#1239832686137#0.1")); private final ImmutableSet<String> seineVesselTypeIds = ImmutableSet.copyOf( Sets.newHashSet("fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.044156847891821505", - "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357", - "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519", - "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084", - "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407")); + "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.307197212385357", + "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.7380146830307519", + "fr.ird.observe.entities.referentiel.VesselType#1239832675735#0.9086075071905084", + "fr.ird.observe.entities.referentiel.VesselType#1239832675737#0.43324169605639407")); public ObserveSwingApplicationConfig() { this(DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME); @@ -152,7 +147,6 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat ApplicationConfig delegate = get(); delegate.setEncoding(StandardCharsets.UTF_8.name()); delegate.setConfigFileName(confFileName); - pcs = new PropertyChangeSupport(this); } public void initConfig(Properties p, String... args) throws IOException, ArgumentsParserException { @@ -368,7 +362,7 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat // log.debug("toRemove : " + toRemove.length); } for (PropertyChangeListener listener : pcs.getPropertyChangeListeners()) { - pcs.removePropertyChangeListener(listener); + removePropertyChangeListener(listener); } if (log.isDebugEnabled()) { log.debug("after remove : " + pcs.getPropertyChangeListeners().length); @@ -387,22 +381,6 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat return longlinVesselTypeIds; } - public String replaceRecursiveOptions(String option) { - return get().replaceRecursiveOptions(option); - } - - public String getConfigurationDescription() { - StringBuilder builder = new StringBuilder(); - builder.append("\n====================================================================================================================="); - builder.append("\n=== Observe Swing configuration ====================================================================================="); - builder.append(String.format("\n=== %1$-40s = %2$s", "Filename", get().getConfigFileName())); - for (ObserveSwingApplicationConfigOption option : orderedByKey()) { - builder.append(String.format("\n=== %1$-40s = %2$s", option.getKey(), get().getOption(option))); - } - builder.append("\n====================================================================================================================="); - return builder.toString(); - } - ////////////////////////////////////////////////// // Toutes les étapes d'actions ////////////////////////////////////////////////// @@ -412,32 +390,4 @@ public class ObserveSwingApplicationConfig extends GeneratedObserveSwingApplicat AfterInit, BeforeExit } - public void addPropertyChangeListener(PropertyChangeListener listener) { - pcs.addPropertyChangeListener(listener); - } - - public void removePropertyChangeListener(PropertyChangeListener listener) { - pcs.removePropertyChangeListener(listener); - } - - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcs.addPropertyChangeListener(propertyName, listener); - } - - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - pcs.removePropertyChangeListener(propertyName, listener); - } - - private void firePropertyChange(String propertyName, Object newValue) { - pcs.firePropertyChange(propertyName, null, newValue); - } - - - private ImmutableList<ObserveSwingApplicationConfigOption> orderedByKey() { - - List<ObserveSwingApplicationConfigOption> values = Arrays.asList(ObserveSwingApplicationConfigOption.values()); - Collections.sort(values, (o1, o2) -> o1.getKey().compareTo(o2.getKey())); - return ImmutableList.copyOf(values); - - } } diff --git a/application-web-configuration/src/main/java/fr/ird/observe/application/web/configuration/ObserveWebApplicationConfig.java b/application-web-configuration/src/main/java/fr/ird/observe/application/web/configuration/ObserveWebApplicationConfig.java index 8c22786..8c75a26 100644 --- a/application-web-configuration/src/main/java/fr/ird/observe/application/web/configuration/ObserveWebApplicationConfig.java +++ b/application-web-configuration/src/main/java/fr/ird/observe/application/web/configuration/ObserveWebApplicationConfig.java @@ -23,7 +23,6 @@ package fr.ird.observe.application.web.configuration; */ import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableList; import com.google.common.io.CharSource; import com.google.common.io.Resources; import fr.ird.observe.util.ObserveUtil; @@ -41,9 +40,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; import java.util.Properties; /** @@ -58,7 +54,7 @@ public class ObserveWebApplicationConfig extends GeneratedObserveWebApplicationC /** Logger. */ private static Log log = LogFactory.getLog(ObserveWebApplicationConfig.class); - protected static final String DEFAULT_OBSERVE_WEB_CONFIGURATION_FILENAME = "observeweb.conf"; + private static final String DEFAULT_OBSERVE_WEB_CONFIGURATION_FILENAME = "observeweb.conf"; public ObserveWebApplicationConfig() { this(DEFAULT_OBSERVE_WEB_CONFIGURATION_FILENAME); @@ -112,13 +108,13 @@ public class ObserveWebApplicationConfig extends GeneratedObserveWebApplicationC } try { - createDirectory(baseDirectory); + Files.createDirectories(baseDirectory.toPath()); } catch (IOException e) { throw new ObserveWebApplicationConfigInitException("Impossible de créer le répertoire principal de l'application (" + baseDirectory + ")", e); } File temporaryDirectory = getTemporaryDirectory(); try { - createDirectory(temporaryDirectory); + Files.createDirectories(temporaryDirectory.toPath()); } catch (IOException e) { throw new ObserveWebApplicationConfigInitException("Impossible de créer le répertoire temporaire de l'application (" + temporaryDirectory + ")", e); } @@ -175,24 +171,7 @@ public class ObserveWebApplicationConfig extends GeneratedObserveWebApplicationC } - public String getConfigurationDescription() { - StringBuilder builder = new StringBuilder(); - builder.append("\n====================================================================================================================="); - builder.append("\n=== Observe Web configuration ======================================================================================="); - ApplicationConfig delegate = get(); - builder.append(String.format("\n=== %1$-40s = %2$s", "Filename", delegate.getConfigFileName())); - for (ObserveWebApplicationConfigOption option : orderedByKey()) { - builder.append(String.format("\n=== %1$-40s = %2$s", option.getKey(), delegate.getOption(option))); - } - builder.append("\n====================================================================================================================="); - return builder.toString(); - } - - protected void createDirectory(File directory) throws IOException { - Files.createDirectories(directory.toPath()); - } - - protected void initLog() { + private void initLog() { File logFile = getLog4jConfigurationFile(); @@ -226,12 +205,4 @@ public class ObserveWebApplicationConfig extends GeneratedObserveWebApplicationC } - - private ImmutableList<ObserveWebApplicationConfigOption> orderedByKey() { - - List<ObserveWebApplicationConfigOption> values = Arrays.asList(ObserveWebApplicationConfigOption.values()); - Collections.sort(values, (o1, o2) -> o1.getKey().compareTo(o2.getKey())); - return ImmutableList.copyOf(values); - - } } diff --git a/pom.xml b/pom.xml index 318d175..bfa7ae2 100644 --- a/pom.xml +++ b/pom.xml @@ -166,7 +166,7 @@ <nuitonI18nVersion>3.6.2</nuitonI18nVersion> <nuitonValidatorVersion>3.0.1</nuitonValidatorVersion> <nuitonUtilsVersion>3.0-rc-15</nuitonUtilsVersion> - <nuitonConfigVersion>3.1-SNAPSHOT</nuitonConfigVersion> + <nuitonConfigVersion>3.1</nuitonConfigVersion> <xworkVersion>2.3.30</xworkVersion> <hibernateVersion>4.3.11.Final</hibernateVersion> <sl4jVersion>1.7.21</sl4jVersion> -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.