From 682b23592b8f7e332b22daf20265648ea2c4b18e Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Mon, 14 Oct 2019 10:58:46 +0200 Subject: [PATCH 1/8] Update IoTivity-lite library --- README.md | 1 - extlibs/iotivity-lite | 2 +- extlibs/patchs/fix_oc_api.patch | 13 ------------- .../otgc/data/repository/CmsRepository.java | 7 +++---- 4 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 extlibs/patchs/fix_oc_api.patch diff --git a/README.md b/README.md index d6351e6..149951c 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,6 @@ git checkout swig 2. Apply all patchs of the OTGC in IoTivity-lite ``` git apply /extlibs/patchs/remove_cred_by_credid.patch -git apply /extlibs/patchs/fix_oc_api.patch ``` 3. Go to the linux directory. ``` diff --git a/extlibs/iotivity-lite b/extlibs/iotivity-lite index d301b81..6b886cc 160000 --- a/extlibs/iotivity-lite +++ b/extlibs/iotivity-lite @@ -1 +1 @@ -Subproject commit d301b81dc3ce39f477318be219ede1d9ab835940 +Subproject commit 6b886cc7731c4f8f3f8ccbb62d0e33b27f7f727a diff --git a/extlibs/patchs/fix_oc_api.patch b/extlibs/patchs/fix_oc_api.patch deleted file mode 100644 index 439ca33..0000000 --- a/extlibs/patchs/fix_oc_api.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/swig/swig_interfaces/oc_api.i b/swig/swig_interfaces/oc_api.i -index e600456c..47ff85cb 100644 ---- a/swig/swig_interfaces/oc_api.i -+++ b/swig/swig_interfaces/oc_api.i -@@ -1372,7 +1372,7 @@ bool jni_oc_init_post(const char *uri, oc_endpoint_t *endpoint, const char *quer - OC_DBG("JNI - initPost failed releasing jni_sync_lock"); - OC_DBG("JNI: - unlock %s\n", __func__); - } -- return returnValue -+ return returnValue; - } - %} - diff --git a/src/main/java/org/openconnectivity/otgc/data/repository/CmsRepository.java b/src/main/java/org/openconnectivity/otgc/data/repository/CmsRepository.java index 8187c53..8015d11 100644 --- a/src/main/java/org/openconnectivity/otgc/data/repository/CmsRepository.java +++ b/src/main/java/org/openconnectivity/otgc/data/repository/CmsRepository.java @@ -276,9 +276,7 @@ public Completable provisionRoleCertificate(String deviceId, String roleId, Stri return Completable.create(emitter -> { OCUuid di = OCUuidUtil.stringToUuid(deviceId); - OCRole role = new OCRole(); - role.setRole(roleId); - role.setAuthority(roleAuthority); + OCRole roles = OCObt.addRoleId(null, roleId, roleAuthority); OCObtStatusHandler handler = (int status) -> { if (status >= 0) { @@ -289,9 +287,10 @@ public Completable provisionRoleCertificate(String deviceId, String roleId, Stri } }; - int ret = OCObt.provisionRoleCertificate(role, di, handler); + int ret = OCObt.provisionRoleCertificate(roles, di, handler); if (ret < 0) { emitter.onError(new IOException("Provision role certificate error")); + OCObt.freeRoleId(roles); } }); } From 3b3e5fd8b45ee0cbf2ad1b9163d965f6e9b3a981 Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Mon, 14 Oct 2019 10:59:35 +0200 Subject: [PATCH 2/8] Fix to set endpoint to delete an ACE --- .../otgc/domain/usecase/accesscontrol/DeleteAclUseCase.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openconnectivity/otgc/domain/usecase/accesscontrol/DeleteAclUseCase.java b/src/main/java/org/openconnectivity/otgc/domain/usecase/accesscontrol/DeleteAclUseCase.java index 4e9772d..0324f31 100644 --- a/src/main/java/org/openconnectivity/otgc/domain/usecase/accesscontrol/DeleteAclUseCase.java +++ b/src/main/java/org/openconnectivity/otgc/domain/usecase/accesscontrol/DeleteAclUseCase.java @@ -45,8 +45,8 @@ public class DeleteAclUseCase { public Completable execute(Device device, long aceId) { return iotivityRepository.getSecureEndpoint(device) .flatMapCompletable(endpoint -> - pstatRepository.changeDeviceStatus(device.getIpv6SecureHost(), device.getDeviceId(), OcfDosType.OC_DOSTYPE_RFPRO) - .andThen(amsRepository.deleteAcl(device.getIpv6SecureHost(), device.getDeviceId(), aceId)) - .andThen(pstatRepository.changeDeviceStatus(device.getIpv6SecureHost(), device.getDeviceId(), OcfDosType.OC_DOSTYPE_RFNOP))); + pstatRepository.changeDeviceStatus(endpoint, device.getDeviceId(), OcfDosType.OC_DOSTYPE_RFPRO) + .andThen(amsRepository.deleteAcl(endpoint, device.getDeviceId(), aceId)) + .andThen(pstatRepository.changeDeviceStatus(endpoint, device.getDeviceId(), OcfDosType.OC_DOSTYPE_RFNOP))); } } From 3562238b0fae231e86617dd20b0faecc95888361 Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Mon, 14 Oct 2019 11:10:24 +0200 Subject: [PATCH 3/8] Change OIC string by IoTivity-lite --- src/main/resources/properties/Strings_en.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/properties/Strings_en.properties b/src/main/resources/properties/Strings_en.properties index fac7195..7f8adae 100644 --- a/src/main/resources/properties/Strings_en.properties +++ b/src/main/resources/properties/Strings_en.properties @@ -73,8 +73,8 @@ settings.label.discovery_scope=Multicast IPv6 scope settings.title.discovery_scope=Select IPv6 scope settings.label.requests_delay=Requests delay # Main -main.init_oic_stack.success=OIC Stack initialized -main.init_oic_stack.error=Error initializing OIC Stack +main.init_oic_stack.success=IoTivity-lite stack initialized +main.init_oic_stack.error=Error initializing IoTivity-lite stack # Device List devicelist.scan.load=Scanning devices... devicelist.scan.success=Scanning devices finished From 841a5f9d7e9f0e679d4fa77c93795fc7af32dd74 Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Mon, 14 Oct 2019 11:55:10 +0200 Subject: [PATCH 4/8] Fix build warnings --- README.md | 13 ++++++++++++- pom.xml | 18 ++---------------- .../constant/OcfResourceAttributeKey.java | 5 ++--- .../otgc/utils/constant/OcfResourceUri.java | 5 ++--- .../otgc/utils/constant/OtgcConstant.java | 6 ++---- 5 files changed, 20 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 149951c..760affd 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,18 @@ To import the IoTivity-lite API Binary into the OTGC Linux App project: 4. Copy **libiotivity-lite.so** into <otgc-linux>/lib/jni -5. Add the following command, to link the previous libraries with iotivity.jar, in the run/debug configuration: +5. Install iotivity-lite.jar into the local Maven repository +``` +mvn install:install-file \ + -Dfile=lib/iotivity-lite.jar \ + -DgroupId=org.iotivity \ + -DartifactId=iotivity-lite \ + -Dversion=1.0 \ + -Dpackaging=jar \ + -DgeneratePom=true +``` + +6. Add the following command, to link the previous libraries with iotivity.jar, in the run/debug configuration: ``` -Djava.library.path=/lib/jni ``` diff --git a/pom.xml b/pom.xml index 0831b6c..311bf78 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,7 @@ - ${build.directory}/jfx/app/lib + ${project.build.directory}/jfx/app/lib false false true @@ -98,8 +98,6 @@ org.iotivity iotivity-lite 1.0 - system - ${project.basedir}/lib/iotivity-lite.jar @@ -168,25 +166,19 @@ hsqldb 2.4.0 + junit junit 4.12 test - org.hamcrest hamcrest-junit 2.0.0.0 test - - junit - junit - 4.11 - test - org.mockito @@ -238,11 +230,5 @@ cbor 3.3.0 - - junit - junit - 4.12 - test - \ No newline at end of file diff --git a/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceAttributeKey.java b/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceAttributeKey.java index c92aa2c..0c5ff16 100644 --- a/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceAttributeKey.java +++ b/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceAttributeKey.java @@ -19,12 +19,11 @@ package org.openconnectivity.otgc.utils.constant; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; public class OcfResourceAttributeKey { - private OcfResourceAttributeKey() { - throw new NotImplementedException(); + private OcfResourceAttributeKey() throws Exception { + throw new Exception("Static class"); } /* Resource base */ diff --git a/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceUri.java b/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceUri.java index 137beef..c49623c 100644 --- a/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceUri.java +++ b/src/main/java/org/openconnectivity/otgc/utils/constant/OcfResourceUri.java @@ -19,12 +19,11 @@ package org.openconnectivity.otgc.utils.constant; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; public class OcfResourceUri { - private OcfResourceUri() { - throw new NotImplementedException(); + private OcfResourceUri() throws Exception { + throw new Exception("Static class"); } // URIs diff --git a/src/main/java/org/openconnectivity/otgc/utils/constant/OtgcConstant.java b/src/main/java/org/openconnectivity/otgc/utils/constant/OtgcConstant.java index 1e3d524..917e21a 100644 --- a/src/main/java/org/openconnectivity/otgc/utils/constant/OtgcConstant.java +++ b/src/main/java/org/openconnectivity/otgc/utils/constant/OtgcConstant.java @@ -19,14 +19,12 @@ package org.openconnectivity.otgc.utils.constant; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; - import java.io.File; public class OtgcConstant { - private OtgcConstant() { - throw new NotImplementedException(); + private OtgcConstant() throws Exception { + throw new Exception("Static class"); } // Data resource path From 6aabf58eefd4b3abb6f6c053fe5d48afaa8040a8 Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Tue, 15 Oct 2019 14:30:00 +0200 Subject: [PATCH 5/8] Add architecure as a parameter to build the OTGC --- build/debian/otgc_native.sh | 21 ++++++++++++------- build/debian/{control => template_control.sh} | 14 ++++++++++--- 2 files changed, 25 insertions(+), 10 deletions(-) rename build/debian/{control => template_control.sh} (55%) mode change 100644 => 100755 diff --git a/build/debian/otgc_native.sh b/build/debian/otgc_native.sh index b8e697a..5468f4d 100755 --- a/build/debian/otgc_native.sh +++ b/build/debian/otgc_native.sh @@ -17,15 +17,17 @@ program=$0 function usage() { - echo "usage: $program app_path" + echo "usage: $program app_path arch" echo " path Path to assets, libraries and application jar" + echo " arch Target architecture (see values with the command dpkg-architecture -L)" exit 1 } -if [ $# -ne 1 ] ; then +if [ $# -ne 2 ] ; then usage else path=$1 + arch=$2 mkdir $(pwd)/out @@ -40,12 +42,17 @@ else mkdir -p $(pwd)/out/$PROJECT_NAME-$VERSION/usr/share/applications # item desktop # Copy configuration and script files to DEBIAN folder - if [ -e "$(pwd)/control" ] + if [ -e "$(pwd)/template_control.sh" ] then - cp $(pwd)/control $(pwd)/out/$PROJECT_NAME-$VERSION/DEBIAN - else - echo "Control file does not exist." - exit 1 + chmod 755 $(pwd)/template_control.sh + if [ -e "$(pwd)/out/control" ] + then + rm $(pwd)/out/control + fi + $(pwd)/template_control.sh "$VERSION" $arch > $(pwd)/out/control + chmod 755 $(pwd)/out/control + cp $(pwd)/out/control $(pwd)/out/$PROJECT_NAME-$VERSION/DEBIAN + rm $(pwd)/out/control fi # Pre-Installation script if [ -e "$(pwd)/template_preinst.sh" ] diff --git a/build/debian/control b/build/debian/template_control.sh old mode 100644 new mode 100755 similarity index 55% rename from build/debian/control rename to build/debian/template_control.sh index 1c794e6..04e9f76 --- a/build/debian/control +++ b/build/debian/template_control.sh @@ -1,9 +1,17 @@ +#!/bin/bash + +# Define parameters which are passed in +VERSION=$1 +ARCH=$2 + +# Define the template +cat << EOF Package: OTGC -Version: 2.1.0 +Version: $VERSION Section: custom Priority: optional -Architecture: amd64 +Architecture: $ARCH Pre-Depends: openjdk-8-jdk, openjfx Maintainer: DEKRA Testing and Certification, S.A.U. Description: Onboarding Tool and Generic Client. - +EOF From fd4b5eee1ac2bb55230e85f229f21a061efdceca Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Tue, 15 Oct 2019 14:31:28 +0200 Subject: [PATCH 6/8] Fix to resize the list of resources in the Access Control view --- .../view/accesscontrol/AccessControlView.fxml | 82 +++++++++---------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/src/main/resources/org/openconnectivity/otgc/view/accesscontrol/AccessControlView.fxml b/src/main/resources/org/openconnectivity/otgc/view/accesscontrol/AccessControlView.fxml index 0f01dce..04e3dcb 100644 --- a/src/main/resources/org/openconnectivity/otgc/view/accesscontrol/AccessControlView.fxml +++ b/src/main/resources/org/openconnectivity/otgc/view/accesscontrol/AccessControlView.fxml @@ -1,15 +1,20 @@ - - - - - - + + - - + + + + + + + + + + + - + - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - + @@ -120,8 +116,8 @@ - - + + From 2c2a28ad927af8c16cd8a56d9ad783f9df4c955c Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Tue, 15 Oct 2019 15:46:11 +0200 Subject: [PATCH 7/8] Change IoTivity-lite to the tag for OTGC v2.2.0 --- extlibs/iotivity-lite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extlibs/iotivity-lite b/extlibs/iotivity-lite index 6b886cc..66a2d08 160000 --- a/extlibs/iotivity-lite +++ b/extlibs/iotivity-lite @@ -1 +1 @@ -Subproject commit 6b886cc7731c4f8f3f8ccbb62d0e33b27f7f727a +Subproject commit 66a2d08784903110b7dead5b9a518933a355e1e6 From a3829142ccbd71ea35a0660c4a594817621ab8b7 Mon Sep 17 00:00:00 2001 From: Javier Guerra Melgares Date: Tue, 15 Oct 2019 15:46:55 +0200 Subject: [PATCH 8/8] Change version to 2.2.0 --- build/debian/otgc_native.sh | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/debian/otgc_native.sh b/build/debian/otgc_native.sh index 5468f4d..6d0dfcf 100755 --- a/build/debian/otgc_native.sh +++ b/build/debian/otgc_native.sh @@ -11,7 +11,7 @@ # Constants PROJECT_NAME="otgc" -VERSION="2.1.0" +VERSION="2.2.0" program=$0 diff --git a/pom.xml b/pom.xml index 311bf78..1643df0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ otgc otgc - 2.1.0 + 2.2.0 UTF-8