- for (IArtifactInfo artifact : artifacts) {
- // Grab the current time so we can measure the download time for the
- // metrics log
- long startTimeInMs = System.currentTimeMillis();
- MdcOverride override = new MdcOverride();
- override.addAttribute(MdcContext.MDC_START_TIME, dateFormatter.format(startTimeInMs));
-
- // Download Artifact
- IDistributionClientDownloadResult downloadResult = client.download(artifact);
-
- // Generate metrics log
- metricsLogger.info(ModelLoaderMsgs.DOWNLOAD_COMPLETE, null, override,
- artifact.getArtifactName(), downloadResult.getDistributionActionResult().toString());
-
- if (downloadResult.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
- publishDownloadFailure(data, artifact, downloadResult.getDistributionMessageResult());
- success = false;
- break;
- }
-
- logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT,
- "Downloaded artifact: " + artifact.getArtifactName() + " Payload:\n" + new String(downloadResult.getArtifactPayload()));
-
- publishDownloadSuccess(data, artifact, downloadResult);
-
- if ((artifact.getArtifactType().compareToIgnoreCase(ArtifactTypeEnum.MODEL_INVENTORY_PROFILE.toString()) == 0)
- || (artifact.getArtifactType().compareToIgnoreCase(ArtifactTypeEnum.MODEL_QUERY_SPEC.toString()) == 0)) {
- IModelParser parser = ModelParserFactory.createModelParser(downloadResult.getArtifactPayload(), downloadResult.getArtifactName());
- List<Artifact> parsedArtifacts = parser.parse(downloadResult.getArtifactPayload(), downloadResult.getArtifactName());
- if (parsedArtifacts != null && !parsedArtifacts.isEmpty()) {
- modelArtifacts.addAll(parsedArtifacts);
- } else {
- success = false;
- publishDeployFailure(data, artifact);
- break;
- }
- } else if (artifact.getArtifactType()
- .compareToIgnoreCase(ArtifactTypeEnum.VNF_CATALOG.toString()) == 0) {
- catalogArtifacts
- .add(new VnfCatalogArtifact(new String(downloadResult.getArtifactPayload())));
- }