Author: sanka
Date: Tue May 9 22:36:31 2006
New Revision: 405643
URL: http://svn.apache.org/viewcvs?rev=405643&view=rev
Log:
renaming AndCompositeAssertion to All and XorCompositeAssertion to ExactlyOne
Modified:
webservices/commons/trunk/modules/neethi/examples/wsse/src/secParser/WSSPolicyProcessor.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Assertion.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyReference.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PrimitiveAssertion.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/attachment/WSDLPolicyProcessor.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/OMPolicyReader.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/PolicyUtil.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/StAXPolicyWriter.java
webservices/commons/trunk/modules/neethi/test/org/apache/ws/policy/util/PolicyComparator.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_Policy.java
Modified:
webservices/commons/trunk/modules/neethi/examples/wsse/src/secParser/WSSPolicyProcessor.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/examples/wsse/src/secParser/WSSPolicyProcessor.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/examples/wsse/src/secParser/WSSPolicyProcessor.java
(original)
+++
webservices/commons/trunk/modules/neethi/examples/wsse/src/secParser/WSSPolicyProcessor.java
Tue May 9 22:36:31 2006
@@ -31,11 +31,11 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.All;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.Assertion;
import org.apache.ws.policy.PrimitiveAssertion;
-import org.apache.ws.policy.XorCompositeAssertion;
+import org.apache.ws.policy.ExactlyOne;
import org.apache.ws.policy.util.PolicyReader;
import org.apache.ws.policy.util.PolicyFactory;
@@ -182,7 +182,7 @@
throw new RuntimeException("Policy is not in normalized
format");
}
- XorCompositeAssertion xor = (XorCompositeAssertion)
policy.getTerms()
+ ExactlyOne xor = (ExactlyOne) policy.getTerms()
.get(0);
List listOfPolicyAlternatives = xor.getTerms();
@@ -190,7 +190,7 @@
int numberOfAlternatives = listOfPolicyAlternatives.size();
for (int i = 0; !success && i < numberOfAlternatives; i++) {
- AndCompositeAssertion aPolicyAlternative =
(AndCompositeAssertion) listOfPolicyAlternatives
+ All aPolicyAlternative = (All) listOfPolicyAlternatives
.get(i);
List listOfAssertions = aPolicyAlternative.getTerms();
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Assertion.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Assertion.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Assertion.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Assertion.java
Tue May 9 22:36:31 2006
@@ -27,20 +27,20 @@
*/
public interface Assertion {
- /** Defines the short value for Primitive Assertions */
- public static final short PRIMITIVE_TYPE = 0x1;
+ /** Defines the short value for Primitive assertions */
+ public static final short PRIMITIVE = 0x1;
- /** Defines the short value for ANDCompositeAssertion */
- public static final short COMPOSITE_AND_TYPE = 0x2;
+ /** Defines the short value for All assertion */
+ public static final short ALL = 0x2;
- /** Defines the short value for XORCompositeAssertion */
- public static final short COMPOSITE_XOR_TYPE = 0x3;
+ /** Defines the short value for ExactlyOne assertion */
+ public static final short EXACTLY_ONE = 0x3;
/** Defines the short value for Policy Assertion */
- public static final short COMPOSITE_POLICY_TYPE = 0x4;
+ public static final short POLICY = 0x4;
/** Defines the short value for PolicyReferece Assertion */
- public static final short POLIY_REFERCE_TYPE = 0x5;
+ public static final short POLICY_REF = 0x5;
/**
* Returns a new assertion which is the normalized form of this
assertion.
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java
Tue May 9 22:36:31 2006
@@ -76,7 +76,7 @@
*/
public void setBase(String xmlBase) {
addAttribute(new QName(PolicyConstants.XML_NAMESPACE_URI,
- PolicyConstants.WS_POLICY_BASE), xmlBase);
+ PolicyConstants.POLICY_BASE), xmlBase);
}
/**
@@ -88,7 +88,7 @@
public String getBase() {
return (String) getAttribute(new QName(
PolicyConstants.XML_NAMESPACE_URI,
- PolicyConstants.WS_POLICY_BASE));
+ PolicyConstants.POLICY_BASE));
}
/**
@@ -97,8 +97,8 @@
* @param id
*/
public void setId(String id) {
- addAttribute(new QName(PolicyConstants.WS_POLICY_NAMESPACE_URI,
- PolicyConstants.WS_POLICY_ID), id);
+ addAttribute(new QName(PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.POLICY_ID), id);
}
/**
@@ -108,8 +108,8 @@
*/
public String getId() {
return (String) getAttribute(new QName(
- PolicyConstants.WS_POLICY_NAMESPACE_URI,
- PolicyConstants.WS_POLICY_ID));
+ PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.POLICY_ID));
}
/**
@@ -118,7 +118,7 @@
* @param name
*/
public void setName(String name) {
- addAttribute(new QName("", PolicyConstants.WS_POLICY_NAME), name);
+ addAttribute(new QName("", PolicyConstants.POLICY_NAME), name);
}
/**
@@ -128,7 +128,7 @@
*/
public String getName() {
return (String) getAttribute(new QName("",
- PolicyConstants.WS_POLICY_NAME));
+ PolicyConstants.POLICY_NAME));
}
/**
@@ -164,8 +164,8 @@
String id = getId();
Policy policy = new Policy(xmlBase, id);
- AndCompositeAssertion AND = new AndCompositeAssertion();
- XorCompositeAssertion XOR = new XorCompositeAssertion();
+ All all = new All();
+ ExactlyOne exactlyOne = new ExactlyOne();
ArrayList childAndTermList = new ArrayList();
ArrayList childXorTermList = new ArrayList();
@@ -178,27 +178,27 @@
term = term.normalize(reg);
if (term instanceof Policy) {
- XorCompositeAssertion Xor = (XorCompositeAssertion) ((Policy)
term)
+ ExactlyOne anExactlyOne = (ExactlyOne) ((Policy) term)
.getTerms().get(0);
- if (Xor.size() != 1) {
- term = Xor;
+ if (anExactlyOne.size() != 1) {
+ term = anExactlyOne;
} else {
- AND
- .addTerms(((AndCompositeAssertion) Xor.getTerms()
+ all
+ .addTerms(((All) anExactlyOne.getTerms()
.get(0)).getTerms());
continue;
}
}
- if (term instanceof XorCompositeAssertion) {
+ if (term instanceof ExactlyOne) {
- if (((XorCompositeAssertion) term).isEmpty()) {
- XorCompositeAssertion emptyXor = new
XorCompositeAssertion();
- emptyXor.setNormalized(true);
+ if (((ExactlyOne) term).isEmpty()) {
+ ExactlyOne tmpExactlyOne = new ExactlyOne();
+ tmpExactlyOne.setNormalized(true);
- policy.addTerm(emptyXor);
+ policy.addTerm(tmpExactlyOne);
policy.setNormalized(true);
return policy;
@@ -208,48 +208,48 @@
continue;
}
- if (term instanceof AndCompositeAssertion) {
+ if (term instanceof All) {
- if (((AndCompositeAssertion) term).isEmpty()) {
- AndCompositeAssertion emptyAnd = new
AndCompositeAssertion();
- XOR.addTerm(emptyAnd);
+ if (((All) term).isEmpty()) {
+ All emptyAnd = new All();
+ exactlyOne.addTerm(emptyAnd);
} else {
- AND.addTerms(((AndCompositeAssertion) term).getTerms());
+ all.addTerms(((All) term).getTerms());
}
continue;
}
- AND.addTerm((Assertion) term);
+ all.addTerm((Assertion) term);
}
// processing child-XORCompositeAssertions
if (childXorTermList.size() > 1) {
- XOR.addTerms(Policy.crossProduct(childXorTermList, 0));
+ exactlyOne.addTerms(Policy.crossProduct(childXorTermList, 0));
} else if (childXorTermList.size() == 1) {
- Assertion xorTerm = (Assertion) childXorTermList.get(0);
- XOR.addTerms(xorTerm.getTerms());
+ Assertion tmpExactlyOne = (Assertion) childXorTermList.get(0);
+ exactlyOne.addTerms(tmpExactlyOne.getTerms());
}
if (childXorTermList.isEmpty()) {
- XorCompositeAssertion xor = new XorCompositeAssertion();
+ ExactlyOne tmpExactlyOne = new ExactlyOne();
- xor.addTerm(AND);
- policy.addTerm(xor);
+ tmpExactlyOne.addTerm(all);
+ policy.addTerm(tmpExactlyOne);
policy.setNormalized(true);
return policy;
}
- List primTerms = AND.getTerms();
- Iterator andTerms = XOR.getTerms().iterator();
+ List primTerms = all.getTerms();
+ Iterator alls = exactlyOne.getTerms().iterator();
- while (andTerms.hasNext()) {
- Assertion anAndTerm = (Assertion) andTerms.next();
+ while (alls.hasNext()) {
+ Assertion anAndTerm = (Assertion) alls.next();
anAndTerm.addTerms(primTerms);
}
- policy.addTerm(XOR);
+ policy.addTerm(exactlyOne);
policy.setNormalized(true);
return policy;
}
@@ -267,30 +267,30 @@
short type = target.getType();
switch (type) {
- case Assertion.COMPOSITE_POLICY_TYPE: {
- Policy nPOLICY = new Policy();
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
- .get(0)).intersect((XorCompositeAssertion) target
+ case Assertion.POLICY: {
+ Policy newPolicy = new Policy();
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
+ .get(0)).intersect((ExactlyOne) target
.getTerms().get(0)));
- return nPOLICY;
+ return newPolicy;
}
- case Assertion.COMPOSITE_XOR_TYPE: {
- Policy nPOLICY = new Policy();
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
+ case Assertion.EXACTLY_ONE: {
+ Policy newPolicy = new Policy();
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
.get(0)).intersect(target));
- return nPOLICY;
+ return newPolicy;
}
- case Assertion.COMPOSITE_AND_TYPE: {
- Policy nPOLICY = new Policy();
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
+ case Assertion.ALL: {
+ Policy newPolicy = new Policy();
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
.get(0)).intersect(target));
- return nPOLICY;
+ return newPolicy;
}
- case Assertion.PRIMITIVE_TYPE: {
- Policy nPOLICY = new Policy();
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
+ case Assertion.PRIMITIVE: {
+ Policy newPolicy = new Policy();
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
.get(0)).intersect(target));
- return nPOLICY;
+ return newPolicy;
}
default: {
@@ -310,7 +310,7 @@
return normalizedMe.merge(assertion, reg);
}
- Policy nPOLICY = new Policy();
+ Policy newPolicy = new Policy();
Assertion target = (assertion.isNormalized()) ? assertion : assertion
.normalize(reg);
@@ -318,29 +318,29 @@
switch (type) {
- case Assertion.COMPOSITE_POLICY_TYPE: {
+ case Assertion.POLICY: {
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
- .get(0)).merge((XorCompositeAssertion) target.getTerms()
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
+ .get(0)).merge((ExactlyOne) target.getTerms()
.get(0)));
- return nPOLICY;
+ return newPolicy;
}
- case Assertion.COMPOSITE_XOR_TYPE: {
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
+ case Assertion.EXACTLY_ONE: {
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
.get(0)).merge(target));
- return nPOLICY;
+ return newPolicy;
}
- case Assertion.COMPOSITE_AND_TYPE: {
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
+ case Assertion.ALL: {
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
.get(0)).merge(target));
- return nPOLICY;
+ return newPolicy;
}
- case Assertion.PRIMITIVE_TYPE: {
- nPOLICY.addTerm(((XorCompositeAssertion) normalizedMe.getTerms()
+ case Assertion.PRIMITIVE: {
+ newPolicy.addTerm(((ExactlyOne) normalizedMe.getTerms()
.get(0)).merge(target));
- return nPOLICY;
+ return newPolicy;
}
default: {
@@ -355,7 +355,7 @@
* Returns a short value which indicates this is a Policy.
*/
public final short getType() {
- return Assertion.COMPOSITE_POLICY_TYPE;
+ return Assertion.POLICY;
}
/**
@@ -431,13 +431,13 @@
protected static ArrayList crossProduct(ArrayList allTerms, int index) {
ArrayList result = new ArrayList();
- XorCompositeAssertion firstTerm = (XorCompositeAssertion) allTerms
+ ExactlyOne firstTerm = (ExactlyOne) allTerms
.get(index);
ArrayList restTerms;
if (allTerms.size() == ++index) {
restTerms = new ArrayList();
- AndCompositeAssertion newTerm = new AndCompositeAssertion();
+ All newTerm = new All();
restTerms.add(newTerm);
} else
restTerms = crossProduct(allTerms, index);
@@ -448,7 +448,7 @@
Iterator restTermsItr = restTerms.iterator();
while (restTermsItr.hasNext()) {
Assertion restTerm = (Assertion) restTermsItr.next();
- AndCompositeAssertion newTerm = new AndCompositeAssertion();
+ All newTerm = new All();
newTerm.addTerms(assertion.getTerms());
newTerm.addTerms(restTerm.getTerms());
result.add(newTerm);
@@ -471,7 +471,7 @@
private class PolicyIterator implements java.util.Iterator {
- private XorCompositeAssertion XOR = null;
+ private ExactlyOne exactlyOne = null;
private int currentIndex = 0;
@@ -480,18 +480,18 @@
policy = (Policy) policy.normalize();
}
- XOR = (XorCompositeAssertion) policy.getTerms().get(0);
+ exactlyOne = (ExactlyOne) policy.getTerms().get(0);
}
public boolean hasNext() {
- return XOR.size() > currentIndex;
+ return exactlyOne.size() > currentIndex;
}
public Object next() {
- AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms()
+ All all = (All) exactlyOne.getTerms()
.get(currentIndex);
currentIndex++;
- return AND.getTerms();
+ return all.getTerms();
}
public void remove() {
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java
Tue May 9 22:36:31 2006
@@ -23,25 +23,25 @@
public interface PolicyConstants {
/** Tag name of AndComposteAssertion */
- public static final String AND_COMPOSITE_ASSERTION = "All";
+ public static final String ALL = "All";
/** Tag name of XorCompositeAssertion */
- public static final String XOR_COMPOSITE_ASSERTION = "ExactlyOne";
+ public static final String EXACTLY_ONE = "ExactlyOne";
/** Tag name of Policy */
- public static final String WS_POLICY = "Policy";
+ public static final String POLICY = "Policy";
/** Prefix of WS-Policy namespace */
- public static final String WS_POLICY_PREFIX = "wsp";
+ public static final String POLICY_PREFIX = "wsp";
/** Prefix of WSU namespace */
public static final String WSU_NAMESPACE_PREFIX = "wsu";
/** Tag name of PolicyReference */
- public static final String WS_POLICY_REFERENCE = "PolicyReference";
+ public static final String POLICY_REFERENCE = "PolicyReference";
/** Namespace of WS-Policy */
- public static final String WS_POLICY_NAMESPACE_URI =
"http://schemas.xmlsoap.org/ws/2004/09/policy";
+ public static final String POLICY_NAMESPACE_URI =
"http://schemas.xmlsoap.org/ws/2004/09/policy";
/** Namespace of WSU */
public static final String WSU_NAMESPACE_URI =
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
@@ -50,13 +50,13 @@
public static final String XML_NAMESPACE_URI =
"http://www.w3.org/XML/1998/namespace";
/** Policy Id attribute * */
- public static final String WS_POLICY_ID = "Id";
+ public static final String POLICY_ID = "Id";
/** Policy Name attribute * */
- public static final String WS_POLICY_NAME = "Name";
+ public static final String POLICY_NAME = "Name";
/** Policy base attribute * */
- public static final String WS_POLICY_BASE = "base";
+ public static final String POLICY_BASE = "base";
/** Namespace of xmlns prefix when defining namespace aliases */
public static final String NAMESPACE_XMLNS =
"http://www.w3.org/2000/xmlns/";
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyReference.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyReference.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyReference.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyReference.java
Tue May 9 22:36:31 2006
@@ -148,7 +148,7 @@
* @return a short value to indicate that this is a PolicyReference.
*/
public final short getType() {
- return Assertion.POLIY_REFERCE_TYPE;
+ return Assertion.POLICY_REF;
}
public void setSource(String source) {
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PrimitiveAssertion.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PrimitiveAssertion.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PrimitiveAssertion.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PrimitiveAssertion.java
Tue May 9 22:36:31 2006
@@ -97,18 +97,18 @@
PrimitiveAssertion self = (PrimitiveAssertion) normalizedMe;
if (!self.getName().equals(arg.getName())) {
- return new XorCompositeAssertion(); // no bahaviour is
admisible
+ return new ExactlyOne(); // no bahaviour is admisible
}
if (self.getTerms().isEmpty() && arg.getTerms().isEmpty()) {
- AndCompositeAssertion assertion2 = new
AndCompositeAssertion();
+ All assertion2 = new All();
assertion2.addTerm(self);
assertion2.addTerm(arg);
return assertion2;
}
if (self.getTerms().isEmpty() || arg.getTerms().isEmpty()) {
- return new XorCompositeAssertion(); // no
+ return new ExactlyOne(); // no
}
List argChildTerms;
@@ -157,18 +157,18 @@
}
if (!found) {
- return new XorCompositeAssertion();
+ return new ExactlyOne();
}
- if (PRIMITIVE_A.intersect(PRIMITIVE_B) instanceof
XorCompositeAssertion) {
- return new XorCompositeAssertion();
+ if (PRIMITIVE_A.intersect(PRIMITIVE_B) instanceof
ExactlyOne) {
+ return new ExactlyOne();
}
}
- AndCompositeAssertion andCompositeAssertion = new
AndCompositeAssertion();
- andCompositeAssertion.addTerm(arg);
- andCompositeAssertion.addTerm(self);
- return andCompositeAssertion;
+ All all = new All();
+ all.addTerm(arg);
+ all.addTerm(self);
+ return all;
}
public Assertion intersect(Assertion assertion)
@@ -196,10 +196,10 @@
* both self and the argument are primitive assertions. Hence
both
* should be wrapped in an AndCompositeType
*/
- AndCompositeAssertion AND = new AndCompositeAssertion();
- AND.addTerm(target);
- AND.addTerm(normalizedMe);
- return AND;
+ All all = new All();
+ all.addTerm(target);
+ all.addTerm(normalizedMe);
+ return all;
}
public Assertion merge(Assertion assertion) {
@@ -218,26 +218,26 @@
}
if (isOptional()) {
- XorCompositeAssertion XOR = new XorCompositeAssertion();
- AndCompositeAssertion AND = new AndCompositeAssertion();
+ ExactlyOne exactlyOne = new ExactlyOne();
+ All all = new All();
- PrimitiveAssertion PRIM = getSelfWithoutTerms();
- PRIM.removeAttribute(new QName(
-
PolicyConstants.WS_POLICY_NAMESPACE_URI, "Optional"));
- PRIM.setOptional(false);
- PRIM.setTerms(getTerms());
-
- AND.addTerm(PRIM);
- XOR.addTerm(AND);
- XOR.addTerm(new AndCompositeAssertion());
+ PrimitiveAssertion prim = getSelfWithoutTerms();
+ prim.removeAttribute(new QName(
+ PolicyConstants.POLICY_NAMESPACE_URI,
"Optional"));
+ prim.setOptional(false);
+ prim.setTerms(getTerms());
+
+ all.addTerm(prim);
+ exactlyOne.addTerm(all);
+ exactlyOne.addTerm(new All());
- return XOR.normalize(reg);
+ return exactlyOne.normalize(reg);
}
if (getTerms().isEmpty()) {
- PrimitiveAssertion PRIM = getSelfWithoutTerms();
- PRIM.setNormalized(true);
- return PRIM;
+ PrimitiveAssertion pirm = getSelfWithoutTerms();
+ pirm.setNormalized(true);
+ return pirm;
}
ArrayList policyTerms = new ArrayList();
@@ -261,54 +261,54 @@
}
if (policyTerms.isEmpty()) {
- PrimitiveAssertion PRIM = getSelfWithoutTerms();
- PRIM.setTerms(getTerms());
- PRIM.setNormalized(true);
- return PRIM;
+ PrimitiveAssertion prim = getSelfWithoutTerms();
+ prim.setTerms(getTerms());
+ prim.setNormalized(true);
+ return prim;
}
- Policy policyTerm = PolicyUtil.getSinglePolicy(policyTerms,
reg);
- Assertion xorTerm = (XorCompositeAssertion)
policyTerm.getTerms()
+ Policy policy = PolicyUtil.getSinglePolicy(policyTerms, reg);
+ Assertion exactlyOne = (ExactlyOne) policy.getTerms()
.get(0);
- List ANDs = xorTerm.getTerms();
+ List alls = exactlyOne.getTerms();
- if (ANDs.size() == 0) {
- return new XorCompositeAssertion();
+ if (alls.size() == 0) {
+ return new ExactlyOne();
}
- if (ANDs.size() == 1) {
- ((AndCompositeAssertion)
ANDs.get(0)).addTerms(nonPolicyTerms);
- PrimitiveAssertion PRIM = getSelfWithoutTerms();
- PRIM.addTerm(policyTerm);
- return PRIM;
+ if (alls.size() == 1) {
+ ((All) alls.get(0)).addTerms(nonPolicyTerms);
+ PrimitiveAssertion prim = getSelfWithoutTerms();
+ prim.addTerm(policy);
+ return prim;
}
- Policy nPOLICY = new Policy();
- XorCompositeAssertion nXOR = new XorCompositeAssertion();
- nPOLICY.addTerm(nXOR);
+ Policy newPolicy = new Policy();
+ ExactlyOne newExactlyOne = new ExactlyOne();
+ newPolicy.addTerm(newExactlyOne);
- PrimitiveAssertion nPRIM;
- Iterator iterator2 = ANDs.iterator();
+ PrimitiveAssertion newPrim;
+ Iterator iterator2 = alls.iterator();
ArrayList list;
while (iterator2.hasNext()) {
- nPRIM = getSelfWithoutTerms();
+ newPrim = getSelfWithoutTerms();
list = new ArrayList();
- list.addAll(((AndCompositeAssertion)
iterator2.next()).getTerms());
+ list.addAll(((All) iterator2.next()).getTerms());
if (!nonPolicyTerms.isEmpty()) {
list.addAll(nonPolicyTerms);
}
- nPRIM.addTerm(getSinglePolicy(list));
- AndCompositeAssertion AND = new AndCompositeAssertion();
- AND.addTerm(nPRIM);
- nXOR.addTerm(AND);
+ newPrim.addTerm(getSinglePolicy(list));
+ All all = new All();
+ all.addTerm(newPrim);
+ newExactlyOne.addTerm(all);
}
- nPOLICY.setNormalized(true);
- return nPOLICY;
+ newPolicy.setNormalized(true);
+ return newPolicy;
}
private PrimitiveAssertion getSelfWithoutTerms() {
@@ -420,27 +420,27 @@
private Policy getSinglePolicy(List childTerms) {
Policy policy = new Policy();
- XorCompositeAssertion xor = new XorCompositeAssertion();
- AndCompositeAssertion and = new AndCompositeAssertion();
- and.addTerms(childTerms);
- xor.addTerm(and);
- policy.addTerm(xor);
+ ExactlyOne exactlyOne = new ExactlyOne();
+ All all = new All();
+ all.addTerms(childTerms);
+ exactlyOne.addTerm(all);
+ policy.addTerm(exactlyOne);
return policy;
}
private boolean isEmptyPolicy(Policy policy) {
- XorCompositeAssertion xor = (XorCompositeAssertion)
policy.getTerms()
+ ExactlyOne exactlyOne = (ExactlyOne) policy.getTerms()
.get(0);
- return xor.isEmpty();
+ return exactlyOne.isEmpty();
}
private List getTerms(Policy policy) {
- return ((AndCompositeAssertion) ((XorCompositeAssertion) policy
+ return ((All) ((ExactlyOne) policy
.getTerms().get(0)).getTerms().get(0)).getTerms();
}
public final short getType() {
- return Assertion.PRIMITIVE_TYPE;
+ return Assertion.PRIMITIVE;
}
}
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/attachment/WSDLPolicyProcessor.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/attachment/WSDLPolicyProcessor.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/attachment/WSDLPolicyProcessor.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/attachment/WSDLPolicyProcessor.java
Tue May 9 22:36:31 2006
@@ -54,11 +54,11 @@
public class WSDLPolicyProcessor {
private static final QName POLICY = new QName(
- PolicyConstants.WS_POLICY_NAMESPACE_URI,
PolicyConstants.WS_POLICY);
+ PolicyConstants.POLICY_NAMESPACE_URI,
PolicyConstants.POLICY);
private static final QName POLICY_REF = new QName(
- PolicyConstants.WS_POLICY_NAMESPACE_URI,
- PolicyConstants.WS_POLICY_REFERENCE);
+ PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.POLICY_REFERENCE);
Definition wsdl4jDefinition = null;
@@ -357,7 +357,7 @@
private List getPoliciesAsExtAttributes(Map extAttributes) {
ArrayList policyList = new ArrayList();
QName PolicyURIs = (QName) extAttributes.get(new QName(
- PolicyConstants.WS_POLICY_NAMESPACE_URI,
"PolicyURIs"));
+ PolicyConstants.POLICY_NAMESPACE_URI,
"PolicyURIs"));
if (PolicyURIs != null) {
String[] URIs = PolicyURIs.getLocalPart().split(" ");
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java
Tue May 9 22:36:31 2006
@@ -35,13 +35,13 @@
import org.w3c.dom.NamedNodeMap;
import org.xml.sax.SAXException;
-import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.All;
import org.apache.ws.policy.Assertion;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PolicyReference;
import org.apache.ws.policy.PrimitiveAssertion;
import org.apache.ws.policy.PolicyConstants;
-import org.apache.ws.policy.XorCompositeAssertion;
+import org.apache.ws.policy.ExactlyOne;
/**
* DOMPolicyReader implements PolicyReader and provides different methods to
@@ -80,20 +80,20 @@
String namespace = element.getNamespaceURI();
String localName = element.getLocalName();
- if (!(namespace.equals(PolicyConstants.WS_POLICY_NAMESPACE_URI))) {
+ if (!(namespace.equals(PolicyConstants.POLICY_NAMESPACE_URI))) {
return readPrimitiveAssertion(element);
}
- if (localName.equals(PolicyConstants.WS_POLICY)) {
+ if (localName.equals(PolicyConstants.POLICY)) {
return readPolicy(element);
- } else if (localName.equals(PolicyConstants.AND_COMPOSITE_ASSERTION)) {
+ } else if (localName.equals(PolicyConstants.ALL)) {
return readAndComposite(element);
- } else if (localName.equals(PolicyConstants.XOR_COMPOSITE_ASSERTION)) {
+ } else if (localName.equals(PolicyConstants.EXACTLY_ONE)) {
return readXorComposite(element);
- } else if (localName.equals(PolicyConstants.WS_POLICY_REFERENCE)) {
+ } else if (localName.equals(PolicyConstants.POLICY_REFERENCE)) {
return readPolicyReference(element);
} else {
@@ -118,14 +118,14 @@
return policy;
}
- private AndCompositeAssertion readAndComposite(Element element) {
- AndCompositeAssertion andCompositeAssertion = new
AndCompositeAssertion();
+ private All readAndComposite(Element element) {
+ All andCompositeAssertion = new All();
andCompositeAssertion.addTerms(readTerms(element));
return andCompositeAssertion;
}
- private XorCompositeAssertion readXorComposite(Element element) {
- XorCompositeAssertion xorCompositeAssertion = new
XorCompositeAssertion();
+ private ExactlyOne readXorComposite(Element element) {
+ ExactlyOne xorCompositeAssertion = new ExactlyOne();
xorCompositeAssertion.addTerms(readTerms(element));
return xorCompositeAssertion;
}
@@ -153,7 +153,7 @@
result.setAttributes(getAttributes(element));
String isOptional = result.getAttribute(new QName(
- PolicyConstants.WS_POLICY_NAMESPACE_URI, "Optional"));
+ PolicyConstants.POLICY_NAMESPACE_URI, "Optional"));
if (isOptional != null) {
if (isOptional.equalsIgnoreCase("true")) {
@@ -174,9 +174,9 @@
if (nodeType == Node.ELEMENT_NODE) {
Element childElement = (Element) node;
if (childElement.getNamespaceURI().equals(
- PolicyConstants.WS_POLICY_NAMESPACE_URI)
+ PolicyConstants.POLICY_NAMESPACE_URI)
&& childElement.getLocalName().equals(
- PolicyConstants.WS_POLICY)) {
+ PolicyConstants.POLICY)) {
Policy policy = readPolicy(childElement);
result.addTerm(policy);
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/OMPolicyReader.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/OMPolicyReader.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/OMPolicyReader.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/OMPolicyReader.java
Tue May 9 22:36:31 2006
@@ -21,13 +21,13 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.All;
import org.apache.ws.policy.Assertion;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PolicyConstants;
import org.apache.ws.policy.PolicyReference;
import org.apache.ws.policy.PrimitiveAssertion;
-import org.apache.ws.policy.XorCompositeAssertion;
+import org.apache.ws.policy.ExactlyOne;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
@@ -69,20 +69,20 @@
String namespace = element.getNamespace().getName();
String localName = element.getLocalName();
- if
(!(namespace.equals(PolicyConstants.WS_POLICY_NAMESPACE_URI))) {
+ if (!(namespace.equals(PolicyConstants.POLICY_NAMESPACE_URI))) {
return readPrimitiveAssertion(element);
}
- if (localName.equals(PolicyConstants.WS_POLICY)) {
+ if (localName.equals(PolicyConstants.POLICY)) {
return readPolicy(element);
- } else if
(localName.equals(PolicyConstants.AND_COMPOSITE_ASSERTION)) {
+ } else if (localName.equals(PolicyConstants.ALL)) {
return readAndComposite(element);
- } else if
(localName.equals(PolicyConstants.XOR_COMPOSITE_ASSERTION)) {
+ } else if (localName.equals(PolicyConstants.EXACTLY_ONE)) {
return readXorComposite(element);
- } else if
(localName.equals(PolicyConstants.WS_POLICY_REFERENCE)) {
+ } else if (localName.equals(PolicyConstants.POLICY_REFERENCE)) {
return readPolicyReference(element);
} else {
@@ -104,14 +104,14 @@
return policy;
}
- private AndCompositeAssertion readAndComposite(OMElement element) {
- AndCompositeAssertion andCompositeAssertion = new
AndCompositeAssertion();
+ private All readAndComposite(OMElement element) {
+ All andCompositeAssertion = new All();
andCompositeAssertion.addTerms(readTerms(element));
return andCompositeAssertion;
}
- private XorCompositeAssertion readXorComposite(OMElement element) {
- XorCompositeAssertion xorCompositeAssertion = new
XorCompositeAssertion();
+ private ExactlyOne readXorComposite(OMElement element) {
+ ExactlyOne xorCompositeAssertion = new ExactlyOne();
xorCompositeAssertion.addTerms(readTerms(element));
return xorCompositeAssertion;
}
@@ -128,7 +128,7 @@
result.setAttributes(getAttributes(element));
String isOptional = result.getAttribute(new QName(
- PolicyConstants.WS_POLICY_NAMESPACE_URI,
"Optional"));
+ PolicyConstants.POLICY_NAMESPACE_URI,
"Optional"));
result.setOptional(new Boolean(isOptional).booleanValue());
// setting the text value ..
@@ -145,9 +145,9 @@
OMElement childElement = (OMElement)
childElements.next();
if (childElement.getNamespace().getName().equals(
- PolicyConstants.WS_POLICY_NAMESPACE_URI)
+ PolicyConstants.POLICY_NAMESPACE_URI)
&& childElement.getLocalName().equals(
-
PolicyConstants.WS_POLICY)) {
+
PolicyConstants.POLICY)) {
Policy policy = readPolicy(childElement);
result.addTerm(policy);
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/PolicyUtil.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/PolicyUtil.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/PolicyUtil.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/PolicyUtil.java
Tue May 9 22:36:31 2006
@@ -21,10 +21,10 @@
import javax.xml.namespace.QName;
-import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.All;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PrimitiveAssertion;
-import org.apache.ws.policy.XorCompositeAssertion;
+import org.apache.ws.policy.ExactlyOne;
/**
* WSPolicyUtil contains several utility methods for policy manipulations.
@@ -72,9 +72,9 @@
policy = (Policy) policy.normalize();
}
- XorCompositeAssertion xorTerm = (XorCompositeAssertion) policy
+ ExactlyOne xorTerm = (ExactlyOne) policy
.getTerms().get(0);
- AndCompositeAssertion andTerm = (AndCompositeAssertion) xorTerm
+ All andTerm = (All) xorTerm
.getTerms().get(0);
return andTerm.getTerms();
@@ -99,8 +99,8 @@
public static Policy getPolicy(List terms) {
Policy policyTerm = new Policy();
- XorCompositeAssertion xorTerm = new XorCompositeAssertion();
- AndCompositeAssertion andTerm = new AndCompositeAssertion();
+ ExactlyOne xorTerm = new ExactlyOne();
+ All andTerm = new All();
andTerm.addTerms(terms);
xorTerm.addTerm(andTerm);
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/StAXPolicyWriter.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/StAXPolicyWriter.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/StAXPolicyWriter.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/StAXPolicyWriter.java
Tue May 9 22:36:31 2006
@@ -27,13 +27,13 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.All;
import org.apache.ws.policy.Assertion;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PolicyConstants;
import org.apache.ws.policy.PolicyReference;
import org.apache.ws.policy.PrimitiveAssertion;
-import org.apache.ws.policy.XorCompositeAssertion;
+import org.apache.ws.policy.ExactlyOne;
/**
* StAXPolicyWriter implements PolicyWriter and provides different methods to
@@ -64,20 +64,20 @@
public void writePolicy(Policy policy, XMLStreamWriter writer)
throws XMLStreamException {
String writerPrefix = writer
-
.getPrefix(PolicyConstants.WS_POLICY_NAMESPACE_URI);
+
.getPrefix(PolicyConstants.POLICY_NAMESPACE_URI);
if (writerPrefix != null) {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_NAMESPACE_URI,
- PolicyConstants.WS_POLICY);
+
writer.writeStartElement(PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.POLICY);
} else {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_PREFIX,
- PolicyConstants.WS_POLICY,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.writeNamespace(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.setPrefix(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
+ writer.writeStartElement(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.writeNamespace(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.setPrefix(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
}
@@ -136,8 +136,8 @@
if (assertion instanceof PrimitiveAssertion) {
writePrimitiveAssertion((PrimitiveAssertion) assertion,
writer);
- } else if (assertion instanceof XorCompositeAssertion) {
- writeXorCompositeAssertion((XorCompositeAssertion)
assertion,
+ } else if (assertion instanceof ExactlyOne) {
+ writeXorCompositeAssertion((ExactlyOne) assertion,
writer);
} else if (assertion instanceof PolicyReference) {
@@ -145,8 +145,8 @@
} else if (assertion instanceof Policy) {
writePolicy((Policy) assertion, writer);
- } else if (assertion instanceof AndCompositeAssertion) {
- writeAndCompositeAssertion((AndCompositeAssertion)
assertion,
+ } else if (assertion instanceof All) {
+ writeAndCompositeAssertion((All) assertion,
writer);
} else {
@@ -154,24 +154,24 @@
}
}
- private void writeAndCompositeAssertion(AndCompositeAssertion assertion,
+ private void writeAndCompositeAssertion(All assertion,
XMLStreamWriter writer) throws XMLStreamException {
String writerPrefix = writer
-
.getPrefix(PolicyConstants.WS_POLICY_NAMESPACE_URI);
+
.getPrefix(PolicyConstants.POLICY_NAMESPACE_URI);
if (writerPrefix == null) {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_PREFIX,
- PolicyConstants.AND_COMPOSITE_ASSERTION,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.writeNamespace(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.setPrefix(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
+ writer.writeStartElement(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.ALL,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.writeNamespace(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.setPrefix(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
} else {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_NAMESPACE_URI,
-
PolicyConstants.AND_COMPOSITE_ASSERTION);
+
writer.writeStartElement(PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.ALL);
}
List terms = assertion.getTerms();
@@ -180,23 +180,23 @@
writer.writeEndElement();
}
- private void writeXorCompositeAssertion(XorCompositeAssertion assertion,
+ private void writeXorCompositeAssertion(ExactlyOne assertion,
XMLStreamWriter writer) throws XMLStreamException {
String writerPrefix = writer
-
.getPrefix(PolicyConstants.WS_POLICY_NAMESPACE_URI);
+
.getPrefix(PolicyConstants.POLICY_NAMESPACE_URI);
if (writerPrefix == null) {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_PREFIX,
- PolicyConstants.XOR_COMPOSITE_ASSERTION,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.writeNamespace(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.setPrefix(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
+ writer.writeStartElement(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.EXACTLY_ONE,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.writeNamespace(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.setPrefix(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
} else {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_NAMESPACE_URI,
-
PolicyConstants.XOR_COMPOSITE_ASSERTION);
+
writer.writeStartElement(PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.EXACTLY_ONE);
}
List terms = assertion.getTerms();
@@ -241,19 +241,19 @@
XMLStreamWriter writer) throws XMLStreamException {
String writerPrefix = writer
-
.getPrefix(PolicyConstants.WS_POLICY_NAMESPACE_URI);
+
.getPrefix(PolicyConstants.POLICY_NAMESPACE_URI);
if (writerPrefix != null) {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_NAMESPACE_URI,
- PolicyConstants.WS_POLICY_REFERENCE);
+
writer.writeStartElement(PolicyConstants.POLICY_NAMESPACE_URI,
+ PolicyConstants.POLICY_REFERENCE);
} else {
-
writer.writeStartElement(PolicyConstants.WS_POLICY_PREFIX,
- PolicyConstants.WS_POLICY_REFERENCE,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.writeNamespace(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
- writer.setPrefix(PolicyConstants.WS_POLICY_PREFIX,
-
PolicyConstants.WS_POLICY_NAMESPACE_URI);
+ writer.writeStartElement(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_REFERENCE,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.writeNamespace(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
+ writer.setPrefix(PolicyConstants.POLICY_PREFIX,
+ PolicyConstants.POLICY_NAMESPACE_URI);
}
writer.writeAttribute("URI", assertion.getPolicyURIString());
Modified:
webservices/commons/trunk/modules/neethi/test/org/apache/ws/policy/util/PolicyComparator.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test/org/apache/ws/policy/util/PolicyComparator.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/test/org/apache/ws/policy/util/PolicyComparator.java
(original)
+++
webservices/commons/trunk/modules/neethi/test/org/apache/ws/policy/util/PolicyComparator.java
Tue May 9 22:36:31 2006
@@ -22,12 +22,12 @@
import javax.xml.namespace.QName;
-import org.apache.ws.policy.AndCompositeAssertion;
+import org.apache.ws.policy.All;
import org.apache.ws.policy.Assertion;
import org.apache.ws.policy.Policy;
import org.apache.ws.policy.PolicyReference;
import org.apache.ws.policy.PrimitiveAssertion;
-import org.apache.ws.policy.XorCompositeAssertion;
+import org.apache.ws.policy.ExactlyOne;
public class PolicyComparator {
public static boolean compare(Policy arg1, Policy arg2) {
@@ -68,14 +68,14 @@
return compare((PolicyReference) arg1,
(PolicyReference) arg2);
- } else if (arg1 instanceof AndCompositeAssertion) {
+ } else if (arg1 instanceof All) {
- return compare((AndCompositeAssertion) arg1,
- (AndCompositeAssertion) arg2);
+ return compare((All) arg1,
+ (All) arg2);
- } else if (arg1 instanceof XorCompositeAssertion) {
- return compare((XorCompositeAssertion) arg1,
- (XorCompositeAssertion) arg2);
+ } else if (arg1 instanceof ExactlyOne) {
+ return compare((ExactlyOne) arg1,
+ (ExactlyOne) arg2);
} else if (arg1 instanceof PrimitiveAssertion) {
return compare((PrimitiveAssertion) arg1,
(PrimitiveAssertion) arg2);
@@ -93,13 +93,13 @@
return
arg1.getPolicyURIString().equals(arg2.getPolicyURIString());
}
- public static boolean compare(AndCompositeAssertion arg1,
- AndCompositeAssertion arg2) {
+ public static boolean compare(All arg1,
+ All arg2) {
return compare(arg1.getTerms(), arg2.getTerms());
}
- public static boolean compare(XorCompositeAssertion arg1,
- XorCompositeAssertion arg2) {
+ public static boolean compare(ExactlyOne arg1,
+ ExactlyOne arg2) {
return compare(arg1.getTerms(), arg2.getTerms());
}
Modified:
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_Policy.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_Policy.java?rev=405643&r1=405642&r2=405643&view=diff
==============================================================================
---
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_Policy.java
(original)
+++
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_Policy.java
Tue May 9 22:36:31 2006
@@ -1154,7 +1154,7 @@
Hashtable attributes = pol.getAttributes();
String value = null;
assertTrue("Attribute number check [" + attributes.size() + "]",
- attributes.size() == 4);
+ attributes.size() == 5);
value = pol.getAttribute(q4);
assertTrue("Attribute value check for [Fourth]", value.equals("Fourth"));
@@ -1182,7 +1182,7 @@
assertTrue("Attribute value check", value.equals("First"));
pol.removeAttribute(q1);
Hashtable attributes = pol.getAttributes();
- assertTrue("Should be no attributes", attributes.size() == 0);
+ assertTrue("Should only be ONE attribute", attributes.size() == 1);
} catch (Exception ex) {
WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
@@ -1244,12 +1244,14 @@
Hashtable attributes = pol.getAttributes();
String value = null;
assertTrue("Attribute number check [" + attributes.size() + "]",
- attributes.size() == 4);
+ attributes.size() == 5);
pol.clearAttributes();
attributes = pol.getAttributes();
assertTrue("Should be no attributes", attributes.size() == 0);
+
+ assertTrue("Id should have been cleared", pol.getId() == null);
} catch (Exception ex) {
WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());