[IOT-3011] Deprecate PlatformConfig to match C++ 79/25279/4
authorLarry Sachs <larry.j.sachs@intel.com>
Wed, 16 May 2018 20:56:06 +0000 (13:56 -0700)
committerLarry Sachs <larry.j.sachs@intel.com>
Thu, 17 May 2018 18:15:59 +0000 (11:15 -0700)
In OCApi.h constructors for PlatformConfig that take ipAddress and port
as parameters have been deprecated.  These deprecated constructors are
now similarly removed from the JNI code and deprecated in the Java code.
Non-deprecated constructors are now available.

Sample code has been changed to use the new constructors.

Change-Id: I3daa9c4eac0480c8fd8d3be7a5d0a80dada8c902
Signed-off-by: Larry Sachs <larry.j.sachs@intel.com>
37 files changed:
java/examples-android/cloudprovisioningclient/src/main/java/org/iotivity/base/examples/cloudprovisioningclient/CloudProvisioningClient.java
java/examples-android/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java
java/examples-android/devicediscoveryserver/src/main/java/org/iotivity/base/examples/DeviceDiscoveryServer.java
java/examples-android/fridgeclient/src/main/java/org/iotivity/base/examples/FridgeClient.java
java/examples-android/fridgegroupclient/src/main/java/org/iotivity/base/examples/FridgeGroupClient.java
java/examples-android/fridgegroupserver/src/main/java/org/iotivity/base/examples/FridgeGroupServer.java
java/examples-android/fridgeserver/src/main/java/org/iotivity/base/examples/fridgeserver/FridgeServer.java
java/examples-android/groupclient/src/main/java/org/iotivity/base/examples/GroupClient.java
java/examples-android/groupserver/src/main/java/org/iotivity/base/examples/GroupServer.java
java/examples-android/guiclient/src/main/java/org/iotivity/guiclient/OcWorker.java
java/examples-android/presenceclient/src/main/java/org/iotivity/base/examples/PresenceClient.java
java/examples-android/presenceserver/src/main/java/org/iotivity/base/examples/PresenceServer.java
java/examples-android/provisioningclient/src/main/java/org/iotivity/base/examples/provisioningclient/ProvisioningClient.java
java/examples-android/simplebase/src/main/java/org/iotivity/base/examples/BluetoothFragment.java
java/examples-android/simplebase/src/main/java/org/iotivity/base/examples/CloudFragment.java
java/examples-android/simplebase/src/main/java/org/iotivity/base/examples/MessageFragment.java
java/examples-android/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java
java/examples-android/simpleserver/src/main/java/org/iotivity/base/examples/SimpleServer.java
java/examples-java/ocflightserver/src/main/java/org/iotivity/base/examples/OcfLightServer.java
java/examples-java/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java
java/examples-java/simpleclientserver/src/main/java/org/iotivity/base/examples/SimpleClientServer.java
java/examples-java/simpleserver/src/main/java/org/iotivity/base/examples/SimpleServer.java
java/iotivity-android/src/androidTest/java/org/iotivity/base/SmokeTest.java
java/iotivity-android/src/main/java/org/iotivity/base/OcPlatform.java
java/iotivity-android/src/main/java/org/iotivity/base/PlatformConfig.java
java/iotivity-java/src/main/java/org/iotivity/base/OcPlatform.java
java/iotivity-java/src/main/java/org/iotivity/base/PlatformConfig.java
java/jni/JniOcPlatform.cpp
java/jni/JniOcPlatform.h
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java
service/notification/examples/android/NotiConsumerExample/app/src/androidTest/java/org/iotivity/service/ns/sample/consumer/ExampleUnitTest.java
service/notification/examples/android/NotiConsumerExample/app/src/main/java/org/iotivity/service/ns/sample/consumer/ConsumerSample.java
service/notification/examples/android/NotiProviderExample/app/src/androidTest/java/org/iotivity/service/ns/sample/provider/ExampleUnitTest.java
service/notification/examples/android/NotiProviderExample/app/src/main/java/org/iotivity/service/ns/sample/provider/ProviderSample.java
service/resource-container/examples/android/RCSampleServerApp/app/src/main/java/org/iotivity/service/sample/container/ResourceContainerActivity.java
service/resource-encapsulation/examples/android/RESampleClientApp/app/src/main/java/org/iotivity/service/sample/client/MainActivity.java
service/resource-encapsulation/examples/android/RESampleServerApp/app/src/main/java/org/iotivity/service/sample/server/MainActivity.java

index 8bd4a03..5203418 100644 (file)
@@ -601,8 +601,6 @@ public class CloudProvisioningClient extends Activity implements OcAccountManage
                 this,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW, filePath + StringConstants.OIC_CLIENT_CBOR_DB_FILE);
         OcPlatform.Configure(cfg);
         try {
index 28f9a93..bca9e82 100644 (file)
@@ -58,8 +58,6 @@ public class DeviceDiscoveryClient extends Activity implements
                 context,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW
         );
 
index db35c11..7d8a0e9 100644 (file)
@@ -55,8 +55,6 @@ public class DeviceDiscoveryServer extends Activity {
                 context,
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW
         );
 
index 73c69a9..7ecc165 100644 (file)
@@ -77,8 +77,6 @@ public class FridgeClient extends Activity implements
                 this, // context
                 ServiceType.IN_PROC,
                 ModeType.CLIENT,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW);
 
         logMessage("Configuring platform");
index f659493..362431e 100644 (file)
@@ -67,8 +67,6 @@ public class FridgeGroupClient extends Activity implements
                 this, // context
                 ServiceType.IN_PROC,
                 ModeType.CLIENT,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW);
 
         logMessage("Configuring platform");
index 4ee0aca..2c4ed8f 100644 (file)
@@ -60,8 +60,6 @@ public class FridgeGroupServer extends Activity {
                 this, // context
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW);
         OcPlatform.Configure(cfg);
 
index 5f0c962..a46215b 100644 (file)
@@ -60,8 +60,6 @@ public class FridgeServer extends Activity {
                 this, //context
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW);
         logMessage("Configuring platform");
         OcPlatform.Configure(cfg);
index 36bc4f2..c808148 100644 (file)
@@ -69,7 +69,6 @@ public class GroupClient extends Activity implements
                 context,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT,
-                "0.0.0.0", 0,
                 QualityOfService.LOW
         );
 
index 4569bc4..6a0448c 100644 (file)
@@ -67,7 +67,6 @@ public class GroupServer extends Activity implements OcPlatform.OnResourceFoundL
                 context,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0", 0,
                 QualityOfService.LOW
         );
 
index cb049a6..f8d0e44 100644 (file)
@@ -452,8 +452,6 @@ public class OcWorker extends Thread
                 mContext,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW);
 
         Log.d(TAG, "configurePlatform(): calling OcPlatform.Configure()");
index d2fad1e..616bda6 100644 (file)
@@ -64,8 +64,6 @@ public class PresenceClient extends Activity implements
                 context,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW
         );
 
index fefd053..1520f14 100644 (file)
@@ -58,8 +58,6 @@ public class PresenceServer extends Activity {
                 context,
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW
         );
 
index 4a10e58..9c3af76 100644 (file)
@@ -284,8 +284,6 @@ OcSecureResource.DoOwnershipTransferListener, OcSecureResource.ProvisionPairwise
                 this,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.LOW, filePath + StringConstants.OIC_CLIENT_CBOR_DB_FILE);
         OcPlatform.Configure(cfg);
 
index 21e727e..c881f92 100644 (file)
@@ -131,8 +131,6 @@ public class BluetoothFragment extends Fragment implements
         PlatformConfig cfg = new PlatformConfig(mActivity, mContext,
                                                 ServiceType.IN_PROC,
                                                 ModeType.CLIENT,
-                                                Common.IP_ADDRESS,
-                                                Common.IP_PORT,
                                                 QualityOfService.LOW);
 
         OcPlatform.Configure(cfg);
index 41819e2..860d536 100644 (file)
@@ -153,8 +153,6 @@ public class CloudFragment extends Fragment implements
         PlatformConfig cfg = new PlatformConfig(mActivity, mContext,
                 ServiceType.IN_PROC,
                 type,
-                Common.IP_ADDRESS,
-                Common.IP_PORT,
                 mQos);
         OcPlatform.Configure(cfg);
     }
index f118bf2..ef850e2 100644 (file)
@@ -517,8 +517,6 @@ public class MessageFragment extends Fragment implements OcResource.OnGetListene
         PlatformConfig cfg = new PlatformConfig(mActivity, mContext,
                 ServiceType.IN_PROC,
                 type,
-                Common.IP_ADDRESS,
-                Common.IP_PORT,
                 mQos);
         OcPlatform.Configure(cfg);
     }
index fa77326..afdf6cc 100644 (file)
@@ -88,8 +88,6 @@ public class SimpleClient extends Activity implements
                 context,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW
         );
         msg("Configuring platform.");
index 1571ef7..e78e30c 100644 (file)
@@ -69,8 +69,6 @@ public class SimpleServer extends Activity {
                 context,
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW
         );
 
index 30b290d..8f15419 100644 (file)
@@ -88,7 +88,7 @@ public class OcfLightServer {
             System.exit(-1);
         }
 
-        PlatformConfig platformConfig = new PlatformConfig(ServiceType.IN_PROC, ModeType.SERVER, "0.0.0.0", 0,
+        PlatformConfig platformConfig = new PlatformConfig(ServiceType.IN_PROC, ModeType.SERVER,
                 QualityOfService.LOW, securityFile.getAbsolutePath(), introspectionFile.getAbsolutePath());
 
         OcPlatform.Configure(platformConfig);
index 12cea48..8b1c30a 100644 (file)
@@ -76,8 +76,6 @@ public class SimpleClient implements
         PlatformConfig platformConfig = new PlatformConfig(
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW,
                 path + "/oic_svr_db_client.dat"
         );
index 8d9a402..1d536e5 100644 (file)
@@ -53,7 +53,7 @@ public class SimpleClientServer {
             msg(TAG, e.getMessage() + " unable to find local file path.");
         }
 
-        PlatformConfig platformConfig = new PlatformConfig(ServiceType.IN_PROC, ModeType.CLIENT_SERVER, "0.0.0.0", 0,
+        PlatformConfig platformConfig = new PlatformConfig(ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW,
                 path + "/oic_svr_db_server.dat");
         msg(TAG, "Configuring platform.");
index e1db921..90d9bc7 100644 (file)
@@ -60,8 +60,6 @@ public class SimpleServer {
         PlatformConfig platformConfig = new PlatformConfig(
                 ServiceType.IN_PROC,
                 ModeType.SERVER,
-                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-                0,         // Uses randomly available port
                 QualityOfService.LOW,
                 path + "/oic_svr_db_server.dat",
                 path + "/simpleserver_introspection.dat"
index e3c54a7..158aac2 100644 (file)
@@ -49,8 +49,6 @@ public class SmokeTest extends InstrumentationTestCase {
                 getInstrumentation().getContext(),
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0",
-                0,
                 QualityOfService.LOW);
 
         OcPlatform.Configure(cfg);
index 66ddfa4..4df5814 100644 (file)
@@ -99,8 +99,6 @@ public final class OcPlatform {
             OcPlatform.configure(
                     platformConfig.getServiceType().getValue(),
                     platformConfig.getModeType().getValue(),
-                    platformConfig.getIpAddress(),
-                    platformConfig.getPort(),
                     platformConfig.getQualityOfService().getValue(),
                     platformConfig.getSvrDbPath(),
                     platformConfig.getIntrospectionPath(),
@@ -119,8 +117,6 @@ public final class OcPlatform {
 
     private static native void configure(int serviceType,
                                          int modeType,
-                                         String ipAddress,
-                                         int port,
                                          int qualityOfService,
                                          String dbPath,
                                          String introspectionPath,
index 434df67..3effa77 100644 (file)
@@ -33,8 +33,6 @@ public class PlatformConfig {
     private Context mContext;
     private ServiceType mServiceType;
     private ModeType mModeType;
-    private String mIpAddress;
-    private int mPort;
     private QualityOfService mQualityOfService;
     private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
                               //this is only for 0.9.2
@@ -46,16 +44,15 @@ public class PlatformConfig {
      * @param context            app context
      * @param serviceType        indicate IN_PROC or OUT_OF_PROC
      * @param modeType           indicate whether we want to do server, client or both
-     * @param ipAddress          ip address of server
-     *                           if you specify 0.0.0.0 : it listens on any interface
-     * @param port               port of server
-     *                           if you specifiy 0 : next available random port is used
-     *                           if you specify 5683 : client discovery can work even if they don't
-     *                           specify port
+     * @param ipAddress          not used
+     * @param port               not used
      * @param qualityOfService   quality of service
-     * @param dbPath             Persistant storage file for SVR Database.
-     * @param introspectionPath  Persistant storage file for introspection data.
+     * @param dbPath             Persistent storage file for SVR Database.
+     * @param introspectionPath  Persistent storage file for introspection data.
+     *
+     * @deprecated ipAddress and port are no longer used
      */
+    @Deprecated
     public PlatformConfig(Activity activity,
                           Context context,
                           ServiceType serviceType,
@@ -65,16 +62,13 @@ public class PlatformConfig {
                           QualityOfService qualityOfService,
                           String dbPath,
                           String introspectionPath) {
-        this.mActivity=activity;
-        this.mContext = context;
-        this.mServiceType = serviceType;
-        this.mModeType = modeType;
-        this.mIpAddress = ipAddress;
-        this.mPort = port;
-        this.mQualityOfService = qualityOfService;
-        this.mSvrDbPath = dbPath;
-        this.mIntrospectPath = introspectionPath;
-        this.mTransportType = 0;
+        mActivity = activity;
+        mContext = context;
+        mServiceType = serviceType;
+        mModeType = modeType;
+        mQualityOfService = qualityOfService;
+        mSvrDbPath = dbPath;
+        mIntrospectPath = introspectionPath;
     }
 
     /**
@@ -82,15 +76,14 @@ public class PlatformConfig {
      * @param context          app context
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
      * @param modeType         indicate whether we want to do server, client or both
-     * @param ipAddress        ip address of server
-     *                         if you specify 0.0.0.0 : it listens on any interface
-     * @param port             port of server
-     *                         if you specifiy 0 : next available random port is used
-     *                         if you specify 5683 : client discovery can work even if they don't
-     *                         specify port
+     * @param ipAddress        not used
+     * @param port             not used
      * @param qualityOfService quality of service
-     * @param dbPath           Persistant storage file for SVR Database.
+     * @param dbPath           Persistent storage file for SVR Database.
+     *
+     * @deprecated ipAddress and port are no longer used
      */
+    @Deprecated
     public PlatformConfig(Activity activity,
                           Context context,
                           ServiceType serviceType,
@@ -99,30 +92,26 @@ public class PlatformConfig {
                           int port,
                           QualityOfService qualityOfService,
                           String dbPath) {
-        this.mActivity=activity;
-        this.mContext = context;
-        this.mServiceType = serviceType;
-        this.mModeType = modeType;
-        this.mIpAddress = ipAddress;
-        this.mPort = port;
-        this.mQualityOfService = qualityOfService;
-        this.mSvrDbPath = dbPath;
-        this.mTransportType = 0;
+        mActivity = activity;
+        mContext = context;
+        mServiceType = serviceType;
+        mModeType = modeType;
+        mQualityOfService = qualityOfService;
+        mSvrDbPath = dbPath;
     }
 
     /**
      * @param context          app context
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
      * @param modeType         indicate whether we want to do server, client or both
-     * @param ipAddress        ip address of server
-     *                         if you specify 0.0.0.0 : it listens on any interface
-     * @param port             port of server
-     *                         if you specifiy 0 : next available random port is used
-     *                         if you specify 5683 : client discovery can work even if they don't
-     *                         specify port
+     * @param ipAddress        not used
+     * @param port             not used
      * @param qualityOfService quality of service
-     * @param dbPath           Persistant storage file for SVR Database.
+     * @param dbPath           Persistent storage file for SVR Database.
+     *
+     * @deprecated ipAddress and port are no longer used
      */
+    @Deprecated
     public PlatformConfig(Context context,
                           ServiceType serviceType,
                           ModeType modeType,
@@ -130,21 +119,20 @@ public class PlatformConfig {
                           int port,
                           QualityOfService qualityOfService,
                           String dbPath) {
-        this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath);
+        this(null, context, serviceType, modeType, ipAddress, port, qualityOfService, dbPath);
     }
 
     /**
      * @param context          app context
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
      * @param modeType         indicate whether we want to do server, client or both
-     * @param ipAddress        ip address of server
-     *                         if you specify 0.0.0.0 : it listens on any interface
-     * @param port             port of server
-     *                         if you specifiy 0 : next available random port is used
-     *                         if you specify 5683 : client discovery can work even if they don't
-     *                         specify port
+     * @param ipAddress        not used
+     * @param port             not used
      * @param qualityOfService quality of service
+     *
+     * @deprecated ipAddress and port are no longer used
      */
+    @Deprecated
     // Avoid breaking building java samples due to persistent storage SVR DB changes.
     public PlatformConfig(Context context,
                           ServiceType serviceType,
@@ -152,7 +140,7 @@ public class PlatformConfig {
                           String ipAddress,
                           int port,
                           QualityOfService qualityOfService) {
-        this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
+        this(null, context, serviceType, modeType, ipAddress, port, qualityOfService, "");
     }
 
     /**
@@ -160,14 +148,13 @@ public class PlatformConfig {
      * @param context          app context
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
      * @param modeType         indicate whether we want to do server, client or both
-     * @param ipAddress        ip address of server
-     *                         if you specify 0.0.0.0 : it listens on any interface
-     * @param port             port of server
-     *                         if you specifiy 0 : next available random port is used
-     *                         if you specify 5683 : client discovery can work even if they don't
-     *                         specify port
+     * @param ipAddress        not used
+     * @param port             not used
      * @param qualityOfService quality of service
+     *
+     * @deprecated ipAddress and port are no longer used
      */
+    @Deprecated
     // Avoid breaking building java samples due to persistent storage SVR DB changes.
     public PlatformConfig(Activity activity,
                           Context context,
@@ -176,8 +163,111 @@ public class PlatformConfig {
                           String ipAddress,
                           int port,
                           QualityOfService qualityOfService) {
-        this(activity,context,serviceType,modeType,ipAddress,port,qualityOfService, "");
+        this(activity, context, serviceType, modeType, ipAddress, port, qualityOfService, "");
     }
+
+    /**
+     * @param activity           app activity
+     * @param context            app context
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     * @param dbPath             Persistent storage file for SVR Database.
+     * @param introspectionPath  Persistent storage file for introspection data.
+     */
+    public PlatformConfig(Activity activity,
+                          Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService,
+                          String dbPath,
+                          String introspectionPath) {
+        mActivity = activity;
+        mContext = context;
+        mServiceType = serviceType;
+        mModeType = modeType;
+        mQualityOfService = qualityOfService;
+        mSvrDbPath = dbPath;
+        mIntrospectPath = introspectionPath;
+    }
+
+    /**
+     * @param activity           app activity
+     * @param context            app context
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     * @param dbPath             Persistent storage file for SVR Database.
+     */
+    public PlatformConfig(Activity activity,
+                          Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService,
+                          String dbPath) {
+        this(activity, context, serviceType, modeType, qualityOfService, dbPath, null);
+    }
+
+    /**
+     * @param activity           app activity
+     * @param context            app context
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     */
+    public PlatformConfig(Activity activity,
+                          Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService) {
+        this(activity, context, serviceType, modeType, qualityOfService, "", null);
+    }
+
+    /**
+     * @param context            app context
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     * @param dbPath             Persistent storage file for SVR Database.
+     * @param introspectionPath  Persistent storage file for introspection data.
+     */
+    public PlatformConfig(Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService,
+                          String dbPath,
+                          String introspectionPath) {
+        this(null, context, serviceType, modeType, qualityOfService, dbPath, introspectionPath);
+    }
+
+    /**
+     * @param context            app context
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     * @param dbPath             Persistent storage file for SVR Database.
+     */
+    public PlatformConfig(Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService,
+                          String dbPath) {
+        this(null, context, serviceType, modeType, qualityOfService, dbPath, null);
+    }
+
+    /**
+     * @param context            app context
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     */
+    public PlatformConfig(Context context,
+                          ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService) {
+        this(null, context, serviceType, modeType, qualityOfService, "", null);
+    }
+
     public Context getContext() {
         return mContext;
     }
@@ -190,14 +280,6 @@ public class PlatformConfig {
         return mModeType;
     }
 
-    public String getIpAddress() {
-        return mIpAddress;
-    }
-
-    public int getPort() {
-        return mPort;
-    }
-
     public QualityOfService getQualityOfService() {
         return mQualityOfService;
     }
index d69acf8..ffb7b8c 100644 (file)
@@ -93,8 +93,6 @@ public final class OcPlatform {
             OcPlatform.configure(
                     platformConfig.getServiceType().getValue(),
                     platformConfig.getModeType().getValue(),
-                    platformConfig.getIpAddress(),
-                    platformConfig.getPort(),
                     platformConfig.getQualityOfService().getValue(),
                     platformConfig.getSvrDbPath(),
                     platformConfig.getIntrospectionPath(),
@@ -113,8 +111,6 @@ public final class OcPlatform {
 
     private static native void configure(int serviceType,
                                          int modeType,
-                                         String ipAddress,
-                                         int port,
                                          int qualityOfService,
                                          String dbPath,
                                          String introspectionPath,
index 99e655a..bf6d611 100644 (file)
@@ -30,8 +30,6 @@ import java.util.EnumSet;
 public class PlatformConfig {
     private ServiceType mServiceType;
     private ModeType mModeType;
-    private String mIpAddress;
-    private int mPort;
     private QualityOfService mQualityOfService;
     private String mSvrDbPath; //TODO: Instead of SVRDB file, it should be Persistent Storage.
                               //this is only for 0.9.2
@@ -41,97 +39,121 @@ public class PlatformConfig {
     /**
      * @param serviceType        indicate IN_PROC or OUT_OF_PROC
      * @param modeType           indicate whether we want to do server, client or both
-     * @param ipAddress          ip address of server
-     *                           if you specify 0.0.0.0 : it listens on any interface
-     * @param port               port of server
-     *                           if you specifiy 0 : next available random port is used
-     *                           if you specify 5683 : client discovery can work even if they don't
-     *                           specify port
+     * @param ipAddress          not used
+     * @param port               not used
      * @param qualityOfService   quality of service
-     * @param dbPath             Persistant storage file for SVR Database.
-     * @param introspectionPath  Persistant storage file for introspection data.
+     * @param dbPath             Persistent storage file for SVR Database.
+     * @param introspectionPath  Persistent storage file for introspection data.
+     *
+     * @deprecated ipAddress and port are no longer used
      */
-    public PlatformConfig(
-                          ServiceType serviceType,
+    @Deprecated
+    public PlatformConfig(ServiceType serviceType,
                           ModeType modeType,
                           String ipAddress,
                           int port,
                           QualityOfService qualityOfService,
                           String dbPath,
                           String introspectionPath) {
-        this.mServiceType = serviceType;
-        this.mModeType = modeType;
-        this.mIpAddress = ipAddress;
-        this.mPort = port;
-        this.mQualityOfService = qualityOfService;
-        this.mSvrDbPath = dbPath;
-        this.mIntrospectPath = introspectionPath;
-        this.mTransportType = 0;
+        mServiceType = serviceType;
+        mModeType = modeType;
+        mQualityOfService = qualityOfService;
+        mSvrDbPath = dbPath;
+        mIntrospectPath = introspectionPath;
     }
 
     /**
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
      * @param modeType         indicate whether we want to do server, client or both
-     * @param ipAddress        ip address of server
-     *                         if you specify 0.0.0.0 : it listens on any interface
-     * @param port             port of server
-     *                         if you specifiy 0 : next available random port is used
-     *                         if you specify 5683 : client discovery can work even if they don't
-     *                         specify port
+     * @param ipAddress        not used
+     * @param port             not used
      * @param qualityOfService quality of service
-     * @param dbPath           Persistant storage file for SVR Database.
+     * @param dbPath           Persistent storage file for SVR Database.
+     *
+     * @deprecated ipAddress and port are no longer used
      */
-    public PlatformConfig(
-                          ServiceType serviceType,
+    @Deprecated
+    public PlatformConfig(ServiceType serviceType,
                           ModeType modeType,
                           String ipAddress,
                           int port,
                           QualityOfService qualityOfService,
                           String dbPath) {
-        this.mServiceType = serviceType;
-        this.mModeType = modeType;
-        this.mIpAddress = ipAddress;
-        this.mPort = port;
-        this.mQualityOfService = qualityOfService;
-        this.mSvrDbPath = dbPath;
-        this.mTransportType = 0;
+        mServiceType = serviceType;
+        mModeType = modeType;
+        mQualityOfService = qualityOfService;
+        mSvrDbPath = dbPath;
     }
 
     /**
      * @param serviceType      indicate IN_PROC or OUT_OF_PROC
      * @param modeType         indicate whether we want to do server, client or both
-     * @param ipAddress        ip address of server
-     *                         if you specify 0.0.0.0 : it listens on any interface
-     * @param port             port of server
-     *                         if you specifiy 0 : next available random port is used
-     *                         if you specify 5683 : client discovery can work even if they don't
-     *                         specify port
+     * @param ipAddress        not used
+     * @param port             not used
      * @param qualityOfService quality of service
+     *
+     * @deprecated ipAddress and port are no longer used
      */
+    @Deprecated
     // Avoid breaking building java samples due to persistent storage SVR DB changes.
-    public PlatformConfig(
-                          ServiceType serviceType,
+    public PlatformConfig(ServiceType serviceType,
                           ModeType modeType,
                           String ipAddress,
                           int port,
                           QualityOfService qualityOfService) {
-        this(serviceType,modeType,ipAddress,port,qualityOfService, "");
+        this(serviceType, modeType, qualityOfService, "");
     }
 
-    public ServiceType getServiceType() {
-        return mServiceType;
+
+    /**
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     */
+    public PlatformConfig(ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService) {
+        this(serviceType, modeType, qualityOfService, "");
     }
 
-    public ModeType getModeType() {
-        return mModeType;
+    /**
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     * @param dbPath             Persistent storage file for SVR Database.
+     */
+    public PlatformConfig(ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService,
+                          String dbPath) {
+        this(serviceType, modeType, qualityOfService, dbPath, null);
+    }
+
+    /**
+     * @param serviceType        indicate IN_PROC or OUT_OF_PROC
+     * @param modeType           indicate whether we want to do server, client or both
+     * @param qualityOfService   quality of service
+     * @param dbPath             Persistent storage file for SVR Database.
+     * @param introspectionPath  Persistent storage file for introspection data.
+     */
+    public PlatformConfig(ServiceType serviceType,
+                          ModeType modeType,
+                          QualityOfService qualityOfService,
+                          String dbPath,
+                          String introspectionPath) {
+        mServiceType = serviceType;
+        mModeType = modeType;
+        mQualityOfService = qualityOfService;
+        mSvrDbPath = dbPath;
+        mIntrospectPath = introspectionPath;
     }
 
-    public String getIpAddress() {
-        return mIpAddress;
+    public ServiceType getServiceType() {
+        return mServiceType;
     }
 
-    public int getPort() {
-        return mPort;
+    public ModeType getModeType() {
+        return mModeType;
     }
 
     public QualityOfService getQualityOfService() {
@@ -145,7 +167,7 @@ public class PlatformConfig {
     public String getIntrospectionPath() {
         return mIntrospectPath;
     }
-    
+
     public void setAvailableTransportType(EnumSet<OcConnectivityType> type) {
         for (OcConnectivityType connType : OcConnectivityType.values()) {
             if (type.contains(connType))
index 41366ca..ed41591 100644 (file)
@@ -474,19 +474,14 @@ void RemoveOnObserveListener(JNIEnv* env, jobject jListener)
 * Signature: (IILjava/lang/String;IILjava/lang/String;Ljava/lang/String;I)V
 */
 JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_configure
-(JNIEnv *env, jclass clazz, jint jServiceType, jint jModeType, jstring jIpAddress, jint jPort,
+(JNIEnv *env, jclass clazz, jint jServiceType, jint jModeType,
  jint jQOS, jstring jDbPath, jstring jIntrospectionPath, jint jTransport)
 {
     OC_UNUSED(clazz);
     LOGI("OcPlatform_configure");
 
-    std::string ipAddress;
     std::string dbfile;
     std::string introspectionfile;
-    if (jIpAddress)
-    {
-        ipAddress = env->GetStringUTFChars(jIpAddress, nullptr);
-    }
     if (jDbPath)
     {
         dbfile = env->GetStringUTFChars(jDbPath, nullptr);
@@ -497,27 +492,13 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_configure
         introspectionfile = env->GetStringUTFChars(jIntrospectionPath, nullptr);
         JniOcSecurity::StoreIntrospection(introspectionfile);
     }
-    uint16_t port = 0;
-    if (jPort > 0)
-    {
-        port = static_cast<uint16_t>(jPort);
-    }
-#if defined(__GNUC__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
     PlatformConfig cfg{
         JniUtils::getServiceType(env, jServiceType),
         JniUtils::getModeType(env, jModeType),
-        ipAddress,
-        port,
         JniUtils::getOCTransportAdapter(jTransport),
         JniUtils::getQOS(env, static_cast<int>(jQOS)),
         JniOcSecurity::getOCPersistentStorage()
     };
-#if defined(__GNUC__)
-#pragma GCC diagnostic pop
-#endif
     OCPlatform::Configure(cfg);
 }
 
index 8c5f88a..2440c7c 100644 (file)
@@ -70,10 +70,10 @@ extern "C" {
     /*
     * Class:     org_iotivity_base_OcPlatform
     * Method:    configure
-    * Signature: (IILjava/lang/String;IILjava/lang/String;Ljava/lang/String;I)V
+    * Signature: (IIILjava/lang/String;Ljava/lang/String;I)V
     */
     JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_configure
-        (JNIEnv *, jclass, jint, jint, jstring, jint, jint, jstring, jstring, jint);
+        (JNIEnv *, jclass, jint, jint, jint, jstring, jstring, jint);
 
     /*
     * Class:     org_iotivity_base_OcPlatform
index d75845d..8993fd0 100644 (file)
@@ -350,8 +350,6 @@ public class EasysetupActivity extends Activity
                 this,
                 ServiceType.IN_PROC,
                 ModeType.CLIENT_SERVER,
-                "0.0.0.0", // bind to all available interfaces
-                0,
                 QualityOfService.HIGH, filePath + OIC_CLIENT_JSON_DB_FILE);
         try {
             /*
index a4186df..ca898cf 100644 (file)
@@ -194,10 +194,8 @@ public class ExampleUnitTest extends ApplicationTestCase<Application> {
 
     @BeforeClass
     public static void Initialize() {
-        String ipAddress = "0.0.0.0";
         PlatformConfig platformConfig = new PlatformConfig(mContext,
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, ipAddress,
-                0, // Uses randomly available port
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW);
 
         OcPlatform.Configure(platformConfig);
index 2544fa0..362a6ef 100644 (file)
@@ -70,10 +70,8 @@ public class ConsumerSample
     }
 
     private void configurePlatform() {
-        String ipAddress = "0.0.0.0";
         PlatformConfig platformConfig = new PlatformConfig(mContext,
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, ipAddress,
-                0, // Uses randomly available port
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW);
 
         Log.i(TAG, "Configuring platform.");
index f359653..8c9d4b1 100644 (file)
@@ -111,10 +111,8 @@ public class ExampleUnitTest extends ApplicationTestCase<Application> {
 
     @BeforeClass
     public static void Initialize() {
-        String ipAddress = "0.0.0.0";
         PlatformConfig platformConfig = new PlatformConfig(mContext,
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, ipAddress,
-                0, // Uses randomly available port
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW);
 
         OcPlatform.Configure(platformConfig);
index 8a4ae95..993a09e 100644 (file)
@@ -74,10 +74,8 @@ public class ProviderSample
     }
 
     private void configurePlatform() {
-        String ipAddress = "0.0.0.0";
         PlatformConfig platformConfig = new PlatformConfig(mContext,
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, ipAddress,
-                0, // Uses randomly available port
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW);
 
         Log.i(TAG, "Configuring platform.");
index 51e78fe..6b5fb31 100644 (file)
@@ -461,7 +461,7 @@ public class ResourceContainerActivity extends Activity {
 
     private void configurePlatform() {
         OcPlatform.Configure(new PlatformConfig(getApplicationContext(),
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, "0.0.0.0", 0,
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW));
         Log.i(LOG_TAG, "Configuration done successfully");
     }
index b9eefeb..b03d901 100644 (file)
@@ -84,9 +84,8 @@ public class MainActivity extends Activity {
     }
 
     private void configurePlatform() {
-        String ipAddress = "0.0.0.0";
         OcPlatform.Configure(new PlatformConfig(getApplicationContext(),
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, ipAddress, 0,
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW));
 
         Log.i(LOG_TAG, "Configuration done Successfully");
index fe7170f..1c1ef33 100644 (file)
@@ -84,9 +84,8 @@ public class MainActivity extends Activity {
     }
 
     private void configurePlatform() {
-        String ipAddress = "0.0.0.0";
         OcPlatform.Configure(new PlatformConfig(getApplicationContext(),
-                ServiceType.IN_PROC, ModeType.CLIENT_SERVER, ipAddress, 0,
+                ServiceType.IN_PROC, ModeType.CLIENT_SERVER,
                 QualityOfService.LOW));
         Log.i(LOG_TAG, "Configuration done successfully");
     }