diff options
Diffstat (limited to 'ms')
3 files changed, 70 insertions, 66 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java index fc7410f9..d7f22e6d 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java @@ -27,7 +27,7 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct;
import java.util.List;
-@Component
+@Component(value = "ApplicationRegistrationService")
@SuppressWarnings("unused")
public class ApplicationRegistrationService {
private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationRegistrationService.class);
@@ -35,8 +35,7 @@ public class ApplicationRegistrationService { @Value("#{'${resourceSourceMappings}'.split(',')}")
private List<String> resourceSourceMappings;
- @PostConstruct
- public void register() {
+ public ApplicationRegistrationService() {
registerDictionarySources();
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java index cfcf93d2..4dc35fd5 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java @@ -39,6 +39,7 @@ import com.att.eelf.configuration.EELFManager; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.DependsOn;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.stereotype.Component;
@@ -56,6 +57,7 @@ import java.util.List; */
@Component
+@DependsOn(value = "ApplicationRegistrationService")
@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true")
public class DataBaseInitService {
@@ -86,7 +88,7 @@ public class DataBaseInitService { * @param configModelService configModelService
*/
public DataBaseInitService(ModelTypeService modelTypeService, ResourceDictionaryService resourceDictionaryService,
- ConfigModelService configModelService) {
+ ConfigModelService configModelService) {
this.modelTypeService = modelTypeService;
this.resourceDictionaryService = resourceDictionaryService;
this.configModelService = configModelService;
@@ -113,28 +115,26 @@ public class DataBaseInitService { try {
Resource[] dataTypefiles = getPathResources(dataTypePath, ".json");
StrBuilder errorBuilder = new StrBuilder();
- for (Resource file : dataTypefiles) {
- if (file != null) {
- loadDataType(file, errorBuilder);
- }
+ for (Resource file : dataTypefiles) {
+ if (file != null) {
+ loadDataType(file, errorBuilder);
}
+ }
Resource[] nodeTypefiles = getPathResources(nodeTypePath, ".json");
- for (Resource file : nodeTypefiles) {
- if (file != null) {
- loadNodeType(file, errorBuilder);
- }
+ for (Resource file : nodeTypefiles) {
+ if (file != null) {
+ loadNodeType(file, errorBuilder);
}
-
+ }
Resource[] artifactTypefiles = getPathResources(artifactTypePath, ".json");
- for (Resource file : artifactTypefiles) {
- if (file != null) {
- loadArtifactType(file, errorBuilder);
- }
+ for (Resource file : artifactTypefiles) {
+ if (file != null) {
+ loadArtifactType(file, errorBuilder);
}
-
+ }
if (!errorBuilder.isEmpty()) {
log.error(errorBuilder.toString());
@@ -146,58 +146,60 @@ public class DataBaseInitService { private void loadResourceDictionary() {
log.info(
- " *************************** loadResourceDictionary **********************");
+ " *************************** loadResourceDictionary **********************");
try {
Resource[] dataTypefiles = getPathResources(resourceDictionaryPath, ".json");
- StrBuilder errorBuilder = new StrBuilder();
- String fileName;
- for (Resource file : dataTypefiles) {
- try {
- fileName = file.getFilename();
- log.trace("Loading : {}", fileName);
- String definitionContent = getResourceContent(file);
- ResourceDefinition resourceDefinition =
- JacksonUtils.readValue(definitionContent, ResourceDefinition.class);
- if (resourceDefinition != null) {
- Preconditions.checkNotNull(resourceDefinition.getProperty(), "Failed to get Property Definition");
- ResourceDictionary resourceDictionary = new ResourceDictionary();
- resourceDictionary.setName(resourceDefinition.getName());
- resourceDictionary.setDefinition(resourceDefinition);
-
- Preconditions.checkNotNull(resourceDefinition.getProperty(), "Property field is missing");
- resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription());
- resourceDictionary.setDataType(resourceDefinition.getProperty().getType());
- if(resourceDefinition.getProperty().getEntrySchema() != null){
- resourceDictionary.setEntrySchema(resourceDefinition.getProperty().getEntrySchema().getType());
- }
- resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy());
- if (StringUtils.isBlank(resourceDefinition.getTags())) {
- resourceDictionary.setTags(
- resourceDefinition.getName() + ", " + resourceDefinition.getUpdatedBy()
- + ", " + resourceDefinition.getUpdatedBy());
-
- } else {
- resourceDictionary.setTags(resourceDefinition.getTags());
- }
- resourceDictionaryService.saveResourceDictionary(resourceDictionary);
-
- log.trace(" Loaded successfully : {}", file.getFilename());
+ StrBuilder errorBuilder = new StrBuilder();
+ String fileName;
+ for (Resource file : dataTypefiles) {
+ try {
+ fileName = file.getFilename();
+ log.trace("Loading : {}", fileName);
+ String definitionContent = getResourceContent(file);
+ ResourceDefinition resourceDefinition =
+ JacksonUtils.readValue(definitionContent, ResourceDefinition.class);
+ if (resourceDefinition != null) {
+ Preconditions
+ .checkNotNull(resourceDefinition.getProperty(), "Failed to get Property Definition");
+ ResourceDictionary resourceDictionary = new ResourceDictionary();
+ resourceDictionary.setName(resourceDefinition.getName());
+ resourceDictionary.setDefinition(resourceDefinition);
+
+ Preconditions.checkNotNull(resourceDefinition.getProperty(), "Property field is missing");
+ resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription());
+ resourceDictionary.setDataType(resourceDefinition.getProperty().getType());
+ if (resourceDefinition.getProperty().getEntrySchema() != null) {
+ resourceDictionary
+ .setEntrySchema(resourceDefinition.getProperty().getEntrySchema().getType());
+ }
+ resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy());
+ if (StringUtils.isBlank(resourceDefinition.getTags())) {
+ resourceDictionary.setTags(
+ resourceDefinition.getName() + ", " + resourceDefinition.getUpdatedBy()
+ + ", " + resourceDefinition.getUpdatedBy());
+
} else {
- throw new BluePrintException("couldn't get dictionary from content information");
+ resourceDictionary.setTags(resourceDefinition.getTags());
}
- } catch (Exception e) {
- errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());
+ resourceDictionaryService.saveResourceDictionary(resourceDictionary);
+
+ log.trace(" Loaded successfully : {}", file.getFilename());
+ } else {
+ throw new BluePrintException("couldn't get dictionary from content information");
}
+ } catch (Exception e) {
+ errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());
}
- if (!errorBuilder.isEmpty()) {
- log.error(errorBuilder.toString());
- }
+ }
+ if (!errorBuilder.isEmpty()) {
+ log.error(errorBuilder.toString());
+ }
} catch (Exception e) {
log.error(
- "Failed in Resource dictionary loading", e);
+ "Failed in Resource dictionary loading", e);
}
}
@@ -241,7 +243,8 @@ public class DataBaseInitService { String nodeKey = file.getFilename().replace(".json", "");
String definitionContent = getResourceContent(file);
NodeType nodeType = JacksonUtils.readValue(definitionContent, NodeType.class);
- Preconditions.checkNotNull(nodeType, String.format("failed to get node type from file : %s", file.getFilename()));
+ Preconditions
+ .checkNotNull(nodeType, String.format("failed to get node type from file : %s", file.getFilename()));
ModelType modelType = new ModelType();
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);
modelType.setDerivedFrom(nodeType.getDerivedFrom());
@@ -251,7 +254,7 @@ public class DataBaseInitService { modelType.setVersion(nodeType.getVersion());
modelType.setUpdatedBy("System");
modelType.setTags(nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + ","
- + nodeType.getDerivedFrom());
+ + nodeType.getDerivedFrom());
modelTypeService.saveModel(modelType);
log.trace("Loaded Node Type successfully : {}", file.getFilename());
} catch (Exception e) {
@@ -265,7 +268,8 @@ public class DataBaseInitService { String dataKey = file.getFilename().replace(".json", "");
String definitionContent = getResourceContent(file);
DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);
- Preconditions.checkNotNull(dataType, String.format("failed to get data type from file : %s", file.getFilename()));
+ Preconditions
+ .checkNotNull(dataType, String.format("failed to get data type from file : %s", file.getFilename()));
ModelType modelType = new ModelType();
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
modelType.setDerivedFrom(dataType.getDerivedFrom());
@@ -275,7 +279,7 @@ public class DataBaseInitService { modelType.setVersion(dataType.getVersion());
modelType.setUpdatedBy("System");
modelType.setTags(dataKey + "," + dataType.getDerivedFrom() + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
modelTypeService.saveModel(modelType);
log.trace(" Loaded Data Type successfully : {}", file.getFilename());
} catch (Exception e) {
@@ -289,7 +293,8 @@ public class DataBaseInitService { String dataKey = file.getFilename().replace(".json", "");
String definitionContent = getResourceContent(file);
ArtifactType artifactType = JacksonUtils.readValue(definitionContent, ArtifactType.class);
- Preconditions.checkNotNull(artifactType, String.format("failed to get artifact type from file : %s", file.getFilename()));
+ Preconditions.checkNotNull(artifactType,
+ String.format("failed to get artifact type from file : %s", file.getFilename()));
ModelType modelType = new ModelType();
modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
modelType.setDerivedFrom(artifactType.getDerivedFrom());
@@ -299,7 +304,7 @@ public class DataBaseInitService { modelType.setVersion(artifactType.getVersion());
modelType.setUpdatedBy("System");
modelType.setTags(dataKey + "," + artifactType.getDerivedFrom() + ","
- + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
+ + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
modelTypeService.saveModel(modelType);
log.trace("Loaded Artifact Type successfully : {}", file.getFilename());
} catch (Exception e) {
diff --git a/ms/neng/src/main/docker/startService.sh b/ms/neng/src/main/docker/startService.sh index be45897f..814fc475 100644 --- a/ms/neng/src/main/docker/startService.sh +++ b/ms/neng/src/main/docker/startService.sh @@ -29,7 +29,7 @@ APP_ARGS=${APP_ARGS}" -Dpol_req_id="${POL_REQ_ID} APP_ARGS=${APP_ARGS}" -Daai_cert_pass="${AAI_CERT_PASS} APP_ARGS=${APP_ARGS}" -Daai_cert_path="${AAI_CERT_PATH} APP_ARGS=${APP_ARGS}" -Daai_uri="${AAI_URI} -APP_ARGS=${APP_ARGS}" -Daai_auth="${AAIC_AUTH} +APP_ARGS=${APP_ARGS}" -Daai_auth="${AAI_AUTH} APP_ARGS=${APP_ARGS}" -cp /opt/etc/config" echo "APP_ARGS ="${APP_ARGS} |