aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components
diff options
context:
space:
mode:
Diffstat (limited to 'ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components')
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java4
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java3
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java1
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java22
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java8
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java13
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java1
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java19
-rw-r--r--ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java8
9 files changed, 46 insertions, 33 deletions
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
index b6a959bfc..aee2b3886 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ActionPolicy.java
@@ -262,7 +262,7 @@ public class ActionPolicy extends Policy {
LOGGER.info("Action Body is succesfully saved at " + file.getAbsolutePath());
}
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
}
@@ -487,7 +487,7 @@ public class ActionPolicy extends Policy {
try {
jpaUtils = JPAUtils.getJPAUtilsInstance(XACMLPapServlet.getEmf());
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
Map<Datatype, List<FunctionDefinition>> functionMap = jpaUtils.getFunctionDatatypeMap();
Map<String, String> dropDownMap = new HashMap<String, String>();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
index c2ab845ae..264602a1d 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ClosedLoopPolicy.java
@@ -80,7 +80,7 @@ public class ClosedLoopPolicy extends Policy {
}
this.policyAdapter.setJsonBody(body);
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
if(policyName.endsWith(".xml")){
@@ -92,7 +92,6 @@ public class ClosedLoopPolicy extends Policy {
} catch (Exception e) {
LOGGER.error("Exception Occured while writing Configuration Data"+e);
- e.printStackTrace();
}
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
index ff8045890..cab76b9e5 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/ConfigPolicy.java
@@ -100,7 +100,6 @@ public class ConfigPolicy extends Policy {
}
} catch (IOException e) {
LOGGER.error("Exception Occured while writing Configuration Data"+e);
- e.printStackTrace();
}
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
index 5eb3493f2..dcb2a93d4 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/CreateClosedLoopPerformanceMetrics.java
@@ -30,6 +30,15 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.io.FilenameUtils;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
+import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
+
+import com.att.research.xacml.std.IdentifierImpl;
+
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
@@ -44,15 +53,10 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-import org.apache.commons.io.FilenameUtils;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
-
-import com.att.research.xacml.std.IdentifierImpl;
-
public class CreateClosedLoopPerformanceMetrics extends Policy {
+ private static final Logger LOGGER = FlexLogger.getLogger(CreateClosedLoopPerformanceMetrics.class);
+
public CreateClosedLoopPerformanceMetrics() {
super();
}
@@ -68,7 +72,7 @@ public class CreateClosedLoopPerformanceMetrics extends Policy {
try {
body = jsonBody;
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
if(policyName.endsWith(".xml")){
policyName = policyName.substring(0, policyName.lastIndexOf(".xml"));
@@ -80,7 +84,7 @@ public class CreateClosedLoopPerformanceMetrics extends Policy {
out.close();
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
index 4c67d798a..e5a114ba8 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/DecisionPolicy.java
@@ -39,6 +39,8 @@ import javax.persistence.Query;
import org.openecomp.policy.common.logging.eelf.MessageCodes;
import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.controlloop.policy.builder.BuilderException;
import org.openecomp.policy.controlloop.policy.builder.Results;
import org.openecomp.policy.controlloop.policy.guard.Constraint;
@@ -77,7 +79,9 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableDefinitionType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableReferenceType;
public class DecisionPolicy extends Policy {
-
+
+ private static final Logger LOGGER = FlexLogger.getLogger(DecisionPolicy.class);
+
public static final String FUNCTION_NOT = "urn:oasis:names:tc:xacml:1.0:function:not";
private static final String AAFProvider = "AAF";
public static final String GUARD_YAML = "GUARD_YAML";
@@ -595,7 +599,7 @@ public class DecisionPolicy extends Policy {
try {
jpaUtils = JPAUtils.getJPAUtilsInstance(XACMLPapServlet.getEmf());
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
Map<Datatype, List<FunctionDefinition>> functionMap = jpaUtils.getFunctionDatatypeMap();
Map<String, String> dropDownMap = new HashMap<String, String>();
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
index 509da0b61..9e590732c 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/FirewallConfigPolicy.java
@@ -114,7 +114,7 @@ public class FirewallConfigPolicy extends Policy {
LOGGER.debug("Configuration is succesfully saved");
}
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
}
@@ -372,7 +372,10 @@ public class FirewallConfigPolicy extends Policy {
assignment2.setCategory(CATEGORY_RESOURCE);
assignment2.setIssuer("");
AttributeValueType AttributeValue = new AttributeValueType();
- AttributeValue.setDataType(URI_DATATYPE);
+ AttributeValue.setDataType(URI_DATATYPE);
+ if (policyName.endsWith(".xml")) {
+ policyName = policyName.substring(0, policyName.lastIndexOf(".xml"));
+ }
String content = CONFIG_URL + "/Config/" + policyName + ".json";
AttributeValue.getContent().add(content);
@@ -1588,10 +1591,10 @@ public class FirewallConfigPolicy extends Policy {
JsonNode updatedJason = null;
try {
- oldJason = JsonLoader.fromString(oldJson);
- updatedJason = JsonLoader.fromString(json);
+ oldJason = JsonLoader.fromString(oldJson);
+ updatedJason = JsonLoader.fromString(json);
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
JsonPatch jsonPatch = JsonDiff.asJsonPatch(oldJason, updatedJason);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
index c5fdc18cc..736069d00 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/MicroServiceConfigPolicy.java
@@ -98,7 +98,6 @@ public class MicroServiceConfigPolicy extends Policy {
out.close();
} catch (Exception e) {
LOGGER.error("Exception Occured While writing Configuration data"+e);
- e.printStackTrace();
}
}
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
index 0f8ccfba0..743883b01 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/Policy.java
@@ -35,15 +35,12 @@ import java.util.Map;
import javax.json.Json;
import javax.json.JsonReader;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
-
import org.apache.commons.io.FilenameUtils;
import org.json.JSONObject;
import org.openecomp.policy.common.logging.eelf.MessageCodes;
import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.rest.XACMLRestProperties;
import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
import org.openecomp.policy.xacml.util.XACMLPolicyWriter;
@@ -53,7 +50,15 @@ import com.att.research.xacml.util.XACMLProperties;
import com.att.research.xacmlatt.pdp.policy.PolicyDef;
import com.att.research.xacmlatt.pdp.policy.dom.DOMPolicyDef;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
+import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
+
public abstract class Policy {
+
+ private static final Logger LOGGER = FlexLogger.getLogger(Policy.class);
+
/**
* Common Fields
@@ -158,7 +163,7 @@ public abstract class Policy {
try {
uri = new URI(key);
} catch (URISyntaxException e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
attributeDesignator.setCategory(CATEGORY_ACCESS_SUBJECT);
attributeDesignator.setDataType(STRING_DATATYPE);
@@ -184,7 +189,7 @@ public abstract class Policy {
try {
dynamicURI = new URI(key);
} catch (URISyntaxException e) {
- e.printStackTrace();// log msg
+ LOGGER.error("Exception Occured"+e);// log msg
}
dynamicAttributeDesignator.setCategory(CATEGORY_RESOURCE);
dynamicAttributeDesignator.setDataType(dataType);
diff --git a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
index a63dacbfe..eaceb6575 100644
--- a/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ECOMP-PAP-REST/src/main/java/org/openecomp/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -200,7 +200,7 @@ public class PolicyDBDao {
}
} catch(Exception e){
System.out.println("Could not get lock entity");
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
if(lock == null){
throw new IllegalStateException("The lock row does not exist in the table. Please create a primary key with value = 1.");
@@ -1157,7 +1157,7 @@ public class PolicyDBDao {
try {
FileUtils.forceMkdir(groupPath.toFile());
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
Properties policyProperties = new Properties();
@@ -1628,7 +1628,7 @@ public class PolicyDBDao {
auditGroups(papEngine2);
} catch(Exception e){
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PolicyDBDao", "auditLocalDatabase() error");
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}
@@ -2150,7 +2150,7 @@ public class PolicyDBDao {
try{
em.close();
} catch(Exception e){
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
return;
}