Issue-ID: AAI-2281
Change-Id: I0f5cce16ce76113b1fee603ad3c191cb6f9fe80f
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
============LICENSE_START=======================================================
org.onap.aai
================================================================================
============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.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
* "Deployment Flavors" x "ImageInfo"
* </p>
*
* "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
* @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();
*/
public BabelArtifact extract(byte[] csar) throws ToscaToCatalogException {
StopWatch stopwatch = new StopWatch();
/**
* Creates a temporary file to store the CSAR content.
*
/**
* 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
* @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");
*/
private Path createTempFile(byte[] bytes) throws IOException {
Path path = Files.createTempFile("temp", ".csar");
throws SdcToscaParserException, InvalidNumberOfNodesException {
ISdcCsarHelper csarHelper = SdcToscaParserFactory.getInstance().getSdcCsarHelper(csarFilepath);
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()
.filter(filterOnType(SdcTypes.VF)).collect(Collectors.toList());
List<NodeTemplate> vnfConfigs = serviceVfList.stream()
- * 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())) //
.filter(entry -> SOFTWARE_VERSION.equals(entry.getKey())) //
- .map(Entry::getValue).findFirst().orElse(null);
+ .map(Entry::getValue).findFirst() //
+ .map(Object::toString).orElse(null);
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* ============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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.onap.aai.babel.xml.generator;
import java.util.List;
package org.onap.aai.babel.xml.generator;
import java.util.List;
/**
* Generate a {@link List} of {@link BabelArtifact}s from the Artifacts obtained from the CSAR
*
/**
* 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
*/
* @return generated {@link BabelArtifact}s
* @throws XmlArtifactGenerationException
*/
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* ============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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
public class ModelGenerator implements ArtifactGenerator {
*/
public class ModelGenerator implements ArtifactGenerator {
private static final Logger logger = LogHelper.INSTANCE;
private static final String VERSION_DELIMITER = ".";
private static final Logger logger = LogHelper.INSTANCE;
private static final String VERSION_DELIMITER = ".";
*
* @param csarArchive
* @param csarArtifacts
*
* @param csarArchive
* @param csarArtifacts
* @return {@link List} of output artifacts
* @throws XmlArtifactGenerationException
* @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)
*/
@Override
public List<BabelArtifact> generateArtifacts(byte[] csarArchive, List<Artifact> csarArtifacts)
* Creates an instance of an input artifact for the generator.
*
* @param payload
* Creates an instance of an input artifact for the generator.
*
* @param payload
- * the payload downloaded from SDC
+ * the payload downloaded from SDC
- * name of the artifact to create
+ * name of the artifact to create
- * 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) {
* @return an {@link Artifact} object constructed from the payload and artifactInfo
*/
public static Artifact createArtifact(byte[] payload, String artifactName, String artifactVersion) {
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* ============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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.onap.aai.babel.xml.generator;
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;
/**
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);
*/
public XmlArtifactGenerationException(String message) {
super(message);
* @throws XmlArtifactGenerationException
*/
private ModelElement createWidgetRelationshipModelElement(Model model) throws XmlArtifactGenerationException {
* @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());
* ============LICENSE_START=======================================================
* org.onap.aai
* ================================================================================
* ============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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
* ============LICENSE_END=========================================================
*/
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.onap.aai.babel.xml.generator.api;
import java.util.List;
package org.onap.aai.babel.xml.generator.api;
import java.util.List;
import org.onap.aai.babel.xml.generator.data.Artifact;
import org.onap.aai.babel.xml.generator.data.GenerationData;
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.
*
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
*/
* @param additionalParams
* @return Translated/Error data as a {@link GenerationData} object
*/
+ * Write String content to a file, flush and close.
+ *
+ * the String content to write to the file
+ * if the file cannot be opened for writing, or an I/O error occurs
*/
private void writeToFile(File file, String text) throws IOException {
FileWriter fileWriter = new FileWriter(file);
*/
private void writeToFile(File file, String text) throws IOException {
FileWriter fileWriter = new FileWriter(file);
- * Assert authorisation results for an admin user based on the test policy file.
+ * Assert authorization results for an admin user based on the test policy file.
*
* @param auth
* the Auth Service to test
*
* @param auth
* the Auth Service to test