diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-28 10:39:49 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-11-28 10:39:49 +0000 |
commit | 2dc8930c63368076d695c3f050fcd8815e7d0c2a (patch) | |
tree | f42e0a87595c96e37b28d5a0c6712ecb9236747d /java/sca | |
parent | cdf9b141765f5397bfd8927c8c8454fa8157ad65 (diff) |
Ensure that all of the jars are located correctly when the node launcher is run from the command line.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@721420 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
4 files changed, 27 insertions, 13 deletions
diff --git a/java/sca/distribution/core/src/main/components/bin-samples.xml b/java/sca/distribution/core/src/main/components/bin-samples.xml index fbe46a296c..0d4e296bb4 100644 --- a/java/sca/distribution/core/src/main/components/bin-samples.xml +++ b/java/sca/distribution/core/src/main/components/bin-samples.xml @@ -21,10 +21,13 @@ <!-- Add samples to the samples directory --> <fileSet> - <directory>../../../samples</directory> + <directory>../../samples</directory> <outputDirectory>samples</outputDirectory> <includes> - <include>calculator/**/*</include> + <include>README</include> + <include>logging.properties</include> + <include>calculator-equinox/**/*</include> + <!--include>calculator/**/*</include> <include>calculator-lean/**/*</include> <include>binding-echo/**/*</include> <include>binding-echo-extension/**/*</include> @@ -36,13 +39,15 @@ <include>loanapplication/**/*</include> <include>simple-bigbank/**/*</include> <include>simple-callback/**/*</include> - <include>supplychain/**/*</include> + <include>supplychain/**/*</include--> </includes> <excludes> <!-- General file/folders to exclude --> <exclude>**/.*</exclude> <exclude>**/.*/**</exclude> <exclude>**/*.log</exclude> + <exclude>**/*.svg</exclude> + <exclude>**/maven-eclipse.xml</exclude> <!-- Sample specific files/folders to exclude --> <exclude>pom.xml</exclude> diff --git a/java/sca/modules/node-launcher-equinox/pom.xml b/java/sca/modules/node-launcher-equinox/pom.xml index e3a9ac4e2e..6acabf1136 100644 --- a/java/sca/modules/node-launcher-equinox/pom.xml +++ b/java/sca/modules/node-launcher-equinox/pom.xml @@ -102,6 +102,7 @@ <archive> <manifest> <mainClass>org.apache.tuscany.sca.node.equinox.launcher.NodeMain</mainClass> + <addClasspath>true</addClasspath> </manifest> </archive> </configuration> diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java index 95d733aba2..db53eb7852 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java @@ -527,13 +527,17 @@ final class NodeLauncherUtil { * @param filter * @throws MalformedURLException */ - private static void collectClasspathEntries(File directory, Set<URL> urls, FilenameFilter filter) throws MalformedURLException { + private static void collectClasspathEntries(File directory, Set<URL> urls, FilenameFilter filter, boolean recursive) throws MalformedURLException { File[] files = directory.listFiles(filter); if (files != null) { int count = 0; for (File file: files) { - urls.add(file.toURI().toURL()); - count++; + if (recursive && file.isDirectory()) { + collectClasspathEntries(file, urls, filter, recursive); + } else { + urls.add(file.toURI().toURL()); + count++; + } } if (count != 0) { logger.info("Runtime classpath: "+ count + " JAR" + (count > 1? "s":"")+ " from " + directory.toString()); @@ -590,14 +594,14 @@ final class NodeLauncherUtil { // Collect files under the given directory jarDirectoryURLs.add(directoryURL); - collectClasspathEntries(directoryFile, jarURLs, filter); + collectClasspathEntries(directoryFile, jarURLs, filter, false); // Collect files under <directory>/modules File modulesDirectory = new File(directoryFile, "modules"); URL modulesDirectoryURL = modulesDirectory.toURI().toURL(); if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) { jarDirectoryURLs.add(modulesDirectoryURL); - collectClasspathEntries(modulesDirectory, jarURLs, filter); + collectClasspathEntries(modulesDirectory, jarURLs, filter, true); } // Collect files under <directory>/lib @@ -605,7 +609,7 @@ final class NodeLauncherUtil { URL libDirectoryURL = libDirectory.toURI().toURL(); if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) { jarDirectoryURLs.add(libDirectoryURL); - collectClasspathEntries(libDirectory, jarURLs, filter); + collectClasspathEntries(libDirectory, jarURLs, filter, true); } } } @@ -649,7 +653,7 @@ final class NodeLauncherUtil { // (e.g. the Tuscany modules directory) URL jarDirectoryURL = jarDirectory.toURI().toURL(); jarDirectoryURLs.add(jarDirectoryURL); - collectClasspathEntries(jarDirectory, jarURLs, new StandAloneJARFileNameFilter()); + collectClasspathEntries(jarDirectory, jarURLs, new StandAloneJARFileNameFilter(), true); File homeDirectory = jarDirectory.getParentFile(); if (homeDirectory != null && homeDirectory.exists()) { @@ -770,6 +774,10 @@ final class NodeLauncherUtil { public boolean accept(File dir, String name) { name = name.toLowerCase(); + if(new File(dir, name).isDirectory()) { + return true; + } + // Filter out the Tomcat and Webapp hosts if (name.startsWith("tuscany-host-tomcat") || name.startsWith("tuscany-host-webapp")) { @@ -918,7 +926,7 @@ final class NodeLauncherUtil { URL libDirectoryURL = libDirectory.toURI().toURL(); if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) { jarDirectoryURLs.add(libDirectoryURL); - collectClasspathEntries(libDirectory, jarURLs, filter); + collectClasspathEntries(libDirectory, jarURLs, filter, false); } } } diff --git a/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java b/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java index 10d3e14838..6b9ed5eae0 100644 --- a/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java +++ b/java/sca/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java @@ -115,7 +115,7 @@ final class NodeLauncherUtil { if (jarDirectory != null && jarDirectory.exists()) { File homeDirectory = jarDirectory.getParentFile(); if (homeDirectory != null && homeDirectory.exists()) { - collectJARFiles(jarDirectory.getPath(), jarDirectoryURLs, jarURLs, filter); + collectJARFiles(homeDirectory.getPath(), jarDirectoryURLs, jarURLs, filter); } } } @@ -185,7 +185,7 @@ final class NodeLauncherUtil { if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) { jarDirectoryURLs.add(modulesDirectoryURL); collectJARFiles(modulesDirectory, jarURLs, filter, true); - } + } // Collect files under $TUSCANY_HOME/lib File libDirectory = new File(directoryFile, "lib"); |