Updated the order of imports in the source files of simulator plugins.
[platform/upstream/iotivity.git] / service / simulator / java / eclipse-plugin / ServiceProviderPlugin / src / oic / simulator / serviceprovider / Activator.java
1 /*
2  * Copyright 2015 Samsung Electronics All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package oic.simulator.serviceprovider;
18
19 import org.eclipse.ui.plugin.AbstractUIPlugin;
20 import org.osgi.framework.BundleContext;
21
22 import oic.simulator.serviceprovider.manager.ImageManager;
23 import oic.simulator.serviceprovider.manager.LogManager;
24 import oic.simulator.serviceprovider.manager.ResourceManager;
25
26 /**
27  * The activator class controls the plug-in life cycle.
28  */
29 public class Activator extends AbstractUIPlugin {
30
31     // The plug-in ID
32     public static final String     PLUGIN_ID = "ServiceProviderPlugin";
33
34     // The shared instance
35     private static Activator       plugin;
36
37     private static ResourceManager resourceManager;
38
39     private static LogManager      logManager;
40
41     private static ImageManager    imageManager;
42
43     static {
44         System.loadLibrary("SimulatorManager");
45     }
46
47     public Activator() {
48     }
49
50     public void start(BundleContext context) throws Exception {
51         super.start(context);
52         plugin = this;
53         setLogManager(new LogManager());
54         setResourceManager(new ResourceManager());
55         imageManager = ImageManager.getInstance();
56     }
57
58     public void stop(BundleContext context) throws Exception {
59         plugin = null;
60
61         // Stopping Resource Manager
62         if (null != resourceManager) {
63             resourceManager.shutdown();
64             resourceManager = null;
65         }
66         // Stopping Log Manager
67         if (null != logManager) {
68             logManager.shutdown();
69             logManager = null;
70         }
71         super.stop(context);
72     }
73
74     public static Activator getDefault() {
75         return plugin;
76     }
77
78     public ResourceManager getResourceManager() {
79         return resourceManager;
80     }
81
82     private static void setResourceManager(ResourceManager manager) {
83         Activator.resourceManager = manager;
84     }
85
86     public LogManager getLogManager() {
87         return logManager;
88     }
89
90     private static void setLogManager(LogManager logManager) {
91         Activator.logManager = logManager;
92     }
93
94     public ImageManager getImageManager() {
95         return imageManager;
96     }
97 }