Remove hard coded resource sources definitions such as Input, DB, MDSAL and Default and their dependencies.
Change-Id: I6e00df176415560aa5bbbbf066e5a046878f3c58
Issue-ID: CCSDK-488
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
+++ /dev/null
-/*\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.resource.dict.data;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;\r
-\r
-import java.util.List;\r
-import java.util.Map;\r
-/**\r
- *\r
- * DictionaryDefinition.java Purpose:\r
- * @author Brinda Santh\r
- */\r
-@Deprecated\r
-public class DictionaryDefinition {\r
- @JsonProperty(value = "name", required = true)\r
- private String name;\r
-\r
- @JsonProperty(value = "description")\r
- private String description;\r
-\r
- @JsonProperty(value = "valid-values")\r
- private String validValues;\r
-\r
- @JsonProperty(value = "sample-value")\r
- private String sampleValue;\r
-\r
- private String tags;\r
-\r
- @JsonProperty(value = "updated-by")\r
- private String updatedBy;\r
-\r
- @JsonProperty(value = "resource-type", required = true)\r
- private String resourceType;\r
-\r
- @JsonProperty(value = "resource-path", required = true)\r
- private String resourcePath;\r
-\r
- @JsonProperty(value = "data-type", required = true)\r
- private String dataType;\r
-\r
- @JsonProperty("entry-schema")\r
- private String entrySchema;\r
-\r
- @JsonProperty(value = "default")\r
- private Object defaultValue;\r
-\r
- @JsonProperty(value = "source", required = true)\r
- @JsonDeserialize(using = SourceDeserializer.class, keyAs = String.class, contentAs = ResourceSource.class)\r
- private Map<String, ResourceSource> source;\r
-\r
- @JsonProperty("candidate-dependency")\r
- private Map<String, DictionaryDependency> dependency;\r
-\r
- @JsonProperty("decryption-rules")\r
- private List<DecryptionRule> decryptionRules;\r
-\r
- public String getName() {\r
- return name;\r
- }\r
-\r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
-\r
- public String getDescription() {\r
- return description;\r
- }\r
-\r
- public void setDescription(String description) {\r
- this.description = description;\r
- }\r
-\r
- public String getValidValues() {\r
- return validValues;\r
- }\r
-\r
- public void setValidValues(String validValues) {\r
- this.validValues = validValues;\r
- }\r
-\r
- public String getSampleValue() {\r
- return sampleValue;\r
- }\r
-\r
- public void setSampleValue(String sampleValue) {\r
- this.sampleValue = sampleValue;\r
- }\r
-\r
- public String getTags() {\r
- return tags;\r
- }\r
-\r
- public void setTags(String tags) {\r
- this.tags = tags;\r
- }\r
-\r
- public String getUpdatedBy() {\r
- return updatedBy;\r
- }\r
-\r
- public void setUpdatedBy(String updatedBy) {\r
- this.updatedBy = updatedBy;\r
- }\r
-\r
- public String getResourceType() {\r
- return resourceType;\r
- }\r
-\r
- public void setResourceType(String resourceType) {\r
- this.resourceType = resourceType;\r
- }\r
-\r
- public String getResourcePath() {\r
- return resourcePath;\r
- }\r
-\r
- public void setResourcePath(String resourcePath) {\r
- this.resourcePath = resourcePath;\r
- }\r
-\r
- public String getDataType() {\r
- return dataType;\r
- }\r
-\r
- public void setDataType(String dataType) {\r
- this.dataType = dataType;\r
- }\r
-\r
- public String getEntrySchema() {\r
- return entrySchema;\r
- }\r
-\r
- public void setEntrySchema(String entrySchema) {\r
- this.entrySchema = entrySchema;\r
- }\r
-\r
- public Object getDefaultValue() {\r
- return defaultValue;\r
- }\r
-\r
- public void setDefaultValue(Object defaultValue) {\r
- this.defaultValue = defaultValue;\r
- }\r
-\r
- public Map<String, ResourceSource> getSource() {\r
- return source;\r
- }\r
-\r
- public void setSource(Map<String, ResourceSource> source) {\r
- this.source = source;\r
- }\r
-\r
- public Map<String, DictionaryDependency> getDependency() {\r
- return dependency;\r
- }\r
-\r
- public void setDependency(Map<String, DictionaryDependency> dependency) {\r
- this.dependency = dependency;\r
- }\r
-\r
- public List<DecryptionRule> getDecryptionRules() {\r
- return decryptionRules;\r
- }\r
-\r
- public void setDecryptionRules(List<DecryptionRule> decryptionRules) {\r
- this.decryptionRules = decryptionRules;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\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.resource.dict.data;\r
-\r
-import java.util.List;\r
-/**\r
- *\r
- * DictionaryDependency\r
- * @author Brinda Santh\r
- */\r
-@Deprecated\r
-public class DictionaryDependency {\r
- private List<String> names;\r
-\r
- public List<String> getNames() {\r
- return names;\r
- }\r
-\r
- public void setNames(List<String> names) {\r
- this.names = names;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\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.resource.dict.data;\r
-\r
-import java.io.Serializable;\r
-@Deprecated\r
-public interface ResourceSource extends Serializable {\r
-}\r
+++ /dev/null
-/*\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.resource.dict.data;\r
-\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-import java.util.Map;\r
-/**\r
- *\r
- * SourceDb\r
- * @author Brinda Santh\r
- */\r
-@Deprecated\r
-public class SourceDb implements ResourceSource{\r
- @JsonProperty(value = "base", required = true)\r
- private String base;\r
- @JsonProperty(value = "type", required = true)\r
- private String type; // SQL | PLSQL\r
- @JsonProperty(value = "query", required = true)\r
- private String query;\r
-\r
- @JsonProperty("input-key-mapping")\r
- private Map<String, String> inputKeyMapping;\r
-\r
- @JsonProperty("output-key-mapping")\r
- private Map<String, String> outputKeyMapping;\r
-\r
- public String getBase() {\r
- return base;\r
- }\r
-\r
- public void setBase(String base) {\r
- this.base = base;\r
- }\r
-\r
- public String getType() {\r
- return type;\r
- }\r
-\r
- public void setType(String type) {\r
- this.type = type;\r
- }\r
-\r
- public String getQuery() {\r
- return query;\r
- }\r
-\r
- public void setQuery(String query) {\r
- this.query = query;\r
- }\r
-\r
- public Map<String, String> getInputKeyMapping() {\r
- return inputKeyMapping;\r
- }\r
-\r
- public void setInputKeyMapping(Map<String, String> inputKeyMapping) {\r
- this.inputKeyMapping = inputKeyMapping;\r
- }\r
-\r
- public Map<String, String> getOutputKeyMapping() {\r
- return outputKeyMapping;\r
- }\r
-\r
- public void setOutputKeyMapping(Map<String, String> outputKeyMapping) {\r
- this.outputKeyMapping = outputKeyMapping;\r
- }\r
-\r
-\r
-\r
-}\r
+++ /dev/null
-/*\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.resource.dict.data;\r
-/**\r
- *\r
- * SourceDefault\r
- * @author Brinda Santh\r
- */\r
-@Deprecated\r
-public class SourceDefault implements ResourceSource {\r
-\r
- private String key;\r
-\r
- public String getKey() {\r
- return key;\r
- }\r
-\r
- public void setKey(String key) {\r
- this.key = key;\r
- }\r
-\r
-\r
-}\r
+++ /dev/null
-/*\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.resource.dict.data;\r
-\r
-import com.fasterxml.jackson.core.JsonParser;\r
-import com.fasterxml.jackson.core.JsonProcessingException;\r
-import com.fasterxml.jackson.databind.*;\r
-import com.fasterxml.jackson.databind.node.ObjectNode;\r
-import com.google.common.base.Preconditions;\r
-import org.apache.commons.lang3.StringUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import java.io.IOException;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-@Deprecated\r
-public class SourceDeserializer extends JsonDeserializer<Map<String, ResourceSource>> {\r
-\r
- private static final Logger log = LoggerFactory.getLogger(SourceDeserializer.class);\r
-\r
- private Class<?> keyAs;\r
-\r
- private Class<?> contentAs;\r
-\r
- private static Map<String, Class<? extends ResourceSource>> registry = new HashMap<String, Class<? extends ResourceSource>>();\r
-\r
- public static void registerSource(String uniqueAttribute, Class<? extends ResourceSource> sourceClass) {\r
- registry.put(uniqueAttribute, sourceClass);\r
- }\r
-\r
- @Override\r
- public Map<String, ResourceSource> deserialize(JsonParser p, DeserializationContext ctxt)\r
- throws IOException, JsonProcessingException {\r
-\r
- ObjectMapper mapper = (ObjectMapper) p.getCodec();\r
- ObjectNode root = (ObjectNode) mapper.readTree(p);\r
- Map<String, ResourceSource> sources = new HashMap();\r
- root.fields().forEachRemaining((node) -> {\r
- String key = node.getKey();\r
- JsonNode valueNode = node.getValue();\r
- Preconditions.checkArgument(StringUtils.isNotBlank(key), "missing source key");\r
- Preconditions.checkArgument(registry.containsKey(key), key +" source not registered");\r
- if (StringUtils.isNotBlank(key) && registry.containsKey(key)) {\r
- Class<? extends ResourceSource> sourceClass = registry.get(key);\r
- ResourceSource resourceSource = JacksonUtils.readValue(valueNode.toString(), sourceClass);\r
- sources.put(key, resourceSource);\r
- }\r
- });\r
- return sources;\r
- }\r
-}\r
+++ /dev/null
-/*\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.resource.dict.data;\r
-/**\r
- *\r
- * SourceInput\r
- * @author Brinda Santh\r
- */\r
-@Deprecated\r
-public class SourceInput implements ResourceSource {\r
-\r
- private String key;\r
-\r
- public String getKey() {\r
- return key;\r
- }\r
-\r
- public void setKey(String key) {\r
- this.key = key;\r
- }\r
-\r
-\r
-}\r
+++ /dev/null
-/*\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.resource.dict.data;\r
-/**\r
- *\r
- * SourceMdsal\r
- * @author Brinda Santh\r
- */\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-import java.util.Map;\r
-@Deprecated\r
-public class SourceMdsal implements ResourceSource {\r
-\r
- @JsonProperty(value = "base", required = true)\r
- private String base;\r
-\r
- @JsonProperty(value = "type", required = true)\r
- private String type; // XML | JSON\r
-\r
- @JsonProperty(value = "url-path", required = true)\r
- private String urlPath;\r
-\r
- @JsonProperty(value = "path", required = true)\r
- private String path;\r
-\r
- @JsonProperty("input-key-mapping")\r
- private Map<String, String> inputKeyMapping;\r
-\r
- @JsonProperty("output-key-mapping")\r
- private Map<String, String> outputKeyMapping;\r
-\r
- public String getBase() {\r
- return base;\r
- }\r
-\r
- public void setBase(String base) {\r
- this.base = base;\r
- }\r
-\r
- public String getType() {\r
- return type;\r
- }\r
-\r
- public void setType(String type) {\r
- this.type = type;\r
- }\r
-\r
- public String getUrlPath() {\r
- return urlPath;\r
- }\r
-\r
- public void setUrlPath(String urlPath) {\r
- this.urlPath = urlPath;\r
- }\r
-\r
- public String getPath() {\r
- return path;\r
- }\r
-\r
- public void setPath(String path) {\r
- this.path = path;\r
- }\r
-\r
- public Map<String, String> getInputKeyMapping() {\r
- return inputKeyMapping;\r
- }\r
-\r
- public void setInputKeyMapping(Map<String, String> inputKeyMapping) {\r
- this.inputKeyMapping = inputKeyMapping;\r
- }\r
-\r
- public Map<String, String> getOutputKeyMapping() {\r
- return outputKeyMapping;\r
- }\r
-\r
- public void setOutputKeyMapping(Map<String, String> outputKeyMapping) {\r
- this.outputKeyMapping = outputKeyMapping;\r
- }\r
-\r
-\r
-}\r
/*\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
\r
package org.onap.ccsdk.apps.controllerblueprints.service;\r
\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
import org.springframework.stereotype.Component;\r
\r
import javax.annotation.PostConstruct;\r
}\r
\r
public void registerDictionarySources(){\r
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class);\r
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class);\r
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class);\r
- SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class);\r
+\r
}\r
}\r
/*\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
\r
import com.google.common.base.Preconditions;\r
import org.apache.commons.lang3.StringUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
\r
/**\r
\r
private ResourceDictionaryValidator() {}\r
\r
- /**\r
- * This is a validateResourceDictionaryDefinition\r
- * \r
- * @param definitionContent\r
- * @return boolean\r
- * @throws BluePrintException\r
- */\r
- public static boolean validateResourceDictionaryDefinition(String definitionContent)\r
- throws BluePrintException {\r
- boolean valid = true;\r
- if (StringUtils.isNotBlank(definitionContent)) {\r
- DictionaryDefinition dictionaryDefinition =\r
- JacksonUtils.readValue(definitionContent, DictionaryDefinition.class);\r
- if (dictionaryDefinition == null) {\r
- throw new BluePrintException(\r
- "Resource dictionary definition is not valid content " + definitionContent);\r
- }\r
-\r
- }\r
- return valid;\r
- }\r
-\r
/**\r
* This is a validateResourceDictionary method\r
* \r