* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.onap.ccsdk.cds.sdclistener.service;
import com.google.protobuf.ByteString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
-import java.io.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
if (validPathCount == 0) {
LOGGER
- .info("CBA archive doesn't exist in the CSAR Package or it doesn't exist as per the given path {}",
- CBA_ZIP_PATH);
+ .info("CBA archive doesn't exist in the CSAR Package or it doesn't exist as per the given path {}",
+ CBA_ZIP_PATH);
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null,
- artifactUrl, SDC_LISTENER_COMPONENT);
+ artifactUrl, SDC_LISTENER_COMPONENT);
}
} catch (Exception e) {
final String errorMessage = format("Failed to extract blueprint %s", e.getMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage,
- artifactUrl, SDC_LISTENER_COMPONENT);
+ artifactUrl, SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
}
}
File targetZipFile = new File(targetLocation.toString());
try {
- if (! targetZipFile.createNewFile()) {
+ if (!targetZipFile.createNewFile()) {
LOGGER.warn("Overwriting zip file {}", targetLocation);
}
} catch (IOException e) {
}
try (InputStream inputStream = zipFile.getInputStream(entry); OutputStream out = new FileOutputStream(
- targetZipFile)) {
+ targetZipFile)) {
IOUtils.copy(inputStream, out);
LOGGER.info("Successfully store the CBA archive {} at this location", targetZipFile);
} catch (Exception e) {
if (responseStatus.getCode() != SUCCESS_CODE) {
final String errorMessage = format("Failed to store the CBA archive into CDS DB due to %s",
- responseStatus.getErrorMessage());
+ responseStatus.getErrorMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
} else {
LOGGER.info(responseStatus.getMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_OK, null, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ SDC_LISTENER_COMPONENT);
}
} catch (Exception e) {
final String errorMessage = format("Failure due to %s", e.getMessage());
listenerStatus.sendResponseBackToSdc(distributionId, COMPONENT_DONE_ERROR, errorMessage, artifactUrl,
- SDC_LISTENER_COMPONENT);
+ SDC_LISTENER_COMPONENT);
LOGGER.error(errorMessage);
}
});
private String getArtifactUrl() {
return sdcListenerDto.getArtifactUrl();
}
+
}