summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2019-11-05 13:44:53 +0100
committersebdet <sebastien.determe@intl.att.com>2019-11-05 17:22:09 +0100
commit1b6a428451709a3daa98d0f1cdee49d791985c0d (patch)
tree22166ce7141e5cd47cc7e995bd60803f5cf00cc1 /src/main
parent2901ca9fec4a88db325b90bda2103ffc5e921681 (diff)
Move to JDK 13
Do the required changes to move to JDK 13 Issue-ID: CLAMP-327 Change-Id: Ia7840851eeefc6c00e3e49eacb2e49cc27a0b2f0 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/docker/backend/Dockerfile2
-rw-r--r--src/main/java/org/onap/clamp/clds/exception/policy/PolicyModelException.java31
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java61
-rw-r--r--src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java4
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java4
5 files changed, 27 insertions, 75 deletions
diff --git a/src/main/docker/backend/Dockerfile b/src/main/docker/backend/Dockerfile
index 9e5c8d8b1..625d5a9b9 100644
--- a/src/main/docker/backend/Dockerfile
+++ b/src/main/docker/backend/Dockerfile
@@ -21,7 +21,7 @@
#
###
-FROM openjdk:8u191-jdk-alpine3.9
+FROM openjdk:13-alpine3.10
MAINTAINER "The Onap Team"
LABEL Description="This immage contains alpine, openjdk 11 and clamp"
diff --git a/src/main/java/org/onap/clamp/clds/exception/policy/PolicyModelException.java b/src/main/java/org/onap/clamp/clds/exception/policy/PolicyModelException.java
deleted file mode 100644
index 0b64b78ea..000000000
--- a/src/main/java/org/onap/clamp/clds/exception/policy/PolicyModelException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 Nokia Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.clamp.clds.exception.policy;
-
-public class PolicyModelException extends Exception {
-
- public PolicyModelException(String msg, Throwable throwable) {
- super(msg, throwable);
- }
-}
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
index 20e13bc7c..3e684f425 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/SdcSingleController.java
@@ -33,7 +33,6 @@ import java.util.concurrent.ThreadLocalRandom;
import org.onap.clamp.clds.config.ClampProperties;
import org.onap.clamp.clds.config.sdc.SdcSingleControllerConfiguration;
-import org.onap.clamp.clds.exception.policy.PolicyModelException;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcControllerException;
@@ -160,8 +159,7 @@ public class SdcSingleController {
* @param distributionClient the distribution client
*/
public SdcSingleController(ClampProperties clampProp, CsarInstaller csarInstaller,
- SdcSingleControllerConfiguration sdcSingleConfig,
- IDistributionClient distributionClient) {
+ SdcSingleControllerConfiguration sdcSingleConfig, IDistributionClient distributionClient) {
this.distributionClient = distributionClient;
isSdcClientAutoManaged = (distributionClient == null);
this.sdcConfig = sdcSingleConfig;
@@ -172,8 +170,9 @@ public class SdcSingleController {
/**
* This method initializes the SDC Controller and the SDC Client.
*
- * @throws SdcControllerException It throws an exception if the SDC Client cannot be instantiated or if
- * an init attempt is done when already initialized
+ * @throws SdcControllerException It throws an exception if the SDC Client
+ * cannot be instantiated or if an init attempt
+ * is done when already initialized
*/
public void initSdc() throws SdcControllerException {
logger.info("Attempt to initialize the SDC Controller: " + sdcConfig.getSdcControllerName());
@@ -183,14 +182,12 @@ public class SdcSingleController {
if (distributionClient == null) {
distributionClient = DistributionClientFactory.createDistributionClient();
}
- IDistributionClientResult result = distributionClient.init(sdcConfig,
- new SdcNotificationCallBack(this));
+ IDistributionClientResult result = distributionClient.init(sdcConfig, new SdcNotificationCallBack(this));
if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
logger.error("SDC distribution client init failed with reason:" + result.getDistributionMessageResult());
this.changeControllerStatus(SdcSingleControllerStatus.STOPPED);
- throw new SdcControllerException(
- "Initialization of the SDC Controller failed with reason: "
- + result.getDistributionMessageResult());
+ throw new SdcControllerException("Initialization of the SDC Controller failed with reason: "
+ + result.getDistributionMessageResult());
}
logger.info("SDC Controller successfully initialized: " + sdcConfig.getSdcControllerName());
logger.info("Attempt to start the SDC Controller: " + sdcConfig.getSdcControllerName());
@@ -206,11 +203,12 @@ public class SdcSingleController {
}
/**
- * This method closes the SDC Controller and the SDC Client.
- *
- * @throws SdcControllerException It throws an exception if the SDC Client cannot be closed because
- * it's currently BUSY in processing notifications.
- */
+ * This method closes the SDC Controller and the SDC Client.
+ *
+ * @throws SdcControllerException It throws an exception if the SDC Client
+ * cannot be closed because it's currently BUSY
+ * in processing notifications.
+ */
public void closeSdc() throws SdcControllerException {
if (this.getControllerStatus() == SdcSingleControllerStatus.BUSY) {
throw new SdcControllerException("Cannot close the SDC controller as it's currently in BUSY state");
@@ -229,8 +227,7 @@ public class SdcSingleController {
}
private void sendAllNotificationForCsarHandler(INotificationData notificationData, CsarHandler csar,
- NotificationType notificationType,
- DistributionStatusEnum distributionStatus, String errorMessage) {
+ NotificationType notificationType, DistributionStatusEnum distributionStatus, String errorMessage) {
if (csar != null) {
// Notify for the CSAR
this.sendSdcNotification(notificationType, csar.getArtifactElement().getArtifactURL(),
@@ -244,13 +241,11 @@ public class SdcSingleController {
this.sendSdcNotification(notificationType,
blueprint.getValue().getResourceAttached().getArtifacts().get(0).getArtifactURL(),
sdcConfig.getConsumerID(), notificationData.getDistributionID(), distributionStatus,
- errorMessage,
- System.currentTimeMillis());
+ errorMessage, System.currentTimeMillis());
}
} else {
this.sendSdcNotification(notificationType, null, sdcConfig.getConsumerID(),
- notificationData.getDistributionID(),
- distributionStatus, errorMessage, System.currentTimeMillis());
+ notificationData.getDistributionID(), distributionStatus, errorMessage, System.currentTimeMillis());
}
}
@@ -290,10 +285,6 @@ public class SdcSingleController {
logger.error("SdcDownloadException exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DOWNLOAD,
DistributionStatusEnum.DOWNLOAD_ERROR, e.getMessage());
- } catch (PolicyModelException e) {
- logger.error("PolicyModelException exception caught during the notification processing", e);
- sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DEPLOY,
- DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
} catch (InterruptedException e) {
logger.error("Interrupt exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DEPLOY,
@@ -303,7 +294,7 @@ public class SdcSingleController {
logger.error("Unexpected exception caught during the notification processing", e);
sendAllNotificationForCsarHandler(notificationData, csar, NotificationType.DEPLOY,
DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
- } finally {
+ } finally {
this.changeControllerStatus(SdcSingleControllerStatus.IDLE);
}
}
@@ -320,9 +311,8 @@ public class SdcSingleController {
}
private IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact) throws SdcDownloadException {
- logger.info(
- "Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "
- + artifact.getArtifactUUID());
+ logger.info("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: "
+ + artifact.getArtifactUUID());
IDistributionClientDownloadResult downloadResult;
try {
downloadResult = distributionClient.download(artifact);
@@ -337,19 +327,16 @@ public class SdcSingleController {
logger.info("Successfully downloaded the artifact " + artifact.getArtifactURL() + " UUID "
+ artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length);
} else {
- throw new SdcDownloadException(
- "Artifact " + artifact.getArtifactName() + " could not be downloaded from SDC URL "
- + artifact.getArtifactURL() + " UUID " + artifact.getArtifactUUID() + ")"
- + System.lineSeparator()
- + "Error message is " + downloadResult.getDistributionMessageResult()
- + System.lineSeparator());
+ throw new SdcDownloadException("Artifact " + artifact.getArtifactName()
+ + " could not be downloaded from SDC URL " + artifact.getArtifactURL() + " UUID "
+ + artifact.getArtifactUUID() + ")" + System.lineSeparator() + "Error message is "
+ + downloadResult.getDistributionMessageResult() + System.lineSeparator());
}
return downloadResult;
}
private void sendSdcNotification(NotificationType notificationType, String artifactUrl, String consumerId,
- String distributionId, DistributionStatusEnum status, String errorReason,
- long timestamp) {
+ String distributionId, DistributionStatusEnum status, String errorReason, long timestamp) {
String event = "Sending " + notificationType.name() + "(" + status.name() + ")"
+ " notification to SDC for artifact:" + artifactUrl;
if (errorReason != null) {
diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java
index a1f8897fb..10e2790f6 100644
--- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java
+++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstaller.java
@@ -23,7 +23,6 @@
package org.onap.clamp.clds.sdc.controller.installer;
-import org.onap.clamp.clds.exception.policy.PolicyModelException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
public interface CsarInstaller {
@@ -31,6 +30,5 @@ public interface CsarInstaller {
boolean isCsarAlreadyDeployed(CsarHandler csar) throws SdcArtifactInstallerException;
- public void installTheCsar(CsarHandler csar)
- throws SdcArtifactInstallerException, InterruptedException, PolicyModelException;
+ public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException, InterruptedException;
}
diff --git a/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java b/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
index 41d34a224..b8bc1f524 100644
--- a/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
+++ b/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
@@ -36,7 +36,6 @@ import java.util.Map.Entry;
import org.json.simple.parser.ParseException;
import org.onap.clamp.clds.client.DcaeInventoryServices;
-import org.onap.clamp.clds.exception.policy.PolicyModelException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
import org.onap.clamp.clds.model.dcae.DcaeInventoryResponse;
import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
@@ -109,8 +108,7 @@ public class LoopCsarInstaller implements CsarInstaller {
@Override
@Transactional(propagation = Propagation.REQUIRED)
- public void installTheCsar(CsarHandler csar)
- throws SdcArtifactInstallerException, InterruptedException, PolicyModelException {
+ public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException, InterruptedException {
try {
logger.info("Installing the CSAR " + csar.getFilePath());
for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) {