summaryrefslogtreecommitdiffstats
path: root/appc-config
diff options
context:
space:
mode:
authorwejs <maciej.wejs@nokia.com>2018-02-13 13:49:55 +0100
committerPatrick Brady <pb071s@att.com>2018-02-14 20:14:59 +0000
commit295e64fb4a0b6654668457ee7e43d54ec533f667 (patch)
tree1df73e99155f36122d43c0f72c53fb1b034c3091 /appc-config
parentfce1a2306f42af3cbc9a6350caf1a57ee25f33e6 (diff)
Sonar fixes - appc-config-flow-controller-provider
Fixes inlude changes in: DefaultResponseHandler EncryptionTool EscapeUtils FlowControllerConstants FlowControllerActivator Change-Id: Ic22db7a53697f1869da248a0351593edf9bdf187 Issue-ID: APPC-618 Signed-off-by: wejs <maciej.wejs@nokia.com>
Diffstat (limited to 'appc-config')
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/FlowControllerActivator.java42
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java20
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EncryptionTool.java42
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EscapeUtils.java8
-rw-r--r--appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java170
5 files changed, 135 insertions, 147 deletions
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/FlowControllerActivator.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/FlowControllerActivator.java
index 9a7b5935d..6594bb783 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/FlowControllerActivator.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/FlowControllerActivator.java
@@ -22,9 +22,10 @@
package org.onap.appc.flow.controller;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.util.LinkedList;
import java.util.List;
-
import org.onap.appc.flow.controller.node.FlowControlNode;
import org.onap.appc.flow.controller.node.JsonParsingNode;
import org.onap.appc.flow.controller.node.RestServiceNode;
@@ -32,50 +33,43 @@ import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+public class FlowControllerActivator implements BundleActivator {
-public class FlowControllerActivator implements BundleActivator{
+ private List<ServiceRegistration> registrations = new LinkedList<>();
- private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControllerActivator.class);
+ private static final String REGISTERING = "Registering service ";
+ private static final String REGISTERING_OK = REGISTERING + "successful for ";
- private static final EELFLogger log = EELFManager.getInstance().getLogger(FlowControllerActivator.class);
@Override
- public void start(BundleContext ctx) throws Exception
- {
-
+ public void start(BundleContext ctx) {
try {
-
FlowControlNode flowExecutorNode = new FlowControlNode();
- log.debug("Registering service "+ flowExecutorNode.getClass().getName());
+ log.debug(REGISTERING + flowExecutorNode.getClass().getName());
registrations.add(ctx.registerService(flowExecutorNode.getClass().getName(), flowExecutorNode, null));
- log.debug("Registering service sccessful for "+ flowExecutorNode.getClass().getName());
+ log.debug(REGISTERING_OK + flowExecutorNode.getClass().getName());
RestServiceNode restServiceNode = new RestServiceNode();
- log.debug("Registering service "+ restServiceNode.getClass().getName());
+ log.debug(REGISTERING + restServiceNode.getClass().getName());
registrations.add(ctx.registerService(restServiceNode.getClass().getName(), restServiceNode, null));
- log.debug("Registering service sccessful for "+ restServiceNode.getClass().getName());
+ log.debug(REGISTERING_OK + restServiceNode.getClass().getName());
JsonParsingNode jsonParsingNode = new JsonParsingNode();
- log.debug("Registering service "+ jsonParsingNode.getClass().getName());
+ log.debug(REGISTERING + jsonParsingNode.getClass().getName());
registrations.add(ctx.registerService(jsonParsingNode.getClass().getName(), jsonParsingNode, null));
- log.debug("Registering service sccessful for "+ jsonParsingNode.getClass().getName());
+ log.debug(REGISTERING_OK + jsonParsingNode.getClass().getName());
} catch (Exception e) {
- e.printStackTrace();
+ log.debug("Exeception occured in FlowControllerActivator", e);
}
-
}
+
@Override
- public void stop(BundleContext arg0) throws Exception
- {
- for (ServiceRegistration registration: registrations)
- {
+ public void stop(BundleContext arg0) {
+ for (ServiceRegistration registration: registrations) {
registration.unregister();
- registration = null;
}
-
}
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java
index 36cb899c6..a164dadee 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/ResponseHandlerImpl/DefaultResponseHandler.java
@@ -19,34 +19,30 @@
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
* ============LICENSE_END=========================================================
*/
-package org.onap.appc.flow.controller.ResponseHandlerImpl;
+package org.onap.appc.flow.controller.ResponseHandlerImpl;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.onap.appc.flow.controller.data.Response;
import org.onap.appc.flow.controller.data.ResponseAction;
import org.onap.appc.flow.controller.data.Transaction;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-
public class DefaultResponseHandler {
private static final EELFLogger log = EELFManager.getInstance().getLogger(DefaultResponseHandler.class);
- public ResponseAction handlerResponse(Transaction transaction){
-
+ public ResponseAction handlerResponse(Transaction transaction) {
log.info("Transaction Input params " + transaction.toString());
ResponseAction responseAction = new ResponseAction();
- if(transaction.getResponses() != null && !transaction.getResponses().isEmpty()) {
- for(Response response : transaction.getResponses()) {
- if(response.getResponseCode() != null && response.getResponseCode().equals(transaction.getStatusCode())) {
+ if (transaction.getResponses() != null && !transaction.getResponses().isEmpty()) {
+ for (Response response : transaction.getResponses()) {
+ if (response.getResponseCode() != null
+ && response.getResponseCode().equals(transaction.getStatusCode())) {
responseAction = response.getResponseAction();
break;
}
-
}
-
}
return responseAction ;
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EncryptionTool.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EncryptionTool.java
index 61b3cd51c..57fca1b78 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EncryptionTool.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EncryptionTool.java
@@ -24,7 +24,6 @@
package org.onap.appc.flow.controller.utils;
-
import java.security.Provider;
import java.security.Provider.Service;
import java.security.Security;
@@ -41,12 +40,12 @@ public class EncryptionTool {
/**
* The prefix we insert onto any data we encrypt so that we can tell if it is encrpyted later and
- * therefore decrypt it
+ * therefore decrypt it.
*/
- public static final String ENCRYPTED_VALUE_PREFIX = "enc:";
+ private static final String ENCRYPTED_VALUE_PREFIX = "enc:";
/**
- * The instance of the encryption utility object
+ * The instance of the encryption utility object.
*/
private static EncryptionTool instance = null;
@@ -60,26 +59,13 @@ public class EncryptionTool {
* are using is a symmetrical cipher.
*/
private static char[] secret = {'C', '_', 'z', 'l', '!', 'K', '!', '4', '?', 'O', 'z', 'E', 'K', 'E', '>', 'U', 'R',
- '/', '%', 'Y', '\\', 'f', 'b', '"', 'e', 'n', '{', '"', 'l', 'U', 'F', '+', 'E', '\'', 'R', 'T', 'p', '1',
- 'V', '4', 'l', 'a', '9', 'w', 'v', '5', 'Z', '#', 'i', 'V', '"', 'd', 'l', '!', 'L', 'M', 'g', 'L', 'Q',
- '{', 'v', 'v', 'K', 'V'};
-
-
+ '/', '%', 'Y', '\\', 'f', 'b', '"', 'e', 'n', '{', '"', 'l', 'U', 'F', '+', 'E', '\'', 'R', 'T', 'p', '1',
+ 'V', '4', 'l', 'a', '9', 'w', 'v', '5', 'Z', '#', 'i', 'V', '"', 'd', 'l', '!', 'L', 'M', 'g', 'L', 'Q',
+ '{', 'v', 'v', 'K', 'V'};
- /**
- * Get an instance of the EncryptionTool
- *
- * @return The encryption tool to be used
- */
- public static final synchronized EncryptionTool getInstance() {
- if (instance == null) {
- instance = new EncryptionTool();
- }
- return instance;
- }
/**
- * Create the EncryptionTool instance
+ * Create the EncryptionTool instance.
*/
private EncryptionTool() {
@@ -88,7 +74,7 @@ public class EncryptionTool {
for (Service s : p.getServices()) {
String algo = s.getAlgorithm();
sb.append(String.format("%n -Algorithm [ %s ] in provider [ %s ] and service [ %s ]", algo, p.getName(),
- s.getClassName()));
+ s.getClassName()));
}
}
if (LOG.isDebugEnabled()) {
@@ -97,6 +83,18 @@ public class EncryptionTool {
}
/**
+ * Get an instance of the EncryptionTool.
+ *
+ * @return The encryption tool to be used
+ */
+ public static final synchronized EncryptionTool getInstance() {
+ if (instance == null) {
+ instance = new EncryptionTool();
+ }
+ return instance;
+ }
+
+ /**
* Decrypt the provided encrypted text
*
* @param cipherText THe cipher text to be decrypted. If the ciphertext is not encrypted, then it is
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EscapeUtils.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EscapeUtils.java
index 6f76cee73..134c96a33 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EscapeUtils.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/EscapeUtils.java
@@ -19,22 +19,22 @@
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
* ============LICENSE_END=========================================================
*/
+
package org.onap.appc.flow.controller.utils;
import org.apache.commons.lang3.StringUtils;
public class EscapeUtils {
- public EscapeUtils() {
+ private EscapeUtils() {
}
public static String escapeSql(String str) {
if (str == null) {
return null;
}
- String searchList[] = new String[]{"'","\\", "\"" };
- String replacementList[] = new String[]{ "''","\\\\" ,"\\\""};
+ String[] searchList = new String[]{"'","\\", "\"" };
+ String[] replacementList = new String[]{ "''","\\\\" ,"\\\""};
return StringUtils.replaceEach(str,searchList, replacementList);
}
-
}
diff --git a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java
index f3f58b8e8..b67f19329 100644
--- a/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java
+++ b/appc-config/appc-flow-controller/provider/src/main/java/org/onap/appc/flow/controller/utils/FlowControllerConstants.java
@@ -19,101 +19,101 @@
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
* ============LICENSE_END=========================================================
*/
+
package org.onap.appc.flow.controller.utils;
public class FlowControllerConstants {
- public static final String STRING_ENCODING = "utf-8";
- public static final String Y = "Y";
- public static final String N = "N";
- public static final String DATA_TYPE_TEXT = "TEXT";
- public static final String DATA_TYPE_JSON = "JSON";
- public static final String DATA_TYPE_XML = "XML";
- public static final String DATA_TYPE_SQL = "SQL";
-
- public static final String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
+ public static final String STRING_ENCODING = "utf-8";
+ public static final String Y = "Y";
+ public static final String N = "N";
+ public static final String DATA_TYPE_TEXT = "TEXT";
+ public static final String DATA_TYPE_JSON = "JSON";
+ public static final String DATA_TYPE_XML = "XML";
+ public static final String DATA_TYPE_SQL = "SQL";
- public static final String OUTPUT_PARAM_STATUS = "status";
- public static final String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
- public static final String OUTPUT_STATUS_SUCCESS = "success";
- public static final String OUTPUT_STATUS_FAILURE = "failure";
+ public static final String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
- public static final String DESINGTIME = "DesignTime";
- public static final String RUNTIME = "RunTime";
- public static final String APPC_FLOW_CONTROLLER = "/appc-flow-controller.properties";
- public static final String VNF_TYPE = "vnf-type";
- public static final String ACTION = "action";
- public static final String VNFC_TYPE = "vnfc-type";
- public static final String VM_INSTANCE = "vm-instance";
- public static final String VM = "vm";
- public static final String VNFC = "vnfc";
- public static final String REFERENCE = "reference";
- public static final String VNFC_INSTANCE = "vnfc-instance";
- public static final String DEVICE_PROTOCOL = "device-protocol";
- public static final String DG_RPC = "dg-rpc";
- public static final String MODULE = "module";
- public static final String USER_NAME = "user-name";
- public static final String PORT_NUMBER = "port-number";
- public static final String DOWNLOAD_DG_REFERENCE = "download-dg-reference";
- public static final String REQUEST_ACTION = "request-action";
- public static final String VNF = "vnf";
- public static final String EXTERNAL = "External";
- public static final String ACTION_LEVEL = "action-level";
- public static final String ARTIFACT_NAME = "artifact-name";
+ public static final String OUTPUT_PARAM_STATUS = "status";
+ public static final String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
+ public static final String OUTPUT_STATUS_SUCCESS = "success";
+ public static final String OUTPUT_STATUS_FAILURE = "failure";
- public static enum endPointType {DG,REST,NODE};
- public static enum flowStatus {PENDING,IN_PROCESS,COMPLETED};
+ public static final String DESINGTIME = "DesignTime";
+ public static final String RUNTIME = "RunTime";
+ public static final String APPC_FLOW_CONTROLLER = "/appc-flow-controller.properties";
+ public static final String VNF_TYPE = "vnf-type";
+ public static final String ACTION = "action";
+ public static final String VNFC_TYPE = "vnfc-type";
+ public static final String VM_INSTANCE = "vm-instance";
+ public static final String VM = "vm";
+ public static final String VNFC = "vnfc";
+ public static final String REFERENCE = "reference";
+ public static final String VNFC_INSTANCE = "vnfc-instance";
+ public static final String DEVICE_PROTOCOL = "device-protocol";
+ public static final String DG_RPC = "dg-rpc";
+ public static final String MODULE = "module";
+ public static final String USER_NAME = "user-name";
+ public static final String PORT_NUMBER = "port-number";
+ public static final String DOWNLOAD_DG_REFERENCE = "download-dg-reference";
+ public static final String REQUEST_ACTION = "request-action";
+ public static final String VNF = "vnf";
+ public static final String EXTERNAL = "External";
+ public static final String ACTION_LEVEL = "action-level";
+ public static final String ARTIFACT_NAME = "artifact-name";
- public static final String GENERATION_NODE = "GENERATION-NODE";
- public static final String SEQUENCE_TYPE = "SEQUENCE-TYPE";
- public static final String CATEGORY = "CATEGORY";
- public static final String EXECUTION_NODE = "EXECUTION-NODE";
+ public enum EndPointType { DG, REST, NODE }
+ public enum FlowStatus { PENDING, IN_PROCESS, COMPLETED }
- public static final String REQUEST_ID = "reqeust-id";
- public static final String ARTIFACT_CONTENT = "artifact-content";
- public static final String ARTIFACT_CONTENT_ESCAPED = "artifact-content-escaped";
- public static final String FLOW_SEQUENCE = "flow-sequence";
- public static final String EXECUTTION_MODULE = "execution-module";
- public static final String EXECUTION_RPC = "execution-rpc";
- public static final String EXECUTION_TYPE = "execution-type";
- public static final String GRAPH = "graph";
- public static final String NODE = "node";
- public static final String REST = "rest";
+ public static final String GENERATION_NODE = "GENERATION-NODE";
+ public static final String SEQUENCE_TYPE = "SEQUENCE-TYPE";
+ public static final String CATEGORY = "CATEGORY";
+ public static final String EXECUTION_NODE = "EXECUTION-NODE";
+ public static final String REQUEST_ID = "reqeust-id";
+ public static final String ARTIFACT_CONTENT = "artifact-content";
+ public static final String ARTIFACT_CONTENT_ESCAPED = "artifact-content-escaped";
+ public static final String FLOW_SEQUENCE = "flow-sequence";
+ public static final String EXECUTTION_MODULE = "execution-module";
+ public static final String EXECUTION_RPC = "execution-rpc";
+ public static final String EXECUTION_TYPE = "execution-type";
+ public static final String GRAPH = "graph";
+ public static final String NODE = "node";
+ public static final String REST = "rest";
- public static final String DB_SDC_ARTIFACTS = "ASDC_ARTIFACTS";
- public static final String DB_SDC_REFERENCE = "ASDC_REFERENCE";
- public static final String DB_REQUEST_ARTIFACTS = "REQUEST_ARTIFACTS";
- public static final String DB_MULTISTEP_FLOW_REFERENCE = "MULTISTEP_FLOW_REFERENCE";
- public static final String DB_PROTOCOL_REFERENCE = "PROTOCOL_REFERENCE";
- public static final String DB_PROCESS_FLOW_REFERENCE = "PROCESS_FLOW_REFERENCE";
- public static final String MOCK_HEALTHCHECK = "mock-healthcheck";
- public static final String ACTION_IDENTIFIER = "action-identifier";
- public static final String PAYLOAD = "payload";
- public static final String FAILURE = "failure";
- public static final String SUCCESS = "success";
- public static final String OTHERS = "Others";
- public static final String RESPONSE_PREFIX = "response-prefix";
- public static final String OUTPUT_STATUS_MESSAGE = "status-message";
- public static final String HEALTHY = "healthy";
- public static final String INPUT_URL = "input.url";
- public static final String INPUT_HOST_IP_ADDRESS = "host-ip-address";
- public static final String INPUT_PORT_NUMBER = "port-number";
- public static final String INPUT_CONTEXT = "context";
- public static final String INPUT_SUB_CONTEXT = "sub-context";
- public static final String INPUT_REQUEST_ACTION_TYPE = "request-action-type";
- public static final String INPUT_REQUEST_ACTION = "request-action";
- public static final String HTTP = "http://";
+ public static final String DB_SDC_ARTIFACTS = "ASDC_ARTIFACTS";
+ public static final String DB_SDC_REFERENCE = "ASDC_REFERENCE";
+ public static final String DB_REQUEST_ARTIFACTS = "REQUEST_ARTIFACTS";
+ public static final String DB_MULTISTEP_FLOW_REFERENCE = "MULTISTEP_FLOW_REFERENCE";
+ public static final String DB_PROTOCOL_REFERENCE = "PROTOCOL_REFERENCE";
+ public static final String DB_PROCESS_FLOW_REFERENCE = "PROCESS_FLOW_REFERENCE";
+ public static final String MOCK_HEALTHCHECK = "mock-healthcheck";
+ public static final String ACTION_IDENTIFIER = "action-identifier";
+ public static final String PAYLOAD = "payload";
+ public static final String FAILURE = "failure";
+ public static final String SUCCESS = "success";
+ public static final String OTHERS = "Others";
+ public static final String RESPONSE_PREFIX = "response-prefix";
+ public static final String OUTPUT_STATUS_MESSAGE = "status-message";
+ public static final String HEALTHY = "healthy";
+ public static final String INPUT_URL = "input.url";
+ public static final String INPUT_HOST_IP_ADDRESS = "host-ip-address";
+ public static final String INPUT_PORT_NUMBER = "port-number";
+ public static final String INPUT_CONTEXT = "context";
+ public static final String INPUT_SUB_CONTEXT = "sub-context";
+ public static final String INPUT_REQUEST_ACTION_TYPE = "request-action-type";
+ public static final String INPUT_REQUEST_ACTION = "request-action";
+ public static final String HTTP = "http://";
- public static final String VNF_ID = "vnf-id";
- public static final String VSERVER_ID = "vserver-id";
- public static final String SEQ_GENERATOR_URL = "seq_generator_url";
- public static final String SEQ_GENERATOR_UID = "seq_generator.uid";
- public static final String SEQ_GENERATOR_PWD = "seq_generator.pwd";
- public static final String CAPABILITY ="capability";
- public static final String DEPENDENCYMODEL ="tosca_dependency_model";
- public static final String VF_MODULE ="vf-module";
- public static final String VNFC_NAME = "vnfc-name";
- public static final String AAI_VNF_TYPE ="aai-vnf-type";
- }
+ public static final String VNF_ID = "vnf-id";
+ public static final String VSERVER_ID = "vserver-id";
+ public static final String SEQ_GENERATOR_URL = "seq_generator_url";
+ public static final String SEQ_GENERATOR_UID = "seq_generator.uid";
+ public static final String SEQ_GENERATOR_PWD = "seq_generator.pwd";
+ public static final String CAPABILITY = "capability";
+ public static final String DEPENDENCYMODEL = "tosca_dependency_model";
+ public static final String VF_MODULE = "vf-module";
+ public static final String VNFC_NAME = "vnfc-name";
+ public static final String AAI_VNF_TYPE = "aai-vnf-type";
+}