2 * //******************************************************************
4 * // Copyright 2015 Intel Corporation.
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * // Licensed under the Apache License, Version 2.0 (the "License");
9 * // you may not use this file except in compliance with the License.
10 * // You may obtain a copy of the License at
12 * // http://www.apache.org/licenses/LICENSE-2.0
14 * // Unless required by applicable law or agreed to in writing, software
15 * // distributed under the License is distributed on an "AS IS" BASIS,
16 * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * // See the License for the specific language governing permissions and
18 * // limitations under the License.
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 #include "JniOcStack.h"
24 #include "OCPlatform.h"
25 #include "OCRepresentation.h"
28 JavaVM* g_jvm = nullptr;
30 jclass g_cls_Integer = nullptr;
31 jclass g_cls_int1DArray = nullptr;
32 jclass g_cls_int2DArray = nullptr;
33 jclass g_cls_Double = nullptr;
34 jclass g_cls_double1DArray = nullptr;
35 jclass g_cls_double2DArray = nullptr;
36 jclass g_cls_Boolean = nullptr;
37 jclass g_cls_boolean1DArray = nullptr;
38 jclass g_cls_boolean2DArray = nullptr;
39 jclass g_cls_String = nullptr;
40 jclass g_cls_String1DArray = nullptr;
41 jclass g_cls_String2DArray = nullptr;
42 jclass g_cls_LinkedList = nullptr;
43 jclass g_cls_Map = nullptr;
44 jclass g_cls_MapEntry = nullptr;
45 jclass g_cls_Set = nullptr;
46 jclass g_cls_Iterator = nullptr;
47 jclass g_cls_HashMap = nullptr;
48 jclass g_cls_OcException = nullptr;
49 jclass g_cls_OcResource = nullptr;
50 jclass g_cls_OcRepresentation = nullptr;
51 jclass g_cls_OcRepresentation1DArray = nullptr;
52 jclass g_cls_OcRepresentation2DArray = nullptr;
53 jclass g_cls_OcResourceRequest = nullptr;
54 jclass g_cls_OcResourceResponse = nullptr;
55 jclass g_cls_OcResourceHandle = nullptr;
56 jclass g_cls_OcPresenceHandle = nullptr;
57 jclass g_cls_OcRequestHandle = nullptr;
58 jclass g_cls_OcPresenceStatus = nullptr;
59 jclass g_cls_OcHeaderOption = nullptr;
60 jclass g_cls_ObservationInfo = nullptr;
61 jclass g_cls_OcResourceIdentifier = nullptr;
62 jclass g_cls_OcProvisionResult = nullptr;
63 jclass g_cls_OcSecureResource = nullptr;
64 jclass g_cls_OcOicSecAcl = nullptr;
66 jmethodID g_mid_Integer_ctor = nullptr;
67 jmethodID g_mid_Double_ctor = nullptr;
68 jmethodID g_mid_Boolean_ctor = nullptr;
69 jmethodID g_mid_LinkedList_ctor = nullptr;
70 jmethodID g_mid_LinkedList_add_object = nullptr;
71 jmethodID g_mid_Map_entrySet = nullptr;
72 jmethodID g_mid_MapEntry_getKey = nullptr;
73 jmethodID g_mid_MapEntry_getValue = nullptr;
74 jmethodID g_mid_Set_iterator = nullptr;
75 jmethodID g_mid_Iterator_hasNext = nullptr;
76 jmethodID g_mid_Iterator_next = nullptr;
77 jmethodID g_mid_HashMap_ctor = nullptr;
78 jmethodID g_mid_HashMap_put = nullptr;
79 jmethodID g_mid_OcException_ctor = nullptr;
80 jmethodID g_mid_OcException_setNativeExceptionLocation = nullptr;
81 jmethodID g_mid_OcResource_ctor = nullptr;
82 jmethodID g_mid_OcRepresentation_N_ctor = nullptr;
83 jmethodID g_mid_OcRepresentation_N_ctor_bool = nullptr;
84 jmethodID g_mid_OcResourceRequest_N_ctor = nullptr;
85 jmethodID g_mid_OcResourceResponse_N_ctor = nullptr;
86 jmethodID g_mid_OcResourceHandle_N_ctor = nullptr;
87 jmethodID g_mid_OcPresenceHandle_N_ctor = nullptr;
88 jmethodID g_mid_OcRequestHandle_N_ctor = nullptr;
89 jmethodID g_mid_OcHeaderOption_ctor = nullptr;
90 jmethodID g_mid_OcHeaderOption_get_id = nullptr;
91 jmethodID g_mid_OcHeaderOption_get_data = nullptr;
92 jmethodID g_mid_ObservationInfo_N_ctor = nullptr;
93 jmethodID g_mid_OcPresenceStatus_get = nullptr;
94 jmethodID g_mid_OcResourceIdentifier_N_ctor = nullptr;
95 jmethodID g_mid_OcProvisionResult_ctor = nullptr;
96 jmethodID g_mid_OcSecureResource_ctor = nullptr;
98 jmethodID g_mid_OcOicSecAcl_get_subject = nullptr;
99 jmethodID g_mid_OcOicSecAcl_get_resources_cnt = nullptr;
100 jmethodID g_mid_OcOicSecAcl_get_resources = nullptr;
101 jmethodID g_mid_OcOicSecAcl_get_permission = nullptr;
102 jmethodID g_mid_OcOicSecAcl_get_periods_cnt = nullptr;
103 jmethodID g_mid_OcOicSecAcl_get_periods = nullptr;
104 jmethodID g_mid_OcOicSecAcl_get_recurrences = nullptr;
105 jmethodID g_mid_OcOicSecAcl_get_owners_cnt = nullptr;
106 jmethodID g_mid_OcOicSecAcl_get_owners = nullptr;
108 jobject getOcException(JNIEnv* env, const char* file, const char* functionName,
109 const int line, const int code, const char* message)
111 std::string codeStr = JniUtils::stackResultToStr(code);
114 codeStr = JniUtils::stackResultToStr(JNI_INVALID_VALUE);
116 jobject ex = env->NewObject(g_cls_OcException,
117 g_mid_OcException_ctor,
118 env->NewStringUTF(codeStr.c_str()),
119 env->NewStringUTF(message));
124 env->CallVoidMethod(ex,
125 g_mid_OcException_setNativeExceptionLocation,
126 env->NewStringUTF(file),
127 env->NewStringUTF(functionName),
129 if (env->ExceptionCheck())
136 void throwOcException(JNIEnv* env, jobject ex)
138 env->Throw((jthrowable)ex);
142 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
148 if (g_jvm->GetEnv((void **)&env, JNI_CURRENT_VERSION) != JNI_OK)
150 LOGE("Failed to get the environment using GetEnv()");
154 jclass clazz = nullptr;
157 clazz = env->FindClass("java/lang/Integer");
158 if (!clazz) return JNI_ERR;
159 g_cls_Integer = (jclass)env->NewGlobalRef(clazz);
160 env->DeleteLocalRef(clazz);
162 g_mid_Integer_ctor = env->GetMethodID(g_cls_Integer, "<init>", "(I)V");
163 if (!g_mid_Integer_ctor) return JNI_ERR;
165 clazz = env->FindClass("[I");
166 if (!clazz) return JNI_ERR;
167 g_cls_int1DArray = (jclass)env->NewGlobalRef(clazz);
168 env->DeleteLocalRef(clazz);
170 clazz = env->FindClass("[[I");
171 if (!clazz) return JNI_ERR;
172 g_cls_int2DArray = (jclass)env->NewGlobalRef(clazz);
173 env->DeleteLocalRef(clazz);
176 clazz = env->FindClass("java/lang/Double");
177 if (!clazz) return JNI_ERR;
178 g_cls_Double = (jclass)env->NewGlobalRef(clazz);
179 env->DeleteLocalRef(clazz);
181 g_mid_Double_ctor = env->GetMethodID(g_cls_Double, "<init>", "(D)V");
182 if (!g_mid_Double_ctor) return JNI_ERR;
184 clazz = env->FindClass("[D");
185 if (!clazz) return JNI_ERR;
186 g_cls_double1DArray = (jclass)env->NewGlobalRef(clazz);
187 env->DeleteLocalRef(clazz);
189 clazz = env->FindClass("[[D");
190 if (!clazz) return JNI_ERR;
191 g_cls_double2DArray = (jclass)env->NewGlobalRef(clazz);
192 env->DeleteLocalRef(clazz);
195 clazz = env->FindClass("java/lang/Boolean");
196 if (!clazz) return JNI_ERR;
197 g_cls_Boolean = (jclass)env->NewGlobalRef(clazz);
198 env->DeleteLocalRef(clazz);
200 g_mid_Boolean_ctor = env->GetMethodID(g_cls_Boolean, "<init>", "(Z)V");
201 if (!g_mid_Boolean_ctor) return JNI_ERR;
203 clazz = env->FindClass("[Z");
204 if (!clazz) return JNI_ERR;
205 g_cls_boolean1DArray = (jclass)env->NewGlobalRef(clazz);
206 env->DeleteLocalRef(clazz);
208 clazz = env->FindClass("[[Z");
209 if (!clazz) return JNI_ERR;
210 g_cls_boolean2DArray = (jclass)env->NewGlobalRef(clazz);
211 env->DeleteLocalRef(clazz);
214 clazz = env->FindClass("java/lang/String");
215 if (!clazz) return JNI_ERR;
216 g_cls_String = (jclass)env->NewGlobalRef(clazz);
217 env->DeleteLocalRef(clazz);
219 clazz = env->FindClass("[Ljava/lang/String;");
220 if (!clazz) return JNI_ERR;
221 g_cls_String1DArray = (jclass)env->NewGlobalRef(clazz);
222 env->DeleteLocalRef(clazz);
224 clazz = env->FindClass("[[Ljava/lang/String;");
225 if (!clazz) return JNI_ERR;
226 g_cls_String2DArray = (jclass)env->NewGlobalRef(clazz);
227 env->DeleteLocalRef(clazz);
230 clazz = env->FindClass("java/util/LinkedList");
231 if (!clazz) return JNI_ERR;
232 g_cls_LinkedList = (jclass)env->NewGlobalRef(clazz);
233 env->DeleteLocalRef(clazz);
235 g_mid_LinkedList_ctor = env->GetMethodID(g_cls_LinkedList, "<init>", "()V");
236 if (!g_mid_LinkedList_ctor) return JNI_ERR;
238 g_mid_LinkedList_add_object = env->GetMethodID(g_cls_LinkedList, "add", "(Ljava/lang/Object;)Z");
239 if (!g_mid_LinkedList_add_object) return JNI_ERR;
242 clazz = env->FindClass("java/util/Map");
243 if (!clazz) return JNI_ERR;
244 g_cls_Map = (jclass)env->NewGlobalRef(clazz);
245 env->DeleteLocalRef(clazz);
247 g_mid_Map_entrySet = env->GetMethodID(g_cls_Map, "entrySet", "()Ljava/util/Set;");
248 if (!g_mid_Map_entrySet) return JNI_ERR;
251 clazz = env->FindClass("java/util/Map$Entry");
252 if (!clazz) return JNI_ERR;
253 g_cls_MapEntry = (jclass)env->NewGlobalRef(clazz);
254 env->DeleteLocalRef(clazz);
256 g_mid_MapEntry_getKey = env->GetMethodID(g_cls_MapEntry, "getKey", "()Ljava/lang/Object;");
257 if (!g_mid_MapEntry_getKey) return JNI_ERR;
258 g_mid_MapEntry_getValue = env->GetMethodID(g_cls_MapEntry, "getValue", "()Ljava/lang/Object;");
259 if (!g_mid_MapEntry_getValue) return JNI_ERR;
262 clazz = env->FindClass("java/util/Set");
263 if (!clazz) return JNI_ERR;
264 g_cls_Set = (jclass)env->NewGlobalRef(clazz);
265 env->DeleteLocalRef(clazz);
267 g_mid_Set_iterator = env->GetMethodID(g_cls_Set, "iterator", "()Ljava/util/Iterator;");
268 if (!g_mid_Set_iterator) return JNI_ERR;
271 clazz = env->FindClass("java/util/Iterator");
272 if (!clazz) return JNI_ERR;
273 g_cls_Iterator = (jclass)env->NewGlobalRef(clazz);
274 env->DeleteLocalRef(clazz);
276 g_mid_Iterator_hasNext = env->GetMethodID(g_cls_Iterator, "hasNext", "()Z");
277 if (!g_mid_Iterator_hasNext) return JNI_ERR;
279 g_mid_Iterator_next = env->GetMethodID(g_cls_Iterator, "next", "()Ljava/lang/Object;");
280 if (!g_mid_Iterator_next) return JNI_ERR;
283 clazz = env->FindClass("java/util/HashMap");
284 if (!clazz) return JNI_ERR;
285 g_cls_HashMap = (jclass)env->NewGlobalRef(clazz);
286 env->DeleteLocalRef(clazz);
288 g_mid_HashMap_ctor = env->GetMethodID(g_cls_HashMap, "<init>", "()V");
289 if (!g_mid_HashMap_ctor) return JNI_ERR;
291 g_mid_HashMap_put = env->GetMethodID(g_cls_HashMap, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
292 if (!g_mid_HashMap_put) return JNI_ERR;
295 clazz = env->FindClass("org/iotivity/base/OcException");
296 if (!clazz) return JNI_ERR;
297 g_cls_OcException = (jclass)env->NewGlobalRef(clazz);
298 env->DeleteLocalRef(clazz);
300 g_mid_OcException_ctor = env->GetMethodID(g_cls_OcException, "<init>", "(Ljava/lang/String;Ljava/lang/String;)V");
301 if (!g_mid_OcException_ctor) return JNI_ERR;
303 g_mid_OcException_setNativeExceptionLocation = env->GetMethodID(g_cls_OcException, "setNativeExceptionLocation",
304 "(Ljava/lang/String;""Ljava/lang/String;""I)V");
305 if (!g_mid_OcException_setNativeExceptionLocation) return JNI_ERR;
308 clazz = env->FindClass("org/iotivity/base/OcResource");
309 if (!clazz) return JNI_ERR;
310 g_cls_OcResource = (jclass)env->NewGlobalRef(clazz);
311 env->DeleteLocalRef(clazz);
313 g_mid_OcResource_ctor = env->GetMethodID(g_cls_OcResource, "<init>", "(J)V");
314 if (!g_mid_OcResource_ctor) return JNI_ERR;
317 clazz = env->FindClass("org/iotivity/base/OcRepresentation");
318 if (!clazz) return JNI_ERR;
319 g_cls_OcRepresentation = (jclass)env->NewGlobalRef(clazz);
320 env->DeleteLocalRef(clazz);
322 g_mid_OcRepresentation_N_ctor = env->GetMethodID(g_cls_OcRepresentation, "<init>", "(J)V");
323 if (!g_mid_OcRepresentation_N_ctor) return JNI_ERR;
325 g_mid_OcRepresentation_N_ctor_bool = env->GetMethodID(g_cls_OcRepresentation, "<init>", "(JZ)V");
326 if (!g_mid_OcRepresentation_N_ctor_bool) return JNI_ERR;
328 clazz = env->FindClass("[Lorg/iotivity/base/OcRepresentation;");
329 if (!clazz) return JNI_ERR;
330 g_cls_OcRepresentation1DArray = (jclass)env->NewGlobalRef(clazz);
331 env->DeleteLocalRef(clazz);
333 clazz = env->FindClass("[[Lorg/iotivity/base/OcRepresentation;");
334 if (!clazz) return JNI_ERR;
335 g_cls_OcRepresentation2DArray = (jclass)env->NewGlobalRef(clazz);
336 env->DeleteLocalRef(clazz);
339 clazz = env->FindClass("org/iotivity/base/OcHeaderOption");
340 if (!clazz) return JNI_ERR;
341 g_cls_OcHeaderOption = (jclass)env->NewGlobalRef(clazz);
342 env->DeleteLocalRef(clazz);
343 g_mid_OcHeaderOption_ctor = env->GetMethodID(g_cls_OcHeaderOption, "<init>", "(ILjava/lang/String;)V");
344 if (!g_mid_OcHeaderOption_ctor) return JNI_ERR;
346 g_mid_OcHeaderOption_get_id = env->GetMethodID(g_cls_OcHeaderOption, "getOptionId", "()I");
347 if (!g_mid_OcHeaderOption_get_id) return JNI_ERR;
349 g_mid_OcHeaderOption_get_data = env->GetMethodID(g_cls_OcHeaderOption, "getOptionData", "()Ljava/lang/String;");
350 if (!g_mid_OcHeaderOption_get_data) return JNI_ERR;
353 clazz = env->FindClass("org/iotivity/base/OcResourceRequest");
354 if (!clazz) return JNI_ERR;
355 g_cls_OcResourceRequest = (jclass)env->NewGlobalRef(clazz);
356 env->DeleteLocalRef(clazz);
358 g_mid_OcResourceRequest_N_ctor = env->GetMethodID(g_cls_OcResourceRequest, "<init>", "(J)V");
359 if (!g_mid_OcResourceRequest_N_ctor) return JNI_ERR;
362 clazz = env->FindClass("org/iotivity/base/OcResourceResponse");
363 if (!clazz) return JNI_ERR;
364 g_cls_OcResourceResponse = (jclass)env->NewGlobalRef(clazz);
365 env->DeleteLocalRef(clazz);
367 g_mid_OcResourceResponse_N_ctor = env->GetMethodID(g_cls_OcResourceResponse, "<init>", "(J)V");
368 if (!g_mid_OcResourceResponse_N_ctor) return JNI_ERR;
371 clazz = env->FindClass("org/iotivity/base/OcResourceHandle");
372 if (!clazz) return JNI_ERR;
373 g_cls_OcResourceHandle = (jclass)env->NewGlobalRef(clazz);
374 env->DeleteLocalRef(clazz);
375 g_mid_OcResourceHandle_N_ctor = env->GetMethodID(g_cls_OcResourceHandle, "<init>", "(J)V");
376 if (!g_mid_OcResourceHandle_N_ctor) return JNI_ERR;
379 clazz = env->FindClass("org/iotivity/base/OcPresenceHandle");
380 if (!clazz) return JNI_ERR;
381 g_cls_OcPresenceHandle = (jclass)env->NewGlobalRef(clazz);
382 env->DeleteLocalRef(clazz);
383 g_mid_OcPresenceHandle_N_ctor = env->GetMethodID(g_cls_OcPresenceHandle, "<init>", "(J)V");
384 if (!g_mid_OcPresenceHandle_N_ctor) return JNI_ERR;
387 clazz = env->FindClass("org/iotivity/base/OcRequestHandle");
388 if (!clazz) return JNI_ERR;
389 g_cls_OcRequestHandle = (jclass)env->NewGlobalRef(clazz);
390 env->DeleteLocalRef(clazz);
391 g_mid_OcRequestHandle_N_ctor = env->GetMethodID(g_cls_OcRequestHandle, "<init>", "(J)V");
392 if (!g_mid_OcRequestHandle_N_ctor) return JNI_ERR;
395 clazz = env->FindClass("org/iotivity/base/OcPresenceStatus");
396 if (!clazz) return JNI_ERR;
397 g_cls_OcPresenceStatus = (jclass)env->NewGlobalRef(clazz);
398 env->DeleteLocalRef(clazz);
399 g_mid_OcPresenceStatus_get = env->GetStaticMethodID(g_cls_OcPresenceStatus, "get",
400 "(Ljava/lang/String;)Lorg/iotivity/base/OcPresenceStatus;");
401 if (!g_mid_OcPresenceStatus_get) return JNI_ERR;
404 clazz = env->FindClass("org/iotivity/base/ObservationInfo");
405 if (!clazz) return JNI_ERR;
406 g_cls_ObservationInfo = (jclass)env->NewGlobalRef(clazz);
407 env->DeleteLocalRef(clazz);
408 g_mid_ObservationInfo_N_ctor = env->GetMethodID(g_cls_ObservationInfo, "<init>", "(IB)V");
409 if (!g_mid_ObservationInfo_N_ctor) return JNI_ERR;
411 clazz = env->FindClass("org/iotivity/base/OcResourceIdentifier");
412 if (!clazz) return JNI_ERR;
413 g_cls_OcResourceIdentifier = (jclass)env->NewGlobalRef(clazz);
414 env->DeleteLocalRef(clazz);
415 g_mid_OcResourceIdentifier_N_ctor = env->GetMethodID(g_cls_OcResourceIdentifier, "<init>", "(J)V");
416 if (!g_mid_OcResourceIdentifier_N_ctor) return JNI_ERR;
419 clazz = env->FindClass("org/iotivity/base/OcSecureResource");
420 if (!clazz) return JNI_ERR;
421 g_cls_OcSecureResource = (jclass)env->NewGlobalRef(clazz);
422 env->DeleteLocalRef(clazz);
423 g_mid_OcSecureResource_ctor = env->GetMethodID(g_cls_OcSecureResource, "<init>", "(J)V");
424 if (!g_mid_OcSecureResource_ctor) return JNI_ERR;
427 clazz = env->FindClass("org/iotivity/base/ProvisionResult");
428 if (!clazz) return JNI_ERR;
429 g_cls_OcProvisionResult = (jclass)env->NewGlobalRef(clazz);
430 env->DeleteLocalRef(clazz);
431 g_mid_OcProvisionResult_ctor = env->GetMethodID(g_cls_OcProvisionResult, "<init>", "(Ljava/lang/String;I)V");
432 if (!g_mid_OcProvisionResult_ctor) return JNI_ERR;
435 clazz = env->FindClass("org/iotivity/base/OicSecAcl");
436 if (!clazz) return JNI_ERR;
437 g_cls_OcOicSecAcl = (jclass)env->NewGlobalRef(clazz);
438 env->DeleteLocalRef(clazz);
440 g_mid_OcOicSecAcl_get_subject = env->GetMethodID(g_cls_OcOicSecAcl, "getSubject", "()Ljava/lang/String;");
441 if (!g_mid_OcOicSecAcl_get_subject) return JNI_ERR;
443 g_mid_OcOicSecAcl_get_resources_cnt = env->GetMethodID(g_cls_OcOicSecAcl, "getResourcesCount", "()I");
444 if (!g_mid_OcOicSecAcl_get_resources_cnt) return JNI_ERR;
446 g_mid_OcOicSecAcl_get_resources = env->GetMethodID(g_cls_OcOicSecAcl, "getResources", "(I)Ljava/lang/String;");
447 if (!g_mid_OcOicSecAcl_get_resources) return JNI_ERR;
449 g_mid_OcOicSecAcl_get_permission = env->GetMethodID(g_cls_OcOicSecAcl, "getPermission", "()I");
450 if (!g_mid_OcOicSecAcl_get_permission) return JNI_ERR;
452 g_mid_OcOicSecAcl_get_periods_cnt = env->GetMethodID(g_cls_OcOicSecAcl, "getPeriodsCount", "()I");
453 if (!g_mid_OcOicSecAcl_get_periods_cnt) return JNI_ERR;
455 g_mid_OcOicSecAcl_get_periods = env->GetMethodID(g_cls_OcOicSecAcl, "getPeriods", "(I)Ljava/lang/String;");
456 if (!g_mid_OcOicSecAcl_get_periods) return JNI_ERR;
458 g_mid_OcOicSecAcl_get_recurrences = env->GetMethodID(g_cls_OcOicSecAcl, "getRecurrences", "(I)Ljava/lang/String;");
459 if (!g_mid_OcOicSecAcl_get_recurrences) return JNI_ERR;
461 g_mid_OcOicSecAcl_get_owners_cnt = env->GetMethodID(g_cls_OcOicSecAcl, "getOwnersCount", "()I");
462 if (!g_mid_OcOicSecAcl_get_owners_cnt) return JNI_ERR;
464 g_mid_OcOicSecAcl_get_owners = env->GetMethodID(g_cls_OcOicSecAcl, "getOwners", "(I)Ljava/lang/String;");
465 if (!g_mid_OcOicSecAcl_get_owners) return JNI_ERR;
467 return JNI_CURRENT_VERSION;
470 JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
472 LOGI("JNI_OnUnload");
475 if (vm->GetEnv((void **)&env, JNI_CURRENT_VERSION) != JNI_OK)
477 LOGE("Failed to get the environment using GetEnv()");
481 env->DeleteGlobalRef(g_cls_Integer);
482 env->DeleteGlobalRef(g_cls_int1DArray);
483 env->DeleteGlobalRef(g_cls_int2DArray);
484 env->DeleteGlobalRef(g_cls_Double);
485 env->DeleteGlobalRef(g_cls_double1DArray);
486 env->DeleteGlobalRef(g_cls_double2DArray);
487 env->DeleteGlobalRef(g_cls_Boolean);
488 env->DeleteGlobalRef(g_cls_boolean1DArray);
489 env->DeleteGlobalRef(g_cls_boolean2DArray);
490 env->DeleteGlobalRef(g_cls_String);
491 env->DeleteGlobalRef(g_cls_String1DArray);
492 env->DeleteGlobalRef(g_cls_String2DArray);
493 env->DeleteGlobalRef(g_cls_LinkedList);
494 env->DeleteGlobalRef(g_cls_Map);
495 env->DeleteGlobalRef(g_cls_MapEntry);
496 env->DeleteGlobalRef(g_cls_Set);
497 env->DeleteGlobalRef(g_cls_Iterator);
498 env->DeleteGlobalRef(g_cls_HashMap);
499 env->DeleteGlobalRef(g_cls_OcResource);
500 env->DeleteGlobalRef(g_cls_OcException);
501 env->DeleteGlobalRef(g_cls_OcRepresentation);
502 env->DeleteGlobalRef(g_cls_OcRepresentation1DArray);
503 env->DeleteGlobalRef(g_cls_OcRepresentation2DArray);
504 env->DeleteGlobalRef(g_cls_OcResourceRequest);
505 env->DeleteGlobalRef(g_cls_OcResourceResponse);
506 env->DeleteGlobalRef(g_cls_OcResourceHandle);
507 env->DeleteGlobalRef(g_cls_OcPresenceHandle);
508 env->DeleteGlobalRef(g_cls_OcRequestHandle);
509 env->DeleteGlobalRef(g_cls_OcPresenceStatus);
510 env->DeleteGlobalRef(g_cls_OcHeaderOption);
511 env->DeleteGlobalRef(g_cls_ObservationInfo);
512 env->DeleteGlobalRef(g_cls_OcResourceIdentifier);
513 env->DeleteGlobalRef(g_cls_OcSecureResource);
514 env->DeleteGlobalRef(g_cls_OcProvisionResult);
515 env->DeleteGlobalRef(g_cls_OcOicSecAcl);