1
2
3
4
5 package gboat2.serviceflow;
6
7 import org.drools.util.ServiceRegistry;
8 import org.osgi.framework.Bundle;
9 import org.osgi.framework.BundleActivator;
10 import org.osgi.framework.BundleContext;
11 import org.osgi.framework.ServiceReference;
12 import org.osgi.util.tracker.ServiceTracker;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16
17
18
19
20
21
22
23
24 public class Activator implements BundleActivator {
25
26 private Logger logger = LoggerFactory.getLogger(Activator.class);
27 private ServiceTracker tracker;
28 public static Bundle LOCAL_BUNDLE;
29
30
31
32
33
34
35
36
37
38
39 public void start(BundleContext bundleContext) {
40 LOCAL_BUNDLE = bundleContext.getBundle();
41 logger.debug("starting gboat2.serviceflow ......");
42
43 tracker = new ServiceTracker(bundleContext,ServiceRegistry.class.getName(),null){
44 public Object addingService(ServiceReference reference){
45 ServiceRegistry registry = (ServiceRegistry)context.getService(reference);
46 JBPMHelper.setServiceRegistry(registry);
47 return super.addingService(reference);
48 }
49 };
50 tracker.open();
51
52 }
53
54
55
56
57
58
59 public void stop(BundleContext context) {
60 tracker.close();
61 }
62
63 }