1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
23 * This file contains the essential declarations and functions required
24 * for JNI implementation.
27 #ifndef JNI_THINGS_MANAGER_JVM_H_
28 #define JNI_THINGS_MANAGER_JVM_H_
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;"
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;"
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;"
43 #define TM_SERVICE_PLATFORM_CLASS_PATH "org/iotivity/base/OcPlatform"
44 #define TM_SERVICE_PLATFORM_CLASS_TYPE "Lorg/iotivity/base/OcPlatform;"
46 #define TM_SERVICE_PLATFORM_CONFIG_CLASS_PATH "org/iotivity/base/PlatformConfig"
47 #define TM_SERVICE_PLATFORM_CONFIG_CLASS_TYPE "Lorg/iotivity/base/PlatformConfig;"
49 #define TM_SERVICE_CAPABILITY_PATH "org/iotivity/service/tm/Capability"
50 #define TM_SERVICE_CAPABILITY_TYPE "Lorg/iotivity/service/tm/Capability;"
52 #define TM_SERVICE_ACTION_PATH "org/iotivity/service/tm/Action"
53 #define TM_SERVICE_ACTION_TYPE "Lorg/iotivity/service/tm/Action;"
55 #define TM_SERVICE_ACTIONSET_PATH "org/iotivity/service/tm/ActionSet"
56 #define TM_SERVICE_ACTIONSET_TYPE "Lorg/iotivity/service/tm/ActionSet;"
58 #define TM_SERVICE_OCRESOURCE_PATH "org/iotivity/base/OcResource"
59 #define TM_SERVICE_OCRESOURCE_TYPE "Lorg/iotivity/base/OcResource;"
61 #define TM_SERVICE_HEADER_OPTION_PATH "org/iotivity/base/OcHeaderOption"
62 #define TM_SERVICE_HEADER_OPTION_TYPE "Lorg/iotivity/base/OcHeaderOption;"
64 #define TM_SERVICE_OCREPRESENTATION_PATH "org/iotivity/base/OcRepresentation"
65 #define TM_SERVICE_OCREPRESENTATION_TYPE "Lorg/iotivity/base/OcRepresentation;"
67 #define TM_SERVICE_OCRESOURCEHANDLE_PATH "org/iotivity/base/OcResourceHandle"
68 #define TM_SERVICE_OCRESOURCEHANDLE_TYPE "Lorg/iotivity/base/OcResourceHandle;"
70 #define TM_SERVICE_TIME_PATH "org/iotivity/service/tm/Time"
72 #define TM_JAVA_VECTOR_CLASS_PATH "java/util/Vector"
73 #define TM_JAVA_VECTOR_TYPE "Ljava/util/Vector;"
75 #define TM_JAVA_STRING_TYPE "Ljava/lang/String;"
78 * This class provides functions related to JNI Environment.
80 class ThingsManagerJVM
86 ~ThingsManagerJVM() {};
91 static JNIEnv *getEnv();
94 * Release aquired JVM instance.
96 static void releaseEnv();
102 static JavaVM *m_jvm;
111 * Mutex for thread synchronization.
113 static std::mutex m_currentThreadMutex;
119 jclass GetJClass(const char *szClassPath);
120 jobject GetJObjectInstance(const char *szClassPath);
124 #endif //JNI_THINGS_MANAGER_JVM_H_