From 0c0d804be0482f70bb393ee0837d21d062560fc9 Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 29 Jan 2009 21:51:11 +0000 Subject: Pass arguments into EquinoxHost so that equinox runtime options can be honored from the main() git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@739035 13f79535-47bb-0310-9956-ffa450edef68 --- .../equinox/launcher/DomainManagerLauncher.java | 2 +- .../sca/node/equinox/launcher/EquinoxHost.java | 37 ++++++++++++++++------ .../node/equinox/launcher/NodeDaemonLauncher.java | 2 +- .../sca/node/equinox/launcher/NodeLauncher.java | 10 +++--- 4 files changed, 34 insertions(+), 17 deletions(-) (limited to 'java/sca/modules/node-launcher-equinox/src/main') diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java index e6f59e1b07..9078aca098 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java @@ -83,7 +83,7 @@ public class DomainManagerLauncher { try { // Start the OSGi host - equinox = new EquinoxHost(); + equinox = new EquinoxHost(args); equinox.start(); // Start the domain manager diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java index b069081a3d..912f15dde6 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java @@ -67,22 +67,31 @@ public class EquinoxHost { private BundleContext bundleContext; private Bundle launcherBundle; private boolean startedEclipse; - private Set dependencies; private List bundleFiles = new ArrayList(); private List bundleNames = new ArrayList(); private List jarFiles = new ArrayList(); private Map allBundles = new HashMap(); private List installedBundles = new ArrayList(); + private Set bundleLocations; + private String[] arguments = {}; + public EquinoxHost() { super(); } - public EquinoxHost(Set dependencies) { + public EquinoxHost(Set urls) { super(); - this.dependencies = dependencies; + this.bundleLocations = urls; } + public EquinoxHost(String[] args) { + super(); + if (args != null) { + this.arguments = args; + } + } + private static String getSystemProperty(final String name) { return AccessController.doPrivileged(new PrivilegedAction() { public String run() { @@ -142,7 +151,7 @@ public class EquinoxHost { EclipseStarter.setInitialProperties(props); // Start Eclipse - bundleContext = EclipseStarter.startup(new String[] {}, null); + bundleContext = EclipseStarter.startup(arguments, null); startedEclipse = true; } else { @@ -153,7 +162,7 @@ public class EquinoxHost { // Determine the runtime classpath entries Set urls; - urls = findDependencies(); + urls = findBundleLocations(); // Sort out which are bundles (and not already installed) and which are just // regular JARs @@ -320,21 +329,21 @@ public class EquinoxHost { } } - private Set findDependencies() throws FileNotFoundException, URISyntaxException, MalformedURLException { - if (dependencies == null) { + private Set findBundleLocations() throws FileNotFoundException, URISyntaxException, MalformedURLException { + if (bundleLocations == null) { if (!startedEclipse) { // Use classpath entries from a distribution if there is one and the modules // directories available in a dev environment for example - dependencies = runtimeClasspathEntries(true, false, true); + bundleLocations = runtimeClasspathEntries(true, false, true); } else { // Use classpath entries from a distribution if there is one and the classpath // entries on the current application's classloader - dependencies = runtimeClasspathEntries(true, true, false); + bundleLocations = runtimeClasspathEntries(true, true, false); } } - return dependencies; + return bundleLocations; } /** @@ -368,4 +377,12 @@ public class EquinoxHost { } } + public void setBundleLocations(Set bundleLocations) { + this.bundleLocations = bundleLocations; + } + + public void setArguments(String[] arguments) { + this.arguments = arguments; + } + } diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java index aeb29c0789..fac714db90 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java @@ -72,7 +72,7 @@ public class NodeDaemonLauncher { try { // Start the OSGi host - equinox = new EquinoxHost(); + equinox = new EquinoxHost(args); equinox.start(); // Start the node diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java index 462246f37c..225f99ca94 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java @@ -41,8 +41,8 @@ public class NodeLauncher { /** * Constructs a new node launcher. */ - private NodeLauncher() { - equinoxHost = new EquinoxHost(); + private NodeLauncher(String args[]) { + equinoxHost = new EquinoxHost(args); bundleContext = equinoxHost.start(); } @@ -51,8 +51,8 @@ public class NodeLauncher { * * @return a new launcher instance */ - public static NodeLauncher newInstance() { - return new NodeLauncher(); + public static NodeLauncher newInstance(String[] args) { + return new NodeLauncher(args); } /** @@ -101,7 +101,7 @@ public class NodeLauncher { logger.info("Apache Tuscany SCA Node is starting..."); // Create a node launcher - NodeLauncher launcher = newInstance(); + NodeLauncher launcher = newInstance(args); EquinoxHost equinox = launcher.equinoxHost; Object node = null; -- cgit v1.2.3