Author: chatellier Date: 2011-02-11 11:19:01 +0000 (Fri, 11 Feb 2011) New Revision: 739 Log: Use a spring class to search pattern resources Modified: trunk/changelog.txt trunk/coser-ui/pom.xml trunk/coser-ui/src/license/THIRD-PARTY.properties trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/option/OptionHandler.java trunk/pom.xml Modified: trunk/changelog.txt =================================================================== --- trunk/changelog.txt 2011-02-11 11:17:12 UTC (rev 738) +++ trunk/changelog.txt 2011-02-11 11:19:01 UTC (rev 739) @@ -1,6 +1,12 @@ Coser release notes =================== +1.0.1 +----- + + * Fix resources copy on javawebstart launch + * Fix selection file filtering after year/strata/species selection + 1.0 --- Modified: trunk/coser-ui/pom.xml =================================================================== --- trunk/coser-ui/pom.xml 2011-02-11 11:17:12 UTC (rev 738) +++ trunk/coser-ui/pom.xml 2011-02-11 11:19:01 UTC (rev 739) @@ -104,6 +104,10 @@ <groupId>com.bbn</groupId> <artifactId>openmap</artifactId> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </dependency> </dependencies> <name>Coser :: UI</name> @@ -232,6 +236,9 @@ <value>true</value> </property> </activation> + <!-- <properties> + <jnlp.codebase>file://${project.build.directory}/jnlp</jnlp.codebase> + </properties> --> <build> <plugins> <plugin> Modified: trunk/coser-ui/src/license/THIRD-PARTY.properties =================================================================== --- trunk/coser-ui/src/license/THIRD-PARTY.properties 2011-02-11 11:17:12 UTC (rev 738) +++ trunk/coser-ui/src/license/THIRD-PARTY.properties 2011-02-11 11:19:01 UTC (rev 739) @@ -2,24 +2,30 @@ #------------------------------------------------------------------------------- # Already used licenses in project : # - Apache 2 +# - Apache License # - Apache Software License, Version 2.0 +# - BBN Technologies # - BSD License +# - BSD-style license +# - Bouncy Castle License # - Common Development and Distribution License (CDDL) v1.0 # - Common Public License Version 1.0 # - GNU General Public License - Version 2 # - GNU Lesser General Public Licence # - GNU Lesser General Public License +# - GNU Lesser General Public License (LGPL), version 2.1 # - General Public License (GPL) v 3.0 # - Lesser General Public License (LGPL) # - Lesser General Public License (LGPL) v 3.0 # - License Agreement for JavaMail(TM) API +# - Mozilla Public License # - The Apache Software License, Version 2.0 # - The OpenSymphony Software License 1.1 #------------------------------------------------------------------------------- # Please fill the missing licenses for dependencies : # # -#Fri Nov 26 17:47:40 CET 2010 +#Thu Feb 10 10:52:10 CET 2011 commons-jxpath--commons-jxpath--1.3--jar=Apache Software License, Version 2.0 commons-primitives--commons-primitives--1.0--jar=Apache Software License, Version 2.0 javassist--javassist--3.8.0.GA--jar=GNU Lesser General Public License @@ -27,3 +33,5 @@ javax.mail--mail--1.4.1--jar=License Agreement for JavaMail(TM) API ognl--ognl--3.0--jar=The OpenSymphony Software License 1.1 org.apache.commons--commons-email--1.2--jar=Apache Software License, Version 2.0 +org.springframework--spring-asm--3.0.5.RELEASE--jar=Apache Software License, Version 2.0 +org.springframework--spring-core--3.0.5.RELEASE--jar=Apache Software License, Version 2.0 Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/option/OptionHandler.java =================================================================== --- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/option/OptionHandler.java 2011-02-11 11:17:12 UTC (rev 738) +++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/option/OptionHandler.java 2011-02-11 11:19:01 UTC (rev 739) @@ -28,7 +28,6 @@ import java.io.File; import java.io.IOException; import java.net.URL; -import java.util.List; import javax.swing.JOptionPane; import javax.swing.tree.TreePath; @@ -37,7 +36,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.util.Resource; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import fr.ifremer.coser.CoserConfig; import fr.ifremer.coser.CoserConstants.Category; @@ -106,27 +106,33 @@ validatorsDir.mkdirs(); // ne match que dans coser - List<URL> urls = Resource.getURLs(".*/validators/fr/ifremer/coser/.+\\.xml"); - for (URL url : urls) { - String path = url.getPath(); - String lastPath = path.substring(path.indexOf("/validators/") + "/validators/".length()); - String folderPath = lastPath.substring(0, lastPath.lastIndexOf('/')); - String name = lastPath.substring(lastPath.lastIndexOf('/') + 1); - - File validatorDirectory = new File(validatorsDir, folderPath); - validatorDirectory.mkdirs(); - File validatorFile = new File(validatorDirectory, name); - + try { + PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(Thread.currentThread().getContextClassLoader()); + Resource[] resources = resolver.getResources("classpath:/validators/fr/ifremer/coser/data/*.xml"); if (log.isDebugEnabled()) { - log.debug("Coping resources " + url + " to " + validatorFile.getAbsolutePath()); + log.debug("XML resources found : " + resources.length + " files"); } - try { + for (Resource resource : resources) { + URL url = resource.getURL(); + String path = url.getPath(); + String lastPath = path.substring(path.indexOf("/validators/") + "/validators/".length()); + String folderPath = lastPath.substring(0, lastPath.lastIndexOf('/')); + String name = lastPath.substring(lastPath.lastIndexOf('/') + 1); + + File validatorDirectory = new File(validatorsDir, folderPath); + validatorDirectory.mkdirs(); + File validatorFile = new File(validatorDirectory, name); + + if (log.isDebugEnabled()) { + log.debug("Coping resources " + url + " to " + validatorFile.getAbsolutePath()); + } + FileUtils.copyURLToFile(url, validatorFile); - } catch (IOException ex) { - if (log.isErrorEnabled()) { - log.error("Can't copy validators to file system", ex); - } } + } catch (IOException ex) { + if (log.isErrorEnabled()) { + log.error("Can't copy validators to file system", ex); + } } // remove bloking layer Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-02-11 11:17:12 UTC (rev 738) +++ trunk/pom.xml 2011-02-11 11:19:01 UTC (rev 739) @@ -274,6 +274,13 @@ <version>2.3.16</version> <scope>compile</scope> </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>3.0.5.RELEASE</version> + <scope>compile</scope> + </dependency> </dependencies> </dependencyManagement>