aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-XACML/src/main/java
diff options
context:
space:
mode:
authorITSERVICES\rb7147 <rb7147@att.com>2017-04-25 11:46:00 -0400
committerITSERVICES\rb7147 <rb7147@att.com>2017-05-03 09:58:17 -0400
commite0addf5b588a1244f9679becd90999dfcb4c3a94 (patch)
tree1212772d6366730266ff0e093c874b07aa716c29 /ECOMP-XACML/src/main/java
parent39fb0f30472777e4b60d6a7ac8aa4eb9773961ff (diff)
Policy 1707 commit to LF
Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 <rb7147@att.com>
Diffstat (limited to 'ECOMP-XACML/src/main/java')
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java2
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java4
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java4
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java123
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java293
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java197
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java3
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java1
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java2
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java32
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java23
11 files changed, 330 insertions, 354 deletions
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java
index c18ad230f..79ee08e2e 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java
@@ -80,7 +80,7 @@ public interface EcompPAPPolicy {
public String getDeleteCondition();
public String getDictionaryType();
public String getDictionary();
- public Map<String, String> getDictionaryFields();
+ public String getDictionaryFields();
public String getRiskLevel();
public String getGuard();
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java
index f00dd7ac5..ecb21aa09 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java
@@ -19,14 +19,12 @@
*/
package org.openecomp.policy.xacml.api.pap;
-import java.util.Set;
-
import org.openecomp.policy.xacml.std.pap.StdPDP;
import com.att.research.xacml.api.pap.PDP;
import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
/*
* The following allows us to use Jackson to convert sub-types of this type into JSON and back to objects.
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java
index a64b4b6dc..4aa7cbf64 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java
@@ -3,9 +3,13 @@ package org.openecomp.policy.xacml.api.pap;
import java.util.Set;
import com.att.research.xacml.api.pap.PDPGroup;
+import com.att.research.xacml.api.pap.PDPPolicy;
public interface EcompPDPGroup extends PDPGroup {
public Set<EcompPDP> getEcompPdps();
+ public Set<PDPPolicy> getSelectedPolicies();
+
+ public String getOperation();
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
index 397f763f2..951f89110 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
@@ -40,14 +40,17 @@ import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import org.openecomp.policy.xacml.api.pap.EcompPDP;
import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
import org.openecomp.policy.xacml.api.pap.PAPPolicyEngine;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.api.pap.PDP;
import com.att.research.xacml.api.pap.PDPGroup;
+import com.att.research.xacml.api.pap.PDPPIPConfig;
import com.att.research.xacml.api.pap.PDPPolicy;
import com.att.research.xacml.api.pap.PDPStatus;
import com.att.research.xacml.util.XACMLProperties;
@@ -62,6 +65,8 @@ import com.google.common.collect.Sets;
*
*/
public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyEngine {
+ public static final String pipPropertyFile = "pip.properties";
+
private static Log logger = LogFactory.getLog(StdEngine.class);
public static String PROP_PAP_REPO = "xacml.pap.pdps";
@@ -149,8 +154,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
this.groups = this.readProperties(this.repository, properties);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to load " + file.toAbsolutePath().toString());
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to load properties file");
this.groups = new HashSet<StdPDPGroup>();
}
@@ -210,8 +213,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
try (OutputStream os = Files.newOutputStream(policyPath)) {
props.store(os, "");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to write default policy properties", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to write default policy properties");
}
}
@@ -223,8 +224,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
try (OutputStream os = Files.newOutputStream(pipPath)) {
props.store(os, "");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to write default pip properties", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to write default pip properties");
}
}
@@ -250,8 +249,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
properties.store(os, "");
}
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to save properties with new default group information.", e);
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to save properties with new default group information.");
}
//
@@ -260,19 +257,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
wasDefaultGroupJustAdded = true;
return newDefault;
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to create default group: " + defaultId, e);
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create default group");
throw new PAPException("Failed to create default group");
}
}
-
-
-
@Override
- public EcompPDPGroup getDefaultGroup() throws PAPException
- {
+ public EcompPDPGroup getDefaultGroup() throws PAPException{
for (EcompPDPGroup group : this.groups) {
if (group.isDefaultGroup()) {
return group;
@@ -284,50 +275,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
return null;
}
- /*@Override
- public void SetDefaultGroup(PDPGroup group) throws PAPException {
-
- boolean changesMade = false;
- for (PDPGroup aGroup : groups) {
- if (aGroup.getId().equals(group.getId())) {
- if ( ! aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
- if (aGroup instanceof StdPDPGroup) {
- ((StdPDPGroup) aGroup).setDefault(true);
- changesMade = true;
- } else {
- throw new IllegalArgumentException("Group in groups of unknown type '" + aGroup.getClass().getName() + "'");
- }
- }
- } else {
- // not the new default group
- if (aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
- if (aGroup instanceof StdPDPGroup) {
- ((StdPDPGroup) aGroup).setDefault(false);
- changesMade = true;
- } else {
- throw new IllegalArgumentException("Group in groups of unknown type '" + aGroup.getClass().getName() + "'");
- }
- }
- }
- }
- if (changesMade) {
- this.doSave();
- }
-
- return;
- }*/
-
- /*@Override
- public Set<PDPGroup> getPDPGroups() throws PAPException {
- final Set<PDPGroup> grps = new HashSet<PDPGroup>();
- for (PDPGroup g : this.groups) {
- grps.add(g);
- }
- return Collections.unmodifiableSet(grps);
- }*/
-
@Override
public EcompPDPGroup getGroup(String id) throws PAPException {
for (EcompPDPGroup g: this.groups) {
@@ -339,8 +286,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
}
@Override
- public void newGroup(String name, String description) throws PAPException, NullPointerException
- {
+ public void newGroup(String name, String description) throws PAPException, NullPointerException{
//
// Null check
//
@@ -379,8 +325,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
Files.createDirectory(groupPath);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create " + groupPath);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create " + groupPath);
throw new PAPException("Failed to create " + id);
}
@@ -402,8 +346,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
props.store(os, "");
}
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to create " + policyProperties);
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create " + policyProperties);
throw new PAPException("Failed to create " + id);
}
@@ -412,19 +354,17 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Create the PIP config
//
Path pipProperties = Paths.get(groupPath.toString(), "xacml.pip.properties");
+ Properties props = new Properties();
if (Files.exists(pipProperties)) {
logger.warn("addGroup " + id + " file exists: " + pipProperties.toString());
} else {
try {
- Properties props = new Properties();
props = setPIPProperties(props);
Files.createFile(pipProperties);
try (OutputStream os = Files.newOutputStream(pipProperties)) {
props.store(os, "");
}
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create " + pipProperties);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create " + pipProperties);
throw new PAPException("Failed to create " + id);
}
@@ -434,6 +374,18 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Ok now add it
//
StdPDPGroup newGroup = new StdPDPGroup(id, name, description, groupPath);
+ // Add the default PIP configuration.
+ String list = props.getProperty(XACMLProperties.PROP_PIP_ENGINES);
+ if (list != null && list.length() > 0) {
+ Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ for (String pipID : list.split("[,]")) {
+ StdPDPPIPConfig config = new StdPDPPIPConfig(pipID, props);
+ if (config.isConfigured()) {
+ pipConfigs.add(config);
+ }
+ }
+ newGroup.setPipConfigs(pipConfigs);
+ }
if (this.groups.add(newGroup)) {
// save the new group in our properties and notify any listeners of the change
groupChanged(newGroup);
@@ -511,12 +463,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
this.doSave();
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to add to new group, putting back into original group.");
PolicyLogger.error("Failed to add to new group, putting back into original group.");
if (((StdPDPGroup) currentGroup).removePDP(pdp) == false) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to put PDP back into original group.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Failed to put PDP back into original group.");
}
}
@@ -814,23 +762,30 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
this.saveConfiguration();
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to save configuration", e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
} catch (PAPException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to save configuration", e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
}
}
- // TODO: Adding Default PIP engine(s) while Loading initially. We don't want
- // Programmer intervention with the PIP engines.
private Properties setPIPProperties(Properties props){
props.setProperty(XACMLProperties.PROP_PIP_ENGINES, "AAF");
props.setProperty("AAF.name", "AAFEngine");
props.setProperty("AAF.description", "AAFEngine to communicate with AAF to take decisions");
props.setProperty("AAF.classname","org.openecomp.policy.xacml.std.pip.engines.aaf.AAFEngine");
+ // read from PIP properties file.
+ Path file = Paths.get(pipPropertyFile);
+ if (!Files.notExists(file)) {
+ InputStream in;
+ Properties prop = new Properties();
+ try {
+ in = new FileInputStream(file.toFile());
+ prop.load(in);
+ } catch (IOException e) {
+ PolicyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "can not load the pip properties from file" +e);
+ }
+ props = prop;
+ }
return props;
}
@@ -860,7 +815,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
for (EcompPDPGroup aGroup : groups) {
if (aGroup.getId().equals(group.getId())) {
if ( ! aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
if (aGroup instanceof StdPDPGroup) {
((StdPDPGroup) aGroup).setDefault(true);
changesMade = true;
@@ -871,7 +825,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
} else {
// not the new default group
if (aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
if (aGroup instanceof StdPDPGroup) {
((StdPDPGroup) aGroup).setDefault(false);
changesMade = true;
@@ -969,8 +922,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
throw new PAPException("Unable to rename directory; reason unknown");
}
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Move '" + oldPath + "' to '" + newPath + "': " + e.getMessage(), e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Unable to rename directory");
throw new PAPException("Unable to move directory from '" + oldPath + "' to '" + newPath + "': " + e.getMessage());
}
@@ -1002,8 +953,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Does this group exist?
//
if (this.groups.contains(group) == false) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "This group doesn't exist.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "This group doesn't exist.");
throw new PAPException("The group '" + group.getId() + "' does not exist");
}
@@ -1065,8 +1014,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
Files.delete(groupPath);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to delete " + groupPath + ": " +e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to delete " + groupPath);
throw new PAPException("Failed to delete " + id);
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
index f4817ac8a..0606daa79 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
@@ -21,6 +21,7 @@ package org.openecomp.policy.xacml.std.pap;
import java.io.Serializable;
import java.net.URI;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -28,7 +29,7 @@ import org.openecomp.policy.xacml.api.pap.EcompPAPPolicy;
public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private static final long serialVersionUID = 5260230629397322000L;
-
+
private String policyName = null;
private String oldPolicyFileName = null;
private String policyDescription = null;
@@ -46,6 +47,8 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private String configBodyData = null;
private String policyID = null;
private String ruleID = null;
+ private String brmsController;
+ private ArrayList<String> brmsDependency;
private String configType = null;
private Boolean editPolicy = false;
private Boolean draft = false;
@@ -65,28 +68,28 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private String actionDictMethod = null;
private String uuid = null;
private String msLocation = null;
- private String priority = null;
+ private String priority = null;
private Map<String,String> drlRuleAndUIParams=null;
private String deleteCondition = null;
private String dictionaryType = null;
private String dictionary = null;
- private Map<String,String> dictionaryFields = new HashMap<String, String>();
+ private String dictionaryFields = null;
private String providerComboBox = null;
private String riskType = null;
private String guard = null;
private String riskLevel;
private String ttlDate = null;
-
+
public StdPAPPolicy() {
-
+
}
-
+
//Constructor for sending location when pushing policies
public StdPAPPolicy(URI location) {
this.location = location;
}
-
+
//Constructor for Validating Config Policies
public StdPAPPolicy(String policyName, String body, String configType, String configPolicyType) {
this.policyName = policyName;
@@ -94,7 +97,7 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.configType = configType;
this.configPolicyType = configPolicyType;
}
-
+
//convenience constructor
public StdPAPPolicy(String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String configType,
String body, Boolean editPolicy, String domain, String riskLevel, String riskType, String guard, String ttlDate){
@@ -104,9 +107,9 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
//Constructor for Create/Update Action Policies from API
public StdPAPPolicy(String policyName, String description, Map<String, String> attributes, List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo,
- List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmField2, String actionPerformer,String actionAttribute, Boolean editPolicy,
- String domain, int highestVersion) {
-
+ List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmField2, String actionPerformer,String actionAttribute, Boolean editPolicy,
+ String domain, int highestVersion) {
+
this.policyName = policyName;
this.policyDescription = description;
this.dyanamicFieldConfigAttributes = attributes;
@@ -119,15 +122,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.editPolicy = editPolicy;
this.domain = domain;
this.highestVersion = highestVersion;
-
+
}
-
+
//Constructor for Create/Update Decision Policies from Admin Console
public StdPAPPolicy(String policyName, String description, String ecompName, String providerComboBox, Map<String, String> attributes, Map<String, String> settings,
List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo, List<String> dynamicRuleAlgorithmField1,
List<String> dynamicRuleAlgorithmField2, Map<String, String> dropDownMap, List<Object> dynamicVariableList,
List<String> dataTypeList, Boolean editPolicy, String domain, int highestVersion) {
-
+
this.policyName = policyName;
this.policyDescription = description;
this.ecompName = ecompName;
@@ -144,15 +147,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.editPolicy = editPolicy;
this.domain = domain;
this.highestVersion = highestVersion;
-
+
}
-
-
+
+
//Constructor for Create Config Policies from API and Admin Console
//Constructor for Updating Config Policies from the API
public StdPAPPolicy(String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String configType,
- String body, Boolean editPolicy, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String body, Boolean editPolicy, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -169,18 +172,18 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//convenience constructor
public StdPAPPolicy (String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String body, String policyID,
String ruleID, String configType, Boolean editPolicy, String version, String domain, String riskLevel, String riskType, String guard, String ttlDate) {
this (configPolicyType, policyName, description, ecompName, configName, attributes, body, policyID,
ruleID, configType, editPolicy, version, domain, 1, riskLevel, riskType, guard, ttlDate);
- }
+ }
//Constructor for Updating Config Policies from Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String body, String policyID,
- String ruleID, String configType, Boolean editPolicy, String version, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String ruleID, String configType, Boolean editPolicy, String version, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -200,12 +203,12 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Creating Config Firewall Policies
public StdPAPPolicy (String configPolicyType, String policyName, String description, String configName,
Boolean editPolicy, String domain, String jsonBody, Integer highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -220,11 +223,11 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.ttlDate = ttlDate;
}
-
+
//Constructor for Creating Goc Policies
public StdPAPPolicy (String configPolicyType, String policyName, String description, String configName,
- Boolean editPolicy, String domain, String jsonBody, Integer highestVersion, String eCompName, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ Boolean editPolicy, String domain, String jsonBody, Integer highestVersion, String eCompName, String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -239,13 +242,13 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Creating BRMS Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
String configName, Boolean editPolicy, String domain,
Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String configBodyData, String riskLevel, String riskType, String guard, String ttlDate, String brmsController, ArrayList<String> brmsDependency) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -260,14 +263,16 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.riskType = riskType;
this.guard = guard;
this.ttlDate = ttlDate;
+ this.brmsController = brmsController;
+ this.brmsDependency = brmsDependency;
}
//Constructor for Creating BRMS Param Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
String configName, Boolean editPolicy, String domain,
Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData,Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String configBodyData,Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate, String brmsController, ArrayList<String> brmsDependency) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -283,13 +288,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.riskType = riskType;
this.guard = guard;
this.ttlDate = ttlDate;
+ this.brmsController = brmsController;
+ this.brmsDependency = brmsDependency;
}
-
+
//Constructor for Creating CloseLoop_Fault and Performance Metric Policies
public StdPAPPolicy (String configPolicyType, String policyName, String description, String ecompName,
String jsonBody, Boolean draft, String oldPolicyFileName, String serviceType, Boolean editPolicy,
String domain, Integer highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -306,11 +313,11 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Config Firewall Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description, String configName, Boolean editPolicy, String domain, String policyID,
String ruleID, String version, String jsonBody, Integer highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -327,11 +334,11 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
- //Constructor for Micro Service Creating/Updating Policies from the Admin Console
+
+ //Constructor for Micro Service Creating/Updating Policies from the Admin Console
public StdPAPPolicy(String configPolicyType, String policyName, String description, String ecompName, String configName, String serviceType, String uuid,
- String msLocation, String jsonBody, String priority, String version, Boolean editPolicy, String domain, int highestVersion, String riskLevel,
- String riskType, String guard, String ttlDate) {
+ String msLocation, String jsonBody, String priority, String version, Boolean editPolicy, String domain, int highestVersion, String riskLevel,
+ String riskType, String guard, String ttlDate) {
this.configPolicyType = configPolicyType;
this.policyName = policyName;
@@ -341,8 +348,8 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.serviceType = serviceType;
this.uuid = uuid;
this.msLocation = msLocation;
- this.priority = priority;
- this.version = version;
+ this.priority = priority;
+ this.version = version;
this.jsonBody = jsonBody;
this.editPolicy = editPolicy;
this.domain = domain;
@@ -352,13 +359,13 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Goc Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- String policyID, String ruleID, String version,
- String jsonBody, Integer highestVersion, String eCompName,String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String configName, Boolean editPolicy, String domain,
+ String policyID, String ruleID, String version,
+ String jsonBody, Integer highestVersion, String eCompName,String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -376,14 +383,14 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Brms Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- String policyID, String ruleID, String version,
- Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData , String riskLevel, String riskType, String guard, String ttlDate
- ) {
+ String configName, Boolean editPolicy, String domain,
+ String policyID, String ruleID, String version,
+ Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
+ String configBodyData , String riskLevel, String riskType, String guard, String ttlDate
+ ) {
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -402,14 +409,14 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Brms Param Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- String policyID, String ruleID, String version,
- Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate
- ) {
+ String configName, Boolean editPolicy, String domain,
+ String policyID, String ruleID, String version,
+ Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
+ Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate
+ ) {
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -434,9 +441,9 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.policyName = policyName;
this.deleteCondition = deleteCondition;
}
-
- // Constructor for creating dictionary items from the API
- public StdPAPPolicy(String dictionaryType, String dictionary, Map<String,String> dictionaryFields) {
+
+ // Constructor for creating dictionary items from the API>
+ public StdPAPPolicy(String dictionaryType, String dictionary, String dictionaryFields) {
this.dictionaryType = dictionaryType;
this.dictionary = dictionary;
this.dictionaryFields = dictionaryFields;
@@ -446,87 +453,87 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public String getPolicyName() {
return policyName;
}
-
+
@Override
public String getPolicyDescription() {
return policyDescription;
}
-
+
@Override
public String getEcompName() {
return ecompName;
}
-
+
@Override
public String getConfigName() {
return configName;
}
-
+
@Override
public Map<String, String> getDynamicFieldConfigAttributes() {
return dyanamicFieldConfigAttributes;
}
-
+
@Override
public String getConfigBodyData() {
return configBodyData;
}
-
+
@Override
public String getPolicyID() {
return policyID;
}
-
+
@Override
public String getRuleID() {
return ruleID;
}
-
+
@Override
public String getConfigType() {
return configType;
}
-
+
@Override
public Boolean isEditPolicy() {
return editPolicy;
}
-
+
@Override
public Boolean isDraft() {
return draft;
}
-
+
@Override
public String getVersion() {
return version;
}
-
+
@Override
public String getDomainDir() {
return domain;
}
-
+
@Override
public String getConfigPolicyType() {
return configPolicyType;
}
-
+
@Override
public String getJsonBody() {
return jsonBody;
}
-
+
@Override
public Integer getHighestVersion() {
return highestVersion;
}
-
+
@Override
public URI getLocation() {
return location;
}
-
+
@Override
public List<String> getDynamicRuleAlgorithmLabels() {
return dynamicRuleAlgorithmLabels;
@@ -556,99 +563,99 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public String getActionAttribute() {
return actionAttribute;
}
-
+
@Override
public String getActionBody() {
return actionBody;
}
-
+
@Override
public Map<String, String> getDropDownMap() {
return dropDownMap;
}
-
+
@Override
public String getActionDictHeader() {
return actionDictHeader;
}
-
+
@Override
public String getActionDictType() {
return actionDictType;
}
-
+
@Override
public String getActionDictUrl() {
return actionDictUrl;
}
-
+
@Override
public String getActionDictMethod() {
return actionDictMethod;
}
-
+
@Override
public Map<String, String> getDynamicSettingsMap() {
return dynamicSettingsMap;
}
-
+
@Override
public List<Object> getDynamicVariableList() {
return dynamicVariableList;
}
-
+
@Override
public List<String> getDataTypeList() {
return dataTypeList;
}
-
+
@Override
public String getOldPolicyFileName() {
return oldPolicyFileName;
}
-
+
@Override
public String getServiceType() {
return serviceType;
}
-
+
@Override
public String getUuid() {
return uuid;
}
-
+
@Override
public String getMsLocation() {
return msLocation;
}
-
- @Override
- public String getPriority() {
- return priority;
- }
-
- @Override
+
+ @Override
+ public String getPriority() {
+ return priority;
+ }
+
+ @Override
public String getDeleteCondition() {
return deleteCondition;
}
-
- @Override
+
+ @Override
public String getDictionaryType() {
return dictionaryType;
}
-
- @Override
+
+ @Override
public String getDictionary() {
return dictionary;
}
-
+
@Override
public String getTTLDate(){
return ttlDate;
}
- @Override
- public Map<String, String> getDictionaryFields() {
+ @Override
+ public String getDictionaryFields() {
return dictionaryFields;
}
@@ -656,17 +663,17 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public String getRiskType() {
return riskType;
}
-
+
@Override
public String getRiskLevel() {
return riskLevel;
}
-
+
@Override
public String getGuard() {
return guard;
}
-
+
@Override
public String toString() {
return "StdPAPPolicy [policyName=" + policyName + ", policyDescription=" + policyDescription + ", ecompName="
@@ -679,45 +686,45 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
+ ",actionDictHeader=" + actionDictHeader + ",actionDictType=" + actionDictType + ",actionDictUrl=" + actionDictUrl
+ ",actionDictMethod=" + actionDictMethod + ",dynamicSettingsMap=" + dynamicSettingsMap + ",dynamicVariableList=" + dynamicVariableList + ",providerComboBox=" + providerComboBox
+ ",dataTypeList=" + dataTypeList + ",draft=" + ",oldPolicyFileName=" + oldPolicyFileName + ",serviceType=" + serviceType
- + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" + deleteCondition + ",dictionaryType=" + dictionaryType
- + ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority="
- + priority + ",deleteCondition=" + deleteCondition + ",riskType="+riskType + ",riskLevel="+riskLevel + ",guard="+ guard + ",ttlDate="+ ttlDate + "]";
+ + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" + deleteCondition + ",dictionaryType=" + dictionaryType
+ + ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority="
+ + priority + ",deleteCondition=" + deleteCondition + ",riskType="+riskType + ",riskLevel="+riskLevel + ",guard="+ guard + ",ttlDate="+ ttlDate + "]";
}
-
+
// Methods needed for JSON Deserialization
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
-
+
public void setPolicyDescription(String policyDescription) {
this.policyDescription = policyDescription;
}
-
+
public void setEcompName(String ecompName) {
this.ecompName = ecompName;
}
-
+
public void setConfigName(String configName) {
this.configName = configName;
}
-
+
public void setDyanamicFieldConfigAttributes(
Map<String, String> dyanamicFieldConfigAttributes) {
this.dyanamicFieldConfigAttributes = dyanamicFieldConfigAttributes;
}
-
+
public void setConfigBodyData(String configBodyData) {
this.configBodyData = configBodyData;
}
-
+
public void setPolicyID(String policyID) {
this.policyID = policyID;
}
-
+
public void setRuleID(String ruleID) {
this.ruleID = ruleID;
}
-
+
public void setConfigType(String configType) {
this.configType = configType;
}
@@ -741,15 +748,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setJsonBody(String jsonBody) {
this.jsonBody = jsonBody;
}
-
+
public void setHighestVersion(Integer highestVersion) {
this.highestVersion = highestVersion;
}
-
+
public void setLocation (URI location) {
this.location = location;
}
-
+
public void setDynamicRuleAlgorithmLabels(
List<String> dynamicRuleAlgorithmLabels) {
this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
@@ -824,7 +831,6 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
-
public Map<String, String> getDrlRuleAndUIParams() {
return drlRuleAndUIParams;
@@ -841,10 +847,10 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setMsLocation(String msLocation) {
this.msLocation = msLocation;
}
-
- public void setPriority(String priority) {
- this.priority = priority;
- }
+
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
public void setDeleteCondition(String deleteCondition) {
this.deleteCondition = deleteCondition;
@@ -858,7 +864,7 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.dictionary = dictionary;
}
- public void setDictionaryFields(Map<String, String> dictionaryFields) {
+ public void setDictionaryFields(String dictionaryFields) {
this.dictionaryFields = dictionaryFields;
}
@@ -869,21 +875,36 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setProviderComboBox(String providerComboBox) {
this.providerComboBox = providerComboBox;
}
-
+
public void setRiskType(String riskType){
this.riskType = riskType;
}
-
+
public void setRiskLevel(String riskLevel){
this.riskLevel = riskLevel;
}
-
+
public void setGuard(String guard){
this.guard = guard;
}
-
+
public void setTTLDate(String ttlDate){
this.ttlDate = ttlDate;
}
-}
+ public String getBrmsController() {
+ return brmsController;
+ }
+
+ public void setBrmsController(String brmsController) {
+ this.brmsController = brmsController;
+ }
+
+ public ArrayList<String> getBrmsDependency() {
+ return brmsDependency;
+ }
+
+ public void setBrmsDependency(ArrayList<String> brmsDependency) {
+ this.brmsDependency = brmsDependency;
+ }
+} \ No newline at end of file
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
index ae4a43db6..46bb73b16 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
@@ -19,9 +19,7 @@
*/
package org.openecomp.policy.xacml.std.pap;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -40,13 +38,15 @@ import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import org.openecomp.policy.xacml.api.pap.EcompPDP;
import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
import org.openecomp.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.api.pap.PDP;
-import com.att.research.xacml.api.pap.PDPGroup;
//import com.att.research.xacml.api.pap.PDPGroup;
import com.att.research.xacml.api.pap.PDPGroupStatus;
import com.att.research.xacml.api.pap.PDPGroupStatus.Status;
@@ -76,8 +76,12 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
private Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> selectedPolicies = new HashSet<PDPPolicy>();
+
private Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ private String operation;
+
@JsonIgnore
private Path directory;
@@ -155,8 +159,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
Files.createDirectory(directory);
this.status.addLoadWarning("Group directory does NOT exist");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Group directory does NOT exist");
this.status.addLoadError("Group directory does NOT exist");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -216,8 +218,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
Properties pipProperties = new Properties();
if ( ! file.toFile().exists()) {
// need to create the properties file with no values
- // TODO: Adding Default PIP engine(s) while Loading initially. We don't want
- // Programmer intervention with the PIP engines.
pipProperties = setPIPProperties(pipProperties);
// save properties to file
try {
@@ -227,6 +227,12 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
} catch (Exception e) {
throw new PAPException("Failed to create new default pip properties file '" + file +"'");
}
+ //Even if we create a new pip file, we still need to parse and load the properties
+ try{
+ this.readPIPProperties(directory, pipProperties);
+ }catch(Exception e){
+ throw new PAPException("Failed to load the new pip properties file");
+ }
} else {
try {
//
@@ -375,12 +381,21 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
}
@Override
- public PDPGroupStatus getStatus()
- {
+ public PDPGroupStatus getStatus(){
return this.status;
}
@Override
+ public Set<PDPPolicy> getSelectedPolicies() {
+ return this.selectedPolicies;
+ }
+
+ @Override
+ public String getOperation() {
+ return this.operation;
+ }
+
+ @Override
public Set<PDP> getPdps() {
return Collections.unmodifiableSet(pdps);
}
@@ -474,8 +489,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
Files.delete(tempFile);
} catch(Exception ee) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy was invalid, could NOT delete it.", ee);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, ee, "StdPDPGroup", "Policy was invalid, could NOT delete it.");
}
throw new PAPException("Policy is invalid");
@@ -493,8 +506,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
//
return tempRootPolicy;
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to publishPolicy: ", e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdPDPGroup", "Failed to publishPolicy");
}
return null;
@@ -521,43 +532,69 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
long num;
Path policyFilePath = Paths.get(this.directory.toAbsolutePath().toString(), id);
+ Path policyFile;
+ if (Files.exists(policyFilePath)) {
+ policyFile = policyFilePath;
+ } else {
+ policyFile = Files.createFile(policyFilePath);
+ }
+
+ try (OutputStream os = Files.newOutputStream(policyFile)) {
+ num = ByteStreams.copy(policy, os);
+ }
+
+ logger.info("Copied " + num + " bytes for policy " + name);
+
+ for (PDPPolicy p : policies) {
+ if (p.getId().equals(id)) {
+ // we just re-copied/refreshed/updated the policy file for a policy that already exists in this group
+ logger.info("Policy '" + id + "' already exists in group '" + getId() + "'");
+ return;
+ }
+ }
+
+ // policy is new to this group
+ StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, true, name, policyFile.toUri());
+ if (tempRootPolicy.isValid() == false) {
+ try {
+ Files.delete(policyFile);
+ } catch(Exception ee) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, ee, "StdPDPGroup", "Policy was invalid, could NOT delete it.");
+ }
+ throw new PAPException("Policy is invalid");
+ }
+ //
+ // Add it in
//
- // THERE IS A WEIRD PROBLEM ON WINDOWS...
- // The file is already "in use" when we try to access it.
- // Looking at the file externally while this is halted here does not show the file in use,
- // so there is no indication what is causing the problem.
+ this.policies.add(tempRootPolicy);
//
- // As a way to by-pass the issue, I simply check if the input and the existing file are identical
- // and generate an exception if they are not.
+ // We are changed
//
-
+ this.firePDPGroupChanged(this);
+ } catch (IOException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to copyPolicyToFile");
+ throw new PAPException("Failed to copy policy to file: " + e);
+ }
+ return;
+ }
+
+ /**
+ * Policy Engine API Copy one policy file into the Group's directory but do not change the configuration.
+ *
+ * @param id
+ * @param name
+ * @param policy
+ * @return
+ * @throws PAPException
+ */
+ public void copyPolicyToFile(String id, String name, InputStream policy) throws PAPException {
+ try {
+ //
+ // Copy the policy over
+ //
+ long num;
+ Path policyFilePath = Paths.get(this.directory.toAbsolutePath().toString(), id);
-
-// if (Files.exists(policyFilePath)) {
-// // compare the
-// String incomingPolicyString = null;
-// try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-// num = ByteStreams.copy(policy, os);
-// incomingPolicyString = new String(os.toByteArray(), "UTF-8");
-// }
-// String existingPolicyString = null;
-// try {
-// byte[] bytes = Files.readAllBytes(policyFilePath);
-// existingPolicyString = new String(bytes, "UTF-8");
-// } catch (Exception e) {
-// //TODO:EELF Cleanup - Remove logger
-// logger.error("Unable to read existing file '" + policyFilePath + "': " + e, e);
-// PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdPDPGroup", "Unable to read existing policy file");
-// throw new PAPException("Unable to read policy file for comparison: " + e);
-// }
-// if (incomingPolicyString.equals(existingPolicyString)) {
-// throw new PAPException("Policy '" + policyFilePath + "' does not match existing policy on server");
-// }
-// // input is same as existing file
-// return;
-// }
-
-
Path policyFile;
if (Files.exists(policyFilePath)) {
policyFile = policyFilePath;
@@ -568,9 +605,8 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try (OutputStream os = Files.newOutputStream(policyFile)) {
num = ByteStreams.copy(policy, os);
}
-
- logger.info("Copied " + num + " bytes for policy " + name);
+ logger.info("Copied " + num + " bytes for policy " + name);
for (PDPPolicy p : policies) {
if (p.getId().equals(id)) {
// we just re-copied/refreshed/updated the policy file for a policy that already exists in this group
@@ -585,8 +621,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
Files.delete(policyFile);
} catch(Exception ee) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy was invalid, could NOT delete it.", ee);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, ee, "StdPDPGroup", "Policy was invalid, could NOT delete it.");
}
throw new PAPException("Policy is invalid");
@@ -599,24 +633,17 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
// We are changed
//
this.firePDPGroupChanged(this);
-
-
-
-
+
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to copyPolicyToFile: ", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to copyPolicyToFile");
throw new PAPException("Failed to copy policy to file: " + e);
}
return;
}
-
+
public boolean removePolicyFromGroup(PDPPolicy policy) {
StdPDPPolicy currentPolicy = (StdPDPPolicy) this.getPolicy(policy.getId());
if (currentPolicy == null) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
return false;
}
@@ -631,8 +658,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
this.firePDPGroupChanged(this);
return true;
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to delete policy " + policy);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to delete policy");
}
return false;
@@ -641,8 +666,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
public boolean removePolicy(PDPPolicy policy) {
StdPDPPolicy currentPolicy = (StdPDPPolicy) this.getPolicy(policy.getId());
if (currentPolicy == null) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
return false;
}
@@ -661,8 +684,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
this.firePDPGroupChanged(this);
return true;
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to delete policy " + policy);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to delete policy " + policy);
}
return false;
@@ -724,8 +745,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
fire = true;
this.status.addLoadWarning("Created missing group directory");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create missing Group directory.");
this.status.addLoadError("Failed to create missing Group directory.");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -741,8 +760,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
fire = true;
this.status.addLoadWarning("Created missing PIP properties file");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create missing PIP properties file");
this.status.addLoadError("Failed to create missing PIP properties file");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -758,8 +775,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
fire = true;
this.status.addLoadWarning("Created missing Policy properties file");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create missing Policy properties file");
this.status.addLoadError("Failed to create missing Policy properties file");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -813,8 +828,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
policy = new StdPDPPolicy(id, isRoot, policyPath.toUri(), properties);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create policy object", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create policy object");
policy = null;
}
@@ -829,7 +842,7 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
this.status.setStatus(Status.LOAD_ERRORS);
}
// force all policies to have a name
- if (policy.getName() == null) {
+ if (policy!=null && policy.getName() == null) {
policy.setName(policy.getId());
}
}
@@ -884,7 +897,8 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
return "StdPDPGroup [id=" + id + ", isDefault=" + isDefault + ", name="
+ name + ", description=" + description + ", status=" + status
+ ", pdps=" + pdps + ", policies=" + policies + ", pipConfigs="
- + pipConfigs + ", directory=" + directory + "]";
+ + pipConfigs + ", directory=" + directory + ",selectedPolicies="
+ + selectedPolicies + ",operation=" + operation + "]";
}
@Override
@@ -894,8 +908,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
saveGroupConfiguration();
} catch (PAPException | IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unable to save group configuration change");
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdPDPGroup", "Unable to save group configuration change");
// don't notify other things of change if we cannot save it???
return;
@@ -915,8 +927,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
//
// If one of the group's PDP's changed, then the group changed
//
- // TODO Really?
- //
this.changed();
}
@@ -950,8 +960,12 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
public void setPolicies(Set<PDPPolicy> policies) {
this.policies = policies;
}
-
-
+ public void setSelectedPolicies(Set<PDPPolicy> selectedPolicies) {
+ this.selectedPolicies = selectedPolicies;
+ }
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
public void saveGroupConfiguration() throws PAPException, IOException {
@@ -972,8 +986,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try (OutputStream os = Files.newOutputStream(file)) {
policyProperties.store(os, "");
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Group Policies Config save failed: " + e, e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "STdPDPGroup", "Group Policies Config save failed");
throw new PAPException("Failed to save policy properties file '" + file +"'");
}
@@ -989,8 +1001,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try (OutputStream os = Files.newOutputStream(file)) {
pipProperties.store(os, "");
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Group PIP Config save failed: " + e, e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Group PIP Config save failed");
throw new PAPException("Failed to save pip properties file '" + file +"'");
}
@@ -1017,13 +1027,26 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
return name.compareTo(((StdPDPGroup)arg0).name);
}
- // TODO: Adding Default PIP engine(s) while Loading initially. We don't want
+ //Adding Default PIP engine(s) while Loading initially. We don't want
// Programmer intervention with the PIP engines.
private Properties setPIPProperties(Properties props){
props.setProperty("AAF.name", "AAFEngine");
props.setProperty("AAF.description", "AAFEngine to communicate with AAF to take decisions");
props.setProperty("AAF.classname","org.openecomp.policy.xacml.std.pip.engines.aaf.AAFEngine");
props.setProperty(XACMLProperties.PROP_PIP_ENGINES, "AAF");
+ // read from PIP properties file.
+ Path file = Paths.get(StdEngine.pipPropertyFile);
+ if (!Files.notExists(file)) {
+ InputStream in;
+ Properties prop = new Properties();
+ try {
+ in = new FileInputStream(file.toFile());
+ prop.load(in);
+ } catch (IOException e) {
+ PolicyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "can not load the pip properties from file" +e);
+ }
+ props = prop;
+ }
return props;
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
index 38f8a5800..a197d5f3d 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
@@ -25,9 +25,6 @@ import java.util.LinkedList;
import org.openecomp.policy.xacml.api.pap.EcompPDP;
import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
-import com.att.research.xacml.api.pap.PDP;
-import com.att.research.xacml.api.pap.PDPGroup;
-
public class StdPDPItemSetChangeNotifier {
private Collection<StdItemSetChangeListener> listeners = null;
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
index 814dbe3af..909f64620 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
@@ -137,7 +137,6 @@ public class StdPDPPIPConfig implements PDPPIPConfig, Serializable {
@JsonIgnore
public boolean isConfigured() {
//
- // TODO
// Also include this in the JSON I/O if it is a data field rather than calculated
//
return true;
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java
index 06c2498f6..0300a3d06 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java
@@ -168,8 +168,6 @@ public class StdPDPPolicy implements PDPPolicy, Serializable {
this.version = versionStringToArray(((PolicyType)rootElement).getVersion());
this.isValid = true;
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Unknown root element: " + rootElement.getClass().getCanonicalName());
PolicyLogger.error("Unknown root element: " + rootElement.getClass().getCanonicalName());
}
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
index 6dea4c21f..581009d18 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
@@ -19,6 +19,7 @@
*/
package org.openecomp.policy.xacml.std.pip.engines.aaf;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -47,6 +48,7 @@ import com.att.research.xacml.std.pip.StdMutablePIPResponse;
import com.att.research.xacml.std.pip.StdPIPRequest;
import com.att.research.xacml.std.pip.StdPIPResponse;
import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
+import com.att.research.xacml.util.XACMLProperties;
/**
* PIP Engine for Implementing {@link com.att.research.xacml.std.pip.engines.ConfigurableEngine} interface to provide
@@ -73,7 +75,6 @@ public class AAFEngine extends StdConfigurableEngine {
private static final PIPRequest PIP_REQUEST_TYPE = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_TYPE"), XACML3.ID_DATATYPE_STRING);
private static final PIPRequest PIP_REQUEST_INSTANCE = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_INSTANCE"), XACML3.ID_DATATYPE_STRING);
private static final PIPRequest PIP_REQUEST_ACTION = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_ACTION"), XACML3.ID_DATATYPE_STRING);
- private static final PIPRequest PIP_REQUEST_ENV = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_ENVIRONMENT"), XACML3.ID_DATATYPE_STRING);
private static final List<PIPRequest> mapRequiredAttributes = new ArrayList<PIPRequest>();
static{
@@ -82,7 +83,6 @@ public class AAFEngine extends StdConfigurableEngine {
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_TYPE));
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_INSTANCE));
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_ACTION));
- mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_ENV));
}
private static final Map<PIPRequest, String> mapSupportedAttributes = new HashMap<PIPRequest, String>();
@@ -135,27 +135,21 @@ public class AAFEngine extends StdConfigurableEngine {
PIPResponse pipResponseType = this.getAttribute(PIP_REQUEST_TYPE, pipFinder);
PIPResponse pipResponseAction = this.getAttribute(PIP_REQUEST_ACTION, pipFinder);
PIPResponse pipResponseInstance = this.getAttribute(PIP_REQUEST_INSTANCE, pipFinder);
- PIPResponse pipResponseEnv = this.getAttribute(PIP_REQUEST_ENV, pipFinder);
String response = null;
// Evaluate AAF if we have all the required values.
- if(pipResponseUID!=null && pipResponsePass!=null && pipResponseType != null && pipResponseAction!= null && pipResponseInstance!=null && pipResponseEnv!=null){
- // Check the Environment.
- String environment = getValue(pipResponseEnv);
- if(environment == null){
- response = "Environment Value is not set. ";
- }
+ if(pipResponseUID!=null && pipResponsePass!=null && pipResponseType != null && pipResponseAction!= null && pipResponseInstance!=null){
String userName = getValue(pipResponseUID);
String pass = getValue(pipResponsePass);
AAFPolicyClient aafClient = null;
- Properties properties = new Properties();
- if(environment.equalsIgnoreCase("PROD")){
- properties.setProperty("ENVIRONMENT", "PROD");
- }else if(environment.equalsIgnoreCase("TEST")){
- properties.setProperty("ENVIRONMENT", "TEST");
- }else{
- properties.setProperty("ENVIRONMENT", "DEVL");
- }
- logger.debug("environment : " + environment);
+ Properties properties;
+ try {
+ properties = XACMLProperties.getProperties();
+ logger.debug("environment : " + properties.getProperty("ENVIRONMENT"));
+ } catch (IOException e1) {
+ logger.error("Exception while getting the properties " + e1);
+ properties = new Properties();
+ properties.setProperty("AAF_LOG_LEVEL", "DEBUG");
+ }
if(userName!=null && pass!=null){
try {
aafClient = AAFPolicyClient.getInstance(properties);
@@ -273,4 +267,4 @@ public class AAFEngine extends StdConfigurableEngine {
return attributes;
}
-}
+} \ No newline at end of file
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java
index 7fa2aa414..7b91426b5 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java
@@ -90,8 +90,15 @@ public class XACMLPolicyScanner {
try (InputStream is = Files.newInputStream(filename)) {
this.policyObject = XACMLPolicyScanner.readPolicy(is);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to read policy", e);
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Failed to read policy");
+ }
+ this.callback = callback;
+ }
+
+ public XACMLPolicyScanner(InputStream filename, Callback callback) {
+ try (InputStream is = filename) {
+ this.policyObject = XACMLPolicyScanner.readPolicy(is);
+ } catch (IOException e) {
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Failed to read policy");
}
this.callback = callback;
@@ -155,8 +162,6 @@ public class XACMLPolicyScanner {
} else if (this.policyObject instanceof PolicySetType) {
this.scanPolicySet(null, (PolicySetType) this.policyObject);
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unknown class type: " + this.policyObject.getClass().getCanonicalName());
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + "Unknown class type: " + this.policyObject.getClass().getCanonicalName());
}
if (this.callback != null) {
@@ -518,8 +523,6 @@ public class XACMLPolicyScanner {
try (InputStream is = Files.newInputStream(policy)) {
data = XACMLPolicyScanner.readPolicy(is);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to read policy", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Failed to read policy");
throw e;
}
@@ -545,8 +548,6 @@ public class XACMLPolicyScanner {
version = ((PolicyType)data).getVersion();
} else {
if (data != null) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
}
return null;
@@ -557,8 +558,6 @@ public class XACMLPolicyScanner {
logger.warn("No version set in policy");
}
} catch (NumberFormatException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid version contained in policy: " + version);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Invalid version contained in policy: " + version);
return null;
}
@@ -577,8 +576,6 @@ public class XACMLPolicyScanner {
} else if (data instanceof PolicyType) {
return ((PolicyType)data).getPolicyId();
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
return null;
}
@@ -711,8 +708,6 @@ public class XACMLPolicyScanner {
}
}
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + e.getMessage());
PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPolicyScanner", "Exception in readPolicy");
}
return null;