078ad43bc2b33ba215d9724ce8c917ae73422b44
[platform/upstream/iotivity.git] / service / resource-manipulation / src / resourceContainer / include / BundleInfoInternal.h
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 #ifndef BUNDLEINFOINTERNAL_H_
22 #define BUNDLEINFOINTERNAL_H_
23
24 #include <string>
25 #include "BundleInfo.h"
26 #include "ResourceContainerBundleAPI.h"
27 #include "jni.h"
28
29 using namespace std;
30 using namespace OIC::Service;
31
32 namespace OIC
33 {
34     namespace Service
35     {
36         typedef void activator_t(ResourceContainerBundleAPI *, std::string bundleId);
37         typedef void deactivator_t(void);
38         typedef void resourceCreator_t(resourceInfo resourceInfo);
39         typedef void resourceDestroyer_t(BundleResource *pBundleResource);
40
41         class BundleInfoInternal: public BundleInfo
42         {
43             public:
44                 BundleInfoInternal();
45                 BundleInfoInternal(BundleInfo *info);
46                 virtual ~BundleInfoInternal();
47                 void setID(string id);
48                 string getID();
49                 void setPath(string path);
50                 string getPath();
51                 void setVersion(string version);
52                 string getVersion();
53
54                 void setLoaded(bool loaded);
55                 bool isLoaded();
56                 void setActivated(bool activated);
57                 bool isActivated();
58
59                 virtual void setLibraryPath(string libpath);
60                 virtual string getLibraryPath();
61
62                 void setActivatorName(string activatorName);
63                 string getActivatorName();
64
65                 void setJavaBundleActivatorMethod(jmethodID activator);
66                 jmethodID getJavaBundleActivatorMethod();
67                 void setJavaBundleDeactivatorMethod(jmethodID deactivator);
68                 jmethodID getJavaBundleDeactivatorMethod();
69
70                 void setJavaBundleActivatorObject(jobject);
71                 jobject getJavaBundleActivatorObject();
72
73                 void setBundleActivator(activator_t *);
74                 activator_t *getBundleActivator();
75
76                 void setBundleDeactivator(deactivator_t *);
77                 deactivator_t *getBundleDeactivator();
78
79                 void setResourceCreator(resourceCreator_t *);
80                 resourceCreator_t *getResourceCreator();
81
82                 void setResourceDestroyer(resourceDestroyer_t *);
83                 resourceDestroyer_t *getResourceDestroyer();
84
85                 void setBundleHandle(void *);
86                 void *getBundleHandle();
87
88                 void setJavaBundle(bool javaBundle);
89                 bool getJavaBundle();
90
91                 void setBundleInfo(BundleInfo *bundleInfo);
92
93             private:
94                 bool m_loaded, m_activated, m_java_bundle;
95                 int m_id;
96                 activator_t *m_activator;
97                 deactivator_t *m_deactivator;
98                 resourceCreator_t *m_resourceCreator;
99                 resourceDestroyer_t *m_resourceDestroyer;
100                 void *m_bundleHandle;
101                 string m_activator_name;
102                 jmethodID m_java_activator, m_java_deactivator;
103                 jobject m_java_activator_object;
104                 string m_library_path;
105         };
106     }
107 }
108
109 #endif /* BUNDLEINFOINTERNAL_H_ */