6adef62f79d9760a65010171a2ce82e3f8be72c0
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceContainer / src / BundleInfoInternal.cpp
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #include "BundleInfoInternal.h"
22
23 namespace OIC
24 {
25     namespace Service
26     {
27
28         BundleInfoInternal::BundleInfoInternal()
29         {
30             m_activator = nullptr;
31             m_deactivator = nullptr;
32             m_resourceCreator = nullptr;
33             m_resourceDestroyer = nullptr;
34             m_bundleHandle = nullptr;
35
36             m_loaded = false;
37             m_activated = false;
38             m_java_bundle = false;
39             m_id = 0;
40         }
41
42         BundleInfoInternal::~BundleInfoInternal()
43         {
44             m_activator = nullptr;
45             m_deactivator = nullptr;
46             m_resourceCreator = nullptr;
47             m_resourceDestroyer = nullptr;
48             m_bundleHandle = nullptr;
49         }
50
51         void BundleInfoInternal::setID(const std::string &id)
52         {
53             m_ID = id;
54         }
55
56         const std::string &BundleInfoInternal::getID()
57         {
58             return m_ID;
59         }
60
61         void BundleInfoInternal::setPath( const std::string &path)
62         {
63             m_path = path;
64         }
65         const std::string &BundleInfoInternal::getPath()
66         {
67             return m_path;
68         }
69
70         void BundleInfoInternal::setVersion( const std::string &version)
71         {
72             m_version = version;
73         }
74
75         const std::string &BundleInfoInternal::getVersion()
76         {
77             return m_version;
78         }
79
80         void BundleInfoInternal::setLoaded(bool loaded)
81         {
82             m_loaded = loaded;
83         }
84
85         bool BundleInfoInternal::isLoaded()
86         {
87             return m_loaded;
88         }
89
90         void BundleInfoInternal::setActivated(bool activated)
91         {
92             m_activated = activated;
93         }
94
95         bool BundleInfoInternal::isActivated()
96         {
97             return m_activated;
98         }
99
100         void BundleInfoInternal::setBundleActivator(activator_t *activator)
101         {
102             m_activator = activator;
103         }
104
105         activator_t *BundleInfoInternal::getBundleActivator()
106         {
107             return m_activator;
108         }
109
110         void BundleInfoInternal::setBundleDeactivator(deactivator_t *deactivator)
111         {
112             m_deactivator = deactivator;
113         }
114
115         deactivator_t *BundleInfoInternal::getBundleDeactivator()
116         {
117             return m_deactivator;
118         }
119
120         void BundleInfoInternal::setResourceCreator(resourceCreator_t *resourceCreator)
121         {
122             m_resourceCreator = resourceCreator;
123         }
124
125         resourceCreator_t *BundleInfoInternal::getResourceCreator()
126         {
127             return m_resourceCreator;
128         }
129
130         void BundleInfoInternal::setResourceDestroyer(resourceDestroyer_t *resourceDestroyer)
131         {
132             m_resourceDestroyer = resourceDestroyer;
133         }
134
135         resourceDestroyer_t *BundleInfoInternal::getResourceDestroyer()
136         {
137             return m_resourceDestroyer;
138         }
139
140         void BundleInfoInternal::setBundleHandle(void *handle)
141         {
142             m_bundleHandle = handle;
143         }
144
145         void *BundleInfoInternal::getBundleHandle()
146         {
147             return m_bundleHandle;
148         }
149
150         void BundleInfoInternal::setJavaBundle(bool javaBundle)
151         {
152             m_java_bundle = javaBundle;
153         }
154
155         bool BundleInfoInternal::getJavaBundle()
156         {
157             return m_java_bundle;
158         }
159
160         void BundleInfoInternal::setActivatorName( const std::string &activatorName)
161         {
162             m_activator_name = activatorName;
163         }
164
165         const std::string &BundleInfoInternal::getActivatorName()
166         {
167             return m_activator_name;
168         }
169
170         void BundleInfoInternal::setLibraryPath( const std::string &libpath)
171         {
172             m_library_path = libpath;
173         }
174
175         const std::string &BundleInfoInternal::getLibraryPath()
176         {
177             return m_library_path;
178         }
179
180 #if (JAVA_SUPPORT)
181         void BundleInfoInternal::setJavaBundleActivatorMethod(jmethodID javaBundleActivator)
182         {
183             m_java_activator = javaBundleActivator;
184         }
185
186         jmethodID BundleInfoInternal::getJavaBundleActivatorMethod()
187         {
188             return m_java_activator;
189         }
190
191         void BundleInfoInternal::setJavaBundleDeactivatorMethod(jmethodID javaBundleActivator)
192         {
193             m_java_deactivator = javaBundleActivator;
194         }
195
196         jmethodID BundleInfoInternal::getJavaBundleDeactivatorMethod()
197         {
198             return m_java_deactivator;
199         }
200
201         void BundleInfoInternal::setJavaBundleActivatorObject(jobject activator_object)
202         {
203             m_java_activator_object = activator_object;
204         }
205
206         jobject BundleInfoInternal::getJavaBundleActivatorObject()
207         {
208             return m_java_activator_object;
209         }
210 #endif
211
212         void BundleInfoInternal::setBundleInfo(RCSBundleInfo *bundleInfo)
213         {
214             BundleInfoInternal *source = (BundleInfoInternal *)bundleInfo;
215             m_ID = source->getID();
216             m_path = source->getPath();
217             m_version = source->getVersion();
218             m_loaded = source->isLoaded();
219             m_activated = source->isActivated();
220             m_java_bundle = source->getJavaBundle();
221             m_activator = source->getBundleActivator();
222             m_bundleHandle = source->getBundleHandle();
223         }
224     }
225 }