summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authormark.j.leonard <mark.j.leonard@gmail.com>2018-04-26 16:53:12 +0100
committermark.j.leonard <mark.j.leonard@gmail.com>2018-04-26 16:53:50 +0100
commit6e4f04afea4c2d07fdd9c15eda38438c7baeb308 (patch)
tree8fd7e14ff590adb16f5b49221b3a7b901fd1fa4c /src/main/java/org/onap
parent3a1f764b762a91e917e9e14a00c4a7ff3c4e0745 (diff)
Convert project from AJSC to Spring Boot
Remove all AJSC configuration and dependencies. Update the pom.xml to use oparent and to depend on Spring Boot. Refactor the main class to introduce a minimal set of Spring annotations. Note that the license text was corrected in this change. Issue-ID: AAI-1039 Change-Id: I16385db3216ec39bfd2881f2278e340ec3795199 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java555
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/Artifact.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/ArtifactHandler.java20
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/ArtifactType.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifact.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/catalog/VnfImageException.java14
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifact.java13
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifactParser.java15
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/BabelArtifactParsingException.java13
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/IModelArtifact.java13
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/IModelId.java17
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/IModelParser.java13
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java20
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactHandler.java19
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactParser.java18
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/ModelSorter.java28
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifact.java23
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifactParser.java26
-rw-r--r--src/main/java/org/onap/aai/modelloader/entity/model/Pair.java13
-rw-r--r--src/main/java/org/onap/aai/modelloader/extraction/ArtifactInfoExtractor.java18
-rw-r--r--src/main/java/org/onap/aai/modelloader/extraction/InvalidArchiveException.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/ArtifactDeploymentManager.java18
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/ArtifactDownloadManager.java24
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/BabelArtifactConverter.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/BasicStatusMsg.java57
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMessageBuilder.java27
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMsg.java49
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMessageBuilder.java30
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMsg.java123
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/DownloadFailureException.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/EventCallback.java21
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java34
-rw-r--r--src/main/java/org/onap/aai/modelloader/notification/ProcessToscaArtifactsException.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClient.java15
-rw-r--r--src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientFactory.java12
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/ArtifactInfoImpl.java25
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/ModelLoaderApplication.java37
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/ModelLoaderInterface.java94
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/ModelLoaderMsgs.java14
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java138
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/NotificationDataImpl.java18
-rw-r--r--src/main/java/org/onap/aai/modelloader/service/SdcConnectionJob.java18
-rw-r--r--src/main/java/org/onap/aai/modelloader/util/JsonXmlConverter.java12
45 files changed, 863 insertions, 849 deletions
diff --git a/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java b/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java
index 692f412..3f03bb5 100644
--- a/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java
+++ b/src/main/java/org/onap/aai/modelloader/config/ModelLoaderConfig.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.config;
@@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.eclipse.jetty.util.security.Password;
-import org.openecomp.sdc.api.consumer.IConfiguration;
+import org.onap.sdc.api.consumer.IConfiguration;
/**
* Properties for the Model Loader
@@ -33,267 +33,286 @@ import org.openecomp.sdc.api.consumer.IConfiguration;
*/
public class ModelLoaderConfig implements IConfiguration {
- // Configuration file structure
- public static final String PREFIX_MODEL_LOADER_CONFIG = "ml";
- public static final String PREFIX_DISTRIBUTION_CLIENT = PREFIX_MODEL_LOADER_CONFIG + ".distribution.";
- public static final String PREFIX_AAI = PREFIX_MODEL_LOADER_CONFIG + ".aai.";
- public static final String PREFIX_BABEL = PREFIX_MODEL_LOADER_CONFIG + ".babel.";
- public static final String PREFIX_DEBUG = PREFIX_MODEL_LOADER_CONFIG + ".debug.";
-
- private static final String SUFFIX_KEYSTORE_FILE = "KEYSTORE_FILE";
- private static final String SUFFIX_KEYSTORE_PASS = "KEYSTORE_PASSWORD";
-
- // Configuration file properties
- protected static final String PROP_ML_DISTRIBUTION_ACTIVE_SERVER_TLS_AUTH =
- PREFIX_DISTRIBUTION_CLIENT + "ACTIVE_SERVER_TLS_AUTH";
- protected static final String PROP_ML_DISTRIBUTION_ASDC_CONNECTION_DISABLED = PREFIX_DISTRIBUTION_CLIENT + "ASDC_CONNECTION_DISABLE";
- protected static final String PROP_ML_DISTRIBUTION_ASDC_ADDRESS = PREFIX_DISTRIBUTION_CLIENT + "ASDC_ADDRESS";
- protected static final String PROP_ML_DISTRIBUTION_CONSUMER_GROUP = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_GROUP";
- protected static final String PROP_ML_DISTRIBUTION_CONSUMER_ID = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_ID";
- protected static final String PROP_ML_DISTRIBUTION_ENVIRONMENT_NAME =
- PREFIX_DISTRIBUTION_CLIENT + "ENVIRONMENT_NAME";
- protected static final String PROP_ML_DISTRIBUTION_KEYSTORE_PASSWORD =
- PREFIX_DISTRIBUTION_CLIENT + SUFFIX_KEYSTORE_PASS;
- protected static final String PROP_ML_DISTRIBUTION_KEYSTORE_FILE =
- PREFIX_DISTRIBUTION_CLIENT + SUFFIX_KEYSTORE_FILE;
- protected static final String PROP_ML_DISTRIBUTION_PASSWORD = PREFIX_DISTRIBUTION_CLIENT + "PASSWORD";
- protected static final String PROP_ML_DISTRIBUTION_POLLING_INTERVAL =
- PREFIX_DISTRIBUTION_CLIENT + "POLLING_INTERVAL";
- protected static final String PROP_ML_DISTRIBUTION_POLLING_TIMEOUT = PREFIX_DISTRIBUTION_CLIENT + "POLLING_TIMEOUT";
- protected static final String PROP_ML_DISTRIBUTION_USER = PREFIX_DISTRIBUTION_CLIENT + "USER";
- protected static final String PROP_ML_DISTRIBUTION_ARTIFACT_TYPES = PREFIX_DISTRIBUTION_CLIENT + "ARTIFACT_TYPES";
- protected static final String PROP_ML_DISTRIBUTION_MSG_BUS_ADDRESSES = PREFIX_DISTRIBUTION_CLIENT + "MSG_BUS_ADDRESSES";
- protected static final String PROP_ML_DISTRIBUTION_HTTPS_WITH_DMAAP =
- PREFIX_DISTRIBUTION_CLIENT + "USE_HTTPS_WITH_DMAAP";
-
- protected static final String PROP_AAI_BASE_URL = PREFIX_AAI + "BASE_URL";
- protected static final String PROP_AAI_KEYSTORE_FILE = PREFIX_AAI + SUFFIX_KEYSTORE_FILE;
- protected static final String PROP_AAI_KEYSTORE_PASSWORD = PREFIX_AAI + SUFFIX_KEYSTORE_PASS;
- protected static final String PROP_AAI_MODEL_RESOURCE_URL = PREFIX_AAI + "MODEL_URL";
- protected static final String PROP_AAI_NAMED_QUERY_RESOURCE_URL = PREFIX_AAI + "NAMED_QUERY_URL";
- protected static final String PROP_AAI_VNF_IMAGE_RESOURCE_URL = PREFIX_AAI + "VNF_IMAGE_URL";
- protected static final String PROP_AAI_AUTHENTICATION_USER = PREFIX_AAI + "AUTH_USER";
- protected static final String PROP_AAI_AUTHENTICATION_PASSWORD = PREFIX_AAI + "AUTH_PASSWORD";
-
- protected static final String PROP_BABEL_BASE_URL = PREFIX_BABEL + "BASE_URL";
- protected static final String PROP_BABEL_KEYSTORE_FILE = PREFIX_BABEL + SUFFIX_KEYSTORE_FILE;
- protected static final String PROP_BABEL_KEYSTORE_PASSWORD = PREFIX_BABEL + SUFFIX_KEYSTORE_PASS;
- protected static final String PROP_BABEL_GENERATE_RESOURCE_URL = PREFIX_BABEL + "GENERATE_ARTIFACTS_URL";
-
- protected static final String PROP_DEBUG_INGEST_SIMULATOR = PREFIX_DEBUG + "INGEST_SIMULATOR";
-
- private Properties modelLoaderProperties = null;
-
- private String certLocation = ".";
-
- private List<String> artifactTypes = null;
-
- private List<String> msgBusAddrs = null;
-
- private String modelVersion = null;
-
-
- /**
- * This is the class constructor.
- *
- * @param modelLoaderProperties properties needed to be configured for the model loader
- * @param certLocation location of the certificate
- */
- public ModelLoaderConfig(Properties modelLoaderProperties, String certLocation) {
- this.modelLoaderProperties = modelLoaderProperties;
- this.certLocation = certLocation;
-
- // Get list of artifacts
- artifactTypes = new ArrayList<>();
- if (modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ARTIFACT_TYPES) != null) {
- String[] artTypeList = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ARTIFACT_TYPES).split(",");
- for (String artType : artTypeList) {
- artifactTypes.add(artType);
- }
- }
-
- // Get list of message bus addresses
- msgBusAddrs = new ArrayList<>();
- if (modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_MSG_BUS_ADDRESSES) != null) {
- String[] msgBusList = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_MSG_BUS_ADDRESSES).split(",");
- for (String addr : msgBusList) {
- msgBusAddrs.add(addr);
- }
- }
- }
-
- @Override
- public boolean activateServerTLSAuth() {
- String value = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ACTIVE_SERVER_TLS_AUTH);
- return value == null ? false : Boolean.parseBoolean(value);
- }
-
- @Override
- public String getAsdcAddress() {
- return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ASDC_ADDRESS);
- }
-
- @Override
- public String getConsumerGroup() {
- return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_CONSUMER_GROUP);
- }
-
- @Override
- public String getConsumerID() {
- return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_CONSUMER_ID);
- }
-
- @Override
- public String getEnvironmentName() {
- return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ENVIRONMENT_NAME);
- }
-
- @Override
- public String getKeyStorePassword() {
- return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_KEYSTORE_PASSWORD));
- }
-
- @Override
- public String getKeyStorePath() {
- return certLocation + modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_KEYSTORE_FILE);
- }
-
- @Override
- public String getPassword() {
- return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_PASSWORD));
- }
-
- @Override
- public int getPollingInterval() {
- return Integer.parseInt(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_POLLING_INTERVAL));
- }
-
- @Override
- public int getPollingTimeout() {
- return Integer.parseInt(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_POLLING_TIMEOUT));
- }
-
- @Override
- public List<String> getRelevantArtifactTypes() {
- return artifactTypes;
- }
-
- @Override
- public String getUser() {
- return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_USER);
- }
-
- @Override
- public boolean isFilterInEmptyResources() {
- return false;
- }
-
- @Override
- public Boolean isUseHttpsWithDmaap() {
- String useHTTPS = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_HTTPS_WITH_DMAAP);
- return useHTTPS == null ? false : Boolean.valueOf(useHTTPS);
- }
-
- @Override
- public List<String> getMsgBusAddress() {
- return msgBusAddrs;
- }
-
- public String getAaiKeyStorePath() {
- return certLocation + File.separator + modelLoaderProperties.getProperty(PROP_AAI_KEYSTORE_FILE);
- }
-
- public String getBabelKeyStorePath() {
- return certLocation + File.separator + modelLoaderProperties.getProperty(PROP_BABEL_KEYSTORE_FILE);
- }
-
- public String getAaiKeyStorePassword() {
- return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_AAI_KEYSTORE_PASSWORD));
- }
-
- public String getBabelKeyStorePassword() {
- return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_BABEL_KEYSTORE_PASSWORD));
- }
-
- public String getAaiBaseUrl() {
- return modelLoaderProperties.getProperty(PROP_AAI_BASE_URL);
- }
-
- public String getBabelBaseUrl() {
- return modelLoaderProperties.getProperty(PROP_BABEL_BASE_URL);
- }
-
- public String getBabelGenerateArtifactsUrl() {
- return modelLoaderProperties.getProperty(PROP_BABEL_GENERATE_RESOURCE_URL);
- }
-
- public String getAaiModelUrl(String version) {
- setModelVersion(version);
- return updatePropertyOXMVersion(modelLoaderProperties, PROP_AAI_MODEL_RESOURCE_URL, version);
- }
-
- public String getAaiNamedQueryUrl(String version) {
- return updatePropertyOXMVersion(modelLoaderProperties, PROP_AAI_NAMED_QUERY_RESOURCE_URL, version);
- }
-
- public String getAaiVnfImageUrl() {
- return updatePropertyOXMVersion(modelLoaderProperties, PROP_AAI_VNF_IMAGE_RESOURCE_URL, getModelVersion());
- }
-
- public String getAaiAuthenticationUser() {
- return modelLoaderProperties.getProperty(PROP_AAI_AUTHENTICATION_USER);
- }
-
- public String getModelVersion() {
- return modelVersion;
- }
-
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- /**
- * @return password for AAI authentication that has been reverse-engineered from its obfuscated form.
- */
- public String getAaiAuthenticationPassword() {
- String password = Password.deobfuscate(modelLoaderProperties.getProperty(PROP_AAI_AUTHENTICATION_PASSWORD));
-
- if (password != null && password.isEmpty()) {
- password = null;
- }
-
- return password;
- }
-
- /**
- * @return a boolean value indicating whether the simulator is enabled.
- */
- public boolean getIngestSimulatorEnabled() {
- String propValue = modelLoaderProperties.getProperty(PROP_DEBUG_INGEST_SIMULATOR);
- return propValue != null && "enabled".equalsIgnoreCase(propValue);
- }
-
- /**
- * @return a String value of the defined property with the oxm version
- */
- private String updatePropertyOXMVersion(Properties modelLoaderProperties, String propertyName, String version) {
- if (version != null)
- return modelLoaderProperties.getProperty(propertyName).replace("v*", version);
- else
- return modelLoaderProperties.getProperty(propertyName);
- }
-
-
-
-
- /**
- * @return a boolean value indicating whether model loader is connected to ASDC.
- */
- public boolean getASDCConnectionDisabled(){
- String propValue = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ASDC_CONNECTION_DISABLED);
- return propValue != null && "true".equalsIgnoreCase(propValue);
-
- }
+ // Configuration file structure
+ public static final String PREFIX_MODEL_LOADER_CONFIG = "ml";
+ public static final String PREFIX_DISTRIBUTION_CLIENT = PREFIX_MODEL_LOADER_CONFIG + ".distribution.";
+ public static final String PREFIX_AAI = PREFIX_MODEL_LOADER_CONFIG + ".aai.";
+ public static final String PREFIX_BABEL = PREFIX_MODEL_LOADER_CONFIG + ".babel.";
+ public static final String PREFIX_DEBUG = PREFIX_MODEL_LOADER_CONFIG + ".debug.";
+
+ private static final String SUFFIX_KEYSTORE_FILE = "KEYSTORE_FILE";
+ private static final String SUFFIX_KEYSTORE_PASS = "KEYSTORE_PASSWORD";
+
+ // Configuration file properties
+ protected static final String PROP_ML_DISTRIBUTION_ACTIVE_SERVER_TLS_AUTH =
+ PREFIX_DISTRIBUTION_CLIENT + "ACTIVE_SERVER_TLS_AUTH";
+ protected static final String PROP_ML_DISTRIBUTION_ASDC_CONNECTION_DISABLED =
+ PREFIX_DISTRIBUTION_CLIENT + "ASDC_CONNECTION_DISABLE";
+ protected static final String PROP_ML_DISTRIBUTION_ASDC_ADDRESS = PREFIX_DISTRIBUTION_CLIENT + "ASDC_ADDRESS";
+ protected static final String PROP_ML_DISTRIBUTION_CONSUMER_GROUP = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_GROUP";
+ protected static final String PROP_ML_DISTRIBUTION_CONSUMER_ID = PREFIX_DISTRIBUTION_CLIENT + "CONSUMER_ID";
+ protected static final String PROP_ML_DISTRIBUTION_ENVIRONMENT_NAME =
+ PREFIX_DISTRIBUTION_CLIENT + "ENVIRONMENT_NAME";
+ protected static final String PROP_ML_DISTRIBUTION_KEYSTORE_PASSWORD =
+ PREFIX_DISTRIBUTION_CLIENT + SUFFIX_KEYSTORE_PASS;
+ protected static final String PROP_ML_DISTRIBUTION_KEYSTORE_FILE =
+ PREFIX_DISTRIBUTION_CLIENT + SUFFIX_KEYSTORE_FILE;
+ protected static final String PROP_ML_DISTRIBUTION_PASSWORD = PREFIX_DISTRIBUTION_CLIENT + "PASSWORD";
+ protected static final String PROP_ML_DISTRIBUTION_POLLING_INTERVAL =
+ PREFIX_DISTRIBUTION_CLIENT + "POLLING_INTERVAL";
+ protected static final String PROP_ML_DISTRIBUTION_POLLING_TIMEOUT = PREFIX_DISTRIBUTION_CLIENT + "POLLING_TIMEOUT";
+ protected static final String PROP_ML_DISTRIBUTION_USER = PREFIX_DISTRIBUTION_CLIENT + "USER";
+ protected static final String PROP_ML_DISTRIBUTION_ARTIFACT_TYPES = PREFIX_DISTRIBUTION_CLIENT + "ARTIFACT_TYPES";
+ protected static final String PROP_ML_DISTRIBUTION_MSG_BUS_ADDRESSES =
+ PREFIX_DISTRIBUTION_CLIENT + "MSG_BUS_ADDRESSES";
+ protected static final String PROP_ML_DISTRIBUTION_HTTPS_WITH_DMAAP =
+ PREFIX_DISTRIBUTION_CLIENT + "USE_HTTPS_WITH_DMAAP";
+
+ protected static final String PROP_AAI_BASE_URL = PREFIX_AAI + "BASE_URL";
+ protected static final String PROP_AAI_KEYSTORE_FILE = PREFIX_AAI + SUFFIX_KEYSTORE_FILE;
+ protected static final String PROP_AAI_KEYSTORE_PASSWORD = PREFIX_AAI + SUFFIX_KEYSTORE_PASS;
+ protected static final String PROP_AAI_MODEL_RESOURCE_URL = PREFIX_AAI + "MODEL_URL";
+ protected static final String PROP_AAI_NAMED_QUERY_RESOURCE_URL = PREFIX_AAI + "NAMED_QUERY_URL";
+ protected static final String PROP_AAI_VNF_IMAGE_RESOURCE_URL = PREFIX_AAI + "VNF_IMAGE_URL";
+ protected static final String PROP_AAI_AUTHENTICATION_USER = PREFIX_AAI + "AUTH_USER";
+ protected static final String PROP_AAI_AUTHENTICATION_PASSWORD = PREFIX_AAI + "AUTH_PASSWORD";
+
+ protected static final String PROP_BABEL_BASE_URL = PREFIX_BABEL + "BASE_URL";
+ protected static final String PROP_BABEL_KEYSTORE_FILE = PREFIX_BABEL + SUFFIX_KEYSTORE_FILE;
+ protected static final String PROP_BABEL_KEYSTORE_PASSWORD = PREFIX_BABEL + SUFFIX_KEYSTORE_PASS;
+ protected static final String PROP_BABEL_GENERATE_RESOURCE_URL = PREFIX_BABEL + "GENERATE_ARTIFACTS_URL";
+
+ protected static final String PROP_DEBUG_INGEST_SIMULATOR = PREFIX_DEBUG + "INGEST_SIMULATOR";
+ private static String configHome;
+
+ private Properties modelLoaderProperties = null;
+
+ private String certLocation = ".";
+
+ private List<String> artifactTypes = null;
+
+ private List<String> msgBusAddrs = null;
+
+ private String modelVersion = null;
+
+ protected static final String FILESEP =
+ (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
+
+ public static void setConfigHome(String configHome) {
+ ModelLoaderConfig.configHome = configHome;
+ }
+
+ public static String propertiesFile() {
+ return configHome + FILESEP + "model-loader.properties";
+ }
+
+ public ModelLoaderConfig(Properties configProperties) {
+ this(configProperties, ModelLoaderConfig.configHome + FILESEP + "auth" + FILESEP);
+ }
+
+ /**
+ * Original constructor
+ *
+ * @param modelLoaderProperties properties needed to be configured for the model loader
+ * @param certLocation location of the certificate
+ */
+ public ModelLoaderConfig(Properties modelLoaderProperties, String certLocation) {
+ this.modelLoaderProperties = modelLoaderProperties;
+ this.certLocation = certLocation;
+
+ // Get list of artifacts
+ artifactTypes = new ArrayList<>();
+ if (modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ARTIFACT_TYPES) != null) {
+ String[] artTypeList = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ARTIFACT_TYPES).split(",");
+ for (String artType : artTypeList) {
+ artifactTypes.add(artType);
+ }
+ }
+
+ // Get list of message bus addresses
+ msgBusAddrs = new ArrayList<>();
+ if (modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_MSG_BUS_ADDRESSES) != null) {
+ String[] msgBusList = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_MSG_BUS_ADDRESSES).split(",");
+ for (String addr : msgBusList) {
+ msgBusAddrs.add(addr);
+ }
+ }
+ }
+
+
+ @Override
+ public boolean activateServerTLSAuth() {
+ String value = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ACTIVE_SERVER_TLS_AUTH);
+ return value == null ? false : Boolean.parseBoolean(value);
+ }
+
+ @Override
+ public String getAsdcAddress() {
+ return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ASDC_ADDRESS);
+ }
+
+ @Override
+ public String getConsumerGroup() {
+ return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_CONSUMER_GROUP);
+ }
+
+ @Override
+ public String getConsumerID() {
+ return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_CONSUMER_ID);
+ }
+
+ @Override
+ public String getEnvironmentName() {
+ return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ENVIRONMENT_NAME);
+ }
+
+ @Override
+ public String getKeyStorePassword() {
+ return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_KEYSTORE_PASSWORD));
+ }
+
+ @Override
+ public String getKeyStorePath() {
+ return certLocation + modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_KEYSTORE_FILE);
+ }
+
+ @Override
+ public String getPassword() {
+ return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_PASSWORD));
+ }
+
+ @Override
+ public int getPollingInterval() {
+ return Integer.parseInt(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_POLLING_INTERVAL));
+ }
+
+ @Override
+ public int getPollingTimeout() {
+ return Integer.parseInt(modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_POLLING_TIMEOUT));
+ }
+
+ @Override
+ public List<String> getRelevantArtifactTypes() {
+ return artifactTypes;
+ }
+
+ @Override
+ public String getUser() {
+ return modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_USER);
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ return false;
+ }
+
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
+ String useHTTPS = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_HTTPS_WITH_DMAAP);
+ return useHTTPS == null ? false : Boolean.valueOf(useHTTPS);
+ }
+
+ @Override
+ public List<String> getMsgBusAddress() {
+ return msgBusAddrs;
+ }
+
+ public String getAaiKeyStorePath() {
+ return certLocation + File.separator + modelLoaderProperties.getProperty(PROP_AAI_KEYSTORE_FILE);
+ }
+
+ public String getBabelKeyStorePath() {
+ String filename = modelLoaderProperties.getProperty(PROP_BABEL_KEYSTORE_FILE);
+ if (filename == null) {
+ return null;
+ } else {
+ return certLocation + File.separator + filename;
+ }
+ }
+
+ public String getAaiKeyStorePassword() {
+ return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_AAI_KEYSTORE_PASSWORD));
+ }
+
+ public String getBabelKeyStorePassword() {
+ return Password.deobfuscate(modelLoaderProperties.getProperty(PROP_BABEL_KEYSTORE_PASSWORD));
+ }
+
+ public String getAaiBaseUrl() {
+ return modelLoaderProperties.getProperty(PROP_AAI_BASE_URL);
+ }
+
+ public String getBabelBaseUrl() {
+ return modelLoaderProperties.getProperty(PROP_BABEL_BASE_URL);
+ }
+
+ public String getBabelGenerateArtifactsUrl() {
+ return modelLoaderProperties.getProperty(PROP_BABEL_GENERATE_RESOURCE_URL);
+ }
+
+ public String getAaiModelUrl(String version) {
+ setModelVersion(version);
+ return updatePropertyOXMVersion(modelLoaderProperties, PROP_AAI_MODEL_RESOURCE_URL, version);
+ }
+
+ public String getAaiNamedQueryUrl(String version) {
+ return updatePropertyOXMVersion(modelLoaderProperties, PROP_AAI_NAMED_QUERY_RESOURCE_URL, version);
+ }
+ public String getAaiVnfImageUrl() {
+ return updatePropertyOXMVersion(modelLoaderProperties, PROP_AAI_VNF_IMAGE_RESOURCE_URL, getModelVersion());
+ }
+
+ public String getAaiAuthenticationUser() {
+ return modelLoaderProperties.getProperty(PROP_AAI_AUTHENTICATION_USER);
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ /**
+ * @return password for AAI authentication that has been reverse-engineered from its obfuscated form.
+ */
+ public String getAaiAuthenticationPassword() {
+ String password = Password.deobfuscate(modelLoaderProperties.getProperty(PROP_AAI_AUTHENTICATION_PASSWORD));
+
+ if (password != null && password.isEmpty()) {
+ password = null;
+ }
+
+ return password;
+ }
+
+ /**
+ * @return a boolean value indicating whether the simulator is enabled.
+ */
+ public boolean getIngestSimulatorEnabled() {
+ String propValue = modelLoaderProperties.getProperty(PROP_DEBUG_INGEST_SIMULATOR);
+ return propValue != null && "enabled".equalsIgnoreCase(propValue);
+ }
+
+ /**
+ * @return a String value of the defined property with the oxm version
+ */
+ private String updatePropertyOXMVersion(Properties modelLoaderProperties, String propertyName, String version) {
+ if (version != null)
+ return modelLoaderProperties.getProperty(propertyName).replace("v*", version);
+ else
+ return modelLoaderProperties.getProperty(propertyName);
+ }
+
+ /**
+ * @return a boolean value indicating whether model loader is connected to ASDC.
+ */
+ public boolean getASDCConnectionDisabled() {
+ String propValue = modelLoaderProperties.getProperty(PROP_ML_DISTRIBUTION_ASDC_CONNECTION_DISABLED);
+ return propValue != null && "true".equalsIgnoreCase(propValue);
+
+ }
}
diff --git a/src/main/java/org/onap/aai/modelloader/entity/Artifact.java b/src/main/java/org/onap/aai/modelloader/entity/Artifact.java
index 4c0e0f1..f576e24 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/Artifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/Artifact.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/ArtifactHandler.java b/src/main/java/org/onap/aai/modelloader/entity/ArtifactHandler.java
index 9e80e05..b1fed03 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/ArtifactHandler.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/ArtifactHandler.java
@@ -1,27 +1,26 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity;
import java.util.List;
-
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.restclient.AaiRestClient;
@@ -33,9 +32,8 @@ public abstract class ArtifactHandler {
this.config = config;
}
- public abstract boolean pushArtifacts(List<Artifact> artifacts, String distributionId, List<Artifact> completedArtifacts,
- AaiRestClient restClient);
+ public abstract boolean pushArtifacts(List<Artifact> artifacts, String distributionId,
+ List<Artifact> completedArtifacts, AaiRestClient restClient);
- public abstract void rollback(List<Artifact> completedArtifacts, String distributionId,
- AaiRestClient aaiClient);
+ public abstract void rollback(List<Artifact> completedArtifacts, String distributionId, AaiRestClient aaiClient);
}
diff --git a/src/main/java/org/onap/aai/modelloader/entity/ArtifactType.java b/src/main/java/org/onap/aai/modelloader/entity/ArtifactType.java
index 6959936..a58c874 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/ArtifactType.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/ArtifactType.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifact.java b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifact.java
index 3219625..a8f4e60 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifact.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.catalog;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java
index b224407..85be50b 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfCatalogArtifactHandler.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.catalog;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfImageException.java b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfImageException.java
index 9459c49..c116abe 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfImageException.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/catalog/VnfImageException.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.catalog;
@@ -55,4 +55,4 @@ class VnfImageException extends Exception {
return resultCode;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifact.java b/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifact.java
index 3c1152f..35c672a 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifact.java
@@ -1,29 +1,28 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifactParser.java b/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifactParser.java
index fd6af31..35405e6 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifactParser.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/AbstractModelArtifactParser.java
@@ -1,24 +1,23 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
-
package org.onap.aai.modelloader.entity.model;
import java.io.StringReader;
@@ -30,12 +29,10 @@ import java.util.stream.Collector;
import java.util.stream.IntStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-
import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/BabelArtifactParsingException.java b/src/main/java/org/onap/aai/modelloader/entity/model/BabelArtifactParsingException.java
index 1426e82..a3f14ba 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/BabelArtifactParsingException.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/BabelArtifactParsingException.java
@@ -1,24 +1,23 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
-
package org.onap.aai.modelloader.entity.model;
/**
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/IModelArtifact.java b/src/main/java/org/onap/aai/modelloader/entity/model/IModelArtifact.java
index 5978b99..a3b0737 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/IModelArtifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/IModelArtifact.java
@@ -1,24 +1,23 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
-
package org.onap.aai.modelloader.entity.model;
/**
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/IModelId.java b/src/main/java/org/onap/aai/modelloader/entity/model/IModelId.java
index 9b635bf..41ac94b 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/IModelId.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/IModelId.java
@@ -1,35 +1,34 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
-
package org.onap.aai.modelloader.entity.model;
/**
- * Defines methods for c
+ * Defines methods for Model Id
*/
public interface IModelId {
/**
* This method is responsible for using the values in the supplied Pair to set the id of the model.
*
- * The definition of what the relationship will be is defined by the implementation. Some model ids would have
+ * The definition of what the relationship will be is defined by the implementation. Some model ids would have
* single key/value pairs, others would have a composite key.
*
* Where the id of the model is a composite key multiple calls to this method will be required to successfully set
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/IModelParser.java b/src/main/java/org/onap/aai/modelloader/entity/model/IModelParser.java
index 758a882..7287142 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/IModelParser.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/IModelParser.java
@@ -1,27 +1,26 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
import java.util.List;
-
import org.onap.aai.modelloader.entity.Artifact;
@FunctionalInterface
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java
index 896167a..154cda1 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifact.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
@@ -31,16 +31,14 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
+import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
import org.onap.aai.modelloader.restclient.AaiRestClient;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
-import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.restclient.client.OperationResult;
-
import org.w3c.dom.Node;
public class ModelArtifact extends AbstractModelArtifact {
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactHandler.java b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactHandler.java
index 157ac8d..626ca49 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactHandler.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactHandler.java
@@ -1,34 +1,33 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
import java.util.List;
-
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactHandler;
import org.onap.aai.modelloader.restclient.AaiRestClient;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
public class ModelArtifactHandler extends ArtifactHandler {
@@ -45,7 +44,7 @@ public class ModelArtifactHandler extends ArtifactHandler {
List<Artifact> sortedModelArtifacts;
try {
sortedModelArtifacts = modelSorter.sort(artifacts);
- } catch (RuntimeException ex) {
+ } catch (BabelArtifactParsingException ex) {
logger.error(ModelLoaderMsgs.DISTRIBUTION_EVENT_ERROR, "Unable to resolve models: " + ex.getMessage());
return false;
}
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactParser.java b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactParser.java
index 17bdd87..e687be0 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactParser.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/ModelArtifactParser.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
@@ -25,12 +25,10 @@ import java.util.Objects;
import java.util.stream.Collector;
import java.util.stream.IntStream;
import javax.xml.XMLConstants;
-
-import org.onap.aai.modelloader.entity.Artifact;
-import org.onap.aai.modelloader.service.ModelLoaderMsgs;
import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
-
+import org.onap.aai.modelloader.entity.Artifact;
+import org.onap.aai.modelloader.service.ModelLoaderMsgs;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/ModelSorter.java b/src/main/java/org/onap/aai/modelloader/entity/model/ModelSorter.java
index e8fcf3f..4c39975 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/ModelSorter.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/ModelSorter.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
@@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import jline.internal.Log;
-
import org.onap.aai.modelloader.entity.Artifact;
/**
@@ -115,15 +114,14 @@ public class ModelSorter {
*
* @param originalList the list that needs to be sorted
* @return a list of sorted models
+ * @throws BabelArtifactParsingException
*/
- public List<Artifact> sort(List<Artifact> originalList) {
-
- if (originalList.size() <= 1) {
+ public List<Artifact> sort(List<Artifact> originalList) throws BabelArtifactParsingException {
+ if (originalList == null || originalList.size() <= 1) {
return originalList;
}
- Collection<Node> nodes = createNodes(originalList);
- Collection<Node> sortedNodes = sortNodes(nodes);
+ Collection<Node> sortedNodes = sortNodes(createNodes(originalList));
List<Artifact> sortedModelsList = new ArrayList<>(sortedNodes.size());
for (Node node : sortedNodes) {
@@ -188,8 +186,9 @@ public class ModelSorter {
*
* @param unsortedNodes the collection of nodes to be sorted
* @return a sorted collection of the given nodes
+ * @throws BabelArtifactParsingException
*/
- private Collection<Node> sortNodes(Collection<Node> unsortedNodes) {
+ private Collection<Node> sortNodes(Collection<Node> unsortedNodes) throws BabelArtifactParsingException {
// L <- Empty list that will contain the sorted elements
List<Node> nodeList = new ArrayList<>();
@@ -233,7 +232,8 @@ public class ModelSorter {
}
}
if (cycle) {
- throw new RuntimeException("Circular dependency present between models, topological sort not possible");
+ throw new BabelArtifactParsingException(
+ "Circular dependency present between models, topological sort not possible");
}
return nodeList;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifact.java b/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifact.java
index 668a751..4df9879 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifact.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifact.java
@@ -1,37 +1,35 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
+import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.ArtifactType;
import org.onap.aai.modelloader.restclient.AaiRestClient;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
-
-import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.restclient.client.OperationResult;
public class NamedQueryArtifact extends AbstractModelArtifact {
@@ -58,7 +56,8 @@ public class NamedQueryArtifact extends AbstractModelArtifact {
}
@Override
- public boolean push(AaiRestClient aaiClient, ModelLoaderConfig config, String distId, List<Artifact> completedArtifacts) {
+ public boolean push(AaiRestClient aaiClient, ModelLoaderConfig config, String distId,
+ List<Artifact> completedArtifacts) {
OperationResult getResponse =
aaiClient.getResource(getNamedQueryUrl(config), distId, MediaType.APPLICATION_XML_TYPE);
if ((getResponse == null) || (getResponse.getResultCode() != Response.Status.OK.getStatusCode())) {
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifactParser.java b/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifactParser.java
index 5b9488e..3a0eada 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifactParser.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/NamedQueryArtifactParser.java
@@ -1,32 +1,30 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.entity.model;
import java.util.List;
-
-import org.onap.aai.modelloader.entity.Artifact;
-import org.onap.aai.modelloader.service.ModelLoaderMsgs;
import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
-
+import org.onap.aai.modelloader.entity.Artifact;
+import org.onap.aai.modelloader.service.ModelLoaderMsgs;
import org.w3c.dom.Node;
public class NamedQueryArtifactParser extends AbstractModelArtifactParser {
@@ -44,15 +42,13 @@ public class NamedQueryArtifactParser extends AbstractModelArtifactParser {
boolean valid = false;
if (model != null) {
- logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT,
- "Named-Query parsed =====>>>> " + "Named-Query-UUID: " + ((NamedQueryArtifact) model)
- .getNamedQueryUuid());
+ logger.info(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Named-Query parsed =====>>>> " + "Named-Query-UUID: "
+ + ((NamedQueryArtifact) model).getNamedQueryUuid());
modelList.add((NamedQueryArtifact) model);
valid = true;
} else {
- logger.error(ModelLoaderMsgs.ARTIFACT_PARSE_ERROR,
- "Unable to parse named-query artifact " + artifactName);
+ logger.error(ModelLoaderMsgs.ARTIFACT_PARSE_ERROR, "Unable to parse named-query artifact " + artifactName);
}
return valid;
diff --git a/src/main/java/org/onap/aai/modelloader/entity/model/Pair.java b/src/main/java/org/onap/aai/modelloader/entity/model/Pair.java
index ede60eb..e6382b1 100644
--- a/src/main/java/org/onap/aai/modelloader/entity/model/Pair.java
+++ b/src/main/java/org/onap/aai/modelloader/entity/model/Pair.java
@@ -1,24 +1,23 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
-
package org.onap.aai.modelloader.entity.model;
/**
diff --git a/src/main/java/org/onap/aai/modelloader/extraction/ArtifactInfoExtractor.java b/src/main/java/org/onap/aai/modelloader/extraction/ArtifactInfoExtractor.java
index 7dbc34f..0fde55c 100644
--- a/src/main/java/org/onap/aai/modelloader/extraction/ArtifactInfoExtractor.java
+++ b/src/main/java/org/onap/aai/modelloader/extraction/ArtifactInfoExtractor.java
@@ -1,30 +1,30 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.extraction;
import java.util.ArrayList;
import java.util.List;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
/**
* This class is responsible for extracting implementations of IArtifactInto from an implementation of
diff --git a/src/main/java/org/onap/aai/modelloader/extraction/InvalidArchiveException.java b/src/main/java/org/onap/aai/modelloader/extraction/InvalidArchiveException.java
index 5e6353f..36581df 100644
--- a/src/main/java/org/onap/aai/modelloader/extraction/InvalidArchiveException.java
+++ b/src/main/java/org/onap/aai/modelloader/extraction/InvalidArchiveException.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.extraction;
diff --git a/src/main/java/org/onap/aai/modelloader/notification/ArtifactDeploymentManager.java b/src/main/java/org/onap/aai/modelloader/notification/ArtifactDeploymentManager.java
index 6d75306..ca17261 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/ArtifactDeploymentManager.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/ArtifactDeploymentManager.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
@@ -27,9 +27,9 @@ import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.entity.catalog.VnfCatalogArtifactHandler;
import org.onap.aai.modelloader.entity.model.ModelArtifactHandler;
import org.onap.aai.modelloader.restclient.AaiRestClient;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
/**
* This class is responsible for deploying model and catalog artifacts.
diff --git a/src/main/java/org/onap/aai/modelloader/notification/ArtifactDownloadManager.java b/src/main/java/org/onap/aai/modelloader/notification/ArtifactDownloadManager.java
index 3fa0b40..9dbe397 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/ArtifactDownloadManager.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/ArtifactDownloadManager.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
@@ -41,12 +41,12 @@ import org.onap.aai.modelloader.extraction.InvalidArchiveException;
import org.onap.aai.modelloader.restclient.BabelServiceClient;
import org.onap.aai.modelloader.restclient.BabelServiceClientFactory;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.sdc.utils.ArtifactTypeEnum;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.results.IDistributionClientDownloadResult;
+import org.onap.sdc.utils.ArtifactTypeEnum;
+import org.onap.sdc.utils.DistributionActionResultEnum;
/**
* This class is responsible for downloading the artifacts from the ASDC.
diff --git a/src/main/java/org/onap/aai/modelloader/notification/BabelArtifactConverter.java b/src/main/java/org/onap/aai/modelloader/notification/BabelArtifactConverter.java
index 7eb562a..ad4eb7d 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/BabelArtifactConverter.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/BabelArtifactConverter.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
diff --git a/src/main/java/org/onap/aai/modelloader/notification/BasicStatusMsg.java b/src/main/java/org/onap/aai/modelloader/notification/BasicStatusMsg.java
new file mode 100644
index 0000000..03f521e
--- /dev/null
+++ b/src/main/java/org/onap/aai/modelloader/notification/BasicStatusMsg.java
@@ -0,0 +1,57 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.modelloader.notification;
+
+import org.onap.sdc.api.consumer.IDistributionStatusMessageBasic;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+public class BasicStatusMsg implements IDistributionStatusMessageBasic {
+
+ private static final String COMPONENT_NAME = "AAI";
+ protected DistributionStatusEnum status;
+ protected String distributionId;
+ protected String consumerId;
+
+ @Override
+ public long getTimestamp() {
+ return System.currentTimeMillis();
+ }
+
+ @Override
+ public DistributionStatusEnum getStatus() {
+ return status;
+ }
+
+ @Override
+ public String getDistributionID() {
+ return distributionId;
+ }
+
+ @Override
+ public String getConsumerID() {
+ return consumerId;
+ }
+
+ public String getComponentName() {
+ return COMPONENT_NAME;
+ }
+
+}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMessageBuilder.java b/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMessageBuilder.java
index 5660ad0..c389945 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMessageBuilder.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMessageBuilder.java
@@ -1,29 +1,29 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.IComponentDoneStatusMessage;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.utils.DistributionStatusEnum;
/**
* This class is responsible for building an instance of {@link DistributionStatusMsg}.
@@ -33,15 +33,16 @@ public class CompDoneStatusMessageBuilder {
private CompDoneStatusMessageBuilder() {}
/**
- * Builds an instance of {@link CompDoneStatusMsg} from the given parameters about the status of the
- * distribution of the given artifact.
+ * Builds an instance of {@link CompDoneStatusMsg} from the given parameters about the status of the distribution of
+ * the given artifact.
*
* @param client the distribution client this message pertains to
* @param data data about the notification that resulted in this message being created
* @param status the status of the distribution of the artifact to be reported
* @return IComponentDoneStatusMessage implementation of IComponentDoneStatusMessage from the given parameters
*/
- public static IComponentDoneStatusMessage build(IDistributionClient client, INotificationData data, DistributionStatusEnum status) {
+ public static IComponentDoneStatusMessage build(IDistributionClient client, INotificationData data,
+ DistributionStatusEnum status) {
return new CompDoneStatusMsg(status, data.getDistributionID(), client.getConfiguration().getConsumerID());
}
}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMsg.java b/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMsg.java
index db358f3..422052a 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMsg.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/CompDoneStatusMsg.java
@@ -1,36 +1,32 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
-import org.openecomp.sdc.api.consumer.IComponentDoneStatusMessage;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.consumer.IComponentDoneStatusMessage;
+import org.onap.sdc.utils.DistributionStatusEnum;
-public class CompDoneStatusMsg implements IComponentDoneStatusMessage {
-
- private DistributionStatusEnum status;
- private String distributionId;
- private String consumerId;
+public class CompDoneStatusMsg extends BasicStatusMsg implements IComponentDoneStatusMessage {
/**
- * Creates a new DistributionStatusMsg instance.
+ * Creates a new Component Done Status Message instance.
*
* @param status - The distribution status to be reported.
* @param distributionId - The identifier of the distribution who's status is being rported on.
@@ -41,29 +37,4 @@ public class CompDoneStatusMsg implements IComponentDoneStatusMessage {
this.distributionId = distributionId;
this.consumerId = consumerId;
}
-
- @Override
- public long getTimestamp() {
- return System.currentTimeMillis();
- }
-
- @Override
- public DistributionStatusEnum getStatus() {
- return status;
- }
-
- @Override
- public String getDistributionID() {
- return distributionId;
- }
-
- @Override
- public String getConsumerID() {
- return consumerId;
- }
-
- @Override
- public String getComponentName() {
- return "AAI";
- }
}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMessageBuilder.java b/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMessageBuilder.java
index fcfd81c..91cd3de 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMessageBuilder.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMessageBuilder.java
@@ -1,30 +1,30 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.utils.DistributionStatusEnum;
/**
* This class is responsible for building an instance of {@link DistributionStatusMsg}.
@@ -58,9 +58,9 @@ public class DistributionStatusMessageBuilder {
* @param status the status of the distribution of the artifact to be reported
* @return IDistributionStatusMessage implementation of IDistributionStatusMsg from the given parameters
*/
- public static IDistributionStatusMessage build(IDistributionClient client,
- INotificationData data, DistributionStatusEnum status) {
- return new DistributionStatusMsg(status, data.getDistributionID(),
- client.getConfiguration().getConsumerID(), "");
+ public static IDistributionStatusMessage build(IDistributionClient client, INotificationData data,
+ DistributionStatusEnum status) {
+ return new DistributionStatusMsg(status, data.getDistributionID(), client.getConfiguration().getConsumerID(),
+ "");
}
}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMsg.java b/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMsg.java
index cc9fb0b..0a2d6a9 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMsg.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/DistributionStatusMsg.java
@@ -1,73 +1,50 @@
-/**
- * ============LICENSE_START==========================================
- * org.onap.aai
- * ===================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- */
-package org.onap.aai.modelloader.notification;
-
-import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
-
-public class DistributionStatusMsg implements IDistributionStatusMessage {
-
- private DistributionStatusEnum status;
- private String distributionId;
- private String consumerId;
- private String artifactUrl;
-
- /**
- * Creates a new DistributionStatusMsg instance.
- *
- * @param status - The distribution status to be reported.
- * @param distributionId - The identifier of the distribution who's status is being rported on.
- * @param consumerId - Identifier of the consumer associated with the distribution.
- * @param artifactUrl - Resource identifier for the artifact.
- */
- public DistributionStatusMsg(DistributionStatusEnum status, String distributionId, String consumerId,
- String artifactUrl) {
- this.status = status;
- this.distributionId = distributionId;
- this.consumerId = consumerId;
- this.artifactUrl = artifactUrl;
- }
-
- @Override
- public long getTimestamp() {
- return System.currentTimeMillis();
- }
-
- @Override
- public DistributionStatusEnum getStatus() {
- return status;
- }
-
- @Override
- public String getDistributionID() {
- return distributionId;
- }
-
- @Override
- public String getConsumerID() {
- return consumerId;
- }
-
- @Override
- public String getArtifactURL() {
- return artifactUrl;
- }
-}
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.modelloader.notification;
+
+import org.onap.sdc.api.consumer.IDistributionStatusMessage;
+import org.onap.sdc.utils.DistributionStatusEnum;
+
+public class DistributionStatusMsg extends BasicStatusMsg implements IDistributionStatusMessage {
+
+ private String artifactUrl;
+
+ /**
+ * Creates a new Distribution Status Message instance.
+ *
+ * @param status - The distribution status to be reported.
+ * @param distributionId - The identifier of the distribution who's status is being rported on.
+ * @param consumerId - Identifier of the consumer associated with the distribution.
+ * @param artifactUrl - Resource identifier for the artifact.
+ */
+ public DistributionStatusMsg(DistributionStatusEnum status, String distributionId, String consumerId,
+ String artifactUrl) {
+ this.status = status;
+ this.distributionId = distributionId;
+ this.consumerId = consumerId;
+ this.artifactUrl = artifactUrl;
+ }
+
+ @Override
+ public String getArtifactURL() {
+ return artifactUrl;
+ }
+}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/DownloadFailureException.java b/src/main/java/org/onap/aai/modelloader/notification/DownloadFailureException.java
index 73a191a..d39330f 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/DownloadFailureException.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/DownloadFailureException.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
diff --git a/src/main/java/org/onap/aai/modelloader/notification/EventCallback.java b/src/main/java/org/onap/aai/modelloader/notification/EventCallback.java
index fe6bf7b..2baa217 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/EventCallback.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/EventCallback.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
@@ -30,10 +30,10 @@ import org.onap.aai.modelloader.entity.Artifact;
import org.onap.aai.modelloader.extraction.ArtifactInfoExtractor;
import org.onap.aai.modelloader.restclient.BabelServiceClientFactory;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.INotificationCallback;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.consumer.INotificationCallback;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
import org.slf4j.MDC;
public class EventCallback implements INotificationCallback {
@@ -76,6 +76,7 @@ public class EventCallback implements INotificationCallback {
if (artifactDeploymentManager == null) {
artifactDeploymentManager = new ArtifactDeploymentManager(client, config);
}
+
return artifactDeploymentManager;
}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java b/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java
index 447e817..967a290 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/NotificationPublisher.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
@@ -31,12 +31,12 @@ import org.onap.aai.cl.mdc.MdcContext;
import org.onap.aai.cl.mdc.MdcOverride;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.service.ModelLoaderMsgs;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.results.IDistributionClientResult;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.utils.DistributionStatusEnum;
/**
* This class is responsible for publishing the status of actions performed working with artifacts.
@@ -46,24 +46,18 @@ class NotificationPublisher {
private static Logger logger = LoggerFactory.getInstance().getLogger(NotificationPublisher.class);
private static Logger metricsLogger = LoggerFactory.getInstance().getMetricsLogger(NotificationPublisher.class);
- protected static final String FILESEP =
- (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
- protected static final String CONFIG_DIR = System.getProperty("CONFIG_HOME") + FILESEP;
- protected static final String CONFIG_AUTH_LOCATION = CONFIG_DIR + "auth" + FILESEP;
- protected static final String CONFIG_FILE = CONFIG_DIR + "model-loader.properties";
-
private boolean publishingEnabled;
public NotificationPublisher() {
Properties configProperties = new Properties();
try {
- configProperties.load(new FileInputStream(CONFIG_FILE));
+ configProperties.load(new FileInputStream(ModelLoaderConfig.propertiesFile()));
} catch (IOException e) {
String errorMsg = "Failed to load configuration: " + e.getMessage();
logger.error(ModelLoaderMsgs.DISTRIBUTION_EVENT_ERROR, e, errorMsg);
}
- ModelLoaderConfig config = new ModelLoaderConfig(configProperties, CONFIG_AUTH_LOCATION);
+ ModelLoaderConfig config = new ModelLoaderConfig(configProperties);
publishingEnabled = !config.getASDCConnectionDisabled();
}
diff --git a/src/main/java/org/onap/aai/modelloader/notification/ProcessToscaArtifactsException.java b/src/main/java/org/onap/aai/modelloader/notification/ProcessToscaArtifactsException.java
index 6678af6..0d082c1 100644
--- a/src/main/java/org/onap/aai/modelloader/notification/ProcessToscaArtifactsException.java
+++ b/src/main/java/org/onap/aai/modelloader/notification/ProcessToscaArtifactsException.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.notification;
diff --git a/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java b/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
index 28cd671..5576ea9 100644
--- a/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
+++ b/src/main/java/org/onap/aai/modelloader/restclient/AaiRestClient.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.restclient;
diff --git a/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClient.java b/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClient.java
index a861580..fa677a9 100644
--- a/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClient.java
+++ b/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClient.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.restclient;
@@ -173,7 +173,8 @@ public class BabelServiceClient {
.post(ClientResponse.class, obj.toString());
String sanitizedJson = JsonSanitizer.sanitize(response.getEntity(String.class));
- logger.debug(ModelLoaderMsgs.DISTRIBUTION_EVENT, "Babel response " + response.getStatus() + " " + sanitizedJson);
+ logger.debug(ModelLoaderMsgs.DISTRIBUTION_EVENT,
+ "Babel response " + response.getStatus() + " " + sanitizedJson);
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
throw new BabelServiceException(sanitizedJson);
diff --git a/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientFactory.java b/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientFactory.java
index 6ce4a60..4354710 100644
--- a/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientFactory.java
+++ b/src/main/java/org/onap/aai/modelloader/restclient/BabelServiceClientFactory.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.restclient;
diff --git a/src/main/java/org/onap/aai/modelloader/service/ArtifactInfoImpl.java b/src/main/java/org/onap/aai/modelloader/service/ArtifactInfoImpl.java
index e32d92c..9af92be 100644
--- a/src/main/java/org/onap/aai/modelloader/service/ArtifactInfoImpl.java
+++ b/src/main/java/org/onap/aai/modelloader/service/ArtifactInfoImpl.java
@@ -1,37 +1,38 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.service;
import java.util.Collections;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
+import java.util.List;
+import org.onap.sdc.api.notification.IArtifactInfo;
/**
* This class is an implementation of IArtifactInfo for test purposes.
*/
public class ArtifactInfoImpl implements IArtifactInfo {
- private java.lang.String artifactName;
- private java.lang.String artifactType;
- private java.lang.String artifactDescription;
- private java.lang.String artifactVersion;
+ private String artifactName;
+ private String artifactType;
+ private String artifactDescription;
+ private String artifactVersion;
@Override
public String getArtifactName() {
@@ -95,7 +96,7 @@ public class ArtifactInfoImpl implements IArtifactInfo {
}
@Override
- public java.util.List<org.openecomp.sdc.api.notification.IArtifactInfo> getRelatedArtifacts() {
+ public List<IArtifactInfo> getRelatedArtifacts() {
return Collections.emptyList();
}
diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderApplication.java b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderApplication.java
new file mode 100644
index 0000000..c0eb5f2
--- /dev/null
+++ b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderApplication.java
@@ -0,0 +1,37 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.modelloader.service;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * Model Loader Spring Boot Application.
+ */
+
+@SpringBootApplication
+public class ModelLoaderApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(ModelLoaderApplication.class, args);
+ }
+
+}
diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderInterface.java b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderInterface.java
index 1b466c8..6796090 100644
--- a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderInterface.java
+++ b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderInterface.java
@@ -1,49 +1,45 @@
-/**
- * ============LICENSE_START==========================================
- * org.onap.aai
- * ===================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- */
-package org.onap.aai.modelloader.service;
-
-import java.io.IOException;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-public interface ModelLoaderInterface {
-
- @GET
- @Path("/loadModel/{modelid}")
- public Response loadModel(@PathParam("modelid") String modelid);
-
- @PUT
- @Path("/saveModel/{modelid}/{modelname}")
- public Response saveModel(@PathParam("modelid") String modelid, @PathParam("modelname") String modelname);
-
- @POST
- @Consumes("text/plain")
- @Produces("application/xml")
- @Path("/ingestModel/{modelName}/{modelVersion}")
- public Response ingestModel(@PathParam("modelName") String modelid, @PathParam("modelVersion") String modelVersion,
- String payload) throws IOException;
-}
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.modelloader.service;
+
+import java.io.IOException;
+import javax.ws.rs.core.Response;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+public interface ModelLoaderInterface {
+
+ @RequestMapping(value = "/loadModel/{modelid}", //
+ method = RequestMethod.GET, produces = "application/json")
+ @ResponseBody
+ public Response loadModel(String modelid);
+
+ @RequestMapping(value = "/saveModel/{modelid}/{modelname}", //
+ method = RequestMethod.PUT, produces = "application/json")
+ @ResponseBody
+ public Response saveModel(String modelid, String modelname);
+
+ @RequestMapping(value = "/ingestModel/{modelName}/{modelVersion}", //
+ method = RequestMethod.POST, produces = "application/json")
+ @ResponseBody
+ public Response ingestModel(String modelid, String modelVersion, String payload) throws IOException;
+}
diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderMsgs.java b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderMsgs.java
index c5f00c0..fd39a9a 100644
--- a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderMsgs.java
+++ b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderMsgs.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.service;
@@ -74,7 +74,7 @@ public enum ModelLoaderMsgs implements LogMessageEnum {
* Arguments: {0} = request type. {1} = endpoint. {2} = error message.
*/
BABEL_REST_REQUEST_ERROR,
-
+
/**
* Arguments: {0} = info request payload.
**/
diff --git a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java
index a4cc5d1..06d6e30 100644
--- a/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java
+++ b/src/main/java/org/onap/aai/modelloader/service/ModelLoaderService.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.service;
@@ -29,9 +29,8 @@ import java.util.List;
import java.util.Properties;
import java.util.Timer;
import java.util.TimerTask;
-
+import javax.annotation.PostConstruct;
import javax.ws.rs.core.Response;
-
import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
@@ -40,53 +39,54 @@ import org.onap.aai.modelloader.notification.ArtifactDeploymentManager;
import org.onap.aai.modelloader.notification.ArtifactDownloadManager;
import org.onap.aai.modelloader.notification.EventCallback;
import org.onap.aai.modelloader.restclient.BabelServiceClientFactory;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.results.IDistributionClientResult;
-import org.openecomp.sdc.impl.DistributionClientFactory;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.impl.DistributionClientFactory;
+import org.onap.sdc.utils.DistributionActionResultEnum;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
/**
* Service class in charge of managing the negotiating model loading capabilities between AAI and an ASDC.
*/
+@RestController
+@RequestMapping("/services/model-loader/v1/model-service")
public class ModelLoaderService implements ModelLoaderInterface {
+ static Logger logger = LoggerFactory.getInstance().getLogger(ModelLoaderService.class.getName());
+
protected static final String FILESEP =
(System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
- protected static final String CONFIG_DIR = System.getProperty("CONFIG_HOME") + FILESEP;
- protected static final String CONFIG_AUTH_LOCATION = CONFIG_DIR + "auth" + FILESEP;
- protected static final String CONFIG_FILE = CONFIG_DIR + "model-loader.properties";
-
+ @Value("${CONFIG_HOME}")
+ private String configDir;
private IDistributionClient client;
private ModelLoaderConfig config;
- static Logger logger = LoggerFactory.getInstance().getLogger(ModelLoaderService.class.getName());
-
/**
* Responsible for loading configuration files and calling initialization.
*/
- public ModelLoaderService() {
- start();
- }
-
+ @PostConstruct
protected void start() {
// Load model loader system configuration
logger.info(ModelLoaderMsgs.LOADING_CONFIGURATION);
+ ModelLoaderConfig.setConfigHome(configDir);
Properties configProperties = new Properties();
try {
- configProperties.load(new FileInputStream(CONFIG_FILE));
+ configProperties.load(new FileInputStream(configDir + FILESEP + "model-loader.properties"));
+ config = new ModelLoaderConfig(configProperties);
+ if (!config.getASDCConnectionDisabled()) {
+ initSdcClient();
+ }
} catch (IOException e) {
String errorMsg = "Failed to load configuration: " + e.getMessage();
logger.error(ModelLoaderMsgs.ASDC_CONNECTION_ERROR, errorMsg);
- shutdown();
}
-
- config = new ModelLoaderConfig(configProperties, CONFIG_AUTH_LOCATION);
- init();
-
- Runtime.getRuntime().addShutdownHook(new Thread(this::preShutdownOperations));
}
/**
@@ -102,18 +102,28 @@ public class ModelLoaderService implements ModelLoaderInterface {
/**
* Responsible for loading configuration files, initializing model distribution clients, and starting them.
*/
- protected void init() {
- if (!config.getASDCConnectionDisabled()) {
- // Initialize distribution client
- logger.debug(ModelLoaderMsgs.INITIALIZING, "Initializing distribution client...");
- client = DistributionClientFactory.createDistributionClient();
- EventCallback callback = new EventCallback(client, config);
-
- IDistributionClientResult initResult = client.init(config, callback);
-
- if (initResult.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
- String errorMsg =
- "Failed to initialize distribution client: " + initResult.getDistributionMessageResult();
+ protected void initSdcClient() {
+ // Initialize distribution client
+ logger.debug(ModelLoaderMsgs.INITIALIZING, "Initializing distribution client...");
+ client = DistributionClientFactory.createDistributionClient();
+ EventCallback callback = new EventCallback(client, config);
+
+ IDistributionClientResult initResult = client.init(config, callback);
+
+ if (initResult.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
+ String errorMsg = "Failed to initialize distribution client: " + initResult.getDistributionMessageResult();
+ logger.error(ModelLoaderMsgs.ASDC_CONNECTION_ERROR, errorMsg);
+
+ // Kick off a timer to retry the SDC connection
+ Timer timer = new Timer();
+ TimerTask task = new SdcConnectionJob(client, config, callback, timer);
+ timer.schedule(task, new Date(), 60000);
+ } else {
+ // Start distribution client
+ logger.debug(ModelLoaderMsgs.INITIALIZING, "Starting distribution client...");
+ IDistributionClientResult startResult = client.start();
+ if (startResult.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
+ String errorMsg = "Failed to start distribution client: " + startResult.getDistributionMessageResult();
logger.error(ModelLoaderMsgs.ASDC_CONNECTION_ERROR, errorMsg);
// Kick off a timer to retry the SDC connection
@@ -121,41 +131,10 @@ public class ModelLoaderService implements ModelLoaderInterface {
TimerTask task = new SdcConnectionJob(client, config, callback, timer);
timer.schedule(task, new Date(), 60000);
} else {
- // Start distribution client
- logger.debug(ModelLoaderMsgs.INITIALIZING, "Starting distribution client...");
- IDistributionClientResult startResult = client.start();
- if (startResult.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
- String errorMsg =
- "Failed to start distribution client: " + startResult.getDistributionMessageResult();
- logger.error(ModelLoaderMsgs.ASDC_CONNECTION_ERROR, errorMsg);
-
- // Kick off a timer to retry the SDC connection
- Timer timer = new Timer();
- TimerTask task = new SdcConnectionJob(client, config, callback, timer);
- timer.schedule(task, new Date(), 60000);
- } else {
- logger.info(ModelLoaderMsgs.INITIALIZING, "Connection to SDC established");
- }
+ logger.info(ModelLoaderMsgs.INITIALIZING, "Connection to SDC established");
}
}
- }
-
- /**
- * Shut down the process.
- */
- private void shutdown() {
- preShutdownOperations();
-
- // TODO: Find a better way to shut down the model loader.
- try {
- // Give logs time to write to file
- Thread.sleep(2000);
- } catch (InterruptedException e) { // NOSONAR
- // Nothing we can do at this point
- logger.debug(e.getMessage());
- }
-
- Runtime.getRuntime().halt(1);
+ Runtime.getRuntime().addShutdownHook(new Thread(this::preShutdownOperations));
}
/**
@@ -164,7 +143,7 @@ public class ModelLoaderService implements ModelLoaderInterface {
* @see org.onap.aai.modelloader.service.ModelLoaderInterface#loadModel(java.lang.String)
*/
@Override
- public Response loadModel(String modelid) {
+ public Response loadModel(@PathVariable String modelid) {
return Response.ok("{\"model_loaded\":\"" + modelid + "\"}").build();
}
@@ -174,12 +153,13 @@ public class ModelLoaderService implements ModelLoaderInterface {
* @see org.onap.aai.modelloader.service.ModelLoaderInterface#saveModel(java.lang.String, java.lang.String)
*/
@Override
- public Response saveModel(String modelid, String modelname) {
+ public Response saveModel(@PathVariable String modelid, @PathVariable String modelname) {
return Response.ok("{\"model_saved\":\"" + modelid + "-" + modelname + "\"}").build();
}
@Override
- public Response ingestModel(String modelName, String modelVersion, String payload) throws IOException {
+ public Response ingestModel(@PathVariable String modelName, @PathVariable String modelVersion,
+ @RequestBody String payload) throws IOException {
boolean success;
if (config.getIngestSimulatorEnabled()) {
diff --git a/src/main/java/org/onap/aai/modelloader/service/NotificationDataImpl.java b/src/main/java/org/onap/aai/modelloader/service/NotificationDataImpl.java
index 28611ff..536aa4a 100644
--- a/src/main/java/org/onap/aai/modelloader/service/NotificationDataImpl.java
+++ b/src/main/java/org/onap/aai/modelloader/service/NotificationDataImpl.java
@@ -1,30 +1,30 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.service;
import java.util.Collections;
import java.util.List;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.api.notification.IArtifactInfo;
+import org.onap.sdc.api.notification.INotificationData;
+import org.onap.sdc.api.notification.IResourceInstance;
public class NotificationDataImpl implements INotificationData {
diff --git a/src/main/java/org/onap/aai/modelloader/service/SdcConnectionJob.java b/src/main/java/org/onap/aai/modelloader/service/SdcConnectionJob.java
index d30e6dd..82e0bc6 100644
--- a/src/main/java/org/onap/aai/modelloader/service/SdcConnectionJob.java
+++ b/src/main/java/org/onap/aai/modelloader/service/SdcConnectionJob.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.service;
@@ -26,9 +26,9 @@ import org.onap.aai.cl.api.Logger;
import org.onap.aai.cl.eelf.LoggerFactory;
import org.onap.aai.modelloader.config.ModelLoaderConfig;
import org.onap.aai.modelloader.notification.EventCallback;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.results.IDistributionClientResult;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
+import org.onap.sdc.api.IDistributionClient;
+import org.onap.sdc.api.results.IDistributionClientResult;
+import org.onap.sdc.utils.DistributionActionResultEnum;
public class SdcConnectionJob extends TimerTask {
static Logger logger = LoggerFactory.getInstance().getLogger(SdcConnectionJob.class.getName());
diff --git a/src/main/java/org/onap/aai/modelloader/util/JsonXmlConverter.java b/src/main/java/org/onap/aai/modelloader/util/JsonXmlConverter.java
index a5a7bc5..48a33b5 100644
--- a/src/main/java/org/onap/aai/modelloader/util/JsonXmlConverter.java
+++ b/src/main/java/org/onap/aai/modelloader/util/JsonXmlConverter.java
@@ -1,22 +1,22 @@
/**
- * ============LICENSE_START==========================================
+ * ============LICENSE_START=======================================================
* org.onap.aai
- * ===================================================================
+ * ================================================================================
* Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017-2018 Amdocs
- * ===================================================================
+ * Copyright © 2017-2018 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END============================================
+ * ============LICENSE_END=========================================================
*/
package org.onap.aai.modelloader.util;