Added Cloud provisioning java class 39/11339/23
authorRandeep Singh <randeep.s@samsung.com>
Fri, 2 Sep 2016 11:35:18 +0000 (17:05 +0530)
committerRandeep Singh <randeep.s@samsung.com>
Thu, 29 Sep 2016 05:27:09 +0000 (05:27 +0000)
Change-Id: I57a37af84f2202051d99627cfbc18bad6de5d8e4
Signed-off-by: Randeep Singh <randeep.s@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11339
Reviewed-by: sandeep sharma <sandeep.s9@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java [new file with mode: 0755]

diff --git a/android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java b/android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java
new file mode 100755 (executable)
index 0000000..9b73305
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ *******************************************************************
+ *
+ * Copyright 2016 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.
+ *
+ *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ */
+
+package org.iotivity.base;
+
+import java.util.List;
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.ArrayList;
+
+
+
+/**
+ * OcCloudProvisioning class is responsible for providing methods for cloud
+ * provisioning.
+ */
+public class  OcCloudProvisioning {
+
+    private long    mNativeHandle;
+    private String mIp;
+    private int mPort;
+
+   /**
+    * API to construct the CloudProvisioning
+    *
+    * @param ipAddr address of the cloud server
+    * @param port port of the cloud server
+    */
+    public OcCloudProvisioning(String ip, int port) {
+        this.mIp = ip;
+        this.mPort = port;
+    }
+
+    public String getIP() {
+        return mIp;
+    }
+
+    public int getPort() {
+        return mPort;
+    }
+
+    private void setNativeHandle(long nativeHandle) {
+        this.mNativeHandle = nativeHandle;
+    }
+
+    public interface RequestCertificateListener {
+        public void requestCertificateListener(boolean result);
+    }
+
+    public interface GetAclIdByDeviceListener {
+        public void getAclIdByDeviceListener(boolean result,String aclId);
+    }
+
+    public interface GetIndividualAclInfoListener {
+        public void getIndividualAclInfoListener(boolean result);
+    }
+
+    public interface GetCRLListener {
+        public void getCRLListener(boolean result);
+    }
+
+    public interface PostCRLListener  {
+        public void postCRLListener(boolean result);
+    }
+
+   /**
+    * Method to Request a certificate from the cloud
+    * @param certificateIssueRequestListener function called by the stack on completion of request.
+    * @throws OcException
+    */
+    public native void requestCertificate(
+            RequestCertificateListener certificateIssueRequestListener) throws OcException;
+
+   /**
+    * Method to get ACL ID for the device
+    * @param deviceId device ID for which the Acl ID is requested
+    * @param cloudAclIdGetByDeviceHandler function called by the stack on completion of request.
+    * @throws OcException
+    */
+    public native void getAclIdByDevice(String deviceId,
+            GetAclIdByDeviceListener cloudAclIdGetByDeviceHandler) throws OcException;
+
+   /**
+    * Method to get ACL information about the given Acl ID
+    * @param aclId ACL ID for which the Acl information is requested
+    * @param cloudAclIndividualGetInfoHandler function called by the stack on completion of request.
+    * @throws OcException
+    */
+    public native void getIndividualAclInfo(String aclId,
+            GetIndividualAclInfoListener cloudAclIndividualGetInfoHandler) throws OcException;
+
+   /**
+    * Method to get certificate revocation list
+    * @param cloudGetCRLHandler function called by the stack on completion of request.
+    * @throws OcException
+    */
+    public native void getCRL(GetCRLListener cloudGetCRLHandler)
+            throws OcException;
+
+   /**
+    * Method to post the  certificate revocation list to cloud
+    * @param thisUpdate thisUpdate [mandatory param].
+    * @param nextUpdate nextUpdate [mandatory param].
+    * @param crl revocation list [optional].
+    * @param serialNumbers [optional].
+    * @param cloudPostCRLHandler function called by the stack on completion of request.
+    * @throws OcException
+    */
+    public native void postCRL0(String thisUpdate, String nextUpdate, String crl, ArrayList<String> serialNumbers,
+                                    PostCRLListener cloudPostCRLHandler) throws OcException;
+}
+