summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorSébastien Determe <sd378r@intl.att.com>2017-09-08 10:44:21 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-08 10:44:21 +0000
commitf0c6215103464e860b756d9e781b7e4d34b30541 (patch)
treefc0caded616831b2d1ab41db39fedcb7364df0f0 /src/main/java/org/onap
parent72e904aa818b14e0f3d869c94cac3cb90930749e (diff)
parent4c14395a640b3f0f1d0422b5ff7f840ebee8e92d (diff)
Merge "Add Holmes to the Backend"
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java72
-rw-r--r--src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java62
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/Holmes.java71
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java28
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/ModelElement.java28
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java50
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/Policy.java22
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java14
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/StringMatch.java18
-rw-r--r--src/main/java/org/onap/clamp/clds/model/prop/Tca.java20
-rw-r--r--src/main/java/org/onap/clamp/clds/transform/XslTransformer.java6
11 files changed, 291 insertions, 100 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java
new file mode 100644
index 000000000..db7b5241b
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.client;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.clamp.clds.model.prop.Holmes;
+import org.onap.clamp.clds.model.prop.ModelProperties;
+import org.onap.clamp.clds.model.refprop.RefProp;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Send Holmes info to policy api.
+ */
+public class HolmesPolicyDelegate implements JavaDelegate {
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(HolmesPolicyDelegate.class);
+ protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+
+ @Autowired
+ private PolicyClient policyClient;
+
+ @Autowired
+ private RefProp refProp;
+
+ /**
+ * Perform activity. Send Holmes info to policy api.
+ *
+ * @param execution
+ */
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ String holmesPolicyRequestUuid = UUID.randomUUID().toString();
+ execution.setVariable("holmesPolicyRequestUuid", holmesPolicyRequestUuid);
+
+ ModelProperties prop = ModelProperties.create(execution);
+ Holmes holmes = prop.getType(Holmes.class);
+ if (holmes.isFound()) {
+ String responseMessage = policyClient.sendMicroServiceInJson(holmes.getCorrelationLogic(), prop,
+ holmesPolicyRequestUuid);
+ if (responseMessage != null) {
+ execution.setVariable("holmesPolicyResponseMessage", responseMessage.getBytes());
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java
new file mode 100644
index 000000000..46b33ffea
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.client;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.clamp.clds.model.prop.Holmes;
+import org.onap.clamp.clds.model.prop.ModelProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Delete Holmes Policy via policy api.
+ */
+public class HolmesPolicyDeleteDelegate implements JavaDelegate {
+ protected static final EELFLogger logger = EELFManager.getInstance()
+ .getLogger(HolmesPolicyDeleteDelegate.class);
+ protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+
+ @Autowired
+ private PolicyClient policyClient;
+
+ /**
+ * Perform activity. Delete Holmes Policy via policy api.
+ *
+ * @param execution
+ */
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ ModelProperties prop = ModelProperties.create(execution);
+ Holmes holmes = prop.getType(Holmes.class);
+ if (holmes.isFound()) {
+ prop.setCurrentModelElementId(holmes.getId());
+
+ policyClient.deleteMicrosService(prop);
+ }
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Holmes.java b/src/main/java/org/onap/clamp/clds/model/prop/Holmes.java
new file mode 100644
index 000000000..233f656e1
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/model/prop/Holmes.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+
+package org.onap.clamp.clds.model.prop;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Parse Holmes bpmn parameters json properties.
+ * <p>
+ * Example json:
+ * [{"name":"correlationalLogic","value":"vcwx"},{"name":"operationalPolicy","value":"cccc"}]
+ *
+ */
+public class Holmes extends ModelElement {
+
+ private static final String TYPE_HOLMES = "holmes";
+
+ private String correlationLogic;
+
+ private String operationalPolicy;
+
+ /**
+ * Default constructor for Holmes Element
+ *
+ * @param modelProp
+ * The ModelProperties containing the all the info, like bpmn,
+ * bpmn params, etc ...
+ * @param modelBpmn
+ * @param modelJson
+ */
+ public Holmes(ModelProperties modelProp, ModelBpmn modelBpmn, JsonNode modelJson) {
+ super(TYPE_HOLMES, modelProp, modelBpmn, modelJson);
+
+ correlationLogic = this.getValueByName("correlationalLogic");
+ operationalPolicy = this.getValueByName("operationalPolicy");
+ }
+
+ public static final String getType() {
+ return TYPE_HOLMES;
+ }
+
+ public String getCorrelationLogic() {
+ return correlationLogic;
+ }
+
+ public String getOperationalPolicy() {
+ return operationalPolicy;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java b/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java
index 63a03058d..ae7028dcd 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java
@@ -23,6 +23,15 @@
package org.onap.clamp.clds.model.prop;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -33,15 +42,6 @@ import java.util.Map.Entry;
import org.onap.clamp.clds.service.CldsService;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
/**
* Parse Model BPMN properties.
* <p>
@@ -50,9 +50,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
* :[{"id":"Policy_0oxeocn", "from":"StringMatch_0h6cbdv"}]}
*/
public class ModelBpmn {
- protected static final EELFLogger logger = EELFManager.getInstance()
+ protected static final EELFLogger logger = EELFManager.getInstance()
.getLogger(CldsService.class);
- protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
// for each type, an array of entries
private final Map<String, List<ModelBpmnEntry>> entriesByType = new HashMap<>();
@@ -123,12 +123,14 @@ public class ModelBpmn {
}
/**
- *
+ * This method verifies if the ModelElement Type (collector, holmes, tca,
+ * ...) is in the list.
*
* @param type
+ * A model Element type (tca, collector, ...)
* @return true if the element is found or false otherwise
*/
- public boolean getModelElementFound(String type) {
+ public boolean isModelElementTypeInList(String type) {
return entriesByType.get(type) != null;
}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelElement.java b/src/main/java/org/onap/clamp/clds/model/prop/ModelElement.java
index 42d11f4b5..edf114261 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/ModelElement.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/ModelElement.java
@@ -32,20 +32,19 @@ import java.util.Iterator;
import java.util.List;
/**
- * Provide base ModelElement functionality.
+ * Provide base ModelElement functionality. Perform base parsing of properties
+ * for a ModelElement (such as, Collector, StringMatch, Policy, Tca, Holmes,
+ * ...)
*/
public abstract class ModelElement {
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ModelElement.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- public static final String TYPE_POLICY = "policy";
- public static final String TYPE_TCA = "tca";
-
private final String type;
private final ModelBpmn modelBpmn;
private final String id;
protected String topicPublishes;
- protected final JsonNode meNode;
+ protected final JsonNode modelElementJsonNode;
private boolean isFound;
private final ModelProperties modelProp;
@@ -64,12 +63,13 @@ public abstract class ModelElement {
this.modelProp = modelProp;
this.modelBpmn = modelBpmn;
this.id = modelBpmn.getId(type);
- this.meNode = modelJson.get(id);
- this.isFound = modelBpmn.getModelElementFound(type);
+ this.modelElementJsonNode = modelJson.get(id);
+ this.isFound = modelBpmn.isModelElementTypeInList(type);
}
/**
- * topicSubscribes is the topicPublishes of the from Model Element
+ * topicSubscribes is the topicPublishes of the from Model Element (the
+ * previous one in the chain).
*
* @return the topicSubscribes
*/
@@ -159,16 +159,14 @@ public abstract class ModelElement {
while (i.hasNext()) {
JsonNode node = i.next();
if (node.path("name").asText().equals(name)) {
- String value;
JsonNode vnode = node.path("value");
if (vnode.isArray()) {
// if array, assume value is in first element
- value = vnode.path(0).asText();
+ values.add(vnode.path(0).asText());
} else {
// otherwise, just return text
- value = vnode.asText();
+ values.add(vnode.asText());
}
- values.add(value);
}
}
}
@@ -241,7 +239,7 @@ public abstract class ModelElement {
* @return
*/
public String getValueByName(String name) {
- return getValueByName(meNode, name);
+ return getValueByName(modelElementJsonNode, name);
}
/**
@@ -252,7 +250,7 @@ public abstract class ModelElement {
* @return
*/
public Integer getIntValueByName(String name) {
- return getIntValueByName(meNode, name);
+ return getIntValueByName(modelElementJsonNode, name);
}
/**
@@ -263,7 +261,7 @@ public abstract class ModelElement {
* @return
*/
public List<String> getValuesByName(String name) {
- return getValuesByName(meNode, name);
+ return getValuesByName(modelElementJsonNode, name);
}
/**
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java
index 1cfd46165..9684eea86 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java
@@ -23,6 +23,12 @@
package org.onap.clamp.clds.model.prop;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
@@ -36,19 +42,13 @@ import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.CldsModel;
import org.onap.clamp.clds.service.CldsService;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
/**
* Parse model properties.
*/
public class ModelProperties {
- protected static final EELFLogger logger = EELFManager.getInstance()
+ protected static final EELFLogger logger = EELFManager.getInstance()
.getLogger(CldsService.class);
- protected static final EELFLogger auditLogger = EELFManager.getInstance()
+ protected static final EELFLogger auditLogger = EELFManager.getInstance()
.getAuditLogger();
private ModelBpmn modelBpmn;
@@ -58,10 +58,9 @@ public class ModelProperties {
private final String controlName;
private final String actionCd;
// Flag indicate whether it is triggered by Validation Test button from UI
- private final boolean isTest;
+ private final boolean isTest;
private Global global;
- private Tca tca;
private final Map<String, ModelElement> modelElements = new ConcurrentHashMap<>();
@@ -93,8 +92,8 @@ public class ModelProperties {
* @throws JsonProcessingException
* @throws IOException
*/
- public ModelProperties(String modelName, String controlName, String actionCd, boolean isTest, String modelBpmnPropText,
- String modelPropText) throws IOException {
+ public ModelProperties(String modelName, String controlName, String actionCd, boolean isTest,
+ String modelBpmnPropText, String modelPropText) throws IOException {
this.modelName = modelName;
this.controlName = controlName;
this.actionCd = actionCd;
@@ -150,7 +149,7 @@ public class ModelProperties {
Global global = new Global(modelJson);
vfs = global.getResourceVf();
} catch (IOException e) {
- // VF is null
+ logger.warn("no VF found", e);
}
String vf = null;
if (vfs != null && !vfs.isEmpty()) {
@@ -168,13 +167,12 @@ public class ModelProperties {
* @throws IOException
*/
public static ModelProperties create(DelegateExecution execution) throws IOException {
- // String modelProp = (String) execution.getVariable("modelProp");
String modelProp = new String((byte[]) execution.getVariable("modelProp"));
String modelBpmnProp = (String) execution.getVariable("modelBpmnProp");
String modelName = (String) execution.getVariable("modelName");
String controlName = (String) execution.getVariable("controlName");
String actionCd = (String) execution.getVariable("actionCd");
- boolean isTest = (boolean)execution.getVariable("isTest");
+ boolean isTest = (boolean) execution.getVariable("isTest");
return new ModelProperties(modelName, controlName, actionCd, isTest, modelBpmnProp, modelProp);
}
@@ -303,12 +301,12 @@ public class ModelProperties {
return actionCd;
}
- /**
- * @return the isTest
- */
- public boolean isTest() {
- return isTest;
- }
+ /**
+ * @return the isTest
+ */
+ public boolean isTest() {
+ return isTest;
+ }
/**
* @return the isCreateRequest
@@ -352,14 +350,4 @@ public class ModelProperties {
String type = modelElementClasses.get(clazz);
return (type != null ? (T) modelElements.get(type) : null);
}
-
- /**
- * @return the tca
- */
- public Tca getTca() {
- if (tca == null) {
- tca = new Tca(this, modelBpmn, modelJson);
- }
- return tca;
- }
}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Policy.java b/src/main/java/org/onap/clamp/clds/model/prop/Policy.java
index 6673af213..452af20cd 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/Policy.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/Policy.java
@@ -23,14 +23,14 @@
package org.onap.clamp.clds.model.prop;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* Parse Policy json properties.
* <p>
@@ -49,12 +49,12 @@ import com.fasterxml.jackson.databind.JsonNode;
* "vf3RtPi"]}]]}]
*/
public class Policy extends ModelElement {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class);
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private List<PolicyChain> policyChains;
+ private List<PolicyChain> policyChains;
- private static final String TYPE_POLICY = "policy";
+ private static final String TYPE_POLICY = "policy";
/**
* Parse Policy given json node.
@@ -64,12 +64,12 @@ public class Policy extends ModelElement {
* @param modelJson
*/
public Policy(ModelProperties modelProp, ModelBpmn modelBpmn, JsonNode modelJson) {
- super(ModelElement.TYPE_POLICY, modelProp, modelBpmn, modelJson);
+ super(TYPE_POLICY, modelProp, modelBpmn, modelJson);
// process policies
- if (meNode != null) {
- Iterator<JsonNode> itr = meNode.elements();
- policyChains = new ArrayList<PolicyChain>();
+ if (modelElementJsonNode != null) {
+ Iterator<JsonNode> itr = modelElementJsonNode.elements();
+ policyChains = new ArrayList<>();
while (itr.hasNext()) {
policyChains.add(new PolicyChain(itr.next()));
}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java b/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java
index de98333a1..6e986bb0e 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java
@@ -23,14 +23,14 @@
package org.onap.clamp.clds.model.prop;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* Parse Resource Group json properties.
*
@@ -63,8 +63,8 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class ResourceGroup {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourceGroup.class);
- protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(ResourceGroup.class);
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
private String groupNumber;
private String policyId;
@@ -84,7 +84,7 @@ public class ResourceGroup {
// process Server_Configurations
JsonNode serviceConfigurationsNode = node.get(node.size() - 1).get("serviceConfigurations");
Iterator<JsonNode> itr = serviceConfigurationsNode.elements();
- serviceConfigurations = new ArrayList<ServiceConfiguration>();
+ serviceConfigurations = new ArrayList<>();
while (itr.hasNext()) {
serviceConfigurations.add(new ServiceConfiguration(itr.next()));
}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/StringMatch.java b/src/main/java/org/onap/clamp/clds/model/prop/StringMatch.java
index b20db0aff..7fcc1b1b9 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/StringMatch.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/StringMatch.java
@@ -23,14 +23,12 @@
package org.onap.clamp.clds.model.prop;
+import com.fasterxml.jackson.databind.JsonNode;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-
/**
* Parse StringMatch json properties.
* <p>
@@ -62,12 +60,10 @@ import com.fasterxml.jackson.databind.JsonNode;
*
*/
public class StringMatch extends ModelElement {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(StringMatch.class);
- protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private List<ResourceGroup> resourceGroups;
+ private List<ResourceGroup> resourceGroups;
- private static final String TYPE_STRING_MATCH = "stringMatch";
+ private static final String TYPE_STRING_MATCH = "stringMatch";
/**
* Parse StringMatch given json node.
@@ -79,9 +75,9 @@ public class StringMatch extends ModelElement {
super(TYPE_STRING_MATCH, modelProp, modelBpmn, modelJson);
// process Server_Configurations
- if (meNode != null) {
- Iterator<JsonNode> itr = meNode.elements();
- resourceGroups = new ArrayList<ResourceGroup>();
+ if (modelElementJsonNode != null) {
+ Iterator<JsonNode> itr = modelElementJsonNode.elements();
+ resourceGroups = new ArrayList<>();
while (itr.hasNext()) {
resourceGroups.add(new ResourceGroup(itr.next()));
}
diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Tca.java b/src/main/java/org/onap/clamp/clds/model/prop/Tca.java
index b94f52304..6bc68e23d 100644
--- a/src/main/java/org/onap/clamp/clds/model/prop/Tca.java
+++ b/src/main/java/org/onap/clamp/clds/model/prop/Tca.java
@@ -23,14 +23,14 @@
package org.onap.clamp.clds.model.prop;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.databind.JsonNode;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* Parse Tca json properties.
*
@@ -50,12 +50,12 @@ import com.fasterxml.jackson.databind.JsonNode;
*/
public class Tca extends ModelElement {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Tca.class);
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Tca.class);
protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
- private List<TcaItem> tcaItems;
+ private List<TcaItem> tcaItems;
- private static final String TYPE_TCA = "tca";
+ private static final String TYPE_TCA = "tca";
/**
* Parse Tca given json node
@@ -68,9 +68,9 @@ public class Tca extends ModelElement {
super(TYPE_TCA, modelProp, modelBpmn, modelJson);
// process Server_Configurations
- if (meNode != null) {
- Iterator<JsonNode> itr = meNode.elements();
- tcaItems = new ArrayList<TcaItem>();
+ if (modelElementJsonNode != null) {
+ Iterator<JsonNode> itr = modelElementJsonNode.elements();
+ tcaItems = new ArrayList<>();
while (itr.hasNext()) {
tcaItems.add(new TcaItem(itr.next()));
}
diff --git a/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java b/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java
index d15f67c77..684bae3f6 100644
--- a/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java
+++ b/src/main/java/org/onap/clamp/clds/transform/XslTransformer.java
@@ -34,6 +34,8 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import org.onap.clamp.clds.util.ResourceFileUtil;
+
/**
* XSL Transformer.
*/
@@ -43,7 +45,7 @@ public class XslTransformer {
public void setXslResourceName(String xslResourceName) throws TransformerConfigurationException {
TransformerFactory tfactory = TransformerFactory.newInstance();
- templates = tfactory.newTemplates(new StreamSource(TransformUtil.getResourceAsStream(xslResourceName)));
+ templates = tfactory.newTemplates(new StreamSource(ResourceFileUtil.getResourceAsStream(xslResourceName)));
}
/**
@@ -53,7 +55,7 @@ public class XslTransformer {
* @throws TransformerException
*/
public String doXslTransformToString(String xml) throws TransformerException {
- StringWriter output = new StringWriter(4000);
+ StringWriter output = new StringWriter(4096);
Transformer transformer = templates.newTransformer();
transformer.transform(new StreamSource(new StringReader(xml)), new StreamResult(output));