diff options
author | Yulian Han <elaine.hanyulian@huawei.com> | 2018-08-18 20:28:09 +0800 |
---|---|---|
committer | Yulian Han <elaine.hanyulian@huawei.com> | 2018-08-21 16:35:35 +0800 |
commit | 5fc988ea1b7add6604d2e740a90875f9c476e45c (patch) | |
tree | e60d722e8ff328866cd939345457c481674df217 /asdc-controller | |
parent | 32fdbf907f8ca5109461379508e3b28d575a9dc1 (diff) |
save csar file path add directory version
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa70000009
Issue-ID: SO-668
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'asdc-controller')
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java | 11 | ||||
-rw-r--r-- | asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 55a437f2c0..0af1dedce4 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -22,6 +22,7 @@ d * ============LICENSE_START=================================================== package org.onap.so.asdc.client; +import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -352,9 +353,17 @@ public class ASDCController { + artifact.getArtifactUUID () + ")"); + String filePath = System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName(); + // make parent directory + File file = new File(filePath); + File fileParent = file.getParentFile(); + if (!fileParent.exists()) { + fileParent.mkdirs(); + } + byte[] payloadBytes = resultArtifact.getArtifactPayload(); - try (FileOutputStream outFile = new FileOutputStream(System.getProperty("mso.config.path") + "/ASDC" + "/" + artifact.getArtifactName())) { + try (FileOutputStream outFile = new FileOutputStream(filePath)) { LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***WRITE FILE ARTIFACT NAME", "ASDC", artifact.getArtifactName()); outFile.write(payloadBytes, 0, payloadBytes.length); outFile.close(); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index 8353f708a9..030035157d 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -126,7 +126,9 @@ public class ToscaResourceStructure { LOGGER.debug("MSO config path is: " + System.getProperty("mso.config.path")); - File spoolFile = new File(System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactName()); + String filePath = System.getProperty("mso.config.path") + "/ASDC/" + artifact.getArtifactVersion() + "/" + artifact.getArtifactName(); + + File spoolFile = new File(filePath); LOGGER.debug("ASDC File path is: " + spoolFile.getAbsolutePath()); LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, "***PATH", "ASDC", spoolFile.getAbsolutePath()); |