diff options
Diffstat (limited to 'src/main')
6 files changed, 55 insertions, 37 deletions
diff --git a/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java b/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java index 49dd19f..5d33bc2 100644 --- a/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java +++ b/src/main/java/org/onap/aai/babel/csar/vnfcatalog/VnfVendorImageExtractor.java @@ -129,10 +129,12 @@ public class VnfVendorImageExtractor { * "Deployment Flavors" x "ImageInfo" * </p> * - * @param csar compressed format that stores multiple TOSCA files and in particular a vnfConfiguration + * @param csar + * compressed format that stores multiple TOSCA files and in particular a vnfConfiguration * @return BabelArtifact VendorImageConfiguration objects created during processing represented as the Babel service * public data structure - * @throws ToscaToCatalogException if the CSAR content is not valid + * @throws ToscaToCatalogException + * if the CSAR content is not valid */ public BabelArtifact extract(byte[] csar) throws ToscaToCatalogException { StopWatch stopwatch = new StopWatch(); @@ -165,9 +167,11 @@ public class VnfVendorImageExtractor { /** * Creates a temporary file to store the CSAR content. * - * @param bytes the CSAR content + * @param bytes + * the CSAR content * @return Path to a temporary file containing the CSAR bytes - * @throws IOException if an I/O error occurs or the temporary-file directory does not exist + * @throws IOException + * if an I/O error occurs or the temporary-file directory does not exist */ private Path createTempFile(byte[] bytes) throws IOException { Path path = Files.createTempFile("temp", ".csar"); @@ -191,7 +195,7 @@ public class VnfVendorImageExtractor { throws SdcToscaParserException, InvalidNumberOfNodesException { ISdcCsarHelper csarHelper = SdcToscaParserFactory.getInstance().getSdcCsarHelper(csarFilepath); - List<NodeTemplate> serviceVfList = csarHelper.getServiceNodeTemplates().stream() // + List<NodeTemplate> serviceVfList = csarHelper.getServiceNodeTemplates().stream() .filter(filterOnType(SdcTypes.VF)).collect(Collectors.toList()); List<NodeTemplate> vnfConfigs = serviceVfList.stream() @@ -301,16 +305,18 @@ public class VnfVendorImageExtractor { } /** - * Get the first software version value from the properties Map. + * Get the first software_version value from the properties Map. * - * @param image the properties Map - * @return the software version value as a String + * @param properties + * the properties map containing the software_version key + * @return the software_version value as a String, or else null */ - private String findSoftwareVersion(Map<String, Object> image) { - applicationLogger.debug("Finding " + SOFTWARE_VERSION + " from " + image); + private String findSoftwareVersion(Map<String, Object> properties) { + applicationLogger.debug("Finding " + SOFTWARE_VERSION + " from " + properties); - return (String) image.entrySet().stream()// + return properties.entrySet().stream() // .filter(entry -> SOFTWARE_VERSION.equals(entry.getKey())) // - .map(Entry::getValue).findFirst().orElse(null); + .map(Entry::getValue).findFirst() // + .map(Object::toString).orElse(null); } } diff --git a/src/main/java/org/onap/aai/babel/xml/generator/ArtifactGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/ArtifactGenerator.java index d7aca0d..ea267ee 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/ArtifactGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/ArtifactGenerator.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel.xml.generator; import java.util.List; @@ -30,8 +31,10 @@ public interface ArtifactGenerator { /** * Generate a {@link List} of {@link BabelArtifact}s from the Artifacts obtained from the CSAR * - * @param csarArchive original CSAR file (zip format) - * @param csarArtifacts YAML artifacts extracted from the CSAR file + * @param csarArchive + * original CSAR file (zip format) + * @param csarArtifacts + * YAML artifacts extracted from the CSAR file * @return generated {@link BabelArtifact}s * @throws XmlArtifactGenerationException */ diff --git a/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java index bbd1ff3..8daa165 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/ModelGenerator.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2019 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2019 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,6 @@ import org.onap.aai.cl.api.Logger; */ public class ModelGenerator implements ArtifactGenerator { - private static final Logger logger = LogHelper.INSTANCE; private static final String VERSION_DELIMITER = "."; @@ -55,10 +54,10 @@ public class ModelGenerator implements ArtifactGenerator { * * @param csarArchive * @param csarArtifacts - * the input artifacts + * the input artifacts * @return {@link List} of output artifacts * @throws XmlArtifactGenerationException - * if there is an error trying to generate XML artifacts + * if there is an error trying to generate XML artifacts */ @Override public List<BabelArtifact> generateArtifacts(byte[] csarArchive, List<Artifact> csarArtifacts) @@ -94,11 +93,11 @@ public class ModelGenerator implements ArtifactGenerator { * Creates an instance of an input artifact for the generator. * * @param payload - * the payload downloaded from SDC + * the payload downloaded from SDC * @param artifactName - * name of the artifact to create + * name of the artifact to create * @param artifactVersion - * version of the artifact to create + * version of the artifact to create * @return an {@link Artifact} object constructed from the payload and artifactInfo */ public static Artifact createArtifact(byte[] payload, String artifactName, String artifactVersion) { diff --git a/src/main/java/org/onap/aai/babel/xml/generator/XmlArtifactGenerationException.java b/src/main/java/org/onap/aai/babel/xml/generator/XmlArtifactGenerationException.java index 5e5304b..ebb6c47 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/XmlArtifactGenerationException.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/XmlArtifactGenerationException.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,17 +18,22 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel.xml.generator; -/** This class represents an exception encountered when generating an Artifact. */ +/** + * This class represents a fatal exception encountered when generating an Artifact. + * + */ public class XmlArtifactGenerationException extends Exception { private static final long serialVersionUID = 1L; /** - * Constructor for an instance of this exception with just a message. + * Constructor for an instance of this exception with a message for the caller. * - * @param message information about the exception + * @param message + * information about the exception */ public XmlArtifactGenerationException(String message) { super(message); diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java index 91eb6a4..0aaf8fc 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiModelGenerator.java @@ -138,8 +138,7 @@ public class AaiModelGenerator { * @throws XmlArtifactGenerationException */ private ModelElement createWidgetRelationshipModelElement(Model model) throws XmlArtifactGenerationException { - return createRelationshipModelElement(model.getDeleteFlag(), model.getWidgetId(), - model.getWidgetInvariantId()); + return createRelationshipModelElement(model.getDeleteFlag(), model.getWidgetId(), model.getWidgetInvariantId()); } /** diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/ArtifactGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/api/ArtifactGenerator.java index 598fd32..292a7d7 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/api/ArtifactGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/api/ArtifactGenerator.java @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 European Software Marketing Ltd. + * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2017-2019 European Software Marketing Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.babel.xml.generator.api; import java.util.List; @@ -25,15 +26,20 @@ import java.util.Map; import org.onap.aai.babel.xml.generator.data.Artifact; import org.onap.aai.babel.xml.generator.data.GenerationData; -/** Artifact Generation. Note that there is only one implementation of this interface currently. */ -@FunctionalInterface +/** + * Artifact Generation. Note that there is only one implementation of this interface currently. + * + */ +@FunctionalInterface // for SONAR only public interface ArtifactGenerator { /** * Implementation of the method to generate AAI artifacts. * - * @param csarArchive original CSAR (zip format) - * @param input List of input tosca files + * @param csarArchive + * original CSAR (zip format) + * @param input + * List of input tosca files * @param additionalParams * @return Translated/Error data as a {@link GenerationData} object */ |