You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openaz.apache.org by co...@apache.org on 2015/05/05 14:23:41 UTC
[43/54] [abbrv] [partial] incubator-openaz git commit: Do an eclipse
based "cleanup" on the project
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetCombinerParameter.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetCombinerParameter.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetCombinerParameter.java
index 0c7a4eb..c3abc6d 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetCombinerParameter.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetCombinerParameter.java
@@ -47,43 +47,49 @@ import com.att.research.xacmlatt.pdp.policy.PolicySetChild;
import com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter;
/**
- * DOMPolicySetCombinerParameter extends {@link com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter} for
- * {@link com.att.research.xacmlatt.pdp.policy.PolicySet}s with methods for creation from DOM {@link org.w3c.dom.Node}s.
- *
+ * DOMPolicySetCombinerParameter extends
+ * {@link com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter} for
+ * {@link com.att.research.xacmlatt.pdp.policy.PolicySet}s with methods for creation from DOM
+ * {@link org.w3c.dom.Node}s.
*/
public class DOMPolicySetCombinerParameter extends TargetedCombinerParameter<Identifier, PolicySetChild> {
- public static final Log logger = LogFactory.getLog(DOMPolicySetCombinerParameter.class);
+ public static final Log logger = LogFactory.getLog(DOMPolicySetCombinerParameter.class);
protected DOMPolicySetCombinerParameter() {
}
/**
- * Creates a new <code>TargetedCombinerParameter</code> for <code>PolicySet</code>s by parsing the given <code>Node</code>
- * representing a XACML PolicySetCombinerParameter element.
+ * Creates a new <code>TargetedCombinerParameter</code> for <code>PolicySet</code>s by parsing the given
+ * <code>Node</code> representing a XACML PolicySetCombinerParameter element.
*
- * @param nodeCombinerParameter the <code>Node</code> representing the XACML PolicySetCombinerParameter element
- * @return a new <code>TargetedCombinerParameter</code> for <code>PolicySet</code>s parsed from the given <code>Node</code>
+ * @param nodeCombinerParameter the <code>Node</code> representing the XACML PolicySetCombinerParameter
+ * element
+ * @return a new <code>TargetedCombinerParameter</code> for <code>PolicySet</code>s parsed from the given
+ * <code>Node</code>
* @throws DOMStructureException if there is an error parsing the <code>Node</code>
*/
- public static TargetedCombinerParameter<Identifier,PolicySetChild> newInstance(Node nodeCombinerParameter) throws DOMStructureException {
- Element elementPolicySetCombinerParameter = DOMUtil.getElement(nodeCombinerParameter);
- boolean bLenient = DOMProperties.isLenient();
+ public static TargetedCombinerParameter<Identifier, PolicySetChild> newInstance(Node nodeCombinerParameter)
+ throws DOMStructureException {
+ Element elementPolicySetCombinerParameter = DOMUtil.getElement(nodeCombinerParameter);
+ boolean bLenient = DOMProperties.isLenient();
- DOMPolicySetCombinerParameter domPolicySetCombinerParameter = new DOMPolicySetCombinerParameter();
+ DOMPolicySetCombinerParameter domPolicySetCombinerParameter = new DOMPolicySetCombinerParameter();
try {
- NodeList children = elementPolicySetCombinerParameter.getChildNodes();
+ NodeList children = elementPolicySetCombinerParameter.getChildNodes();
int numChildren;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
- if (DOMUtil.isInNamespace(child, XACML3.XMLNS) && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
+ if (DOMUtil.isInNamespace(child, XACML3.XMLNS)
+ && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
if (domPolicySetCombinerParameter.getAttributeValue() != null && !bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeCombinerParameter);
}
- domPolicySetCombinerParameter.setAttributeValue(DOMAttributeValue.newInstance(child, null));
+ domPolicySetCombinerParameter.setAttributeValue(DOMAttributeValue
+ .newInstance(child, null));
} else if (!bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeCombinerParameter);
}
@@ -91,10 +97,15 @@ public class DOMPolicySetCombinerParameter extends TargetedCombinerParameter<Ide
}
}
if (domPolicySetCombinerParameter.getAttributeValue() == null && !bLenient) {
- throw DOMUtil.newMissingElementException(elementPolicySetCombinerParameter, XACML3.XMLNS, XACML3.ELEMENT_ATTRIBUTEVALUE);
+ throw DOMUtil.newMissingElementException(elementPolicySetCombinerParameter, XACML3.XMLNS,
+ XACML3.ELEMENT_ATTRIBUTEVALUE);
}
- domPolicySetCombinerParameter.setName(DOMUtil.getStringAttribute(elementPolicySetCombinerParameter, XACML3.ATTRIBUTE_PARAMETERNAME, !bLenient));
- domPolicySetCombinerParameter.setTargetId(DOMUtil.getIdentifierAttribute(elementPolicySetCombinerParameter, XACML3.ATTRIBUTE_POLICYSETIDREF, !bLenient));
+ domPolicySetCombinerParameter.setName(DOMUtil
+ .getStringAttribute(elementPolicySetCombinerParameter, XACML3.ATTRIBUTE_PARAMETERNAME,
+ !bLenient));
+ domPolicySetCombinerParameter.setTargetId(DOMUtil
+ .getIdentifierAttribute(elementPolicySetCombinerParameter, XACML3.ATTRIBUTE_POLICYSETIDREF,
+ !bLenient));
} catch (DOMStructureException ex) {
domPolicySetCombinerParameter.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
if (DOMProperties.throwsExceptions()) {
@@ -107,38 +118,42 @@ public class DOMPolicySetCombinerParameter extends TargetedCombinerParameter<Ide
}
public static boolean repair(Node nodeCombinerParameter) throws DOMStructureException {
- Element elementPolicySetCombinerParameter = DOMUtil.getElement(nodeCombinerParameter);
- boolean result = false;
+ Element elementPolicySetCombinerParameter = DOMUtil.getElement(nodeCombinerParameter);
+ boolean result = false;
- NodeList children = elementPolicySetCombinerParameter.getChildNodes();
+ NodeList children = elementPolicySetCombinerParameter.getChildNodes();
int numChildren;
- boolean sawAttributeValue = false;
+ boolean sawAttributeValue = false;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
- if (DOMUtil.isInNamespace(child, XACML3.XMLNS) && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
+ if (DOMUtil.isInNamespace(child, XACML3.XMLNS)
+ && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
if (sawAttributeValue) {
logger.warn("Unexpected element " + child.getNodeName());
elementPolicySetCombinerParameter.removeChild(child);
- result = true;
+ result = true;
} else {
- sawAttributeValue = true;
- result = DOMAttributeValue.repair(child) || result;
+ sawAttributeValue = true;
+ result = DOMAttributeValue.repair(child) || result;
}
} else {
logger.warn("Unexpected element " + child.getNodeName());
elementPolicySetCombinerParameter.removeChild(child);
- result = true;
+ result = true;
}
}
}
}
if (!sawAttributeValue) {
- throw DOMUtil.newMissingElementException(elementPolicySetCombinerParameter, XACML3.XMLNS, XACML3.ELEMENT_ATTRIBUTEVALUE);
+ throw DOMUtil.newMissingElementException(elementPolicySetCombinerParameter, XACML3.XMLNS,
+ XACML3.ELEMENT_ATTRIBUTEVALUE);
}
- result = DOMUtil.repairStringAttribute(elementPolicySetCombinerParameter, XACML3.ATTRIBUTE_PARAMETERNAME, "parameter", logger) || result;
- result = DOMUtil.repairIdentifierAttribute(elementPolicySetCombinerParameter, XACML3.ATTRIBUTE_POLICYSETIDREF, logger) || result;
+ result = DOMUtil.repairStringAttribute(elementPolicySetCombinerParameter,
+ XACML3.ATTRIBUTE_PARAMETERNAME, "parameter", logger) || result;
+ result = DOMUtil.repairIdentifierAttribute(elementPolicySetCombinerParameter,
+ XACML3.ATTRIBUTE_POLICYSETIDREF, logger) || result;
return result;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetIdReference.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetIdReference.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetIdReference.java
index b8f28c5..4a8090c 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetIdReference.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMPolicySetIdReference.java
@@ -40,26 +40,29 @@ import com.att.research.xacmlatt.pdp.policy.PolicySet;
import com.att.research.xacmlatt.pdp.policy.PolicySetIdReference;
/**
- * DOMPolicySetIdReference extends {@link com.att.research.xacmlatt.pdp.policy.PolicySetIdReference} with methods for creation
- * from DOM {@link org.w3c.dom.Node}s.
- *
+ * DOMPolicySetIdReference extends {@link com.att.research.xacmlatt.pdp.policy.PolicySetIdReference} with
+ * methods for creation from DOM {@link org.w3c.dom.Node}s.
*/
public class DOMPolicySetIdReference {
protected DOMPolicySetIdReference() {
}
/**
- * Creates a new <code>PolicySetIdReference</code> parsed from the given <code>Node</code> representing a XACML PolicySetIdReference element.
+ * Creates a new <code>PolicySetIdReference</code> parsed from the given <code>Node</code> representing a
+ * XACML PolicySetIdReference element.
*
- * @param nodePolicySetIdReference the <code>Node</code> representing the XACML PolicySetIdReference element
+ * @param nodePolicySetIdReference the <code>Node</code> representing the XACML PolicySetIdReference
+ * element
* @return a new <code>PolicySetIdReference</code> parsed from the given <code>Node</code>
* @throws DOMStructureException if there is an error parsing the <code>Node</code>
*/
- public static PolicySetIdReference newInstance(Node nodePolicySetIdReference, PolicySet policySetParent) throws DOMStructureException {
- PolicySetIdReference domPolicySetIdReference = new PolicySetIdReference(policySetParent);
+ public static PolicySetIdReference newInstance(Node nodePolicySetIdReference, PolicySet policySetParent)
+ throws DOMStructureException {
+ PolicySetIdReference domPolicySetIdReference = new PolicySetIdReference(policySetParent);
try {
- domPolicySetIdReference.setIdReferenceMatch(DOMIdReferenceMatch.newInstance(nodePolicySetIdReference));
+ domPolicySetIdReference.setIdReferenceMatch(DOMIdReferenceMatch
+ .newInstance(nodePolicySetIdReference));
} catch (DOMStructureException ex) {
domPolicySetIdReference.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
if (DOMProperties.throwsExceptions()) {
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRule.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRule.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRule.java
index c11e23d..db2fc30 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRule.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRule.java
@@ -50,18 +50,18 @@ import com.att.research.xacmlatt.pdp.policy.Rule;
import com.att.research.xacmlatt.pdp.policy.RuleEffect;
/**
- * DOMRule extends {@link com.att.research.xacmlatt.pdp.policy.Rule} with methods for creation from
- * DOM {@link org.w3c.dom.Node}s.
- *
+ * DOMRule extends {@link com.att.research.xacmlatt.pdp.policy.Rule} with methods for creation from DOM
+ * {@link org.w3c.dom.Node}s.
*/
public class DOMRule extends Rule {
- private static final Log logger = LogFactory.getLog(DOMRule.class);
+ private static final Log logger = LogFactory.getLog(DOMRule.class);
protected DOMRule() {
}
/**
- * Creates a new <code>Rule</code> by parsing the given <code>Node</code> representing a XACML Rule element.
+ * Creates a new <code>Rule</code> by parsing the given <code>Node</code> representing a XACML Rule
+ * element.
*
* @param nodeRule the <code>Node</code> representing the XACML Rule element
* @param policy the {@link com.att.research.xacmlatt.pdp.policy.Policy} encompassing the Rule element
@@ -69,24 +69,24 @@ public class DOMRule extends Rule {
* @throws DOMStructureException if there is an error parsing the <code>Node</code>
*/
public static Rule newInstance(Node nodeRule, Policy policy) throws DOMStructureException {
- Element elementRule = DOMUtil.getElement(nodeRule);
- boolean bLenient = DOMProperties.isLenient();
+ Element elementRule = DOMUtil.getElement(nodeRule);
+ boolean bLenient = DOMProperties.isLenient();
- DOMRule domRule = new DOMRule();
+ DOMRule domRule = new DOMRule();
domRule.setPolicy(policy);
Iterator<?> iterator;
try {
- NodeList children = elementRule.getChildNodes();
+ NodeList children = elementRule.getChildNodes();
int numChildren;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
if (DOMUtil.isInNamespace(child, XACML3.XMLNS)) {
- String childName = child.getLocalName();
+ String childName = child.getLocalName();
if (XACML3.ELEMENT_DESCRIPTION.equals(childName)) {
if (domRule.getDescription() != null && !bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeRule);
@@ -101,18 +101,23 @@ public class DOMRule extends Rule {
if (domRule.getCondition() != null && !bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeRule);
}
- Node nodeExpression = DOMUtil.getFirstChildElement(child);
+ Node nodeExpression = DOMUtil.getFirstChildElement(child);
if (nodeExpression == null && !bLenient) {
- throw DOMUtil.newMissingElementException(child, XACML3.XMLNS, XACML3.ELEMENT_EXPRESSION);
+ throw DOMUtil.newMissingElementException(child, XACML3.XMLNS,
+ XACML3.ELEMENT_EXPRESSION);
}
- domRule.setCondition(new Condition(DOMExpression.newInstance(nodeExpression, policy)));
+ domRule.setCondition(new Condition(DOMExpression.newInstance(nodeExpression,
+ policy)));
} else if (XACML3.ELEMENT_OBLIGATIONEXPRESSIONS.equals(childName)) {
- if ((iterator = domRule.getObligationExpressions()) != null && iterator.hasNext() && !bLenient) {
+ if ((iterator = domRule.getObligationExpressions()) != null
+ && iterator.hasNext() && !bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeRule);
}
- domRule.setObligationExpressions(DOMObligationExpression.newList(child, policy));
+ domRule.setObligationExpressions(DOMObligationExpression.newList(child,
+ policy));
} else if (XACML3.ELEMENT_ADVICEEXPRESSIONS.equals(childName)) {
- if ((iterator = domRule.getAdviceExpressions()) != null && iterator.hasNext() && !bLenient) {
+ if ((iterator = domRule.getAdviceExpressions()) != null && iterator.hasNext()
+ && !bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeRule);
}
domRule.setAdviceExpressions(DOMAdviceExpression.newList(child, policy));
@@ -127,10 +132,11 @@ public class DOMRule extends Rule {
}
domRule.setRuleId(DOMUtil.getStringAttribute(elementRule, XACML3.ATTRIBUTE_RULEID, !bLenient));
- String string = DOMUtil.getStringAttribute(elementRule, XACML3.ATTRIBUTE_EFFECT, !bLenient);
- RuleEffect ruleEffect = RuleEffect.getRuleEffect(string);
+ String string = DOMUtil.getStringAttribute(elementRule, XACML3.ATTRIBUTE_EFFECT, !bLenient);
+ RuleEffect ruleEffect = RuleEffect.getRuleEffect(string);
if (ruleEffect == null && !bLenient) {
- throw new DOMStructureException(elementRule, "Unknown RuleEffect \"" + string + "\" in \"" + DOMUtil.getNodeLabel(nodeRule) + "\"");
+ throw new DOMStructureException(elementRule, "Unknown RuleEffect \"" + string + "\" in \""
+ + DOMUtil.getNodeLabel(nodeRule) + "\"");
}
domRule.setRuleEffect(ruleEffect);
@@ -144,94 +150,100 @@ public class DOMRule extends Rule {
}
public static boolean repair(Node nodeRule) throws DOMStructureException {
- Element elementRule = DOMUtil.getElement(nodeRule);
- boolean result = false;
+ Element elementRule = DOMUtil.getElement(nodeRule);
+ boolean result = false;
- NodeList children = elementRule.getChildNodes();
+ NodeList children = elementRule.getChildNodes();
int numChildren;
- boolean sawDescription = false;
- boolean sawTarget = false;
- boolean sawCondition = false;
- boolean sawObligationExpressions = false;
- boolean sawAdviceExpressions = false;
+ boolean sawDescription = false;
+ boolean sawTarget = false;
+ boolean sawCondition = false;
+ boolean sawObligationExpressions = false;
+ boolean sawAdviceExpressions = false;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
if (DOMUtil.isInNamespace(child, XACML3.XMLNS)) {
- String childName = child.getLocalName();
+ String childName = child.getLocalName();
if (XACML3.ELEMENT_DESCRIPTION.equals(childName)) {
if (sawDescription) {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
} else {
- sawDescription = true;
+ sawDescription = true;
}
} else if (XACML3.ELEMENT_TARGET.equals(childName)) {
if (sawTarget) {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
} else {
- sawTarget = true;
- result = DOMTarget.repair(child) || result;
+ sawTarget = true;
+ result = DOMTarget.repair(child) || result;
}
} else if (XACML3.ELEMENT_CONDITION.equals(childName)) {
if (sawCondition) {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
} else {
- sawCondition = true;
- Node nodeExpression = DOMUtil.getFirstChildElement(child);
+ sawCondition = true;
+ Node nodeExpression = DOMUtil.getFirstChildElement(child);
if (nodeExpression == null) {
- throw DOMUtil.newMissingElementException(child, XACML3.XMLNS, XACML3.ELEMENT_EXPRESSION);
+ throw DOMUtil.newMissingElementException(child, XACML3.XMLNS,
+ XACML3.ELEMENT_EXPRESSION);
}
- result = DOMExpression.repair(nodeExpression) || result;
+ result = DOMExpression.repair(nodeExpression) || result;
}
} else if (XACML3.ELEMENT_OBLIGATIONEXPRESSIONS.equals(childName)) {
if (sawObligationExpressions) {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
} else {
- sawObligationExpressions = true;
- result = DOMObligationExpression.repairList(child) || result;
+ sawObligationExpressions = true;
+ result = DOMObligationExpression.repairList(child) || result;
}
} else if (XACML3.ELEMENT_ADVICEEXPRESSIONS.equals(childName)) {
if (sawAdviceExpressions) {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
} else {
- sawAdviceExpressions = true;
- result = DOMAdviceExpression.repairList(child) || result;
+ sawAdviceExpressions = true;
+ result = DOMAdviceExpression.repairList(child) || result;
}
} else {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
}
} else {
logger.warn("Unexpected element " + child.getNodeName());
elementRule.removeChild(child);
- result = true;
+ result = true;
}
}
}
}
- result = DOMUtil.repairStringAttribute(elementRule, XACML3.ATTRIBUTE_RULEID, IdentifierImpl.gensym().stringValue(), logger) || result;
- result = DOMUtil.repairStringAttribute(elementRule, XACML3.ATTRIBUTE_EFFECT, RuleEffect.DENY.getName(), logger) || result;
+ result = DOMUtil.repairStringAttribute(elementRule, XACML3.ATTRIBUTE_RULEID, IdentifierImpl.gensym()
+ .stringValue(), logger)
+ || result;
+ result = DOMUtil.repairStringAttribute(elementRule, XACML3.ATTRIBUTE_EFFECT,
+ RuleEffect.DENY.getName(), logger)
+ || result;
- String string = DOMUtil.getStringAttribute(elementRule, XACML3.ATTRIBUTE_EFFECT);
- RuleEffect ruleEffect = RuleEffect.getRuleEffect(string);
+ String string = DOMUtil.getStringAttribute(elementRule, XACML3.ATTRIBUTE_EFFECT);
+ RuleEffect ruleEffect = RuleEffect.getRuleEffect(string);
if (ruleEffect == null) {
- logger.warn("Setting invalid " + XACML3.ATTRIBUTE_EFFECT + " attribute " + string + " to " + RuleEffect.DENY.getName());
+ logger.warn("Setting invalid " + XACML3.ATTRIBUTE_EFFECT + " attribute " + string + " to "
+ + RuleEffect.DENY.getName());
elementRule.setAttribute(XACML3.ATTRIBUTE_EFFECT, RuleEffect.DENY.getName());
- result = true;
+ result = true;
}
return result;
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRuleCombinerParameters.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRuleCombinerParameters.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRuleCombinerParameters.java
index beb1140..3474c76 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRuleCombinerParameters.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMRuleCombinerParameters.java
@@ -46,42 +46,48 @@ import com.att.research.xacmlatt.pdp.policy.Rule;
import com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter;
/**
- * DOMRuleCombinerParameters extends {@link com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter} with methods
- * for creation from DOM {@link org.w3c.dom.Node}s.
- *
+ * DOMRuleCombinerParameters extends {@link com.att.research.xacmlatt.pdp.policy.TargetedCombinerParameter}
+ * with methods for creation from DOM {@link org.w3c.dom.Node}s.
*/
-public class DOMRuleCombinerParameters extends TargetedCombinerParameter<String,Rule> {
- private static final Log logger = LogFactory.getLog(DOMRuleCombinerParameters.class);
+public class DOMRuleCombinerParameters extends TargetedCombinerParameter<String, Rule> {
+ private static final Log logger = LogFactory.getLog(DOMRuleCombinerParameters.class);
protected DOMRuleCombinerParameters() {
}
/**
- * Creates a new <code>TargetedCombinerParameter</code> for {@link com.att.research.xacmlatt.pdp.policy.Rule}s by parsing the
- * given <code>Node</code> representing a XACML RuleCombinerParameters element.
+ * Creates a new <code>TargetedCombinerParameter</code> for
+ * {@link com.att.research.xacmlatt.pdp.policy.Rule}s by parsing the given <code>Node</code> representing
+ * a XACML RuleCombinerParameters element.
*
- * @param nodeRuleCombinerParameters the <code>Node</code> representing the XACML RuleCombinerParameters element.
- * @return a new <code>TargetedCombinerParameter</code> for <code>Rule</code>s parsed from the given <code>Node</code>
+ * @param nodeRuleCombinerParameters the <code>Node</code> representing the XACML RuleCombinerParameters
+ * element.
+ * @return a new <code>TargetedCombinerParameter</code> for <code>Rule</code>s parsed from the given
+ * <code>Node</code>
* @throws DOMStructureException if there is an error parsing the <code>Node</code>.
*/
- public static TargetedCombinerParameter<String,Rule> newInstance(Node nodeRuleCombinerParameters) throws DOMStructureException {
- Element elementRuleCombinerParameters = DOMUtil.getElement(nodeRuleCombinerParameters);
- boolean bLenient = DOMProperties.isLenient();
+ public static TargetedCombinerParameter<String, Rule> newInstance(Node nodeRuleCombinerParameters)
+ throws DOMStructureException {
+ Element elementRuleCombinerParameters = DOMUtil.getElement(nodeRuleCombinerParameters);
+ boolean bLenient = DOMProperties.isLenient();
- DOMRuleCombinerParameters domRuleCombinerParameters = new DOMRuleCombinerParameters();
+ DOMRuleCombinerParameters domRuleCombinerParameters = new DOMRuleCombinerParameters();
try {
- NodeList children = elementRuleCombinerParameters.getChildNodes();
+ NodeList children = elementRuleCombinerParameters.getChildNodes();
int numChildren;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
- if (DOMUtil.isInNamespace(child, XACML3.XMLNS) && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
+ if (DOMUtil.isInNamespace(child, XACML3.XMLNS)
+ && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
if (domRuleCombinerParameters.getAttributeValue() != null) {
- throw DOMUtil.newUnexpectedElementException(child, nodeRuleCombinerParameters);
+ throw DOMUtil
+ .newUnexpectedElementException(child, nodeRuleCombinerParameters);
}
- domRuleCombinerParameters.setAttributeValue(DOMAttributeValue.newInstance(child, null));
+ domRuleCombinerParameters.setAttributeValue(DOMAttributeValue.newInstance(child,
+ null));
} else if (!bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeRuleCombinerParameters);
}
@@ -89,10 +95,15 @@ public class DOMRuleCombinerParameters extends TargetedCombinerParameter<String,
}
}
if (domRuleCombinerParameters.getAttributeValue() == null && !bLenient) {
- throw DOMUtil.newMissingElementException(nodeRuleCombinerParameters, XACML3.XMLNS, XACML3.ELEMENT_ATTRIBUTEVALUE);
+ throw DOMUtil.newMissingElementException(nodeRuleCombinerParameters, XACML3.XMLNS,
+ XACML3.ELEMENT_ATTRIBUTEVALUE);
}
- domRuleCombinerParameters.setName(DOMUtil.getStringAttribute(elementRuleCombinerParameters, XACML3.ATTRIBUTE_PARAMETERNAME, !bLenient));
- domRuleCombinerParameters.setTargetId(DOMUtil.getStringAttribute(elementRuleCombinerParameters, XACML3.ATTRIBUTE_RULEIDREF, !bLenient));
+ domRuleCombinerParameters.setName(DOMUtil.getStringAttribute(elementRuleCombinerParameters,
+ XACML3.ATTRIBUTE_PARAMETERNAME,
+ !bLenient));
+ domRuleCombinerParameters.setTargetId(DOMUtil.getStringAttribute(elementRuleCombinerParameters,
+ XACML3.ATTRIBUTE_RULEIDREF,
+ !bLenient));
} catch (DOMStructureException ex) {
domRuleCombinerParameters.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
if (DOMProperties.throwsExceptions()) {
@@ -103,38 +114,44 @@ public class DOMRuleCombinerParameters extends TargetedCombinerParameter<String,
}
public static boolean repair(Node nodeRuleCombinerParameters) throws DOMStructureException {
- Element elementRuleCombinerParameters = DOMUtil.getElement(nodeRuleCombinerParameters);
- boolean result = false;
+ Element elementRuleCombinerParameters = DOMUtil.getElement(nodeRuleCombinerParameters);
+ boolean result = false;
- NodeList children = elementRuleCombinerParameters.getChildNodes();
+ NodeList children = elementRuleCombinerParameters.getChildNodes();
int numChildren;
- boolean sawAttributeValue = false;
+ boolean sawAttributeValue = false;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
- if (DOMUtil.isInNamespace(child, XACML3.XMLNS) && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
+ if (DOMUtil.isInNamespace(child, XACML3.XMLNS)
+ && XACML3.ELEMENT_ATTRIBUTEVALUE.equals(child.getLocalName())) {
if (sawAttributeValue) {
logger.warn("Unexpected element " + child.getNodeName());
elementRuleCombinerParameters.removeChild(child);
- result = true;
+ result = true;
} else {
- sawAttributeValue = true;
- result = result || DOMAttributeValue.repair(child);
+ sawAttributeValue = true;
+ result = result || DOMAttributeValue.repair(child);
}
} else {
logger.warn("Unexpected element " + child.getNodeName());
elementRuleCombinerParameters.removeChild(child);
- result = true;
+ result = true;
}
}
}
}
if (!sawAttributeValue) {
- throw DOMUtil.newMissingElementException(nodeRuleCombinerParameters, XACML3.XMLNS, XACML3.ELEMENT_ATTRIBUTEVALUE);
+ throw DOMUtil.newMissingElementException(nodeRuleCombinerParameters, XACML3.XMLNS,
+ XACML3.ELEMENT_ATTRIBUTEVALUE);
}
- result = result || DOMUtil.repairStringAttribute(elementRuleCombinerParameters, XACML3.ATTRIBUTE_PARAMETERNAME, "parameter", logger);
- result = result || DOMUtil.repairIdentifierAttribute(elementRuleCombinerParameters, XACML3.ATTRIBUTE_RULEIDREF, logger);
+ result = result
+ || DOMUtil.repairStringAttribute(elementRuleCombinerParameters,
+ XACML3.ATTRIBUTE_PARAMETERNAME, "parameter", logger);
+ result = result
+ || DOMUtil.repairIdentifierAttribute(elementRuleCombinerParameters,
+ XACML3.ATTRIBUTE_RULEIDREF, logger);
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMTarget.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMTarget.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMTarget.java
index 264425f..a6a9c42 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMTarget.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMTarget.java
@@ -44,12 +44,11 @@ import com.att.research.xacml.std.dom.DOMUtil;
import com.att.research.xacmlatt.pdp.policy.Target;
/**
- * DOMTarget extends {@link com.att.research.xacmlatt.pdp.policy.Target} with methods for creation from
- * DOM {@link org.w3c.dom.Node}s.
- *
+ * DOMTarget extends {@link com.att.research.xacmlatt.pdp.policy.Target} with methods for creation from DOM
+ * {@link org.w3c.dom.Node}s.
*/
public class DOMTarget extends Target {
- private static final Log logger = LogFactory.getLog(DOMTarget.class);
+ private static final Log logger = LogFactory.getLog(DOMTarget.class);
/**
* Creates an empty <code>DOMTarget</code>.
@@ -58,25 +57,27 @@ public class DOMTarget extends Target {
}
/**
- * Creates a new <code>DOMTarget</code> by parsing the given <code>Node</code> representing a XACML Target element.
+ * Creates a new <code>DOMTarget</code> by parsing the given <code>Node</code> representing a XACML Target
+ * element.
*
* @param nodeTarget the <code>Node</code> representing the XACML Target element
* @return a new <code>DOMTarget</code> parsed from the given <code>Node</code>
* @throws DOMStructureException if there is an error parsing the <code>Node</code>
*/
public static Target newInstance(Node nodeTarget) throws DOMStructureException {
- Element elementTarget = DOMUtil.getElement(nodeTarget);
- boolean bLenient = DOMProperties.isLenient();
+ Element elementTarget = DOMUtil.getElement(nodeTarget);
+ boolean bLenient = DOMProperties.isLenient();
- DOMTarget domTarget = new DOMTarget();
+ DOMTarget domTarget = new DOMTarget();
try {
- NodeList children = elementTarget.getChildNodes();
+ NodeList children = elementTarget.getChildNodes();
int numChildren;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
- if (DOMUtil.isInNamespace(child, XACML3.XMLNS) && XACML3.ELEMENT_ANYOF.equals(child.getLocalName())) {
+ if (DOMUtil.isInNamespace(child, XACML3.XMLNS)
+ && XACML3.ELEMENT_ANYOF.equals(child.getLocalName())) {
domTarget.addAnyOf(DOMAnyOf.newInstance(child));
} else if (!bLenient) {
throw DOMUtil.newUnexpectedElementException(child, nodeTarget);
@@ -95,21 +96,22 @@ public class DOMTarget extends Target {
}
public static boolean repair(Node nodeTarget) throws DOMStructureException {
- Element elementTarget = DOMUtil.getElement(nodeTarget);
- boolean result = false;
+ Element elementTarget = DOMUtil.getElement(nodeTarget);
+ boolean result = false;
- NodeList children = elementTarget.getChildNodes();
+ NodeList children = elementTarget.getChildNodes();
int numChildren;
if (children != null && (numChildren = children.getLength()) > 0) {
- for (int i = 0 ; i < numChildren ; i++) {
- Node child = children.item(i);
+ for (int i = 0; i < numChildren; i++) {
+ Node child = children.item(i);
if (DOMUtil.isElement(child)) {
- if (DOMUtil.isInNamespace(child, XACML3.XMLNS) && XACML3.ELEMENT_ANYOF.equals(child.getLocalName())) {
- result = DOMAnyOf.repair(child) || result;
+ if (DOMUtil.isInNamespace(child, XACML3.XMLNS)
+ && XACML3.ELEMENT_ANYOF.equals(child.getLocalName())) {
+ result = DOMAnyOf.repair(child) || result;
} else {
logger.warn("Unexpected element " + child.getNodeName());
elementTarget.removeChild(child);
- result = true;
+ result = true;
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMVariableDefinition.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMVariableDefinition.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMVariableDefinition.java
index 683f330..23789bd 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMVariableDefinition.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/dom/DOMVariableDefinition.java
@@ -46,30 +46,31 @@ import com.att.research.xacmlatt.pdp.policy.VariableDefinition;
/**
* DOMVariableDefinition extends {@link com.att.research.xacmlatt.pdp.policy.VariableDefinition} with methods
* for creation from DOM {@link org.w3c.dom.Node}s.
- *
*/
public class DOMVariableDefinition extends VariableDefinition {
- private static final Log logger = LogFactory.getLog(DOMVariableDefinition.class);
+ private static final Log logger = LogFactory.getLog(DOMVariableDefinition.class);
protected DOMVariableDefinition() {
}
/**
- * Creates a new <code>VariableDefinition</code> by parsing the given <code>Node</code> representing a XACML VariableDefinition element.
+ * Creates a new <code>VariableDefinition</code> by parsing the given <code>Node</code> representing a
+ * XACML VariableDefinition element.
*
* @param nodeVariableDefinition the <code>Node</code> representing the XACML VariableDefinition element
* @param policy the <code>Policy</code> encompassing the VariableDefinition element
* @return a new <code>VariableDefinition</code> parsed from the given <code>Node</code>
* @throws DOMStructureException if there is an error parsing the <code>Node</code>
*/
- public static VariableDefinition newInstance(Node nodeVariableDefinition, Policy policy) throws DOMStructureException {
- Element elementVariableDefinition = DOMUtil.getElement(nodeVariableDefinition);
- boolean bLenient = DOMProperties.isLenient();
+ public static VariableDefinition newInstance(Node nodeVariableDefinition, Policy policy)
+ throws DOMStructureException {
+ Element elementVariableDefinition = DOMUtil.getElement(nodeVariableDefinition);
+ boolean bLenient = DOMProperties.isLenient();
- DOMVariableDefinition domVariableDefinition = new DOMVariableDefinition();
+ DOMVariableDefinition domVariableDefinition = new DOMVariableDefinition();
try {
- Element elementExpression = DOMUtil.getFirstChildElement(elementVariableDefinition);
+ Element elementExpression = DOMUtil.getFirstChildElement(elementVariableDefinition);
if (elementExpression != null) {
if (DOMExpression.isExpression(elementExpression)) {
domVariableDefinition.setExpression(DOMExpression.newInstance(elementExpression, policy));
@@ -77,9 +78,11 @@ public class DOMVariableDefinition extends VariableDefinition {
throw DOMUtil.newUnexpectedElementException(elementExpression, elementVariableDefinition);
}
} else if (!bLenient) {
- throw DOMUtil.newMissingElementException(elementVariableDefinition, XACML3.XMLNS, XACML3.ELEMENT_EXPRESSION);
+ throw DOMUtil.newMissingElementException(elementVariableDefinition, XACML3.XMLNS,
+ XACML3.ELEMENT_EXPRESSION);
}
- domVariableDefinition.setId(DOMUtil.getStringAttribute(elementVariableDefinition, XACML3.ATTRIBUTE_VARIABLEID, !bLenient));
+ domVariableDefinition.setId(DOMUtil.getStringAttribute(elementVariableDefinition,
+ XACML3.ATTRIBUTE_VARIABLEID, !bLenient));
} catch (DOMStructureException ex) {
domVariableDefinition.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
if (DOMProperties.throwsExceptions()) {
@@ -90,23 +93,26 @@ public class DOMVariableDefinition extends VariableDefinition {
}
public static boolean repair(Node nodeVariableDefinition) throws DOMStructureException {
- Element elementVariableDefinition = DOMUtil.getElement(nodeVariableDefinition);
- boolean result = false;
+ Element elementVariableDefinition = DOMUtil.getElement(nodeVariableDefinition);
+ boolean result = false;
- Element elementExpression = DOMUtil.getFirstChildElement(elementVariableDefinition);
+ Element elementExpression = DOMUtil.getFirstChildElement(elementVariableDefinition);
if (elementExpression != null) {
if (DOMExpression.isExpression(elementExpression)) {
- result = result || DOMExpression.repair(elementExpression);
+ result = result || DOMExpression.repair(elementExpression);
} else {
logger.warn("Unexpected element " + elementExpression.getNodeName());
elementVariableDefinition.removeChild(elementExpression);
- result = true;
+ result = true;
}
} else {
- throw DOMUtil.newMissingElementException(elementVariableDefinition, XACML3.XMLNS, XACML3.ELEMENT_EXPRESSION);
+ throw DOMUtil.newMissingElementException(elementVariableDefinition, XACML3.XMLNS,
+ XACML3.ELEMENT_EXPRESSION);
}
- result = result || DOMUtil.repairStringAttribute(elementVariableDefinition, XACML3.ATTRIBUTE_VARIABLEID, "variable", logger);
+ result = result
+ || DOMUtil.repairStringAttribute(elementVariableDefinition, XACML3.ATTRIBUTE_VARIABLEID,
+ "variable", logger);
return result;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/Apply.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/Apply.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/Apply.java
index b9f1bab..ac9a3f8 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/Apply.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/Apply.java
@@ -51,14 +51,14 @@ import com.att.research.xacmlatt.pdp.policy.FunctionDefinitionFactory;
import com.att.research.xacmlatt.pdp.policy.PolicyDefaults;
/**
- * Apply extends {@link com.att.research.xacmlatt.pdp.policy.Expression} to implement the XACML Apply Expression element.
- *
+ * Apply extends {@link com.att.research.xacmlatt.pdp.policy.Expression} to implement the XACML Apply
+ * Expression element.
*/
public class Apply extends Expression {
private Identifier functionId;
private FunctionDefinition functionDefinition;
private String description;
- private List<Expression> arguments = new ArrayList<Expression>();
+ private List<Expression> arguments = new ArrayList<Expression>();
protected List<Expression> getArgumentList() {
return this.arguments;
@@ -80,8 +80,8 @@ public class Apply extends Expression {
}
public Apply(Identifier functionIdIn, String descriptionIn, Collection<Expression> argumentsIn) {
- this.functionId = functionIdIn;
- this.description = descriptionIn;
+ this.functionId = functionIdIn;
+ this.description = descriptionIn;
if (argumentsIn != null) {
this.arguments.addAll(argumentsIn);
}
@@ -92,7 +92,7 @@ public class Apply extends Expression {
}
public void setFunctionId(Identifier identifier) {
- this.functionId = identifier;
+ this.functionId = identifier;
this.functionDefinition = null;
}
@@ -100,16 +100,19 @@ public class Apply extends Expression {
* Gets and caches the {@link com.att.research.xacmlatt.pdp.policy.FunctionDefinition} matching the
* <code>Identifier</code> for the FunctionId in this <code>Apply</code>.
*
- * @return the <code>FunctionDefinition</code> for the <code>Identifier</code> for the Function Id for this <code>Apply</code>
+ * @return the <code>FunctionDefinition</code> for the <code>Identifier</code> for the Function Id for
+ * this <code>Apply</code>
*/
public FunctionDefinition getFunctionDefinition() {
if (this.functionDefinition == null) {
- Identifier thisFunctionId = this.getFunctionId();
+ Identifier thisFunctionId = this.getFunctionId();
if (thisFunctionId != null) {
try {
- this.functionDefinition = FunctionDefinitionFactory.newInstance().getFunctionDefinition(thisFunctionId);
+ this.functionDefinition = FunctionDefinitionFactory.newInstance()
+ .getFunctionDefinition(thisFunctionId);
} catch (FactoryException ex) {
- this.setStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "FactoryException getting FunctionDefinition");
+ this.setStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "FactoryException getting FunctionDefinition");
}
}
}
@@ -121,7 +124,7 @@ public class Apply extends Expression {
}
public void setDescription(String string) {
- this.description = string;
+ this.description = string;
}
public Iterator<Expression> getArguments() {
@@ -144,7 +147,8 @@ public class Apply extends Expression {
}
@Override
- public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults) throws EvaluationException {
+ public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults)
+ throws EvaluationException {
if (!this.validate()) {
return ExpressionResult.newError(new StdStatus(this.getStatusCode(), this.getStatusMessage()));
}
@@ -152,19 +156,22 @@ public class Apply extends Expression {
/*
* Get the FunctionDefinition
*/
- FunctionDefinition thisFunctionDefinition = this.getFunctionDefinition();
+ FunctionDefinition thisFunctionDefinition = this.getFunctionDefinition();
if (thisFunctionDefinition == null) {
- return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Unknown Function \"" + this.getFunctionId().toString() + "\""));
+ return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Unknown Function \""
+ + this.getFunctionId().toString() + "\""));
}
/*
* Get all of the arguments and convert them into FunctionArgument objects.
*/
- List<FunctionArgument> listFunctionArguments = new ArrayList<FunctionArgument>();
- Iterator<Expression> iterExpressionArguments = this.getArguments();
+ List<FunctionArgument> listFunctionArguments = new ArrayList<FunctionArgument>();
+ Iterator<Expression> iterExpressionArguments = this.getArguments();
if (iterExpressionArguments != null) {
while (iterExpressionArguments.hasNext()) {
- listFunctionArguments.add(new FunctionArgumentExpression(iterExpressionArguments.next(), evaluationContext, policyDefaults));
+ listFunctionArguments.add(new FunctionArgumentExpression(iterExpressionArguments.next(),
+ evaluationContext, policyDefaults));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeDesignator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeDesignator.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeDesignator.java
index 4a26f4e..a59e289 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeDesignator.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeDesignator.java
@@ -54,9 +54,8 @@ import com.att.research.xacmlatt.pdp.policy.ExpressionResult;
import com.att.research.xacmlatt.pdp.policy.PolicyDefaults;
/**
- * AttributeDesignator extends {@link com.att.research.xacmlatt.pdp.policy.expression.AttributeRetrievalBase} to represent the
- * XACML AttributeDesignator element.
- *
+ * AttributeDesignator extends {@link com.att.research.xacmlatt.pdp.policy.expression.AttributeRetrievalBase}
+ * to represent the XACML AttributeDesignator element.
*/
public class AttributeDesignator extends AttributeRetrievalBase {
private Identifier attributeId;
@@ -67,21 +66,25 @@ public class AttributeDesignator extends AttributeRetrievalBase {
protected PIPRequest getPIPRequest() {
if (this.pipRequestCached == null) {
- this.pipRequestCached = new StdPIPRequest(this.getCategory(), this.getAttributeId(), this.getDataTypeId(), this.getIssuer());
+ this.pipRequestCached = new StdPIPRequest(this.getCategory(), this.getAttributeId(),
+ this.getDataTypeId(), this.getIssuer());
}
return this.pipRequestCached;
}
protected MissingAttributeDetail getMissingAttributeDetail() {
if (this.missingAttributeDetail == null) {
- this.missingAttributeDetail = new StdMutableMissingAttributeDetail(this.getCategory(), this.getAttributeId(), this.getDataTypeId(), this.getIssuer());
+ this.missingAttributeDetail = new StdMutableMissingAttributeDetail(this.getCategory(),
+ this.getAttributeId(),
+ this.getDataTypeId(),
+ this.getIssuer());
}
return this.missingAttributeDetail;
}
protected StatusDetail getStatusDetail() {
if (this.statusDetail == null) {
- this.statusDetail = new StdStatusDetail(this.getMissingAttributeDetail());
+ this.statusDetail = new StdStatusDetail(this.getMissingAttributeDetail());
}
return this.statusDetail;
}
@@ -102,7 +105,7 @@ public class AttributeDesignator extends AttributeRetrievalBase {
}
public void setAttributeId(Identifier identifierAttributeId) {
- this.attributeId = identifierAttributeId;
+ this.attributeId = identifierAttributeId;
}
public String getIssuer() {
@@ -110,7 +113,7 @@ public class AttributeDesignator extends AttributeRetrievalBase {
}
public void setIssuer(String issuerIn) {
- this.issuer = issuerIn;
+ this.issuer = issuerIn;
}
@Override
@@ -160,7 +163,8 @@ public class AttributeDesignator extends AttributeRetrievalBase {
}
@Override
- public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults) throws EvaluationException {
+ public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults)
+ throws EvaluationException {
if (!this.validate()) {
return ExpressionResult.newInstance(new StdStatus(this.getStatusCode(), this.getStatusMessage()));
}
@@ -168,8 +172,8 @@ public class AttributeDesignator extends AttributeRetrievalBase {
/*
* Set up the PIPRequest representing this
*/
- PIPRequest pipRequest = this.getPIPRequest();
- assert(pipRequest != null);
+ PIPRequest pipRequest = this.getPIPRequest();
+ assert (pipRequest != null);
/*
* Query the evaluation context for results
@@ -180,12 +184,12 @@ public class AttributeDesignator extends AttributeRetrievalBase {
} catch (PIPException ex) {
throw new EvaluationException("PIPException getting Attributes", ex);
}
- assert(pipResponse != null);
+ assert (pipResponse != null);
/*
* See if the request was successful
*/
- Status pipStatus = pipResponse.getStatus();
+ Status pipStatus = pipResponse.getStatus();
if (pipStatus != null && !pipStatus.getStatusCode().equals(StdStatusCode.STATUS_CODE_OK)) {
return ExpressionResult.newInstance(pipStatus);
}
@@ -193,11 +197,11 @@ public class AttributeDesignator extends AttributeRetrievalBase {
/*
* See if there were any results
*/
- Bag bagAttributeValues = new Bag();
- Collection<Attribute> listAttributes = pipResponse.getAttributes();
+ Bag bagAttributeValues = new Bag();
+ Collection<Attribute> listAttributes = pipResponse.getAttributes();
for (Attribute attribute : listAttributes) {
if (this.match(attribute)) {
- for (AttributeValue<?> attributeValue: attribute.getValues()) {
+ for (AttributeValue<?> attributeValue : attribute.getValues()) {
if (this.match(attributeValue)) {
bagAttributeValues.add(attributeValue);
}
@@ -205,7 +209,10 @@ public class AttributeDesignator extends AttributeRetrievalBase {
}
}
if (this.getMustBePresent() && bagAttributeValues.size() == 0) {
- return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE, "Missing required attribute", new StdStatusDetail(this.getMissingAttributeDetail())));
+ return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE,
+ "Missing required attribute",
+ new StdStatusDetail(this
+ .getMissingAttributeDetail())));
} else {
return ExpressionResult.newBag(bagAttributeValues);
}
@@ -213,7 +220,7 @@ public class AttributeDesignator extends AttributeRetrievalBase {
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{");
+ StringBuilder stringBuilder = new StringBuilder("{");
stringBuilder.append("super=");
stringBuilder.append(super.toString());
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeRetrievalBase.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeRetrievalBase.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeRetrievalBase.java
index efdc916..1a1bc90 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeRetrievalBase.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeRetrievalBase.java
@@ -41,19 +41,17 @@ import com.att.research.xacmlatt.pdp.policy.Expression;
import com.att.research.xacmlatt.pdp.policy.ExpressionResult;
/**
- * AttributeRetrievalBase extends {@link com.att.research.xacmlatt.pdp.policy.PolicyComponent} and
- * implements {@link com.att.research.xacmlatt.pdp.eval.Evaluatable} to serve as an abstract base class
- * for the {@link com.att.research.xacmlatt.pdp.policy.AttributeSelector} and {@link com.att.research.xacmlatt.pdp.policy.AttributeDesignator}
- * classes.
- *
+ * AttributeRetrievalBase extends {@link com.att.research.xacmlatt.pdp.policy.PolicyComponent} and implements
+ * {@link com.att.research.xacmlatt.pdp.eval.Evaluatable} to serve as an abstract base class for the
+ * {@link com.att.research.xacmlatt.pdp.policy.AttributeSelector} and
+ * {@link com.att.research.xacmlatt.pdp.policy.AttributeDesignator} classes.
*/
public abstract class AttributeRetrievalBase extends Expression {
- private Identifier category;
- private Identifier dataTypeId;
- private Boolean mustBePresent;
+ private Identifier category;
+ private Identifier dataTypeId;
+ private Boolean mustBePresent;
- protected AttributeRetrievalBase(StatusCode statusCodeIn,
- String statusMessageIn) {
+ protected AttributeRetrievalBase(StatusCode statusCodeIn, String statusMessageIn) {
super(statusCodeIn, statusMessageIn);
}
@@ -65,9 +63,9 @@ public abstract class AttributeRetrievalBase extends Expression {
}
protected AttributeRetrievalBase(Identifier categoryIn, Identifier dataTypeIdIn, Boolean mustBePresentIn) {
- this.category = categoryIn;
- this.dataTypeId = dataTypeIdIn;
- this.mustBePresent = mustBePresentIn;
+ this.category = categoryIn;
+ this.dataTypeId = dataTypeIdIn;
+ this.mustBePresent = mustBePresentIn;
}
/**
@@ -81,41 +79,49 @@ public abstract class AttributeRetrievalBase extends Expression {
}
/**
- * Sets the <code>Identifier</code> for the category associated with this <code>AttributeRetrievalBase</code>.
+ * Sets the <code>Identifier</code> for the category associated with this
+ * <code>AttributeRetrievalBase</code>.
*
- * @param categoryIn the <code>Identifier</code> for the category associated with this <code>AttributeRetrievalBase</code>
+ * @param categoryIn the <code>Identifier</code> for the category associated with this
+ * <code>AttributeRetrievalBase</code>
*/
public void setCategory(Identifier categoryIn) {
- this.category = categoryIn;
+ this.category = categoryIn;
}
/**
- * Gets the <code>Identifier</code> for the data type associated with this <code>AttributeRetrievalBase</code>.
+ * Gets the <code>Identifier</code> for the data type associated with this
+ * <code>AttributeRetrievalBase</code>.
*
- * @return the <code>Identifier</code> for the data type associated with this <code>AttributeRetrievalBase</code>
+ * @return the <code>Identifier</code> for the data type associated with this
+ * <code>AttributeRetrievalBase</code>
*/
public Identifier getDataTypeId() {
return this.dataTypeId;
}
/**
- * Sets the <code>Identifier</code> for the data type associated with this <code>AttributeRetrievalBase</code>.
+ * Sets the <code>Identifier</code> for the data type associated with this
+ * <code>AttributeRetrievalBase</code>.
*
- * @param dataTypeIn the <code>Identifier</code> for the data type associated with this <code>AttributeRetrievalBase</code>
+ * @param dataTypeIn the <code>Identifier</code> for the data type associated with this
+ * <code>AttributeRetrievalBase</code>
*/
public void setDataTypeId(Identifier dataTypeIn) {
- // allow old-style Ids for Durations since there is no structural or semantic changes, just a different Id.
+ // allow old-style Ids for Durations since there is no structural or semantic changes, just a
+ // different Id.
if (dataTypeIn.equals(XACML.ID_DATATYPE_WD_DAYTIMEDURATION)) {
- dataTypeIn = DataTypes.DT_DAYTIMEDURATION.getId();
+ dataTypeIn = DataTypes.DT_DAYTIMEDURATION.getId();
} else if (dataTypeIn.equals(XACML.ID_DATATYPE_WD_YEARMONTHDURATION)) {
- dataTypeIn = DataTypes.DT_YEARMONTHDURATION.getId();
+ dataTypeIn = DataTypes.DT_YEARMONTHDURATION.getId();
}
this.dataTypeId = dataTypeIn;
}
/**
- * Determines if a value must be found for this <code>AttributeRetrievalBase</code> when it is evaluated. If true,
- * and no value is found, an indeterminate result is returned, otherwise an empty bag is returned.
+ * Determines if a value must be found for this <code>AttributeRetrievalBase</code> when it is evaluated.
+ * If true, and no value is found, an indeterminate result is returned, otherwise an empty bag is
+ * returned.
*
* @return true if the value of this <code>AttributeRetrievalBase</code> must be found, else false
*/
@@ -129,7 +135,7 @@ public abstract class AttributeRetrievalBase extends Expression {
* @param b the boolean value for the flag
*/
public void setMustBePresent(boolean b) {
- this.mustBePresent = b;
+ this.mustBePresent = b;
}
@Override
@@ -149,8 +155,9 @@ public abstract class AttributeRetrievalBase extends Expression {
}
}
- @Override public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{");
+ @Override
+ public String toString() {
+ StringBuilder stringBuilder = new StringBuilder("{");
stringBuilder.append("super=");
stringBuilder.append(super.toString());
@@ -172,14 +179,15 @@ public abstract class AttributeRetrievalBase extends Expression {
}
/**
- * Creates the appropriate {@link com.att.research.xacmlatt.pdp.policy.ExpressionResult} for an empty list based
- * on the <code>getMustBePresent</code> value.
+ * Creates the appropriate {@link com.att.research.xacmlatt.pdp.policy.ExpressionResult} for an empty list
+ * based on the <code>getMustBePresent</code> value.
*
* @return an appropriate <code>ExpressionResult</code>
*/
protected ExpressionResult getEmptyResult(String statusMessage, StatusDetail statusDetail) {
if (this.getMustBePresent() != null && this.getMustBePresent().booleanValue()) {
- return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE, statusMessage, statusDetail));
+ return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE,
+ statusMessage, statusDetail));
} else {
return ExpressionResult.newEmpty();
}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeSelector.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeSelector.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeSelector.java
index f52f70e..a72c131 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeSelector.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeSelector.java
@@ -67,22 +67,21 @@ import com.att.research.xacmlatt.pdp.policy.ExpressionResult;
import com.att.research.xacmlatt.pdp.policy.PolicyDefaults;
/**
- * AttributeSelector extends {@link com.att.research.xacmlatt.pdp.policy.expressions.AttributeRetrievalBase} to implement
- * the XACML AttributeSelector element.
- *
+ * AttributeSelector extends {@link com.att.research.xacmlatt.pdp.policy.expressions.AttributeRetrievalBase}
+ * to implement the XACML AttributeSelector element.
*/
public class AttributeSelector extends AttributeRetrievalBase {
- private Identifier contextSelectorId;
- private String path;
+ private Identifier contextSelectorId;
+ private String path;
@SuppressWarnings("unused")
- private DataType<?> dataType;
+ private DataType<?> dataType;
protected DataType<?> getDataType() {
- Identifier dataTypeIdThis = this.getDataTypeId();
+ Identifier dataTypeIdThis = this.getDataTypeId();
if (dataTypeIdThis == null) {
return null;
} else {
- DataTypeFactory dataTypeFactory = null;
+ DataTypeFactory dataTypeFactory = null;
try {
dataTypeFactory = DataTypeFactory.newInstance();
if (dataTypeFactory == null) {
@@ -91,7 +90,7 @@ public class AttributeSelector extends AttributeRetrievalBase {
} catch (FactoryException ex) {
return null;
}
- return (this.dataType = dataTypeFactory.getDataType(dataTypeIdThis));
+ return (this.dataType = dataTypeFactory.getDataType(dataTypeIdThis));
}
}
@@ -111,7 +110,7 @@ public class AttributeSelector extends AttributeRetrievalBase {
}
public void setContextSelectorId(Identifier identifier) {
- this.contextSelectorId = identifier;
+ this.contextSelectorId = identifier;
}
public String getPath() {
@@ -119,7 +118,7 @@ public class AttributeSelector extends AttributeRetrievalBase {
}
public void setPath(String pathIn) {
- this.path = pathIn;
+ this.path = pathIn;
}
@Override
@@ -135,26 +134,27 @@ public class AttributeSelector extends AttributeRetrievalBase {
}
/**
- * If there is a context selector ID, get the attributes from the given <code>RequestAttributes</code> with that
- * ID, ensure they are <code>XPathExpression</code>s and return them.
+ * If there is a context selector ID, get the attributes from the given <code>RequestAttributes</code>
+ * with that ID, ensure they are <code>XPathExpression</code>s and return them.
*
* @param requestAttributes
* @return
*/
protected List<XPathExpression> getContextSelectorValues(RequestAttributes requestAttributes) {
- Identifier thisContextSelectorId = this.getContextSelectorId();
+ Identifier thisContextSelectorId = this.getContextSelectorId();
if (thisContextSelectorId == null) {
return null;
}
- List<XPathExpression> listXPathExpressions = null;
- Iterator<Attribute> iterAttributes = requestAttributes.getAttributes(thisContextSelectorId);
+ List<XPathExpression> listXPathExpressions = null;
+ Iterator<Attribute> iterAttributes = requestAttributes.getAttributes(thisContextSelectorId);
if (iterAttributes != null) {
while (iterAttributes.hasNext()) {
- Attribute attribute = iterAttributes.next();
- Iterator<AttributeValue<XPathExpressionWrapper>> iterXPathExpressions = attribute.findValues(DataTypes.DT_XPATHEXPRESSION);
+ Attribute attribute = iterAttributes.next();
+ Iterator<AttributeValue<XPathExpressionWrapper>> iterXPathExpressions = attribute
+ .findValues(DataTypes.DT_XPATHEXPRESSION);
if (iterXPathExpressions != null && iterXPathExpressions.hasNext()) {
if (listXPathExpressions == null) {
- listXPathExpressions = new ArrayList<XPathExpression>();
+ listXPathExpressions = new ArrayList<XPathExpression>();
}
listXPathExpressions.add(iterXPathExpressions.next().getValue());
}
@@ -164,7 +164,8 @@ public class AttributeSelector extends AttributeRetrievalBase {
}
@Override
- public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults) throws EvaluationException {
+ public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults)
+ throws EvaluationException {
if (!this.validate()) {
return ExpressionResult.newError(new StdStatus(this.getStatusCode(), this.getStatusMessage()));
}
@@ -172,50 +173,51 @@ public class AttributeSelector extends AttributeRetrievalBase {
/*
* Get the DataType for this AttributeSelector for converting the resulting nodes into AttributeValues
*/
- DataType<?> thisDataType = this.getDataType();
+ DataType<?> thisDataType = this.getDataType();
/*
- * Get the Request so we can find the XPathExpression to locate the root node and to find the Content element
- * of the requested category.
+ * Get the Request so we can find the XPathExpression to locate the root node and to find the Content
+ * element of the requested category.
*/
Request request = evaluationContext.getRequest();
- assert(request != null);
+ assert (request != null);
/*
- * Get the RequestAttributes objects for our Category. If none are found, then we abort quickly with either
- * an empty or indeterminate result.
+ * Get the RequestAttributes objects for our Category. If none are found, then we abort quickly with
+ * either an empty or indeterminate result.
*/
- Iterator<RequestAttributes> iterRequestAttributes = request.getRequestAttributes(this.getCategory());
+ Iterator<RequestAttributes> iterRequestAttributes = request.getRequestAttributes(this.getCategory());
if (iterRequestAttributes == null || !iterRequestAttributes.hasNext()) {
return this.getEmptyResult("No Attributes with Category " + this.getCategory().toString(), null);
}
/*
* Section 5.30 of the XACML 3.0 specification is a little vague about how to use the
- * ContextSelectorId in the face of having multiple Attributes elements with the same CategoryId. My interpretation
- * is that each is distinct, so we look for an attribute matching the ContextSelectorId in each matching Attributes element
- * and use that to search the Content in that particular Attributes element. If either an Attribute matching the context selector id
- * is not found or there is no Content, then that particular Attributes element is skipped.
+ * ContextSelectorId in the face of having multiple Attributes elements with the same CategoryId. My
+ * interpretation is that each is distinct, so we look for an attribute matching the ContextSelectorId
+ * in each matching Attributes element and use that to search the Content in that particular
+ * Attributes element. If either an Attribute matching the context selector id is not found or there
+ * is no Content, then that particular Attributes element is skipped.
*/
- Bag bagAttributeValues = new Bag();
- StdStatus statusFirstError = null;
+ Bag bagAttributeValues = new Bag();
+ StdStatus statusFirstError = null;
while (iterRequestAttributes.hasNext()) {
RequestAttributes requestAttributes = iterRequestAttributes.next();
/*
* See if we have a Content element to query.
*/
- Node nodeContentRoot = requestAttributes.getContentRoot();
+ Node nodeContentRoot = requestAttributes.getContentRoot();
if (nodeContentRoot != null) {
- List<Node> listNodesToQuery = new ArrayList<Node>();
- List<XPathExpression> listXPathExpressions = this.getContextSelectorValues(requestAttributes);
+ List<Node> listNodesToQuery = new ArrayList<Node>();
+ List<XPathExpression> listXPathExpressions = this.getContextSelectorValues(requestAttributes);
if (listXPathExpressions == null) {
listNodesToQuery.add(nodeContentRoot);
} else {
- Iterator<XPathExpression> iterXPathExpressions = listXPathExpressions.iterator();
+ Iterator<XPathExpression> iterXPathExpressions = listXPathExpressions.iterator();
while (iterXPathExpressions.hasNext()) {
XPathExpression xpathExpression = iterXPathExpressions.next();
- Node nodeContent = requestAttributes.getContentNodeByXpathExpression(xpathExpression);
+ Node nodeContent = requestAttributes.getContentNodeByXpathExpression(xpathExpression);
if (nodeContent != null) {
listNodesToQuery.add(nodeContent);
}
@@ -227,37 +229,49 @@ public class AttributeSelector extends AttributeRetrievalBase {
*/
if (listNodesToQuery.size() > 0) {
for (Node nodeToQuery : listNodesToQuery) {
- NodeList nodeList = null;
+ NodeList nodeList = null;
try {
XPath xPath = XPathFactory.newInstance().newXPath();
- xPath.setNamespaceContext(new NodeNamespaceContext(nodeToQuery.getOwnerDocument()));
- XPathExpression xPathExpression = xPath.compile(this.getPath());
- Node nodeToQueryDocumentRoot = null;
+ xPath
+ .setNamespaceContext(new NodeNamespaceContext(nodeToQuery.getOwnerDocument()));
+ XPathExpression xPathExpression = xPath.compile(this.getPath());
+ Node nodeToQueryDocumentRoot = null;
try {
nodeToQueryDocumentRoot = DOMUtil.getDirectDocumentChild(nodeToQuery);
} catch (DOMStructureException ex) {
- return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Exception processing context node: " + ex.getMessage()));
+ return ExpressionResult
+ .newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Exception processing context node: "
+ + ex.getMessage()));
}
- nodeList = (NodeList)xPathExpression.evaluate(nodeToQueryDocumentRoot, XPathConstants.NODESET);
+ nodeList = (NodeList)xPathExpression.evaluate(nodeToQueryDocumentRoot,
+ XPathConstants.NODESET);
} catch (XPathExpressionException ex) {
if (statusFirstError == null) {
- statusFirstError = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "XPathExpressionException: " + ex.getMessage());
+ statusFirstError = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "XPathExpressionException: "
+ + ex.getMessage());
}
}
if (nodeList != null && nodeList.getLength() > 0) {
- for (int i = 0 ; i < nodeList.getLength() ; i++) {
- AttributeValue<?> attributeValueNode = null;
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ AttributeValue<?> attributeValueNode = null;
try {
- attributeValueNode = thisDataType.createAttributeValue(nodeList.item(i));
+ attributeValueNode = thisDataType.createAttributeValue(nodeList.item(i));
} catch (DataTypeException ex) {
if (statusFirstError == null) {
- statusFirstError = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, ex.getMessage());
+ statusFirstError = new StdStatus(
+ StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ ex.getMessage());
}
}
if (attributeValueNode != null) {
bagAttributeValues.add(attributeValueNode);
} else if (statusFirstError == null) {
- statusFirstError = new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, "Unable to convert node to " + this.getDataTypeId().toString());
+ statusFirstError = new StdStatus(
+ StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+ "Unable to convert node to "
+ + this.getDataTypeId().toString());
}
}
}
@@ -280,7 +294,7 @@ public class AttributeSelector extends AttributeRetrievalBase {
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{");
+ StringBuilder stringBuilder = new StringBuilder("{");
stringBuilder.append("super=");
stringBuilder.append(super.toString());
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/38b6d318/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeValueExpression.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeValueExpression.java b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeValueExpression.java
index 8f75d3f..6db7f6c 100644
--- a/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeValueExpression.java
+++ b/openaz-xacml-pdp/src/main/java/com/att/research/xacmlatt/pdp/policy/expressions/AttributeValueExpression.java
@@ -43,7 +43,6 @@ import com.att.research.xacmlatt.pdp.policy.PolicyDefaults;
/**
* AttributeValueExpression extends {@link com.att.research.xacmlatt.pdp.policy.Expression} to represent XACML
* AttributeValue elements in an Expression context.
- *
*/
public class AttributeValueExpression extends Expression {
private AttributeValue<?> attributeValue;
@@ -60,7 +59,7 @@ public class AttributeValueExpression extends Expression {
}
public AttributeValueExpression(AttributeValue<?> attributeValueIn) {
- this.attributeValue = attributeValueIn;
+ this.attributeValue = attributeValueIn;
}
public AttributeValue<?> getAttributeValue() {
@@ -68,11 +67,12 @@ public class AttributeValueExpression extends Expression {
}
public void setAttributeValue(AttributeValue<?> attributeValueIn) {
- this.attributeValue = attributeValueIn;
+ this.attributeValue = attributeValueIn;
}
@Override
- public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults) throws EvaluationException {
+ public ExpressionResult evaluate(EvaluationContext evaluationContext, PolicyDefaults policyDefaults)
+ throws EvaluationException {
if (!this.validate()) {
return ExpressionResult.newError(new StdStatus(this.getStatusCode(), this.getStatusMessage()));
}
@@ -93,7 +93,7 @@ public class AttributeValueExpression extends Expression {
@Override
public String toString() {
- StringBuilder stringBuilder = new StringBuilder("{");
+ StringBuilder stringBuilder = new StringBuilder("{");
Object objectToDump;
if ((objectToDump = this.getAttributeValue()) != null) {