summaryrefslogtreecommitdiffstats
path: root/artifactbroker/plugins/reception-plugins/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'artifactbroker/plugins/reception-plugins/src/main/java/org')
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessage.java74
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessageBuilder.java112
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessage.java77
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessageBuilder.java132
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java120
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterBuilder.java52
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java84
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcClientHandler.java76
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcConfiguration.java117
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java382
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java357
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java210
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerStatus.java49
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java53
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java53
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java53
-rw-r--r--artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java53
17 files changed, 2054 insertions, 0 deletions
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessage.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessage.java
new file mode 100644
index 0000000..581681b
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessage.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+/**
+ * This class represents the component done status of the distribution service.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class ComponentDoneStatusMessage implements IComponentDoneStatusMessage {
+
+ private String consumerId;
+ private String distributionId;
+ private DistributionStatusEnum distributionStatus;
+ private long timestamp;
+
+ /**
+ * Constructor for instantiating {@link ComponentDoneStatusMessage} class.
+ *
+ * @param messageBuilder the message builder
+ */
+ public ComponentDoneStatusMessage(final ComponentDoneStatusMessageBuilder messageBuilder) {
+ this.consumerId = messageBuilder.getConsumerId();
+ this.distributionId = messageBuilder.getDistributionId();
+ this.distributionStatus = messageBuilder.getDistributionStatus();
+ this.timestamp = messageBuilder.getTimestamp();
+ }
+
+ @Override
+ public DistributionStatusEnum getStatus() {
+ return distributionStatus;
+ }
+
+ @Override
+ public String getDistributionID() {
+ return distributionId;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ @Override
+ public String getConsumerID() {
+ return consumerId;
+ }
+
+ @Override
+ public String getComponentName() {
+ return "POLICY";
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessageBuilder.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessageBuilder.java
new file mode 100644
index 0000000..567ae8d
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/ComponentDoneStatusMessageBuilder.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+/**
+ * This class builds an instance of {@link ComponentDoneStatusMessage} class.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class ComponentDoneStatusMessageBuilder {
+
+ private String consumerId;
+ private String distributionId;
+ private DistributionStatusEnum distributionStatus;
+ private long timestamp;
+
+ /**
+ * Returns consumer id of this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @return the consumerId
+ */
+ public String getConsumerId() {
+ return consumerId;
+ }
+
+ /**
+ * Returns distribution id of this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @return the distributionId
+ */
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ /**
+ * Returns distribution status of this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @return the distributionStatus
+ */
+ public DistributionStatusEnum getDistributionStatus() {
+ return distributionStatus;
+ }
+
+ /**
+ * Returns time of this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @return the timestamp
+ */
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Set consumer id url to this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @param consumerId the consumerId to set
+ */
+ public ComponentDoneStatusMessageBuilder setConsumerId(final String consumerId) {
+ this.consumerId = consumerId;
+ return this;
+ }
+
+ /**
+ * Set distribution id to this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @param distributionId the distributionId to set
+ */
+ public ComponentDoneStatusMessageBuilder setDistributionId(final String distributionId) {
+ this.distributionId = distributionId;
+ return this;
+ }
+
+ /**
+ * Set distribution status to this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @param distributionStatus the distributionStatus to set
+ */
+ public ComponentDoneStatusMessageBuilder setDistributionStatus(final DistributionStatusEnum distributionStatus) {
+ this.distributionStatus = distributionStatus;
+ return this;
+ }
+
+ /**
+ * Set time to this {@link ComponentDoneStatusMessageBuilder} instance.
+ *
+ * @param timestamp the timestamp to set
+ */
+ public ComponentDoneStatusMessageBuilder setTimestamp(final long timestamp) {
+ this.timestamp = timestamp;
+ return this;
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessage.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessage.java
new file mode 100644
index 0000000..436c061
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessage.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+/**
+ * This class represents the distribution status of the distribution service.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class DistributionStatusMessage implements IDistributionStatusMessage {
+
+ private String artifactUrl;
+ private String consumerId;
+ private String distributionId;
+ private DistributionStatusEnum distributionStatus;
+ private long timestamp;
+
+ /**
+ * Constructor for instantiating {@link DistributionStatusMessage} class.
+ *
+ * @param messageBuilder the message builder
+ */
+ public DistributionStatusMessage(final DistributionStatusMessageBuilder messageBuilder) {
+ this.artifactUrl = messageBuilder.getArtifactUrl();
+ this.consumerId = messageBuilder.getConsumerId();
+ this.distributionId = messageBuilder.getDistributionId();
+ this.distributionStatus = messageBuilder.getDistributionStatus();
+ this.timestamp = messageBuilder.getTimestamp();
+ }
+
+ @Override
+ public String getArtifactURL() {
+ return artifactUrl;
+ }
+
+ @Override
+ public String getConsumerID() {
+ return consumerId;
+ }
+
+ @Override
+ public String getDistributionID() {
+ return distributionId;
+ }
+
+ @Override
+ public DistributionStatusEnum getStatus() {
+ return distributionStatus;
+ }
+
+ @Override
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessageBuilder.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessageBuilder.java
new file mode 100644
index 0000000..b83a768
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/DistributionStatusMessageBuilder.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+/**
+ * This class builds an instance of {@link DistributionStatusMessage} class.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class DistributionStatusMessageBuilder {
+
+ private String artifactUrl;
+ private String consumerId;
+ private String distributionId;
+ private DistributionStatusEnum distributionStatus;
+ private long timestamp;
+
+ /**
+ * Returns artifact url of this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @return the artifactUrl
+ */
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ /**
+ * Returns consumer id of this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @return the consumerId
+ */
+ public String getConsumerId() {
+ return consumerId;
+ }
+
+ /**
+ * Returns distribution id of this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @return the distributionId
+ */
+ public String getDistributionId() {
+ return distributionId;
+ }
+
+ /**
+ * Returns distribution status of this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @return the distributionStatus
+ */
+ public DistributionStatusEnum getDistributionStatus() {
+ return distributionStatus;
+ }
+
+ /**
+ * Returns time of this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @return the timestamp
+ */
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ /**
+ * Set artifact url to this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @param artifactUrl the artifactUrl to set
+ */
+ public DistributionStatusMessageBuilder setArtifactUrl(final String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ return this;
+ }
+
+ /**
+ * Set consumer id url to this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @param consumerId the consumerId to set
+ */
+ public DistributionStatusMessageBuilder setConsumerId(final String consumerId) {
+ this.consumerId = consumerId;
+ return this;
+ }
+
+ /**
+ * Set distribution id to this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @param distributionId the distributionId to set
+ */
+ public DistributionStatusMessageBuilder setDistributionId(final String distributionId) {
+ this.distributionId = distributionId;
+ return this;
+ }
+
+ /**
+ * Set distribution status to this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @param distributionStatus the distributionStatus to set
+ */
+ public DistributionStatusMessageBuilder setDistributionStatus(final DistributionStatusEnum distributionStatus) {
+ this.distributionStatus = distributionStatus;
+ return this;
+ }
+
+ /**
+ * Set time to this {@link DistributionStatusMessageBuilder} instance.
+ *
+ * @param timestamp the timestamp to set
+ */
+ public DistributionStatusMessageBuilder setTimestamp(final long timestamp) {
+ this.timestamp = timestamp;
+ return this;
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java
new file mode 100644
index 0000000..941cdd6
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandler.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel Corp. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.WatchEvent;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchService;
+
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+
+import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.distribution.model.Csar;
+import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
+import org.onap.policy.distribution.reception.handling.AbstractReceptionHandler;
+
+/**
+ * Handles reception of inputs from File System which can be used to decode policies.
+ */
+public class FileSystemReceptionHandler extends AbstractReceptionHandler {
+ private boolean running = false;
+ private static final Logger LOGGER = FlexLogger.getLogger(FileSystemReceptionHandler.class);
+
+ @Override
+ protected void initializeReception(final String parameterGroupName) {
+ LOGGER.debug("FileSystemReceptionHandler init...");
+ try {
+ final FileSystemReceptionHandlerConfigurationParameterGroup handlerParameters =
+ ParameterService.get(parameterGroupName);
+ main(handlerParameters.getWatchPath());
+ } catch (final Exception ex) {
+ LOGGER.error(ex);
+ }
+ running = false;
+ LOGGER.debug("FileSystemReceptionHandler main loop exited...");
+ }
+
+ @Override
+ public void destroy() {
+ // Tear down subscription etc
+ running = false;
+ }
+
+ public boolean isRunning() {
+ return running;
+ }
+
+ /**
+ * Main entry point.
+ *
+ * @param watchPath Path to watch
+ */
+ public void main(String watchPath) throws IOException {
+ try (final WatchService watcher = FileSystems.getDefault().newWatchService()) {
+ final Path dir = Paths.get(watchPath);
+ dir.register(watcher, ENTRY_CREATE);
+ LOGGER.debug("Watch Service registered for dir: " + dir.getFileName());
+ startMainLoop(watcher, dir);
+ } catch (final InterruptedException ex) {
+ LOGGER.debug(ex);
+ Thread.currentThread().interrupt();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void startMainLoop(WatchService watcher, Path dir) throws InterruptedException {
+ WatchKey key;
+ running = true;
+ while (running) {
+ key = watcher.take();
+
+ for (final WatchEvent<?> event : key.pollEvents()) {
+ final WatchEvent<Path> ev = (WatchEvent<Path>) event;
+ final Path fileName = ev.context();
+ LOGGER.debug("new CSAR found: " + fileName);
+ createPolicyInputAndCallHandler(dir.toString() + File.separator + fileName.toString());
+ LOGGER.debug("CSAR complete: " + fileName);
+ }
+ final boolean valid = key.reset();
+ if (!valid) {
+ LOGGER.error("Watch key no longer valid!");
+ break;
+ }
+ }
+ }
+
+ protected void createPolicyInputAndCallHandler(final String fileName) {
+ try {
+ final Csar csarObject = new Csar(fileName);
+ inputReceived(csarObject);
+ } catch (final PolicyDecodingException ex) {
+ LOGGER.error(ex);
+ }
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterBuilder.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterBuilder.java
new file mode 100644
index 0000000..37a1698
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterBuilder.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel Corp. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+/**
+ * This class builds an instance of {@link FileSystemReceptionHandlerConfigurationParameterGroup} class.
+ *
+ */
+public class FileSystemReceptionHandlerConfigurationParameterBuilder {
+
+ private String watchPath;
+
+ /**
+ * Set watchPath to this {@link FileSystemReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param watchPath the watchPath
+ */
+ public FileSystemReceptionHandlerConfigurationParameterBuilder setWatchPath(final String watchPath) {
+ this.watchPath = watchPath;
+ return this;
+ }
+
+
+ /**
+ * Returns the watchPath of this {@link FileSystemReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the watchPath
+ */
+ public String getWatchPath() {
+ return watchPath;
+ }
+}
+
+
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java
new file mode 100644
index 0000000..457cd5e
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/FileSystemReceptionHandlerConfigurationParameterGroup.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import java.io.File;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
+
+/**
+ * This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json
+ * format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK.
+ */
+public class FileSystemReceptionHandlerConfigurationParameterGroup extends ReceptionHandlerConfigurationParameterGroup {
+
+ private String watchPath;
+
+ /**
+ * The constructor for instantiating {@link FileSystemReceptionHandlerConfigurationParameterGroup} class.
+ *
+ * @param builder the SDC configuration builder
+ */
+ public FileSystemReceptionHandlerConfigurationParameterGroup(
+ final FileSystemReceptionHandlerConfigurationParameterBuilder builder) {
+ watchPath = builder.getWatchPath();
+ }
+
+ public String getWatchPath() {
+ return watchPath;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ validatePathElement(validationResult, watchPath, "watchPath");
+ return validationResult;
+ }
+
+
+ /**
+ * Validate the string element.
+ *
+ * @param validationResult the result object
+ * @param element the element to validate
+ * @param elementName the element name for error message
+ */
+ private void validatePathElement(final GroupValidationResult validationResult, final String element,
+ final String elementName) {
+ boolean valid = false;
+ if (element != null) {
+ File file = new File(element);
+ if (file.exists() && file.isDirectory()) {
+ valid = true;
+ }
+ }
+ if (!valid) {
+ validationResult.setResult(elementName, ValidationStatus.INVALID,
+ elementName + " must be a valid directory");
+ }
+ }
+}
+
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcClientHandler.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcClientHandler.java
new file mode 100644
index 0000000..f69fb15
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcClientHandler.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * This class implements TimerTask for calling life cycle methods of SdcClient iteratively after specified interval
+ * until the operation is successful.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class SdcClientHandler extends TimerTask {
+
+ private SdcReceptionHandler sdcReceptionHandler;
+ private SdcClientOperationType operationType;
+ private Timer timer;
+
+ public enum SdcClientOperationType {
+ START, STOP
+ }
+
+ /**
+ * Constructs an instance of {@link SdcClientHandler} class.
+ *
+ * @param sdcReceptionHandler the sdcReceptionHandler
+ */
+ public SdcClientHandler(final SdcReceptionHandler sdcReceptionHandler, final SdcClientOperationType operationType,
+ final long retryDelay) {
+ this.sdcReceptionHandler = sdcReceptionHandler;
+ this.operationType = operationType;
+ timer = new Timer(false);
+ timer.scheduleAtFixedRate(this, 0, retryDelay * 1000L);
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void run() {
+ if (SdcClientOperationType.START.equals(operationType)) {
+ sdcReceptionHandler.initializeSdcClient();
+ sdcReceptionHandler.startSdcClient();
+ } else {
+ sdcReceptionHandler.stopSdcClient();
+ }
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public boolean cancel() {
+ timer.cancel();
+ return true;
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcConfiguration.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcConfiguration.java
new file mode 100644
index 0000000..04c978b
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcConfiguration.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import java.util.List;
+import org.onap.sdc.api.consumer.IConfiguration;
+
+/**
+ * This class represents the configurations needed for SDC Client.
+ *
+ */
+public class SdcConfiguration implements IConfiguration {
+
+ private SdcReceptionHandlerConfigurationParameterGroup configParameters = null;
+
+ /**
+ * Constructor for instantiating {@link SdcConfiguration}.
+ *
+ * @param configParameters the SDC Client configuration parameters
+ */
+ public SdcConfiguration(final SdcReceptionHandlerConfigurationParameterGroup configParameters) {
+ this.configParameters = configParameters;
+ }
+
+ @Override
+ public String getAsdcAddress() {
+ return configParameters.getAsdcAddress();
+ }
+
+ @Override
+ public List<String> getMsgBusAddress() {
+ return configParameters.getMessageBusAddress();
+ }
+
+ @Override
+ public String getUser() {
+ return configParameters.getUser();
+ }
+
+ @Override
+ public String getPassword() {
+ return configParameters.getPassword();
+ }
+
+ @Override
+ public int getPollingInterval() {
+ return configParameters.getPollingInterval();
+ }
+
+ @Override
+ public int getPollingTimeout() {
+ return configParameters.getPollingTimeout();
+ }
+
+ @Override
+ public List<String> getRelevantArtifactTypes() {
+ return configParameters.getArtifactTypes();
+ }
+
+ @Override
+ public String getConsumerGroup() {
+ return configParameters.getConsumerGroup();
+ }
+
+ @Override
+ public String getEnvironmentName() {
+ return configParameters.getEnvironmentName();
+ }
+
+ @Override
+ public String getConsumerID() {
+ return configParameters.getConsumerId();
+ }
+
+ @Override
+ public String getKeyStorePassword() {
+ return configParameters.getKeyStorePassword();
+ }
+
+ @Override
+ public String getKeyStorePath() {
+ return configParameters.getKeyStorePath();
+ }
+
+ @Override
+ public boolean activateServerTLSAuth() {
+ return configParameters.isActiveServerTlsAuth();
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return configParameters.isFilterInEmptyResources();
+ }
+
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
+ return configParameters.isUseHttpsWithDmaap();
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java
new file mode 100644
index 0000000..0d100f8
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandler.java
@@ -0,0 +1,382 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.common.parameters.ParameterService;
+import org.onap.policy.distribution.model.Csar;
+import org.onap.policy.distribution.reception.decoding.PolicyDecodingException;
+import org.onap.policy.distribution.reception.handling.AbstractReceptionHandler;
+import org.onap.policy.distribution.reception.handling.sdc.SdcClientHandler.SdcClientOperationType;
+import org.onap.policy.distribution.reception.handling.sdc.exceptions.ArtifactDownloadException;
+import org.onap.policy.distribution.reception.statistics.DistributionStatisticsManager;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+/**
+ * Handles reception of inputs from ONAP Service Design and Creation (SDC) from which policies may be decoded.
+ */
+public class SdcReceptionHandler extends AbstractReceptionHandler implements INotificationCallback {
+
+ private static final Logger LOGGER = FlexLogger.getLogger(SdcReceptionHandler.class);
+ private static final String SECONDS = "Seconds";
+
+ private SdcReceptionHandlerStatus sdcReceptionHandlerStatus = SdcReceptionHandlerStatus.STOPPED;
+ private IDistributionClient distributionClient;
+ private SdcConfiguration sdcConfig;
+ private volatile int nbOfNotificationsOngoing = 0;
+ private int retryDelay;
+ private SdcClientHandler sdcClientHandler;
+
+ private enum DistributionStatusType {
+ DOWNLOAD, DEPLOY
+ }
+
+ @Override
+ protected void initializeReception(final String parameterGroupName) {
+ final SdcReceptionHandlerConfigurationParameterGroup handlerParameters =
+ ParameterService.get(parameterGroupName);
+ retryDelay = handlerParameters.getRetryDelay() < 30 ? 30 : handlerParameters.getRetryDelay();
+ sdcConfig = new SdcConfiguration(handlerParameters);
+ distributionClient = createSdcDistributionClient();
+ sdcClientHandler = new SdcClientHandler(this, SdcClientOperationType.START, retryDelay);
+ }
+
+ @Override
+ public void destroy() {
+ if (distributionClient != null) {
+ sdcClientHandler = new SdcClientHandler(this, SdcClientOperationType.STOP, retryDelay);
+ }
+ }
+
+ @Override
+ public void activateCallback(final INotificationData notificationData) {
+ LOGGER.debug("Receieved the notification from SDC with ID: " + notificationData.getDistributionID());
+ changeSdcReceptionHandlerStatus(SdcReceptionHandlerStatus.BUSY);
+ processCsarServiceArtifacts(notificationData);
+ changeSdcReceptionHandlerStatus(SdcReceptionHandlerStatus.IDLE);
+ LOGGER.debug("Processed the notification from SDC with ID: " + notificationData.getDistributionID());
+ }
+
+ /**
+ * Method to change the status of this reception handler instance.
+ *
+ * @param newStatus the new status
+ */
+ private final synchronized void changeSdcReceptionHandlerStatus(final SdcReceptionHandlerStatus newStatus) {
+ switch (newStatus) {
+ case INIT:
+ case STOPPED:
+ sdcReceptionHandlerStatus = newStatus;
+ break;
+ case IDLE:
+ handleIdleStatusChange(newStatus);
+ break;
+ case BUSY:
+ ++nbOfNotificationsOngoing;
+ sdcReceptionHandlerStatus = newStatus;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /**
+ * Creates an instance of {@link IDistributionClient} from {@link DistributionClientFactory}.
+ *
+ * @return the {@link IDistributionClient} instance
+ */
+ protected IDistributionClient createSdcDistributionClient() {
+ return DistributionClientFactory.createDistributionClient();
+ }
+
+ /**
+ * Method to initialize the SDC client.
+ *
+ */
+ protected void initializeSdcClient() {
+
+ LOGGER.debug("Initializing the SDC Client...");
+ if (sdcReceptionHandlerStatus != SdcReceptionHandlerStatus.STOPPED) {
+ LOGGER.error("The SDC Client is already initialized");
+ return;
+ }
+ final IDistributionClientResult clientResult = distributionClient.init(sdcConfig, this);
+ if (!clientResult.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ LOGGER.error("SDC client initialization failed with reason:" + clientResult.getDistributionMessageResult()
+ + ". Initialization will be retried after " + retryDelay + SECONDS);
+ return;
+ }
+ LOGGER.debug("SDC Client is initialized successfully");
+ changeSdcReceptionHandlerStatus(SdcReceptionHandlerStatus.INIT);
+ }
+
+ /**
+ * Method to start the SDC client.
+ *
+ */
+ protected void startSdcClient() {
+
+ LOGGER.debug("Going to start the SDC Client...");
+ if (sdcReceptionHandlerStatus != SdcReceptionHandlerStatus.INIT) {
+ LOGGER.error("The SDC Client is not initialized");
+ return;
+ }
+ final IDistributionClientResult clientResult = distributionClient.start();
+ if (!clientResult.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ LOGGER.error("SDC client start failed with reason:" + clientResult.getDistributionMessageResult()
+ + ". Start will be retried after " + retryDelay + SECONDS);
+ return;
+ }
+ LOGGER.debug("SDC Client is started successfully");
+ changeSdcReceptionHandlerStatus(SdcReceptionHandlerStatus.IDLE);
+ sdcClientHandler.cancel();
+ }
+
+ /**
+ * Method to stop the SDC client.
+ *
+ */
+ protected void stopSdcClient() {
+ LOGGER.debug("Going to stop the SDC Client...");
+ final IDistributionClientResult clientResult = distributionClient.stop();
+ if (!clientResult.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ LOGGER.error("SDC client stop failed with reason:" + clientResult.getDistributionMessageResult()
+ + ". Stop will be retried after " + retryDelay + SECONDS);
+ return;
+ }
+ LOGGER.debug("SDC Client is stopped successfully");
+ changeSdcReceptionHandlerStatus(SdcReceptionHandlerStatus.STOPPED);
+ sdcClientHandler.cancel();
+ }
+
+ /**
+ * Method to process csar service artifacts from incoming SDC notification.
+ *
+ * @param notificationData the notification from SDC
+ */
+ public void processCsarServiceArtifacts(final INotificationData notificationData) {
+ boolean artifactsProcessedSuccessfully = true;
+ DistributionStatisticsManager.updateTotalDistributionCount();
+ for (final IArtifactInfo artifact : notificationData.getServiceArtifacts()) {
+ try {
+ final IDistributionClientDownloadResult resultArtifact =
+ downloadTheArtifact(artifact, notificationData);
+ final Path filePath = writeArtifactToFile(artifact, resultArtifact);
+ final Csar csarObject = new Csar(filePath.toString());
+ inputReceived(csarObject);
+ sendDistributionStatus(DistributionStatusType.DEPLOY, artifact.getArtifactURL(),
+ notificationData.getDistributionID(), DistributionStatusEnum.DEPLOY_OK, null);
+ deleteArtifactFile(filePath);
+ } catch (final ArtifactDownloadException | PolicyDecodingException exp) {
+ LOGGER.error("Failed to process csar service artifacts ", exp);
+ artifactsProcessedSuccessfully = false;
+ sendDistributionStatus(DistributionStatusType.DEPLOY, artifact.getArtifactURL(),
+ notificationData.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,
+ "Failed to deploy the artifact due to: " + exp.getMessage());
+ }
+ }
+ if (artifactsProcessedSuccessfully) {
+ DistributionStatisticsManager.updateDistributionSuccessCount();
+ sendComponentDoneStatus(notificationData.getDistributionID(), DistributionStatusEnum.COMPONENT_DONE_OK,
+ null);
+ } else {
+ DistributionStatisticsManager.updateDistributionFailureCount();
+ sendComponentDoneStatus(notificationData.getDistributionID(), DistributionStatusEnum.COMPONENT_DONE_ERROR,
+ "Failed to process the artifact");
+ }
+ }
+
+ /**
+ * Method to download the distribution artifact.
+ *
+ * @param artifact the artifact
+ * @return the download result
+ * @throws ArtifactDownloadException if download fails
+ */
+ private IDistributionClientDownloadResult downloadTheArtifact(final IArtifactInfo artifact,
+ final INotificationData notificationData) throws ArtifactDownloadException {
+
+ DistributionStatisticsManager.updateTotalDownloadCount();
+ final IDistributionClientDownloadResult downloadResult = distributionClient.download(artifact);
+ if (!downloadResult.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ DistributionStatisticsManager.updateDownloadFailureCount();
+ final String message = "Failed to download artifact with name: " + artifact.getArtifactName() + " due to: "
+ + downloadResult.getDistributionMessageResult();
+ LOGGER.error(message);
+ sendDistributionStatus(DistributionStatusType.DOWNLOAD, artifact.getArtifactURL(),
+ notificationData.getDistributionID(), DistributionStatusEnum.DOWNLOAD_ERROR, message);
+ throw new ArtifactDownloadException(message);
+ }
+ DistributionStatisticsManager.updateDownloadSuccessCount();
+ sendDistributionStatus(DistributionStatusType.DOWNLOAD, artifact.getArtifactURL(),
+ notificationData.getDistributionID(), DistributionStatusEnum.DOWNLOAD_OK, null);
+ return downloadResult;
+ }
+
+ /**
+ * Method to write the downloaded distribution artifact to local file system.
+ *
+ * @param artifact the notification artifact
+ * @param resultArtifact the download result artifact
+ * @return the local path of written file
+ * @throws ArtifactDownloadException if error occurs while writing the artifact
+ */
+ private Path writeArtifactToFile(final IArtifactInfo artifact,
+ final IDistributionClientDownloadResult resultArtifact) throws ArtifactDownloadException {
+ try {
+ final byte[] payloadBytes = resultArtifact.getArtifactPayload();
+ final File tempArtifactFile = File.createTempFile(artifact.getArtifactName(), ".csar");
+ try (FileOutputStream fileOutputStream = new FileOutputStream(tempArtifactFile)) {
+ fileOutputStream.write(payloadBytes, 0, payloadBytes.length);
+ return tempArtifactFile.toPath();
+ }
+ } catch (final Exception exp) {
+ final String message = "Failed to write artifact to local repository";
+ LOGGER.error(message, exp);
+ throw new ArtifactDownloadException(message, exp);
+ }
+ }
+
+ /**
+ * Method to delete the downloaded notification artifact from local file system.
+ *
+ * @param filePath the path of file
+ */
+ private void deleteArtifactFile(final Path filePath) {
+ try {
+ Files.deleteIfExists(filePath);
+ } catch (final IOException exp) {
+ LOGGER.error("Failed to delete the downloaded artifact file", exp);
+ }
+ }
+
+ /**
+ * Sends the distribution status to SDC using the input values.
+ *
+ * @param statusType the status type
+ * @param artifactUrl the artifact url
+ * @param distributionId the distribution id
+ * @param status the status
+ * @param errorReason the error reason
+ */
+ private void sendDistributionStatus(final DistributionStatusType statusType, final String artifactUrl,
+ final String distributionId, final DistributionStatusEnum status, final String errorReason) {
+
+ IDistributionClientResult clientResult;
+ final DistributionStatusMessageBuilder messageBuilder = new DistributionStatusMessageBuilder()
+ .setArtifactUrl(artifactUrl).setConsumerId(sdcConfig.getConsumerID()).setDistributionId(distributionId)
+ .setDistributionStatus(status).setTimestamp(System.currentTimeMillis());
+ final IDistributionStatusMessage message = new DistributionStatusMessage(messageBuilder);
+ if (DistributionStatusType.DOWNLOAD.equals(statusType)) {
+ if (errorReason != null) {
+ clientResult = distributionClient.sendDownloadStatus(message, errorReason);
+ } else {
+ clientResult = distributionClient.sendDownloadStatus(message);
+ }
+ } else {
+ if (errorReason != null) {
+ clientResult = distributionClient.sendDeploymentStatus(message, errorReason);
+ } else {
+ clientResult = distributionClient.sendDeploymentStatus(message);
+ }
+ }
+ final StringBuilder loggerMessage = new StringBuilder();
+ loggerMessage.append("distribution status to SDC with values - ").append("DistributionId")
+ .append(distributionId).append(" Artifact: ").append(artifactUrl).append(" StatusType: ")
+ .append(statusType.name()).append(" Status: ").append(status.name());
+ if (errorReason != null) {
+ loggerMessage.append(" ErrorReason: ").append(errorReason);
+ }
+ if (!clientResult.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ loggerMessage.insert(0, "Failed sending ");
+ LOGGER.debug(loggerMessage);
+ } else {
+ loggerMessage.insert(0, "Successfully Sent ");
+ LOGGER.debug(loggerMessage);
+ }
+ }
+
+ /**
+ * Sends the component done status to SDC using the input values.
+ *
+ * @param distributionId the distribution Id
+ * @param status the distribution status
+ * @param errorReason the error reason
+ */
+ private void sendComponentDoneStatus(final String distributionId, final DistributionStatusEnum status,
+ final String errorReason) {
+ IDistributionClientResult clientResult;
+ final ComponentDoneStatusMessageBuilder messageBuilder = new ComponentDoneStatusMessageBuilder()
+ .setConsumerId(sdcConfig.getConsumerID()).setDistributionId(distributionId)
+ .setDistributionStatus(status).setTimestamp(System.currentTimeMillis());
+ final IComponentDoneStatusMessage message = new ComponentDoneStatusMessage(messageBuilder);
+ if (errorReason == null) {
+ clientResult = distributionClient.sendComponentDoneStatus(message);
+ } else {
+ clientResult = distributionClient.sendComponentDoneStatus(message, errorReason);
+ }
+
+ final StringBuilder loggerMessage = new StringBuilder();
+ loggerMessage.append("component done status to SDC with values - ").append("DistributionId")
+ .append(distributionId).append(" Status: ").append(status.name());
+ if (errorReason != null) {
+ loggerMessage.append(" ErrorReason: ").append(errorReason);
+ }
+ if (!clientResult.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) {
+ loggerMessage.insert(0, "Failed sending ");
+ LOGGER.debug(loggerMessage);
+ } else {
+ loggerMessage.insert(0, "Successfully Sent ");
+ LOGGER.debug(loggerMessage);
+ }
+ }
+
+ /**
+ * Handle the status change of {@link SdcReceptionHandler} to Idle.
+ *
+ * @param newStatus the new status
+ */
+ private void handleIdleStatusChange(final SdcReceptionHandlerStatus newStatus) {
+ if (nbOfNotificationsOngoing > 1) {
+ --nbOfNotificationsOngoing;
+ } else {
+ nbOfNotificationsOngoing = 0;
+ sdcReceptionHandlerStatus = newStatus;
+ }
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java
new file mode 100644
index 0000000..65305c1
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterBuilder.java
@@ -0,0 +1,357 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import java.util.List;
+
+/**
+ * This class builds an instance of {@link SdcReceptionHandlerConfigurationParameterGroup} class.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public class SdcReceptionHandlerConfigurationParameterBuilder {
+
+ private boolean activeserverTlsAuth;
+ private boolean filterinEmptyResources;
+ private boolean useHttpsWithDmaap;
+ private int pollingTimeout;
+ private int pollingInterval;
+ private String user;
+ private String password;
+ private String consumerId;
+ private String consumerGroup;
+ private String asdcAddress;
+ private String environmentName;
+ private String keystorePath;
+ private String keystorePassword;
+ private List<String> messageBusAddress;
+ private List<String> artifactTypes;
+ private int retryDelay;
+
+ /**
+ * Set activeserverTlsAuth to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param activeserverTlsAuth the activeserverTlsAuth
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setActiveserverTlsAuth(final boolean activeserverTlsAuth) {
+ this.activeserverTlsAuth = activeserverTlsAuth;
+ return this;
+ }
+
+ /**
+ * Set filterinEmptyResources to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param filterinEmptyResources the filterinEmptyResources
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setFilterinEmptyResources(
+ final boolean filterinEmptyResources) {
+ this.filterinEmptyResources = filterinEmptyResources;
+ return this;
+ }
+
+ /**
+ * Set useHttpsWithDmaap to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param useHttpsWithDmaap the useHttpsWithDmaap
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setUseHttpsWithDmaap(final Boolean useHttpsWithDmaap) {
+ this.useHttpsWithDmaap = useHttpsWithDmaap;
+ return this;
+ }
+
+ /**
+ * Set pollingInterval to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param pollingInterval the pollingInterval
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setPollingInterval(final int pollingInterval) {
+ this.pollingInterval = pollingInterval;
+ return this;
+ }
+
+ /**
+ * Set pollingTimeout to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param pollingTimeout the pollingTimeout
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setPollingTimeout(final int pollingTimeout) {
+ this.pollingTimeout = pollingTimeout;
+ return this;
+ }
+
+ /**
+ * Set asdcAddress to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param asdcAddress the asdcAddress
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setAsdcAddress(final String asdcAddress) {
+ this.asdcAddress = asdcAddress;
+ return this;
+ }
+
+ /**
+ * Set user to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param user the user
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setUser(final String user) {
+ this.user = user;
+ return this;
+ }
+
+ /**
+ * Set password to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param password the password
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setPassword(final String password) {
+ this.password = password;
+ return this;
+ }
+
+ /**
+ * Set consumerId to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param consumerId the consumerId
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setConsumerId(final String consumerId) {
+ this.consumerId = consumerId;
+ return this;
+ }
+
+ /**
+ * Set consumerGroup to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param consumerGroup the consumerGroup
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setConsumerGroup(final String consumerGroup) {
+ this.consumerGroup = consumerGroup;
+ return this;
+ }
+
+ /**
+ * Set environmentName to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param environmentName the environmentName
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setEnvironmentName(final String environmentName) {
+ this.environmentName = environmentName;
+ return this;
+ }
+
+ /**
+ * Set keystorePath to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param keystorePath the keystorePath
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setKeystorePath(final String keystorePath) {
+ this.keystorePath = keystorePath;
+ return this;
+ }
+
+ /**
+ * Set keystorePassword to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param keystorePassword the keystorePassword
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setKeystorePassword(final String keystorePassword) {
+ this.keystorePassword = keystorePassword;
+ return this;
+ }
+
+ /**
+ * Set messageBusAddress to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param messageBusAddress the messageBusAddress
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setMessageBusAddress(final List<String> messageBusAddress) {
+ this.messageBusAddress = messageBusAddress;
+ return this;
+ }
+
+ /**
+ * Set artifactTypes to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param artifactTypes the artifactTypes
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setArtifactTypes(final List<String> artifactTypes) {
+ this.artifactTypes = artifactTypes;
+ return this;
+ }
+
+ /**
+ * Set retryDelay to this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @param retryDelay the retryDelay
+ */
+ public SdcReceptionHandlerConfigurationParameterBuilder setRetryDelay(final int retryDelay) {
+ this.retryDelay = retryDelay;
+ return this;
+ }
+
+ /**
+ * Returns the active server TlsAuth of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the activeserverTlsAuth
+ */
+ public boolean isActiveserverTlsAuth() {
+ return activeserverTlsAuth;
+ }
+
+ /**
+ * Returns the isFilterinEmptyResources flag of this {@link SdcReceptionHandlerConfigurationParameterBuilder}
+ * instance.
+ *
+ * @return the isFilterinEmptyResources
+ */
+ public boolean isFilterinEmptyResources() {
+ return filterinEmptyResources;
+ }
+
+ /**
+ * Returns the isUseHttpsWithDmaap flag of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the isUseHttpsWithDmaap
+ */
+ public Boolean getIsUseHttpsWithDmaap() {
+ return useHttpsWithDmaap;
+ }
+
+ /**
+ * Returns the polling interval of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the pollingInterval
+ */
+ public int getPollingInterval() {
+ return pollingInterval;
+ }
+
+ /**
+ * Returns the polling timeout of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the pollingTimeout
+ */
+ public int getPollingTimeout() {
+ return pollingTimeout;
+ }
+
+ /**
+ * Returns the asdc address of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the asdcAddress
+ */
+ public String getAsdcAddress() {
+ return asdcAddress;
+ }
+
+ /**
+ * Returns the user of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the user
+ */
+ public String getUser() {
+ return user;
+ }
+
+ /**
+ * Returns the password of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the password
+ */
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Returns the consumer id of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the consumerId
+ */
+ public String getConsumerId() {
+ return consumerId;
+ }
+
+ /**
+ * Returns the consumer group of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the consumerGroup
+ */
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ /**
+ * Returns the environment name of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the environmentName
+ */
+ public String getEnvironmentName() {
+ return environmentName;
+ }
+
+ /**
+ * Returns the keystore path of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the keystorePath
+ */
+ public String getKeystorePath() {
+ return keystorePath;
+ }
+
+ /**
+ * Returns the keystore password of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the keystorePassword
+ */
+ public String getKeystorePassword() {
+ return keystorePassword;
+ }
+
+ /**
+ * Returns the message bus address of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the messageBusAddress
+ */
+ public List<String> getMessageBusAddress() {
+ return messageBusAddress;
+ }
+
+ /**
+ * Returns the artifact types of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the artifactTypes
+ */
+ public List<String> getArtifactTypes() {
+ return artifactTypes;
+ }
+
+ /**
+ * Returns the retryDelay of this {@link SdcReceptionHandlerConfigurationParameterBuilder} instance.
+ *
+ * @return the retryDelay
+ */
+ public int getRetryDelay() {
+ return retryDelay;
+ }
+
+}
+
+
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java
new file mode 100644
index 0000000..6746dc3
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerConfigurationParameterGroup.java
@@ -0,0 +1,210 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+import java.util.List;
+
+import org.onap.policy.common.parameters.GroupValidationResult;
+import org.onap.policy.common.parameters.ValidationStatus;
+import org.onap.policy.common.utils.validation.ParameterValidationUtils;
+import org.onap.policy.distribution.reception.parameters.ReceptionHandlerConfigurationParameterGroup;
+
+/**
+ * This class handles reading, parsing and validating of the Policy SDC Service Distribution parameters from Json
+ * format, which strictly adheres to the interface:IConfiguration, defined by SDC SDK.
+ */
+public class SdcReceptionHandlerConfigurationParameterGroup extends ReceptionHandlerConfigurationParameterGroup {
+
+ private String asdcAddress;
+ private List<String> messageBusAddress;
+ private String user;
+ private String password;
+ private int pollingInterval;
+ private int pollingTimeout;
+ private int retryDelay;
+ private String consumerId;
+ private List<String> artifactTypes;
+ private String consumerGroup;
+ private String environmentName;
+ private String keyStorePath;
+ private String keyStorePassword;
+ private boolean activeServerTlsAuth;
+ private boolean isFilterInEmptyResources;
+ private boolean isUseHttpsWithDmaap;
+
+ /**
+ * The constructor for instantiating {@link SdcReceptionHandlerConfigurationParameterGroup} class.
+ *
+ * @param builder the SDC configuration builder
+ */
+ public SdcReceptionHandlerConfigurationParameterGroup(
+ final SdcReceptionHandlerConfigurationParameterBuilder builder) {
+ asdcAddress = builder.getAsdcAddress();
+ messageBusAddress = builder.getMessageBusAddress();
+ user = builder.getUser();
+ password = builder.getPassword();
+ pollingInterval = builder.getPollingInterval();
+ pollingTimeout = builder.getPollingTimeout();
+ retryDelay = builder.getRetryDelay();
+ consumerId = builder.getConsumerId();
+ artifactTypes = builder.getArtifactTypes();
+ consumerGroup = builder.getConsumerGroup();
+ environmentName = builder.getEnvironmentName();
+ keyStorePath = builder.getKeystorePath();
+ keyStorePassword = builder.getKeystorePassword();
+ activeServerTlsAuth = builder.isActiveserverTlsAuth();
+ isFilterInEmptyResources = builder.isFilterinEmptyResources();
+ isUseHttpsWithDmaap = builder.getIsUseHttpsWithDmaap();
+
+ }
+
+ public String getAsdcAddress() {
+ return asdcAddress;
+ }
+
+ public List<String> getMessageBusAddress() {
+ return messageBusAddress;
+ }
+
+ public String getUser() {
+ return user;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public int getPollingInterval() {
+ return pollingInterval;
+ }
+
+ public int getPollingTimeout() {
+ return pollingTimeout;
+ }
+
+ public int getRetryDelay() {
+ return retryDelay;
+ }
+
+ public String getConsumerId() {
+ return consumerId;
+ }
+
+ public List<String> getArtifactTypes() {
+ return artifactTypes;
+ }
+
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ public String getEnvironmentName() {
+ return environmentName;
+ }
+
+ public String getKeyStorePassword() {
+ return keyStorePassword;
+ }
+
+ public boolean isActiveServerTlsAuth() {
+ return activeServerTlsAuth;
+ }
+
+ public String getKeyStorePath() {
+ return keyStorePath;
+ }
+
+ public boolean isFilterInEmptyResources() {
+ return isFilterInEmptyResources;
+ }
+
+ public boolean isUseHttpsWithDmaap() {
+ return isUseHttpsWithDmaap;
+ }
+
+ /**
+ * {@inheritDoc}.
+ */
+ @Override
+ public GroupValidationResult validate() {
+ final GroupValidationResult validationResult = new GroupValidationResult(this);
+ validateStringElement(validationResult, asdcAddress, "asdcAddress");
+ validateStringElement(validationResult, user, "user");
+ validateStringElement(validationResult, consumerId, "consumerId");
+ validateStringElement(validationResult, consumerGroup, "consumerGroup");
+ validateStringElement(validationResult, keyStorePath, "keyStorePath");
+ validateStringElement(validationResult, keyStorePassword, "keyStorePassword");
+ validateIntElement(validationResult, pollingInterval, "pollingInterval");
+ validateIntElement(validationResult, pollingTimeout, "pollingTimeout");
+ validateIntElement(validationResult, retryDelay, "retryDelay");
+ validateStringListElement(validationResult, messageBusAddress, "messageBusAddress");
+ validateStringListElement(validationResult, artifactTypes, "artifactTypes");
+ return validationResult;
+ }
+
+ /**
+ * Validate the integer Element.
+ *
+ * @param validationResult the result object
+ * @param element the element to validate
+ * @param elementName the element name for error message
+ */
+ private void validateIntElement(final GroupValidationResult validationResult, final int element,
+ final String elementName) {
+ if (!ParameterValidationUtils.validateIntParameter(element)) {
+ validationResult.setResult(elementName, ValidationStatus.INVALID,
+ elementName + " must be a positive integer");
+ }
+ }
+
+ /**
+ * Validate the String List Element.
+ *
+ * @param validationResult the result object
+ * @param element the element to validate
+ * @param elementName the element name for error message
+ */
+ private void validateStringListElement(final GroupValidationResult validationResult, final List<String> element,
+ final String elementName) {
+ for (final String temp : element) {
+ if (!ParameterValidationUtils.validateStringParameter(temp)) {
+ validationResult.setResult(elementName, ValidationStatus.INVALID,
+ "the string of " + elementName + "must be a non-blank string");
+ }
+ }
+ }
+
+ /**
+ * Validate the string element.
+ *
+ * @param validationResult the result object
+ * @param element the element to validate
+ * @param elementName the element name for error message
+ */
+ private void validateStringElement(final GroupValidationResult validationResult, final String element,
+ final String elementName) {
+ if (!ParameterValidationUtils.validateStringParameter(element)) {
+ validationResult.setResult(elementName, ValidationStatus.INVALID,
+ elementName + " must be a non-blank string");
+ }
+ }
+}
+
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerStatus.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerStatus.java
new file mode 100644
index 0000000..d0e04c7
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/SdcReceptionHandlerStatus.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc;
+
+/**
+ * Class to hold the possible values for status of {@link SdcReceptionHandler}.
+ *
+ * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
+ */
+public enum SdcReceptionHandlerStatus {
+
+ /**
+ * The SdcReceptionHandler is not alive.
+ */
+ STOPPED,
+
+ /**
+ * The SdcReceptionHandler is initialized but not started yet.
+ */
+ INIT,
+
+ /**
+ * The SdcReceptionHandler is initialized, started & ready to handle incoming notifications.
+ */
+ IDLE,
+
+ /**
+ * The SdcReceptionHandler is currently busy in handling notifications.
+ */
+ BUSY
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java
new file mode 100644
index 0000000..23409ea
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactDownloadException.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc.exceptions;
+
+/**
+ * Exception during download from Pssd.
+ */
+public class ArtifactDownloadException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating PssdDownloadException using message.
+ *
+ * @param message The message to dump
+ */
+ public ArtifactDownloadException(final String message) {
+ super(message);
+
+ }
+
+ /**
+ * Constructor for creating PssdDownloadException using message and exception.
+ *
+ * @param message The message to dump
+ * @param ex the exception that caused this exception to be thrown
+ */
+ public ArtifactDownloadException(final String message, final Exception ex) {
+ super(message, ex);
+
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
new file mode 100644
index 0000000..19e711b
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/ArtifactInstallerException.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc.exceptions;
+
+/**
+ * Exception during artifact installation.
+ */
+public class ArtifactInstallerException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating ArtifactInstallerException using message.
+ *
+ * @param message The message to dump
+ */
+ public ArtifactInstallerException(final String message) {
+ super(message);
+
+ }
+
+ /**
+ * Constructor for creating ArtifactInstallerException using message and exception.
+ *
+ * @param message The message to dump
+ * @param ex the exception that caused this exception to be thrown
+ */
+ public ArtifactInstallerException(final String message, final Exception ex) {
+ super(message, ex);
+
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java
new file mode 100644
index 0000000..0dd16d7
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdControllerException.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc.exceptions;
+
+/**
+ * Exception of the Pssd controller.
+ */
+public class PssdControllerException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating PssdControllerException using message.
+ *
+ * @param message The message to dump
+ */
+ public PssdControllerException(final String message) {
+ super(message);
+
+ }
+
+ /**
+ * Constructor for creating PssdControllerException using message and exception.
+ *
+ * @param message The message to dump
+ * @param ex the exception that caused this exception to be thrown
+ */
+ public PssdControllerException(final String message, final Exception ex) {
+ super(message, ex);
+
+ }
+}
diff --git a/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java
new file mode 100644
index 0000000..e1cdf70
--- /dev/null
+++ b/artifactbroker/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/handling/sdc/exceptions/PssdParametersException.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2018 Intel. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.distribution.reception.handling.sdc.exceptions;
+
+/**
+ * Exception of the Pssd controller.
+ */
+public class PssdParametersException extends Exception {
+
+ /**
+ * serialization id.
+ */
+ private static final long serialVersionUID = -8507246953751956974L;
+
+ /**
+ * Constructor for creating PssdParametersException using message.
+ *
+ * @param message The message to dump
+ */
+ public PssdParametersException(final String message) {
+ super(message);
+
+ }
+
+ /**
+ * Constructor for creating PssdParametersException using message and exception.
+ *
+ * @param message The message to dump
+ * @param ex the exception that caused this exception to be thrown
+ */
+ public PssdParametersException(final String message, final Exception ex) {
+ super(message, ex);
+
+ }
+}