[ANDROID] Remove GroupSynchronization in things manager. 13/2713/3
authorarya.k <arya.kumar@samsung.com>
Fri, 18 Sep 2015 13:50:09 +0000 (19:20 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Fri, 18 Sep 2015 22:21:02 +0000 (22:21 +0000)
Change-Id: I3d3324636ee7642cdba7657cba3c92105831159b
Signed-off-by: arya.k <arya.kumar@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2713
Reviewed-by: Jihun Ha <jihun.ha@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/things-manager/SConscript
service/things-manager/sampleapp/android/Sample/src/com/tm/sample/ConfigurationApiActivity.java
service/things-manager/sampleapp/android/Sample/src/com/tm/sample/GroupApiActivity.java
service/things-manager/sampleapp/android/Sample/src/com/tm/sample/GroupClient.java
service/things-manager/sdk/java/jni/jniutil/inc/jni_things_manager_jvm.h
service/things-manager/sdk/java/jni/jniutil/src/jni_things_manager_jvm.cpp
service/things-manager/sdk/java/jni/tm/inc/jni_group_synchronization.h [deleted file]
service/things-manager/sdk/java/jni/tm/inc/jni_group_synchronization_callbacks.h [deleted file]
service/things-manager/sdk/java/jni/tm/src/jni_group_synchronization.cpp [deleted file]
service/things-manager/sdk/java/jni/tm/src/jni_group_synchronization_callbacks.cpp [deleted file]
service/things-manager/sdk/java/src/org/iotivity/service/tm/GroupSynchronization.java [deleted file]

index e1c65aa..16aa06b 100644 (file)
@@ -54,21 +54,18 @@ if target_os == 'android':
 # Source files and Targets
 ######################################################################
 
+tgm_src = env.Glob('sdk/src/*.cpp', '../../extlibs/timer/timer.c')
+tgmsdk_static = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
+tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
 
-# Remove it if the conversion for Android and Tizen platform is done
-if target_os in ['linux', 'tizen']:
-   tgm_src = env.Glob('sdk/src/*.cpp', '../../extlibs/timer/timer.c')
-   tgmsdk_static = things_manager_env.StaticLibrary('TGMSDKLibrary', tgm_src)
-   tgmsdk_shared = things_manager_env.SharedLibrary('TGMSDKLibrary', tgm_src)
+things_manager_env.InstallTarget([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
+things_manager_env.UserInstallTargetLib([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
 
-   things_manager_env.InstallTarget([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
-   things_manager_env.UserInstallTargetLib([tgmsdk_static,tgmsdk_shared], 'libTGMSDK')
+# Build JNI layer
+#if target_os == 'android':
+#    SConscript(os.path.join('sdk', 'java', 'jni', 'SConscript'))
 
-   # Build JNI layer
-   #if target_os == 'android':
-   #    SConscript(os.path.join('sdk', 'java', 'jni', 'SConscript'))
-
-    #Go to build sample apps
-   SConscript('sampleapp/SConscript')
+#Go to build sample apps
+SConscript('sampleapp/SConscript')
 
 
index 472f0ed..25eef14 100644 (file)
@@ -20,6 +20,7 @@
 package com.tm.sample;
 
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -31,7 +32,7 @@ import org.iotivity.base.OcPlatform;
 import org.iotivity.base.OcRepresentation;
 import org.iotivity.base.OcResource;
 import org.iotivity.base.OcResourceHandle;
-import org.iotivity.service.tm.GroupSynchronization;
+import org.iotivity.base.ResourceProperty;
 import org.iotivity.service.tm.OCStackResult;
 import org.iotivity.service.tm.GroupManager;
 import org.iotivity.service.tm.ThingsMaintenance;
@@ -94,7 +95,6 @@ public class ConfigurationApiActivity extends Activity {
     private static Message                   msg;
 
     private GroupManager                     groupManager                           = null;
-    private GroupSynchronization             groupSyn                               = null;
     private ThingsConfiguration              thingsConfiguration                    = null;
     private ThingsMaintenance                thingsMaintenance                      = null;
     private Map<String, ResourceInformation> resourceList                           = null;
@@ -115,7 +115,6 @@ public class ConfigurationApiActivity extends Activity {
 
         mcontext = this;
         groupManager = new GroupManager();
-        groupSyn = new GroupSynchronization();
         thingsConfiguration = ThingsConfiguration.getInstance();
         thingsMaintenance = ThingsMaintenance.getInstance();
 
@@ -755,20 +754,27 @@ public class ConfigurationApiActivity extends Activity {
 
         OcResourceHandle resourceHandle = null;
 
-        // Crate group
-        OCStackResult result = groupSyn.createGroup(typename);
-        if ((OCStackResult.OC_STACK_OK != result)) {
-            Log.e(LOG_TAG, "createGroup returned error: " + result.name());
-            return;
-        } else {
-            Log.e(LOG_TAG, "createGroup returned: " + result.name());
+        try {
+            resourceHandle = OcPlatform.registerResource(
+                    uri,
+                    typename,
+                    OcPlatform.BATCH_INTERFACE, null, EnumSet.of(
+                            ResourceProperty.DISCOVERABLE));
+        } catch (OcException e) {
+            Log.e(LOG_TAG, "go exception");
+            Log.e(LOG_TAG, "RegisterResource error. " + e.getMessage());
         }
-        groupList = groupSyn.getGroupList();
-        if (groupList.containsKey(typename)) {
-            resourceHandle = groupList.get(typename);
-        } else {
-            Log.e(LOG_TAG, "group does not contain groupResourceType: "
-                    + result.name());
+        try {
+            OcPlatform.bindInterfaceToResource(resourceHandle, OcPlatform.GROUP_INTERFACE);
+        } catch (OcException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        try {
+            OcPlatform.bindInterfaceToResource(resourceHandle, OcPlatform.DEFAULT_INTERFACE);
+        } catch (OcException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
         }
 
         if (null == resourceHandle) {
@@ -826,10 +832,6 @@ public class ConfigurationApiActivity extends Activity {
                 }
             }
 
-            // delete all the groups
-            groupSyn.deleteGroup(CONFIGURATION_COLLECTION_RESOURCE_TYPE);
-            groupSyn.deleteGroup(MAINTENANCE_COLLECTION_RESOURCE_TYPE);
-            groupSyn.deleteGroup(FACTORYSET_COLLECTION_RESOURCE_TYPE);
         } catch (OcException e) {
             Log.e(LOG_TAG, "OcException occured! " + e.toString());
         }
index a67e31e..968e41c 100644 (file)
@@ -235,8 +235,6 @@ public class GroupApiActivity extends Activity {
     @Override
     public void onBackPressed() {
         super.onBackPressed();
-        // unregister the resource and set callback listener to null
-        groupClientObj.leaveGroup();
     }
 
     // for update UI these functions will be called from GroupClient Class
index c2b9cf0..a624c72 100644 (file)
  ******************************************************************/
 package com.tm.sample;
 
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
+import org.iotivity.base.EntityHandlerResult;
 import org.iotivity.base.ObserveType;
 import org.iotivity.base.OcException;
 import org.iotivity.base.OcHeaderOption;
 import org.iotivity.base.OcPlatform;
 import org.iotivity.base.OcRepresentation;
 import org.iotivity.base.OcResource;
+import org.iotivity.base.OcResourceRequest;
+import org.iotivity.base.OcStackConfig;
+import org.iotivity.base.ResourceProperty;
 import org.iotivity.base.OcResource.OnObserveListener;
 import org.iotivity.base.OcResourceHandle;
 import org.iotivity.service.tm.Action;
 import org.iotivity.service.tm.ActionSet;
 import org.iotivity.service.tm.Capability;
-import org.iotivity.service.tm.GroupSynchronization;
-import org.iotivity.service.tm.GroupSynchronization.*;
 import org.iotivity.service.tm.OCStackResult;
 import org.iotivity.service.tm.GroupManager;
 import org.iotivity.service.tm.GroupManager.*;
@@ -56,9 +59,9 @@ public class GroupClient {
     public String                      logMessage;
 
     private final String               groupResourceType   = "b.collection";
+    private final String               groupResourceURI    = "/b/collection";
 
     private final GroupManager         groupManagerObj;
-    private final GroupSynchronization groupSynObj;
     private final ActionListener       actionListener;
     private final ObserveListener      observeListener;
     private OcResource                 groupResource;
@@ -67,6 +70,7 @@ public class GroupClient {
     private static GroupApiActivity    groupApiActivityObj = null;
     public static Vector<String>       lights              = new Vector<String>();
     public static Vector<String>       bookmarks           = new Vector<String>();
+    public static boolean              groupFound          = false;
 
     /**
      * Listener for receiving observe notifications.
@@ -91,42 +95,7 @@ public class GroupClient {
     }
 
     /**
-     * Listener for receiving groups discovered in network.
-     */
-    private class FindGroupListener implements IFindGroupListener {
-        @Override
-        public void onGroupFindCallback(OcResource resource) {
-            Log.i(LOG_TAG, "onGroupFindCallback invoked");
-            if (resource != null) {
-                String uri = resource.getUri();
-                if (uri.equals("/b/collection") == true) {
-                    String hostAddress = resource.getHost();
-                    Log.d(LOG_TAG, "onGroupFindCallback URI : " + uri);
-                    Log.d(LOG_TAG, "onGroupFindCallback HOST : " + hostAddress);
-
-                    groupResource = resource;
-                    Message msg = Message.obtain();
-                    msg.what = 0;
-                    groupApiActivityObj.getHandler().sendMessage(msg);
-
-                    logMessage = "onGroupFind" + "\n";
-                    logMessage += "URI : " + uri + "\n";
-                    logMessage += "Host :" + hostAddress;
-                    GroupApiActivity.setMessageLog(logMessage);
-                    msg = Message.obtain();
-                    msg.what = 1;
-                    groupApiActivityObj.getHandler().sendMessage(msg);
-                } else {
-                    Log.d(LOG_TAG, "onGroupFindCallback URI : " + uri);
-                }
-            } else {
-                Log.i(LOG_TAG, "Resource is NULL");
-            }
-        }
-    };
-
-    /**
-     * Listener for receiving Light resource and Observe resources discovered in
+     * Listener for receiving group resource , Light resource and Observe resources discovered in
      * network.
      */
     private class FindCadidateResourceListener implements
@@ -151,8 +120,31 @@ public class GroupClient {
                     msg = Message.obtain();
                     msg.what = 1;
                     groupApiActivityObj.getHandler().sendMessage(msg);
+                    if (resourceURI.equals("/b/collection") == true) {
+
+                        if(!groupFound)
+                        {
+                            Log.d(LOG_TAG, "Group Found URI : " + resourceURI);
+                            Log.d(LOG_TAG, "Group Foundk HOST : " + hostAddress);
+
+                            groupResource = ocResource;
+                            groupFound = true;
+                            Message msg = Message.obtain();
+                            msg.what = 0;
+                            groupApiActivityObj.getHandler().sendMessage(msg);
+
+                            logMessage = "onGroupFind" + "\n";
+                            logMessage += "URI : " + resourceURI + "\n";
+                            logMessage += "Host :" + hostAddress;
+                            GroupApiActivity.setMessageLog(logMessage);
+                            msg = Message.obtain();
+                            msg.what = 1;
+                            groupApiActivityObj.getHandler().sendMessage(msg);
+                        }else{
+                            Log.d(LOG_TAG, "Group Already found ");
+                        }
 
-                    if (resourceURI.equals("/a/light") == true) {
+                    }else if (resourceURI.equals("/a/light") == true) {
                         if (lights.contains((hostAddress + resourceURI)) == false) {
                             lights.add((hostAddress + resourceURI));
                             if (groupApiActivityObj != null) {
@@ -167,13 +159,19 @@ public class GroupClient {
                                 groupApiActivityObj.getHandler().sendMessage(
                                         msg);
                                 try {
-                                    foundLightHandle = groupManagerObj
-                                            .bindResourceToGroup(ocResource,
-                                                    groupResourceHandle);
+                                    foundLightHandle = OcPlatform.registerResource(ocResource);
+                                    Log.d(LOG_TAG, "Platform registeration done");
+                                } catch (OcException e) {
+                                    // TODO Auto-generated catch block
+                                    e.printStackTrace();
+                                }
 
+                                try {
+                                    OcPlatform.bindResource(groupResourceHandle, foundLightHandle);
+                                    Log.d(LOG_TAG, "Bind resource done");
                                 } catch (OcException e) {
-                                    Log.i(LOG_TAG,
-                                            "bindResourceToGroup Exception!");
+                                    // TODO Auto-generated catch block
+                                    e.printStackTrace();
                                 }
                             }
                         } else {
@@ -204,17 +202,13 @@ public class GroupClient {
     };
 
     private final FindCadidateResourceListener findCandidateResourceListener;
-    private final FindGroupListener            findGroupListener;
 
     public GroupClient() {
         groupManagerObj = new GroupManager();
-        groupSynObj = GroupSynchronization.getInstance();
-        findGroupListener = new FindGroupListener();
         actionListener = new ActionListener();
         observeListener = new ObserveListener();
         findCandidateResourceListener = new FindCadidateResourceListener();
 
-        groupSynObj.setGroupListener(findGroupListener);
         groupManagerObj
                 .setFindCandidateResourceListener(findCandidateResourceListener);
         groupManagerObj.setActionListener(actionListener);
@@ -227,25 +221,30 @@ public class GroupClient {
      * resources.
      */
     public void createGroup() {
-        Map<String, OcResourceHandle> groupList = new HashMap<String, OcResourceHandle>();
+        groupFound = false;
+        try {
+            groupResourceHandle = OcPlatform.registerResource(
+                    groupResourceURI,
+                    groupResourceType,
+                    OcPlatform.BATCH_INTERFACE, null, EnumSet.of(
+                            ResourceProperty.DISCOVERABLE));
+        } catch (OcException e) {
+            Log.e(LOG_TAG, "go exception");
+            Log.e(LOG_TAG, "RegisterResource error. " + e.getMessage());
+        }
 
-        // creating group of type b.collection
-        // OcPlatform.registerResource(ocResource);
-        OCStackResult result = groupSynObj.createGroup(groupResourceType);
-        if ((OCStackResult.OC_STACK_OK != result)) {
-            Log.e(LOG_TAG, "createGroup returned error: " + result.name());
-            return;
-        } else {
-            Log.e(LOG_TAG, "createGroup success: " + result.name());
+        try {
+            OcPlatform.bindInterfaceToResource(groupResourceHandle, OcPlatform.GROUP_INTERFACE);
+        } catch (OcException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
         }
 
-        // getting the Created group Handle
-        groupList = groupSynObj.getGroupList();
-        if (groupList.containsKey(groupResourceType)) {
-            groupResourceHandle = groupList.get(groupResourceType);
-        } else {
-            Log.e(LOG_TAG, "group does not contain groupResourceType: "
-                    + result.name());
+        try {
+            OcPlatform.bindInterfaceToResource(groupResourceHandle, OcPlatform.DEFAULT_INTERFACE);
+        } catch (OcException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
         }
     }
 
@@ -255,12 +254,12 @@ public class GroupClient {
     public void findGroup() {
         Log.d(LOG_TAG, "finding group");
 
-        Vector<String> resourceTypes = new Vector<String>();
-        resourceTypes.add(groupResourceType);
-        OCStackResult result = groupSynObj.findGroup(resourceTypes);
+        Vector<String> types = new Vector<String>();
+        types.add(groupResourceType);
+        OCStackResult result = groupManagerObj.findCandidateResources(types, 5);
         if (OCStackResult.OC_STACK_OK != result) {
-            Log.e(LOG_TAG, "findGroup returned error: " + result.name());
-            return;
+            Log.e(LOG_TAG,
+                    "findCandidateResources returned error: " + result.name());
         }
 
         logMessage = "API RESULT : " + result.toString();
@@ -692,33 +691,6 @@ public class GroupClient {
         }
     }
 
-    /**
-     * This method is for unbinding and unregister all the found resources and
-     * groups.
-     */
-    public void leaveGroup() {
-        groupSynObj.setGroupListener(null);
-        groupManagerObj.setFindCandidateResourceListener(null);
-        groupManagerObj.setActionListener(null);
-
-        if (null != foundLightHandle) {
-            try {
-                OcPlatform.unregisterResource(foundLightHandle);
-            } catch (OcException e) {
-                e.printStackTrace();
-                Log.i(LOG_TAG, "Resource Unregister Exception");
-            }
-        } else {
-            Log.i(LOG_TAG, "foundLightHandle is NULL");
-        }
-        if (null != groupResourceHandle) {
-
-            groupSynObj.deleteGroup(groupResourceType);
-        } else {
-            Log.i(LOG_TAG, "groupResourceHandle is NULL");
-        }
-    }
-
     private void executeActionSet(String actonSetName, long delay) {
         try {
             OCStackResult result = groupManagerObj.executeActionSet(
index 0a1138e..bd01a37 100644 (file)
@@ -34,9 +34,6 @@
 #define TM_SERVICE_GROUP_MANAGER_CLASS_PATH    "org/iotivity/service/tm/GroupManager"
 #define TM_SERVICE_GROUP_MANAGER_CLASS_TYPE    "Lorg/iotivity/service/tm/GroupManager;"
 
-#define TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH    "org/iotivity/service/tm/GroupSynchronization"
-#define TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_TYPE    "Lorg/iotivity/service/tm/GroupSynchronization;"
-
 #define TM_SERVICE_THINGS_CONFIGURATION_CLASS_PATH    "org/iotivity/service/tm/ThingsConfiguration"
 #define TM_SERVICE_THINGS_CONFIGURATION_CLASS_TYPE    "Lorg/iotivity/service/tm/ThingsConfigurationn;"
 
index 6d85966..a8bb16c 100644 (file)
@@ -22,7 +22,6 @@
 
 #include "jni_things_manager_jvm.h"
 #include "jni_group_manager.h"
-#include "jni_group_synchronization.h"
 #include "jni_things_configuration.h"
 #include "jni_things_maintenance.h"
 #include "jni_things_manager_util.h"
@@ -84,7 +83,6 @@ class JObjectMap
 static JClassMap gJClassMapArray[] =
 {
     JClassMap(TM_SERVICE_GROUP_MANAGER_CLASS_PATH),
-    JClassMap(TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH),
     JClassMap(TM_SERVICE_THINGS_CONFIGURATION_CLASS_PATH),
     JClassMap(TM_SERVICE_THINGS_MAINTENANCE_CLASS_PATH),
     JClassMap(TM_SERVICE_OCRESOURCE_PATH),
@@ -100,7 +98,6 @@ static JClassMap gJClassMapArray[] =
 
 static JObjectMap gJObjectMapArray[] =
 {
-    JObjectMap(TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH),
     JObjectMap(TM_SERVICE_THINGS_CONFIGURATION_CLASS_PATH),
     JObjectMap(TM_SERVICE_THINGS_MAINTENANCE_CLASS_PATH)
 };
@@ -118,18 +115,6 @@ static JNINativeMethod gGroupManagerMethodTable[] =
     { "nativeDeleteActionSet", "(Lorg/iotivity/base/OcResource;Ljava/lang/String;)I", (void *) JNIGroupManagerDeleteActionSet}
 };
 
-static JNINativeMethod gGroupSynchronizationMethodTable[] =
-{
-    { "nativeFindGroup", "(Ljava/util/Vector;)I", (void *) JNIGroupSynchronizationFindGroup},
-    { "nativeCreateGroup", "(Ljava/lang/String;)I", (void *) JNIGroupSynchronizationCreateGroup},
-    { "nativeJoinGroupString", "(Ljava/lang/String;Lorg/iotivity/base/OcResourceHandle;)I", (void *) JNIGroupSynchronizationJoinGroupString},
-    { "nativeJoinGroupObject", "(Lorg/iotivity/base/OcResource;Lorg/iotivity/base/OcResourceHandle;)I", (void *) JNIGroupSynchronizationJoinGroupObject},
-    { "nativeLeaveGroup", "(Ljava/lang/String;Lorg/iotivity/base/OcResourceHandle;)I", (void *) JNIGroupSynchronizationLeaveGroup},
-    { "nativeLeaveGroupForResource", "(Lorg/iotivity/base/OcResource;Ljava/lang/String;Lorg/iotivity/base/OcResourceHandle;)I", (void *) JNIGroupSynchronizationLeaveGroupForResource},
-    { "nativeDeleteGroup", "(Ljava/lang/String;)V", (void *) JNIGroupSynchronizationDeleteGroup},
-    { "nativeGetGroupList", "()Ljava/util/Map;", (void *) JNIGroupSynchronizationGetGroupList}
-};
-
 static JNINativeMethod gThingsConfigurationMethodTable[] =
 {
     { "nativeUpdateConfigurations", "(Lorg/iotivity/base/OcResource;Ljava/util/Map;)I", (void *) JNIThingsConfigurationUpdateConfigurations},
@@ -149,10 +134,6 @@ static JNINativeMethod gThingsMaintenanceMethodTable[] =
 static int gGroupManagerMethodTableSize = sizeof(gGroupManagerMethodTable) / sizeof(
             gGroupManagerMethodTable[0]);
 
-static int gGroupSynchronizationMethodTableSize = sizeof(gGroupSynchronizationMethodTable) / sizeof(
-            gGroupSynchronizationMethodTable[0]);
-
-
 static int gThingsConfigurationMethodTableSize = sizeof(gThingsConfigurationMethodTable) / sizeof(
             gThingsConfigurationMethodTable[0]);
 
@@ -387,18 +368,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
     env->RegisterNatives(groupManagerClassRef, gGroupManagerMethodTable,
                          gGroupManagerMethodTableSize);
 
-    // Group Synchronization
-    jclass groupSynchronizationClassRef = GetJClass(TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH);
-
-    if (NULL == groupSynchronizationClassRef)
-    {
-        LOGE("JNI_OnLoad: GetJClass gThingsManagerClass failed !");
-        return JNI_ERR;
-    }
-
-    env->RegisterNatives(groupSynchronizationClassRef, gGroupSynchronizationMethodTable,
-                         gGroupSynchronizationMethodTableSize);
-
     //Things Configuration
     jclass thingsConfigurationClassRef = GetJClass(TM_SERVICE_THINGS_CONFIGURATION_CLASS_PATH);
 
diff --git a/service/things-manager/sdk/java/jni/tm/inc/jni_group_synchronization.h b/service/things-manager/sdk/java/jni/tm/inc/jni_group_synchronization.h
deleted file mode 100644 (file)
index 2e5d505..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-
-/**
- * @file
- * This file contains the declaration of Group Synchronization APIs
- * for JNI implementation.
- */
-
-#ifndef JNI_GROUP_SYNCHRONIZATION_H_
-#define JNI_GROUP_SYNCHRONIZATION_H_
-
-#include <stdio.h>
-#include <string.h>
-
-#include <jni.h>
-#include <jni_string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * API for finding a specific remote group when a resource tries to join a group.
- * Callback is called when a group is found or not.
- *
- * @param resourceTypes  - resource types of a group to find and join
- *
- * @return OCStackResult - return value of this API.
- *                         It returns OC_STACK_OK if success.
- *
- * NOTE: It return OC_STACK ERROR when It was finding a group.
- *       You should call this api when the group finding process has stopped.
- *       OCStackResult is defined in ocstack.h.
- */
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationFindGroup
-(JNIEnv *env, jobject interfaceObject, jobject resourceTypes);
-
-/**
- * API for creating a new group.
- *
- * @param resourceType   - resource type of a group to create
- *
- * @return OCStackResult - return value of this API.
- *                         It returns OC_STACK_OK if success.
- *
- * NOTE: OCStackResult is defined in ocstack.h.
- */
-JNIEXPORT jint JNICALL JNIGroupSynchronizationCreateGroup
-(JNIEnv *env, jobject interfaceObject, jstring resourceType);
-
-/**
- * API for joining a group. This API is used when a resource that has a group tries
- * to find a specific remote resource and makes it join a group
- *
- * @param resourceType   - resource type of a group to join.
- * @param resourceHandle - resource handle to join a group.
- *
- * @return OCStackResult - return value of this API.
- *                         It returns OC_STACK_OK if success.
- *
- * NOTE: If you want to join the resource in the remote(other) process, use the API
- *       jniThingsManagerJoinGroupObject instead of this.
- *       OCStackResult is defined in ocstack.h.
- */
-JNIEXPORT jint JNICALL JNIGroupSynchronizationJoinGroupString
-(JNIEnv *env, jobject interfaceObject, jstring resourceType, jobject resourceHandle);
-
-/**
- * API for joining a group. This API is used when a resource that
- * doesn't have a group tries to find and join a specific remote group.
- *
- * @param resource       - group resource pointer to join.
- * @param resourceHandle - resource handle to join a group.
- *
- * @return OCStackResult - return value of this API.
- *                         It returns OC_STACK_OK if success.
- *
- * NOTE: NOTE: If you want to join the resource in the same process, use the API
- *       jniThingsManagerJoinGroupString instead of this.
- *       OCStackResult is defined in ocstack.h.
- */
-JNIEXPORT jint JNICALL JNIGroupSynchronizationJoinGroupObject
-(JNIEnv *env, jobject interfaceObject, jobject resource, jobject resourceHandle);
-
-/**
- * API for leaving a joined group.
- *
- * @param resourceType   - resource type of a group to leave.
- * @param resourceHandle - resource handle to join a group.
- *
- * @return OCStackResult - return value of this API.
- *                         It returns OC_STACK_OK if success.
- *
- * NOTE: OCStackResult is defined in ocstack.h.
- */
-JNIEXPORT jint JNICALL JNIGroupSynchronizationLeaveGroup
-(JNIEnv *env, jobject interfaceObject, jstring resourceType, jobject resourceHandle);
-
-/**
- * API for leaving a joined group.
- *
- * @param resource       - resource of a group to leave.
- * @param resourceType   - resource type of a group to leave.
- * @param resourceHandle - resource handle to join a group.
- *
- * @return OCStackResult - return value of this API.
- *                         It returns OC_STACK_OK if success.
- *
- * NOTE: OCStackResult is defined in ocstack.h.
- */
-JNIEXPORT jint JNICALL JNIGroupSynchronizationLeaveGroupForResource
-(JNIEnv *env, jobject interfaceObject, jobject resource, jstring resourceType,
- jobject resourceHandle);
-
-/**
- * API for deleting a group.
- *
- * @param collectionResourceType - resource type of a group to delete.
- *
- * @return void
- */
-JNIEXPORT void JNICALL JNIGroupSynchronizationDeleteGroup
-(JNIEnv *env, jobject interfaceObject, jstring collectionResourceType);
-
-/**
- * API for getting a list of joined groups.
- *
- * @return std::map - return value of this API.
- *                  It returns group resource type and group resource handle as a map type.
- */
-JNIEXPORT jobject JNICALL JNIGroupSynchronizationGetGroupList
-(JNIEnv *env, jobject interfaceObject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //JNI_GROUP_SYNCHRONIZATION_H_
diff --git a/service/things-manager/sdk/java/jni/tm/inc/jni_group_synchronization_callbacks.h b/service/things-manager/sdk/java/jni/tm/inc/jni_group_synchronization_callbacks.h
deleted file mode 100644 (file)
index f84d5e3..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-
-/**
- * @file
- * This file contains the declaration of GroupSynchronizationCallbacks class.
- */
-
-#ifndef JNI_GROUP_SYNCHRONIZATION_CALLBACKS_H_
-#define JNI_GROUP_SYNCHRONIZATION_CALLBACKS_H_
-
-#include <string>
-
-#include "GroupSynchronization.h"
-
-/**
- * This class provides callback function for group Synchronization.
- */
-class GroupSynchronizationCallbacks
-{
-
-    public:
-        GroupSynchronizationCallbacks() {}
-        virtual ~GroupSynchronizationCallbacks() {}
-
-        /**
-         * This callback method is called to notify whether group is found or not.
-         *
-         * @param resource - Resource URI
-         */
-        static void onFoundGroup(std::shared_ptr<OC::OCResource> resource);
-
-
-};
-#endif //JNI_GROUP_SYNCHRONIZATION_CALLBACKS_H_
diff --git a/service/things-manager/sdk/java/jni/tm/src/jni_group_synchronization.cpp b/service/things-manager/sdk/java/jni/tm/src/jni_group_synchronization.cpp
deleted file mode 100644 (file)
index 1ab32fe..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-
-#include "jni_group_synchronization.h"
-#include "JniOcResource.h"
-#include "JniOcResourceHandle.h"
-#include "GroupManager.h"
-#include "ActionSet.h"
-#include "jni_things_manager_jvm.h"
-#include "jni_things_manager_util.h"
-#include "jni_group_synchronization_callbacks.h"
-#include "jni_action_set.h"
-
-using namespace OC;
-using namespace OIC;
-
-/**
- * GroupSynchronization static object
- */
-static GroupSynchronization g_GroupSynchronization;
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationFindGroup(JNIEnv *env, jobject interfaceObject,
-        jobject jResourceTypes)
-{
-    LOGI("JNIGroupSynchronizationFindGroup: Enter");
-
-    if (!jResourceTypes)
-    {
-        LOGE("JNIGroupSynchronizationFindGroup: jResourceTypes is NULL!");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    OCStackResult ocResult = OC_STACK_ERROR;
-    try
-    {
-        ocResult = g_GroupSynchronization.findGroup((convertStringVector(env, jResourceTypes)),
-                   &GroupSynchronizationCallbacks::onFoundGroup);
-        if (OC_STACK_OK != ocResult)
-        {
-            LOGE("JNIGroupSynchronizationFindGroup: findGroup failed!");
-            return ocResult;
-        }
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationFindGroup: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-        return ocResult;
-    }
-    LOGI("JNIGroupSynchronizationFindGroup: Exit");
-    return ocResult;
-}
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationCreateGroup(JNIEnv *env, jobject interfaceObject,
-        jstring jResourceType)
-{
-    LOGI("JNIGroupSynchronizationCreateGroup: Enter");
-
-    if (!jResourceType)
-    {
-        LOGE("JNIGroupSynchronizationCreateGroup: jResourceType is NULL!");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    OCStackResult ocResult = OC_STACK_ERROR;
-
-    const char *resourceTypePointer = env->GetStringUTFChars(jResourceType, NULL);
-    if (NULL == resourceTypePointer)
-    {
-        LOGE("JNIGroupSynchronizationCreateGroup: Failed to convert jstring to char string!");
-        return OC_STACK_NO_MEMORY;
-    }
-
-    std::string resourceType(resourceTypePointer);
-    try
-    {
-        ocResult =  g_GroupSynchronization.createGroup(resourceType);
-        if (OC_STACK_OK != ocResult)
-        {
-            LOGE("JNIGroupSynchronizationCreateGroup: CreateGroup failed!");
-        }
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationCreateGroup: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-    }
-    env->ReleaseStringUTFChars(jResourceType, resourceTypePointer);
-    LOGI("JNIGroupSynchronizationCreateGroup: Exit");
-    return ocResult;
-}
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationJoinGroupString(JNIEnv *env, jobject interfaceObject,
-        jstring jResourceType, jobject jResourceHandle)
-{
-    LOGI("JNIGroupSynchronizationJoinGroupString: Enter");
-
-    if ((!jResourceType) || (!jResourceHandle))
-    {
-        LOGE("JNIGroupSynchronizationJoinGroupString: jResourceType or jResourceHandle is NULL!");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    OCStackResult ocResult = OC_STACK_ERROR;
-
-    const char *resourceTypePointer = env->GetStringUTFChars(jResourceType, NULL);
-    if (NULL == resourceTypePointer)
-    {
-        LOGE("JNIGroupSynchronizationJoinGroupString: Failed to convert jstring to char string!");
-        return OC_STACK_NO_MEMORY;
-    }
-
-    std::string resourceType(resourceTypePointer);
-
-    JniOcResourceHandle *jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(env,
-            jResourceHandle);
-    try
-    {
-        OCResourceHandle ocResourceHandle = jniOcResourceHandle->getOCResourceHandle();
-        ocResult = g_GroupSynchronization.joinGroup(resourceType, ocResourceHandle);
-        if (OC_STACK_OK != ocResult)
-        {
-            LOGE("JNIGroupSynchronizationJoinGroupString: joinGroup failed!");
-        }
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationJoinGroupString: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-    }
-    env->ReleaseStringUTFChars(jResourceType, resourceTypePointer);
-    LOGI("JNIGroupSynchronizationJoinGroupString: Exit");
-    return ocResult;
-}
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationJoinGroupObject(JNIEnv *env, jobject interfaceObject,
-        jobject jResource, jobject jResourceHandle)
-{
-    LOGI("JNIGroupSynchronizationJoinGroupObject: Enter");
-
-    if ((!jResource) || (!jResourceHandle))
-    {
-        LOGE("JNIGroupSynchronizationJoinGroupObject: jResource or jResourceHandle is NULL!");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    OCStackResult ocResult = OC_STACK_ERROR;
-
-    std::shared_ptr<OCResource> ocResource;
-    JniOcResource *jniOcResource = JniOcResource::getJniOcResourcePtr(env, jResource);
-    if (jniOcResource)
-    {
-        ocResource = jniOcResource->getOCResource();
-    }
-
-    if (NULL == ocResource.get())
-    {
-        LOGE("JNIGroupSynchronizationJoinGroupObject: Failed to get OCResource object!");
-        return ocResult;
-    }
-
-    JniOcResourceHandle *jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(env,
-            jResourceHandle);
-
-    try
-    {
-        OCResourceHandle resHandle = jniOcResourceHandle->getOCResourceHandle();
-
-        ocResult = g_GroupSynchronization.joinGroup(ocResource, resHandle);
-        if (OC_STACK_OK != ocResult)
-        {
-            LOGE("JNIGroupSynchronizationJoinGroupObject: joinGroup failed!");
-            return ocResult;
-        }
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationJoinGroupObject: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-        return ocResult;
-    }
-    LOGI("JNIGroupSynchronizationJoinGroupObject: Exit");
-    return ocResult;
-}
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationLeaveGroup(JNIEnv *env, jobject interfaceObject,
-        jstring jResourceType,
-        jobject jResourceHandle)
-{
-    LOGI("JNIGroupSynchronizationLeaveGroup: Enter");
-
-    if ((!jResourceType) || (!jResourceHandle))
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroup: jResourceType or jResourceHandle is NULL!");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    OCStackResult ocResult = OC_STACK_ERROR;
-
-    const char *resourceTypePointer = env->GetStringUTFChars(jResourceType, NULL);
-    if (NULL == resourceTypePointer)
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroup: Failed to convert jstring to char string!");
-        return OC_STACK_NO_MEMORY;
-    }
-
-    std::string resourceType(resourceTypePointer);
-    JniOcResourceHandle *jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(env,
-            jResourceHandle);
-
-    try
-    {
-        OCResourceHandle ocResourceHandle = jniOcResourceHandle->getOCResourceHandle();
-
-        ocResult = g_GroupSynchronization.leaveGroup(resourceType, ocResourceHandle);
-        if (OC_STACK_OK != ocResult)
-        {
-            LOGE("JNIGroupSynchronizationLeaveGroup: leaveGroup failed!");
-        }
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroup: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-    }
-    env->ReleaseStringUTFChars(jResourceType, resourceTypePointer);
-    LOGI("JNIGroupSynchronizationLeaveGroup: Exit");
-    return ocResult;
-}
-
-JNIEXPORT jint JNICALL JNIGroupSynchronizationLeaveGroupForResource(JNIEnv *env,
-        jobject interfaceObject,
-        jobject jResource,
-        jstring jResourceType,
-        jobject jResourceHandle)
-{
-    LOGI("JNIGroupSynchronizationLeaveGroupForResource: Enter");
-
-    if ((!jResource) || (!jResourceType) || (!jResourceHandle))
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroupForResource: jResourceType or jResourceHandle is NULL!");
-        return OC_STACK_INVALID_PARAM;
-    }
-
-    OCStackResult ocResult = OC_STACK_ERROR;
-
-    JniOcResource *jniOcResource = JniOcResource::getJniOcResourcePtr(env, jResource);
-    if (NULL == jniOcResource)
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroupForResource: Failed to get jni OcResource!");
-        return ocResult;
-    }
-
-    std::shared_ptr<OCResource> ocResource = jniOcResource->getOCResource();
-    if (NULL == ocResource.get())
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroupForResource: Failed to get OCResource object!");
-        return ocResult;
-    }
-
-    const char *resourceTypePointer = env->GetStringUTFChars(jResourceType, NULL);
-    if (NULL == resourceTypePointer)
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroupForResource: Failed to convert jstring to char string!");
-        return OC_STACK_NO_MEMORY;
-    }
-
-    std::string resourceType(resourceTypePointer);
-    JniOcResourceHandle *jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(env,
-            jResourceHandle);
-
-    try
-    {
-        OCResourceHandle ocResourceHandle = jniOcResourceHandle->getOCResourceHandle();
-
-        ocResult = g_GroupSynchronization.leaveGroup(ocResource, resourceType, ocResourceHandle);
-        if (OC_STACK_OK != ocResult)
-        {
-            LOGE("JNIGroupSynchronizationLeaveGroupForResource: leaveGroup failed!");
-        }
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationLeaveGroupForResource: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-    }
-
-    env->ReleaseStringUTFChars(jResourceType, resourceTypePointer);
-    LOGI("JNIGroupSynchronizationLeaveGroupForResource: Exit");
-    return ocResult;
-}
-
-JNIEXPORT void JNICALL JNIGroupSynchronizationDeleteGroup(JNIEnv *env, jobject interfaceObject,
-        jstring jcollectionResourceType)
-{
-    LOGI("JNIGroupSynchronizationDeleteGroup: Enter");
-
-    if (!jcollectionResourceType)
-    {
-        LOGE("JNIGroupSynchronizationDeleteGroup: jcollectionResourceType is NULL!");
-        return;
-    }
-
-    const char *collectionResourceTypePointer = env->GetStringUTFChars(jcollectionResourceType, NULL);
-    if (NULL == collectionResourceTypePointer)
-    {
-        LOGE("JNIGroupSynchronizationDeleteGroup: Failed to convert jstring to char string!");
-        return;
-    }
-
-    std::string collectionResourceType(collectionResourceTypePointer);
-    try
-    {
-        g_GroupSynchronization.deleteGroup(collectionResourceType);
-    }
-    catch (InitializeException &e)
-    {
-        LOGE("JNIGroupSynchronizationDeleteGroup: Exception occurred! %s, %d", e.reason().c_str(),
-             e.code());
-    }
-
-    env->ReleaseStringUTFChars(jcollectionResourceType, collectionResourceTypePointer);
-    LOGI("JNIGroupSynchronizationDeleteGroup: Exit");
-}
-
-JNIEXPORT jobject JNICALL JNIGroupSynchronizationGetGroupList(JNIEnv *env, jobject interfaceObject)
-{
-    LOGI("JNIGroupSynchronizationGetGroupList: Enter");
-
-    std::map< std::string, OCResourceHandle> groupListMap;
-    jobject jGroupListMap;
-
-    groupListMap = g_GroupSynchronization.getGroupList();
-    if (groupListMap.empty())
-    {
-        LOGD("getGroupList Map is empty");
-        return NULL;
-    }
-
-    jclass clazz = env->FindClass("java/util/HashMap");
-    jmethodID init = env->GetMethodID(clazz, "<init>", "()V");
-    jGroupListMap = env->NewObject(clazz, init);
-    jmethodID putMethod = env->GetMethodID(clazz, "put",
-                                           "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
-
-    for (auto it = groupListMap.begin(); it != groupListMap.end(); ++it)
-    {
-        jstring key = (*env).NewStringUTF( (*it).first.c_str() );
-        JniOcResourceHandle *jniOcResourceHandle = new JniOcResourceHandle(((*it).second));
-        jobject value = ocResourceHandleToJava(env, reinterpret_cast<jlong>(jniOcResourceHandle));
-        env->CallObjectMethod(jGroupListMap, putMethod, key, value);
-    }
-
-    LOGI("JNIGroupSynchronizationGetGroupList: Exit");
-    return jGroupListMap;
-}
-
-
diff --git a/service/things-manager/sdk/java/jni/tm/src/jni_group_synchronization_callbacks.cpp b/service/things-manager/sdk/java/jni/tm/src/jni_group_synchronization_callbacks.cpp
deleted file mode 100644 (file)
index 867831b..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-
-#include "jni_group_synchronization_callbacks.h"
-#include "JniOcResource.h"
-#include "GroupSynchronization.h"
-#include "jni_things_manager_jvm.h"
-#include "jni_things_manager_util.h"
-#include "jni_string.h"
-
-#define LOG_TAG "GroupSynchronizationCallbacks"
-
-#define METHOD_ONGROUP_FIND_CALLBACK    "(" TM_SERVICE_OCRESOURCE_TYPE")V"
-
-void GroupSynchronizationCallbacks::onFoundGroup(std::shared_ptr<OC::OCResource> groupResource)
-{
-    LOGI("FindGroup : Enter");
-
-    if (NULL == groupResource.get())
-    {
-        LOGE("FindGroup : Invalid received GroupResource!");
-        return;
-    }
-
-    JNIEnv *env = ThingsManagerJVM::getEnv();
-    if (env == NULL)
-    {
-        LOGE("FindGroup : Getting JNIEnv failed");
-        return;
-    }
-
-    // Get ThingsManagerCallback class reference
-    jclass groupSynchronizationCallbacks = GetJClass(TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH);
-    if (NULL == groupSynchronizationCallbacks)
-    {
-        LOGE("FindGroup : GetJClass TMServiceCallbackInterface failed");
-        ThingsManagerJVM::releaseEnv();
-        return;
-    }
-
-    // Get the ThingsManagerCallback class instance
-    jobject jobjectCallback = GetJObjectInstance(TM_SERVICE_GROUP_SYNCHRONIZATION_CLASS_PATH);
-    if (NULL == jobjectCallback)
-    {
-        LOGE("FindGroup: getInstance failed!");
-        ThingsManagerJVM::releaseEnv();
-        return;
-    }
-
-    // Get onGroupFindCallback method reference
-    jmethodID method_id = env->GetMethodID(groupSynchronizationCallbacks,
-                                           "onGroupFindCallback",
-                                           METHOD_ONGROUP_FIND_CALLBACK);
-    if (NULL == method_id)
-    {
-        LOGE("FindGroup : GetMethodID failed");
-        ThingsManagerJVM::releaseEnv();
-        return;
-    }
-
-    if ((env)->ExceptionCheck())
-    {
-        LOGE("FindGroup : ExceptionCheck failed");
-        ThingsManagerJVM::releaseEnv();
-        return;
-    }
-
-    JniOcResource *jniOcResource = new JniOcResource(groupResource);
-    if (!jniOcResource)
-    {
-        LOGE("FindGroup : groupResource is invalid!");
-        ThingsManagerJVM::releaseEnv();
-        return;
-    }
-
-    jobject resource = OcResourceToJava(env, reinterpret_cast<jlong>(jniOcResource));
-
-    env->CallVoidMethod(jobjectCallback, method_id, resource);
-
-    if ((env)->ExceptionCheck())
-    {
-        LOGE("FindGroup : CallVoidMethod failed");
-        ThingsManagerJVM::releaseEnv();
-        return;
-    }
-
-    ThingsManagerJVM::releaseEnv();
-    LOGI("FindGroup : Exit");
-}
diff --git a/service/things-manager/sdk/java/src/org/iotivity/service/tm/GroupSynchronization.java b/service/things-manager/sdk/java/src/org/iotivity/service/tm/GroupSynchronization.java
deleted file mode 100644 (file)
index 2d461bb..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-/* *****************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-
-/**
- * @file
- * This file contains class which provides functions
- * related to Group Synchronization.
- */
-
-package org.iotivity.service.tm;
-
-import java.util.Map;
-import java.util.Vector;
-
-import org.iotivity.base.OcException;
-import org.iotivity.base.OcResource;
-import org.iotivity.base.OcResourceHandle;
-
-import android.util.Log;
-
-/**
- * This class provides a set of APIs relating to Group Synchronization.
- */
-public class GroupSynchronization {
-
-    private IFindGroupListener          groupListener;
-    private final String                LOG_TAG = this.getClass()
-                                                        .getSimpleName();
-
-    private static GroupSynchronization s_groupSynchronizationInstance;
-
-    // Native methods
-    private static native int nativeFindGroup(
-            Vector<String> collectionResourceTypes);
-
-    private static native int nativeCreateGroup(String collectionResourceType);
-
-    private static native int nativeJoinGroupString(
-            String collectionResourceType, OcResourceHandle resourceHandle);
-
-    private static native int nativeJoinGroupObject(OcResource resource,
-            OcResourceHandle resourceHandle);
-
-    private static native int nativeLeaveGroup(String collectionResourceType,
-            OcResourceHandle resourceHandle);
-
-    private static native int nativeLeaveGroupForResource(OcResource resource,
-            String collectionResourceType, OcResourceHandle resourceHandle);
-
-    private static native void nativeDeleteGroup(String collectionResourceType);
-
-    private static native Map<String, OcResourceHandle> nativeGetGroupList();
-
-    static {
-        System.loadLibrary("gnustl_shared");
-        System.loadLibrary("oc_logger");
-        System.loadLibrary("connectivity_abstraction");
-        System.loadLibrary("ca-interface");
-        System.loadLibrary("octbstack");
-        System.loadLibrary("oc");
-        System.loadLibrary("TGMSDKLibrary");
-        System.loadLibrary("ocstack-jni");
-        System.loadLibrary("things-manager-jni");
-    }
-
-    /**
-     * Function for Getting instance of GroupSynchronization object.
-     *
-     * @return GroupSynchronization instance.
-     */
-    public static GroupSynchronization getInstance() {
-        if (null == s_groupSynchronizationInstance) {
-            s_groupSynchronizationInstance = new GroupSynchronization();
-        }
-        return s_groupSynchronizationInstance;
-    }
-
-    /**
-     * Provides interface for getting group discovery status.
-     */
-    public interface IFindGroupListener {
-        /**
-         * This callback method will be called to notify whether group is found
-         * or not.
-         *
-         * @param resource
-         *            URI of resource.
-         */
-        public void onGroupFindCallback(OcResource resource);
-    }
-
-    /**
-     * Set listener for receiving notification on whether the requested group is
-     * found or not.
-     *
-     * @param listener
-     *            IFindGroupListener to receive group discovery status.
-     */
-    public void setGroupListener(IFindGroupListener listener) {
-        groupListener = listener;
-    }
-
-    /**
-     * API for finding a specific remote group when a resource tries to join a
-     * group.
-     * <p>
-     * IFindGroupListener::onGroupFindCallback will be called to notify whether
-     * requested group found or not.
-     * </p>
-     *
-     * @param resourceTypes
-     *            resource types of a group to find and join
-     *
-     * @return OCStackResult - return value of this API. It returns OC_STACK_OK
-     *         if success.
-     */
-    public OCStackResult findGroup(Vector<String> resourceTypes) {
-        OCStackResult result;
-        if (null == groupListener) {
-            result = OCStackResult.OC_STACK_ERROR;
-        } else {
-            int ordinal = nativeFindGroup(resourceTypes);
-            result = OCStackResult.conversion(ordinal);
-        }
-        return result;
-    }
-
-    /**
-     * API for creating a new group.
-     *
-     * @param resourceType
-     *            resource type of a group to create
-     *
-     * @return OCStackResult - return value of this API. It returns OC_STACK_OK
-     *         if success.
-     */
-    public OCStackResult createGroup(String resourceType) {
-        OCStackResult result;
-        int ordinal = nativeCreateGroup(resourceType);
-        result = OCStackResult.conversion(ordinal);
-        return result;
-    }
-
-    /**
-     * API for joining a group. This API is used when a resource that has a
-     * group tries to find a specific remote resource and makes it join a group.
-     *
-     * @param resourceType
-     *            resource type of a group to join.
-     * @param resourceHandle
-     *            resource handle to join a group.
-     *
-     * @return OCStackResult - return value of this API. It returns OC_STACK_OK
-     *         if success.
-     */
-    public OCStackResult joinGroup(String resourceType,
-            OcResourceHandle resourceHandle) {
-        OCStackResult result;
-
-        int ordinal = nativeJoinGroupString(resourceType, resourceHandle);
-        result = OCStackResult.conversion(ordinal);
-
-        return result;
-    }
-
-    /**
-     * API for joining a group. This API is used when a resource that doesn't
-     * have a group tries to find and join a specific remote group.
-     *
-     * @param resource
-     *            group resource to join.
-     * @param resourceHandle
-     *            resource handle to join a group.
-     *
-     * @return OCStackResult - return value of this API. It returns OC_STACK_OK
-     *         if success.
-     */
-    public OCStackResult joinGroup(OcResource resource,
-            OcResourceHandle resourceHandle) throws OcException {
-
-        OCStackResult result;
-        int ordinal = nativeJoinGroupObject(resource, resourceHandle);
-        result = OCStackResult.conversion(ordinal);
-
-        return result;
-    }
-
-    /**
-     * API for leaving a joined group.
-     *
-     * @param resourceType
-     *            resource type of a group to leave.
-     * @param resourceHandle
-     *            resource handle to leave a group.
-     *
-     * @return OCStackResult - return value of this API. It returns OC_STACK_OK
-     *         if success.
-     */
-    public OCStackResult leaveGroup(String resourceType,
-            OcResourceHandle resourceHandle) {
-
-        OCStackResult result;
-        int ordinal = nativeLeaveGroup(resourceType, resourceHandle);
-        result = OCStackResult.conversion(ordinal);
-
-        return result;
-    }
-
-    /**
-     * API for leaving a joined group.
-     *
-     * @param resource
-     *            resource of a group to leave.
-     * @param resourceType
-     *            resource type of a group to leave.
-     * @param resourceHandle
-     *            resource handle to leave a group.
-     *
-     * @return OCStackResult - return value of this API. It returns OC_STACK_OK
-     *         if success.
-     */
-    public OCStackResult leaveGroup(OcResource resource, String resourceType,
-            OcResourceHandle resourceHandle) {
-
-        OCStackResult result;
-        int ordinal = nativeLeaveGroupForResource(resource, resourceType,
-                resourceHandle);
-        result = OCStackResult.conversion(ordinal);
-
-        return result;
-    }
-
-    /**
-     * API for deleting a group.
-     *
-     * @param collectionResourceType
-     *            resource type of a group to delete.
-     */
-    public void deleteGroup(String collectionResourceType) {
-        nativeDeleteGroup(collectionResourceType);
-    }
-
-    /**
-     * API for getting a list of joined groups.
-     *
-     * @return Returns group resource type and group resource handle as a map
-     *         table.
-     */
-    public Map<String, OcResourceHandle> getGroupList() {
-        return nativeGetGroupList();
-    }
-
-    // ******** JNI UTILITY FUNCTION **********//
-
-    /*
-     * This callback method is called from JNI to notify whether group is found
-     * or not.
-     */
-    public void onGroupFindCallback(OcResource resource) {
-        if (null != groupListener) {
-            Log.i("ThingsManagerCallback : onGroupFindCallback",
-                    "Received Callback from JNI");
-            groupListener.onGroupFindCallback(resource);
-        }
-    }
-}