const val RESPONSE_HEADER_TRANSACTION_ID: String = "X-ONAP-RequestID"\r
const val RESPONSE_HEADER_MINOR_VERSION: String = "X-MinorVersion"\r
const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion"\r
- const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"
-
- const val STATUS_SUCCESS: String = "success"
- const val STATUS_PROCESSING: String = "processing"
- const val STATUS_FAILURE: String = "failure"
-
- const val TYPE_DEFAULT: String = "default"
+ const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"\r
+\r
+ const val STATUS_SUCCESS: String = "success"\r
+ const val STATUS_PROCESSING: String = "processing"\r
+ const val STATUS_FAILURE: String = "failure"\r
+\r
+ const val TYPE_DEFAULT: String = "default"\r
\r
const val DATA_TYPE_STRING: String = "string"\r
const val DATA_TYPE_INTEGER: String = "integer"\r
const val MODEL_TYPE_NODES_COMPONENT_SCRIPT: String = "tosca.nodes.component.Script"\r
const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"\r
const val MODEL_TYPE_NODES_COMPONENT_JYTHON: String = "tosca.nodes.component.Jython"\r
+ const val MODEL_TYPE_NODES_COMPONENT_KOTLIN: String = "tosca.nodes.component.Kotlin"\r
const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"\r
\r
const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION = "tosca.artifacts.Implementation"\r
const val TOSCA_SCRIPTS_DIR: String = "Scripts"\r
const val TOSCA_MAPPINGS_DIR: String = "Mappings"\r
const val TOSCA_TEMPLATES_DIR: String = "Templates"\r
+ const val TOSCA_SCRIPTS_KOTLIN_DIR: String = "$TOSCA_SCRIPTS_DIR/kotlin"\r
\r
const val METADATA_USER_GROUPS = "user-groups"\r
const val METADATA_TEMPLATE_NAME = "template_name"\r
--- /dev/null
+/*
+ * 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.core.interfaces
+
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+
+interface BluePrintScriptsService{
+
+ fun <T> scriptInstance(blueprintContext: BluePrintContext, scriptClassName: String,
+ reCompile: Boolean): T
+}
\ No newline at end of file
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
*/\r
+@file:Suppress("unused")\r
\r
package org.onap.ccsdk.apps.controllerblueprints.core.service\r
\r
import com.att.eelf.configuration.EELFLogger\r
import com.att.eelf.configuration.EELFManager\r
import com.fasterxml.jackson.databind.JsonNode\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.*\r
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils\r
return JacksonUtils.getJson(serviceTemplate, pretty)\r
}\r
\r
+ fun name(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_NAME)\r
+ ?: throw BluePrintException("could't get template name from meta data")\r
+\r
+ fun version(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_VERSION)\r
+ ?: throw BluePrintException("could't get template version from meta data")\r
+\r
+ fun author(): String = metadata?.get(BluePrintConstants.METADATA_TEMPLATE_AUTHOR)\r
+ ?: throw BluePrintException("could't get template author from meta data")\r
+\r
// Workflow\r
val workflows: MutableMap<String, Workflow>? = serviceTemplate.topologyTemplate?.workflows\r
\r
val nodeTemplates: MutableMap<String, NodeTemplate>? = serviceTemplate.topologyTemplate?.nodeTemplates\r
\r
fun nodeTemplateByName(name: String): NodeTemplate =\r
- nodeTemplates?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")
+ nodeTemplates?.get(name) ?: throw BluePrintException("could't get node template for the name($name)")\r
\r
fun nodeTemplateForNodeType(name: String): MutableMap<String, NodeTemplate>? {\r
return nodeTemplates?.filterValues { nodeTemplate -> nodeTemplate.type == name }?.toMutableMap()\r
--- /dev/null
+/*
+ * 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.
+ */
+
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.processor.*
+import org.onap.ccsdk.apps.blueprintsprocessor.functions.resource.resolution.CapabilityResourceSource
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintScriptsService
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
+
+open class ScriptResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+
+ lateinit var resourceAssignment: ResourceAssignment
+
+ override fun getName(): String {
+ return "resource-assignment-processor-custom-capability"
+ }
+
+ override fun process(resourceAssignment: ResourceAssignment) {
+ this.resourceAssignment = resourceAssignment
+ }
+
+ override fun prepareResponse(): ResourceAssignment {
+ return resourceAssignment
+ }
+
+ override fun recover(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
+ TODO("To Implement")
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ */
+
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+
+open class SampleKotlinComponent : BlueprintFunctionNode<String, String> {
+
+ override fun getName(): String {
+ return "my Name"
+ }
+
+ override fun prepareRequest(executionRequest: String): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun process(executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun prepareResponse(): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun apply(t: String): String {
+ return "Successfully Executed Scripts"
+ }
+}
]
},
"instance-name": {
- "description": "Capability component instance reference name.",
+ "description": "Capability component instance reference name for JAVA-COMPONENT, Script Class name for KOTLIN-COMPONENT.",
"required": true,
"type": "string"
},
+ "instance-dependencies": {
+ "required": false,
+ "description": "Instance dependency Names to Inject to Kotlin / Jython Script.",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
"input-key-mapping": {
"description": "Context name to input parameters name mapping.",
"required": false,