diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-01-29 21:51:11 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-01-29 21:51:11 +0000 |
commit | 0c0d804be0482f70bb393ee0837d21d062560fc9 (patch) | |
tree | f54b442a6581ceb3a5bcb0fcc210838b6c210554 /java/sca | |
parent | 14d5471f17989e8f8051d45b124fe1d9c5cfd26f (diff) |
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
Diffstat (limited to '')
5 files changed, 35 insertions, 18 deletions
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<URL> dependencies; private List<String> bundleFiles = new ArrayList<String>(); private List<String> bundleNames = new ArrayList<String>(); private List<String> jarFiles = new ArrayList<String>(); private Map<String, Bundle> allBundles = new HashMap<String, Bundle>(); private List<Bundle> installedBundles = new ArrayList<Bundle>(); + private Set<URL> bundleLocations; + private String[] arguments = {}; + public EquinoxHost() { super(); } - public EquinoxHost(Set<URL> dependencies) { + public EquinoxHost(Set<URL> 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<String>() { 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<URL> 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<URL> findDependencies() throws FileNotFoundException, URISyntaxException, MalformedURLException { - if (dependencies == null) { + private Set<URL> 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<URL> 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; diff --git a/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java b/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java index 6186b1799a..9d7059eab8 100644 --- a/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java +++ b/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java @@ -34,7 +34,7 @@ public class NodeLauncherTestCase { @BeforeClass public static void setUp() { try { - launcher = NodeLauncher.newInstance(); + launcher = NodeLauncher.newInstance(null); } catch (Exception e) { e.printStackTrace(); } |