Author: sanka
Date: Tue Sep 26 12:33:33 2006
New Revision: 450162
URL: http://svn.apache.org/viewvc?view=rev&rev=450162
Log:
1) Improved documentation.
2) Added proper serialization / deserialization of the attributes of the
Policy PolicyOperator
Removed:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyAlternative.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyAlternatives.java
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AbstractPolicyOperator.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/All.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Assertion.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Constants.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/ExactlyOne.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyComponent.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyOperator.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistry.java
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AbstractPolicyOperator.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AbstractPolicyOperator.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AbstractPolicyOperator.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AbstractPolicyOperator.java
Tue Sep 26 12:33:33 2006
@@ -22,8 +22,8 @@
import org.apache.neethi.util.PolicyComparator;
/**
- *
- *
+ * AbstractPolicyOperator provides an implementation of few functions of
+ * PolicyOperator interface that other PolicyOperators can use.
*/
public abstract class AbstractPolicyOperator implements PolicyOperator {
protected ArrayList policyComponents = new ArrayList();
@@ -54,6 +54,18 @@
protected static Policy normalize(Policy policy, PolicyRegistry reg,
boolean deep) {
Policy result = new Policy();
+
+ String policyName = policy.getName();
+ if (policyName != null) {
+ result.setName(policyName);
+ }
+
+ String id = policy.getId();
+ if (id != null) {
+ result.setId(id);
+ }
+
+
result.addPolicyComponent(normalizeOperator(policy,reg, deep));
return result;
}
@@ -116,12 +128,6 @@
return computeResultantComponent(childComponentsList, type);
}
- /**
- *
- * @param normalizedInnerComponets
- * @param componentType
- * @return
- */
private static PolicyComponent computeResultantComponent(List
normalizedInnerComponets, short componentType) {
ExactlyOne exactlyOne = new ExactlyOne();
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/All.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/All.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/All.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/All.java
Tue Sep 26 12:33:33 2006
@@ -21,11 +21,10 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-/**
- *
- *
+/**
+ * All is a PolicyOperator that require all its PolicyComponents to be met.
*/
-public class All extends AbstractPolicyOperator implements PolicyAlternative {
+public class All extends AbstractPolicyOperator {
public void addAssertion(Assertion assertion) {
addPolicyComponent(assertion);
@@ -39,9 +38,9 @@
String prefix = writer.getPrefix(Constants.URI_POLICY_NS);
if (prefix == null) {
- writer.writeStartElement(Constants.POLICY_PREFIX,
Constants.ELEM_ALL, Constants.URI_POLICY_NS);
- writer.writeNamespace(Constants.POLICY_PREFIX,
Constants.URI_POLICY_NS);
- writer.setPrefix(Constants.POLICY_PREFIX, Constants.URI_POLICY_NS);
+ writer.writeStartElement(Constants.ATTR_WSP, Constants.ELEM_ALL,
Constants.URI_POLICY_NS);
+ writer.writeNamespace(Constants.ATTR_WSP, Constants.URI_POLICY_NS);
+ writer.setPrefix(Constants.ATTR_WSP, Constants.URI_POLICY_NS);
} else {
writer.writeStartElement(Constants.URI_POLICY_NS,
Constants.ELEM_ALL);
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Assertion.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Assertion.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Assertion.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Assertion.java
Tue Sep 26 12:33:33 2006
@@ -46,7 +46,7 @@
public void serialize(XMLStreamWriter writer) throws XMLStreamException;
/**
- *
+ * Returns a new PolicyComponent that is the normalized version of this.
*/
public PolicyComponent normalize();
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/AssertionBuilderFactory.java
Tue Sep 26 12:33:33 2006
@@ -22,6 +22,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.neethi.builders.AssertionBuilder;
+import org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder;
import sun.misc.Service;
@@ -29,8 +30,7 @@
* AssertionFactory is used to create an Assertion from an OMElement. It uses
an
* appropriate AssertionBuilder instace to create an Assertion based on the
* QName of the given OMElement. Domain Policy authors could right custom
- * AssertionBuilders to build Assertions for domain specific assertions and
- * register them.
+ * AssertionBuilders to build Assertions for domain specific assertions.
*
*/
public class AssertionBuilderFactory {
@@ -43,7 +43,7 @@
public static final String ALL = "All";
- private final QName XML_ASSERTION_BUILDER = new QName(
+ private static final QName XML_ASSERTION_BUILDER = new QName(
"http://test.org/test", "test");
private static HashMap registeredBuilders = new HashMap();
@@ -54,14 +54,23 @@
for (Iterator providers = Service.providers(AssertionBuilder.class);
providers
.hasNext();) {
builder = (AssertionBuilder) providers.next();
-
+
QName[] knownElements = builder.getKnownElements();
for (int i = 0; i < knownElements.length; i++) {
- registerBuilder(knownElements[i], builder);
+ registerBuilder(knownElements[i], builder);
}
}
+
+ registerBuilder(XML_ASSERTION_BUILDER, new
XMLPrimitiveAssertionBuilder());
}
+ /**
+ * Registers an AssertionBuilder with a specified QName.
+ *
+ * @param key the QName that the AssertionBuilder understand
+ * @param builder the AssertionBuilder that can build an Assertion from
+ * OMElement of specified type
+ */
public static void registerBuilder(QName key, AssertionBuilder builder) {
registeredBuilders.put(key, builder);
}
@@ -70,10 +79,11 @@
}
/**
- * Returns an assertion
+ * Returns an assertion that is built using the specified OMElement.
*
- * @param element
- * @return
+ * @param element the element that the AssertionBuilder can use to build
+ * an Assertion.
+ * @return an Assertion that is built using the specified element.
*/
public Assertion build(OMElement element) {
@@ -86,11 +96,22 @@
return builder.build(element, this);
}
+ /*
+ * if we can't locate an appropriate AssertionBuilder, we always
+ * use the XMLPrimitiveAssertionBuilder
+ */
builder = (AssertionBuilder) registeredBuilders
.get(XML_ASSERTION_BUILDER);
return builder.build(element, this);
}
-
+
+ /**
+ * Returns an AssertionBuilder that build an Assertion from an OMElement
+ * of qname type.
+ *
+ * @param qname the type that the AssertionBuilder understands and builds
an Assertion from
+ * @return an AssertionBuilder that understands qname type
+ */
public AssertionBuilder getBuilder(QName qname) {
return (AssertionBuilder) registeredBuilders.get(qname);
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Constants.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Constants.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Constants.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Constants.java
Tue Sep 26 12:33:33 2006
@@ -17,35 +17,43 @@
import javax.xml.namespace.QName;
+/**
+ * Constants contains the set of Constants that are used throughout the Neethi2
+ * framework.
+ *
+ */
public class Constants {
-
+
public static final String ATTR_NAME = "Name";
-
+
public static final String ATTR_ID = "Id";
+
+ public static final String ATTR_WSP = "wsp";
- public static final String POLICY_PREFIX = "wsp";
-
+ public static final String ATTR_WSU = "wsu";
+
public static final String URI_POLICY_NS =
"http://schemas.xmlsoap.org/ws/2004/09/policy";
-
+
public static final String URI_WSU_NS =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
-
+
public static final String ELEM_POLICY = "Policy";
public static final String ELEM_EXACTLYONE = "ExactlyOne";
public static final String ELEM_ALL = "All";
-
+
public static final String ELEM_POLICYREF = "PolicyReference";
-
+
public static final short TYPE_POLICY = 0x1;
public static final short TYPE_EXACTLYONE = 0x2;
public static final short TYPE_ALL = 0x3;
-
+
public static final short TYPE_POLICYREF = 0x4;
public static final short TYPE_ASSERTION = 0x5;
-
- public static final QName Q_ELEM_OPTIONAL_ATTR = new
QName(Constants.URI_POLICY_NS, "Optional",Constants.POLICY_PREFIX);
+
+ public static final QName Q_ELEM_OPTIONAL_ATTR = new QName(
+ Constants.URI_POLICY_NS, "Optional", Constants.ATTR_WSP);
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/ExactlyOne.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/ExactlyOne.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/ExactlyOne.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/ExactlyOne.java
Tue Sep 26 12:33:33 2006
@@ -16,37 +16,35 @@
package org.apache.neethi;
import java.util.Iterator;
-import java.util.List;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-public class ExactlyOne extends AbstractPolicyOperator implements
PolicyAlternatives {
-
- public void addAlternative(PolicyAlternative policyAlternative) {
- addPolicyComponent(policyAlternative);
- }
-
-
- public List getAlternatives() {
- // TODO Auto-generated method stub
- return null;
- }
+/**
+ * ExactlyOne PolicyOperator requires exactly one of its PolicyComponents to be
+ * met.
+ *
+ */
+public class ExactlyOne extends AbstractPolicyOperator {
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
String prefix = writer.getPrefix(Constants.URI_POLICY_NS);
if (prefix == null) {
- writer.writeStartElement(Constants.POLICY_PREFIX,
Constants.ELEM_EXACTLYONE, Constants.URI_POLICY_NS);
- writer.writeNamespace(Constants.POLICY_PREFIX,
Constants.URI_POLICY_NS);
- writer.setPrefix(Constants.POLICY_PREFIX, Constants.URI_POLICY_NS);
+ writer.writeStartElement(Constants.ATTR_WSP,
+ Constants.ELEM_EXACTLYONE, Constants.URI_POLICY_NS);
+ writer.writeNamespace(Constants.ATTR_WSP,
+ Constants.URI_POLICY_NS);
+ writer.setPrefix(Constants.ATTR_WSP, Constants.URI_POLICY_NS);
} else {
- writer.writeStartElement(Constants.URI_POLICY_NS,
Constants.ELEM_EXACTLYONE);
+ writer.writeStartElement(Constants.URI_POLICY_NS,
+ Constants.ELEM_EXACTLYONE);
}
PolicyComponent policyComponent;
- for (Iterator iterator = getPolicyComponents().iterator();
iterator.hasNext();) {
+ for (Iterator iterator = getPolicyComponents().iterator(); iterator
+ .hasNext();) {
policyComponent = (PolicyComponent) iterator.next();
policyComponent.serialize(writer);
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/Policy.java
Tue Sep 26 12:33:33 2006
@@ -23,6 +23,11 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+/**
+ * Policy is a PolicyOperator that requires to statisfy all of its
+ * PolicyComponents. It is always the outermost component of a Policy.
+ *
+ */
public class Policy extends All {
private HashMap attributes = new HashMap();
@@ -30,7 +35,7 @@
public PolicyComponent normalize(boolean deep) {
return normalize(null, deep);
}
-
+
public PolicyComponent normalize(PolicyRegistry reg, boolean deep) {
return normalize(this, reg, deep);
}
@@ -47,17 +52,53 @@
}
public void serialize(XMLStreamWriter writer) throws XMLStreamException {
- String prefix = writer.getPrefix(Constants.ATTR_NAME);
-
- if (prefix == null) {
- writer.writeStartElement(Constants.POLICY_PREFIX,
Constants.ELEM_POLICY, Constants.URI_POLICY_NS);
- writer.writeNamespace(Constants.POLICY_PREFIX,
Constants.URI_POLICY_NS);
- writer.setPrefix(Constants.POLICY_PREFIX, Constants.URI_POLICY_NS);
-
- } else {
- writer.writeStartElement(Constants.URI_POLICY_NS,
Constants.ELEM_POLICY);
+ String wspPrefix = writer.getPrefix(Constants.URI_POLICY_NS);
+ if (wspPrefix == null) {
+ wspPrefix = Constants.ATTR_WSP;
+ writer.setPrefix(wspPrefix, Constants.URI_POLICY_NS);
+ }
+
+ String wsuPrefix = writer.getPrefix(Constants.URI_WSU_NS);
+ if (wsuPrefix == null) {
+ wsuPrefix = Constants.ATTR_WSU;
+ writer.setPrefix(wsuPrefix, Constants.URI_WSU_NS);
+ }
+
+ writer.writeStartElement(wspPrefix, Constants.ELEM_POLICY,
Constants.URI_POLICY_NS);
+
+ QName key;
+ String prefix;
+
+ HashMap prefix2ns = new HashMap();
+
+ for (Iterator iterator = getAttributes().keySet().iterator();
iterator.hasNext();) {
+ key = (QName) iterator.next();
+
+ prefix = writer.getPrefix(key.getNamespaceURI());
+ if (prefix == null) {
+ prefix = key.getPrefix();
+
+ if (prefix != null) {
+ writer.setPrefix(prefix, key.getNamespaceURI());
+ }
+ }
+
+ if (prefix != null) {
+ writer.writeAttribute(prefix, key.getNamespaceURI(),
key.getLocalPart(), getAttribute(key));
+ prefix2ns.put(prefix, key.getNamespaceURI());
+
+ } else {
+ writer.writeAttribute(key.getNamespaceURI(),
key.getLocalPart(), getAttribute(key));
+ }
+ }
+
+ String prefiX;
+
+ for (Iterator iterator = prefix2ns.keySet().iterator();
iterator.hasNext();) {
+ prefiX = (String) iterator.next();
+ writer.writeNamespace(prefiX, (String) prefix2ns.get(prefiX));
}
-
+
PolicyComponent policyComponent;
for (Iterator iterator = getPolicyComponents().iterator(); iterator
@@ -74,10 +115,6 @@
return Constants.TYPE_POLICY;
}
- public void addAlternatives(PolicyAlternatives policyAlternatives) {
- policyComponents.add(policyAlternatives);
- }
-
public Iterator getAlternatives() {
return new PolicyIterator(this);
}
@@ -127,13 +164,10 @@
}
public void setId(String id) {
- addAttribute(
- new QName(Constants.URI_WSU_NS, Constants.ATTR_ID),
- id);
+ addAttribute(new QName(Constants.URI_WSU_NS, Constants.ATTR_ID), id);
}
public String getId() {
- return getAttribute(new QName(Constants.URI_WSU_NS,
- Constants.ATTR_ID));
+ return getAttribute(new QName(Constants.URI_WSU_NS,
Constants.ATTR_ID));
}
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyComponent.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyComponent.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyComponent.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyComponent.java
Tue Sep 26 12:33:33 2006
@@ -19,7 +19,7 @@
import javax.xml.stream.XMLStreamWriter;
/**
- * This is an interface which any component of the frame must implement.
+ * This is an interface which any component of the framework must implement.
*/
public interface PolicyComponent {
@@ -36,12 +36,19 @@
* Returns a short value which uniquely identify the type of the
* PolicyComponent.
*
- * @return PolicyComponent.POLICY for Policy type PolicyComponent
- * PolicyComponent.EXACTLYONE for ExactlyOne type PolicyComponent
- * PolicyComponent.All for All type PolicyComponent
- * PolicyComponent.ASSERTION for Assertion type PolicyComponent
+ * @return Constants.POLICY for Policy type PolicyComponent
+ * Constants.EXACTLYONE for ExactlyOne type PolicyComponent
+ * Constants.All for All type PolicyComponent
+ * Constants.ASSERTION for Assertion type PolicyComponent
*/
public short getType();
+ /**
+ * Returns true if the argument is equal to self.
+ *
+ * @param policyComponent the PolicyComponent to check whether self is
+ * logically equal or not
+ * @return ture if the argument is equal to self.
+ */
public boolean equal(PolicyComponent policyComponent);
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyEngine.java
Tue Sep 26 12:33:33 2006
@@ -16,7 +16,9 @@
package org.apache.neethi;
import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
import org.apache.neethi.builders.AssertionBuilder;
import org.apache.neethi.builders.xml.XmlPrimtiveAssertion;
@@ -82,7 +84,6 @@
return null;
}
-
public static PolicyReference getPolicyReferene(InputStream inputStream) {
try {
@@ -115,8 +116,8 @@
public static PolicyReference getPolicyReference(OMElement element) {
if (!(Constants.URI_POLICY_NS.equals(element.getNamespace()
- .getNamespaceURI()) && Constants.ELEM_POLICYREF
- .equals(element.getLocalName()))) {
+ .getNamespaceURI()) && Constants.ELEM_POLICYREF.equals(element
+ .getLocalName()))) {
throw new RuntimeException(
"Specified element is not a <wsp:PolicyReference .. />
element");
@@ -144,7 +145,33 @@
private static PolicyOperator processOperationElement(
OMElement operationElement, PolicyOperator operator) {
+ if (Constants.TYPE_POLICY == operator.getType()) {
+ Policy policyOperator = (Policy) operator;
+
+ OMAttribute attribute;
+ OMNamespace namespace;
+ QName key;
+
+ for (Iterator iterator = operationElement.getAllAttributes();
iterator.hasNext(); ) {
+ attribute = (OMAttribute) iterator.next();
+ namespace = attribute.getNamespace();
+
+ if (namespace == null) {
+ key = new QName(attribute.getLocalName());
+
+ } else if (namespace.getPrefix() == null) {
+ key = new QName(namespace.getNamespaceURI(),
attribute.getLocalName());
+
+ } else {
+ key = new QName(namespace.getNamespaceURI(),
attribute.getLocalName(), namespace.getPrefix());
+ }
+
+ policyOperator.addAttribute(key,
attribute.getAttributeValue());
+ }
+ }
+
OMElement childElement;
+
for (Iterator iterator = operationElement.getChildElements(); iterator
.hasNext();) {
@@ -153,13 +180,12 @@
if (Constants.URI_POLICY_NS.equals(childElement.getNamespace()
.getNamespaceURI())) {
- if (Constants.ELEM_POLICY.equals(childElement
- .getLocalName())) {
+ if (Constants.ELEM_POLICY.equals(childElement.getLocalName()))
{
operator
.addPolicyComponent(getPolicyOperator(childElement));
- } else if (Constants.ELEM_EXACTLYONE
- .equals(childElement.getLocalName())) {
+ } else if (Constants.ELEM_EXACTLYONE.equals(childElement
+ .getLocalName())) {
operator
.addPolicyComponent(getExactlyOneOperator(childElement));
@@ -169,23 +195,12 @@
} else if (Constants.ELEM_POLICYREF.equals(childElement
.getLocalName())) {
-
operator.addPolicyComponent(getPolicyReference(childElement));
+ operator
+
.addPolicyComponent(getPolicyReference(childElement));
}
} else {
-
- AssertionBuilder builder = factory.getBuilder(childElement
- .getQName());
-
- if (builder == null) {
- XmlPrimtiveAssertion xmlPrimtiveAssertion = new
XmlPrimtiveAssertion(
- childElement);
- operator.addPolicyComponent(xmlPrimtiveAssertion);
-
- } else {
- operator.addPolicyComponent(builder.build(childElement,
- factory));
- }
+ operator.addPolicyComponent(factory.build(childElement));
}
}
return operator;
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyOperator.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyOperator.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyOperator.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyOperator.java
Tue Sep 26 12:33:33 2006
@@ -36,20 +36,6 @@
* @return the List of PolicyComponents that this PolicyOperator contains.
*/
public List getPolicyComponents();
-
- /**
- * Returns a PolicyComponent which is the normalized format of this
- * PolicyOperator.
- *
- * @param deep
- * the deep flag indicates whether the assertion it contains
- * should be normalized or not. Merge and Intersect will use a
- * partial normalization since partial normalization is
- * sufficient for most high level processing of Policies will
- * @return
- */
-// public PolicyComponent normalize(boolean deep);
-
/**
* Returns true if the PolicyOperator doesn't contain any PolicyComponents.
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyReference.java
Tue Sep 26 12:33:33 2006
@@ -18,6 +18,9 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
+/**
+ * PolicyReference is a wrapper that holds explict PolicyReferences.
+ */
public class PolicyReference implements PolicyComponent {
private String uri;
@@ -56,5 +59,4 @@
throw new UnsupportedOperationException();
}
-
}
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistry.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistry.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistry.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistry.java
Tue Sep 26 12:33:33 2006
@@ -15,6 +15,10 @@
*/
package org.apache.neethi;
+/**
+ * PolicyRegistry contains (URI,Policy) pairs and it is used to resolve
explicit Policy references.
+ *
+ */
public interface PolicyRegistry {
public void register(String key, Policy policy);
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java?view=diff&rev=450162&r1=450161&r2=450162
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/neethi/PolicyRegistryImpl.java
Tue Sep 26 12:33:33 2006
@@ -17,6 +17,9 @@
import java.util.HashMap;
+/**
+ * Provides a default implementation of PolicyRegistry interface.
+ */
public class PolicyRegistryImpl implements PolicyRegistry {
private PolicyRegistry parent = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]