View Javadoc
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  	// avoid dependency to RWT OSGi
11  	private final static String CONTEXT_NAME_PROP = "contextName";
12  
13  	private static ServiceTracker<NodeState, NodeState> nodeState;
14  
15  	// @Override
16  	public void start(BundleContext bc) throws Exception {
17  		// UI
18  //		bc.registerService(ApplicationConfiguration.class, new MaintenanceUi(),
19  //				LangUtils.dico(CONTEXT_NAME_PROP, "system"));
20  //		bc.registerService(ApplicationConfiguration.class, new UserUi(), LangUtils.dico(CONTEXT_NAME_PROP, "user"));
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  }