Author: slaws
Date: Thu Nov 19 10:42:06 2009
New Revision: 882097

URL: http://svn.apache.org/viewvc?rev=882097&view=rev
Log:
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. 

Modified:
    tuscany/sandbox/slaws/runtimecompat/1xbundle/pom.xml
    tuscany/sandbox/slaws/runtimecompat/1xlauncher/pom.xml
    
tuscany/sandbox/slaws/runtimecompat/1xlauncher/src/main/java/launcher/OneXLauncher.java
    
tuscany/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java

Modified: tuscany/sandbox/slaws/runtimecompat/1xbundle/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/runtimecompat/1xbundle/pom.xml?rev=882097&r1=882096&r2=882097&view=diff
==============================================================================
--- tuscany/sandbox/slaws/runtimecompat/1xbundle/pom.xml (original)
+++ tuscany/sandbox/slaws/runtimecompat/1xbundle/pom.xml Thu Nov 19 10:42:06 
2009
@@ -314,7 +314,7 @@
                                </configuration>
                     </execution>
                 </executions>
-            </plugin-->   
+            </plugin -->   
             
             <plugin>    
                 <groupId>org.apache.felix</groupId>
@@ -322,7 +322,8 @@
                 <extensions>true</extensions>
                        <configuration>
                          <instructions>
-                           
<Export-Package>org.apache.tuscany.sca.node</Export-Package>
+                           
<Export-Package>org.apache.tuscany.sca.node;version=1.6</Export-Package>
+                           
<Import-Package>!com.*,!javax.*,!net.*,!org.*,!nu.*,!oracle.*,!sun.*,*</Import-Package>
                            
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                            
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                            <Embed-Transitive>true</Embed-Transitive>
@@ -330,46 +331,6 @@
                          </instructions>
                        </configuration>
            </plugin> 
-            
-            <!-- plugin>    
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <executions>
-                                   <execution>
-                                       <id>build-1x-bundle</id>
-                                       <phase>process-classes</phase>
-                                       <goals>
-                                         <goal>bundle</goal>
-                                       </goals>
-                                       <configuration>
-                                         <instructions>
-                                           
<Export-Package>org.apache.tuscany.sca.node</Export-Package>
-                                           
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
-                                           
<Bundle-ClassPath>.,${maven-dependencies}</Bundle-ClassPath>
-                                         </instructions>
-                                       </configuration>
-                                   </execution>
-                           </executions>   
-           </plugin--> 
-
-            <!-- plugin>
-                <artifactId>maven-dependency-plugin</artifactId>
-                <configuration>
-                    
<cpFile>${project.build.directory}/classes/org/apache/tuscany/sca/installer/.classpath</cpFile>
-                    <includeScope>runtime</includeScope>
-                </configuration>
-                 <executions>
-                     <execution>
-                         <id>build-classpath</id>
-                         <phase>compile</phase>
-                         <goals>
-                             <goal>build-classpath</goal>
-                         </goals>
-                     </execution>
-                 </executions>
-            </plugin -->
-
 
             <!-- plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Modified: tuscany/sandbox/slaws/runtimecompat/1xlauncher/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/runtimecompat/1xlauncher/pom.xml?rev=882097&r1=882096&r2=882097&view=diff
==============================================================================
--- tuscany/sandbox/slaws/runtimecompat/1xlauncher/pom.xml (original)
+++ tuscany/sandbox/slaws/runtimecompat/1xlauncher/pom.xml Thu Nov 19 10:42:06 
2009
@@ -26,6 +26,7 @@
     </parent><version>1.0-SNAPSHOT</version>
     <artifactId>1x-launcher</artifactId>
     <name>Apache Tuscany SCA 1.x Launcher</name>
+    <packaging>bundle</packaging> 
 
     <dependencies>
         <dependency>
@@ -58,5 +59,21 @@
     
     <build>
        <finalName>${artifactId}</finalName>
+        <plugins> 
+            
+            <plugin>    
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                       <configuration>
+                         <instructions>
+                           
<Import-Package>org.apache.tuscany.sca.node;version="[1.6.0,1.6.0]"</Import-Package>
+                           <Export-Package>launcher</Export-Package>
+                           
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                         </instructions>
+                       </configuration>
+           </plugin> 
+
+        </plugins>       
     </build>
 </project>

Modified: 
tuscany/sandbox/slaws/runtimecompat/1xlauncher/src/main/java/launcher/OneXLauncher.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/runtimecompat/1xlauncher/src/main/java/launcher/OneXLauncher.java?rev=882097&r1=882096&r2=882097&view=diff
==============================================================================
--- 
tuscany/sandbox/slaws/runtimecompat/1xlauncher/src/main/java/launcher/OneXLauncher.java
 (original)
+++ 
tuscany/sandbox/slaws/runtimecompat/1xlauncher/src/main/java/launcher/OneXLauncher.java
 Thu Nov 19 10:42:06 2009
@@ -26,8 +26,12 @@
 public class OneXLauncher {
 
     public static void main(String[] args) throws Exception {
+       OneXLauncher.launchNode();
+    }
+    
+    public static void launchNode(){
         SCANode node = 
SCANodeFactory.newInstance().createSCANode("Calculator.composite", 
-            new SCAContribution("calculator", "../1xcalculator.jar"));
+                new SCAContribution("calculator", "../1xcalculator.jar"));
 
         node.start();
         

Modified: 
tuscany/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java?rev=882097&r1=882096&r2=882097&view=diff
==============================================================================
--- 
tuscany/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java
 (original)
+++ 
tuscany/sandbox/slaws/runtimecompat/combinedlauncher/src/main/java/launcher/CombinedLauncher.java
 Thu Nov 19 10:42:06 2009
@@ -39,6 +39,8 @@
        
        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 @@
        // 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 @@
         
         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();
     }
     


Reply via email to