summaryrefslogtreecommitdiffstats
path: root/ueb-listener
diff options
context:
space:
mode:
authorLalena Aria <la505a@att.com>2017-11-08 16:25:41 +0000
committerlalena.aria <lalena.aria@att.com>2017-11-08 16:46:37 +0000
commitf1cdb6b4212168879f623abd4beb345dadf200dd (patch)
tree66e76e73bd8241d3329da9b6696b9ab7a6f5f31d /ueb-listener
parentda99eed5436f92eb2b4794cc0399bdb0eb400afc (diff)
Abstract
Changes made: update AAI Service path list from the latest version published by AAI Team Change-Id: Ie6d5451777cfd45b528acdfe098e31f26ab3714c Issue-ID: SDC-564 Signed-off-by: lalena.aria <lalena.aria@att.com>
Diffstat (limited to 'ueb-listener')
-rw-r--r--ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java33
1 files changed, 24 insertions, 9 deletions
diff --git a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java
index d01b02589..aa856b4fe 100644
--- a/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java
+++ b/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java
@@ -26,6 +26,7 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
@@ -396,21 +397,35 @@ public class SdncUebCallback implements INotificationCallback {
return;
}
- String payload = new String(payloadBytes);
-
File spoolFile = new File(incomingDir.getAbsolutePath() + "/" + artifact.getArtifactName());
boolean writeSucceeded = false;
- try (FileWriter spoolFileWriter = new FileWriter(spoolFile)) {
- spoolFileWriter.write(payload);
- spoolFileWriter.close();
- writeSucceeded = true;
- } catch (Exception e) {
- LOG.error("Unable to save downloaded file to spool directory ("+ incomingDir.getAbsolutePath() +")", e);
- }
+ // Save zip if TOSCA_CSAR
+ if (artifact.getArtifactType().contains("TOSCA_CSAR") || artifact.getArtifactName().contains(".csar")) {
+ try {
+ FileOutputStream outFile = new FileOutputStream(incomingDir.getAbsolutePath() + "/" + artifact.getArtifactName());
+ outFile.write(payloadBytes, 0, payloadBytes.length);
+ outFile.close();
+ writeSucceeded = true;
+ } catch (Exception e) {
+ LOG.error("Unable to save downloaded zip file to spool directory ("+ incomingDir.getAbsolutePath() +")", e);
+ }
+
+ } else {
+ String payload = new String(payloadBytes);
+
+ try {
+ FileWriter spoolFileWriter = new FileWriter(spoolFile);
+ spoolFileWriter.write(payload);
+ spoolFileWriter.close();
+ writeSucceeded = true;
+ } catch (Exception e) {
+ LOG.error("Unable to save downloaded file to spool directory ("+ incomingDir.getAbsolutePath() +")", e);
+ }
+ }
if (writeSucceeded && (downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS)) {
handleSuccessfulDownload(data, svcName, resourceName, artifact, spoolFile, archiveDir);