Eclipse plug-in for service provider.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / Activator.java
1 package oic.simulator.serviceprovider;
2
3 import oic.simulator.serviceprovider.manager.LogManager;
4 import oic.simulator.serviceprovider.manager.ResourceManager;
5
6 import org.eclipse.ui.plugin.AbstractUIPlugin;
7 import org.osgi.framework.BundleContext;
8
9 /**
10  * The activator class controls the plug-in life cycle
11  */
12 public class Activator extends AbstractUIPlugin {
13
14     // The plug-in ID
15     public static final String     PLUGIN_ID = "ServiceProviderPlugin"; //$NON-NLS-1$
16
17     // The shared instance
18     private static Activator       plugin;
19
20     private static ResourceManager resourceManager;
21
22     private static LogManager      logManager;
23
24     public Activator() {
25     }
26
27     public void start(BundleContext context) throws Exception {
28         super.start(context);
29         plugin = this;
30         setResourceManager(new ResourceManager());
31         setLogManager(new LogManager());
32     }
33
34     public void stop(BundleContext context) throws Exception {
35         plugin = null;
36
37         // Stopping Resource Manager
38         if (null != resourceManager) {
39             resourceManager.shutdown();
40             resourceManager = null;
41         }
42         // Stopping Log Manager
43         if (null != logManager) {
44             logManager.shutdown();
45             logManager = null;
46         }
47         super.stop(context);
48     }
49
50     public static Activator getDefault() {
51         return plugin;
52     }
53
54     public ResourceManager getResourceManager() {
55         return resourceManager;
56     }
57
58     private static void setResourceManager(ResourceManager manager) {
59         Activator.resourceManager = manager;
60     }
61
62     public LogManager getLogManager() {
63         return logManager;
64     }
65
66     private static void setLogManager(LogManager logManager) {
67         Activator.logManager = logManager;
68     }
69 }