+ List<String> relevantArtifactTypes = sdcConfig.getRelevantArtifactTypes();
+ Path path = Paths.get("/data");
+ ArrayList<VfModuleModel> vfModuleModels = new ArrayList<>();
+ HashMap<String, IArtifactInfo> artifactMap = new HashMap<>();//key is UUID, value is artifact for shared folder
+ String vfArtifactData = null;
+ IArtifactInfo vfModuleMetaDataArtifact = null;
+
+ for (final IArtifactInfo artifact : resource.getArtifacts()) {
+ artifactMap.put(artifact.getArtifactUUID(),artifact);
+
+ //extract the artifactlist and write them into MongoDB
+ if (artifact.getArtifactType().equals("VF_MODULES_METADATA")) {
+ try {
+ final IDistributionClientDownloadResult resultArtifact =
+ downloadTheArtifact(artifact,notificationData);
+ if (resultArtifact != null) {
+ vfArtifactData = new String(resultArtifact.getArtifactPayload(),"UTF-8");
+ LOGGER.debug("VF_MODULE_ARTIFACT: " + new String(resultArtifact.getArtifactPayload(),"UTF-8"));
+ }
+ Type listType = new TypeToken<ArrayList<VfModuleModel>>(){}.getType();
+ vfModuleModels = new Gson().fromJson(vfArtifactData,listType);
+ LOGGER.debug("pass to process VF_MODULES_METADATA artifacts ");
+ vfModuleMetaDataArtifact = artifact;
+ } catch (final ArtifactDownloadException | UnsupportedEncodingException exp) {
+ LOGGER.error("Failed to process csar VF_MODULES_METADATA artifacts ", exp);
+ artifactsProcessedSuccessfully = false;
+ sendDistributionStatus(DistributionStatusType.DEPLOY, artifact.getArtifactURL(),
+ notificationData.getDistributionID(), DistributionStatusEnum.DEPLOY_ERROR,
+ "Failed to deploy the artifact due to: " + exp.getMessage());
+ }
+ }
+ }
+
+ //foreach(vf_module_metadata)
+ // 1. create a dir like /data/UUID1
+ // 2. put the vfmodule-meta.json into it
+ // 3. put the service-meta.json into it
+ // 3. go through each aritfact uuid under artifact_list of vf_module and download
+ for (final VfModuleModel vfModule : vfModuleModels) {