From a7bad9a798a9d6398d6f65f3dff707e523044221 Mon Sep 17 00:00:00 2001 From: ipatini Date: Tue, 2 Apr 2024 20:41:39 +0300 Subject: [PATCH] Resource Manager: Copied changes from branch 'add-sal-connectivity' Change-Id: I9b39e95b117331e0b5d764938b7701c183986fba --- .../.mvn/wrapper/maven-wrapper.properties | 2 +- resource-discovery/Dockerfile | 13 +- resource-discovery/pom.xml | 81 +++- resource-discovery/run.sh | 2 +- .../ResourceDiscoveryProperties.java | 7 + .../broker_communication/BrokerPublisher.java | 110 ++++++ .../BrokerSubscriber.java | 194 ++++++++++ .../BrokerSubscriptionDetails.java | 79 ++++ .../CustomConnectorHandler.java | 24 ++ .../ExtendedConnector.java | 99 +++++ .../broker_communication/JsonFileParser.java | 27 ++ .../broker_communication/SALCommunicator.java | 355 ++++++++++++++++++ .../SynchronousBrokerPublisher.java | 149 ++++++++ .../discovery/monitor/DeviceProcessor.java | 10 + .../DeviceManagementController.java | 4 + .../discovery/monitor/model/Device.java | 2 + .../service/DeviceManagementService.java | 2 + .../UnknownDeviceRegistrationService.java | 14 +- .../RegistrationRequestProcessor.java | 6 +- .../discovery/registration/model/Device.java | 1 + .../model/RegistrationRequest.java | 7 +- .../service/SALRegistrationService.java | 117 ++++++ .../src/main/resources/application.yml | 7 + .../archived-device-view.html | 7 + .../archived-request-view.html | 7 + .../freebees_webdesign_6/device-view.html | 7 + .../freebees_webdesign_6/request-edit.html | 7 + 27 files changed, 1317 insertions(+), 23 deletions(-) create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/BrokerPublisher.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/BrokerSubscriber.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/BrokerSubscriptionDetails.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/CustomConnectorHandler.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/ExtendedConnector.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/JsonFileParser.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/SALCommunicator.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/broker_communication/SynchronousBrokerPublisher.java create mode 100644 resource-discovery/src/main/java/eu/nebulous/resource/discovery/registration/service/SALRegistrationService.java diff --git a/resource-discovery/.mvn/wrapper/maven-wrapper.properties b/resource-discovery/.mvn/wrapper/maven-wrapper.properties index 2e76e18..e70e7bc 100644 --- a/resource-discovery/.mvn/wrapper/maven-wrapper.properties +++ b/resource-discovery/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/resource-discovery/Dockerfile b/resource-discovery/Dockerfile index 7f2a763..4f1e381 100644 --- a/resource-discovery/Dockerfile +++ b/resource-discovery/Dockerfile @@ -1,9 +1,6 @@ -ARG BUILDER_IMAGE=docker.io/library/maven:3.9.5-eclipse-temurin-17 -ARG RUN_IMAGE=docker.io/library/eclipse-temurin:17.0.8.1_1-jre - # ----------------- Builder image ----------------- -FROM docker.io/library/maven:3.9.5-eclipse-temurin-17 as rd-builder +FROM docker.io/library/maven:3.9.6-eclipse-temurin-21 as rd-builder ENV BASEDIR /app WORKDIR ${BASEDIR} COPY src ${BASEDIR}/src @@ -13,7 +10,7 @@ RUN mvn -f ${BASEDIR}/pom.xml -DskipTests clean install && \ java -Djarmode=layertools -jar ${BASEDIR}/target/resource-discovery-*.jar extract # ----------------- Runtime image ----------------- -FROM docker.io/library/eclipse-temurin:17.0.8.1_1-jre +FROM docker.io/library/eclipse-temurin:21.0.1_12-jre # Setup environment ENV BASEDIR /opt/resource-discovery @@ -26,9 +23,9 @@ RUN wget --progress=dot:giga -O /usr/local/bin/dumb-init \ # Add RD user ARG RD_USER=rd -RUN mkdir ${RD_HOME} ; \ - addgroup ${RD_USER} ; \ - adduser --home ${RD_HOME} --no-create-home --ingroup ${RD_USER} --disabled-password ${RD_USER} ; \ +RUN mkdir ${RD_HOME} && \ + addgroup ${RD_USER} && \ + adduser --home ${RD_HOME} --no-create-home --ingroup ${RD_USER} --disabled-password ${RD_USER} && \ chown ${RD_USER}:${RD_USER} ${RD_HOME} # Set User and Workdir diff --git a/resource-discovery/pom.xml b/resource-discovery/pom.xml index bf395bb..ff87f62 100644 --- a/resource-discovery/pom.xml +++ b/resource-discovery/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.4 + 3.2.1 @@ -17,11 +17,19 @@ Nebulous resource discovery service - 17 + 21 ${project.artifactId}:${project.version} + + + eu.nebulouscloud + exn-connector-java + 1.0-SNAPSHOT + + + org.springframework.boot spring-boot-starter-security @@ -45,12 +53,12 @@ org.projectlombok lombok - 1.18.26 + 1.18.30 org.apache.commons commons-lang3 - 3.13.0 + 3.14.0 @@ -72,6 +80,57 @@ com.fasterxml.jackson.datatype jackson-datatype-jsr310 + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + + commons-io + commons-io + 2.15.1 + + + + org.apache.httpcomponents + httpcore + 4.4.16 + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + org.apache.httpcomponents + httpmime + 4.5.14 + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-logging + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + + + @@ -79,7 +138,7 @@ org.yaml snakeyaml - 2.0 + 2.2 @@ -93,6 +152,18 @@ + + + + maven-central + https://repo1.maven.org/maven2/ + + + nexus-nebulous + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + + +
+ +
+ +
+
diff --git a/resource-discovery/src/main/resources/static/freebees_webdesign_6/archived-request-view.html b/resource-discovery/src/main/resources/static/freebees_webdesign_6/archived-request-view.html index 16d70ba..ea9e61d 100644 --- a/resource-discovery/src/main/resources/static/freebees_webdesign_6/archived-request-view.html +++ b/resource-discovery/src/main/resources/static/freebees_webdesign_6/archived-request-view.html @@ -300,6 +300,13 @@ function flattenObject(ob) {
+ +
+ +
+ +
+
diff --git a/resource-discovery/src/main/resources/static/freebees_webdesign_6/device-view.html b/resource-discovery/src/main/resources/static/freebees_webdesign_6/device-view.html index 37b9a9c..c39924e 100644 --- a/resource-discovery/src/main/resources/static/freebees_webdesign_6/device-view.html +++ b/resource-discovery/src/main/resources/static/freebees_webdesign_6/device-view.html @@ -404,6 +404,13 @@ function sendDeviceData(deviceData) {
+ +
+ +
+ +
+
diff --git a/resource-discovery/src/main/resources/static/freebees_webdesign_6/request-edit.html b/resource-discovery/src/main/resources/static/freebees_webdesign_6/request-edit.html index 05dd881..20266ce 100644 --- a/resource-discovery/src/main/resources/static/freebees_webdesign_6/request-edit.html +++ b/resource-discovery/src/main/resources/static/freebees_webdesign_6/request-edit.html @@ -458,6 +458,13 @@ function sendRequestData(requestData) {
+ +
+ +
+ +
+