Nuiton-config-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- 221 discussions
r2588 - branches tags trunk trunk/src trunk/src/license trunk/src/main/java/org/nuiton trunk/src/main/java/org/nuiton/config trunk/src/main/resources trunk/src/site trunk/src/site/apt trunk/src/test/java/org/nuiton trunk/src/test/java/org/nuiton/config trunk/src/test/resources
by tchemit@users.nuiton.org 20 Jul '13
by tchemit@users.nuiton.org 20 Jul '13
20 Jul '13
Author: tchemit
Date: 2013-07-20 16:01:21 +0200 (Sat, 20 Jul 2013)
New Revision: 2588
Url: http://nuiton.org/projects/nuiton-config/repository/revisions/2588
Log:
transform from nuiton-utils project
Added:
trunk/src/license/
trunk/src/license/THIRD-PARTY.properties
trunk/src/main/
trunk/src/main/java/org/nuiton/config/
trunk/src/main/java/org/nuiton/config/ApplicationConfigSaveException.java
trunk/src/test/
trunk/src/test/java/org/nuiton/config/
Removed:
branches/0.29-SNAPSHOT/
branches/codelutin/
branches/lutinutil-sans-vcs/
tags/0.21/
tags/0.22/
tags/0.25/
tags/0.26/
tags/0.27/
tags/0.30/
tags/1.0/
tags/isis-ver-2-2-3/
tags/isis-ver-2-2-4/
tags/lutinutil-1.0.1/
tags/lutinutil-1.0.5/
tags/lutinutil_before_lutinproject:2.4/
tags/nuiton-csv-2.6.12.1/
tags/nuiton-utils-1.1.0-rc-1/
tags/nuiton-utils-1.1.0-rc-2/
tags/nuiton-utils-1.1.0-rc-3/
tags/nuiton-utils-1.1.0-rc-4/
tags/nuiton-utils-1.1.0-rc-5/
tags/nuiton-utils-1.1.0-rc-6/
tags/nuiton-utils-1.1.0-rc-7/
tags/nuiton-utils-1.1.0-rc-8/
tags/nuiton-utils-1.2.1/
tags/nuiton-utils-1.2.2/
tags/nuiton-utils-1.4.1/
tags/nuiton-utils-1.4.2/
tags/nuiton-utils-2.4.1/
tags/nuiton-utils-2.4.2/
tags/nuiton-utils-2.4.3/
tags/nuiton-utils-2.4.4/
tags/nuiton-utils-2.4.5/
tags/nuiton-utils-2.4.6/
tags/nuiton-utils-2.4.7/
tags/nuiton-utils-2.4.8/
tags/nuiton-utils-2.6.1/
tags/nuiton-utils-2.6.2/
tags/nuiton-utils-2.6.3/
tags/nuiton-utils-2.6.4/
tags/nuiton-utils-2.6.5/
tags/nuiton-utils-2.6.6/
tags/nuiton-utils-2.6.7/
tags/nuiton-utils-2.6.8/
tags/nuiton-utils-2.6.9/
tags/start/
tags/ver-isis-2-0-11/
trunk/changelog.txt
trunk/nuiton-config/
trunk/nuiton-csv/
trunk/nuiton-updater/
trunk/nuiton-utils-maven-report-plugin/
trunk/nuiton-utils/
trunk/nuiton-validator/
trunk/src/main/java/org/nuiton/util/
trunk/src/main/resources/i18n/
trunk/src/test/java/org/nuiton/util/
Modified:
trunk/pom.xml
trunk/src/main/java/org/nuiton/config/ApplicationConfig.java
trunk/src/main/java/org/nuiton/config/ApplicationConfigHelper.java
trunk/src/main/java/org/nuiton/config/ApplicationConfigProvider.java
trunk/src/main/java/org/nuiton/config/ArgumentsParserException.java
trunk/src/main/java/org/nuiton/config/ConfigActionDef.java
trunk/src/main/java/org/nuiton/config/ConfigOptionDef.java
trunk/src/site/apt/index.apt
trunk/src/site/site_fr.xml
trunk/src/test/java/org/nuiton/config/ApplicationConfigTest.java
trunk/src/test/resources/log4j.properties
Deleted: trunk/changelog.txt
===================================================================
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/pom.xml 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,58 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Nuiton Utils
- %%
- Copyright (C) 2004 - 2012 CodeLutin, Tony Chemit
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Lesser Public License for more details.
-
- You should have received a copy of the GNU General Lesser Public
- License along with this program. If not, see
- <http://www.gnu.org/licenses/lgpl-3.0.html>.
- #L%
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>3.4.11</version>
+ <version>3.4.13</version>
</parent>
- <artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <artifactId>nuiton-config</artifactId>
+ <version>3.0-SNAPSHOT</version>
- <modules>
- <module>nuiton-utils</module>
- <module>nuiton-config</module>
- <module>nuiton-updater</module>
- <module>nuiton-csv</module>
- <module>nuiton-validator</module>
- <module>nuiton-utils-maven-report-plugin</module>
- </modules>
+ <name>Nuiton Config</name>
+ <description>Simple Application config API</description>
+ <inceptionYear>2013</inceptionYear>
+ <url>http://maven-site.nuiton.org/nuiton-config</url>
- <name>Nuiton Utils</name>
- <description>Parent of nuiton utils projects.</description>
- <inceptionYear>2011</inceptionYear>
- <url>http://maven-site.nuiton.org/nuiton-utils</url>
-
<developers>
<developer>
- <name>Brendan Le Ny</name>
+ <name>Benjamin Poussin</name>
<id>bleny</id>
- <email>bleny(a)codelutin.com</email>
+ <email>poussin at codelutin dot com</email>
<organization>CodeLutin</organization>
<organizationUrl>http://www.codelutin.com/</organizationUrl>
<timezone>Europe/Paris</timezone>
@@ -62,52 +34,6 @@
</developer>
<developer>
- <name>Benjamin Poussin</name>
- <id>bpoussin</id>
- <email>poussin(a)codelutin.com</email>
- <organization>CodeLutin</organization>
- <organizationUrl>http://www.codelutin.com/</organizationUrl>
- <timezone>Europe/Paris</timezone>
- <roles>
- <role>developer</role>
- <role>Debian packager</role>
- </roles>
- </developer>
-
- <developer>
- <name>Éric Chatellier</name>
- <id>echatellier</id>
- <email>chatellier(a)codelutin.com</email>
- <organization>CodeLutin</organization>
- <organizationUrl>http://www.codelutin.com/</organizationUrl>
- <timezone>Europe/Paris</timezone>
- <roles>
- <role>developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Florian Desbois</name>
- <id>fdesbois</id>
- <timezone>Europe/Paris</timezone>
- <roles>
- <role>developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Sylvain Letellier</name>
- <id>sletellier</id>
- <email>letellier(a)codelutin.com</email>
- <organization>CodeLutin</organization>
- <organizationUrl>http://www.codelutin.com/</organizationUrl>
- <timezone>Europe/Paris</timezone>
- <roles>
- <role>developer</role>
- </roles>
- </developer>
-
- <developer>
<name>Tony Chemit</name>
<id>tchemit</id>
<email>chemit at codelutin dot com</email>
@@ -121,16 +47,10 @@
</developers>
- <packaging>pom</packaging>
-
<properties>
- <projectId>nuiton-utils</projectId>
+ <projectId>nuiton-config</projectId>
- <nuitonI18nVersion>2.5</nuitonI18nVersion>
- <xworkVersion>2.3.7</xworkVersion>
- <doxiaVersion>1.3</doxiaVersion>
-
<!-- i18n configuration -->
<i18n.bundles>fr_FR,en_GB,es_ES</i18n.bundles>
@@ -139,206 +59,61 @@
</properties>
- <dependencyManagement>
+ <dependencies>
- <dependencies>
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>2.6.12</version>
+ </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-vfs2</artifactId>
- <version>2.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.maven.scm</groupId>
- <artifactId>maven-scm-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.scm</groupId>
- <artifactId>maven-scm-provider-svnexe</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.nuiton.i18n</groupId>
- <artifactId>nuiton-i18n</artifactId>
- <version>${nuitonI18nVersion}</version>
- </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
- <dependency>
- <groupId>net.sourceforge.javacsv</groupId>
- <artifactId>javacsv</artifactId>
- <version>2.0</version>
- </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
- <!-- xworks dependencies -->
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
- <dependency>
- <groupId>org.apache.struts.xwork</groupId>
- <artifactId>xwork-core</artifactId>
- <version>${xworkVersion}</version>
- </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </dependency>
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.12.1.GA</version>
- <scope>runtime</scope>
- </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
- <!-- maven dependencies for report plugin module -->
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>${mavenVersion}</version>
- <scope>provided</scope>
- </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${mavenVersion}</version>
- <scope>provided</scope>
- </dependency>
+ </dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-settings</artifactId>
- <version>${mavenVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- <version>${mavenVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>${mavenVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>${pluginPluginVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.reporting</groupId>
- <artifactId>maven-reporting-api</artifactId>
- <version>2.2.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.reporting</groupId>
- <artifactId>maven-reporting-impl</artifactId>
- <version>2.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-i18n</artifactId>
- <version>1.0-beta-10</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>3.0.10</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-component-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- doxia -->
-
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-core</artifactId>
- <version>${doxiaVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-site-renderer</artifactId>
- <version>${doxiaVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </exclusion>
- <exclusion>
- <groupId>velocity</groupId>
- <artifactId>velocity</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-decoration-model</artifactId>
- <version>${doxiaVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-sink-api</artifactId>
- <version>${doxiaVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.3.04</version>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <build>
- <pluginManagement>
- <plugins>
-
- <!-- plugin i18n -->
- <plugin>
- <groupId>org.nuiton.i18n</groupId>
- <artifactId>i18n-maven-plugin</artifactId>
- <version>${nuitonI18nVersion}</version>
- </plugin>
-
- </plugins>
- </pluginManagement>
- </build>
-
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/trunk
+ scm:svn:http://svn.nuiton.org/svn/nuiton-config/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/trunk
+ scm:svn:http://svn.nuiton.org/svn/nuiton-config/trunk
</developerConnection>
- <url>http://nuiton.org/projects/nuiton-utils/repository/show/trunk</url>
+ <url>http://nuiton.org/projects/nuiton-config/repository/show/trunk</url>
</scm>
<distributionManagement>
@@ -391,6 +166,45 @@
</profile>
+ <!-- create assemblies at release time -->
+ <profile>
+ <id>assembly-profile</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <plugins>
+
+ <!-- launch in a release the assembly automaticly -->
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-assemblies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <attach>false</attach>
+ <descriptorRefs>
+ <descriptorRef>deps</descriptorRef>
+ <descriptorRef>full</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+ </profile>
+
</profiles>
</project>
Added: trunk/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/src/license/THIRD-PARTY.properties (rev 0)
+++ trunk/src/license/THIRD-PARTY.properties 2013-07-20 14:01:21 UTC (rev 2588)
@@ -0,0 +1,19 @@
+# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
+#-------------------------------------------------------------------------------
+# Already used licenses in project :
+# - BSD License
+# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+# - Common Public License Version 1.0
+# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - Lesser General Public License (LGPL) v 3.0
+# - Lesser General Public License (LPGL)
+# - Lesser General Public License (LPGL) v 2.1
+# - MIT License
+# - New BSD License
+# - The Apache Software License, Version 2.0
+#-------------------------------------------------------------------------------
+# Please fill the missing licenses for dependencies :
+#
+#
+#Sat Jul 20 15:32:25 CEST 2013
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
Property changes on: trunk/src/license/THIRD-PARTY.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/src/main/java/org/nuiton/config/ApplicationConfig.java
===================================================================
--- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfig.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/main/java/org/nuiton/config/ApplicationConfig.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL$
* %%
@@ -77,8 +77,6 @@
import java.util.Properties;
import java.util.Set;
-import static org.nuiton.i18n.I18n._;
-
/**
* Application configuration.
* <p/>
@@ -298,9 +296,7 @@
* @author Benjamin Poussin <poussin(a)codelutin.com>
* @author tchemit <chemit(a)codelutin.com>
* @since 0.30
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public class ApplicationConfig {
/** Logger. */
@@ -704,7 +700,7 @@
*
* @param excludeKeys optional list of keys to exclude from
*/
- public void saveForSystem(String... excludeKeys) {
+ public void saveForSystem(String... excludeKeys) throws ApplicationConfigSaveException {
File file = getSystemConfigFile();
if (log.isDebugEnabled()) {
log.debug("will save system configuration in " + file);
@@ -712,10 +708,7 @@
try {
save(file, false, excludeKeys);
} catch (IOException eee) {
- if (log.isWarnEnabled()) {
- log.warn(_("nuitonutil.error.applicationconfig.save", file),
- eee);
- }
+ throw new ApplicationConfigSaveException(eee);
}
}
@@ -725,7 +718,7 @@
*
* @param excludeKeys optional list of keys to exclude from
*/
- public void saveForUser(String... excludeKeys) {
+ public void saveForUser(String... excludeKeys) throws ApplicationConfigSaveException {
File file = getUserConfigFile();
if (log.isDebugEnabled()) {
log.debug("will save user configuration in " + file);
@@ -733,10 +726,7 @@
try {
save(file, false, excludeKeys);
} catch (IOException eee) {
- if (log.isWarnEnabled()) {
- log.warn(_("nuitonutil.error.applicationconfig.save", file),
- eee);
- }
+ throw new ApplicationConfigSaveException(eee);
}
}
@@ -762,7 +752,7 @@
* nor save in user user config file.
* @since 2.6.6
*/
- public void cleanUserConfig(String... excludeKeys) {
+ public void cleanUserConfig(String... excludeKeys) throws ApplicationConfigSaveException {
Set<String> keys = new HashSet<String>(homefile.stringPropertyNames());
@@ -2075,8 +2065,8 @@
File homeConfig)
throws IOException {
if (log.isInfoEnabled()) {
- log.info(_("nuitonutil.config.moving.conf",
- oldHomeConfig.getPath(), homeConfig.getPath()));
+ log.info(String.format("Moving old configuration file from %s to %s",
+ oldHomeConfig.getPath(), homeConfig.getPath()));
}
boolean b = oldHomeConfig.renameTo(homeConfig);
Modified: trunk/src/main/java/org/nuiton/config/ApplicationConfigHelper.java
===================================================================
--- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfigHelper.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/main/java/org/nuiton/config/ApplicationConfigHelper.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL$
* %%
@@ -36,9 +36,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.4.8
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public class ApplicationConfigHelper {
/** Logger. */
Modified: trunk/src/main/java/org/nuiton/config/ApplicationConfigProvider.java
===================================================================
--- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfigProvider.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/main/java/org/nuiton/config/ApplicationConfigProvider.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL$
* %%
@@ -40,9 +40,7 @@
*
* @author tchemit <chemit(a)codelutin.com>
* @since 1.4.8
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public interface ApplicationConfigProvider {
/**
Added: trunk/src/main/java/org/nuiton/config/ApplicationConfigSaveException.java
===================================================================
--- trunk/src/main/java/org/nuiton/config/ApplicationConfigSaveException.java (rev 0)
+++ trunk/src/main/java/org/nuiton/config/ApplicationConfigSaveException.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -0,0 +1,39 @@
+package org.nuiton.config;
+
+/*
+ * #%L
+ * Nuiton Config
+ * $Id$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * throw if any error when saving configuration.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 3.0
+ */
+public class ApplicationConfigSaveException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public ApplicationConfigSaveException(Throwable cause) {
+ super(cause);
+ }
+}
Property changes on: trunk/src/main/java/org/nuiton/config/ApplicationConfigSaveException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/src/main/java/org/nuiton/config/ArgumentsParserException.java
===================================================================
--- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ArgumentsParserException.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/main/java/org/nuiton/config/ArgumentsParserException.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL$
* %%
@@ -29,9 +29,7 @@
*
* @author Benjamin Poussin <poussin(a)codelutin.com>
* @since 2.7
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public class ArgumentsParserException extends Exception {
private static final long serialVersionUID = 1L;
Modified: trunk/src/main/java/org/nuiton/config/ConfigActionDef.java
===================================================================
--- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ConfigActionDef.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/main/java/org/nuiton/config/ConfigActionDef.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL$
* %%
@@ -59,9 +59,7 @@
* @author sletellier
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.10
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public interface ConfigActionDef extends Serializable {
/**
Modified: trunk/src/main/java/org/nuiton/config/ConfigOptionDef.java
===================================================================
--- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ConfigOptionDef.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/main/java/org/nuiton/config/ConfigOptionDef.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL:$
* %%
@@ -110,9 +110,7 @@
* </pre>
*
* @since 1.0.0-rc-9
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public interface ConfigOptionDef extends Serializable {
/** @return la clef identifiant l'option */
Modified: trunk/src/site/apt/index.apt
===================================================================
--- trunk/src/site/apt/index.apt 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/site/apt/index.apt 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,11 +1,10 @@
~~~
~~ #%L
-~~ Nuiton Utils
-~~
+~~ Nuiton Config
~~ $Id$
~~ $HeadURL$
~~ %%
-~~ Copyright (C) 2004 - 2010 CodeLutin
+~~ Copyright (C) 2013 CodeLutin
~~ %%
~~ This program is free software: you can redistribute it and/or modify
~~ it under the terms of the GNU Lesser General Public License as
@@ -23,70 +22,353 @@
~~ #L%
~~~
----
- Nuiton utils
+ Nuiton config
----
----
2009-08-23
----
-
Présentation
- Ensemble de projets utilitaires.
+ La classe ApplicationConfig a pour but de gérer les options et actions
+ disponibles au sein d'une application. Elle gère aussi bien :
-Librairie Nuiton-utils
+ * la lecture de fichier de configuration ;
- Librairie regroupant les utilitaires classiques sur les fichiers, les tableaux,
- les collections, les maps, les chaînes de caractères, ... De plus elle intègre
- un parser des arguments et des options pour les lignes de commande (ApplicationConfig).
+ * le parsage de la ligne de commande ;
- {{{./nuiton-utils}Plus d'infos}}
+ * l'execution des actions ;
-Librairie Nuiton-validator
+ * la sauvegarde de la configuration.
- <<Ce module a été déplacé en version 2.7 vers http://maven-site.nuiton.org/nuiton-validator>>.
- <<Le module sera supprimé en version 3.0.>>
+Lecture/écriture
- Cette librairie propose une Api de validation plus complète que la JSR-303,
- permettant nottament de préciser des scopes (info, erreur, warning, ...)
+* Lecture des fichiers de configuration
- {{{./nuiton-validator}Plus d'infos}}
+ La lecture des fichiers de configuration est effectuée lors de l'appel
+ à la methode <<<parse(String...)>>> en utilisant la valeur de
+ <<<getConfigFileName()>>> pour trouver les fichiers à lire.
-Librairie Nuiton-csv
+* La sauvegarde
- <<Ce module a été déplacé en version 2.7 vers http://maven-site.nuiton.org/nuiton-csv>>.
+ La sauvegarde des options se fait via une des trois methodes disponibles :
- <<Le module sera supprimé en version 3.0.>>
+ * <<<save>>> : sauvegarde dans un fichier specifique ;
- Cette librairie propose une Api simple d'import export au format csv.
+ * <<<saveForSystem>>> : sauvegarde les donnees dans /etc ;
- {{{./nuiton-csv}Plus d'infos}}
+ * <<<saveForUser>>> : sauvegarde les donnees dans $HOME.
-Librairie Nuiton-config
+ []
- <<Ce module a été déplacé en version 2.7 vers http://maven-site.nuiton.org/nuiton-config>>.
+ Seules les options qui ont été modifiées par l'application (par la methode
+ <<<setOption()>>>) seront sauvegardées. Les variables d'environnement, les
+ arguments de la ligne de commandes(etc...) ne seront pas sauvegardés.
- <<Le module sera supprimé en version 3.0.>>
+* Configuration multi instance
- Cette librairie propose une Api simple de configuration d'application.
+ Il est possible d'associer un nom de contexte à une configuration via la
+ methode <<<setAppName("azerty")>>>. Ainsi, les fichiers seront cherchés
+ dans le dossier défini par l'option <<<azerty.config.path>>> si elle existe
+ (sinon, dans le dossier par défaut) et le nom du fichier cherché defini
+ par l'option <<<azerty.config.file>>>.
- {{{./nuiton-config}Plus d'infos}}
+ Cette option est utilisée par exemple pour installer plusieurs instances
+ d'application dans un serveur web et que chaque instance aille
+ chercher ses fichiers de configuration à son propre endroit.
-Librairie Nuiton-updater
+Fonctionnalités
- <<Ce module a été déplacé en version 2.7 vers http://maven-site.nuiton.org/nuiton-updater>>.
+* Les options de configuration
- <<Le module sera supprimé en version 3.0.>>
+ L'ordre de prise en compte des options est le suivant :
- Cette librairie propose une Api simple de mise à jour d'application.
+ * Option renseignée par programmation ;
- {{{./nuiton-updater}Plus d'infos}}
+ * Ligne de commande ;
-Rapports Maven
+ * Propriétés système (System.getProperties()) ;
- <<Ajouté en version 2.4.8>>, ce module permet la génération de rapports
- Maven liés aux outils offerts par les librairies de ce projet
- (ApplicationConfig,...).
+ * Propriétés d'environnement (System.getenv()) ;
- {{{./nuiton-utils-maven-report-plugin}Plus d'infos}}
+ * Fichier du dossier courant ( ./ + nom du fichier) ;
+
+ * Fichier de configuration globale ( /etc/ + nom du fichier) ;
+
+ * Fichier dans le classpath ( / + nom du fichier) ;
+
+ * Valeur par défaut (renseignée à l'init).
+
+ []
+
+ Cela signifie par exemple que si une option a une valeur par défaut et qu'elle
+ est renseignée dans le fichier /etc et sur la ligne de commande, c'est la
+ valeur présente sur la ligne de commande qui sera prise en compte.
+
+* Les actions
+
+ Les actions ne peuvent être renseignées que sur la ligne de commande. Exemple :
+
++------------------------------------------------
+--org.nuiton.test.Test#doLogin user password true
++------------------------------------------------
+
+ Une action est donc définie par le chemin complet de la methode qui traitera
+ l'action. Si la methode est statique, elle sera appelée directement. Dans le
+ cas contraire, la classe contenant la méthode sera instanciée à partir
+ d'un constructeur prenant en paramètre seulement la configuration, ou, s'il
+ n'est pas disponible, le constructeur par défaut. La méthode sera ensuite
+ appelée sur cette instance. Les diverses instances sont conservées pour
+ effectuer plusieurs actions.
+
+ Les arguments de la méthode utilisés lors de l'appel sont convertis
+ dans le bon type. Si la méthode a des arguments de taille variante (...)
+ tous les arguments jusqu'à la prochaine option ou à la fin de la ligne
+ seront utilisés.
+
+ Si vous avez des paramètres optionnels, le seul moyen est d'utiliser des
+ arguments variants.
+
+ Par exemple, la ligne de commande précédente appelera la methode :
+
++-------------------------------------------
+public class Test {
+ public doLogin(String login, String password, boolean dryRun) {
+ [...]
+ }
+}
++-------------------------------------------
+
+ Les actions ne sont pas executées, mais seulement parsées. Cela signifie
+ qu'elles seront executées seulement lorsque l'application appelera la méthode
+ <<<doAction(int)>>>.
+ Par défaut, toutes les actions sont de niveau 0 et sont executées dans leur
+ ordre d'apparition sur la ligne de commande.
+ Il est possible de différencier les différentes actions en utilisant
+ l'annotation <<<@Step>>>
+
++-------------------------------------------
+doAction(0);
+... do something ...
+doAction(1);
++-------------------------------------------
+
+ Dans cet exemple, les actions 0 et 1 ne sont pas effectuées au même moment.
+ C'est très utile par exemple pour éxecuter certaines actions avant le démarrage
+ de l'UI par exemple, et d'autres après...
+
+* Les arguments non parsés
+
+ La configuration 'consomme' les arguments de la ligne de commande qu'elle a
+ réussie à traiter. Pour recupérer les autres arguments propres à l'application
+ il est possible de les obtenir grace à la méthode <<<getUnparsed()>>>.
+ Si l'on souhaite forcer la fin du parsing de la ligne de commande il est
+ possible de mettre <<<-->>>.
+
+ Par exemple, la ligne suivante :
+
++-------------------------------------------
+monApplication "mon arg" --option k1 v1 -- --option k2 v2 -- autre
++-------------------------------------------
+
+ Renverra la liste suivante via <<<getUnparsed()>>> :
+
++-------------------------------------------
+"mon arg", "--option", "k2", "v2", "--", "autre"
++-------------------------------------------
+
+* Les alias
+
+ Il est possible d'utiliser des alias pour definir les options et les actions.
+ Ces alias doivent être renseignés par la methode <<<addAlias(String, String>>>:
+
++-------------------------------------------
+addAlias("-v", "--option", "verbose", "true");
+addAlias("-o", "--option", "outputfile");
+addAlias("-i", "--mon.package.MaClass#MaMethode", "import");
++-------------------------------------------
+
+ Dans le premier exemple on simplifie une option de flags l'option -v n'attend
+ donc plus d'argument. Dans le second exemple on simplifie une option qui
+ attend encore un argment de type File. Enfin dans le troisieme exemple
+ on simplifie la syntaxe d'une action et on force le premier argument de
+ l'action à être "import".
+
+ Lors du parsing de la ligne de commande, tous les alias sont remplacés par
+ leur correspondance. Il est donc possible d'utiliser ce mecanisme pour
+ autre chose :
+
++-------------------------------------------
+addAlias("cl", "Code Lutin");
++-------------------------------------------
+
+
+* Conversion de type
+
+ Pour convertir les types des options et arguments de méthodes,
+ {{{http://commons.apache.org/beanutils/}commons-beanutils}} est utilisé.
+
+ Les types actuellement supporté sont :
+
+ * <<<java.lang.String>>> ;
+
+ * <<<java.io.File>>> ;
+
+ * <<<java.net.URL>>> ;
+
+ * <<<java.lang.Class>>> ;
+
+ * <<<java.sql.Date>>> ;
+
+ * <<<java.sql.Time>>> ;
+
+ * <<<java.sql.Timestamp>>> ;
+
+ * Les tableaux d'un type primitif ou {@link String}. Chaque élément doit
+ être séparé par une virgule.
+
+ []
+
+ Pour utiliser d'autres types, il suffit de les enregistrer dans beanutils via
+ la méthode <<<ConvertUtils.register(Converter, Class)>>>
+
+* Les substitutions de variable
+
+ La configuration de variable supporte la substitution par d'autres variables
+ via la syntaxe <<<$\{xxx\}>>> où <<<xxx>>> est une autre variable de
+ la configuration.
+
+ Par exemple (fichier de configuration) :
+
++-------------------------------------------
+application.name = Mon Appli
+application.version = 1.2.3
+application.info = ${application.name} ${application.version} (${java.version})
++-------------------------------------------
+
+ L'appel de l'option <<<application.info>>> via la methode <<<getOption()>>>
+ retournera une chaîne de la forme :
+
++-------------------------------------------
+Mon Appli 1.2.3 (1.6.0_18)
++-------------------------------------------
+
+ À noter que les substitutions ne sont remplacées qu'a leur lecture, la sauvegarde
+ de l'option <<<application.info>>> se fera sans remplacement.
+
+Mise en oeuvre
+
+* Définition
+
+ Voici l'ensemble des tâches à effectuer pour définir une configuration
+ d'application :
+
+ * Creation d'une sous classe d'<<<ApplicationConfig>>> ;
+
+ * Ajout des options par défaut ;
+
+ * Création des classes et méthodes d'actions ;
+
+ * Déclaration des alias des options et actions.
+
+ []
+
+ Exemple :
+
++-------------------------------------------
+public class MyConfig extends ApplicationConfig {
+
+ public static final int AFTER_LOGIN = 1;
+
+ public MyConfig () {
+ // options par défaut
+ setDefaultOption("user", "anonymous");
+ setDefaultOption("password", "");
+ // ajout des alias
+ addAlias("-u", "--user");
+ addAlias("-p", "--password");
+ addActionAlias("--login", MyConfig.class.getName + "#" + "doLogin");
+ }
+
+ public void setUser(String user) {
+ setOption("user", user);
+ }
+
+ public void setUser(String user) {
+ setOption("user", user);
+ }
+
+ public void doLogin(String user, String password) {
+ [...]
+ }
+
+ @Step(AFTER_LOGIN)
+ public void doSomething() {
+ [...]
+ }
+}
++-------------------------------------------
+
+* Usage
+
+ La configuration doit principalement être initilalisée grâce à la méthode
+ <<<parse(String[])>>> avant d'être utilisée.
+
++-------------------------------------------
+public static void main(String[] args) {
+ MyConfig config = new MyConfig();
+ config.setConfigFileName("myconfig.conf");
+ config.parse(args);
+
+ System.out.println("Connecting with " : + config.getOption("user"));
+ config.doAction(0);
+ System.out.println("Connected, do something...");
+ config.doAction(MyConfig.AFTER_LOGIN);
+}
++-------------------------------------------
+
+* Utilisation du ApplicationConfigProvider
+
+ Ce contrat ajouté en version <2.4.8> permet de spécifier qu'une librairie
+ ou une application offre des options.
+
+ Il suffit d'implanter ce contrat et de le rendre disponible via le mécanisme
+ de ServiceLoader.
+
+** Exemple
+
++-------------------------------------------
+public class PollenApplicationConfigProvider implements ApplicationConfigProvider {
+
+ @Override
+ public String getName() {
+ return "pollen";
+ }
+
+ @Override
+ public String getDescription(Locale locale) {
+ return l_(locale, "pollen.application.config");
+ }
+
+ @Override
+ public ApplicationConfig.OptionDef[] getOptions() {
+ return PollenConfigurationOption.values();
+ }
+
+ @Override
+ public ApplicationConfig.ActionDef[] getActions() {
+ return new ApplicationConfig.ActionDef[0];
+ }
+}
++-------------------------------------------
+
+ Puis ajouter le fichier <META-INF/services/org.nuiton.util.ApplicationConfigProvider>
+ dans les resources du projet :
+
++-------------------------------------------
+org.chorem.pollen.PollenApplicationConfigProvider
++-------------------------------------------
+
+ Cela permet ensuite, par exemple, de générer un rapport contenant toutes les
+ options disponibles dans l'application.
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/site/site_fr.xml 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
- Nuiton Utils
-
+ Nuiton Config
$Id$
$HeadURL$
%%
- Copyright (C) 2004 - 2010 CodeLutin
+ Copyright (C) 2013 CodeLutin
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -85,8 +84,6 @@
href="${project.url}/index.html"/>
</breadcrumbs>
- <menu ref="modules"/>
-
<menu name="Utilisateur">
<item name="Accueil" href="index.html"/>
</menu>
Modified: trunk/src/test/java/org/nuiton/config/ApplicationConfigTest.java
===================================================================
--- trunk/nuiton-config/src/test/java/org/nuiton/util/config/ApplicationConfigTest.java 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/test/java/org/nuiton/config/ApplicationConfigTest.java 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,8 +1,8 @@
-package org.nuiton.util.config;
+package org.nuiton.config;
/*
* #%L
- * Nuiton Utils :: Nuiton Config
+ * Nuiton Config
* $Id$
* $HeadURL$
* %%
@@ -38,7 +38,7 @@
import org.nuiton.util.FileUtil;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
-import org.nuiton.util.config.ApplicationConfig.Action;
+import org.nuiton.config.ApplicationConfig.Action;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -60,9 +60,7 @@
* @author Benjamin Poussin <poussin(a)codelutin.com>
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.10
- * @deprecated since 2.7, use now the http://maven-site.nuiton.org/nuiton-config project, This module will be remove in version 3.0
*/
-@Deprecated
public class ApplicationConfigTest {
private static final Log log =
Modified: trunk/src/test/resources/log4j.properties
===================================================================
--- trunk/nuiton-config/src/test/resources/log4j.properties 2013-07-20 07:10:55 UTC (rev 2587)
+++ trunk/src/test/resources/log4j.properties 2013-07-20 14:01:21 UTC (rev 2588)
@@ -1,6 +1,6 @@
###
# #%L
-# Nuiton Utils :: Nuiton Config
+# Nuiton Config
# $Id$
# $HeadURL$
# %%
@@ -30,4 +30,4 @@
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
# package level
-log4j.logger.org.nuiton.util.config=INFO
+log4j.logger.org.nuiton.config=INFO
1
0