From adcd4f2bc695840e9ecbc05003bc52c675f22fec Mon Sep 17 00:00:00 2001 From: KAPIL SINGAL Date: Fri, 22 Jan 2021 11:49:51 -0500 Subject: Renaming Files having BluePrint to have Blueprint Replacing BluePrint with Blueprint throughout Issue-ID: CCSDK-3098 Signed-off-by: KAPIL SINGAL Change-Id: Ibee8bad07ae7d9287073db2d4f2f2cd730fa8b96 --- .../SdcListenerNotificationCallback.java | 4 +- .../handler/BluePrintProcesssorHandler.java | 67 ---------------------- .../handler/BlueprintProcesssorHandler.java | 67 ++++++++++++++++++++++ .../cds/sdclistener/service/ListenerService.java | 4 +- .../sdclistener/service/ListenerServiceImpl.java | 20 +++---- 5 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java create mode 100644 ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java (limited to 'ms/sdclistener/application/src/main') diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java index b8868325a..45fb36736 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java @@ -122,13 +122,13 @@ public class SdcListenerNotificationCallback implements INotificationCallback { final String archivePath = cbaArchivePath.toString(); // Extract CBA archive from CSAR package and store it into local disk - csarFiles.forEach(file -> listenerService.extractBluePrint(file.getAbsolutePath(), archivePath)); + csarFiles.forEach(file -> listenerService.extractBlueprint(file.getAbsolutePath(), archivePath)); csarFiles.forEach(file -> FileUtil.deleteFile(file, csarArchivePath.toString())); } else { LOGGER.error("Could not able to read CSAR files from this location {}", csarArchivePath); } - listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc()); + listenerService.saveBlueprintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc()); } } diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java deleted file mode 100644 index b80dd260d..000000000 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright © 2019 Bell Canada - * - * 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. - */ - -package org.onap.ccsdk.cds.sdclistener.handler; - -import io.grpc.ManagedChannel; -import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc.BluePrintManagementServiceBlockingStub; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -@ConfigurationProperties("listenerservice") -@Component -public class BluePrintProcesssorHandler implements AutoCloseable { - - private static final Logger LOGGER = LoggerFactory.getLogger(BluePrintProcesssorHandler.class); - - private ManagedChannel channel; - - /** - * Sending CBA archive to CDS backend to store into its Database. - * - * @param request BluePrintManagementInput object holds CBA archive, its version and blueprints. - * @param managedChannel - ManagedChannel object helps to access the server or application end point. - * - * @return A response object - */ - public Status sendRequest(BluePrintUploadInput request, ManagedChannel managedChannel) { - LOGGER.info("Sending request to blueprint processor"); - - this.channel = managedChannel; - - final BluePrintManagementServiceBlockingStub syncStub = BluePrintManagementServiceGrpc.newBlockingStub(channel); - - // Send the request to CDS backend. - final BluePrintManagementOutput response = syncStub.uploadBlueprint(request); - - return response.getStatus(); - } - - @Override - public void close() { - if (channel != null) { - channel.shutdown(); - } - LOGGER.info("Stopping GRPC connection to CDS backend"); - } - -} diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java new file mode 100644 index 000000000..41475cd6b --- /dev/null +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BlueprintProcesssorHandler.java @@ -0,0 +1,67 @@ +/* + * Copyright © 2019 Bell Canada + * + * 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. + */ + +package org.onap.ccsdk.cds.sdclistener.handler; + +import io.grpc.ManagedChannel; +import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementOutput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementServiceGrpc; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintManagementServiceGrpc.BlueprintManagementServiceBlockingStub; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintUploadInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@ConfigurationProperties("listenerservice") +@Component +public class BlueprintProcesssorHandler implements AutoCloseable { + + private static final Logger LOGGER = LoggerFactory.getLogger(BlueprintProcesssorHandler.class); + + private ManagedChannel channel; + + /** + * Sending CBA archive to CDS backend to store into its Database. + * + * @param request BlueprintManagementInput object holds CBA archive, its version and blueprints. + * @param managedChannel - ManagedChannel object helps to access the server or application end point. + * + * @return A response object + */ + public Status sendRequest(BlueprintUploadInput request, ManagedChannel managedChannel) { + LOGGER.info("Sending request to blueprint processor"); + + this.channel = managedChannel; + + final BlueprintManagementServiceBlockingStub syncStub = BlueprintManagementServiceGrpc.newBlockingStub(channel); + + // Send the request to CDS backend. + final BlueprintManagementOutput response = syncStub.uploadBlueprint(request); + + return response.getStatus(); + } + + @Override + public void close() { + if (channel != null) { + channel.shutdown(); + } + LOGGER.info("Stopping GRPC connection to CDS backend"); + } + +} diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java index 5fa3fb327..231054f06 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java @@ -29,7 +29,7 @@ public interface ListenerService { * @param csarArchivePath The path where CSAR archive is stored. * @param cbaArchivePath The destination path where CBA will be stored. */ - void extractBluePrint(String csarArchivePath, String cbaArchivePath); + void extractBlueprint(String csarArchivePath, String cbaArchivePath); /** * Store the Zip file into CDS database. @@ -37,7 +37,7 @@ public interface ListenerService { * @param path path where zip file exists. * @param managedChannel To access the blueprint processor application end point */ - void saveBluePrintToCdsDatabase(Path path, ManagedChannel managedChannel); + void saveBlueprintToCdsDatabase(Path path, ManagedChannel managedChannel); /** * Extract and store the csar package to local disk. diff --git a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java index ee27a9475..1aebd74b8 100644 --- a/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java @@ -23,12 +23,12 @@ import org.apache.commons.io.IOUtils; import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers; import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; -import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput; +import org.onap.ccsdk.cds.controllerblueprints.management.api.BlueprintUploadInput; import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk; import org.onap.ccsdk.cds.controllerblueprints.management.api.UploadAction; import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; -import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler; +import org.onap.ccsdk.cds.sdclistener.handler.BlueprintProcesssorHandler; import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; import org.onap.ccsdk.cds.sdclistener.util.FileUtil; import org.onap.sdc.api.results.IDistributionClientDownloadResult; @@ -64,7 +64,7 @@ import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK; public class ListenerServiceImpl implements ListenerService { @Autowired - private BluePrintProcesssorHandler bluePrintProcesssorHandler; + private BlueprintProcesssorHandler bluePrintProcesssorHandler; @Autowired private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @@ -87,7 +87,7 @@ public class ListenerServiceImpl implements ListenerService { private static final Logger LOGGER = LoggerFactory.getLogger(ListenerServiceImpl.class); @Override - public void extractBluePrint(String csarArchivePath, String cbaArchivePath) { + public void extractBlueprint(String csarArchivePath, String cbaArchivePath) { int validPathCount = 0; final String distributionId = getDistributionId(); final String artifactUrl = getArtifactUrl(); @@ -101,7 +101,7 @@ public class ListenerServiceImpl implements ListenerService { validPathCount++; final String cbaArchiveName = Paths.get(fileName).getFileName().toString(); LOGGER.info("Storing the CBA archive {}", cbaArchiveName); - storeBluePrint(zipFile, cbaArchiveName, cbaStorageDir, entry); + storeBlueprint(zipFile, cbaArchiveName, cbaStorageDir, entry); } } @@ -121,7 +121,7 @@ public class ListenerServiceImpl implements ListenerService { } } - private void storeBluePrint(ZipFile zipFile, String fileName, Path cbaArchivePath, ZipEntry entry) { + private void storeBlueprint(ZipFile zipFile, String fileName, Path cbaArchivePath, ZipEntry entry) { Path targetLocation = cbaArchivePath.resolve(fileName); LOGGER.info("The target location for zip file is {}", targetLocation); File targetZipFile = new File(targetLocation.toString()); @@ -144,7 +144,7 @@ public class ListenerServiceImpl implements ListenerService { } @Override - public void saveBluePrintToCdsDatabase(Path cbaArchivePath, ManagedChannel channel) { + public void saveBlueprintToCdsDatabase(Path cbaArchivePath, ManagedChannel channel) { List zipFiles = FileUtil.getFilesFromDisk(cbaArchivePath); if (!zipFiles.isEmpty()) { prepareRequestForCdsBackend(zipFiles, channel, cbaArchivePath.toString()); @@ -193,7 +193,7 @@ public class ListenerServiceImpl implements ListenerService { files.forEach(zipFile -> { try { - final BluePrintUploadInput request = generateBluePrintUploadInputBuilder(zipFile, path); + final BlueprintUploadInput request = generateBlueprintUploadInputBuilder(zipFile, path); // Send request to CDS Backend. final Status responseStatus = bluePrintProcesssorHandler.sendRequest(request, managedChannel); @@ -219,11 +219,11 @@ public class ListenerServiceImpl implements ListenerService { }); } - private BluePrintUploadInput generateBluePrintUploadInputBuilder(File file, String path) throws IOException { + private BlueprintUploadInput generateBlueprintUploadInputBuilder(File file, String path) throws IOException { byte[] bytes = FileUtils.readFileToByteArray(file); FileChunk fileChunk = FileChunk.newBuilder().setChunk(ByteString.copyFrom(bytes)).build(); FileUtil.deleteFile(file, path); - return BluePrintUploadInput.newBuilder() + return BlueprintUploadInput.newBuilder() .setCommonHeader(CommonHeader.newBuilder().setRequestId(UUID.randomUUID().toString()) .setSubRequestId(UUID.randomUUID().toString()).setOriginatorId("SDC-LISTENER").build()) .setActionIdentifiers( -- cgit 1.2.3-korg