From 208cb6ae94922c0198648aea817085793ce8bc47 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Mon, 27 Aug 2018 17:29:51 +0000 Subject: Controller Blueprints Microservice Optimise model type repository search for DB and file in blueprint repo service. Change-Id: If5458e218b723d3fff451789a73a667dd75bc91c Issue-ID: CCSDK-487 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../load/model_type/node_type/source-db.json | 44 ++++++++++++++++ .../load/model_type/node_type/source-default.json | 18 +++++++ .../load/model_type/node_type/source-input.json | 18 +++++++ .../load/model_type/node_type/source-rest.json | 61 ++++++++++++++++++++++ .../node_type/tosca.nodes.ResourceSource.json | 5 ++ .../ApplicationExceptionHandler.java | 5 ++ 6 files changed, 151 insertions(+) create mode 100644 ms/controllerblueprints/application/load/model_type/node_type/source-db.json create mode 100644 ms/controllerblueprints/application/load/model_type/node_type/source-default.json create mode 100644 ms/controllerblueprints/application/load/model_type/node_type/source-input.json create mode 100644 ms/controllerblueprints/application/load/model_type/node_type/source-rest.json create mode 100644 ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.ResourceSource.json (limited to 'ms/controllerblueprints/application') diff --git a/ms/controllerblueprints/application/load/model_type/node_type/source-db.json b/ms/controllerblueprints/application/load/model_type/node_type/source-db.json new file mode 100644 index 00000000..661a9503 --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/source-db.json @@ -0,0 +1,44 @@ +{ + "description": "This is Database Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": true, + "type": "string", + "constraints": [ + { + "valid_values": [ + "SQL", + "PLSQL" + ] + } + ] + }, + "query": { + "required": true, + "type": "string" + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/ms/controllerblueprints/application/load/model_type/node_type/source-default.json b/ms/controllerblueprints/application/load/model_type/node_type/source-default.json new file mode 100644 index 00000000..13e234e1 --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/source-default.json @@ -0,0 +1,18 @@ +{ + "description": "This is Default Resource Source Node Type", + "version": "1.0.0", + "properties": { + "key": { + "required": false, + "type": "string" + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/ms/controllerblueprints/application/load/model_type/node_type/source-input.json b/ms/controllerblueprints/application/load/model_type/node_type/source-input.json new file mode 100644 index 00000000..126ea30b --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/source-input.json @@ -0,0 +1,18 @@ +{ + "description": "This is Input Resource Source Node Type", + "version": "1.0.0", + "properties": { + "key": { + "required": false, + "type": "string" + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/ms/controllerblueprints/application/load/model_type/node_type/source-rest.json b/ms/controllerblueprints/application/load/model_type/node_type/source-rest.json new file mode 100644 index 00000000..f8dd8b6f --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/source-rest.json @@ -0,0 +1,61 @@ +{ + "description": "This is Rest Resource Source Node Type", + "version": "1.0.0", + "properties": { + "type": { + "required": false, + "type": "string", + "default": "JSON", + "constraints": [ + { + "valid_values": [ + "JSON" + ] + } + ] + }, + "url-path": { + "required": true, + "type": "string" + }, + "path": { + "required": true, + "type": "string" + }, + "expression-type": { + "required": false, + "type": "string", + "default": "JSON_PATH", + "constraints": [ + { + "valid_values": [ + "JSON_PATH", + "JSON_POINTER" + ] + } + ] + }, + "input-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "output-key-mapping": { + "required": false, + "type": "map", + "entry_schema": { + "type": "string" + } + }, + "key-dependencies": { + "required": true, + "type": "list", + "entry_schema": { + "type": "string" + } + } + }, + "derived_from": "tosca.nodes.ResourceSource" +} \ No newline at end of file diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.ResourceSource.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.ResourceSource.json new file mode 100644 index 00000000..2ef553e2 --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.ResourceSource.json @@ -0,0 +1,5 @@ +{ + "description": "TOSCA base type for Resource Sources", + "version": "1.0.0", + "derived_from": "tosca.nodes.Root" +} \ No newline at end of file diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java index d02be5c2..d9380a2f 100644 --- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java +++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java @@ -16,6 +16,8 @@ package org.onap.ccsdk.apps.controllerblueprints; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException; import org.onap.ccsdk.apps.controllerblueprints.service.common.ErrorMessage; import org.springframework.http.HttpStatus; @@ -28,14 +30,17 @@ import org.springframework.web.context.request.WebRequest; @ControllerAdvice @RestController public class ApplicationExceptionHandler { + private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationExceptionHandler.class); @ExceptionHandler(Exception.class) public final ResponseEntity handleAllExceptions(Exception ex, WebRequest request) { + log.error("Application Exception", ex); ErrorMessage exceptionResponse = new ErrorMessage( ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR.value(), ex.getLocalizedMessage()); return new ResponseEntity<>(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR); } @ExceptionHandler(BluePrintException.class) public final ResponseEntity handleBlueprintException(BluePrintException ex, WebRequest request) { + log.error("Application Blueprint Exception", ex); ErrorMessage exceptionResponse = new ErrorMessage( ex.getMessage(), ex.getCode(), ex.getLocalizedMessage()); return new ResponseEntity<>(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR); } -- cgit 1.2.3-korg