You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2008/09/05 04:31:14 UTC

svn commit: r692321 - in /tuscany/java/sca/modules/node-launcher-equinox/src: main/java/org/apache/tuscany/sca/node/equinox/launcher/ test/java/org/apache/tuscany/sca/node/equinox/launcher/

Author: jsdelfino
Date: Thu Sep  4 19:31:13 2008
New Revision: 692321

URL: http://svn.apache.org/viewvc?rev=692321&view=rev
Log:
Simplified a bit the access to EquinoxOSGiHost.

Modified:
    tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java
    tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java
    tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java
    tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java
    tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java
    tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java?rev=692321&r1=692320&r2=692321&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/DomainManagerLauncher.java Thu Sep  4 19:31:13 2008
@@ -20,8 +20,6 @@
 package org.apache.tuscany.sca.node.equinox.launcher;
 
 import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.domainManager;
-import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.startOSGi;
-import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.stopOSGi;
 
 import java.io.IOException;
 import java.util.logging.Level;
@@ -79,13 +77,14 @@
         // Create a launcher
         DomainManagerLauncher launcher = newInstance();
         
-        OSGiHost osgiHost = null;
+        EquinoxOSGiHost equinox = null;
         Object domainManager = null;
         ShutdownThread shutdown = null;
         try {
 
             // Start the OSGi host 
-            osgiHost = startOSGi();
+            equinox = new EquinoxOSGiHost();
+            equinox.start();
 
             // Start the domain manager
             domainManager = launcher.createDomainManager();
@@ -98,7 +97,7 @@
             logger.info("SCA Domain Manager is now started.");
 
             // Install a shutdown hook
-            ShutdownThread hook = new ShutdownThread(domainManager, osgiHost);
+            ShutdownThread hook = new ShutdownThread(domainManager, equinox);
             Runtime.getRuntime().addShutdownHook(hook);
 
             logger.info("Press enter to shutdown.");
@@ -124,8 +123,8 @@
             if (domainManager != null) {
                 stopDomainManager(domainManager);
             }
-            if (osgiHost != null) {
-                stopOSGi(osgiHost);
+            if (equinox != null) {
+                equinox.stop();
             }
         }
     }
@@ -149,12 +148,12 @@
     
     private static class ShutdownThread extends Thread {
         private Object domainManager;
-        private OSGiHost osgiHost;
+        private EquinoxOSGiHost equinox;
 
-        public ShutdownThread(Object domainManager, OSGiHost osgiHost) {
+        public ShutdownThread(Object domainManager, EquinoxOSGiHost equinox) {
             super();
             this.domainManager = domainManager;
-            this.osgiHost = osgiHost;
+            this.equinox = equinox;
         }
 
         public void run() {
@@ -164,7 +163,7 @@
                 // Ignore
             }
             try {
-                stopOSGi(osgiHost);
+                equinox.stop();
             } catch (Exception e) {
                 // Ignore
             }

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java?rev=692321&r1=692320&r2=692321&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxOSGiHost.java Thu Sep  4 19:31:13 2008
@@ -28,9 +28,9 @@
 import org.osgi.framework.BundleContext;
 
 /**
- * 
+ * Wraps the Equinox runtime.
  */
-public class EquinoxOSGiHost implements OSGiHost {
+public class EquinoxOSGiHost {
     private LauncherBundleActivator activator = new LauncherBundleActivator();
     private BundleContext context;
     

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java?rev=692321&r1=692320&r2=692321&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeDaemonLauncher.java Thu Sep  4 19:31:13 2008
@@ -20,8 +20,6 @@
 package org.apache.tuscany.sca.node.equinox.launcher;
 
 import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.nodeDaemon;
-import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.startOSGi;
-import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.stopOSGi;
 
 import java.io.IOException;
 import java.util.logging.Level;
@@ -68,13 +66,14 @@
         // Create a node launcher
         NodeDaemonLauncher launcher = newInstance();
 
-        OSGiHost osgiHost = null;
+        EquinoxOSGiHost equinox = null;
         Object node = null;
         ShutdownThread shutdown = null;
         try {
 
             // Start the OSGi host 
-            osgiHost = startOSGi();
+            equinox = new EquinoxOSGiHost();
+            equinox.start();
 
             // Start the node
             node = launcher.createNodeDaemon();
@@ -87,7 +86,7 @@
             logger.info("SCA Node Daemon is now started.");
             
             // Install a shutdown hook
-            shutdown = new ShutdownThread(node, osgiHost);
+            shutdown = new ShutdownThread(node, equinox);
             Runtime.getRuntime().addShutdownHook(shutdown);
             
             logger.info("Press enter to shutdown.");
@@ -112,8 +111,8 @@
             if (node != null) {
                 stopNode(node);
             }
-            if (osgiHost != null) {
-                stopOSGi(osgiHost);
+            if (equinox != null) {
+                equinox.stop();
             }
         }
     }
@@ -136,12 +135,12 @@
     
     private static class ShutdownThread extends Thread {
         private Object node;
-        private OSGiHost osgiHost;
+        private EquinoxOSGiHost equinox;
 
-        public ShutdownThread(Object node, OSGiHost osgiHost) {
+        public ShutdownThread(Object node, EquinoxOSGiHost equinox) {
             super();
             this.node = node;
-            this.osgiHost = osgiHost;
+            this.equinox = equinox;
         }
 
         public void run() {
@@ -151,7 +150,7 @@
                 // Ignore
             }
             try {
-                stopOSGi(osgiHost);
+                equinox.stop();
             } catch (Exception e) {
                 // Ignore
             }

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java?rev=692321&r1=692320&r2=692321&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncher.java Thu Sep  4 19:31:13 2008
@@ -20,8 +20,6 @@
 package org.apache.tuscany.sca.node.equinox.launcher;
 
 import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.node;
-import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.startOSGi;
-import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.stopOSGi;
 
 import java.io.IOException;
 import java.util.logging.Level;
@@ -117,13 +115,14 @@
         // Create a node launcher
         NodeLauncher launcher = newInstance();
 
-        OSGiHost osgiHost = null;
+        EquinoxOSGiHost equinox = null;
         Object node = null;
         ShutdownThread shutdown = null;
         try {
 
             // Start the OSGi host 
-            osgiHost = startOSGi();
+            equinox = new EquinoxOSGiHost();
+            equinox.start();
 
             if (args.length ==1) {
                 
@@ -151,7 +150,7 @@
             logger.info("SCA Node is now started.");
             
             // Install a shutdown hook
-            shutdown = new ShutdownThread(node, osgiHost);
+            shutdown = new ShutdownThread(node, equinox);
             Runtime.getRuntime().addShutdownHook(shutdown);
             
             logger.info("Press enter to shutdown.");
@@ -176,8 +175,8 @@
             if (node != null) {
                 stopNode(node);
             }
-            if (osgiHost != null) {
-                stopOSGi(osgiHost);
+            if (equinox != null) {
+                equinox.stop();
             }
         }
     }
@@ -200,12 +199,12 @@
     
     private static class ShutdownThread extends Thread {
         private Object node;
-        private OSGiHost osgiHost;
+        private EquinoxOSGiHost equinox;
 
-        public ShutdownThread(Object node, OSGiHost osgiHost) {
+        public ShutdownThread(Object node, EquinoxOSGiHost equinox) {
             super();
             this.node = node;
-            this.osgiHost = osgiHost;
+            this.equinox = equinox;
         }
 
         public void run() {
@@ -215,7 +214,7 @@
                 // Ignore
             }
             try {
-                stopOSGi(osgiHost);
+                equinox.stop();
             } catch (Exception e) {
                 // Ignore
             }

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java?rev=692321&r1=692320&r2=692321&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java Thu Sep  4 19:31:13 2008
@@ -172,14 +172,4 @@
         }
     }
 
-    static OSGiHost startOSGi() {
-        OSGiHost host = new EquinoxOSGiHost();
-        host.start();
-        return host;
-    }
-
-    static void stopOSGi(OSGiHost host) {
-        host.stop();
-    }
-
 }

Modified: tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java?rev=692321&r1=692320&r2=692321&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java (original)
+++ tuscany/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java Thu Sep  4 19:31:13 2008
@@ -32,18 +32,19 @@
  * 
  */
 public class NodeLauncherTestCase {
-    private static OSGiHost host;
+    private static EquinoxOSGiHost equinox;
 
     @BeforeClass
     public static void setUp() {
         // System.setProperty("TUSCANY_HOME", "target/tuscany");
-        host = NodeLauncherUtil.startOSGi();
+        equinox = new EquinoxOSGiHost();
+        equinox.start();
     }
 
     @AfterClass
     public static void tearDown() {
-        if (host != null) {
-            NodeLauncherUtil.stopOSGi(host);
+        if (equinox != null) {
+            equinox.stop();
         }
 
     }