From fe56d619a6e9c5a5a3ed26d61591fd4fb89b4c1f Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 8 Sep 2008 03:16:34 +0000 Subject: Simplified a bit the service discovery implementation. Some code cleanup in node-launcher-equinox. Started to remove dependencies on a particular setting of the Thread Context ClassLoader. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@692989 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/node/equinox/launcher/JarFileFinder.java | 5 +---- .../equinox/launcher/LibrariesBundleFileFactoryHook.java | 1 + .../sca/node/equinox/launcher/NodeLauncherUtil.java | 15 +++++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'java/sca/modules/node-launcher-equinox') diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/JarFileFinder.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/JarFileFinder.java index 476c65958e..0f595df758 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/JarFileFinder.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/JarFileFinder.java @@ -277,10 +277,7 @@ public class JarFileFinder { * * @return */ - public static List getClassPathEntries(ClassLoader classLoader, boolean recursive) { - if (classLoader == null) { - classLoader = Thread.currentThread().getContextClassLoader(); - } + static List getClassPathEntries(ClassLoader classLoader, boolean recursive) { Set entries = new HashSet(); list(entries, classLoader, recursive); return new ArrayList(entries); diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LibrariesBundleFileFactoryHook.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LibrariesBundleFileFactoryHook.java index 2713dd7f52..db0524a7d7 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LibrariesBundleFileFactoryHook.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LibrariesBundleFileFactoryHook.java @@ -64,6 +64,7 @@ public class LibrariesBundleFileFactoryHook implements org.eclipse.osgi.baseadap @Override public InputStream getInputStream() throws IOException { + System.out.println(new String(bytes)); return new ByteArrayInputStream(bytes); } 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 f4c4f1369c..c058589433 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 @@ -19,6 +19,12 @@ package org.apache.tuscany.sca.node.equinox.launcher; +import static org.osgi.framework.Constants.BUNDLE_CLASSPATH; +import static org.osgi.framework.Constants.BUNDLE_MANIFESTVERSION; +import static org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME; +import static org.osgi.framework.Constants.DYNAMICIMPORT_PACKAGE; +import static org.osgi.framework.Constants.EXPORT_PACKAGE; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -260,10 +266,11 @@ final class NodeLauncherUtil { Manifest manifest = new Manifest(); Attributes attributes = manifest.getMainAttributes(); attributes.putValue("Manifest-Version", "1.0"); - attributes.putValue(Constants.BUNDLE_MANIFESTVERSION, "2"); - attributes.putValue(Constants.BUNDLE_SYMBOLICNAME, "org.apache.tuscany.sca.node.launcher.equinox.libraries"); - attributes.putValue(Constants.EXPORT_PACKAGE, exports.substring(0, exports.length() -1)); - attributes.putValue(Constants.BUNDLE_CLASSPATH, classpath.substring(0, classpath.length() -1)); + attributes.putValue(BUNDLE_MANIFESTVERSION, "2"); + attributes.putValue(BUNDLE_SYMBOLICNAME, "org.apache.tuscany.sca.node.launcher.equinox.libraries"); + attributes.putValue(EXPORT_PACKAGE, exports.substring(0, exports.length() -1)); + attributes.putValue(BUNDLE_CLASSPATH, classpath.substring(0, classpath.length() -1)); + attributes.putValue(DYNAMICIMPORT_PACKAGE, "*"); return manifest; } catch (IOException e) { -- cgit v1.2.3