1 package org.argeo.cms.ui.internal;
2
3 import org.argeo.api.NodeState;
4 import org.osgi.framework.BundleActivator;
5 import org.osgi.framework.BundleContext;
6 import org.osgi.util.tracker.ServiceTracker;
7
8 public class Activator implements BundleActivator {
9
10
11 private final static String CONTEXT_NAME_PROP = "contextName";
12
13 private static ServiceTracker<NodeState, NodeState> nodeState;
14
15
16 public void start(BundleContext bc) throws Exception {
17
18
19
20
21
22 nodeState = new ServiceTracker<>(bc, NodeState.class, null);
23 nodeState.open();
24 }
25
26 @Override
27 public void stop(BundleContext context) throws Exception {
28 if (nodeState != null) {
29 nodeState.close();
30 nodeState = null;
31 }
32 }
33
34 public static NodeState getNodeState() {
35 return nodeState.getService();
36 }
37 }