diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-11-05 13:44:53 +0100 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-11-05 17:22:09 +0100 |
commit | 1b6a428451709a3daa98d0f1cdee49d791985c0d (patch) | |
tree | 22166ce7141e5cd47cc7e995bd60803f5cf00cc1 /src/main/java/org | |
parent | 2901ca9fec4a88db325b90bda2103ffc5e921681 (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/java/org')
4 files changed, 26 insertions, 74 deletions
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 0b64b78e..00000000 --- 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 20e13bc7..3e684f42 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 a1f8897f..10e2790f 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 41d34a22..b8bc1f52 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()) { |