cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, ))
exampleAclFiles = jdk_env.Install('#java/examples-java/simpleserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
+exampleAclFiles += jdk_env.Install('#java/examples-java/simpleclientserver/build/libs/', 'examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat')
Depends(cmdBuildExamples, exampleAclFiles)
Depends(cmdBuildExamples, cmdBuildApi)
import org.iotivity.base.QualityOfService;
import org.iotivity.base.ServiceType;
+import java.net.URISyntaxException;
import java.util.LinkedList;
import java.util.List;
private static final String TAG = SimpleClientServer.class.getSimpleName();
public static void main(String[] args) {
+ String path = "";
+ // This assumes the oic_svr_db_server.dat file is in the same location as the SimpleServer.jar file
+ try {
+ path = SimpleServer.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
+ path = path.substring(0, path.lastIndexOf('/'));
+ } catch (URISyntaxException e) {
+ 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,
- QualityOfService.LOW);
+ QualityOfService.LOW,
+ path + "/oic_svr_db_server.dat");
msg(TAG, "Configuring platform.");
OcPlatform.Configure(platformConfig);