From cc8967d7638d980d02cb44be647f76d979b02071 Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 3 Sep 2008 00:48:29 +0000 Subject: Make a few fields non-static to ServiceDiscovery Enable Equinox launcher to load tuscany jars git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@691447 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/node/equinox/launcher/EquinoxOSGiHost.java | 15 ++++++++++++--- .../node/equinox/launcher/LauncherBundleActivator.java | 9 ++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'java/sca/modules/node-launcher-equinox/src') diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java index 46b1ebb808..effe9b298d 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java @@ -31,7 +31,9 @@ import org.osgi.framework.BundleContext; * */ public class EquinoxOSGiHost implements OSGiHost { - + private LauncherBundleActivator activator = new LauncherBundleActivator(); + private BundleContext context; + private final static String systemPackages = "org.osgi.framework; version=1.3.0," + "org.osgi.service.packageadmin; version=1.2.0, " + "org.osgi.service.startlevel; version=1.0.0, " @@ -92,15 +94,22 @@ public class EquinoxOSGiHost implements OSGiHost { String args[] = {}; Map props = new HashMap(); props.put("org.osgi.framework.system.packages", systemPackages); + // Set the extension bundle + // props.put("osgi.framework.extensions", "org.apache.tuscany.sca.extensibility.equinox"); props.put(EclipseStarter.PROP_CLEAN, "true"); props.put(LocationManager.PROP_INSTANCE_AREA, new File("target/workspace").toURI().toString()); - props.put(LocationManager.PROP_INSTALL_AREA, new File("target/eclipse").toURI().toString()); + props.put(LocationManager.PROP_INSTALL_AREA, new File("target/eclipse/install").toURI().toString()); + props.put(LocationManager.PROP_CONFIG_AREA, new File("target/eclipse/config").toURI().toString()); + props.put(LocationManager.PROP_USER_AREA, new File("target/eclipse/user").toURI().toString()); + EclipseStarter.setInitialProperties(props); - BundleContext context = EclipseStarter.startup(args, null); + context = EclipseStarter.startup(args, null); + activator.start(context); return context; } private void shutdown() throws Exception { + activator.stop(context); EclipseStarter.shutdown(); } diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LauncherBundleActivator.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LauncherBundleActivator.java index 2a5af89171..778eb0f690 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LauncherBundleActivator.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/LauncherBundleActivator.java @@ -142,7 +142,8 @@ public class LauncherBundleActivator implements BundleActivator, Constants, Bund for (URL url : urls) { File file = new File(url.toURI()); - if (file.getName().startsWith("org.apache.felix.") || file.getName().startsWith("org.osgi.")) { + if (file.getName().startsWith("org.apache.felix.") || file.getName().startsWith("osgi-") + || file.getName().startsWith("org.osgi.")) { continue; } try { @@ -205,6 +206,12 @@ public class LauncherBundleActivator implements BundleActivator, Constants, Bund } String symbolicName = manifest.getMainAttributes().getValue(BUNDLE_SYMBOLICNAME); + if (symbolicName != null) { + int index = symbolicName.indexOf(';'); + if (index != -1) { + symbolicName = symbolicName.substring(0, index); + } + } String version = manifest.getMainAttributes().getValue(BUNDLE_VERSION); Bundle bundle = findBundle(bundleContext, symbolicName, version); if (bundle != null) { -- cgit v1.2.3