[ANDROID] Remove GroupSynchronization in things manager.
[platform/upstream/iotivity.git] / service / things-manager / sdk / java / jni / jniutil / inc / jni_things_manager_jvm.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 /**
22   * @file
23   * This file contains the essential declarations and functions required
24   * for JNI implementation.
25   */
26
27 #ifndef JNI_THINGS_MANAGER_JVM_H_
28 #define JNI_THINGS_MANAGER_JVM_H_
29
30 #include <jni.h>
31 #include <thread>
32 #include <mutex>
33
34 #define TM_SERVICE_GROUP_MANAGER_CLASS_PATH    "org/iotivity/service/tm/GroupManager"
35 #define TM_SERVICE_GROUP_MANAGER_CLASS_TYPE    "Lorg/iotivity/service/tm/GroupManager;"
36
37 #define TM_SERVICE_THINGS_CONFIGURATION_CLASS_PATH    "org/iotivity/service/tm/ThingsConfiguration"
38 #define TM_SERVICE_THINGS_CONFIGURATION_CLASS_TYPE    "Lorg/iotivity/service/tm/ThingsConfigurationn;"
39
40 #define TM_SERVICE_THINGS_MAINTENANCE_CLASS_PATH    "org/iotivity/service/tm/ThingsMaintenance"
41 #define TM_SERVICE_THINGS_MAINTENANCE_CLASS_TYPE    "Lorg/iotivity/service/tm/ThingsMaintenance;"
42
43 #define TM_SERVICE_PLATFORM_CLASS_PATH    "org/iotivity/base/OcPlatform"
44 #define TM_SERVICE_PLATFORM_CLASS_TYPE    "Lorg/iotivity/base/OcPlatform;"
45
46 #define TM_SERVICE_PLATFORM_CONFIG_CLASS_PATH    "org/iotivity/base/PlatformConfig"
47 #define TM_SERVICE_PLATFORM_CONFIG_CLASS_TYPE    "Lorg/iotivity/base/PlatformConfig;"
48
49 #define TM_SERVICE_CAPABILITY_PATH    "org/iotivity/service/tm/Capability"
50 #define TM_SERVICE_CAPABILITY_TYPE    "Lorg/iotivity/service/tm/Capability;"
51
52 #define TM_SERVICE_ACTION_PATH    "org/iotivity/service/tm/Action"
53 #define TM_SERVICE_ACTION_TYPE    "Lorg/iotivity/service/tm/Action;"
54
55 #define TM_SERVICE_ACTIONSET_PATH    "org/iotivity/service/tm/ActionSet"
56 #define TM_SERVICE_ACTIONSET_TYPE    "Lorg/iotivity/service/tm/ActionSet;"
57
58 #define TM_SERVICE_OCRESOURCE_PATH    "org/iotivity/base/OcResource"
59 #define TM_SERVICE_OCRESOURCE_TYPE    "Lorg/iotivity/base/OcResource;"
60
61 #define TM_SERVICE_HEADER_OPTION_PATH    "org/iotivity/base/OcHeaderOption"
62 #define TM_SERVICE_HEADER_OPTION_TYPE    "Lorg/iotivity/base/OcHeaderOption;"
63
64 #define TM_SERVICE_OCREPRESENTATION_PATH    "org/iotivity/base/OcRepresentation"
65 #define TM_SERVICE_OCREPRESENTATION_TYPE    "Lorg/iotivity/base/OcRepresentation;"
66
67 #define TM_SERVICE_OCRESOURCEHANDLE_PATH    "org/iotivity/base/OcResourceHandle"
68 #define TM_SERVICE_OCRESOURCEHANDLE_TYPE    "Lorg/iotivity/base/OcResourceHandle;"
69
70 #define TM_SERVICE_TIME_PATH    "org/iotivity/service/tm/Time"
71
72 #define TM_JAVA_VECTOR_CLASS_PATH "java/util/Vector"
73 #define TM_JAVA_VECTOR_TYPE "Ljava/util/Vector;"
74
75 #define TM_JAVA_STRING_TYPE "Ljava/lang/String;"
76
77 /**
78  * This class provides functions related to JNI Environment.
79  */
80 class ThingsManagerJVM
81 {
82     public:
83         /**
84          * destructor
85          */
86         ~ThingsManagerJVM() {};
87
88         /**
89          * Get JVM instance
90          */
91         static JNIEnv *getEnv();
92
93         /**
94          * Release aquired JVM instance.
95          */
96         static void releaseEnv();
97
98     public:
99         /**
100          *  Java VM pointer
101          */
102         static JavaVM *m_jvm;
103
104     private:
105         /**
106          * constructor
107          */
108         ThingsManagerJVM();
109
110         /**
111          *  Mutex for thread synchronization.
112          */
113         static std::mutex m_currentThreadMutex;
114 };
115
116 #ifdef __cplusplus
117 extern "C" {
118 #endif
119 jclass GetJClass(const char *szClassPath);
120 jobject GetJObjectInstance(const char *szClassPath);
121 #ifdef __cplusplus
122 }
123 #endif
124 #endif //JNI_THINGS_MANAGER_JVM_H_