* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener;
-import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
-import java.io.File;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.Objects;
import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto;
import org.onap.ccsdk.cds.sdclistener.service.ListenerService;
import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Objects;
+
+import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS;
+
@ConfigurationProperties("listenerservice")
@Component
@ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto")
private void processNotification(INotificationData notificationData) {
final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient();
notificationData.getServiceArtifacts()
- .forEach(artifactInfo -> downloadCsarArtifacts(artifactInfo, distributionClient));
+ .forEach(artifactInfo -> downloadCsarArtifacts(artifactInfo, distributionClient));
}
/**
if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) {
final String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url,
- result.getDistributionActionResult());
- listenerStatus
- .sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR, errorMessage,
- url, NotificationType.DOWNLOAD);
+ result.getDistributionActionResult());
+ listenerStatus.sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_ERROR,
+ errorMessage, url, NotificationType.DOWNLOAD);
LOGGER.error(errorMessage);
} else {
listenerStatus.sendResponseBackToSdc(distributionId, DistributionStatusEnum.DOWNLOAD_OK, null, url,
- NotificationType.DOWNLOAD);
+ NotificationType.DOWNLOAD);
LOGGER.info("Trying to write CSAR artifact to file with URL {} and UUID {}", url, id);
processCsarArtifact(result);
}
if (!csarFiles.isEmpty()) {
final String archivePath = cbaArchivePath.toString();
- //Extract CBA archive from CSAR package and store it into local disk
+ // Extract CBA archive from CSAR package and store it into local disk
csarFiles.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath));
csarFiles.forEach(file -> FileUtil.deleteFile(file, csarArchivePath.toString()));
} else {
listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc());
}
+
}