]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AutoUiActivator.java
Introduce detached execution server.
[gpl/argeo-slc.git] / org.argeo.slc.autoui / src / main / java / org / argeo / slc / autoui / AutoUiActivator.java
index cc78b2911440ef35f0d76688a377a61179ad9186..b95d6b4b9d747826306fc84fe0fc7911c792b7fb 100644 (file)
@@ -1,19 +1,32 @@
 package org.argeo.slc.autoui;
 
-import org.osgi.framework.BundleActivator;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.autoui.internal.DetachedExecutionServerImpl;
 import org.osgi.framework.BundleContext;
 
-public class AutoUiActivator implements BundleActivator {
+public class AutoUiActivator extends AbstractDetachedActivator {
+       private final Log log = LogFactory.getLog(getClass());
 
-       public void start(BundleContext context) throws Exception {
-               stdOut("AutoUi started");
-       }
+       private DetachedExecutionServerImpl executionServer;
+
+       public void startAutoBundle(BundleContext context) throws Exception {
+               Object obj = getStaticRefProvider().getStaticRef("executionServer");
+               if (obj != null)
+                       executionServer = (DetachedExecutionServerImpl) obj;
+               else
+                       throw new DetachedException("Could not find execution server.");
+
+               executionServer.setBundleContext(context);
 
-       public void stop(BundleContext context) throws Exception {
-               stdOut("AutoUi stopped");
+               context.registerService(DetachedExecutionServer.class.getName(),
+                               executionServer, new Properties());
+               log.info("AutoUi started");
        }
 
-       public static void stdOut(Object obj) {
-               System.out.println(obj);
+       public void stopAutoBundle(BundleContext context) throws Exception {
+               log.info("AutoUi stopped");
        }
 }