summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Liebig2008-02-27 10:04:06 (EST)
committerStefan Liebig2008-02-27 10:04:06 (EST)
commit0b815a680d6f5a62029232113318e7a5a219f9c4 (patch)
tree9d1a9ad2739870b1661bc8d4b16e9cbddbedfbf8
parent4654eca34160f4d39992e09b6b5dd006a33ed918 (diff)
downloadorg.eclipse.riena.old-0b815a680d6f5a62029232113318e7a5a219f9c4.zip
org.eclipse.riena.old-0b815a680d6f5a62029232113318e7a5a219f9c4.tar.gz
org.eclipse.riena.old-0b815a680d6f5a62029232113318e7a5a219f9c4.tar.bz2
based on abstract activator
-rw-r--r--org.eclipse.riena.communication.discovery/src/org/eclipse/riena/internal/communication/discovery/Activator.java46
-rw-r--r--org.eclipse.riena.communication.registry/src/org/eclipse/riena/internal/communication/registry/Activator.java27
2 files changed, 20 insertions, 53 deletions
diff --git a/org.eclipse.riena.communication.discovery/src/org/eclipse/riena/internal/communication/discovery/Activator.java b/org.eclipse.riena.communication.discovery/src/org/eclipse/riena/internal/communication/discovery/Activator.java
index de5ed8a..0275e39 100644
--- a/org.eclipse.riena.communication.discovery/src/org/eclipse/riena/internal/communication/discovery/Activator.java
+++ b/org.eclipse.riena.communication.discovery/src/org/eclipse/riena/internal/communication/discovery/Activator.java
@@ -15,26 +15,30 @@ import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
import org.eclipse.riena.communication.core.factory.IRemoteServiceFactory;
import org.eclipse.riena.communication.core.factory.RemoteServiceFactory;
import org.eclipse.riena.communication.core.publisher.IServicePublishEventDispatcher;
+import org.eclipse.riena.core.RienaActivator;
import org.eclipse.riena.core.service.Injector;
import org.eclipse.riena.core.service.ServiceId;
-import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
-public class Activator implements BundleActivator {
+public class Activator extends RienaActivator {
private RemoteServiceDiscovery discovery;
private Injector registryInjector;
private String HOST_ID = Activator.class.getName();
private IRemoteServiceRegistration servicePublisherReg;
+ private static Activator plugin;
+
/*
* (non-Javadoc)
*
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
RemoteServiceFactory factory = new RemoteServiceFactory();
discovery = new RemoteServiceDiscovery(context);
@@ -43,34 +47,6 @@ public class Activator implements BundleActivator {
registryInjector = new ServiceId(IRemoteServiceRegistry.ID).injectInto(discovery).andStart(context);
discovery.start();
- // Thread t = new Thread() {
- // public void run() {
- // boolean firstRun = true;
- // agent.start();
- // System.out.println("thread start");
- // while (true) {
- // try {
- // if (firstRun) {
- // Thread.sleep(1000);
- // } else {
- // Thread.sleep(10000);
- // }
- // firstRun = false;
- // } catch (InterruptedException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- // if (agent != null) {
- // agent.update();
- // } else {
- // break;
- // }
- // }
- // System.out.println("thread end");
- // }
- // };
- // t.start();
-
servicePublisherReg = factory.createAndRegisterProxy(IServicePublishEventDispatcher.class,
"http://${hostname}/hessian/ServicePublisherWS", "hessian", null, HOST_ID);
@@ -96,6 +72,9 @@ public class Activator implements BundleActivator {
discovery = null;
registryInjector = null;
servicePublisherReg = null;
+ plugin = null;
+
+ super.stop(context);
}
class ProtocolNotifier implements ServiceListener {
@@ -107,4 +86,11 @@ public class Activator implements BundleActivator {
}
}
+
+ /**
+ * @return
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
}
diff --git a/org.eclipse.riena.communication.registry/src/org/eclipse/riena/internal/communication/registry/Activator.java b/org.eclipse.riena.communication.registry/src/org/eclipse/riena/internal/communication/registry/Activator.java
index 009056c..51956e7 100644
--- a/org.eclipse.riena.communication.registry/src/org/eclipse/riena/internal/communication/registry/Activator.java
+++ b/org.eclipse.riena.communication.registry/src/org/eclipse/riena/internal/communication/registry/Activator.java
@@ -12,9 +12,8 @@ package org.eclipse.riena.internal.communication.registry;
import java.util.Hashtable;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.communication.core.IRemoteServiceRegistry;
+import org.eclipse.riena.core.RienaPlugin;
import org.eclipse.riena.core.logging.LogUtil;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
@@ -24,27 +23,20 @@ import org.osgi.framework.ServiceRegistration;
* @author Christian Campo
*
*/
-public class Activator extends Plugin {
+public class Activator extends RienaPlugin {
- private static BundleContext CONTEXT;
private static Activator plugin;
private RemoteServiceRegistry serviceRegistry;
private ServiceRegistration regServiceRegistry;
private LogUtil logUtil;
- /**
- * The constructor
- */
- public Activator() {
- }
-
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
- CONTEXT = context;
+ super.start(context);
plugin = this;
serviceRegistry = new RemoteServiceRegistry();
serviceRegistry.start();
@@ -64,23 +56,12 @@ public class Activator extends Plugin {
serviceRegistry.stop();
serviceRegistry = null;
- CONTEXT = null;
plugin = null;
- }
-
- public static BundleContext getContext() {
- return CONTEXT;
+ super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
- public synchronized Logger getLogger(String name) {
- if (logUtil == null) {
- logUtil = new LogUtil(CONTEXT);
- }
- return logUtil.getLogger(name);
- }
-
}