fixed sonar issues in DataBaseInitService.java
authorSandeep J <sandeejh@in.ibm.com>
Fri, 30 Nov 2018 11:34:01 +0000 (17:04 +0530)
committerSandeep Jha <sandeejh@in.ibm.com>
Fri, 30 Nov 2018 12:30:54 +0000 (12:30 +0000)
fixed sonar issues

Issue-ID: CCSDK-525
Change-Id: I1b38d9656ace1160b7fd93f336f43d37f0d17847
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java

index a1a9b9c..74faa4d 100644 (file)
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.service;\r
-\r
-import com.google.common.base.Preconditions;\r
-import org.apache.commons.collections.CollectionUtils;\r
-import org.apache.commons.io.IOUtils;\r
-import org.apache.commons.lang3.StringUtils;\r
-import org.apache.commons.lang3.text.StrBuilder;\r
-import org.jetbrains.annotations.NotNull;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.beans.factory.annotation.Value;\r
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;\r
-import org.springframework.boot.context.event.ApplicationReadyEvent;\r
-import org.springframework.context.event.EventListener;\r
-import org.springframework.core.io.Resource;\r
-import org.springframework.core.io.support.ResourcePatternResolver;\r
-import org.springframework.stereotype.Component;\r
-import java.io.IOException;\r
-import java.nio.charset.Charset;\r
-import java.util.List;\r
-\r
-/**\r
- * DataBaseInitService.java Purpose: Provide DataBaseInitService Service\r
- *\r
- * @author Brinda Santh\r
- * @version 1.0\r
- */\r
-\r
-@Component\r
-@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true")\r
-public class DataBaseInitService {\r
-\r
-    private static EELFLogger log = EELFManager.getInstance().getLogger(DataBaseInitService.class);\r
-    private ModelTypeService modelTypeService;\r
-    private ResourceDictionaryService resourceDictionaryService;\r
-    private ConfigModelService configModelService;\r
-    private String updateBySystem = "System";\r
-\r
-    @Value("${load.dataTypePath}")\r
-    private String dataTypePath;\r
-    @Value("${load.nodeTypePath}")\r
-    private String nodeTypePath;\r
-    @Value("${load.artifactTypePath}")\r
-    private String artifactTypePath;\r
-    @Value("${load.resourceDictionaryPath}")\r
-    private String resourceDictionaryPath;\r
-    @Value("${load.blueprintsPath}")\r
-    private String bluePrintsPath;\r
-\r
-    @Autowired\r
-    private ResourcePatternResolver resourceLoader;\r
-\r
-    /**\r
-     * This is a DataBaseInitService, used to load the initial data\r
-     *\r
-     * @param modelTypeService modelTypeService\r
-     * @param resourceDictionaryService resourceDictionaryService\r
-     * @param configModelService configModelService\r
-     */\r
-    public DataBaseInitService(ModelTypeService modelTypeService, ResourceDictionaryService resourceDictionaryService,\r
-                               ConfigModelService configModelService) {\r
-        this.modelTypeService = modelTypeService;\r
-        this.resourceDictionaryService = resourceDictionaryService;\r
-        this.configModelService = configModelService;\r
-        log.info("DataBaseInitService started...");\r
-\r
-    }\r
-\r
-    @SuppressWarnings("unused")\r
-    @EventListener(ApplicationReadyEvent.class)\r
-    private void initDatabase() {\r
-        log.info("loading dataTypePath from DIR : {}", dataTypePath);\r
-        log.info("loading nodeTypePath from DIR : {}", nodeTypePath);\r
-        log.info("loading artifactTypePath from DIR : {}", artifactTypePath);\r
-        log.info("loading resourceDictionaryPath from DIR : {}", resourceDictionaryPath);\r
-        log.info("loading bluePrintsPath from DIR : {}", bluePrintsPath);\r
-\r
-        loadModelType();\r
-        loadResourceDictionary();\r
-    }\r
-\r
-    private void loadModelType() {\r
-        log.info(" *************************** loadModelType **********************");\r
-        try {\r
-            Resource[] dataTypefiles = getPathResources(dataTypePath, ".json");\r
-            StrBuilder errorBuilder = new StrBuilder();\r
-                for (Resource file : dataTypefiles) {\r
-                    if (file != null) {\r
-                        loadDataType(file, errorBuilder);\r
-                    }\r
-                }\r
-\r
-            Resource[] nodeTypefiles = getPathResources(nodeTypePath, ".json");\r
-                       for (Resource file : nodeTypefiles) {\r
-                    if (file != null) {\r
-                        loadNodeType(file, errorBuilder);\r
-                    }\r
-                }\r
-\r
-\r
-            Resource[] artifactTypefiles = getPathResources(artifactTypePath, ".json");\r
-\r
-                for (Resource file : artifactTypefiles) {\r
-                    if (file != null) {\r
-                        loadArtifactType(file, errorBuilder);\r
-                    }\r
-                }\r
-\r
-\r
-            if (!errorBuilder.isEmpty()) {\r
-                log.error(errorBuilder.toString());\r
-            }\r
-        } catch (Exception e) {\r
-            log.error("Failed in Data type loading", e);\r
-        }\r
-    }\r
-\r
-    private void loadResourceDictionary() {\r
-        log.info(\r
-                " *************************** loadResourceDictionary **********************");\r
-        try {\r
-            Resource[] dataTypefiles = getPathResources(resourceDictionaryPath, ".json");\r
-\r
-                StrBuilder errorBuilder = new StrBuilder();\r
-                String fileName;\r
-                for (Resource file : dataTypefiles) {\r
-                    try {\r
-                        fileName = file.getFilename();\r
-                        log.trace("Loading : {}", fileName);\r
-                        String definitionContent = getResourceContent(file);\r
-                        ResourceDefinition resourceDefinition =\r
-                                JacksonUtils.readValue(definitionContent, ResourceDefinition.class);\r
-                        if (resourceDefinition != null) {\r
-                            Preconditions.checkNotNull(resourceDefinition.getProperty(), "Failed to get Property Definition");\r
-                            ResourceDictionary resourceDictionary = new ResourceDictionary();\r
-                            resourceDictionary.setName(resourceDefinition.getName());\r
-                            resourceDictionary.setDefinition(resourceDefinition);\r
-\r
-                            Preconditions.checkNotNull(resourceDefinition.getProperty(), "Property field is missing");\r
-                            resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription());\r
-                            resourceDictionary.setDataType(resourceDefinition.getProperty().getType());\r
-                            if(resourceDefinition.getProperty().getEntrySchema() != null){\r
-                                resourceDictionary.setEntrySchema(resourceDefinition.getProperty().getEntrySchema().getType());\r
-                            }\r
-                            resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy());\r
-                            if (StringUtils.isBlank(resourceDefinition.getTags())) {\r
-                                resourceDictionary.setTags(\r
-                                        resourceDefinition.getName() + ", " + resourceDefinition.getUpdatedBy()\r
-                                                + ", " + resourceDefinition.getUpdatedBy());\r
-\r
-                            } else {\r
-                                resourceDictionary.setTags(resourceDefinition.getTags());\r
-                            }\r
-                            resourceDictionaryService.saveResourceDictionary(resourceDictionary);\r
-\r
-                            log.trace(" Loaded successfully : {}", file.getFilename());\r
-                        } else {\r
-                            throw new BluePrintException("couldn't get dictionary from content information");\r
-                        }\r
-                    } catch (Exception e) {\r
-                        log.error("Exception", e);\r
-                        errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());\r
-                    }\r
-                }\r
-                if (!errorBuilder.isEmpty()) {\r
-                    log.error(errorBuilder.toString());\r
-                }\r
-\r
-\r
-        } catch (Exception e) {\r
-            log.error(\r
-                    "Failed in Resource dictionary loading", e);\r
-        }\r
-    }\r
-\r
-    private void loadBlueprints() {\r
-        log.info("*************************** loadServiceTemplate **********************");\r
-        try {\r
-            List<String> serviceTemplateDirs = ConfigModelUtils.getBlueprintNames(bluePrintsPath);\r
-            if (CollectionUtils.isNotEmpty(serviceTemplateDirs)) {\r
-                StrBuilder errorBuilder = new StrBuilder();\r
-                for (String fileName : serviceTemplateDirs) {\r
-                    try {\r
-                        String bluePrintPath = this.bluePrintsPath.concat("/").concat(fileName);\r
-                        log.debug("***** Loading service template :  {}", bluePrintPath);\r
-                        ConfigModel configModel = ConfigModelUtils.getConfigModel(bluePrintPath);\r
-\r
-                        configModel = this.configModelService.saveConfigModel(configModel);\r
-\r
-                        log.info("Publishing : {}", configModel.getId());\r
-\r
-                        this.configModelService.publishConfigModel(configModel.getId());\r
-\r
-                        log.info("Loaded service template successfully: {}", fileName);\r
-\r
-                    } catch (Exception e) {\r
-                        log.error("Exception", e);\r
-                        errorBuilder.appendln("load config model " + fileName + " error : " + e.getMessage());\r
-                    }\r
-                }\r
-\r
-                if (!errorBuilder.isEmpty()) {\r
-                    log.error(errorBuilder.toString());\r
-                }\r
-            }\r
-        } catch (Exception e) {\r
-            log.error("Failed in Service Template loading", e);\r
-        }\r
-    }\r
-\r
-    private void loadNodeType(Resource file, StrBuilder errorBuilder) {\r
-        try {\r
-            log.trace("Loading Node Type : {}", file.getFilename());\r
-            String nodeKey = file.getFilename().replace(".json", "");\r
-            String definitionContent = getResourceContent(file);\r
-            NodeType nodeType = JacksonUtils.readValue(definitionContent, NodeType.class);\r
-            Preconditions.checkNotNull(nodeType, String.format("failed to get node type from file : %s", file.getFilename()));\r
-            ModelType modelType = new ModelType();\r
-            modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);\r
-            modelType.setDerivedFrom(nodeType.getDerivedFrom());\r
-            modelType.setDescription(nodeType.getDescription());\r
-            modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));\r
-            modelType.setModelName(nodeKey);\r
-            modelType.setVersion(nodeType.getVersion());\r
-            modelType.setUpdatedBy(updateBySystem);\r
-            modelType.setTags(nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + ","\r
-                    + nodeType.getDerivedFrom());\r
-            modelTypeService.saveModel(modelType);\r
-            log.trace("Loaded Node Type successfully : {}", file.getFilename());\r
-        } catch (Exception e) {\r
-            log.error("Exception", e);\r
-            errorBuilder.appendln("Node type loading error : " + file.getFilename() + ":" + e.getMessage());\r
-        }\r
-    }\r
-\r
-    private void loadDataType(@NotNull Resource file, StrBuilder errorBuilder) {\r
-        try {\r
-            log.trace("Loading Data Type: {}", file.getFilename());\r
-            String dataKey = file.getFilename().replace(".json", "");\r
-            String definitionContent = getResourceContent(file);\r
-            DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);\r
-            Preconditions.checkNotNull(dataType, String.format("failed to get data type from file : %s", file.getFilename()));\r
-            ModelType modelType = new ModelType();\r
-            modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);\r
-            modelType.setDerivedFrom(dataType.getDerivedFrom());\r
-            modelType.setDescription(dataType.getDescription());\r
-            modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));\r
-            modelType.setModelName(dataKey);\r
-            modelType.setVersion(dataType.getVersion());\r
-            modelType.setUpdatedBy(updateBySystem);\r
-            modelType.setTags(dataKey + "," + dataType.getDerivedFrom() + ","\r
-                    + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);\r
-            modelTypeService.saveModel(modelType);\r
-            log.trace(" Loaded Data Type successfully : {}", file.getFilename());\r
-        } catch (Exception e) {\r
-            log.error("Exception", e);\r
-            errorBuilder.appendln("Data type loading error : " + file.getFilename() + ":" + e.getMessage());\r
-        }\r
-    }\r
-\r
-    private void loadArtifactType(Resource file, StrBuilder errorBuilder) {\r
-        try {\r
-            log.trace("Loading Artifact Type: {}", file.getFilename());\r
-            String dataKey = file.getFilename().replace(".json", "");\r
-            String definitionContent = getResourceContent(file);\r
-            ArtifactType artifactType = JacksonUtils.readValue(definitionContent, ArtifactType.class);\r
-            Preconditions.checkNotNull(artifactType, String.format("failed to get artifact type from file : %s", file.getFilename()));\r
-            ModelType modelType = new ModelType();\r
-            modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);\r
-            modelType.setDerivedFrom(artifactType.getDerivedFrom());\r
-            modelType.setDescription(artifactType.getDescription());\r
-            modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));\r
-            modelType.setModelName(dataKey);\r
-            modelType.setVersion(artifactType.getVersion());\r
-            modelType.setUpdatedBy(updateBySystem);\r
-            modelType.setTags(dataKey + "," + artifactType.getDerivedFrom() + ","\r
-                    + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);\r
-            modelTypeService.saveModel(modelType);\r
-            log.trace("Loaded Artifact Type successfully : {}", file.getFilename());\r
-        } catch (Exception e) {\r
-            log.error("Exception", e);\r
-            errorBuilder.appendln("Artifact type loading error : " + file.getFilename() + ":" + e.getMessage());\r
-        }\r
-    }\r
-\r
-    private Resource[] getPathResources(String path, String extension) throws IOException {\r
-        return resourceLoader.getResources("file:" + path + "/*" + extension);\r
-    }\r
-\r
-    private String getResourceContent(Resource resource) throws IOException {\r
-        return IOUtils.toString(resource.getInputStream(), Charset.defaultCharset());\r
-    }\r
-\r
-}\r
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.controllerblueprints.service;
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.text.StrBuilder;
+import org.jetbrains.annotations.NotNull;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.DataType;
+import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeType;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDefinition;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;
+import com.att.eelf.configuration.EELFLogger;
+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.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.List;
+
+/**
+ * DataBaseInitService.java Purpose: Provide DataBaseInitService Service
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Component
+@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true")
+public class DataBaseInitService {
+
+    private static EELFLogger log = EELFManager.getInstance().getLogger(DataBaseInitService.class);
+    private ModelTypeService modelTypeService;
+    private ResourceDictionaryService resourceDictionaryService;
+    private ConfigModelService configModelService;
+    private String updateBySystem = "System";
+    private static final String JSON_EXTN= ".json";
+    private static final String EXCEPTION= "Exception";
+
+    @Value("${load.dataTypePath}")
+    private String dataTypePath;
+    @Value("${load.nodeTypePath}")
+    private String nodeTypePath;
+    @Value("${load.artifactTypePath}")
+    private String artifactTypePath;
+    @Value("${load.resourceDictionaryPath}")
+    private String resourceDictionaryPath;
+    @Value("${load.blueprintsPath}")
+    private String bluePrintsPath;
+
+    @Autowired
+    private ResourcePatternResolver resourceLoader;
+
+    /**
+     * This is a DataBaseInitService, used to load the initial data
+     *
+     * @param modelTypeService modelTypeService
+     * @param resourceDictionaryService resourceDictionaryService
+     * @param configModelService configModelService
+     */
+    public DataBaseInitService(ModelTypeService modelTypeService, ResourceDictionaryService resourceDictionaryService,
+                               ConfigModelService configModelService) {
+        this.modelTypeService = modelTypeService;
+        this.resourceDictionaryService = resourceDictionaryService;
+        this.configModelService = configModelService;
+        log.info("DataBaseInitService started...");
+
+    }
+
+    @SuppressWarnings("unused")
+    @EventListener(ApplicationReadyEvent.class)
+    private void initDatabase() {
+        log.info("loading dataTypePath from DIR : {}", dataTypePath);
+        log.info("loading nodeTypePath from DIR : {}", nodeTypePath);
+        log.info("loading artifactTypePath from DIR : {}", artifactTypePath);
+        log.info("loading resourceDictionaryPath from DIR : {}", resourceDictionaryPath);
+        log.info("loading bluePrintsPath from DIR : {}", bluePrintsPath);
+
+        loadModelType();
+        loadResourceDictionary();
+    }
+
+    private void loadModelType() {
+        log.info(" *************************** loadModelType **********************");
+        try {
+            Resource[] dataTypefiles = getPathResources(dataTypePath, JSON_EXTN);
+            StrBuilder errorBuilder = new StrBuilder();
+                for (Resource file : dataTypefiles) {
+                    if (file != null) {
+                        loadDataType(file, errorBuilder);
+                    }
+                }
+
+            Resource[] nodeTypefiles = getPathResources(nodeTypePath, JSON_EXTN);
+                       for (Resource file : nodeTypefiles) {
+                    if (file != null) {
+                        loadNodeType(file, errorBuilder);
+                    }
+                }
+
+
+            Resource[] artifactTypefiles = getPathResources(artifactTypePath, JSON_EXTN);
+
+                for (Resource file : artifactTypefiles) {
+                    if (file != null) {
+                        loadArtifactType(file, errorBuilder);
+                    }
+                }
+
+
+            if (!errorBuilder.isEmpty()) {
+                log.error(errorBuilder.toString());
+            }
+        } catch (Exception e) {
+            log.error("Failed in Data type loading", e);
+        }
+    }
+
+    private void loadResourceDictionary() {
+        log.info(
+                " *************************** loadResourceDictionary **********************");
+        try {
+            Resource[] dataTypefiles = getPathResources(resourceDictionaryPath, JSON_EXTN);
+
+                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());
+                        } else {
+                            throw new BluePrintException("couldn't get dictionary from content information");
+                        }
+                    } catch (Exception e) {
+                        log.error(EXCEPTION, e);
+                        errorBuilder.appendln("Dictionary loading Errors : " + file.getFilename() + ":" + e.getMessage());
+                    }
+                }
+                if (!errorBuilder.isEmpty()) {
+                    log.error(errorBuilder.toString());
+                }
+
+
+        } catch (Exception e) {
+            log.error(
+                    "Failed in Resource dictionary loading", e);
+        }
+    }
+
+    private void loadBlueprints() {
+        log.info("*************************** loadServiceTemplate **********************");
+        try {
+            List<String> serviceTemplateDirs = ConfigModelUtils.getBlueprintNames(bluePrintsPath);
+            if (CollectionUtils.isNotEmpty(serviceTemplateDirs)) {
+                StrBuilder errorBuilder = new StrBuilder();
+                for (String fileName : serviceTemplateDirs) {
+                    try {
+                        String bluePrintPath = this.bluePrintsPath.concat("/").concat(fileName);
+                        log.debug("***** Loading service template :  {}", bluePrintPath);
+                        ConfigModel configModel = ConfigModelUtils.getConfigModel(bluePrintPath);
+
+                        configModel = this.configModelService.saveConfigModel(configModel);
+
+                        log.info("Publishing : {}", configModel.getId());
+
+                        this.configModelService.publishConfigModel(configModel.getId());
+
+                        log.info("Loaded service template successfully: {}", fileName);
+
+                    } catch (Exception e) {
+                        log.error(EXCEPTION, e);
+                        errorBuilder.appendln("load config model " + fileName + " error : " + e.getMessage());
+                    }
+                }
+
+                if (!errorBuilder.isEmpty()) {
+                    log.error(errorBuilder.toString());
+                }
+            }
+        } catch (Exception e) {
+            log.error("Failed in Service Template loading", e);
+        }
+    }
+
+    private void loadNodeType(Resource file, StrBuilder errorBuilder) {
+        try {
+            log.trace("Loading Node Type : {}", file.getFilename());
+            String nodeKey = file.getFilename().replace(JSON_EXTN, "");
+            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()));
+            ModelType modelType = new ModelType();
+            modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE);
+            modelType.setDerivedFrom(nodeType.getDerivedFrom());
+            modelType.setDescription(nodeType.getDescription());
+            modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
+            modelType.setModelName(nodeKey);
+            modelType.setVersion(nodeType.getVersion());
+            modelType.setUpdatedBy(updateBySystem);
+            modelType.setTags(nodeKey + "," + BluePrintConstants.MODEL_DEFINITION_TYPE_NODE_TYPE + ","
+                    + nodeType.getDerivedFrom());
+            modelTypeService.saveModel(modelType);
+            log.trace("Loaded Node Type successfully : {}", file.getFilename());
+        } catch (Exception e) {
+            log.error(EXCEPTION, e);
+            errorBuilder.appendln("Node type loading error : " + file.getFilename() + ":" + e.getMessage());
+        }
+    }
+
+    private void loadDataType(@NotNull Resource file, StrBuilder errorBuilder) {
+        try {
+            log.trace("Loading Data Type: {}", file.getFilename());
+            String dataKey = file.getFilename().replace(JSON_EXTN, "");
+            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()));
+            ModelType modelType = new ModelType();
+            modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+            modelType.setDerivedFrom(dataType.getDerivedFrom());
+            modelType.setDescription(dataType.getDescription());
+            modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
+            modelType.setModelName(dataKey);
+            modelType.setVersion(dataType.getVersion());
+            modelType.setUpdatedBy(updateBySystem);
+            modelType.setTags(dataKey + "," + dataType.getDerivedFrom() + ","
+                    + BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
+            modelTypeService.saveModel(modelType);
+            log.trace(" Loaded Data Type successfully : {}", file.getFilename());
+        } catch (Exception e) {
+            log.error(EXCEPTION, e);
+            errorBuilder.appendln("Data type loading error : " + file.getFilename() + ":" + e.getMessage());
+        }
+    }
+
+    private void loadArtifactType(Resource file, StrBuilder errorBuilder) {
+        try {
+            log.trace("Loading Artifact Type: {}", file.getFilename());
+            String dataKey = file.getFilename().replace(JSON_EXTN, "");
+            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()));
+            ModelType modelType = new ModelType();
+            modelType.setDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
+            modelType.setDerivedFrom(artifactType.getDerivedFrom());
+            modelType.setDescription(artifactType.getDescription());
+            modelType.setDefinition(JacksonUtils.jsonNode(definitionContent));
+            modelType.setModelName(dataKey);
+            modelType.setVersion(artifactType.getVersion());
+            modelType.setUpdatedBy(updateBySystem);
+            modelType.setTags(dataKey + "," + artifactType.getDerivedFrom() + ","
+                    + BluePrintConstants.MODEL_DEFINITION_TYPE_ARTIFACT_TYPE);
+            modelTypeService.saveModel(modelType);
+            log.trace("Loaded Artifact Type successfully : {}", file.getFilename());
+        } catch (Exception e) {
+            log.error(EXCEPTION, e);
+            errorBuilder.appendln("Artifact type loading error : " + file.getFilename() + ":" + e.getMessage());
+        }
+    }
+
+    private Resource[] getPathResources(String path, String extension) throws IOException {
+        return resourceLoader.getResources("file:" + path + "/*" + extension);
+    }
+
+    private String getResourceContent(Resource resource) throws IOException {
+        return IOUtils.toString(resource.getInputStream(), Charset.defaultCharset());
+    }
+
+}