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
- 3157 discussions
Author: bpoussin
Date: 2013-01-22 18:38:58 +0100 (Tue, 22 Jan 2013)
New Revision: 2469
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2469
Log:
add third party license file
Added:
trunk/nuiton-profiling/src/license/THIRD-PARTY.properties
Added: trunk/nuiton-profiling/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-profiling/src/license/THIRD-PARTY.properties (rev 0)
+++ trunk/nuiton-profiling/src/license/THIRD-PARTY.properties 2013-01-22 17:38:58 UTC (rev 2469)
@@ -0,0 +1,21 @@
+# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
+#-------------------------------------------------------------------------------
+# Already used licenses in project :
+# - BSD License
+# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+# - Common Public License Version 1.0
+# - Eclipse Public License - v 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 :
+#
+#
+#Tue Jan 22 18:38:26 CET 2013
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
+regexp--regexp--1.3=The Apache Software License, Version 2.0
1
0
r2468 - in trunk/nuiton-profiling: . src/main/java/org/nuiton/profiling src/main/resources src/main/resources/nuiton-js src/main/resources/org src/main/resources/org/nuiton src/main/resources/org/nuiton/profiling src/main/resources/org/nuiton/profiling/web src/site/apt src/test/java/org/nuiton/profiling
by bpoussin@users.nuiton.org 22 Jan '13
by bpoussin@users.nuiton.org 22 Jan '13
22 Jan '13
Author: bpoussin
Date: 2013-01-22 18:06:19 +0100 (Tue, 22 Jan 2013)
New Revision: 2468
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2468
Log:
Anomalie #2513: [nuiton-profiling] update javadoc and documentation
Evolution #2511: [nuiton-profiling] add automatic CSV file generation when JVM shutdown
Evolution #2512: [nuiton-profiling] add mini web server in NuitonTrace to show statistic during application life
Added:
trunk/nuiton-profiling/src/main/resources/nuiton-js/
trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.properties
trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.xml
trunk/nuiton-profiling/src/main/resources/org/
trunk/nuiton-profiling/src/main/resources/org/nuiton/
trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/
trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/
trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/index.html
trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.css
trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.js
Modified:
trunk/nuiton-profiling/pom.xml
trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java
trunk/nuiton-profiling/src/site/apt/index.apt.vm
trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/NuitonTraceTest.java
Modified: trunk/nuiton-profiling/pom.xml
===================================================================
--- trunk/nuiton-profiling/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
+++ trunk/nuiton-profiling/pom.xml 2013-01-22 17:06:19 UTC (rev 2468)
@@ -39,6 +39,12 @@
<dependencies>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
@@ -108,6 +114,68 @@
<plugins>
<plugin>
+ <groupId>ro.isdc.wro4j</groupId>
+ <artifactId>wro4j-maven-plugin</artifactId>
+ <version>1.6.2</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-wro</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-jquery</artifactId>
+ <version>1.8.3-1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-jquery-ui</artifactId>
+ <version>1.9.2-1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-jqplot</artifactId>
+ <version>1.0.4r1121-1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-jqgrid</artifactId>
+ <version>4.4.1-1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.js</groupId>
+ <artifactId>nuiton-js-bootstrap</artifactId>
+ <version>2.2.2-1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+
+ <configuration>
+ <targetGroups>profiling-ui-web</targetGroups>
+ <minimize>true</minimize>
+ <wroFile>${basedir}/src/main/resources/nuiton-js/wro.xml</wroFile>
+ <extraConfigFile>${basedir}/src/main/resources/nuiton-js/wro.properties</extraConfigFile>
+ <contextFolder>${basedir}/src/main/resources/org/nuiton/profiling/web/</contextFolder>
+ <destinationFolder>${basedir}/target/classes/org/nuiton/profiling/web/</destinationFolder>
+ <wroManagerFactory>org.nuiton.js.wro.NuitonJsMavenWroManagerFactory</wroManagerFactory>
+ </configuration>
+ </plugin>
+
+ <plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
Modified: trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java
===================================================================
--- trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java 2013-01-13 11:57:03 UTC (rev 2467)
+++ trunk/nuiton-profiling/src/main/java/org/nuiton/profiling/NuitonTrace.java 2013-01-22 17:06:19 UTC (rev 2468)
@@ -21,20 +21,36 @@
*/
package org.nuiton.profiling;
-import java.util.Map.Entry;
-import org.apache.commons.lang3.time.DurationFormatUtils;
-
+import com.sun.net.httpserver.Headers;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import com.sun.net.httpserver.spi.HttpServerProvider;
+import java.io.ByteArrayOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.io.PrintStream;
+import java.io.Writer;
import java.lang.reflect.Method;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.Stack;
import java.util.TreeSet;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DurationFormatUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterThrowing;
@@ -44,48 +60,73 @@
import org.aspectj.lang.reflect.MethodSignature;
/**
- * TODO poussin 20110824 check documentation: this documentation is for aspectwerkz, there are little
- * change for aspectj. see example file aop.xml
+ * Permet de tracer les appels aux methodes.
*
- * Permet de tracer les appels aux methodes.
+ * <h1>Mise en place</h1>
+ *
+ * Il faut mettre dans les dependances Maven le nuiton-profiling
+ * <pre>
+ $lt;dependency$gt;
+ $lt;groupId$gt;org.nuiton$lt;/groupId$gt;
+ $lt;artifactId$gt;nuiton-profiling$lt;/artifactId$gt;
+ $lt;version$gt;2.7$lt;/version$gt;
+ $lt;/dependency$gt;
+ * </pre>
+ *
* <p/>
- * Pour l'utiliser il faut définir un fichier XML qui intercepte les methodes
- * souhaiter.
+ * Pour l'utiliser il faut définir un fichier XML aop.xml dans le repertoire
+ * META-INF ou WEB-INF qui intercepte les methodes souhaiter.
* <pre>
- * <?xml version="1.0" encoding="UTF-8"?>
- * <!DOCTYPE aspectwerkz PUBLIC
- * "-//AspectWerkz//DTD//EN"
- * "http://aspectwerkz.codehaus.org/dtd/aspectwerkz2.dtd">
- * <aspectwerkz>
- * <system id="sample">
- * <aspect class="fr.ifremer.isisfish.aspect.TraceIsis">
- * <pointcut name="executeMethod">
- * execution(* fr.ifremer.isisfish.datastore.ResultStorage.*(..))
- * || execution(* fr.ifremer.isisfish.aspect.Cache.*(..))
- * || execution(* fr.ifremer.isisfish.aspect.Trace.*(..))
- * || execution(* org.nuiton.topia..*(..))
- * || execution(* org.nuiton.math.matrix..*(..))
- * || execution(* fr.ifremer.isisfish.types..*(..))
- * || execution(* org.apache.commons.collections..*(..))
- * </pointcut>
- * </aspect>
- * </system>
- * </aspectwerkz>
+ * <!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"$gt;
+$lt;aspectj$gt;
+ $lt;weaver options="-verbose"$gt;
+ $lt;exclude within="fr.insee..*CGLIB*"/$gt;
+ $lt;/weaver$gt;
+ $lt;aspects$gt;
+ $lt;concrete-aspect name="org.nuiton.profiling.NuitonTraceAppAspect"
+ extends="org.nuiton.profiling.NuitonTrace"$gt;
+ $lt;pointcut name="executeMethod"
+ expression="
+ execution(* org.nuiton..*(..))
+ || execution(* org.chorem..*(..))
+ || execution(* org.apache..*(..))
+ || execution(* ognl..*(..))"/$gt;
+ $lt;/concrete-aspect$gt;
+ $lt;/aspects$gt;
+$lt;/aspectj$gt;
* </pre>
- * Ensuite il faut lancer la JVM avec deux options
+ * Ensuite il faut lancer la JVM avec l'option
* <pre>
- * -javaagent:path/to/aspectwerkz-jdk5-2.0.jar
- * -Daspectwerkz.definition.file=path/to/trace-aop.xml
+ * -javaagent:path/to/aspectjweaver-1.7.1.jar
* </pre>
- * Il est possible d'utiliser des noms normalisé et
- * trouvable dans le classpath a la place de -Daspectwerkz.definition.file
- * <li> /aspectwerkz.xml
- * <li> META-INF/aop.xml
- * <li> WEB-INF/aop.xml
- * <br/>
- * Ensuite pour afficher les statistiques dans votre programme
+ * normalement il se trouve dans le repo maven dans le repertoire
+ * <li>$MAVEN_REPO/org/aspectj/aspectjweaver/1.7.1/aspectjweaver-1.7.1.jar
+ *
+ * <h1>Utilisation</h1>
+ *
+ * Il y a 3 modes: interactif, non interactif et par programmation
+ *
+ * <h2>Mode non interactif</h2>
+ *
+ * Il faut mettre le nom d'un fichier dans la variable d'environnnement
+ * {@link #AUTO_SAVE_FILENAME_OPTION}. Dans ce cas lors de l'arrêt de la JVM
+ * les statistiques sont ecrites dans ce fichier.
+ *
+ * <h2>Mode interactif</h2>
+ *
+ * Il est possible de demander a a NuitonTrace lorsqu'il s'initialise de demarrer
+ * un serveur Web qui permet de voir et recuperer les donnees statistiques.
+ * Pour cela il faut indique sur quel port le serveur doit attendre via la
+ * variable d'environnnement {@link #PORT_OPTION}
+ *
+ * <h2>Par programmation</h2>
+ *
+ * Pour afficher les statistiques dans votre programme
* <li> log.info(NuitonTrace.getStatisticsAndClear());
* <li> NuitonTrace.printStatistiqueAndClear();
+ *
+ * <h1>Autre mode de fonctionnement</h1>
+ *
* Il doit être possible, plutot que d'écrire un fichier XML, de sous classer
* NuitonTrace en ajoutant par exemple
* <p/>
@@ -101,16 +142,31 @@
* Pointcut executeMethod;
* </pre>
* <p/>
- * Voir la classe de test {@code org.nuiton.profiling.NuitonTraceTest}.
*
- * @see http://aspectwerkz.codehaus.org/definition_issues.html
- *
* @author bpoussin <poussin(a)codelutin.com>
* @author tchemit <chemit(a)codelutin.com>
*/
@Aspect
public abstract class NuitonTrace {
+ /**
+ * constante determinant le nom de la variable d'environnement a lire
+ * pour connaitre le port a utiliser pour le serveur web
+ * @since 2.7
+ */ // ne doit pas contenir de '.' ou de '-' sinon elle est non utiliable en variable d'env
+ final static public String PORT_OPTION = "nuitonprofiling_webport";
+ /**
+ * constante determinant le nom de la variable d'environnement a lire
+ * pour connaitre le nom du fichier de sauvegarde a la sortie de la JVM
+ * @since 2.7
+ */ // ne doit pas contenir de '.' ou de '-' sinon elle est non utiliable en variable d'env
+ final static public String AUTO_SAVE_FILENAME_OPTION = "nuitonprofiling_autosavefile";
+ /**
+ * Indique si nuiton trace a deja ete initialise ou non
+ * @since 2.7
+ */
+ static protected boolean initilized = false;
+
static private final List<NuitonTrace> instances = new ArrayList<NuitonTrace>();
// poussin 20110824: ne pas mettre de logger, car sinon, ca pose des problemes
@@ -287,6 +343,70 @@
return result.toString();
}
+ /**
+ * @return les statistiques in json format
+ * @since 2.7
+ */
+ static public String getStatisticsJson() {
+ StringBuilder result = new StringBuilder();
+ result.append("{");
+
+ String separator = "";
+ for (NuitonTrace trace : instances) {
+ for (Method method : trace.statistics.keySet()) {
+ Statistic stat = trace.getStatistics(method);
+ Caller<Method> caller = trace.getCallers(method);
+ long meanTime = stat.timeTotal / stat.call;
+ result.append(separator);
+ separator = ","; // separtor est vide seulement la 1ere fois
+ result.append("'").append(method).append("': {");
+ result.append("'method':").append("'").append(method).append("'")
+ .append(",")
+ .append("'call':").append(stat.call)
+ .append(",")
+ // Time is in nano not millis, we must divide by 1000000
+ .append("'min':").append(DurationFormatUtils.formatDuration(stat.timeMin / 1000000, "s'.'S"))
+ .append(",")
+ .append("'mean':").append(DurationFormatUtils.formatDuration(meanTime / 1000000, "s'.'S"))
+ .append(",")
+ .append("'max':").append(DurationFormatUtils.formatDuration(stat.timeMax / 1000000, "s'.'S"))
+ .append(",")
+ .append("'total':").append(DurationFormatUtils.formatDuration(stat.timeTotal / 1000000, "s'.'S"))
+ .append(",")
+ .append("'call_nest':").append(stat.callNestMethod)
+ .append(",")
+ .append("'total_with_nest':").append(DurationFormatUtils.formatDuration(stat.timeTotalNestMethod / 1000000, "s'.'S"))
+ .append(",")
+ .append("'callers': [");
+ for (Map.Entry<Method, Integer> c : caller) {
+ result.append("{")
+ .append("'caller':").append("'").append(c.getKey()).append("'")
+ .append(",")
+ .append("'call':").append(c.getValue())
+ .append("},");
+ }
+ result.append("]}").append("\n");
+ }
+ }
+ result.append("}");
+ // Poussin 20110826 on ne vide pas les instances mais les stats
+// instances.clear();
+ return result.toString();
+ }
+
+ /**
+ * @return clear all statistiques
+ * @since 2.7
+ */
+ static public void clearStatistics() {
+ for (NuitonTrace trace : instances) {
+ trace.statistics.clear();
+ trace.callers.clear();
+ }
+ }
+
+
+
/** @return les statistiques */
static public String getStatisticsAndClear() {
StringBuilder result = new StringBuilder();
@@ -311,8 +431,6 @@
trace.statistics.clear();
trace.callers.clear();
}
- // Poussin 20110826 on ne vide pas les instances mais les stats
-// instances.clear();
return result.toString();
}
@@ -381,7 +499,7 @@
* appele a elle ce quelqu'un.
*
*/
- protected static class Caller<E> {
+ protected static class Caller<E> implements Iterable<Map.Entry<E, Integer>> {
protected Map<E, Integer> data = new HashMap<E, Integer>();
@@ -406,6 +524,21 @@
*/
@Override
public String toString() {
+
+ StringBuilder result = new StringBuilder();
+
+ for (Map.Entry<E, Integer> e : this) {
+ result.append(e.getValue()).append("=[").append(e.getKey()).append("]").append(",");
+ }
+ if (result.length() > 0) {
+ // on supprime la derniere virgule en trop
+ result.deleteCharAt(result.length()-1);
+ }
+
+ return result.toString();
+ }
+
+ public Iterator<Entry<E, Integer>> iterator() {
Comparator<Map.Entry<E, Integer>> comparator = new Comparator<Map.Entry<E, Integer>>() {
public int compare(Entry<E, Integer> o1, Entry<E, Integer> o2) {
// on inverse, car on veut le plus grand en 1er
@@ -414,25 +547,222 @@
};
Set<Map.Entry<E, Integer>> entries = data.entrySet();
- Set<Map.Entry<E, Integer>> sorted =
+ Set<Map.Entry<E, Integer>> sorted =
new TreeSet<Map.Entry<E, Integer>>(comparator);
sorted.addAll(entries);
+ return sorted.iterator();
+ }
+ }
- StringBuilder result = new StringBuilder();
+ /**
+ * Demarre le service web sur le port demande
+ * @param port un port valide sur lequel attendre
+ * @since 2.7
+ */
+ static protected void startWebService(int port) {
+ try {
+ HttpServerProvider provider = HttpServerProvider.provider();
+ InetSocketAddress inet = new InetSocketAddress(port);
+ HttpServer server = provider.createHttpServer(inet, 0);
- for (Map.Entry<E, Integer> e : sorted) {
- result.append(e.getValue()).append("=[").append(e.getKey()).append("]").append(",");
+ server.createContext("/", new WebHandler());
+ server.createContext("/data", new DataHandler());
+ server.createContext("/api", new ApiHandler());
+ server.start();
+ System.out.println("Nuiton profiling Server is listening on " + inet );
+
+ } catch(Throwable eee) {
+ System.err.println("Can't start web service on port " + port);
+ eee.printStackTrace(System.err);
+ }
+ }
+
+ /**
+ * Handler pour le serveur web qui gere le demande de statistique
+ * @since 2.7
+ */
+ static class WebHandler implements HttpHandler {
+
+ static final public String filepath = "/org/nuiton/profiling/web/";
+
+ public void handle(HttpExchange exchange) throws IOException {
+ String requestMethod = exchange.getRequestMethod();
+ if (requestMethod.equalsIgnoreCase("GET")) {
+ String path = exchange.getRequestURI().getPath();
+ String file = StringUtils.substringAfterLast(path, "/");
+ URL resource = getClass().getClassLoader().getResource(filepath + file);
+ if (resource == null) {
+ exchange.sendResponseHeaders(404, 0);
+ } else {
+ String type = "text/" + StringUtils.substringAfterLast(file, ".");
+ Headers responseHeaders = exchange.getResponseHeaders();
+ responseHeaders.set("Content-Type", type);
+ exchange.sendResponseHeaders(200, 0);
+
+ InputStream in = resource.openStream();
+ ByteArrayOutputStream content = new ByteArrayOutputStream();
+ IOUtils.copy(in, content);
+
+ OutputStream responseBody = exchange.getResponseBody();
+ responseBody.write(content.toByteArray());
+ responseBody.close();
+ IOUtils.closeQuietly(in);
+ IOUtils.closeQuietly(content);
+ }
}
- if (result.length() > 0) {
- // on supprime la derniere virgule en trop
- result.deleteCharAt(result.length()-1);
+
+ }
+ }
+
+ /**
+ * Handler pour le serveur web qui gere le demande de statistique
+ * @since 2.7
+ */
+ static class DataHandler implements HttpHandler {
+ /**
+ * Permet de recupere le parametre callback de l'URL, utilise pour le jsonp
+ * @param exchange
+ * @return
+ */
+ protected String getCallback(HttpExchange exchange) {
+ String result = null;
+ URI uri = exchange.getRequestURI();
+ String query = uri.getQuery();
+ if (query != null) {
+ String pairs[] = query.split("[&]");
+
+ for (String pair : pairs) {
+ String param[] = pair.split("[=]", 2);
+ if (param.length == 2 && "callback".equalsIgnoreCase(param[0])) {
+ result = param[1];
+ break;
+ }
+ }
}
+ return result;
+ }
- return result.toString();
+ public void handle(HttpExchange exchange) throws IOException {
+ String requestMethod = exchange.getRequestMethod();
+ if (requestMethod.equalsIgnoreCase("GET")) {
+ Headers responseHeaders = exchange.getResponseHeaders();
+ responseHeaders.set("Content-Type", "text/javascript");
+ exchange.sendResponseHeaders(200, 0);
+
+ String jsoncallback = getCallback(exchange);
+ String json = NuitonTrace.getStatisticsJson();
+ if (jsoncallback != null) {
+ json = jsoncallback + "(" + json + ")";
+ }
+
+ OutputStream responseBody = exchange.getResponseBody();
+ responseBody.write(json.getBytes());
+ responseBody.close();
+ }
}
+ }
+ /**
+ * Handler pour le serveur web qui gere l'api:
+ * <li>clear
+ * @since 2.7
+ */
+ static class ApiHandler implements HttpHandler {
+ public void handle(HttpExchange exchange) throws IOException {
+ String requestMethod = exchange.getRequestMethod();
+ if (requestMethod.equalsIgnoreCase("GET")) {
+ String path = exchange.getRequestURI().getPath();
+ if (StringUtils.endsWithIgnoreCase(path, "clear")) {
+ Headers responseHeaders = exchange.getResponseHeaders();
+ responseHeaders.set("Content-Type", "text/plain");
+ exchange.sendResponseHeaders(200, 0);
+ clearStatistics();
+
+ OutputStream responseBody = exchange.getResponseBody();
+ responseBody.write("ok".getBytes());
+ responseBody.close();
+ } else {
+ exchange.sendResponseHeaders(404, 0);
+ }
+ }
+
+ }
}
+ /**
+ * Permet de lire les options de la ligne de commande Java (-D) et si non
+ * trouver de rechercher dans les variables d'environnement
+ * @param optionName
+ * @return la valeur de l'option ou null si non trouve
+ * @since 2.7
+ */
+ static protected String getOption(String optionName) {
+ String result = System.getProperty(optionName);
+ if (result == null) {
+ result = System.getenv(optionName);
+ }
+ return result;
+ }
+
+ /**
+ * Recherche la configuration dans les variables d'environnement et les
+ * utilise pour mettre en place ce qui est demande par l'utilisateur
+ * @since 2.7
+ */
+ static protected void init() {
+ if (initilized) {
+ return;
+ }
+ initilized = true;
+
+ System.out.println("Init Nuiton Profiling ...");
+ String portString = getOption(PORT_OPTION);
+ System.out.println("NuitonProfiling web port: " + portString);
+ if (portString != null) {
+ try {
+ int port = Integer.parseInt(portString);
+ if (port > 0) {
+ startWebService(port);
+ }
+ } catch (Exception eee) {
+ eee.printStackTrace(System.err);
+ System.err.println("Can't parse port number: "+ portString);
+ }
+ }
+
+ final String file = getOption(AUTO_SAVE_FILENAME_OPTION);
+ System.out.println("NuitonProfiling auto save file: " + file);
+ if (file != null) {
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ Writer out = null;
+ try {
+ String stat = NuitonTrace.getStatisticsCSVAndClear();
+ out = new FileWriter(file);
+ out.write(stat);
+ } catch (IOException eee) {
+ eee.printStackTrace(System.err);
+ System.err.println("Can't write Statistic file: " + file);
+ } finally {
+ IOUtils.closeQuietly(out);
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Constructeur static pour initialise nuiton trace
+ * @since 2.7
+ */
+ static {
+ // attention aucune classe utilisee dans le init ne doit utiliser
+ // des classes surveille par NuitonTrace, sinon y'a un probleme d'init
+ // l'AOP voulant surveillee une method, mais l'AOP n'est pas encore
+ // initialise puisqu'on est dans l'init :(
+ init();
+ }
}
Added: trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.properties
===================================================================
--- trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.properties (rev 0)
+++ trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.properties 2013-01-22 17:06:19 UTC (rev 2468)
@@ -0,0 +1,4 @@
+debug=false
+preProcessors=cssDataUri,cssUrlRewriting,cssImport,semicolonAppender,cssMinJawr
+postProcessors=cssVariables,jsMin
+uriLocators=uri,classpath
Added: trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.xml
===================================================================
--- trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.xml (rev 0)
+++ trunk/nuiton-profiling/src/main/resources/nuiton-js/wro.xml 2013-01-22 17:06:19 UTC (rev 2468)
@@ -0,0 +1,29 @@
+<groups xmlns="http://www.isdc.ro/wro">
+
+ <group name='profiling-ui-web'>
+ <group-ref>jquery</group-ref>
+ <group-ref>bootstrap-responsive</group-ref>
+ <group-ref>jquery-ui</group-ref>
+ <group-ref>jquery-ui-base</group-ref>
+ <group-ref>jquery-ui-fr</group-ref>
+ <group-ref>jqplot</group-ref>
+
+ <!-- plugin jqplot -->
+ <group-ref>jqplot.dateAxisRenderer</group-ref>
+ <group-ref>jqplot.canvasAxisTickRenderer</group-ref>
+ <group-ref>jqplot.canvasTextRenderer</group-ref>
+ <group-ref>jqplot.categoryAxisRenderer</group-ref>
+ <group-ref>jqplot.cursor</group-ref>
+ <group-ref>jqplot.highlighter</group-ref>
+ <group-ref>jqplot.barRenderer</group-ref>
+
+ <!-- plugin jqgrid -->
+ <group-ref>jqgrid-fr</group-ref>
+ <group-ref>jqgrid</group-ref>
+
+ <!-- scpecifique nuiton profiling -->
+ <css>/nuiton-profiling.css</css>
+ <js>/nuiton-profiling.js</js>
+ </group>
+
+</groups>
Added: trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/index.html
===================================================================
--- trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/index.html (rev 0)
+++ trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/index.html 2013-01-22 17:06:19 UTC (rev 2468)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Nuiton Profiling</title>
+ <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+ <meta charset="UTF-8"/>
+
+ <link href="/profiling-ui-web.css" rel="stylesheet" type="text/css"/>
+ <script type="text/javascript" src="/profiling-ui-web.js"></script>
+
+ </head>
+ <body>
+ <div class="navbar navbar-fixed-top">
+ <div class="navbar-inner">
+ <div class="container">
+ <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
+ <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </a>
+
+ <a class="brand" href="http://maven-site.nuiton.org/nuiton-utils/nuiton-profiling/index.html">
+ Nuiton Profiling
+ </a>
+
+ <form action="javascript:requestNewData()">
+ <input type="text" id="newDatas" placeholder="app url" value="http://[::1]:4488/data"/>
+ <input id="addStat" type="submit" value="Add"/>
+ </form>
+ <input id="clearStat" type="submit" value="Clear"/>
+
+ Datas: <select id="datas">
+ <option label="" value=""></option>
+ </select>
+
+ </div>
+ </div>
+ </div>
+
+ <div class="container">
+ <div class="well">
+
+ <span id="download">download</span>
+
+ <table id="treegrid"></table>
+ <div id="ptreegrid"></div>
+
+ </div>
+ </div>
+ </body>
+</html>
Added: trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.css
===================================================================
--- trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.css (rev 0)
+++ trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.css 2013-01-22 17:06:19 UTC (rev 2468)
@@ -0,0 +1,6 @@
+body {
+ margin-top: 50px;
+}
+form {
+ display: inline;
+}
Added: trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.js
===================================================================
--- trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.js (rev 0)
+++ trunk/nuiton-profiling/src/main/resources/org/nuiton/profiling/web/nuiton-profiling.js 2013-01-22 17:06:19 UTC (rev 2468)
@@ -0,0 +1,252 @@
+jQuery(document).ready(function($) {
+ $('#newDatas').val(window.location.origin);
+
+ $('#clearStat').click(function () {
+ var url = $("#newDatas").val() + "/api/clear";
+ $.get(url);
+ });
+
+ $('#download').click(function () {
+ var content = '';
+
+ var fields = ['method', 'call', 'time', 'timewithnest', 'min', 'mean', 'max'];
+ content += fields.join(';') + '\n';
+ var rows = getGrid().jqGrid().getRowData();
+ $.each( rows, function(i, info){
+ var sep = '';
+ for (var i=0; i<fields.length; i++) {
+ if (i == 0) {
+ content += sep + $(info[fields[i]]).text();
+ } else {
+ content += sep + info[fields[i]]
+ }
+ sep = ';';
+ }
+ content += '\n';
+ });
+
+ window.URL = window.URL || window.webkitURL;
+ var a = document.createElement('a');
+ var blob = new Blob([content], {'type':'text/csv'});
+ a.href = window.URL.createObjectURL(blob);
+ a.download = 'nuitonprofiling.csv';
+ a.click();
+ window.URL.revokeObjectURL(a.href);
+ });
+
+$("select#datas").change(function () {
+ var index = $("select#datas option:selected").val();
+ if (index == "") {
+ loadData({});
+ } else {
+ loadData(datas[index]);
+ }
+ });
+
+ getGrid().jqGrid({
+ datatype: processrequest,
+ mtype: 'POST',
+ jsonReader : {
+ root:"rows",
+ page: "page",
+ total: "total",
+ records: "records",
+ repeatitems: false,
+ id: "idx"
+ },
+ colNames:["idx", "method","call","time", "timewithnest", "min", "mean", "max"],
+ colModel:[
+ {name:'idx', index:'idx', hidden: true, key:true, firstsortorder:'desc'},
+ {name:'method', index:'method', align: "left", formatter:methodFormatter},
+ {name:'call', index:'call', width:25, align:"right", sorttype:'float', firstsortorder:'desc'},
+ {name:'time', index:'time', width:25, align:"right", formatter:timeFormatter, sorttype:'float', firstsortorder:'desc'},
+ {name:'timewithnest', index:'timewithnest', width:25, align:"right", formatter:timeFormatter, sorttype:'float', firstsortorder:'desc'},
+ {name:'min', index:'min', width:25, align:"right", sorttype:'float', formatter:timeFormatter, firstsortorder:'desc'},
+ {name:'mean', index:'mean', width:25, align:"right", sorttype:'float', formatter:timeFormatter, firstsortorder:'desc'},
+ {name:'max', index:'max', width:25 ,align:"right", sorttype:'float', formatter:timeFormatter, firstsortorder:'desc'},
+ ],
+ height:'auto',
+ autowidth: true,
+ forceFit: true,
+ // rownumbers: true,
+ // treeGrid: true,
+ sortname: 'time',
+ sortorder: 'desc',
+ treeGridModel: 'adjacency',
+ ExpandColumn : 'method',
+ caption: "Info"
+ });
+
+ getGrid().jqGrid('filterToolbar', {searchOnEnter : false});
+
+});
+
+
+function requestNewData() {
+ var url = $("#newDatas").val() + "/data";
+ var select = $("#datas");
+ getNewData(url, select);
+}
+
+function getGrid() {
+ return $("#treegrid");
+}
+
+var currentData = {};
+var datas = [];
+
+/**
+ * Charge les data comme current data et force le rechargement de la grille
+ */
+function loadData(data) {
+ currentData = data;
+ getGrid().trigger("reloadGrid")
+}
+
+/**
+ * Recupere les donnees d'une instance de Nuiton Profiling et l'ajoute
+ * a la liste des donnees disponibles
+ */
+function getNewData (url, select) {
+ $.ajax({
+ type: "GET",
+ url: url,
+ dataType: "jsonp",
+ success: function(data){
+ var date = new Date();
+ select.append('<option label="'+date+'" value="'+datas.length+'"/>');
+ datas.push(data)
+ }
+ });
+}
+
+
+
+/**
+ * Pour les arbres les parametres sont:
+ * nodeid: le nom du noeud qui a ete ouvert
+ * n_level: le level du noeud qui a ete ouvert
+ * parentid: le noeud pere
+ *
+ * Les autres parametres:
+ * _search=false
+ * nd=1358630099165
+ * rows=10000
+ * page=1
+ * sidx=
+ * sord=asc
+ */
+function processrequest(args) {
+ var p = "";
+ for (var f in args) {
+ p += " "+f+"="+args[f];
+ }
+ console.log("r: '" + p + "'");
+ var thegrid = getGrid()[0];
+
+ var jsonObject = createGridData(currentData, args, args.nodeid, args.n_level, args.sidx, args.sord);
+
+ thegrid.addJSONData(jsonObject);
+}
+
+function checkFilter(filter, row) {
+ var result =
+ (!filter.method || row.method.indexOf(filter.method) > 0) &&
+ (!filter.call || row.call - filter.call > 0) &&
+ (!filter.time || row.time - filter.time > 0) &&
+ (!filter.timewithnest || row.timewithnest - filter.timewithnest > 0) &&
+ (!filter.min || row.min - filter.min > 0) &&
+ (!filter.mean || row.mean - filter.mean > 0) &&
+ (!filter.max || row.max - filter.max > 0)
+ ;
+ return result;
+}
+
+function createGridData(data, filter, parent, level, sortField, sortOrder) {
+ if (level === undefined) {
+ level = 0;
+ } else {
+ level++;
+ }
+ var rows = [];
+ if (data) {
+ $.each( data, function(method, info){
+ var row = {};
+ row.idx = level + '_' + rows.length;
+ row.level = level;
+ row.isLeaf = false;
+ row.parent = parent;
+
+ row.method = info.method;
+ row.call = info.call;
+ row.time = info.total;
+ row.timewithnest = info.total_with_nest;
+ row.min = info.min;
+ row.mean = info.mean;
+ row.max = info.max;
+
+ if (checkFilter(filter, row)) {
+ rows.push(row);
+ }
+ } );
+ }
+
+ sortRow(rows, sortField, sortOrder);
+
+ var result = {
+ "total": rows.length,
+ "page": "1",
+ "records": rows.length,
+ "rows" : rows
+ };
+
+ return result;
+}
+
+function sortRow(rows, field, order) {
+ if (field == 'method') {
+ rows.sort();
+ } else {
+ rows.sort(function(a,b) {
+ var result = a[field] - b[field];
+ return result;
+ });
+ }
+ if (order == 'desc') {
+ rows.reverse();
+ }
+}
+
+function methodFormatter (cellvalue, options, rowObject) {
+ var shortName = cellvalue.replace(/[^\(]*\.([_\w\$]+\.[_\w\$]+).*/, "$1");
+ var result = "<span title='" + cellvalue + "'>" + shortName + "</span>"
+ return result;
+}
+
+function two(x) {return ((x>9)?"":"0")+x}
+function three(x) {return ((x>99)?"":"0")+((x>9)?"":"0")+x}
+
+function timeFormatter (cellvalue, options, rowObject) {
+ // return cellvalue;
+ var ms = cellvalue * 1000;
+ var sec = Math.floor(ms/1000)
+ ms = ms % 1000
+ t = three(ms)
+
+ var min = Math.floor(sec/60)
+ sec = sec % 60
+ t = two(sec) + "." + t
+
+ var hr = Math.floor(min/60)
+ min = min % 60
+ t = two(min) + ":" + t
+
+ if (hr > 0) {
+ t = two(hr) + ":" + t
+ }
+
+ return t;
+// var time = new Date(0,0,0,0,0,0,cellvalue*1000);
+// var result = time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() + "." + time.getMilliseconds();
+// return result;
+}
Modified: trunk/nuiton-profiling/src/site/apt/index.apt.vm
===================================================================
--- trunk/nuiton-profiling/src/site/apt/index.apt.vm 2013-01-13 11:57:03 UTC (rev 2467)
+++ trunk/nuiton-profiling/src/site/apt/index.apt.vm 2013-01-22 17:06:19 UTC (rev 2468)
@@ -39,9 +39,9 @@
Permet de tracer le temps passé dans les méthodes au cours de l'éxecution.
Cette classe utilise l'AOP pour cela. Pour l'utiliser voir sa javadoc.
-NuitonTrace pour une application Web lancée avec Maven
+Configuration de NuitonTrace
- Il faut créer le fichier src/main/webapp/WEB-INF/classes/META-INF/aop.xml
+ Il faut créer le fichier src/main/resources/META-INF/aop.xml
pour indiquer les methodes que vous souhaitez surveiller, il contient par
exemple
@@ -78,6 +78,40 @@
</dependency>
--------------------------------------------------------------------------------
+ Vous pouvez ajouter une variable d'environnement pour qu'à la fin de l'exécution
+ de l'application les statistiques soient automatiquement sauvegardées
+
+--------------------------------------------------------------------------------
+ export nuitonprofiling_autosavefile=/path/to/MonFichierDeStat.csv
+--------------------------------------------------------------------------------
+
+ ou
+
+--------------------------------------------------------------------------------
+ java -Dnuitonprofiling_autosavefile=/path/to/MonFichierDeStat.csv ...
+--------------------------------------------------------------------------------
+
+ Vous pouvez ajouter une variable d'environnement pour qu'un serveur web soit
+ lancé et vous donne accès au statistique durant l'exécution de l'application
+
+--------------------------------------------------------------------------------
+ export nuitonprofiling_webport=4488
+--------------------------------------------------------------------------------
+
+ ou
+
+--------------------------------------------------------------------------------
+ java -Dnuitonprofiling_webport=4488 ...
+--------------------------------------------------------------------------------
+
+..Lors du lancement de la JVM il faut ajouter un agent sur la ligne de commande
+
+--------------------------------------------------------------------------------
+ java -javaagent:\${maven_repo}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar ...
+--------------------------------------------------------------------------------
+
+pour une application Web lancée avec Maven
+
Il faut ajouter des options Maven
--------------------------------------------------------------------------------
@@ -90,21 +124,11 @@
mvn jetty:run
--------------------------------------------------------------------------------
- Le plus simple pour sortir les statistiques lorsque vous en avez besoin est de
- créer un lien sur votre page web vers une jsp qui contient
-
---------------------------------------------------------------------------------
- <%@page import="org.nuiton.profiling.NuitonTrace"%>
- <%@page contentType="text/csv" pageEncoding="UTF-8"%>
- <%=NuitonTrace.getStatisticsCSVAndClear()%>
---------------------------------------------------------------------------------
-
Il ne vous reste plus qu'a analyser votre application
NuitonTrace pour une application Web lancée dans un Tomcat
- Procéder de la même façon que pour maven, le seul changement est le nom
- de la variable d'environnement qui est
+ Il faut ajouter des options Tomcat
--------------------------------------------------------------------------------
export JAVA_OPTS="$JAVA_OPTS -javaagent:${maven_repo}/org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar"
Modified: trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/NuitonTraceTest.java
===================================================================
--- trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/NuitonTraceTest.java 2013-01-13 11:57:03 UTC (rev 2467)
+++ trunk/nuiton-profiling/src/test/java/org/nuiton/profiling/NuitonTraceTest.java 2013-01-22 17:06:19 UTC (rev 2468)
@@ -28,10 +28,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
/**
- * Launch this test with -javaagent:target/lib/aspectjweaver-1.6.11.jar
+ * Launch this test with -javaagent:target/lib/aspectjweaver-1.7.1.jar
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.3
@@ -72,7 +73,7 @@
// pour pouvoir tester la meme chose avec un simple java -javaagent:...
// par exemple:
- // java -javaagent:target/lib/aspectjweaver-1.6.11.jar -classpath target/classes:target/lib/aspectjrt-1.6.11.jar:target/lib/aspectjweaver-1.6.11.jar:target/lib/commons-lang-2.6.jar:target/lib/commons-logging-1.1.1.jar:target/lib/junit-4.8.2.jar:target/lib/log4j-1.2.16.jar:target/test-classes org.nuiton.profiling.NuitonTraceTest
+ // java -javaagent:target/lib/aspectjweaver-1.7.1.jar -classpath target/classes:target/lib/aspectjrt-1.7.1.jar:target/lib/aspectjweaver-1.7.1.jar:target/lib/commons-lang-2.6.jar:target/lib/commons-logging-1.1.1.jar:target/lib/junit-4.8.2.jar:target/lib/log4j-1.2.16.jar:target/test-classes org.nuiton.profiling.NuitonTraceTest
public static void main(String... args) {
NuitonTraceTest t = new NuitonTraceTest();
1
0
r2467 - in trunk: . nuiton-csv nuiton-profiling nuiton-utils nuiton-utils-maven-report-plugin nuiton-validator
by maven-release@users.nuiton.org 13 Jan '13
by maven-release@users.nuiton.org 13 Jan '13
13 Jan '13
Author: maven-release
Date: 2013-01-13 12:57:03 +0100 (Sun, 13 Jan 2013)
New Revision: 2467
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2467
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/nuiton-csv/pom.xml
trunk/nuiton-profiling/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-01-13 11:57:01 UTC (rev 2466)
+++ trunk/nuiton-csv/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-csv</artifactId>
Modified: trunk/nuiton-profiling/pom.xml
===================================================================
--- trunk/nuiton-profiling/pom.xml 2013-01-13 11:57:01 UTC (rev 2466)
+++ trunk/nuiton-profiling/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-profiling</artifactId>
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-01-13 11:57:01 UTC (rev 2466)
+++ trunk/nuiton-utils/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6</version>
+ <version>2.7-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-01-13 11:57:01 UTC (rev 2466)
+++ trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-utils-maven-report-plugin</artifactId>
Modified: trunk/nuiton-validator/pom.xml
===================================================================
--- trunk/nuiton-validator/pom.xml 2013-01-13 11:57:01 UTC (rev 2466)
+++ trunk/nuiton-validator/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-validator</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-13 11:57:01 UTC (rev 2466)
+++ trunk/pom.xml 2013-01-13 11:57:03 UTC (rev 2467)
@@ -31,7 +31,7 @@
</parent>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6</version>
+ <version>2.7-SNAPSHOT</version>
<modules>
<module>nuiton-utils</module>
@@ -337,12 +337,12 @@
<scm>
<connection>
- scm:svn:http://svn.nuiton.org/svn/nuiton-utils/tags/nuiton-utils-2.6.6
+ 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.6
+ 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-01-13 12:57:01 +0100 (Sun, 13 Jan 2013)
New Revision: 2466
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2466
Log:
[maven-release-plugin] copy for tag nuiton-utils-2.6.6
Added:
tags/nuiton-utils-2.6.6/
Property changes on: tags/nuiton-utils-2.6.6
___________________________________________________________________
Added: svn:ignore
+ target
velocity.log
maven.log
.eclipse
.classpath
*.iml
*.ipr
*.iws
.settings
.project
testdir
Added: svn:mergeinfo
+
1
0
r2465 - in trunk: . nuiton-csv nuiton-profiling nuiton-utils nuiton-utils-maven-report-plugin nuiton-validator
by maven-release@users.nuiton.org 13 Jan '13
by maven-release@users.nuiton.org 13 Jan '13
13 Jan '13
Author: maven-release
Date: 2013-01-13 12:56:59 +0100 (Sun, 13 Jan 2013)
New Revision: 2465
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2465
Log:
[maven-release-plugin] prepare release nuiton-utils-2.6.6
Modified:
trunk/nuiton-csv/pom.xml
trunk/nuiton-profiling/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-01-13 11:16:02 UTC (rev 2464)
+++ trunk/nuiton-csv/pom.xml 2013-01-13 11:56:59 UTC (rev 2465)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.6.6</version>
</parent>
<artifactId>nuiton-csv</artifactId>
Modified: trunk/nuiton-profiling/pom.xml
===================================================================
--- trunk/nuiton-profiling/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
+++ trunk/nuiton-profiling/pom.xml 2013-01-13 11:56:59 UTC (rev 2465)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.6.6</version>
</parent>
<artifactId>nuiton-profiling</artifactId>
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
+++ trunk/nuiton-utils/pom.xml 2013-01-13 11:56:59 UTC (rev 2465)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.6.6</version>
</parent>
<artifactId>nuiton-utils</artifactId>
Modified: trunk/nuiton-utils-maven-report-plugin/pom.xml
===================================================================
--- trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
+++ trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-01-13 11:56:59 UTC (rev 2465)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.6.6</version>
</parent>
<artifactId>nuiton-utils-maven-report-plugin</artifactId>
Modified: trunk/nuiton-validator/pom.xml
===================================================================
--- trunk/nuiton-validator/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
+++ trunk/nuiton-validator/pom.xml 2013-01-13 11:56:59 UTC (rev 2465)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.6.6</version>
</parent>
<artifactId>nuiton-validator</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
+++ trunk/pom.xml 2013-01-13 11:56:59 UTC (rev 2465)
@@ -31,7 +31,7 @@
</parent>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.6.6</version>
<modules>
<module>nuiton-utils</module>
@@ -337,12 +337,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.6
</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.6
</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
r2464 - in trunk: . nuiton-csv/src/license nuiton-utils nuiton-utils/src/license nuiton-utils/src/main/java/org/nuiton/util nuiton-utils/src/test/java/org/nuiton/util nuiton-utils-maven-report-plugin/src/license nuiton-validator/src/license
by tchemit@users.nuiton.org 13 Jan '13
by tchemit@users.nuiton.org 13 Jan '13
13 Jan '13
Author: tchemit
Date: 2013-01-13 12:16:02 +0100 (Sun, 13 Jan 2013)
New Revision: 2464
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2464
Log:
prepare release (still doing some other nice people work, thanks\!)
Modified:
trunk/nuiton-csv/src/license/THIRD-PARTY.properties
trunk/nuiton-utils-maven-report-plugin/src/license/THIRD-PARTY.properties
trunk/nuiton-utils/pom.xml
trunk/nuiton-utils/src/license/THIRD-PARTY.properties
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipUtil.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/PagerBeanUtilTest.java
trunk/nuiton-validator/src/license/THIRD-PARTY.properties
trunk/pom.xml
Modified: trunk/nuiton-csv/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-csv/src/license/THIRD-PARTY.properties 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-csv/src/license/THIRD-PARTY.properties 2013-01-13 11:16:02 UTC (rev 2464)
@@ -2,7 +2,6 @@
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - BSD License
-# - BSD style
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
# - Common Public License Version 1.0
# - GNU Library or Lesser General Public License
@@ -11,10 +10,12 @@
# - 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 :
#
#
-#Tue Nov 22 12:24:47 CET 2011
+#Sun Jan 13 12:13:30 CET 2013
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
+regexp--regexp--1.3=The Apache Software License, Version 2.0
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
@@ -44,13 +44,9 @@
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- </dependency>
-
- <dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
Modified: trunk/nuiton-utils/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-utils/src/license/THIRD-PARTY.properties 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/license/THIRD-PARTY.properties 2013-01-13 11:16:02 UTC (rev 2464)
@@ -11,13 +11,12 @@
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
# - New BSD License
-# - Public Domain
# - The Apache Software License, Version 2.0
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Mon Jan 07 09:23:10 CET 2013
+#Sun Jan 13 12:12:10 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
regexp--regexp--1.3=The Apache Software License, Version 2.0
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfig.java 2013-01-13 11:16:02 UTC (rev 2464)
@@ -556,7 +556,7 @@
* Get os name (system property {@code os.name}).
*
* @return os name
- * @since 2.7
+ * @since 2.6.6
*/
public String getOsName() {
String result = getOption("os.name");
@@ -567,7 +567,7 @@
* Get os arch (system property {@code os.arch}).
*
* @return os arch
- * @since 2.7
+ * @since 2.6.6
*/
public String getOsArch() {
String result = getOption("os.arch");
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java 2013-01-13 11:16:02 UTC (rev 2464)
@@ -123,7 +123,7 @@
* @param includes config to include (if none given all is include)
* @param excludes config to exclude (if none given, no exclude)
* @param verbose verbose flag
- * @since 2.7
+ * @since 2.6.6
*/
public static void loadAllDefaultOption(ApplicationConfig config,
ClassLoader classLoader,
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-01-13 11:16:02 UTC (rev 2464)
@@ -122,7 +122,7 @@
* Last update: $Date$
* by : $Author$
*
- * @since 2.7
+ * @since 2.6.6
*/
public class ApplicationUpdater {
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipUtil.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipUtil.java 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ZipUtil.java 2013-01-13 11:16:02 UTC (rev 2464)
@@ -104,7 +104,7 @@
* @param targetDir the destination directory
* @return return last entry name
* @throws IOException if any problem while uncompressing
- * @since 2.7
+ * @since 2.6.6
*/
public static String uncompress(InputStream stream, File targetDir) throws IOException {
String result = uncompressAndRename(stream, targetDir, null, null);
@@ -148,7 +148,7 @@
* you can use $1, $2, ... if you have '(' ')' in renameFrom
* @return return last entry name
* @throws IOException if any problem while uncompressing
- * @since 2.7
+ * @since 2.6.6
*/
public static String uncompressAndRename(InputStream stream,
File targetDir,
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-01-13 11:16:02 UTC (rev 2464)
@@ -26,7 +26,6 @@
import java.io.File;
-import java.net.URL;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -38,6 +37,7 @@
*
* @author poussin
* @version $Revision$
+ * @since 2.6.6
*
* Last update: $Date$
* by : $Author$
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/PagerBeanUtilTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/PagerBeanUtilTest.java 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/PagerBeanUtilTest.java 2013-01-13 11:16:02 UTC (rev 2464)
@@ -32,7 +32,7 @@
* Test {@link PagerBeanUtil}.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 2.7
+ * @since 2.6.6
*/
public class PagerBeanUtilTest {
Modified: trunk/nuiton-utils-maven-report-plugin/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-utils-maven-report-plugin/src/license/THIRD-PARTY.properties 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-utils-maven-report-plugin/src/license/THIRD-PARTY.properties 2013-01-13 11:16:02 UTC (rev 2464)
@@ -4,7 +4,6 @@
# - Apache License
# - Apache Software License, Version 1.1
# - BSD License
-# - BSD style
# - 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
@@ -12,6 +11,7 @@
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
+# - New BSD License
# - Public Domain
# - The Apache Software License, Version 2.0
# - http://classworlds.codehaus.org/license.html
@@ -19,7 +19,7 @@
# Please fill the missing licenses for dependencies :
#
#
-#Tue May 01 14:53:17 CEST 2012
+#Sun Jan 13 12:14:17 CET 2013
antlr--antlr--2.7.2=BSD License
classworlds--classworlds--1.1-alpha-2=http\://classworlds.codehaus.org/lice…
commons-digester--commons-digester--1.6=The Apache Software License, Version 2.0
@@ -29,3 +29,4 @@
org.codehaus.plexus--plexus-i18n--1.0-beta-10=The Apache Software License, Version 2.0
org.codehaus.plexus--plexus-velocity--1.1.7=The Apache Software License, Version 2.0
oro--oro--2.0.8=The Apache Software License, Version 2.0
+regexp--regexp--1.3=The Apache Software License, Version 2.0
Modified: trunk/nuiton-validator/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-validator/src/license/THIRD-PARTY.properties 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/nuiton-validator/src/license/THIRD-PARTY.properties 2013-01-13 11:16:02 UTC (rev 2464)
@@ -2,7 +2,6 @@
#-------------------------------------------------------------------------------
# Already used licenses in project :
# - BSD License
-# - BSD style
# - 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
@@ -11,10 +10,12 @@
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
# - MPL 1.1
+# - New BSD License
# - The Apache Software License, Version 2.0
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Tue Apr 03 15:50:05 CEST 2012
+#Sun Jan 13 12:13:35 CET 2013
commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
+regexp--regexp--1.3=The Apache Software License, Version 2.0
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
+++ trunk/pom.xml 2013-01-13 11:16:02 UTC (rev 2464)
@@ -88,9 +88,6 @@
<developer>
<name>Florian Desbois</name>
<id>fdesbois</id>
- <email>desbois(a)codelutin.com</email>
- <organization>Code Lutin</organization>
- <organizationUrl>http://www.codelutin.com/</organizationUrl>
<timezone>Europe/Paris</timezone>
<roles>
<role>developer</role>
@@ -148,18 +145,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.4.1</version>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.0</version>
</dependency>
1
0
r2463 - in trunk: . nuiton-csv nuiton-profiling nuiton-utils nuiton-utils/src/main/java/org/nuiton/util nuiton-utils-maven-report-plugin nuiton-validator
by tchemit@users.nuiton.org 07 Jan '13
by tchemit@users.nuiton.org 07 Jan '13
07 Jan '13
Author: tchemit
Date: 2013-01-07 23:43:34 +0100 (Mon, 07 Jan 2013)
New Revision: 2463
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2463
Log:
pass to version 2.7-SNAPSHOT + fix typo
Modified:
trunk/nuiton-csv/pom.xml
trunk/nuiton-profiling/pom.xml
trunk/nuiton-utils-maven-report-plugin/pom.xml
trunk/nuiton-utils/pom.xml
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java
trunk/nuiton-validator/pom.xml
trunk/pom.xml
Modified: trunk/nuiton-csv/pom.xml
===================================================================
--- trunk/nuiton-csv/pom.xml 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/nuiton-csv/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-csv</artifactId>
Modified: trunk/nuiton-profiling/pom.xml
===================================================================
--- trunk/nuiton-profiling/pom.xml 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/nuiton-profiling/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-profiling</artifactId>
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/nuiton-utils/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-utils</artifactId>
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java 2013-01-07 22:43:34 UTC (rev 2463)
@@ -122,7 +122,7 @@
* @param classLoader optional classLoader
* @param includes config to include (if none given all is include)
* @param excludes config to exclude (if none given, no exclude)
- * @param verbose verbose flga
+ * @param verbose verbose flag
* @since 2.7
*/
public static void loadAllDefaultOption(ApplicationConfig config,
Modified: trunk/nuiton-utils-maven-report-plugin/pom.xml
===================================================================
--- trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/nuiton-utils-maven-report-plugin/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-utils-maven-report-plugin</artifactId>
Modified: trunk/nuiton-validator/pom.xml
===================================================================
--- trunk/nuiton-validator/pom.xml 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/nuiton-validator/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
</parent>
<artifactId>nuiton-validator</artifactId>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-07 22:40:38 UTC (rev 2462)
+++ trunk/pom.xml 2013-01-07 22:43:34 UTC (rev 2463)
@@ -31,7 +31,7 @@
</parent>
<artifactId>nuiton-utils-parent</artifactId>
- <version>2.6.6-SNAPSHOT</version>
+ <version>2.7-SNAPSHOT</version>
<modules>
<module>nuiton-utils</module>
1
0
07 Jan '13
Author: tchemit
Date: 2013-01-07 23:40:38 +0100 (Mon, 07 Jan 2013)
New Revision: 2462
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2462
Log:
fixes #2503: [ApplicationConfig] Add a method to load all default options from all ApplicationConfigProvider found in class-path
Modified:
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java 2013-01-07 08:29:27 UTC (rev 2461)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationConfigHelper.java 2013-01-07 22:40:38 UTC (rev 2462)
@@ -114,4 +114,40 @@
}
return result;
}
+
+ /**
+ * Load default options from all config provider found in classpath.
+ *
+ * @param config config where to add default options.
+ * @param classLoader optional classLoader
+ * @param includes config to include (if none given all is include)
+ * @param excludes config to exclude (if none given, no exclude)
+ * @param verbose verbose flga
+ * @since 2.7
+ */
+ public static void loadAllDefaultOption(ApplicationConfig config,
+ ClassLoader classLoader,
+ Set<String> includes,
+ Set<String> excludes,
+ boolean verbose) {
+
+ Set<ApplicationConfigProvider> providers = getProviders(classLoader,
+ includes,
+ excludes,
+ verbose);
+ for (ApplicationConfigProvider provider : providers) {
+ if (log.isInfoEnabled()) {
+ log.info("Load default options from configuration: " +
+ provider.getName());
+ }
+ if (verbose && log.isInfoEnabled()) {
+ for (ApplicationConfig.OptionDef optionDef : provider.getOptions()) {
+ log.info(" " + optionDef.getKey() +
+ " (" + optionDef.getDefaultValue() + ')');
+ }
+ }
+ config.loadDefaultOptions(provider.getOptions());
+ }
+
+ }
}
1
0
r2461 - in trunk/nuiton-utils/src: license main/java/org/nuiton/util test/java/org/nuiton/util test/resources/ApplicationUpdater/App1 test/resources/ApplicationUpdater/App2 test/resources/ApplicationUpdater/App3 test/resources/ApplicationUpdater/zip test/resources/properties
by tchemit@users.nuiton.org 07 Jan '13
by tchemit@users.nuiton.org 07 Jan '13
07 Jan '13
Author: tchemit
Date: 2013-01-07 09:29:27 +0100 (Mon, 07 Jan 2013)
New Revision: 2461
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2461
Log:
optimize third parties
add missing svn properties + license headers
Modified:
trunk/nuiton-utils/src/license/THIRD-PARTY.properties
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App1/Readme.txt
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App1/version.appup
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App2/Readme.txt
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App3/Readme.txt
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App3/version.appup
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App2-7.zip
trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App3-7.zip
trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties
trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties
Modified: trunk/nuiton-utils/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/nuiton-utils/src/license/THIRD-PARTY.properties 2013-01-05 02:50:34 UTC (rev 2460)
+++ trunk/nuiton-utils/src/license/THIRD-PARTY.properties 2013-01-07 08:29:27 UTC (rev 2461)
@@ -1,6 +1,7 @@
# 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
@@ -9,10 +10,14 @@
# - Lesser General Public License (LPGL)
# - Lesser General Public License (LPGL) v 2.1
# - MIT License
+# - New BSD License
+# - Public Domain
# - The Apache Software License, Version 2.0
#-------------------------------------------------------------------------------
# Please fill the missing licenses for dependencies :
#
#
-#Fri Sep 09 18:42:56 CEST 2011
+#Mon Jan 07 09:23:10 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
+regexp--regexp--1.3=The Apache Software License, Version 2.0
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-01-05 02:50:34 UTC (rev 2460)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-01-07 08:29:27 UTC (rev 2461)
@@ -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.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
Property changes on: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-01-05 02:50:34 UTC (rev 2460)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-01-07 08:29:27 UTC (rev 2461)
@@ -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.io.File;
import java.net.URL;
import java.util.Map;
Property changes on: trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App1/Readme.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App1/version.appup
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App2/Readme.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App3/Readme.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/App3/version.appup
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App2-7.zip
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Property changes on: trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App3-7.zip
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties
===================================================================
--- trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties 2013-01-05 02:50:34 UTC (rev 2460)
+++ trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties 2013-01-07 08:29:27 UTC (rev 2461)
@@ -1,3 +1,26 @@
+###
+# #%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/…
linux.App3.version=8
Property changes on: trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties
===================================================================
--- trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties 2013-01-05 02:50:34 UTC (rev 2460)
+++ trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties 2013-01-07 08:29:27 UTC (rev 2461)
@@ -1,3 +1,26 @@
+###
+# #%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
Property changes on: trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r2460 - in trunk: . nuiton-utils nuiton-utils/src/main/java/org/nuiton/util nuiton-utils/src/test/java/org/nuiton/util nuiton-utils/src/test/resources/properties
by bpoussin@users.nuiton.org 05 Jan '13
by bpoussin@users.nuiton.org 05 Jan '13
05 Jan '13
Author: bpoussin
Date: 2013-01-05 03:50:34 +0100 (Sat, 05 Jan 2013)
New Revision: 2460
Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2460
Log:
utilsation de commons-vfs2 pour l'acces au ressource ce qui permet
de supporter tout type de protocole et de format de compression
Modified:
trunk/nuiton-utils/pom.xml
trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties
trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties
trunk/pom.xml
Modified: trunk/nuiton-utils/pom.xml
===================================================================
--- trunk/nuiton-utils/pom.xml 2013-01-04 15:51:26 UTC (rev 2459)
+++ trunk/nuiton-utils/pom.xml 2013-01-05 02:50:34 UTC (rev 2460)
@@ -44,6 +44,21 @@
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-vfs2</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
Modified: trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java
===================================================================
--- trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-01-04 15:51:26 UTC (rev 2459)
+++ trunk/nuiton-utils/src/main/java/org/nuiton/util/ApplicationUpdater.java 2013-01-05 02:50:34 UTC (rev 2460)
@@ -5,11 +5,6 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Proxy;
-import java.net.SocketAddress;
-import java.net.URL;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -21,6 +16,13 @@
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;
/**
* Permet de telecharger des mises a jour d'application.
@@ -29,7 +31,7 @@
* information necessaire pour la recuperation de l'application.
*
* Si une nouvelle version de l'application existe, elle est alors telechargee
- * et dezipper dans un repertoire specifique (elle ne remplace pas l'application
+ * et decompressee dans un repertoire specifique (elle ne remplace pas l'application
* courante).
*
* Il est alors a la charge d'un script de mettre en place cette nouvelle application
@@ -49,7 +51,8 @@
*
* <h3>format du fichier de properties</h3>
* [osName.][osArch.]appName.version=version de l'application
- * [osName.][osArch.]appName.url=url du zip de la nouvelle version
+ * [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>)
*
* appName est a remplacer par le nom de l'application. Il est possible
* d'avoir plusieurs application dans le meme fichier ou plusieurs version
@@ -57,13 +60,13 @@
*
* osName et osArch sont toujours en minuscule
*
- * <h3>format des fichiers zip applicatif</h3>
+ * <h3>format des fichiers compresses</h3>
*
- * Le zip doit avec un repertoire racine qui contient l'ensemble de l'application
+ * 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
- * dezippe le fichier.
+ * decompresse le fichier.
*
- * exemple de contenu de zip convenable
+ * exemple de contenu de fichier compresse convenable
* <pre>
* MonApp-0.3/Readme.txt
* MonApp-0.3/License.txt
@@ -150,8 +153,8 @@
* @param async if true, check is done in background mode
* @param callback callback used to interact with updater, can be null
*/
- public void update(URL propertiesURL, File currentDir, File destDir, boolean async, ApplicationUpdaterCallback callback) {
- Updater up = new Updater(config, propertiesURL, currentDir, destDir, callback);
+ 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();
@@ -232,15 +235,15 @@
static public class Updater implements Runnable {
protected ApplicationConfig config;
- protected URL url;
+ protected String vfsPropertiesUrl;
protected File currentDir;
protected File destDir;
protected ApplicationUpdaterCallback callback;
- public Updater(ApplicationConfig config, URL url,
+ public Updater(ApplicationConfig config, String vfsPropertiesUrl,
File currentDir, File destDir, ApplicationUpdaterCallback callback) {
this.config = config;
- this.url = url;
+ this.vfsPropertiesUrl = vfsPropertiesUrl;
this.currentDir = currentDir;
this.destDir = destDir;
this.callback = callback;
@@ -255,8 +258,8 @@
*/
public void run() {
try {
- Proxy proxy = getProxy(config);
- ApplicationConfig releaseConfig = getUpdaterConfig(proxy);
+ FileSystemOptions vfsConfig = getVFSConfig(config);
+ ApplicationConfig releaseConfig = getUpdaterConfig(vfsConfig, vfsPropertiesUrl);
List<String> appNames = getApplicationName(releaseConfig);
Map<String, String> appVersions = getCurrentVersion(appNames, currentDir);
@@ -291,7 +294,7 @@
String app = appInfo.getKey();
ApplicationInfo info = appInfo.getValue();
try {
- doUpdate(proxy, appInfo.getValue());
+ doUpdate(vfsConfig, appInfo.getValue());
} catch (Exception eee) {
appUpdateError.put(app, eee);
try {
@@ -321,7 +324,7 @@
log.warn("Can't update");
log.info("Application update aborted because: ", eee);
if (callback != null) {
- callback.aborted(String.valueOf(url), eee);
+ callback.aborted(vfsPropertiesUrl, eee);
}
}
}
@@ -337,20 +340,13 @@
* @param info information sur l'application a mettre a jour
* @throws Exception
*/
- protected void doUpdate(Proxy proxy, ApplicationInfo info) throws Exception {
+ protected void doUpdate(FileSystemOptions vfsConfig, ApplicationInfo info) throws Exception {
if (info.destDir != null) {
- // suppression d'une ancienne version si elle existait
File dest = new File(info.destDir, info.name);
- if (dest.exists()) {
- log.warn(String.format("Remove destination directory for new data '%s'", dest));
- FileUtils.deleteDirectory(dest);
- }
+ deepCopy(vfsConfig, info.url, dest.getAbsolutePath());
- URL applicationURL = toURL(info.url);
- InputStream in = new BufferedInputStream(
- applicationURL.openConnection(proxy).getInputStream());
- ZipUtil.uncompressAndRename(in, info.destDir, "^[^/]+", info.name);
- File versionFile = new File(info.destDir, info.name + File.separator + VERSION_FILE);
+ // 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'",
@@ -361,21 +357,51 @@
}
/**
- * Converti le path en URL. Path doit etre une URL, mais pour les fichiers
+ * Recupere le contenu du repertoire de l'archive pour le mettre dans targetPath
+ * 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
+ */
+ protected void deepCopy(FileSystemOptions vfsConfig,
+ String srcPath, String targetPath) throws FileSystemException {
+ FileSystemManager fsManager = VFS.getManager();
+ FileObject archive = fsManager.resolveFile(toVfsURL(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
+ * @return
*/
- protected URL toURL(String path) throws MalformedURLException {
- URL result;
- if (StringUtils.startsWith(path, "file:")) {
- File f = new File(StringUtils.substringAfter(path, "file:"));
- result = f.toURI().toURL();
- } else {
- result = new URL(path);
+ 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;
}
@@ -386,27 +412,35 @@
* @return
* @throws Exception
*/
- protected ApplicationConfig getUpdaterConfig(Proxy proxy) 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' with proxy '%s'",
- url, proxy));
+ log.debug(String.format("Try to load properties from '%s'", vfsPropertiesUrl));
}
-
- InputStream in = new BufferedInputStream(
- url.openConnection(proxy).getInputStream());
+
Properties prop = new Properties();
- prop.load(in);
+ 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",
- url, prop));
+ vfsPropertiesUrl, prop));
}
// load config with new properties as default
@@ -422,12 +456,12 @@
/**
* Recupere le proxy http a utiliser pour les connexions reseaux
- *
+ *
* @param config
* @return
*/
- protected Proxy getProxy(ApplicationConfig config) {
- Proxy result = Proxy.NO_PROXY;
+ protected FileSystemOptions getVFSConfig(ApplicationConfig config) {
+ FileSystemOptions result = new FileSystemOptions();
String proxyHost = config.getOption(HTTP_PROXY);
try {
proxyHost = StringUtils.substringAfter(proxyHost, "://");
@@ -435,9 +469,11 @@
String hostname = StringUtils.substringBefore(proxyHost, ":");
String port = StringUtils.substringAfter(proxyHost, ":");
if (StringUtils.isNumeric(port)) {
+
int portNumber = Integer.parseInt(port);
- SocketAddress socket = new InetSocketAddress(hostname, portNumber);
- result = new Proxy(Proxy.Type.HTTP, socket);
+
+ HttpFileSystemConfigBuilder.getInstance().setProxyHost(result, hostname);
+ HttpFileSystemConfigBuilder.getInstance().setProxyPort(result, portNumber);
} else {
log.warn(String.format("Invalide proxy port number '%s', not used proxy", port));
}
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java
===================================================================
--- trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-01-04 15:51:26 UTC (rev 2459)
+++ trunk/nuiton-utils/src/test/java/org/nuiton/util/ApplicationUpdaterTest.java 2013-01-05 02:50:34 UTC (rev 2460)
@@ -47,7 +47,7 @@
@Test
public void testUpdate() throws Exception {
ApplicationUpdater up = new ApplicationUpdater();
- URL url = new File("src/test/resources/properties/ApplicationUpdaterTest.properties").toURI().toURL();
+ String url = "file:src/test/resources/properties/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());
@@ -56,7 +56,7 @@
@Test
public void testUpdateNetwork() throws Exception {
ApplicationUpdater up = new ApplicationUpdater();
- URL url = new URL("http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resource…");
+ String url = "http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resource…";
File current = new File("src/test/resources/ApplicationUpdater");
File dest = new File("target/test/ApplicationUpdater/NEWNETWORK");
up.update(url, current, dest, false, new Callback());
Modified: trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties
===================================================================
--- trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties 2013-01-04 15:51:26 UTC (rev 2459)
+++ trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterNetworkTest.properties 2013-01-05 02:50:34 UTC (rev 2460)
@@ -1,6 +1,6 @@
App1.version=0.3
-App1.url=http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
+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=http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App3-7.zip
+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=http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App2-7.zip
+linux.amd64.App2.url=zip:http://svn.nuiton.org/svn/nuiton-utils/trunk/nuiton-utils/src/test/resources/ApplicationUpdater/zip/App2-7.zip
Modified: trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties
===================================================================
--- trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties 2013-01-04 15:51:26 UTC (rev 2459)
+++ trunk/nuiton-utils/src/test/resources/properties/ApplicationUpdaterTest.properties 2013-01-05 02:50:34 UTC (rev 2460)
@@ -1,6 +1,6 @@
App1.version=0.3
-App1.url=file:src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
+App1.url=zip:file:src/test/resources/ApplicationUpdater/zip/App1-0.3.zip
linux.App3.version=8
-linux.App3.url=file:src/test/resources/ApplicationUpdater/zip/App3-7.zip
+linux.App3.url=zip:file:src/test/resources/ApplicationUpdater/zip/App3-7.zip
linux.amd64.App2.version=7
-linux.amd64.App2.url=file:src/test/resources/ApplicationUpdater/zip/App2-7.zip
+linux.amd64.App2.url=zip:file:src/test/resources/ApplicationUpdater/zip/App2-7.zip
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-01-04 15:51:26 UTC (rev 2459)
+++ trunk/pom.xml 2013-01-05 02:50:34 UTC (rev 2460)
@@ -147,6 +147,24 @@
<dependencies>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-vfs2</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton.i18n</groupId>
<artifactId>nuiton-i18n</artifactId>
<version>${nuitonI18nVersion}</version>
1
0