summaryrefslogtreecommitdiffstats
path: root/sandbox/slaws/runtimecompat/combinedlauncher/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-11-19 10:42:06 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-11-19 10:42:06 +0000
commit6ec4eafe0cda08a7b3fb862aa4027e8ac280f832 (patch)
tree11b74eb7865240d8345b5cdc4af308da682fc1f7 /sandbox/slaws/runtimecompat/combinedlauncher/src
parenta50e7af29c5695006c4227d4d7e36cf99eff254a (diff)
Sort out the 1.x bundles and launcher manifests and the relationships between them. Step closer to getting 1.x and 2.x up together. Still getting NPE in 1.x on start.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@882097 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/slaws/runtimecompat/combinedlauncher/src')
-rw-r--r--sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java61
1 files changed, 39 insertions, 22 deletions
diff --git a/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java b/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java
index f21284716f..5809f572fa 100644
--- a/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java
+++ b/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java
@@ -39,6 +39,8 @@ public class CombinedLauncher {
private static final String TWO_X_NODE_API_BUNDLE = "org.apache.tuscany.sca.node.api";
private static final String TWO_X_NODE = "org.apache.tuscany.sca.node.Node";
+
+ private static final String ONE_X_LAUNCHER = "launcher.OneXLauncher";
public static void main(String[] args) throws Exception {
// fire up the equinox host for the core set of Tuscany bundles
@@ -51,47 +53,52 @@ public class CombinedLauncher {
// set the environment variable. Don't do this at home
System.setProperty("TUSCANY_HOME",
"../../../java-2.x/distribution/all/target/apache-tuscany-sca-all-2.0-SNAPSHOT-dir/tuscany-sca-2.0-SNAPSHOT");
+
+ // To get to the console run with -Dosgi.console=<port>
EquinoxHost equinoxHost = new EquinoxHost();
BundleContext bundleContext = equinoxHost.start();
// need to add in the 1.x bundle(s) also
- // TODO
+ Bundle oneXbundle = equinoxHost.installBundle(new URL("file:///C:/simon/tuscany/sandbox/runtimecompat/1xbundle/target/1.x-osgi-bundle-1.6-SNAPSHOT.jar"), "1xbundle");
+ Bundle oneXLauncherbundle = equinoxHost.installBundle(new URL("file:///C:/simon/tuscany/sandbox/runtimecompat/1xlauncher/target/1x-launcher.jar"), "1xlauncherbundle");
- // load 2xcalculator?
+ System.out.println("Bundles loaded");
+/*
+ // load 2xcalculator
// find the the 2.x node launcher util
// Get the node runtime bundle.
- Bundle bundle = null;
+ Bundle twoXbundle = null;
for (Bundle b : bundleContext.getBundles()) {
if (TWO_X_NODE_LAUNCHER_EQUINOX_BUNDLE.equals(b.getSymbolicName())) {
- bundle = b;
+ twoXbundle = b;
break;
}
}
- if (bundle == null) {
+ if (twoXbundle == null) {
throw new IllegalStateException("Bundle " + TWO_X_NODE_LAUNCHER_EQUINOX_BUNDLE + " is not installed");
}
// All this reflection not strictly needed given the current
// module dependencies. Just experimenting
- Class<?> contributionClass = bundle.loadClass(TWO_X_CONTRIBUTION);
+ Class<?> contributionClass = twoXbundle.loadClass(TWO_X_CONTRIBUTION);
Constructor<?> constructor = contributionClass.getConstructor(String.class, String.class);
- Class<?> bootstrapClass = bundle.loadClass(TWO_X_NODE_LAUNCHER_UTIL);
+ Class<?> bootstrapClass = twoXbundle.loadClass(TWO_X_NODE_LAUNCHER_UTIL);
Class<?> contributionArrayClass = Array.newInstance(contributionClass, 0).getClass();
Method nodeMethod = bootstrapClass.getMethod("node", String.class, String.class, String.class, contributionArrayClass, BundleContext.class);
- bundle = null;
+ twoXbundle = null;
for (Bundle b : bundleContext.getBundles()) {
if (TWO_X_NODE_API_BUNDLE.equals(b.getSymbolicName())) {
- bundle = b;
+ twoXbundle = b;
break;
}
}
- if (bundle == null) {
+ if (twoXbundle == null) {
throw new IllegalStateException("Bundle " + TWO_X_NODE_API_BUNDLE + " is not installed");
}
- Class<?> nodeClass = bundle.loadClass(TWO_X_NODE);
+ Class<?> nodeClass = twoXbundle.loadClass(TWO_X_NODE);
Method startMethod = nodeClass.getMethod("start");
String configurationURI = null;
@@ -110,20 +117,30 @@ public class CombinedLauncher {
startMethod.invoke(node);
- System.out.println("2.x Started");
+ System.out.println("2.x Running");
+*/
+// try {
+// System.out.println("Waiting");
+// Thread.sleep(20000);
+// } catch (Exception ex) {
+//
+// }
- // load 1xcalculator?
+ // load 1xcalculator
// find the the 1.x node launcher
+ Class<?> oneXLauncherClass = oneXLauncherbundle.loadClass(ONE_X_LAUNCHER);
+ Method launchNodeMethod = oneXLauncherClass.getMethod("launchNode");
+ launchNodeMethod.invoke(null);
+
+ System.out.println("1.x Running");
+
+// try {
+// System.out.println("Press a key");
+// System.in.read();
+// } catch (Exception ex) {
+//
+// }
-
-
-/*
- Node node = NodeFactory.newInstance().createNode("Calculator.composite",
- new Contribution("calculator", "../2xcalculator.jar"));
-
- node.start();
- node.stop();
-*/
equinoxHost.stop();
}