From 274c3adda0e6805701230b1137350a570d1caebf Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Fri, 24 Aug 2018 22:48:32 -0400 Subject: Controller Blueprints Microservice Create resource definition and Create Source Node Type definitions for Input, default, db, mdsal and component sources. Change-Id: Icc49cb4be2e8700b61c281ff2d01c365321bb311 Issue-ID: CCSDK-487 Signed-off-by: Brinda Santh --- .../resource/dict/ResourceAssignment.java | 167 --------------------- .../resource/dict/data/DictionaryDefinition.java | 2 + .../resource/dict/data/DictionaryDependency.java | 2 + .../resource/dict/data/SourceDb.java | 2 + .../resource/dict/data/SourceDefault.java | 2 + .../resource/dict/data/SourceDeserializer.java | 3 +- .../resource/dict/data/SourceInput.java | 2 + .../resource/dict/data/SourceMdsal.java | 3 +- .../resource/dict/ResourceAssignmentProcessor.kt | 34 +++++ .../resource/dict/ResourceDefinition.kt | 95 ++++++++++++ 10 files changed, 143 insertions(+), 169 deletions(-) delete mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java create mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt create mode 100644 ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt (limited to 'ms/controllerblueprints/modules/resource-dict/src/main') diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java deleted file mode 100644 index f85e5ebc..00000000 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright © 2017-2018 AT&T Intellectual Property. - * - * 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.resource.dict; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition; - -import java.util.Date; -import java.util.List; - -/** - * ResourceAssignment.java Purpose: Provide ResourceAssignment Custom TOSCO Model POJO bean. - * - * @author Brinda Santh - * @version 1.0 - */ -public class ResourceAssignment { - @JsonProperty(value = "name", required = true) - private String name; - - @JsonProperty(value = "property", required = true) - private PropertyDefinition property; - - @JsonProperty("input-param") - private Boolean inputParameter; - - @JsonProperty("dictionary-name") - private String dictionaryName; - - @JsonProperty("dictionary-source") - private String dictionarySource; - - @JsonProperty("dependencies") - private List dependencies; - - @JsonProperty("version") - private int version; - - @JsonProperty("status") - private String status; - - @JsonProperty("message") - private String message; - - @JsonProperty("updated-date") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") - private Date updatedDate; - - @JsonProperty("updated-by") - private String updatedBy; - - @Override - public String toString() { - StringBuilder builder = new StringBuilder("["); - builder.append("name = " + name); - builder.append(", source = " + dictionarySource); - if (dependencies != null) { - builder.append(", dependencies = " + dependencies); - } - builder.append("]"); - return builder.toString(); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public PropertyDefinition getProperty() { - return property; - } - - public void setProperty(PropertyDefinition property) { - this.property = property; - } - - public Boolean getInputParameter() { - return inputParameter; - } - - public void setInputParameter(Boolean inputParameter) { - this.inputParameter = inputParameter; - } - - public String getDictionaryName() { - return dictionaryName; - } - - public void setDictionaryName(String dictionaryName) { - this.dictionaryName = dictionaryName; - } - - public String getDictionarySource() { - return dictionarySource; - } - - public void setDictionarySource(String dictionarySource) { - this.dictionarySource = dictionarySource; - } - - public List getDependencies() { - return dependencies; - } - - public void setDependencies(List dependencies) { - this.dependencies = dependencies; - } - - public int getVersion() { - return version; - } - - public void setVersion(int version) { - this.version = version; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Date getUpdatedDate() { - return updatedDate; - } - - public void setUpdatedDate(Date updatedDate) { - this.updatedDate = updatedDate; - } - - public String getUpdatedBy() { - return updatedBy; - } - - public void setUpdatedBy(String updatedBy) { - this.updatedBy = updatedBy; - } - -} diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java index 7c2d926f..92178673 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java @@ -1,5 +1,6 @@ /* * 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. @@ -26,6 +27,7 @@ import java.util.Map; * DictionaryDefinition.java Purpose: * @author Brinda Santh */ +@Deprecated public class DictionaryDefinition { @JsonProperty(value = "name", required = true) private String name; diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java index acb71058..6ffbca26 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDependency.java @@ -1,5 +1,6 @@ /* * 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. @@ -22,6 +23,7 @@ import java.util.List; * DictionaryDependency * @author Brinda Santh */ +@Deprecated public class DictionaryDependency { private List names; diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java index 724d0224..fbeab52f 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java @@ -1,5 +1,6 @@ /* * 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. @@ -24,6 +25,7 @@ import java.util.Map; * SourceDb * @author Brinda Santh */ +@Deprecated public class SourceDb implements ResourceSource{ @JsonProperty(value = "base", required = true) private String base; diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java index d165192e..e0f83bb8 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java @@ -1,5 +1,6 @@ /* * 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. @@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data; * SourceDefault * @author Brinda Santh */ +@Deprecated public class SourceDefault implements ResourceSource { private String key; diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java index 86476e1c..a097c56d 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java @@ -1,5 +1,6 @@ /* * 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. @@ -29,7 +30,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.HashMap; import java.util.Map; - +@Deprecated public class SourceDeserializer extends JsonDeserializer> { private static final Logger log = LoggerFactory.getLogger(SourceDeserializer.class); diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java index 87184f22..8ab16ecb 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java @@ -1,5 +1,6 @@ /* * 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. @@ -20,6 +21,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data; * SourceInput * @author Brinda Santh */ +@Deprecated public class SourceInput implements ResourceSource { private String key; diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java index 8a066e91..379f6e91 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java +++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java @@ -1,5 +1,6 @@ /* * 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. @@ -23,7 +24,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; - +@Deprecated public class SourceMdsal implements ResourceSource { @JsonProperty(value = "base", required = true) diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt new file mode 100644 index 00000000..a6802f67 --- /dev/null +++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignmentProcessor.kt @@ -0,0 +1,34 @@ +/* + * 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.resource.dict + +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException + +interface ResourceAssignmentProcessor { + + @Throws(BluePrintProcessorException::class) + fun validate(resourceAssignment: ResourceAssignment, context : MutableMap) + + @Throws(BluePrintProcessorException::class) + fun process(resourceAssignment: ResourceAssignment, context : MutableMap) + + @Throws(BluePrintProcessorException::class) + fun errorHandle(resourceAssignment: ResourceAssignment, context : MutableMap) + + @Throws(BluePrintProcessorException::class) + fun reTrigger(resourceAssignment: ResourceAssignment, context : MutableMap) +} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt new file mode 100644 index 00000000..c2c8094b --- /dev/null +++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDefinition.kt @@ -0,0 +1,95 @@ +/* + * 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.resource.dict + +import com.fasterxml.jackson.annotation.JsonFormat +import com.fasterxml.jackson.annotation.JsonProperty +import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate +import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition +import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DecryptionRule +import java.io.Serializable +import java.util.* + +open class ResourceDefinition{ + + @JsonProperty(value = "name", required = true) + lateinit var name: String + + @JsonProperty(value = "property", required = true) + lateinit var property : PropertyDefinition + + var tags: String? = null + + @JsonProperty(value = "updated-by") + lateinit var updatedBy: String + + @JsonProperty(value = "resource-type", required = true) + lateinit var resourceType: String + + @JsonProperty(value = "resource-path", required = true) + lateinit var resourcePath: String + + @JsonProperty(value = "sources", required = true) + var sources: MutableMap? = null + + @JsonProperty("decryption-rules") + var decryptionRules: MutableList? = null + +} + +open class ResourceAssignment { + + @JsonProperty(value = "name", required = true) + lateinit var name: String + + @JsonProperty(value = "property") + var property: PropertyDefinition? = null + + @JsonProperty("input-param") + var inputParameter: Boolean = false + + @JsonProperty("dictionary-name") + var dictionaryName: String? = null + + @JsonProperty("dictionary-source") + var dictionarySource: String? = null + + @JsonProperty("dependencies") + var dependencies: MutableList? = null + + @JsonProperty("version") + var version: Int = 0 + + @JsonProperty("status") + var status: String? = null + + @JsonProperty("message") + var message: String? = null + + @JsonProperty("updated-date") + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") + var updatedDate: Date? = null + + @JsonProperty("updated-by") + var updatedBy: String? = null +} + +/** + * Interface for Source Definitions (ex Input Source, + * Default Source, Database Source, Rest Sources, etc) + */ +interface ResourceSource : Serializable -- cgit 1.2.3-korg