Fix for Jira issue: IOT-1252
authorSandipan Patra <sandipan.p@samsung.com>
Tue, 27 Sep 2016 12:49:56 +0000 (18:19 +0530)
committerUze Choi <uzchoi@samsung.com>
Wed, 28 Sep 2016 23:26:08 +0000 (23:26 +0000)
Simulator error codes compatible with OC stack error codes

Change-Id: If03fff46fae4144db4318c5e5d95c97c9ae377fd
Signed-off-by: Sandipan Patra <sandipan.p@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/12381
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/simulator/inc/simulator_error_codes.h [changed mode: 0644->0755]
service/simulator/java/eclipse-plugin/ClientControllerPlugin/src/oic/simulator/clientcontroller/manager/ResourceManager.java [changed mode: 0644->0755]
service/simulator/java/jni/simulator_utils_jni.cpp [changed mode: 0644->0755]
service/simulator/java/sdk/src/org/oic/simulator/SimulatorResult.java [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0bacb54..254af62
@@ -30,6 +30,7 @@ typedef enum
     SIMULATOR_RESOURCE_CREATED,
     SIMULATOR_RESOURCE_DELETED,
     SIMULATOR_CONTINUE,
+    SIMULATOR_RESOURCE_CHANGED,
     SIMULATOR_INVALID_URI = 20,
     SIMULATOR_INVALID_QUERY,
     SIMULATOR_INVALID_IP,
@@ -57,6 +58,11 @@ typedef enum
     SIMULATOR_INVALID_DEVICE_INFO,
     SIMULATOR_INVALID_JSON,
     SIMULATOR_UNAUTHORIZED_REQ,
+    SIMULATOR_TOO_LARGE_REQ,
+    SIMULATOR_PDM_IS_NOT_INITIALIZED,
+    SIMULATOR_DUPLICATE_UUID,
+    SIMULATOR_INCONSISTENT_DB,
+    SIMULATOR_AUTHENTICATION_FAILURE,
 #ifdef WITH_PRESENCE
     SIMULATOR_PRESENCE_STOPPED = 128,
     SIMULATOR_PRESENCE_TIMEOUT,
old mode 100644 (file)
new mode 100755 (executable)
index 5590881..b8ddf79
@@ -320,7 +320,7 @@ public class ResourceManager {
             public void onGetResponse(final String uid,
                     final SimulatorResult result,
                     final SimulatorResourceModel resourceModelN) {
-                if (result != SimulatorResult.SIMULATOR_OK) {
+                if (result.ordinal() > SimulatorResult.SIMULATOR_RESOURCE_CHANGED.ordinal()) {
                     Activator
                             .getDefault()
                             .getLogManager()
@@ -354,7 +354,7 @@ public class ResourceManager {
             public void onPutResponse(final String uid,
                     final SimulatorResult result,
                     final SimulatorResourceModel resourceModelN) {
-                if (result != SimulatorResult.SIMULATOR_OK) {
+                if (result.ordinal() > SimulatorResult.SIMULATOR_RESOURCE_CHANGED.ordinal()) {
                     Activator
                             .getDefault()
                             .getLogManager()
@@ -387,7 +387,7 @@ public class ResourceManager {
             public void onPostResponse(final String uid,
                     final SimulatorResult result,
                     final SimulatorResourceModel resourceModelN) {
-                if (result != SimulatorResult.SIMULATOR_OK) {
+                if (result.ordinal() > SimulatorResult.SIMULATOR_RESOURCE_CHANGED.ordinal()) {
                     Activator
                             .getDefault()
                             .getLogManager()
old mode 100644 (file)
new mode 100755 (executable)
index ce154f7..eea25cf
@@ -48,6 +48,12 @@ jobject SimulatorResultToJava(JNIEnv *env, SimulatorResult errorCode)
                                           "SIMULATOR_CONTINUE", "Lorg/oic/simulator/SimulatorResult;");
                 return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
             }
+        case SIMULATOR_RESOURCE_CHANGED:
+        {
+            static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
+                                      "SIMULATOR_RESOURCE_CHANGED", "Lorg/oic/simulator/SimulatorResult;");
+            return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
+        }
         case SIMULATOR_INVALID_URI:
             {
                 static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
@@ -210,6 +216,36 @@ jobject SimulatorResultToJava(JNIEnv *env, SimulatorResult errorCode)
                                           "SIMULATOR_UNAUTHORIZED_REQ", "Lorg/oic/simulator/SimulatorResult;");
                 return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
             }
+        case SIMULATOR_TOO_LARGE_REQ:
+            {
+                static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
+                                          "SIMULATOR_TOO_LARGE_REQ", "Lorg/oic/simulator/SimulatorResult;");
+                return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
+            }
+        case SIMULATOR_PDM_IS_NOT_INITIALIZED:
+            {
+                static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
+                                          "SIMULATOR_PDM_IS_NOT_INITIALIZED", "Lorg/oic/simulator/SimulatorResult;");
+                return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
+            }
+        case SIMULATOR_DUPLICATE_UUID:
+            {
+                static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
+                                          "SIMULATOR_DUPLICATE_UUID", "Lorg/oic/simulator/SimulatorResult;");
+                return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
+            }
+        case SIMULATOR_INCONSISTENT_DB:
+            {
+                static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
+                                          "SIMULATOR_INCONSISTENT_DB", "Lorg/oic/simulator/SimulatorResult;");
+                return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
+            }
+        case SIMULATOR_AUTHENTICATION_FAILURE:
+            {
+                static jfieldID fieldID = env->GetStaticFieldID(gSimulatorClassRefs.simulatorResultCls,
+                                          "SIMULATOR_AUTHENTICATION_FAILURE", "Lorg/oic/simulator/SimulatorResult;");
+                return env->GetStaticObjectField(gSimulatorClassRefs.simulatorResultCls, fieldID);
+            }
 #ifdef WITH_PRESENCE
         case SIMULATOR_PRESENCE_STOPPED:
             {
old mode 100644 (file)
new mode 100755 (executable)
index 96de7e3..0e4a9ab
@@ -21,7 +21,13 @@ package org.oic.simulator;
  */
 public enum SimulatorResult {
     /** STACK error codes - START */
-    SIMULATOR_OK, SIMULATOR_RESOURCE_CREATED, SIMULATOR_RESOURCE_DELETED, SIMULATOR_CONTINUE, SIMULATOR_INVALID_URI, SIMULATOR_INVALID_QUERY, SIMULATOR_INVALID_IP, SIMULATOR_INVALID_PORT, SIMULATOR_INVALID_CALLBACK, SIMULATOR_INVALID_METHOD, SIMULATOR_INVALID_PARAM, SIMULATOR_INVALID_OBSERVE_PARAM, SIMULATOR_NO_MEMORY, SIMULATOR_COMM_ERROR, SIMULATOR_TIMEOUT, SIMULATOR_ADAPTER_NOT_ENABLED, SIMULATOR_NOTIMPL, SIMULATOR_NO_RESOURCE, SIMULATOR_RESOURCE_ERROR, SIMULATOR_SLOW_RESOURCE, SIMULATOR_DUPLICATE_REQUEST, SIMULATOR_NO_OBSERVERS, SIMULATOR_OBSERVER_NOT_FOUND, SIMULATOR_VIRTUAL_DO_NOT_HANDLE, SIMULATOR_INVALID_OPTION, SIMULATOR_MALFORMED_RESPONSE, SIMULATOR_PERSISTENT_BUFFER_REQUIRED, SIMULATOR_INVALID_REQUEST_HANDLE, SIMULATOR_INVALID_DEVICE_INFO, SIMULATOR_INVALID_JSON, SIMULATOR_UNAUTHORIZED_REQ,
+    SIMULATOR_OK, SIMULATOR_RESOURCE_CREATED, SIMULATOR_RESOURCE_DELETED, SIMULATOR_CONTINUE, SIMULATOR_RESOURCE_CHANGED, SIMULATOR_INVALID_URI, SIMULATOR_INVALID_QUERY, SIMULATOR_INVALID_IP, SIMULATOR_INVALID_PORT, SIMULATOR_INVALID_CALLBACK, SIMULATOR_INVALID_METHOD, SIMULATOR_INVALID_PARAM, SIMULATOR_INVALID_OBSERVE_PARAM, SIMULATOR_NO_MEMORY, SIMULATOR_COMM_ERROR, SIMULATOR_TIMEOUT, SIMULATOR_ADAPTER_NOT_ENABLED, SIMULATOR_NOTIMPL, SIMULATOR_NO_RESOURCE, SIMULATOR_RESOURCE_ERROR, SIMULATOR_SLOW_RESOURCE, SIMULATOR_DUPLICATE_REQUEST, SIMULATOR_NO_OBSERVERS, SIMULATOR_OBSERVER_NOT_FOUND, SIMULATOR_VIRTUAL_DO_NOT_HANDLE, SIMULATOR_INVALID_OPTION, SIMULATOR_MALFORMED_RESPONSE, SIMULATOR_PERSISTENT_BUFFER_REQUIRED, SIMULATOR_INVALID_REQUEST_HANDLE, SIMULATOR_INVALID_DEVICE_INFO, SIMULATOR_INVALID_JSON, SIMULATOR_UNAUTHORIZED_REQ, SIMULATOR_TOO_LARGE_REQ,
+
+    /** Error code from PDM */
+    SIMULATOR_PDM_IS_NOT_INITIALIZED, SIMULATOR_DUPLICATE_UUID, SIMULATOR_INCONSISTENT_DB,
+
+    /** Error code from OTM */
+    SIMULATOR_AUTHENTICATION_FAILURE,
 
     SIMULATOR_PRESENCE_STOPPED, SIMULATOR_PRESENCE_TIMEOUT, SIMULATOR_PRESENCE_DO_NOT_HANDLE,
     /** STACK error codes - END */