Nuiton-utils-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
February 2013
- 4 participants
- 30 discussions
Author: tchemit
Date: 2013-02-24 11:39:44 +0100 (Sun, 24 Feb 2013)
New Revision: 2510
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2510
Log:
refs #2541: Introduce nuiton-updater module
Added:
trunk/nuiton-updater/
trunk/nuiton-updater/LICENSE.txt
trunk/nuiton-updater/README.txt
trunk/nuiton-updater/changelog.txt
trunk/nuiton-updater/pom.xml
trunk/nuiton-updater/src/
trunk/nuiton-updater/src/license/
trunk/nuiton-updater/src/license/THIRD-PARTY.properties
trunk/nuiton-updater/src/main/
trunk/nuiton-updater/src/main/java/
trunk/nuiton-updater/src/main/java/org/
trunk/nuiton-updater/src/main/java/org/nuiton/
trunk/nuiton-updater/src/main/java/org/nuiton/util/
trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/
trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationInfo.java
trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdater.java
trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdaterCallback.java
trunk/nuiton-updater/src/main/resources/
trunk/nuiton-updater/src/site/
trunk/nuiton-updater/src/site/apt/
trunk/nuiton-updater/src/site/apt/index.apt
trunk/nuiton-updater/src/site/site_fr.xml
trunk/nuiton-updater/src/test/
trunk/nuiton-updater/src/test/java/
trunk/nuiton-updater/src/test/java/org/
trunk/nuiton-updater/src/test/java/org/nuiton/
trunk/nuiton-updater/src/test/java/org/nuiton/util/
trunk/nuiton-updater/src/test/java/org/nuiton/util/updater/
trunk/nuiton-updater/src/test/java/org/nuiton/util/updater/ApplicationUpdaterTest.java
trunk/nuiton-updater/src/test/resources/
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/Readme.txt
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/version.appup
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App2/
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App2/Readme.txt
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/Readme.txt
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/version.appup
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App2-7.zip
trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App3-7.zip
trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkAuthTest.properties
trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkTest.properties
trunk/nuiton-updater/src/test/resources/ApplicationUpdaterTest.properties
trunk/nuiton-updater/src/test/resources/log4j.properties
Modified:
trunk/pom.xml
Property changes on: trunk/nuiton-updater
___________________________________________________________________
Added: svn:ignore
+ target
.idea
*.ipr
*.iws
*.iml
.project
.classpath
.settings
*.log
Added: trunk/nuiton-updater/LICENSE.txt
===================================================================
--- trunk/nuiton-updater/LICENSE.txt (rev 0)
+++ trunk/nuiton-updater/LICENSE.txt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,166 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
Property changes on: trunk/nuiton-updater/LICENSE.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/README.txt
===================================================================
--- trunk/nuiton-updater/README.txt (rev 0)
+++ trunk/nuiton-updater/README.txt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,2 @@
+To deploy new version of pom: mvn deploy
+To install localy: mvn install
Property changes on: trunk/nuiton-updater/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/changelog.txt
===================================================================
--- trunk/nuiton-updater/changelog.txt (rev 0)
+++ trunk/nuiton-updater/changelog.txt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,136 @@
+ver 2.0 xxx 201101xx
+
+ * [FEATURE] Add classes to easily export and reuse services to a RMI registry
+
+ver 1.1.3 xxx 201001xx
+ * Use display-name from web.xml file as server name
+
+ver 1.1.2 desbois 20091223
+ * Add generic war launcher (winstone & jetty based)
+ * Add new uncompress method with exclusion filters
+ * [FEATURE] Force application configuration properties to be written sorted
+ * [FEATURE] Add sed and grep method on FileUtil
+
+ver 1.1.1 chemit 20090903
+
+ * [FEATURE] #39 add a filterVersions method in VersionUtil
+
+-- chemit -- Thu, 03 Sep 2009 18:51:54 +0200
+
+
+ver 1.1.0 20090830
+ * can auto-load converters at runtime via a ServiceLoader mecanism (see org.nuiton.util.ConverterUtil#initConverters() )
+ * migrate to org.nuiton groupId
+
+ver 1.0.6 chemit 20090511
+ * bump versions (lutinproject, maven-license-switcher-plugin)
+ * use doxia-modules-jrst instead of maven-jrst-plugin
+ * improve download section on site
+ * fix generics and javadoc
+ * refactor i18n loading with a direct looding mode (see also i18n:bundle goal)
+
+ver 1.0.5 chatellier xxxxxx ?
+ * Add Tar/bzip2 utility class
+ * Add md5 creation on ZipUtil methods
+ * Change MD5 implementation to http://ostermiller.org/utils/MD5.html one.
+
+ver 1.0.4 chemit 20090311
+ * 20090305 [chemit] - improve FileUtil methods : now can specify the component's invoker (fix some focus bugs in fullscreen mode)
+
+ver 1.0.3 chemit 20090218
+ * 20090218 [chemit] - use lutinproject 3.4
+ * 20090209 [chemit] - add inputStreamToFile method in FileUtil + javadoc on this class
+ - can now exclude some keys when saving configurations (for password, for example)
+ * 20090208 [chemit] add PropertyChangedSupport in ApplicationConfig
+ * 20090203 [chemit] fix StringUtil failed tests since to locale.
+ * 20090126 [chemit] i18n Resource class
+ * 20090121 [chemit] fix bug on Resource when a jar manifest classpath contains some XXX:// jar path
+
+ver 1.0.2 chemit 20090107
+ * 20090105 [chemit] add getCurrentDirectory method in FileUtil
+ * 20090104 [chemit] modify I18n loading to not override sentences with empty value are found and there is already a
+ none empty value loaded
+
+ver 1.0.1 chatellier 20081210
+
+ver 1.0 chemit 20081210
+ * 20081205 [chemit] use lutinproject 3.2
+ * 20081120 [chatellier] Remove deprecated HashMapMultiKey
+ * 20081120 [chatellier] Fix i18n lutinutil properties files
+ * 20081118 [chemit] - use lutinproject 3.1
+ - improve i18n loading : skip urls with no i18n directory
+ - introduce ClassLoaderUtil class
+ * 20081101 [chatellier] Remove deprecated I18n._ and replace by temporary code
+
+ver-0-31 chemit 2008????
+ * always build javadoc
+ * Change group id
+ * utilisation de lutinproject 2.4 et nettoyage du pom
+ * reorganisation du site
+ * <poussin> ArgumentsParser.java marked deprecated
+
+ver-0-30 chemit 20080710
+ * <chemit> passage en maven 2 layout directory
+ * <chemit> utilisation de lutinproject 2.3
+ * <chemit> suppression du code vcs du projet
+ * <poussin> add ApplicationConfig class
+ * <poussin> enhance ObjectUtil
+ * <poussin> HashMapMultiKey marked deprecated
+
+ver-0-26 poussin 2007????
+ * bug in concat(Object [] ...), better array type now work
+ * add unaccent in StringUtil
+
+ver-0-25 poussin 20070425
+ * add StringUtil.toArrayXXX(String ... s) methodes
+ * use generic
+
+ver-0-24 poussin
+ * ArgumentsParser have 1 as repetitionMax by default
+ * ArgumentsParser use jdk 1.5 syntaxe (..., <>)
+
+ver-0-23 poussin 20061004
+ * move i18n in lutinutil
+ * add method Resource.getConfigProperties(String, Properties) to chains
+ properties
+
+ver-0-22 poussin 20060913
+ * use Generics in CategorisedListenerSet
+ * add org.codelutin.log package (LutinLog, ...)
+ * remove org.codelutin.util.Log
+
+ver-0-21 poussin 20060907
+
+ * Add TransformedList
+ * Add FileUtil.getTempFile(String):File
+ * add FileUtil.getFile():File that prompt user
+ * add FileUtil.getDirectory(): String that prompt user
+ * add FileUtil.copyRecursively(File, File, String ... patternFilter)
+ * add ZipUtil class to compress/uncompress zip file
+ * Transparente*Reference accept null object
+
+ver-0-17 thimel 20050610
+
+ * Ajout de BoundedList et BoundedListOutOfBoundsException
+
+ver-0-16 poussin 20050526
+
+ * Ajout de la methode getConfigProperties dans Resource
+
+ver-0-9 poussin 20040728
+
+ * Ajout de methode isJar, isZip, dans Resource
+
+ver-0-3 poussin 20040405
+
+ * utilisation de maven pour la gestion du projet
+ * Ajout de ExceptionUtil
+
+ver-0-2 poussin 20031021
+
+ * ajout du parser d'argument, ArgumentsParser
+ * ajout de StringUtil
+
+ver-0-1
+
+ * premier version contient seulement Resource
Property changes on: trunk/nuiton-updater/changelog.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/pom.xml
===================================================================
--- trunk/nuiton-updater/pom.xml (rev 0)
+++ trunk/nuiton-updater/pom.xml 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Nuiton Utils :: Nuiton Utils
+ %%
+ Copyright (C) 2004 - 2010 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">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ************************************************************* -->
+ <!-- *** POM Relationships *************************************** -->
+ <!-- ************************************************************* -->
+
+ <parent>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils-parent</artifactId>
+ <version>2.6.10-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>nuiton-updater</artifactId>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-vfs2</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+
+ <!-- ************************************************************* -->
+ <!-- *** Project Information ************************************* -->
+ <!-- ************************************************************* -->
+
+ <name>Nuiton Utils :: Nuiton Updater</name>
+ <description>Application updater api.</description>
+ <inceptionYear>2013</inceptionYear>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Settings ****************************************** -->
+ <!-- ************************************************************* -->
+
+ <properties>
+
+ <!-- extra files to include in release -->
+ <redmine.releaseFiles>${redmine.libReleaseFiles}</redmine.releaseFiles>
+
+ </properties>
+
+ <build>
+
+ <plugins>
+
+ </plugins>
+
+ </build>
+
+ <!-- ************************************************************* -->
+ <!-- *** Build Environment ************************************** -->
+ <!-- ************************************************************* -->
+
+ <profiles>
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <quiet>true</quiet>
+ <links>
+ <link>http://java.sun.com/javase/6/docs/api/</link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ </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>
Property changes on: trunk/nuiton-updater/pom.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-updater/src/license/THIRD-PARTY.properties (rev 0)
+++ trunk/nuiton-updater/src/license/THIRD-PARTY.properties 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,21 @@
+# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
+#-------------------------------------------------------------------------------
+# Already used licenses in project :
+# - Apache License
+# - 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 :
+#
+#
+#Fri Feb 01 00:49:05 CET 2013
+commons-codec--commons-codec--1.2=The Apache Software License, Version 2.0
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
Property changes on: trunk/nuiton-updater/src/license/THIRD-PARTY.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationInfo.java
===================================================================
--- trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationInfo.java (rev 0)
+++ trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationInfo.java 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,81 @@
+package org.nuiton.util.updater;
+
+/*
+ * #%L
+ * Nuiton Utils :: Nuiton Updater
+ * $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%
+ */
+
+import java.io.File;
+
+/**
+ * TODO
+ *
+ * @author bpoussin <poussing(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.7
+ */
+public class ApplicationInfo {
+
+ public String name;
+
+ public String oldVersion;
+
+ public String newVersion;
+
+ public String url;
+
+ public boolean needAuthentication;
+
+ public String login;
+
+ public char[] password;
+
+ public File destDir;
+
+ public ApplicationInfo(String name,
+ String oldVersion,
+ String newVersion,
+ String url,
+ File destDir,
+ boolean needAuthentication) {
+ this.name = name;
+ this.oldVersion = oldVersion;
+ this.newVersion = newVersion;
+ this.url = url;
+ this.needAuthentication = needAuthentication;
+ this.destDir = destDir;
+ }
+
+ public void setAuthentication(String login, char[] password) {
+ this.login = login;
+ this.password = password;
+ }
+
+ @Override
+ public String toString() {
+ String result = String.format(
+ "App: %s, oldVersion: %s, newVersion: %s, url: %s, destDir:%s",
+ name, oldVersion, newVersion, url, destDir);
+ return result;
+ }
+
+}
Property changes on: trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationInfo.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdater.java
===================================================================
--- trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdater.java (rev 0)
+++ trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdater.java 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,511 @@
+package org.nuiton.util.updater;
+
+/*
+ * #%L
+ * Nuiton Utils :: Nuiton Updater
+ * $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%
+ */
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.vfs2.AllFileSelector;
+import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.FileSystemManager;
+import org.apache.commons.vfs2.FileSystemOptions;
+import org.apache.commons.vfs2.VFS;
+import org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder;
+import org.nuiton.util.ApplicationConfig;
+import org.nuiton.util.ArgumentsParserException;
+import org.nuiton.util.VersionUtil;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Permet de telecharger des mises a jour d'application.
+ * <p/>
+ * Le principe est qu'un fichier properties pointe par une URL indique les
+ * information necessaire pour la recuperation de l'application.
+ * <p/>
+ * Si une nouvelle version de l'application existe, elle est alors telechargee
+ * et decompressee dans un repertoire specifique (elle ne remplace pas l'application
+ * courante).
+ * <p/>
+ * Il est alors a la charge d'un script de mettre en place cette nouvelle application
+ * a la place de l'ancienne.
+ * <p/>
+ * Il est possible d'interagir avec ApplicationUpdater via l'implantation d'un
+ * {@link ApplicationUpdaterCallback} passer en parametre de la methode {@link #update}
+ * <p/>
+ * <h3>Configuration possible</h3>
+ * Vous pouvez passer un ApplicationConfig dans le constructeur ou utiliser
+ * la recherche du fichier de configuration par defaut (ApplicationUpdater.properties)
+ * <p/>
+ * Cette configuration permet de récupérer les informations suivantes:
+ * <li>http_proxy: le proxy a utiliser pour l'acces au reseau (ex: squid.chezmoi.fr:8080)
+ * <li>os.name: le nom du systeme d'exploitation sur lequel l'application fonctionne (ex: Linux)
+ * <li>os.arch: l'architecture du systeme d'exploitation sur lequel l'application fonctionne (ex: amd64)
+ * <p/>
+ * <h3>format du fichier de properties</h3>
+ * <p/>
+ * <li>[osName.][osArch.]appName.version=version de l'application</li>
+ * <li>[osName.][osArch.]appName.auth=true ou false selon que l'acces a l'url
+ * demande une authentification a fournir par le callback
+ * (voir {@link ApplicationUpdaterCallback#updateToDo})</li>
+ * <li>[osName.][osArch.]appName.url=url du fichier compresse de la nouvelle version
+ * (format <a href="http://commons.apache.org/vfs/filesystems.html">commons-vfs2</a>)</li>
+ * <p/>
+ * appName est a remplacer par le nom de l'application. Il est possible
+ * d'avoir plusieurs application dans le meme fichier ou plusieurs version
+ * en fonction de l'os et de l'architecture.
+ * <p/>
+ * osName et osArch sont toujours en minuscule
+ * <p/>
+ * <h3>format des fichiers compresses</h3>
+ * <p/>
+ * Le fichier compresse doit avoir un repertoire racine qui contient l'ensemble de l'application
+ * c-a-d que les fichiers ne doivent pas etre directement a la racine lorsqu'on
+ * decompresse le fichier.
+ * <p/>
+ * exemple de contenu de fichier compresse convenable
+ * <pre>
+ * MonApp-0.3/Readme.txt
+ * MonApp-0.3/License.txt
+ * </pre>
+ * <p/>
+ * Ceci est du au fait qu'on renomme le repertoire racine avec le nom de l'application,
+ * donc si le repertoire racine n'existe pas ou qu'il y a plusieurs repertoires
+ * a la racine le resultat de l'operation n'est pas celui souhaite
+ * <p/>
+ * <h3>os.name and os.arch</h3>
+ * <table>
+ * <th><td>os.name</td><td>os.arch</td></th>
+ * <tr><td>linux</td><td>amd64</td></tr>
+ * <tr><td>linux</td><td>i386</td></tr>
+ * <tr><td>mac</td><td>ppc</td></tr>
+ * <tr><td>windows</td><td>x86</td></tr>
+ * <tr><td>solaris</td><td>sparc</td></tr>
+ * </table>
+ * <p/>
+ * os.name est tronque apres le 1er mot donc "windows 2000" et "windows 2003"
+ * deviennet tous les deux "windows". Si vous souhaitez gérer plus finement vos
+ * url de telechargement vous pouvez modifier les donnees via
+ * {@link ApplicationUpdaterCallback#updateToDo(java.util.Map) } en modifiant
+ * l'url avant de retourner la map
+ *
+ * @author bpoussin <poussing(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.7
+ */
+public class ApplicationUpdater {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(ApplicationUpdater.class);
+
+ final static private String SEPARATOR_KEY = ".";
+
+ final static public String HTTP_PROXY = "http_proxy";
+
+ final static public String URL_KEY = "url";
+
+ final static public String AUTHENTICATION_KEY = "auth";
+
+ final static public String VERSION_KEY = "version";
+
+ final static public String VERSION_FILE = "version.appup";
+
+ protected ApplicationConfig config;
+
+ /** Utilise le fichier de configuration par defaut: ApplicationUpdater.properties */
+ public ApplicationUpdater() {
+ this(null);
+ }
+
+ /**
+ * @param config La configuration a utiliser pour rechercher le proxy (http_proxy)
+ * et os.name, os.arch
+ */
+ public ApplicationUpdater(ApplicationConfig config) {
+ if (config == null) {
+ try {
+ config = new ApplicationConfig(
+ ApplicationUpdater.class.getSimpleName() + ".properties");
+ config.parse();
+ config = config.getSubConfig(
+ ApplicationUpdater.class.getSimpleName() + SEPARATOR_KEY);
+ } catch (ArgumentsParserException eee) {
+ throw new RuntimeException(eee);
+ }
+ }
+ this.config = config;
+ }
+
+
+ /**
+ * @param url url where properties file is downloadable. This properties
+ * must contains information on application release
+ * @param currentDir directory where application is currently
+ * @param destDir default directory to put new application version, can be null if you used callback
+ * @param async if true, check is done in background mode
+ * @param callback callback used to interact with updater, can be null
+ */
+ public void update(String vfsPropertiesURL, File currentDir, File destDir, boolean async, ApplicationUpdaterCallback callback) {
+ Updater up = new Updater(config, vfsPropertiesURL, currentDir, destDir, callback);
+ if (async) {
+ Thread thread = new Thread(up, ApplicationUpdater.class.getSimpleName());
+ thread.start();
+ } else {
+ up.run();
+ }
+ }
+
+ /**
+ * La classe ou le travail est reellement fait, peut-etre appeler dans
+ * un thread si necessaire.
+ */
+ public static class Updater implements Runnable {
+
+ protected ApplicationConfig config;
+
+ protected String vfsPropertiesUrl;
+
+ protected File currentDir;
+
+ protected File destDir;
+
+ protected ApplicationUpdaterCallback callback;
+
+ public Updater(ApplicationConfig config,
+ String vfsPropertiesUrl,
+ File currentDir,
+ File destDir,
+ ApplicationUpdaterCallback callback) {
+ this.config = config;
+ this.vfsPropertiesUrl = vfsPropertiesUrl;
+ this.currentDir = currentDir;
+ this.destDir = destDir;
+ this.callback = callback;
+ }
+
+ /**
+ * <li>Recupere le fichier properties contenant les informations de mise a jour
+ * <li>liste les applications et leur version actuelle
+ * <li>pour chaque application a mettre a jour recupere le zip et le decompresse
+ * <p/>
+ * Si callback existe envoi les messages necessaire
+ */
+ public void run() {
+ try {
+ FileSystemOptions vfsConfig = getVFSConfig(config);
+ ApplicationConfig releaseConfig = getUpdaterConfig(vfsConfig, vfsPropertiesUrl);
+
+ List<String> appNames = getApplicationName(releaseConfig);
+ Map<String, String> appVersions = getCurrentVersion(appNames, currentDir);
+
+ log.debug("application current version: " + appVersions);
+
+ // recherche des applications a mettre a jour
+ Map<String, ApplicationInfo> appToUpdate = new HashMap<String, ApplicationInfo>();
+ for (String app : appNames) {
+ String currentVersion = appVersions.get(app);
+ String newVersion = releaseConfig.getOption(app + SEPARATOR_KEY + VERSION_KEY);
+ boolean greater = VersionUtil.greaterThan(newVersion, currentVersion);
+ log.debug(String.format("for %s Current(%s) < newVersion(%s) ? %s",
+ app, currentVersion, newVersion, greater));
+ if (greater) {
+ String urlString = releaseConfig.getOption(
+ app + SEPARATOR_KEY + URL_KEY);
+ boolean needAuthentication = releaseConfig.getOptionAsBoolean(
+ app + SEPARATOR_KEY + AUTHENTICATION_KEY);
+
+ appToUpdate.put(app, new ApplicationInfo(
+ app, currentVersion, newVersion, urlString, destDir, needAuthentication));
+ }
+ }
+
+ // offre la possibilite a l'appelant de modifier les valeurs par defaut
+ if (callback != null) {
+ appToUpdate = callback.updateToDo(appToUpdate);
+ }
+
+ // mise a jour
+ Map<String, Exception> appUpdateError = new HashMap<String, Exception>();
+ for (Map.Entry<String, ApplicationInfo> appInfo : appToUpdate.entrySet()) {
+ String app = appInfo.getKey();
+ ApplicationInfo info = appInfo.getValue();
+ try {
+ doUpdate(vfsConfig, appInfo.getValue());
+ } catch (Exception eee) {
+ appUpdateError.put(app, eee);
+ try {
+ // clear data if error occur during uncompress operation
+ File dest = new File(info.destDir, info.name);
+ if (dest.exists()) {
+ log.debug(String.format("Cleaning destination directory due to error '%s'", dest));
+ FileUtils.deleteDirectory(dest);
+ }
+ } catch (Exception doNothing) {
+ log.debug("Can't clean directory", doNothing);
+ }
+
+
+ log.warn(String.format(
+ "Can't update application '%s' with url '%s'",
+ app, info.url));
+ log.debug("Application update aborted because: ", eee);
+ }
+ }
+
+ // envoi le resultat a l'appelant s'il le souhaite
+ if (callback != null) {
+ callback.updateDone(appToUpdate, appUpdateError);
+ }
+ } catch (Exception eee) {
+ log.warn("Can't update");
+ log.info("Application update aborted because: ", eee);
+ if (callback != null) {
+ callback.aborted(vfsPropertiesUrl, eee);
+ }
+ }
+ }
+
+ /**
+ * Decompresse le zip qui est pointer par l'url dans le repertoire
+ * specifie, et ajoute le fichier contenant la version de l'application.
+ * Le repertoire root du zip est renomme par le nom de l'application.
+ * Par exemple si un fichier se nomme "monApp-1.2/Readme.txt" il se
+ * nommera au final "monApp/Readme.txt"
+ *
+ * @param proxy le proxy a utiliser pour la connexion a l'url
+ * @param info information sur l'application a mettre a jour
+ * @throws Exception
+ */
+ protected void doUpdate(FileSystemOptions vfsConfig, ApplicationInfo info) throws Exception {
+ if (info.destDir != null) {
+ File dest = new File(info.destDir, info.name);
+ String url = toVfsURL(info.url);
+ if (info.needAuthentication) {
+ url = StringUtils.replaceOnce(url, "://",
+ String.format("://%s:%s@", info.login, new String(info.password)));
+ }
+ if (callback != null) {
+ callback.startUpdate(info);
+ }
+ deepCopy(vfsConfig, url, dest.getAbsolutePath());
+
+ // ajout du fichier de version
+ File versionFile = new File(dest, VERSION_FILE);
+ FileUtils.writeStringToFile(versionFile, info.newVersion);
+ log.info(String.format(
+ "Application '%s' is uptodate with version '%s' in '%s'",
+ info.name, info.newVersion, info.destDir));
+ } else {
+ log.info(String.format("Update for '%s' aborted because destination dir is set to null", info.name));
+ }
+ }
+
+ /**
+ * Recupere le contenu du repertoire de l'archive pour le mettre dans targetPath
+ * si targetPath existait deja, il est supprime au prealable.
+ * <p/>
+ * Si l'archive a plus d'un repertoire root, une exception est levee
+ *
+ * @param srcPath source path de la forme vfs2 ex:"zip:http://www.nuiton.org/attachments/download/830/nuiton-utils-2.6.5-deps.…"
+ * @param targetPath le path destination
+ * @throws FileSystemException
+ */
+ protected void deepCopy(FileSystemOptions vfsConfig,
+ String srcPath, String targetPath) throws FileSystemException {
+ FileSystemManager fsManager = VFS.getManager();
+ FileObject archive = fsManager.resolveFile(srcPath, vfsConfig);
+
+ FileObject[] children = archive.getChildren();
+ if (children.length == 1) {
+ FileObject child = children[0];
+
+ FileObject target = fsManager.resolveFile(toVfsURL(targetPath), vfsConfig);
+ target.delete(new AllFileSelector());
+ target.copyFrom(child, new AllFileSelector());
+ } else {
+ throw new RuntimeException("must have only one root directory");
+ }
+ }
+
+ /**
+ * Converti le path en URL vfs2. Path doit etre une URL, mais pour les fichiers
+ * au lieu d'etre absolue ils peuvent etre relatif, un traitement special
+ * est donc fait pour ce cas. Cela est necessaire pour facilement faire
+ * des tests unitaires independant de la machine ou il sont fait
+ *
+ * @param path
+ * @return
+ */
+ protected String toVfsURL(String path) {
+ String result = path;
+ Pattern p = Pattern.compile("(.*?file:)([^/][^!]*)(.*)");
+ Matcher m = p.matcher(path);
+ if (m.matches()) {
+ String filepath = m.group(2);
+ File f = new File(filepath);
+ result = path.replaceAll(
+ "(.*?file:)([^/][^!]*)(.*)",
+ "$1" + f.getAbsolutePath() + "$3");
+ }
+ return result;
+ }
+
+ /**
+ * Return config prepared for os and arch
+ *
+ * @return
+ * @throws Exception
+ */
+ protected ApplicationConfig getUpdaterConfig(FileSystemOptions vfsConfig, String vfsPropertiesUrl) throws Exception {
+ String osName = StringUtils.lowerCase(config.getOsName());
+ String osArch = StringUtils.lowerCase(config.getOsArch());
+ // take only first part for osName (windows 2000 or windows 2003 -> windows)
+ osName = StringUtils.substringBefore(osName, " ");
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Try to load properties from '%s'", vfsPropertiesUrl));
+ }
+
+ Properties prop = new Properties();
+
+ FileSystemManager fsManager = VFS.getManager();
+ FileObject properties = fsManager.resolveFile(toVfsURL(vfsPropertiesUrl), vfsConfig);
+ try {
+ InputStream in = new BufferedInputStream(properties.getContent().getInputStream());
+ prop.load(in);
+ } finally {
+ try {
+ properties.close();
+ } catch (Exception doNothing) {
+ log.debug("Can't close vfs file", doNothing);
+ }
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format(
+ "Properties loaded from '%s'\n%s",
+ vfsPropertiesUrl, prop));
+ }
+
+ // load config with new properties as default
+ ApplicationConfig result = new ApplicationConfig(prop);
+ // don't parse. We want only prop in applicationConfig
+ result = result.getSubConfig(
+ ApplicationUpdater.class.getSimpleName() + SEPARATOR_KEY);
+
+ result = result.getSubConfig(osName + SEPARATOR_KEY);
+ result = result.getSubConfig(osArch + SEPARATOR_KEY);
+ return result;
+ }
+
+ /**
+ * Recupere le proxy http a utiliser pour les connexions reseaux
+ *
+ * @param config
+ * @return
+ */
+ protected FileSystemOptions getVFSConfig(ApplicationConfig config) {
+ FileSystemOptions result = new FileSystemOptions();
+ String proxyHost = config.getOption(HTTP_PROXY);
+ try {
+ proxyHost = StringUtils.substringAfter(proxyHost, "://");
+ if (StringUtils.isNotBlank(proxyHost)) {
+ String hostname = StringUtils.substringBefore(proxyHost, ":");
+ String port = StringUtils.substringAfter(proxyHost, ":");
+ if (StringUtils.isNumeric(port)) {
+
+ int portNumber = Integer.parseInt(port);
+
+ HttpFileSystemConfigBuilder.getInstance().setProxyHost(result, hostname);
+ HttpFileSystemConfigBuilder.getInstance().setProxyPort(result, portNumber);
+ } else {
+ log.warn(String.format("Invalide proxy port number '%s', not used proxy", port));
+ }
+ }
+ } catch (Exception eee) {
+ log.warn(String.format("Can't use proxy '%s'", proxyHost), eee);
+ }
+ return result;
+ }
+
+ /**
+ * Recherche pour chaque application la version courante
+ *
+ * @param apps la liste des applications a rechercher
+ * @return
+ */
+ protected Map<String, String> getCurrentVersion(List<String> apps, File dir) {
+ Map<String, String> result = new HashMap<String, String>();
+ for (String app : apps) {
+ File f = new File(dir, app + File.separator + VERSION_FILE);
+ String version = "0";
+ try {
+ version = FileUtils.readFileToString(f);
+ } catch (IOException ex) {
+ log.warn(String.format(
+ "Can't find file version '%s' for application '%s', this file should be '%s'",
+ VERSION_FILE, app, f));
+ }
+ version = StringUtils.trim(version);
+ result.put(app, version);
+ }
+ return result;
+ }
+
+ /**
+ * Retourne la liste des noms d'application se trouvant dans la
+ * configuration
+ *
+ * @param config
+ * @return
+ */
+ protected List<String> getApplicationName(ApplicationConfig config) {
+ Pattern p = Pattern.compile("([^.]+)\\.version");
+ List<String> result = new LinkedList<String>();
+ for (String v : config.getFlatOptions().stringPropertyNames()) {
+ Matcher match = p.matcher(v);
+ if (match.matches()) {
+ result.add(match.group(1));
+ } else if (StringUtils.endsWith(v, ".version")) {
+ log.debug(String.format("value is not valid application version '%s'", v));
+ }
+ }
+ return result;
+ }
+
+ }
+}
Property changes on: trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdater.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdaterCallback.java
===================================================================
--- trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdaterCallback.java (rev 0)
+++ trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdaterCallback.java 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,90 @@
+package org.nuiton.util.updater;
+
+/*
+ * #%L
+ * Nuiton Utils :: Nuiton Updater
+ * $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%
+ */
+
+import java.util.Map;
+
+/**
+ * Permet d'interagir avec ApplicationUpdater.
+ *
+ * @author bpoussin <poussing(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.7
+ */
+public interface ApplicationUpdaterCallback {
+ /**
+ * Appeler avant la recuperation des nouvelles versions
+ * <p/>
+ * Permet de modifier le repertoire destination ou l'url du zip de
+ * l'application pour une application/version
+ * particuliere ou d'annuler la mise a jour en le supprimant de la map
+ * qui sera retourne.
+ * <p/>
+ * Si {@link ApplicationInfo#needAuthentication} est vrai, il faut que
+ * les valeurs {@link ApplicationInfo#login} et {@link ApplicationInfo#password}
+ * soient renseignees. Si elle ne le sont pas la recuperation de la
+ * ressource echouera. Pour des raisons de securite vous pouvez souhaiter
+ * mettre le mot de passe sous une forme encrypte. Dans ce cas il doit
+ * etre encadrer par '{' et '}'. Pour encrypter le mot de passe
+ * vous devez utiliser:
+ * <pre>
+ * java -cp commons-vfs-2.0.jar org.apache.commons.vfs2.util.EncryptUtil encrypt mypassword
+ * </pre>
+ *
+ * @param appToUpdate liste des applications a mettre a jour
+ * @return null or empty map if we don't want update, otherwize list of
+ * app to update
+ */
+ Map<String, ApplicationInfo> updateToDo(Map<String, ApplicationInfo> appToUpdate);
+
+ /**
+ * Appeler au démarrage d'une mise à jour.
+ *
+ * @param info application à mettre à jour
+ * @since 2.7
+ */
+ void startUpdate(ApplicationInfo info);
+
+ /**
+ * Appeler une fois qu'une mise a jour a parfaitement fonctionne
+ *
+ * @param name le nom de l'application
+ * @param oldVersion l'ancienne version
+ * @param newVersion la nouvelle version
+ * @param applicationURL l'url d'ou provient le zip de l'application
+ * @param dest le repertoire ou se trouve la nouvelle version
+ */
+ void updateDone(
+ Map<String, ApplicationInfo> appToUpdate,
+ Map<String, Exception> appUpdateError);
+
+ /**
+ * Called when exception occur during process initialization
+ *
+ * @param propertiesURL url use to download properties release information
+ * @param eee exception throw during process
+ */
+ void aborted(String propertiesURL, Exception eee);
+}
Property changes on: trunk/nuiton-updater/src/main/java/org/nuiton/util/updater/ApplicationUpdaterCallback.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/site/apt/index.apt
===================================================================
--- trunk/nuiton-updater/src/site/apt/index.apt (rev 0)
+++ trunk/nuiton-updater/src/site/apt/index.apt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,39 @@
+~~~
+~~ #%L
+~~ Nuiton Utils :: Nuiton Updater
+~~ $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%
+~~~
+ ----
+ Nuiton updater
+ ----
+ ----
+ 2013-02-24
+ ----
+
+
+Présentation
+
+ TODO
+
+
+
+
+
Property changes on: trunk/nuiton-updater/src/site/apt/index.apt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/site/site_fr.xml
===================================================================
--- trunk/nuiton-updater/src/site/site_fr.xml (rev 0)
+++ trunk/nuiton-updater/src/site/site_fr.xml 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Nuiton Utils :: Nuiton Updater
+ $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%
+ -->
+
+
+<project name="${project.name}">
+
+ <bannerLeft>
+ <name>${project.name}</name>
+ <href>index.html</href>
+ </bannerLeft>
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="http://maven-site.chorem.org/public/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="http://maven-site.chorem.org/public/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="index.html"/>
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Utilisateur">
+ <item name="Accueil" href="index.html"/>
+ </menu>
+
+ <menu name="Téléchargement">
+ <item
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar"
+ name="Librairie (jar)"/>
+ <item
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar"
+ name="Javadoc (jar)"/>
+ <item
+ href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar"
+ name="Sources (jar)"/>
+ </menu>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}' locale='fr'>
+ </div>
+ </footer>
+
+ </body>
+</project>
Property changes on: trunk/nuiton-updater/src/site/site_fr.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/java/org/nuiton/util/updater/ApplicationUpdaterTest.java
===================================================================
--- trunk/nuiton-updater/src/test/java/org/nuiton/util/updater/ApplicationUpdaterTest.java (rev 0)
+++ trunk/nuiton-updater/src/test/java/org/nuiton/util/updater/ApplicationUpdaterTest.java 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,101 @@
+package org.nuiton.util.updater;
+
+/*
+ * #%L
+ * Nuiton Utils :: Nuiton Updater
+ * $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%
+ */
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.Map;
+
+/**
+ * @author bpoussin <poussing(a)codelutin.com>
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.7
+ */
+public class ApplicationUpdaterTest {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(ApplicationUpdaterTest.class);
+
+ static private class Callback implements ApplicationUpdaterCallback {
+
+ public Map<String, ApplicationInfo> updateToDo(Map<String, ApplicationInfo> appToUpdate) {
+ log.info("Application to update\n" + appToUpdate);
+ for (ApplicationInfo info : appToUpdate.values()) {
+ info.login = "ApplicationUpdate";
+ info.password = new char[]{'p', 'a', 's', 's', 'w', 'o', 'r', 'd'};
+ }
+ return appToUpdate;
+ }
+
+ @Override
+ public void startUpdate(ApplicationInfo info) {
+ log.info("Start to update: " + info);
+ }
+
+ public void updateDone(Map<String, ApplicationInfo> appToUpdate, Map<String, Exception> appUpdateError) {
+ for (Map.Entry<String, Exception> e : appUpdateError.entrySet()) {
+ log.info(String.format("Error during update for application '%s'", e.getKey()), e.getValue());
+ }
+ Assert.assertTrue("Error: " + appUpdateError, appUpdateError.isEmpty());
+ }
+
+ public void aborted(String propertiesURL, Exception eee) {
+ log.info(String.format("Update aborted for url '%s'", propertiesURL), eee);
+ Assert.assertTrue(false);
+ }
+
+ }
+
+ @Test
+ public void testUpdate() throws Exception {
+ ApplicationUpdater up = new ApplicationUpdater();
+ String url = "file:src/test/resources/ApplicationUpdaterTest.properties";
+ File current = new File("src/test/resources/ApplicationUpdater");
+ File dest = new File("target/test/ApplicationUpdater/NEW");
+ up.update(url, current, dest, false, new Callback());
+ }
+
+ @Test
+ public void testUpdateNetwork() throws Exception {
+ ApplicationUpdater up = new ApplicationUpdater();
+ String url = "http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-updater/src/test/resour…";
+ File current = new File("src/test/resources/ApplicationUpdater");
+ File dest = new File("target/test/ApplicationUpdater/NEWNETWORK");
+ up.update(url, current, dest, false, new Callback());
+ }
+
+ @Test
+ public void testUpdateNetworkAuth() throws Exception {
+ ApplicationUpdater up = new ApplicationUpdater();
+ String url = "http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-updater/src/test/resour…";
+ File current = new File("src/test/resources/ApplicationUpdater");
+ File dest = new File("target/test/ApplicationUpdater/NEWNETWORKAUTH");
+ up.update(url, current, dest, false, new Callback());
+ }
+}
Property changes on: trunk/nuiton-updater/src/test/java/org/nuiton/util/updater/ApplicationUpdaterTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/Readme.txt
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/Readme.txt (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/Readme.txt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,2 @@
+Application 1
+v0.1
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/Readme.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/version.appup
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/version.appup (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/version.appup 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1 @@
+0.1
\ No newline at end of file
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App1/version.appup
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App2/Readme.txt
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App2/Readme.txt (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App2/Readme.txt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,2 @@
+Application 2
+v4
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App2/Readme.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/Readme.txt
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/Readme.txt (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/Readme.txt 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,2 @@
+Application 3
+v7.1
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/Readme.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/version.appup
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/version.appup (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/version.appup 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1 @@
+7.1
\ No newline at end of file
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/App3/version.appup
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
===================================================================
(Binary files differ)
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
___________________________________________________________________
Added: svn:mime-type
+ application/zip
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App2-7.zip
===================================================================
(Binary files differ)
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App2-7.zip
___________________________________________________________________
Added: svn:mime-type
+ application/zip
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App3-7.zip
===================================================================
(Binary files differ)
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdater/zip/App3-7.zip
___________________________________________________________________
Added: svn:mime-type
+ application/zip
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkAuthTest.properties
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkAuthTest.properties (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkAuthTest.properties 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,32 @@
+###
+# #%L
+# Nuiton Utils :: Nuiton Utils
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2004 - 2013 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+App1.version=0.3
+App1.url=zip:http://test.ApplicationUpdate.nuiton.org/App1-0.3.zip
+App1.auth=true
+linux.App3.version=8
+linux.App3.url=zip:http://test.ApplicationUpdate.nuiton.org/App3-7.zip
+linux.App3.auth=true
+linux.amd64.App2.version=7
+linux.amd64.App2.url=zip:http://test.ApplicationUpdate.nuiton.org/App2-7.zip
+linux.amd64.App2.auth=true
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkAuthTest.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkTest.properties
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkTest.properties (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkTest.properties 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,29 @@
+###
+# #%L
+# Nuiton Utils :: Nuiton Utils
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2004 - 2013 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+App1.version=0.3
+App1.url=zip:http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
+linux.App3.version=8
+linux.App3.url=zip:http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App3-7.zip
+linux.amd64.App2.version=7
+linux.amd64.App2.url=zip:http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App2-7.zip
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdaterNetworkTest.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/ApplicationUpdaterTest.properties
===================================================================
--- trunk/nuiton-updater/src/test/resources/ApplicationUpdaterTest.properties (rev 0)
+++ trunk/nuiton-updater/src/test/resources/ApplicationUpdaterTest.properties 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,29 @@
+###
+# #%L
+# Nuiton Utils :: Nuiton Utils
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2004 - 2013 CodeLutin
+# %%
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Lesser Public License for more details.
+#
+# You should have received a copy of the GNU General Lesser Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/lgpl-3.0.html>.
+# #L%
+###
+App1.version=0.3
+App1.url=zip:file:src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
+linux.App3.version=8
+linux.App3.url=zip:file:src/test/resources/ApplicationUpdater/zip/App3-7.zip
+linux.amd64.App2.version=7
+linux.amd64.App2.url=zip:file:src/test/resources/ApplicationUpdater/zip/App2-7.zip
Property changes on: trunk/nuiton-updater/src/test/resources/ApplicationUpdaterTest.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/nuiton-updater/src/test/resources/log4j.properties
===================================================================
--- trunk/nuiton-updater/src/test/resources/log4j.properties (rev 0)
+++ trunk/nuiton-updater/src/test/resources/log4j.properties 2013-02-24 10:39:44 UTC (rev 2510)
@@ -0,0 +1,34 @@
+###
+# #%L
+# Nuiton Utils
+#
+# $Id$
+# $HeadURL$
+# %%
+# Copyright (C) 2004 - 2011 CodeLutin, Chatellier Eric
+# %%
+# 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%
+###
+# Global logging configuration
+log4j.rootLogger=ERROR, stdout
+
+# Console output...
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) %M - %m%n
+
+# package level
+log4j.logger.org.nuiton.util=INFO
Property changes on: trunk/nuiton-updater/src/test/resources/log4j.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-24 10:38:46 UTC (rev 2509)
+++ trunk/pom.xml 2013-02-24 10:39:44 UTC (rev 2510)
@@ -35,6 +35,7 @@
<modules>
<module>nuiton-utils</module>
+ <module>nuiton-updater</module>
<module>nuiton-csv</module>
<module>nuiton-validator</module>
<module>nuiton-utils-maven-report-plugin</module>
1
0
r2509 - in trunk/nuiton-utils/src: main/java/org/nuiton/util test/java/org/nuiton/util
by tchemit@users.nuiton.org 24 Feb '13
by tchemit@users.nuiton.org 24 Feb '13
24 Feb '13
Author: tchemit
Date: 2013-02-24 11:38:46 +0100 (Sun, 24 Feb 2013)
New Revision: 2509
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2509
Log:
fixes #2542: Deprecates ApplicationUpdater
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-02-24 01:40:27 UTC (rev 2508)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-02-24 10:38:46 UTC (rev 2509)
@@ -127,7 +127,10 @@
* by : $Author$
*
* @since 2.6.6
+ * @deprecated since 2.7 (replaced by org.nuiton.util.updater.ApplicationUpdater
+ * in nuiton-updater module), will be removed in version 2.7.1.
*/
+@Deprecated
public class ApplicationUpdater {
/** to use log facility, just put in your code: log.info(\"...\"); */
@@ -206,7 +209,7 @@
*
* Si {@link ApplicationInfo#needAuthentication} est vrai, il faut que
* les valeurs {@link ApplicationInfo#login} et {@link ApplicationInfo#password}
- * soient renseignees. Si elle ne le sont pas la recuperation de la
+ * soient renseignees. Si elle ne le sont pas la recuperation de la
* ressource echouera. Pour des raisons de securite vous pouvez souhaiter
* mettre le mot de passe sous une forme encrypte. Dans ce cas il doit
* etre encadrer par '{' et '}'. Pour encrypter le mot de passe
@@ -281,7 +284,7 @@
name, oldVersion, newVersion, url, destDir);
return result;
}
-
+
}
/**
@@ -427,7 +430,7 @@
* si targetPath existait deja, il est supprime au prealable.
*
* Si l'archive a plus d'un repertoire root, une exception est levee
- *
+ *
* @param srcPath source path de la forme vfs2 ex:"zip:http://www.nuiton.org/attachments/download/830/nuiton-utils-2.6.5-deps.…"
* @param targetPath le path destination
* @throws FileSystemException
@@ -537,7 +540,7 @@
if (StringUtils.isNumeric(port)) {
int portNumber = Integer.parseInt(port);
-
+
HttpFileSystemConfigBuilder.getInstance().setProxyHost(result, hostname);
HttpFileSystemConfigBuilder.getInstance().setProxyPort(result, portNumber);
} else {
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-02-24 01:40:27 UTC (rev 2508)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-02-24 10:38:46 UTC (rev 2509)
@@ -39,8 +39,8 @@
* @version $Revision$
* @since 2.6.6
*
- * Last update: $Date$
- * by : $Author$
+ * @deprecated since 2.7 (replaced by org.nuiton.util.updater.ApplicationUpdater
+ * in nuiton-updater module), will be removed in version 2.7.1.
*/
public class ApplicationUpdaterTest {
1
0
r2508 - in trunk: . nuiton-csv nuiton-utils nuiton-utils-maven-report-plugin nuiton-validator
by maven-release@users.nuiton.org 24 Feb '13
by maven-release@users.nuiton.org 24 Feb '13
24 Feb '13
Author: maven-release
Date: 2013-02-24 02:40:27 +0100 (Sun, 24 Feb 2013)
New Revision: 2508
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2508
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/nuiton-csv/pom.xml
trunk/nuiton-utils-maven-report-plugin/pom.xml
trunk/nuiton-utils/pom.xml
trunk/nuiton-validator/pom.xml
trunk/pom.xml
Modified: trunk/nuiton-csv/pom.xml
===================================================================
--- trunk/nuiton-csv/pom.xml 2013-02-24 01:40:25 UTC (rev 2507)
+++ trunk/nuiton-csv/pom.xml 2013-02-24 01:40:27 UTC (rev 2508)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9</version>
+ <version>2.6.10-SNAPSHOT</version>
</parent>
<artifactId>nuiton-csv</artifactId>
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-02-24 01:40:25 UTC (rev 2507)
+++ trunk/nuiton-utils/pom.xml 2013-02-24 01:40:27 UTC (rev 2508)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9</version>
+ <version>2.6.10-SNAPSHOT</version>
</parent>
<artifactId>nuiton-utils</artifactId>
Modified: trunk/nuiton-utils-maven-report-plugin/pom.xml
===================================================================
--- trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-02-24 01:40:25 UTC (rev 2507)
+++ trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-02-24 01:40:27 UTC (rev 2508)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9</version>
+ <version>2.6.10-SNAPSHOT</version>
</parent>
<artifactId>nuiton-utils-maven-report-plugin</artifactId>
Modified: trunk/nuiton-validator/pom.xml
===================================================================
--- trunk/nuiton-validator/pom.xml 2013-02-24 01:40:25 UTC (rev 2507)
+++ trunk/nuiton-validator/pom.xml 2013-02-24 01:40:27 UTC (rev 2508)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9</version>
+ <version>2.6.10-SNAPSHOT</version>
</parent>
<artifactId>nuiton-validator</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-24 01:40:25 UTC (rev 2507)
+++ trunk/pom.xml 2013-02-24 01:40:27 UTC (rev 2508)
@@ -31,7 +31,7 @@
</parent>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9</version>
+ <version>2.6.10-SNAPSHOT</version>
<modules>
<module>nuiton-utils</module>
@@ -331,12 +331,12 @@
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/tags/nuiton-utils-2.6.9
+ scm:svn:http://svn.nuiton.org/svn/nuiton-utils/trunk
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/tags/nuiton-utils-2.6.9
+ scm:svn:http://svn.nuiton.org/svn/nuiton-utils/trunk
</developerConnection>
- <url>http://nuiton.org/projects/nuiton-utils/repository/show/tags/nuiton-utils-2…</url>
+ <url>http://nuiton.org/projects/nuiton-utils/repository/show/trunk</url>
</scm>
<distributionManagement>
1
0
Author: maven-release
Date: 2013-02-24 02:40:25 +0100 (Sun, 24 Feb 2013)
New Revision: 2507
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2507
Log:
[maven-release-plugin] copy for tag nuiton-utils-2.6.9
Added:
tags/nuiton-utils-2.6.9/
Property changes on: tags/nuiton-utils-2.6.9
___________________________________________________________________
Added: svn:ignore
+ target
velocity.log
maven.log
.eclipse
.classpath
*.iml
*.ipr
*.iws
.settings
.project
testdir
Added: svn:mergeinfo
+
1
0
r2506 - in trunk: . nuiton-csv nuiton-utils nuiton-utils-maven-report-plugin nuiton-validator
by maven-release@users.nuiton.org 24 Feb '13
by maven-release@users.nuiton.org 24 Feb '13
24 Feb '13
Author: maven-release
Date: 2013-02-24 02:40:22 +0100 (Sun, 24 Feb 2013)
New Revision: 2506
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2506
Log:
[maven-release-plugin] prepare release nuiton-utils-2.6.9
Modified:
trunk/nuiton-csv/pom.xml
trunk/nuiton-utils-maven-report-plugin/pom.xml
trunk/nuiton-utils/pom.xml
trunk/nuiton-validator/pom.xml
trunk/pom.xml
Modified: trunk/nuiton-csv/pom.xml
===================================================================
--- trunk/nuiton-csv/pom.xml 2013-02-23 14:49:49 UTC (rev 2505)
+++ trunk/nuiton-csv/pom.xml 2013-02-24 01:40:22 UTC (rev 2506)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9-SNAPSHOT</version>
+ <version>2.6.9</version>
</parent>
<artifactId>nuiton-csv</artifactId>
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-02-23 14:49:49 UTC (rev 2505)
+++ trunk/nuiton-utils/pom.xml 2013-02-24 01:40:22 UTC (rev 2506)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9-SNAPSHOT</version>
+ <version>2.6.9</version>
</parent>
<artifactId>nuiton-utils</artifactId>
Modified: trunk/nuiton-utils-maven-report-plugin/pom.xml
===================================================================
--- trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-02-23 14:49:49 UTC (rev 2505)
+++ trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-02-24 01:40:22 UTC (rev 2506)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9-SNAPSHOT</version>
+ <version>2.6.9</version>
</parent>
<artifactId>nuiton-utils-maven-report-plugin</artifactId>
Modified: trunk/nuiton-validator/pom.xml
===================================================================
--- trunk/nuiton-validator/pom.xml 2013-02-23 14:49:49 UTC (rev 2505)
+++ trunk/nuiton-validator/pom.xml 2013-02-24 01:40:22 UTC (rev 2506)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9-SNAPSHOT</version>
+ <version>2.6.9</version>
</parent>
<artifactId>nuiton-validator</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-02-23 14:49:49 UTC (rev 2505)
+++ trunk/pom.xml 2013-02-24 01:40:22 UTC (rev 2506)
@@ -31,7 +31,7 @@
</parent>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.9-SNAPSHOT</version>
+ <version>2.6.9</version>
<modules>
<module>nuiton-utils</module>
@@ -331,12 +331,12 @@
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/trunk
+ scm:svn:http://svn.nuiton.org/svn/nuiton-utils/tags/nuiton-utils-2.6.9
</connection>
<developerConnection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/trunk
+ scm:svn:http://svn.nuiton.org/svn/nuiton-utils/tags/nuiton-utils-2.6.9
</developerConnection>
- <url>http://nuiton.org/projects/nuiton-utils/repository/show/trunk</url>
+ <url>http://nuiton.org/projects/nuiton-utils/repository/show/tags/nuiton-utils-2…</url>
</scm>
<distributionManagement>
1
0
r2505 - in trunk/nuiton-utils/src: main/java/org/nuiton/util test/java/org/nuiton/util
by bpoussin@users.nuiton.org 23 Feb '13
by bpoussin@users.nuiton.org 23 Feb '13
23 Feb '13
Author: bpoussin
Date: 2013-02-23 15:49:49 +0100 (Sat, 23 Feb 2013)
New Revision: 2505
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2505
Log:
ajout header et svn:keyword
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/SemVer.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/SemVerTest.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java 2013-02-23 14:02:19 UTC (rev 2504)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java 2013-02-23 14:49:49 UTC (rev 2505)
@@ -1,6 +1,30 @@
package org.nuiton.util;
+/*
+ * #%L
+ * Nuiton Utils :: Nuiton Utils
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Property changes on: trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/SemVer.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/SemVer.java 2013-02-23 14:02:19 UTC (rev 2504)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/SemVer.java 2013-02-23 14:49:49 UTC (rev 2505)
@@ -3,8 +3,8 @@
/*
* #%L
* Nuiton Utils :: Nuiton Utils
- * $Id:$
- * $HeadURL:$
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2013 CodeLutin
* %%
Property changes on: trunk/nuiton-utils/src/main/java/org/nuiton/util/SemVer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java 2013-02-23 14:02:19 UTC (rev 2504)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java 2013-02-23 14:49:49 UTC (rev 2505)
@@ -1,6 +1,30 @@
package org.nuiton.util;
+/*
+ * #%L
+ * Nuiton Utils :: Nuiton Utils
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
import java.util.Arrays;
import java.util.Collection;
import org.apache.commons.logging.Log;
Property changes on: trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/SemVerTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/SemVerTest.java 2013-02-23 14:02:19 UTC (rev 2504)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/SemVerTest.java 2013-02-23 14:49:49 UTC (rev 2505)
@@ -3,8 +3,8 @@
/*
* #%L
* Nuiton Utils :: Nuiton Utils
- * $Id:$
- * $HeadURL:$
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2013 CodeLutin
* %%
Property changes on: trunk/nuiton-utils/src/test/java/org/nuiton/util/SemVerTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
1
0
23 Feb '13
Author: bpoussin
Date: 2013-02-23 15:02:19 +0100 (Sat, 23 Feb 2013)
New Revision: 2504
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2504
Log:
ajout du petit @since
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java 2013-02-23 14:00:57 UTC (rev 2503)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java 2013-02-23 14:02:19 UTC (rev 2504)
@@ -31,6 +31,7 @@
*
* @author poussin
* @version $Revision$
+ * @since 3.6.9
*
* Last update: $Date$
* by : $Author$
1
0
r2503 - in trunk/nuiton-utils/src: main/java/org/nuiton/util test/java/org/nuiton/util
by bpoussin@users.nuiton.org 23 Feb '13
by bpoussin@users.nuiton.org 23 Feb '13
23 Feb '13
Author: bpoussin
Date: 2013-02-23 15:00:57 +0100 (Sat, 23 Feb 2013)
New Revision: 2503
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2503
Log:
Ajout d'un nouvelle implantation de Map qui permet de mettre
des alias et de retourne une cle ou une valeur en passant
en parametre les alias
Added:
trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java
Added: trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java (rev 0)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/AliasMap.java 2013-02-23 14:00:57 UTC (rev 2503)
@@ -0,0 +1,252 @@
+package org.nuiton.util;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.UUID;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.map.MultiValueMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Une map base sur une HashMap qui permet pour une valeur d'ajouter d'autres
+ * cles. Cette nouvelle cle est un alias, un alias peut-etre utilise pour
+ * plusieurs valeurs. Si l'on demande la valeur associe a un Alias, cela
+ * retourne une liste contenant toutes les valeurs pour lequel cette Alias est
+ * utilise.
+ *
+ * Cela permet de stocker des objets avec une cle principale et unique, puis
+ * avec des alias.
+ *
+ * Et ainsi recherche les valeurs qui ont un ensemble d'alias via la methode
+ * {@link #getValueAlias(java.lang.Object[]) } ou supprimer les valeurs qui
+ * ont un ensemble d'Alias en commun via la methode {@link #removeValue}
+ *
+ * Si la cle ne vous importe que peu, vous pouvez par exemple utiliser
+ * {@link UUID#randomUUID()} pour generer une cle unique.
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class AliasMap<K, V, A> extends HashMap<K, V> {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(AliasMap.class);
+ private static final long serialVersionUID = 1L;
+
+ /** key: alias, value: key */
+ protected MultiValueMap aliases;
+ /** key: key, value: alias */
+ protected MultiValueMap keys;
+
+ public AliasMap() {
+ aliases = MultiValueMap.decorate(new HashMap<A, K>(), HashSet.class);
+ keys = MultiValueMap.decorate(new HashMap<K, A>(), HashSet.class);
+ }
+
+ /**
+ * Ajoute une valeur dans la map avec un ensemble d'alias associe
+ *
+ * @param key identifiant unique pour cette valeur
+ * @param value la valeur
+ * @param alias les alias de la valeur
+ * @return
+ */
+ public V put(K key, V value, A alias1, A ... alias) {
+ V result = put(key, value);
+ putAlias(key, alias1, alias);
+
+ return result;
+ }
+
+ /**
+ * Ajoute des alias a une cle
+ * @param key
+ * @param alias1
+ * @param alias
+ */
+ protected void putAlias(K key, A alias1, A ... alias) {
+ aliases.put(alias1, key);
+ keys.put(key, alias1);
+ for (Object a : alias) {
+ aliases.put(a, key);
+ keys.put(key, a);
+ }
+ }
+
+ /**
+ * Retoure les cles en commun de tous les alias. Les cles retournees sont
+ * celle qui ont tous les alias.
+ * <pre>
+ * K1: a, b, c
+ * K2: b, c, d
+ * K3: c, d, e
+ *
+ * getKeyAlias(a, b, c) retourne [K1]
+ * getKeyAlias(b, c) retourne [K1, K2]
+ * getKeyAlias(c) retourne [K1, K2, K3]
+ * getKeyAlias(d) retourne [K2, K3]
+ * getKeyAlias(z) retourne []
+ * </pre>
+ *
+ *
+ * @param alias
+ * @return une liste vide si aucune valeur ne correspond au alias en argument
+ */
+ public Collection<K> getKeyAlias(A ... alias) {
+ Collection result = null;
+ for (Object a : alias) {
+ Collection tmp = aliases.getCollection(a);
+ if (tmp != null) {
+ if (result == null) {
+ result = new HashSet(tmp);
+ } else {
+ result.retainAll(tmp);
+ }
+ }
+ }
+ if (result == null) {
+ result = Collections.emptySet();
+ }
+ return result;
+ }
+
+ /**
+ * Retoure les valeurs en commun de tous les alias. Les valeurs retournees sont
+ * celle qui ont tous les alias.
+ * <pre>
+ * V1: a, b, c
+ * V2: b, c, d
+ * V3: c, d, e
+ *
+ * getKeyAlias(a, b, c) retourne [V1]
+ * getKeyAlias(b, c) retourne [V1, V2]
+ * getKeyAlias(c) retourne [V1, V2, V3]
+ * getKeyAlias(d) retourne [V2, V3]
+ * getKeyAlias(z) retourne []
+ * </pre>
+ *
+ *
+ * @param alias
+ * @return une liste vide si aucune valeur ne correspond au alias en argument
+ */
+ public Collection<V> getValueAlias(A ... alias) {
+ Collection keys = getKeyAlias(alias);
+ Collection result = new HashSet(keys.size());
+ for (Object k : keys) {
+ result.add(get(k));
+ }
+ return result;
+ }
+
+ /**
+ * Retourne la liste d'alias associee avec une cle
+ *
+ * <pre>
+ * K1: a, b, c
+ * K2: b, c, d
+ * K3: c, d, e
+ *
+ * getAlias(K1) retourne [a, b, c]
+ * getAlias(k3) retourne [c, d, e]
+ * getKeyAlias(k9) retourne []
+ * </pre>
+ *
+ * @param key
+ * @return
+ */
+ public Collection<A> getAlias(K key) {
+ Collection result = keys.getCollection(key);
+ if (result == null) {
+ result = Collections.emptySet();
+ }
+ return result;
+ }
+
+ /**
+ * Retire une cle ainsi que tous ses alias
+ *
+ * <pre>
+ * K1: a, b, c
+ * K2: b, c, d
+ * K3: c, d, e
+ *
+ * remove(K1) il reste K2: [b, c, d], K3: [c, d, e]
+ * </pre>
+ *
+ * @param key
+ * @return
+ */
+ @Override
+ public V remove(Object key) {
+ V result = super.remove(key);
+ Collection alias = getAlias((K)key);
+ keys.remove(key);
+ if (alias != null) {
+ for (Object a : alias) {
+ aliases.remove(a, key);
+ if (CollectionUtils.isEmpty(aliases.getCollection(a))) {
+ aliases.remove(a);
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Supprime toutes les valeurs et leur cle associe aux alias
+ *
+ * <pre>
+ * K1: a, b, c
+ * K2: b, c, d
+ * K3: c, d, e
+ *
+ * removeValue(b, c) il reste K3: [c, d, e]
+ * </pre>
+ *
+ * @param alias
+ * @return la liste de valeur qui a ete supprime de la map
+ */
+ public Collection<V> removeValue(A ... alias) {
+ Collection keys = getKeyAlias(alias);
+ Collection result = new ArrayList(keys.size());
+ for (Object k : keys) {
+ result.add(remove(k));
+ }
+ return result;
+ }
+
+ /**
+ * Supprime des alias quelque soit leur cle
+ *
+ * <pre>
+ * K1: a, b, c
+ * K2: b, c, d
+ * K3: c, d, e
+ *
+ * removeAlias(a, b) alors K1: [c], k2: [c, d], k3: [c, d, e]
+ * removeAlias(c) alors K1: [a, b], k2: [b, d], k3: [d, e]
+ * getKeyAlias(z) alors rien ne change car cette alias n'existe pas
+ * </pre>
+ *
+ * @param alias
+ */
+ public void removeAlias(A ... alias) {
+ for (Object a : alias) {
+ Collection ks = aliases.getCollection(a);
+ aliases.remove(a);
+ if (ks != null) {
+ for (Object k : ks) {
+ keys.remove(k, a);
+ }
+ }
+ }
+ }
+}
Added: trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java (rev 0)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/AliasMapTest.java 2013-02-23 14:00:57 UTC (rev 2503)
@@ -0,0 +1,57 @@
+package org.nuiton.util;
+
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class AliasMapTest {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(AliasMapTest.class);
+
+ protected Object[] toArray(Collection c) {
+ Object[] result = c.toArray();
+ Arrays.sort(result);
+ return result;
+ }
+
+ @Test
+ public void testAlias() {
+ AliasMap<String, String, String> map = new AliasMap<String, String, String>();
+ map.put("a", "A", "à", "â", "ä", "commun");
+ map.put("b", "B");
+ map.put("e", "E", "é", "è", "ê", "ë", "commun");
+ map.put("ebis", "EBIS", "é", "è", "commun");
+
+ Assert.assertEquals("A", map.get("a"));
+ Assert.assertArrayEquals(new String[]{"commun", "à", "â", "ä"}, toArray(map.getAlias("a")));
+ Assert.assertArrayEquals(new String[]{"a"}, toArray(map.getKeyAlias("à")));
+ Assert.assertArrayEquals(new String[]{"e", "ebis"}, toArray(map.getKeyAlias("é")));
+ Assert.assertArrayEquals(new String[]{"E", "EBIS"}, toArray(map.getValueAlias("é", "è")));
+ Assert.assertArrayEquals(new String[]{}, toArray(map.getValueAlias("é", "è", "à")));
+
+ String v = map.remove("e");
+ Assert.assertEquals("E", v);
+ Assert.assertArrayEquals(new String[]{}, toArray(map.getAlias("e")));
+ Assert.assertArrayEquals(new String[]{"ebis"}, toArray(map.getKeyAlias("é")));
+
+ Collection<String> cr = map.removeValue("à", "é");
+ Assert.assertArrayEquals(new String[]{}, toArray(cr));
+
+ cr = map.removeValue("commun");
+ Assert.assertArrayEquals(new String[]{"A", "EBIS"}, toArray(cr));
+ }
+
+}
1
0
23 Feb '13
Author: bpoussin
Date: 2013-02-23 14:06:57 +0100 (Sat, 23 Feb 2013)
New Revision: 2502
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2502
Log:
la constante CLASS_METHOD_SEPARATOR est maintenant public
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java 2013-02-20 11:24:30 UTC (rev 2501)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java 2013-02-23 13:06:57 UTC (rev 2502)
@@ -74,7 +74,7 @@
static private Log log = LogFactory.getLog(ObjectUtil.class);
/** Used to know what is separator between class and method*/
- private static final String CLASS_METHOD_SEPARATOR = "#";
+ public static final String CLASS_METHOD_SEPARATOR = "#";
protected static final Integer ZERO = 0;
1
0
20 Feb '13
Author: bpoussin
Date: 2013-02-20 12:24:30 +0100 (Wed, 20 Feb 2013)
New Revision: 2501
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2501
Log:
move reuseable code from ApplicationConfig to ObjectUtil
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java 2013-02-15 19:56:59 UTC (rev 2500)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java 2013-02-20 11:24:30 UTC (rev 2501)
@@ -1876,30 +1876,10 @@
InvocationTargetException {
Action result = null;
- Class<?> clazz;
- Method method = null;
- String className;
- String methodName;
+ List<Method> methods = ObjectUtil.getMethod(name, true);
- // looking for method name
- int sep = name.lastIndexOf(CLASS_METHOD_SEPARATOR);
- if (sep == -1) {
- throw new IllegalArgumentException(String.format(
- "Can't find action method in %s", name));
- } else {
- className = name.substring(0, sep);
- methodName = name.substring(sep + 1);
- }
-
- // looking for class name
- try {
- clazz = Class.forName(className);
- } catch (ClassNotFoundException eee) {
- throw new IllegalArgumentException(String.format(
- "Can't find action class %s", className));
- }
-
- List<Method> methods = ObjectUtil.getMethod(clazz, methodName, true);
+ Class clazz = null;
+ Method method = null;
if (methods.size() > 0) {
if (methods.size() > 1) {
log.warn(String.format(
@@ -1907,6 +1887,7 @@
methods));
}
method = methods.get(0);
+ clazz = method.getDeclaringClass();
}
if (method != null) {
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java 2013-02-15 19:56:59 UTC (rev 2500)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ObjectUtil.java 2013-02-20 11:24:30 UTC (rev 2501)
@@ -73,6 +73,9 @@
/** Logger. */
static private Log log = LogFactory.getLog(ObjectUtil.class);
+ /** Used to know what is separator between class and method*/
+ private static final String CLASS_METHOD_SEPARATOR = "#";
+
protected static final Integer ZERO = 0;
protected static final Character ZEROC = (char) 0;
@@ -396,6 +399,42 @@
return result;
}
+ /**
+ * List method that match name, name must be [package.][class][#][method]
+ * if package, class or method missing, exception throw
+ *
+ * @param name name of the method
+ * @param ignoreCase check exact method name if false
+ * @return list of method that match name
+ * @since 2.6.9
+ */
+ static public List<Method> getMethod(String name, boolean ignoreCase) {
+ Class<?> clazz;
+ String className;
+ String methodName;
+
+ // looking for method name
+ int sep = name.lastIndexOf(CLASS_METHOD_SEPARATOR);
+ if (sep == -1) {
+ throw new IllegalArgumentException(String.format(
+ "Can't find method in %s", name));
+ } else {
+ className = name.substring(0, sep);
+ methodName = name.substring(sep + 1);
+ }
+
+ // looking for class name
+ try {
+ clazz = Class.forName(className);
+ } catch (ClassNotFoundException eee) {
+ throw new IllegalArgumentException(String.format(
+ "Can't find class %s", className));
+ }
+
+ List<Method> result = ObjectUtil.getMethod(clazz, methodName, ignoreCase);
+ return result;
+ }
+
public static Object newInstance(String constructorWithParams) throws ClassNotFoundException {
int p = constructorWithParams.indexOf('(');
int l = constructorWithParams.lastIndexOf(')');
1
0