diff --git a/README.md b/README.md index ce22748..0eaef57 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 ``` @@ -54,7 +65,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/build/debian/otgc_native.sh b/build/debian/otgc_native.sh index b8e697a..6d0dfcf 100755 --- a/build/debian/otgc_native.sh +++ b/build/debian/otgc_native.sh @@ -11,21 +11,23 @@ # Constants PROJECT_NAME="otgc" -VERSION="2.1.0" +VERSION="2.2.0" 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 diff --git a/extlibs/iotivity-lite b/extlibs/iotivity-lite index d301b81..66a2d08 160000 --- a/extlibs/iotivity-lite +++ b/extlibs/iotivity-lite @@ -1 +1 @@ -Subproject commit d301b81dc3ce39f477318be219ede1d9ab835940 +Subproject commit 66a2d08784903110b7dead5b9a518933a355e1e6 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/pom.xml b/pom.xml index 0831b6c..1643df0 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ otgc otgc - 2.1.0 + 2.2.0 UTF-8 @@ -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/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); } }); } 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))); } } 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 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 @@ - - + + 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