You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/02/17 20:50:08 UTC
svn commit: r1071761 [1/2] - in /cxf/trunk:
api/src/main/java/org/apache/cxf/ws/policy/
api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/
api/src/test/java/org/apache/cxf/ws/policy/
rt/transports/http/src/main/java/org/apache/cxf/transport/...
Author: dkulp
Date: Thu Feb 17 19:50:06 2011
New Revision: 1071761
URL: http://svn.apache.org/viewvc?rev=1071761&view=rev
Log:
Update to just use Neethi Assertion wherever possible instead of CXF
specific PolicyAssertion subclass.
Modified:
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelectorTest.java
cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/MinimalMaximalAlternativeSelectorTest.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java
cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JInInterceptor.java
cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWss4JInOutTest.java
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AlternativeSelector.java Thu Feb 17 19:50:06 2011
@@ -21,6 +21,7 @@ package org.apache.cxf.ws.policy;
import java.util.Collection;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
/**
@@ -28,6 +29,6 @@ import org.apache.neethi.Policy;
*/
public interface AlternativeSelector {
- Collection<PolicyAssertion> selectAlternative(Policy policy, PolicyEngine engine, Assertor assertor);
+ Collection<Assertion> selectAlternative(Policy policy, PolicyEngine engine, Assertor assertor);
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfo.java Thu Feb 17 19:50:06 2011
@@ -19,6 +19,8 @@
package org.apache.cxf.ws.policy;
+import org.apache.neethi.Assertion;
+
/**
*
@@ -26,10 +28,10 @@ package org.apache.cxf.ws.policy;
public class AssertionInfo {
private boolean asserted;
- private final PolicyAssertion assertion;
+ private final Assertion assertion;
private String errorMessage;
- public AssertionInfo(PolicyAssertion a) {
+ public AssertionInfo(Assertion a) {
assertion = a;
}
public boolean isAsserted() {
@@ -46,7 +48,7 @@ public class AssertionInfo {
return errorMessage;
}
- public PolicyAssertion getAssertion() {
+ public Assertion getAssertion() {
return assertion;
}
public String toString() {
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/AssertionInfoMap.java Thu Feb 17 19:50:06 2011
@@ -34,6 +34,7 @@ import javax.xml.namespace.QName;
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.helpers.CastUtils;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyComponent;
import org.apache.neethi.PolicyContainingAssertion;
@@ -47,20 +48,20 @@ public class AssertionInfoMap extends Ha
this(getAssertions(p));
}
- public AssertionInfoMap(Collection<PolicyAssertion> assertions) {
+ public AssertionInfoMap(Collection<? extends Assertion> assertions) {
super(assertions.size() < 6 ? 6 : assertions.size());
- for (PolicyAssertion a : assertions) {
+ for (Assertion a : assertions) {
putAssertionInfo(a);
}
}
- private void putAssertionInfo(PolicyAssertion a) {
+ private void putAssertionInfo(Assertion a) {
if (a instanceof PolicyContainingAssertion) {
Policy p = ((PolicyContainingAssertion)a).getPolicy();
if (p != null) {
- List<PolicyAssertion> pcs = new ArrayList<PolicyAssertion>();
+ List<Assertion> pcs = new ArrayList<Assertion>();
getAssertions(p, pcs);
- for (PolicyAssertion na : pcs) {
+ for (Assertion na : pcs) {
putAssertionInfo(na);
}
}
@@ -81,16 +82,29 @@ public class AssertionInfoMap extends Ha
}
- public boolean supportsAlternative(PolicyAssertion assertion,
+ public boolean supportsAlternative(PolicyComponent assertion,
List<QName> errors) {
boolean pass = true;
- PolicyAssertion a = (PolicyAssertion)assertion;
- if (!a.isAsserted(this) && !a.isOptional()) {
- errors.add(a.getName());
- pass = false;
+ if (assertion instanceof PolicyAssertion) {
+ PolicyAssertion a = (PolicyAssertion)assertion;
+ if (!a.isAsserted(this) && !a.isOptional()) {
+ errors.add(a.getName());
+ pass = false;
+ }
+ } else if (assertion instanceof Assertion) {
+ Assertion ass = (Assertion)assertion;
+ Collection<AssertionInfo> ail = getAssertionInfo(ass.getName());
+ for (AssertionInfo ai : ail) {
+ if (ai.isAsserted() && ai.getAssertion() == ass) {
+ return true;
+ } else if (!ass.isOptional()) {
+ errors.add(ass.getName());
+ pass = false;
+ }
+ }
}
- if (a instanceof PolicyContainingAssertion) {
- Policy p = ((PolicyContainingAssertion)a).getPolicy();
+ if (assertion instanceof PolicyContainingAssertion) {
+ Policy p = ((PolicyContainingAssertion)assertion).getPolicy();
if (p != null) {
Iterator it = p.getAlternatives();
while (it.hasNext()) {
@@ -101,12 +115,12 @@ public class AssertionInfoMap extends Ha
}
}
}
- return pass || a.isOptional();
+ return pass;
}
- public boolean supportsAlternative(Collection<PolicyAssertion> alternative,
+ public boolean supportsAlternative(Collection<? extends PolicyComponent> alternative,
List<QName> errors) {
boolean pass = true;
- for (PolicyAssertion a : alternative) {
+ for (PolicyComponent a : alternative) {
pass &= supportsAlternative(a, errors);
}
return pass;
@@ -114,11 +128,10 @@ public class AssertionInfoMap extends Ha
public void checkEffectivePolicy(Policy policy) {
List<QName> errors = new ArrayList<QName>();
- Iterator alternatives = policy.getAlternatives();
- while (alternatives.hasNext()) {
- List<PolicyAssertion> alternative = CastUtils.cast((List)alternatives.next(),
- PolicyAssertion.class);
- if (supportsAlternative(alternative, errors)) {
+ Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
+ while (alternatives.hasNext()) {
+ List<PolicyComponent> pc = alternatives.next();
+ if (supportsAlternative(pc, errors)) {
return;
}
}
@@ -156,18 +169,17 @@ public class AssertionInfoMap extends Ha
}
}
}
- private static Collection<PolicyAssertion> getAssertions(PolicyOperator p) {
- Collection<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>();
+ private static Collection<Assertion> getAssertions(PolicyOperator p) {
+ Collection<Assertion> assertions = new ArrayList<Assertion>();
getAssertions(p, assertions);
return assertions;
}
- private static void getAssertions(PolicyOperator p, Collection<PolicyAssertion> assertions) {
- List<PolicyComponent> pcs =
- CastUtils.cast(p.getPolicyComponents(), PolicyComponent.class);
+ private static void getAssertions(PolicyOperator p, Collection<Assertion> assertions) {
+ List<PolicyComponent> pcs = p.getPolicyComponents();
for (PolicyComponent pc : pcs) {
- if (pc instanceof PolicyAssertion) {
- assertions.add((PolicyAssertion)pc);
+ if (pc instanceof Assertion) {
+ assertions.add((Assertion)pc);
} else {
getAssertions((PolicyOperator)pc, assertions);
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EffectivePolicy.java Thu Feb 17 19:50:06 2011
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.message.Message;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
/**
@@ -33,7 +34,7 @@ public interface EffectivePolicy {
Policy getPolicy();
- Collection<PolicyAssertion> getChosenAlternative();
+ Collection<Assertion> getChosenAlternative();
List<Interceptor<? extends Message>> getInterceptors();
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/EndpointPolicy.java Thu Feb 17 19:50:06 2011
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.message.Message;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
/**
@@ -37,11 +38,11 @@ public interface EndpointPolicy {
Policy getPolicy();
EndpointPolicy updatePolicy(Policy p);
- Collection<PolicyAssertion> getChosenAlternative();
+ Collection<Assertion> getChosenAlternative();
- Collection<PolicyAssertion> getVocabulary();
+ Collection<Assertion> getVocabulary();
- Collection<PolicyAssertion> getFaultVocabulary();
+ Collection<Assertion> getFaultVocabulary();
List<Interceptor<? extends Message>> getInterceptors();
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyEngine.java Thu Feb 17 19:50:06 2011
@@ -26,6 +26,7 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.PolicyComponent;
import org.apache.neethi.PolicyRegistry;
/**
@@ -49,7 +50,7 @@ public interface PolicyEngine {
//
- boolean supportsAlternative(Collection<PolicyAssertion> alterative, Assertor assertor);
+ boolean supportsAlternative(Collection<? extends PolicyComponent> alterative, Assertor assertor);
// available throughout the outbound path
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistry.java Thu Feb 17 19:50:06 2011
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
import org.apache.cxf.extension.Registry;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.message.Message;
+import org.apache.neethi.Assertion;
/**
@@ -43,7 +44,7 @@ public interface PolicyInterceptorProvid
*/
void register(PolicyInterceptorProvider provider);
- List<Interceptor<? extends Message>> getInterceptors(Collection<PolicyAssertion> alterative,
+ List<Interceptor<? extends Message>> getInterceptors(Collection<? extends Assertion> alterative,
boolean out, boolean fault);
}
Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java Thu Feb 17 19:50:06 2011
@@ -31,7 +31,6 @@ import org.w3c.dom.Node;
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.ws.policy.AssertionInfo;
import org.apache.cxf.ws.policy.AssertionInfoMap;
import org.apache.cxf.ws.policy.PolicyAssertion;
@@ -152,30 +151,29 @@ public class NestedPrimitiveAssertion
if (p == null) {
return true;
}
- List<PolicyComponent> pcs =
- CastUtils.cast(p.getPolicyComponents(), PolicyComponent.class);
+ List<PolicyComponent> pcs = p.getPolicyComponents();
if (pcs.size() == 0) {
return true;
}
-
- if (pcs.get(0) instanceof PolicyAssertion) {
- List<PolicyAssertion> assertions =
- CastUtils.cast(pcs, PolicyAssertion.class);
- for (PolicyAssertion pa : assertions) {
- if (!pa.isAsserted(aim)) {
+ for (PolicyComponent pc : pcs) {
+ if (pc instanceof PolicyOperator) {
+ if (!isPolicyAsserted((PolicyOperator)pc, aim)) {
return false;
}
- }
- return true;
- } else {
- List<PolicyOperator> assertions =
- CastUtils.cast(pcs, PolicyOperator.class);
- for (PolicyOperator po : assertions) {
- if (isPolicyAsserted(po, aim)) {
- return true;
+ } else if (pc instanceof PolicyAssertion) {
+ if (!((PolicyAssertion)pc).isAsserted(aim)) {
+ return false;
+ }
+ } else {
+ Assertion ass = (Assertion)pc;
+ Collection<AssertionInfo> ail = aim.getAssertionInfo(ass.getName());
+ for (AssertionInfo ai : ail) {
+ if (!ai.isAsserted() && ai.getAssertion() == ass) {
+ return false;
+ }
}
}
- return false;
}
+ return true;
}
}
Modified: cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java (original)
+++ cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/AssertionInfoMapTest.java Thu Feb 17 19:50:06 2011
@@ -30,6 +30,7 @@ import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
import org.easymock.classextension.EasyMock;
@@ -88,11 +89,11 @@ public class AssertionInfoMapTest extend
EasyMock.expect(c.isAsserted(aim)).andReturn(true).anyTimes();
- List<PolicyAssertion> alt1 = new ArrayList<PolicyAssertion>();
+ List<Assertion> alt1 = new ArrayList<Assertion>();
alt1.add(a1);
alt1.add(b);
- List<PolicyAssertion> alt2 = new ArrayList<PolicyAssertion>();
+ List<Assertion> alt2 = new ArrayList<Assertion>();
alt2.add(a2);
alt2.add(c);
Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java (original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java Thu Feb 17 19:50:06 2011
@@ -36,10 +36,10 @@ import org.apache.cxf.transports.http.co
import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
import org.apache.cxf.ws.policy.AssertionInfo;
import org.apache.cxf.ws.policy.AssertionInfoMap;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.policy.PolicyException;
import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
+import org.apache.neethi.Assertion;
/**
*
@@ -85,7 +85,7 @@ public final class PolicyUtils {
if (null == ais) {
return confPolicy;
}
- Collection<PolicyAssertion> alternative = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> alternative = new ArrayList<Assertion>();
for (AssertionInfo ai : ais) {
alternative.add(ai.getAssertion());
}
@@ -120,7 +120,7 @@ public final class PolicyUtils {
if (null == ais) {
return confPolicy;
}
- Collection<PolicyAssertion> alternative = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> alternative = new ArrayList<Assertion>();
for (AssertionInfo ai : ais) {
alternative.add(ai.getAssertion());
}
@@ -147,9 +147,9 @@ public final class PolicyUtils {
* @throws PolicyException if no compatible HTTPClientPolicy can be determined
*/
public static HTTPClientPolicy getClient(PolicyEngine pe, EndpointInfo ei, Conduit c) {
- Collection<PolicyAssertion> alternative = pe.getClientEndpointPolicy(ei, c).getChosenAlternative();
+ Collection<Assertion> alternative = pe.getClientEndpointPolicy(ei, c).getChosenAlternative();
HTTPClientPolicy compatible = null;
- for (PolicyAssertion a : alternative) {
+ for (Assertion a : alternative) {
if (HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())) {
HTTPClientPolicy p = JaxbAssertion.cast(a, HTTPClientPolicy.class).getData();
if (null == compatible) {
@@ -177,9 +177,9 @@ public final class PolicyUtils {
* @throws PolicyException if no compatible HTTPServerPolicy can be determined
*/
public static HTTPServerPolicy getServer(PolicyEngine pe, EndpointInfo ei, Destination d) {
- Collection<PolicyAssertion> alternative = pe.getServerEndpointPolicy(ei, d).getChosenAlternative();
+ Collection<Assertion> alternative = pe.getServerEndpointPolicy(ei, d).getChosenAlternative();
HTTPServerPolicy compatible = null;
- for (PolicyAssertion a : alternative) {
+ for (Assertion a : alternative) {
if (HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())) {
HTTPServerPolicy p = JaxbAssertion.cast(a, HTTPServerPolicy.class).getData();
if (null == compatible) {
@@ -634,9 +634,9 @@ public final class PolicyUtils {
return s1 == null || s2 == null || s1.equals(s2);
}
- private static HTTPClientPolicy getClient(Collection<PolicyAssertion> alternative) {
+ private static HTTPClientPolicy getClient(Collection<Assertion> alternative) {
HTTPClientPolicy compatible = null;
- for (PolicyAssertion a : alternative) {
+ for (Assertion a : alternative) {
if (HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())) {
HTTPClientPolicy p = JaxbAssertion.cast(a, HTTPClientPolicy.class).getData();
if (null == compatible) {
@@ -656,9 +656,9 @@ public final class PolicyUtils {
return compatible;
}
- private static HTTPServerPolicy getServer(Collection<PolicyAssertion> alternative) {
+ private static HTTPServerPolicy getServer(Collection<Assertion> alternative) {
HTTPServerPolicy compatible = null;
- for (PolicyAssertion a : alternative) {
+ for (Assertion a : alternative) {
if (HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())) {
HTTPServerPolicy p = JaxbAssertion.cast(a, HTTPServerPolicy.class).getData();
if (null == compatible) {
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java Thu Feb 17 19:50:06 2011
@@ -34,6 +34,7 @@ import org.apache.cxf.message.MessageUti
import org.apache.cxf.phase.Phase;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
+import org.apache.neethi.Assertion;
/**
*
@@ -90,7 +91,7 @@ public class ClientPolicyInFaultIntercep
// insert assertions of endpoint's fault vocabulary into message
- Collection<PolicyAssertion> assertions = ep.getFaultVocabulary();
+ Collection<Assertion> assertions = ep.getFaultVocabulary();
if (null != assertions && !assertions.isEmpty()) {
msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
}
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EffectivePolicyImpl.java Thu Feb 17 19:50:06 2011
@@ -42,7 +42,9 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
import org.apache.neethi.PolicyContainingAssertion;
/**
@@ -54,7 +56,7 @@ public class EffectivePolicyImpl impleme
private static final Logger LOG = LogUtils.getL7dLogger(EffectivePolicyImpl.class);
protected Policy policy;
- protected Collection<PolicyAssertion> chosenAlternative;
+ protected Collection<Assertion> chosenAlternative;
protected List<Interceptor<? extends org.apache.cxf.message.Message>> interceptors;
public Policy getPolicy() {
@@ -65,7 +67,7 @@ public class EffectivePolicyImpl impleme
return interceptors;
}
- public Collection<PolicyAssertion> getChosenAlternative() {
+ public Collection<Assertion> getChosenAlternative() {
return chosenAlternative;
}
@@ -145,7 +147,7 @@ public class EffectivePolicyImpl impleme
}
void chooseAlternative(PolicyEngineImpl engine, Assertor assertor) {
- Collection<PolicyAssertion> alternative = engine.getAlternativeSelector()
+ Collection<Assertion> alternative = engine.getAlternativeSelector()
.selectAlternative(policy, engine, assertor);
if (null == alternative) {
PolicyUtils.logPolicy(LOG, Level.FINE, "No alternative supported.", getPolicy());
@@ -164,7 +166,7 @@ public class EffectivePolicyImpl impleme
= engine.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
Set<Interceptor<? extends org.apache.cxf.message.Message>> out
= new LinkedHashSet<Interceptor<? extends org.apache.cxf.message.Message>>();
- for (PolicyAssertion a : getChosenAlternative()) {
+ for (Assertion a : getChosenAlternative()) {
initialiseInterceptors(reg, engine, out, a, useIn);
}
setInterceptors(new ArrayList<Interceptor<? extends org.apache.cxf.message.Message>>(out));
@@ -172,13 +174,16 @@ public class EffectivePolicyImpl impleme
}
- protected Collection<PolicyAssertion> getSupportedAlternatives(PolicyEngineImpl engine,
+ protected Collection<Assertion> getSupportedAlternatives(PolicyEngineImpl engine,
Policy p) {
- Collection<PolicyAssertion> alternatives = new ArrayList<PolicyAssertion>();
- for (Iterator it = p.getAlternatives(); it.hasNext();) {
- List<PolicyAssertion> alternative = CastUtils.cast((List)it.next(), PolicyAssertion.class);
+ Collection<Assertion> alternatives = new ArrayList<Assertion>();
+
+
+ for (Iterator<List<PolicyComponent>> it = p.getAlternatives(); it.hasNext();) {
+ List<PolicyComponent> alternative = it.next();
if (engine.supportsAlternative(alternative, null)) {
- alternatives.addAll(alternative);
+ List<Assertion> asserts = CastUtils.cast(alternative);
+ alternatives.addAll(asserts);
}
}
return alternatives;
@@ -187,7 +192,7 @@ public class EffectivePolicyImpl impleme
void initialiseInterceptors(PolicyInterceptorProviderRegistry reg,
PolicyEngineImpl engine,
Set<Interceptor<? extends org.apache.cxf.message.Message>> out,
- PolicyAssertion a,
+ Assertion a,
boolean usIn) {
QName qn = a.getName();
PolicyInterceptorProvider pp = reg.get(qn);
@@ -197,7 +202,7 @@ public class EffectivePolicyImpl impleme
if (a instanceof PolicyContainingAssertion) {
Policy p = ((PolicyContainingAssertion)a).getPolicy();
if (p != null) {
- for (PolicyAssertion a2 : getSupportedAlternatives(engine, p)) {
+ for (Assertion a2 : getSupportedAlternatives(engine, p)) {
initialiseInterceptors(reg, engine, out, a2, usIn);
}
}
@@ -210,7 +215,7 @@ public class EffectivePolicyImpl impleme
policy = ep;
}
- void setChosenAlternative(Collection<PolicyAssertion> c) {
+ void setChosenAlternative(Collection<Assertion> c) {
chosenAlternative = c;
}
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/EndpointPolicyImpl.java Thu Feb 17 19:50:06 2011
@@ -38,8 +38,10 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
import org.apache.neethi.PolicyContainingAssertion;
/**
@@ -50,10 +52,10 @@ public class EndpointPolicyImpl implemen
private static final ResourceBundle BUNDLE = BundleUtils.getBundle(EndpointPolicyImpl.class);
private Policy policy;
- private Collection<PolicyAssertion> chosenAlternative;
+ private Collection<Assertion> chosenAlternative;
- private Collection<PolicyAssertion> vocabulary;
- private Collection<PolicyAssertion> faultVocabulary;
+ private Collection<Assertion> vocabulary;
+ private Collection<Assertion> faultVocabulary;
private List<Interceptor<? extends Message>> interceptors;
private List<Interceptor<? extends Message>> faultInterceptors;
@@ -105,18 +107,18 @@ public class EndpointPolicyImpl implemen
return epi;
}
- public Collection<PolicyAssertion> getChosenAlternative() {
+ public Collection<Assertion> getChosenAlternative() {
return chosenAlternative;
}
- public synchronized Collection<PolicyAssertion> getVocabulary() {
+ public synchronized Collection<Assertion> getVocabulary() {
if (vocabulary == null) {
initializeVocabulary();
}
return vocabulary;
}
- public synchronized Collection<PolicyAssertion> getFaultVocabulary() {
+ public synchronized Collection<Assertion> getFaultVocabulary() {
if (vocabulary == null) {
initializeVocabulary();
}
@@ -157,7 +159,7 @@ public class EndpointPolicyImpl implemen
}
void chooseAlternative() {
- Collection<PolicyAssertion> alternative = null;
+ Collection<Assertion> alternative = null;
if (requestor) {
alternative = engine.getAlternativeSelector().selectAlternative(policy, engine, assertor);
} else {
@@ -170,26 +172,28 @@ public class EndpointPolicyImpl implemen
}
}
- protected Collection<PolicyAssertion> getSupportedAlternatives() {
- Collection<PolicyAssertion> alternatives = new ArrayList<PolicyAssertion>();
- for (Iterator it = policy.getAlternatives(); it.hasNext();) {
- List<PolicyAssertion> alternative = CastUtils.cast((List)it.next(), PolicyAssertion.class);
+ protected Collection<Assertion> getSupportedAlternatives() {
+ Collection<Assertion> alternatives = new ArrayList<Assertion>();
+
+ for (Iterator<List<PolicyComponent>> it = policy.getAlternatives(); it.hasNext();) {
+ List<PolicyComponent> alternative = it.next();
if (engine.supportsAlternative(alternative, assertor)) {
- alternatives.addAll(alternative);
+ List<Assertion> asserts = CastUtils.cast(alternative);
+ alternatives.addAll(asserts);
}
}
return alternatives;
}
void initializeVocabulary() {
- vocabulary = new ArrayList<PolicyAssertion>();
+ vocabulary = new ArrayList<Assertion>();
if (requestor) {
- faultVocabulary = new ArrayList<PolicyAssertion>();
+ faultVocabulary = new ArrayList<Assertion>();
}
// vocabulary of alternative chosen for endpoint
if (getChosenAlternative() != null) {
- for (PolicyAssertion a : getChosenAlternative()) {
+ for (Assertion a : getChosenAlternative()) {
if (a.isOptional()) {
continue;
}
@@ -210,7 +214,7 @@ public class EndpointPolicyImpl implemen
} else {
p = engine.getEffectiveServerRequestPolicy(ei, boi);
}
- Collection<PolicyAssertion> c = engine.getAssertions(p, false);
+ Collection<Assertion> c = engine.getAssertions(p, false);
if (c != null) {
vocabulary.addAll(c);
if (null != faultVocabulary) {
@@ -250,12 +254,13 @@ public class EndpointPolicyImpl implemen
}
}
- Collection<PolicyAssertion> getSupportedAlternatives(Policy p) {
- Collection<PolicyAssertion> alternatives = new ArrayList<PolicyAssertion>();
- for (Iterator it = p.getAlternatives(); it.hasNext();) {
- List<PolicyAssertion> alternative = CastUtils.cast((List)it.next(), PolicyAssertion.class);
+ Collection<Assertion> getSupportedAlternatives(Policy p) {
+ Collection<Assertion> alternatives = new ArrayList<Assertion>();
+ for (Iterator<List<PolicyComponent>> it = p.getAlternatives(); it.hasNext();) {
+ List<PolicyComponent> alternative = it.next();
if (engine.supportsAlternative(alternative, null)) {
- alternatives.addAll(alternative);
+ List<Assertion> asserts = CastUtils.cast(alternative);
+ alternatives.addAll(asserts);
}
}
return alternatives;
@@ -263,7 +268,7 @@ public class EndpointPolicyImpl implemen
void initializeInterceptors(PolicyInterceptorProviderRegistry reg,
Set<Interceptor<? extends Message>> out,
- PolicyAssertion a,
+ Assertion a,
boolean fault) {
QName qn = a.getName();
PolicyInterceptorProvider pp = reg.get(qn);
@@ -273,7 +278,7 @@ public class EndpointPolicyImpl implemen
if (a instanceof PolicyContainingAssertion) {
Policy p = ((PolicyContainingAssertion)a).getPolicy();
if (p != null) {
- for (PolicyAssertion a2 : getSupportedAlternatives(p)) {
+ for (Assertion a2 : getSupportedAlternatives(p)) {
initializeInterceptors(reg, out, a2, fault);
}
}
@@ -290,7 +295,7 @@ public class EndpointPolicyImpl implemen
Set<Interceptor<? extends Message>> out = new LinkedHashSet<Interceptor<? extends Message>>();
if (getChosenAlternative() != null) {
- for (PolicyAssertion a : getChosenAlternative()) {
+ for (Assertion a : getChosenAlternative()) {
initializeInterceptors(reg, out, a, false);
}
}
@@ -298,7 +303,7 @@ public class EndpointPolicyImpl implemen
if (requestor) {
interceptors = new ArrayList<Interceptor<? extends Message>>(out);
out.clear();
- for (PolicyAssertion a : getChosenAlternative()) {
+ for (Assertion a : getChosenAlternative()) {
initializeInterceptors(reg, out, a, true);
}
faultInterceptors = new ArrayList<Interceptor<? extends Message>>(out);
@@ -308,9 +313,9 @@ public class EndpointPolicyImpl implemen
if (p == null || p.getPolicy() == null || p.getPolicy().isEmpty()) {
continue;
}
- Collection<PolicyAssertion> c = engine.getAssertions(p, true);
+ Collection<Assertion> c = engine.getAssertions(p, true);
if (c != null) {
- for (PolicyAssertion a : c) {
+ for (Assertion a : c) {
initializeInterceptors(reg, out, a, false);
initializeInterceptors(reg, out, a, true);
}
@@ -328,15 +333,15 @@ public class EndpointPolicyImpl implemen
policy = ep;
}
- void setChosenAlternative(Collection<PolicyAssertion> c) {
+ void setChosenAlternative(Collection<Assertion> c) {
chosenAlternative = c;
}
- void setVocabulary(Collection<PolicyAssertion> v) {
+ void setVocabulary(Collection<Assertion> v) {
vocabulary = v;
}
- void setFaultVocabulary(Collection<PolicyAssertion> v) {
+ void setFaultVocabulary(Collection<Assertion> v) {
faultVocabulary = v;
}
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Thu Feb 17 19:50:06 2011
@@ -41,6 +41,7 @@ import org.apache.cxf.service.model.Serv
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
import org.apache.cxf.ws.policy.selector.MinimalAlternativeSelector;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Constants;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyComponent;
@@ -444,12 +445,12 @@ public class PolicyEngineImpl implements
* @param includeOptional flag indicating if optional assertions should be included
* @return the assertions
*/
- Collection<PolicyAssertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
+ Collection<Assertion> getAssertions(PolicyComponent pc, boolean includeOptional) {
- Collection<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> assertions = new ArrayList<Assertion>();
if (Constants.TYPE_ASSERTION == pc.getType()) {
- PolicyAssertion a = (PolicyAssertion)pc;
+ Assertion a = (Assertion)pc;
if (includeOptional || !a.isOptional()) {
assertions.add(a);
}
@@ -458,16 +459,15 @@ public class PolicyEngineImpl implements
}
return assertions;
}
- Collection<PolicyAssertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {
+ Collection<Assertion> getAssertions(EffectivePolicy pc, boolean includeOptional) {
if (pc == null || pc.getChosenAlternative() == null) {
return null;
}
- Collection<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>();
- for (PolicyAssertion assertion : pc.getChosenAlternative()) {
+ Collection<Assertion> assertions = new ArrayList<Assertion>();
+ for (Assertion assertion : pc.getChosenAlternative()) {
if (Constants.TYPE_ASSERTION == assertion.getType()) {
- PolicyAssertion a = assertion;
- if (includeOptional || !a.isOptional()) {
- assertions.add(a);
+ if (includeOptional || !assertion.isOptional()) {
+ assertions.add(assertion);
}
} else {
addAssertions(assertion, includeOptional, assertions);
@@ -477,12 +477,12 @@ public class PolicyEngineImpl implements
}
void addAssertions(PolicyComponent pc, boolean includeOptional,
- Collection<PolicyAssertion> assertions) {
+ Collection<Assertion> assertions) {
if (Constants.TYPE_ASSERTION == pc.getType()) {
- PolicyAssertion a = (PolicyAssertion)pc;
+ Assertion a = (Assertion)pc;
if (includeOptional || !a.isOptional()) {
- assertions.add((PolicyAssertion)pc);
+ assertions.add((Assertion)pc);
}
return;
}
@@ -508,9 +508,9 @@ public class PolicyEngineImpl implements
* @return the vocabulary
*/
Set<QName> getVocabulary(PolicyComponent pc, boolean includeOptional) {
- Collection<PolicyAssertion> assertions = getAssertions(pc, includeOptional);
+ Collection<Assertion> assertions = getAssertions(pc, includeOptional);
Set<QName> vocabulary = new HashSet<QName>();
- for (PolicyAssertion a : assertions) {
+ for (Assertion a : assertions) {
vocabulary.add(a.getName());
}
return vocabulary;
@@ -535,16 +535,21 @@ public class PolicyEngineImpl implements
* @param Assertor the assertor
* @return true iff the alternative can be supported
*/
- public boolean supportsAlternative(Collection<PolicyAssertion> alternative,
+ public boolean supportsAlternative(Collection<? extends PolicyComponent> alternative,
Assertor assertor) {
PolicyInterceptorProviderRegistry pipr =
bus.getExtension(PolicyInterceptorProviderRegistry.class);
- for (PolicyAssertion a : alternative) {
- if (!(a.isOptional()
- || (null != pipr.get(a.getName()))
- || (null != assertor && assertor.canAssert(a.getName())))) {
+ for (PolicyComponent pc : alternative) {
+ if (pc instanceof Assertion) {
+ Assertion a = (Assertion)pc;
+ if (!(a.isOptional()
+ || (null != pipr.get(a.getName()))
+ || (null != assertor && assertor.canAssert(a.getName())))) {
- LOG.fine("Alternative " + a.getName() + " is not supported");
+ LOG.fine("Alternative " + a.getName() + " is not supported");
+ return false;
+ }
+ } else {
return false;
}
}
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInInterceptor.java Thu Feb 17 19:50:06 2011
@@ -36,6 +36,7 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
/**
@@ -82,7 +83,7 @@ public class PolicyInInterceptor extends
msg.getInterceptorChain().add(i);
LOG.log(Level.FINE, "Added interceptor of type {0}", i.getClass().getSimpleName());
}
- Collection<PolicyAssertion> assertions = effectivePolicy.getChosenAlternative();
+ Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
if (null != assertions && !assertions.isEmpty()) {
msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
msg.getInterceptorChain().add(PolicyVerificationInInterceptor.INSTANCE);
@@ -101,7 +102,7 @@ public class PolicyInInterceptor extends
// insert assertions of endpoint's vocabulary into message
- Collection<PolicyAssertion> assertions = ep.getVocabulary();
+ Collection<Assertion> assertions = ep.getVocabulary();
if (null != assertions && !assertions.isEmpty()) {
msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
msg.getInterceptorChain().add(PolicyVerificationInInterceptor.INSTANCE);
@@ -142,7 +143,7 @@ public class PolicyInInterceptor extends
// insert assertions of endpoint's vocabulary into message
- Collection<PolicyAssertion> assertions = ep.getVocabulary();
+ Collection<Assertion> assertions = ep.getVocabulary();
if (null != assertions && !assertions.isEmpty()) {
msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
msg.getInterceptorChain().add(PolicyVerificationInInterceptor.INSTANCE);
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyInterceptorProviderRegistryImpl.java Thu Feb 17 19:50:06 2011
@@ -35,6 +35,7 @@ import org.apache.cxf.extension.BusExten
import org.apache.cxf.extension.RegistryImpl;
import org.apache.cxf.interceptor.Interceptor;
import org.apache.cxf.message.Message;
+import org.apache.neethi.Assertion;
/**
*
@@ -94,11 +95,11 @@ public class PolicyInterceptorProviderRe
}
}
}
- public List<Interceptor<? extends Message>> getInterceptors(Collection<PolicyAssertion> alternative,
+ public List<Interceptor<? extends Message>> getInterceptors(Collection<? extends Assertion> alternative,
boolean out, boolean fault) {
loadDynamic();
List<Interceptor<? extends Message>> interceptors = new ArrayList<Interceptor<? extends Message>>();
- for (PolicyAssertion a : alternative) {
+ for (Assertion a : alternative) {
if (a.isOptional()) {
continue;
}
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyOutInterceptor.java Thu Feb 17 19:50:06 2011
@@ -36,6 +36,7 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
/**
@@ -88,14 +89,14 @@ public class PolicyOutInterceptor extend
// insert assertions of the chosen alternative into the message
- Collection<PolicyAssertion> assertions = effectivePolicy.getChosenAlternative();
+ Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
if (null != assertions && !assertions.isEmpty()) {
if (LOG.isLoggable(Level.FINEST)) {
StringBuilder buf = new StringBuilder();
buf.append("Chosen alternative: ");
String nl = System.getProperty("line.separator");
buf.append(nl);
- for (PolicyAssertion a : assertions) {
+ for (Assertion a : assertions) {
PolicyUtils.printPolicyComponent(a, buf, 1);
}
LOG.finest(buf.toString());
@@ -119,14 +120,14 @@ public class PolicyOutInterceptor extend
// insert assertions of the chosen alternative into the message
- Collection<PolicyAssertion> assertions = effectivePolicy.getChosenAlternative();
+ Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
if (null != assertions && !assertions.isEmpty()) {
if (LOG.isLoggable(Level.FINEST)) {
StringBuilder buf = new StringBuilder();
buf.append("Chosen alternative: ");
String nl = System.getProperty("line.separator");
buf.append(nl);
- for (PolicyAssertion a : assertions) {
+ for (Assertion a : assertions) {
PolicyUtils.printPolicyComponent(a, buf, 1);
}
LOG.finest(buf.toString());
@@ -148,7 +149,7 @@ public class PolicyOutInterceptor extend
// insert assertions of the chosen alternative into the message
- Collection<PolicyAssertion> assertions = effectivePolicy.getChosenAlternative();
+ Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
if (null != assertions && !assertions.isEmpty()) {
msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
msg.getInterceptorChain().add(PolicyVerificationOutInterceptor.INSTANCE);
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java Thu Feb 17 19:50:06 2011
@@ -36,6 +36,7 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.BindingOperationInfo;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
/**
*
@@ -97,7 +98,7 @@ public class ServerPolicyOutFaultInterce
// insert assertions of the chosen alternative into the message
- Collection<PolicyAssertion> assertions = effectivePolicy.getChosenAlternative();
+ Collection<Assertion> assertions = effectivePolicy.getChosenAlternative();
if (null != assertions && !assertions.isEmpty()) {
msg.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
}
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelector.java Thu Feb 17 19:50:06 2011
@@ -26,23 +26,23 @@ import java.util.List;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.ws.policy.AlternativeSelector;
import org.apache.cxf.ws.policy.Assertor;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
/**
*
*/
public class FirstAlternativeSelector implements AlternativeSelector {
- public Collection<PolicyAssertion> selectAlternative(
+ public Collection<Assertion> selectAlternative(
Policy policy, PolicyEngine engine, Assertor assertor) {
- Iterator alternatives = policy.getAlternatives();
+ Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
while (alternatives.hasNext()) {
- List<PolicyAssertion> alternative =
- CastUtils.cast((List)alternatives.next(), PolicyAssertion.class);
+ List<PolicyComponent> alternative = alternatives.next();
if (engine.supportsAlternative(alternative, assertor)) {
- return alternative;
+ return CastUtils.cast(alternative);
}
}
return null;
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MaximalAlternativeSelector.java Thu Feb 17 19:50:06 2011
@@ -26,25 +26,25 @@ import java.util.List;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.ws.policy.AlternativeSelector;
import org.apache.cxf.ws.policy.Assertor;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
/**
*
*/
public class MaximalAlternativeSelector implements AlternativeSelector {
- public Collection<PolicyAssertion> selectAlternative(
+ public Collection<Assertion> selectAlternative(
Policy policy, PolicyEngine engine, Assertor assertor) {
- Collection<PolicyAssertion> choice = null;
- Iterator alternatives = policy.getAlternatives();
+ Collection<Assertion> choice = null;
+ Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
while (alternatives.hasNext()) {
- List<PolicyAssertion> alternative =
- CastUtils.cast((List)alternatives.next(), PolicyAssertion.class);
+ List<PolicyComponent> alternative = alternatives.next();
if (engine.supportsAlternative(alternative, assertor)
&& (null == choice || alternative.size() > choice.size())) {
- choice = alternative;
+ choice = CastUtils.cast(alternative);
}
}
return choice;
Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/selector/MinimalAlternativeSelector.java Thu Feb 17 19:50:06 2011
@@ -26,25 +26,26 @@ import java.util.List;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.ws.policy.AlternativeSelector;
import org.apache.cxf.ws.policy.Assertor;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
/**
*
*/
public class MinimalAlternativeSelector implements AlternativeSelector {
- public Collection<PolicyAssertion> selectAlternative(
+ public Collection<Assertion> selectAlternative(
Policy policy, PolicyEngine engine, Assertor assertor) {
- Collection<PolicyAssertion> choice = null;
- Iterator alternatives = policy.getAlternatives();
+ Collection<Assertion> choice = null;
+ Iterator<List<PolicyComponent>> alternatives = policy.getAlternatives();
while (alternatives.hasNext()) {
- List<PolicyAssertion> alternative =
- CastUtils.cast((List)alternatives.next(), PolicyAssertion.class);
+ List<PolicyComponent> alternative = alternatives.next();
+
if (engine.supportsAlternative(alternative, assertor)
&& (null == choice || alternative.size() < choice.size())) {
- choice = alternative;
+ choice = CastUtils.cast(alternative);
}
}
return choice;
Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EffectivePolicyImplTest.java Thu Feb 17 19:50:06 2011
@@ -36,6 +36,7 @@ import org.apache.cxf.service.model.Bind
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
@@ -73,8 +74,8 @@ public class EffectivePolicyImplTest ext
assertNull(effectivePolicy.getInterceptors());
Policy p = control.createMock(Policy.class);
- PolicyAssertion a = control.createMock(PolicyAssertion.class);
- List<PolicyAssertion> la = Collections.singletonList(a);
+ Assertion a = control.createMock(Assertion.class);
+ List<Assertion> la = Collections.singletonList(a);
List<Interceptor<? extends Message>> li = createMockInterceptorList();
control.replay();
effectivePolicy.setPolicy(p);
@@ -94,7 +95,7 @@ public class EffectivePolicyImplTest ext
EndpointPolicyImpl endpointPolicy = control.createMock(EndpointPolicyImpl.class);
Policy p = control.createMock(Policy.class);
EasyMock.expect(endpointPolicy.getPolicy()).andReturn(p);
- Collection<PolicyAssertion> chosenAlternative = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> chosenAlternative = new ArrayList<Assertion>();
EasyMock.expect(endpointPolicy.getChosenAlternative()).andReturn(chosenAlternative);
PolicyEngineImpl pe = new PolicyEngineImpl();
effectivePolicy.initialiseInterceptors(pe, false);
@@ -259,11 +260,11 @@ public class EffectivePolicyImplTest ext
control.reset();
EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
- Collection<PolicyAssertion> alternative = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> alternative = new ArrayList<Assertion>();
EasyMock.expect(selector.selectAlternative(policy, engine, assertor)).andReturn(alternative);
control.replay();
epi.chooseAlternative(engine, assertor);
- Collection<PolicyAssertion> choice = epi.getChosenAlternative();
+ Collection<Assertion> choice = epi.getChosenAlternative();
assertSame(choice, alternative);
control.verify();
}
@@ -272,7 +273,7 @@ public class EffectivePolicyImplTest ext
@Test
public void testInitialiseOutInterceptors() {
EffectivePolicyImpl epi = new EffectivePolicyImpl();
- List<PolicyAssertion> alternative = new ArrayList<PolicyAssertion>();
+ List<Assertion> alternative = new ArrayList<Assertion>();
epi.setChosenAlternative(alternative);
PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/EndpointPolicyImplTest.java Thu Feb 17 19:50:06 2011
@@ -34,6 +34,7 @@ import org.apache.cxf.message.Message;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Constants;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
@@ -84,8 +85,8 @@ public class EndpointPolicyImplTest exte
assertNull(epi.getFaultInterceptors());
Policy p = control.createMock(Policy.class);
- PolicyAssertion a = control.createMock(PolicyAssertion.class);
- List<PolicyAssertion> la = Collections.singletonList(a);
+ Assertion a = control.createMock(Assertion.class);
+ List<Assertion> la = Collections.singletonList(a);
List<Interceptor<? extends Message>> li = createMockInterceptorList();
control.replay();
epi.setPolicy(p);
@@ -176,11 +177,11 @@ public class EndpointPolicyImplTest exte
control.reset();
EasyMock.expect(engine.getAlternativeSelector()).andReturn(selector);
- Collection<PolicyAssertion> alternative = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> alternative = new ArrayList<Assertion>();
EasyMock.expect(selector.selectAlternative(policy, engine, assertor)).andReturn(alternative);
control.replay();
epi.chooseAlternative();
- Collection<PolicyAssertion> choice = epi.getChosenAlternative();
+ Collection<Assertion> choice = epi.getChosenAlternative();
assertSame(choice, alternative);
control.verify();
}
@@ -306,8 +307,8 @@ public class EndpointPolicyImplTest exte
PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, engine, requestor, null);
- Collection<PolicyAssertion> v = new ArrayList<PolicyAssertion>();
- Collection<PolicyAssertion> fv = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> v = new ArrayList<Assertion>();
+ Collection<Assertion> fv = new ArrayList<Assertion>();
QName aqn = new QName("http://x.y.z", "a");
v.add(mockAssertion(aqn, requestor ? 2 : 1, false));
v.add(mockAssertion(aqn, requestor ? 2 : 1, false));
Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyEngineTest.java Thu Feb 17 19:50:06 2011
@@ -44,6 +44,7 @@ import org.apache.cxf.service.model.Serv
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Constants;
import org.apache.neethi.Policy;
import org.apache.neethi.PolicyComponent;
@@ -598,7 +599,7 @@ public class PolicyEngineTest extends As
// EasyMock.expect(a.isOptional()).andReturn(false);
control.replay();
- Collection<PolicyAssertion> ca = engine.getAssertions(a, true);
+ Collection<Assertion> ca = engine.getAssertions(a, true);
assertEquals(1, ca.size());
assertSame(a, ca.iterator().next());
control.verify();
@@ -607,7 +608,7 @@ public class PolicyEngineTest extends As
Policy p = control.createMock(Policy.class);
EasyMock.expect(p.getType()).andReturn(Constants.TYPE_POLICY);
engine.addAssertions(EasyMock.eq(p), EasyMock.eq(false),
- CastUtils.cast(EasyMock.isA(Collection.class), PolicyAssertion.class));
+ CastUtils.cast(EasyMock.isA(Collection.class), Assertion.class));
EasyMock.expectLastCall();
control.replay();
@@ -618,7 +619,7 @@ public class PolicyEngineTest extends As
@Test
public void testAddAssertions() {
engine = new PolicyEngineImpl();
- Collection<PolicyAssertion> assertions = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> assertions = new ArrayList<Assertion>();
PolicyAssertion a = control.createMock(PolicyAssertion.class);
EasyMock.expect(a.getType()).andReturn(Constants.TYPE_ASSERTION);
Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java Thu Feb 17 19:50:06 2011
@@ -38,6 +38,7 @@ import org.apache.cxf.service.model.Endp
import org.apache.cxf.service.model.FaultInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.Destination;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
@@ -94,8 +95,8 @@ public class PolicyInterceptorsTest exte
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
ic.add(li.get(0));
EasyMock.expectLastCall();
- Collection<PolicyAssertion> assertions =
- CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class);
+ Collection<Assertion> assertions =
+ CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
EasyMock.expect(effectivePolicy.getChosenAlternative()).andReturn(assertions);
control.replay();
interceptor.handleMessage(message);
@@ -147,8 +148,8 @@ public class PolicyInterceptorsTest exte
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
ic.add(li.get(0));
EasyMock.expectLastCall();
- Collection<PolicyAssertion> assertions =
- CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class);
+ Collection<Assertion> assertions =
+ CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
EasyMock.expect(endpointPolicy.getFaultVocabulary()).andReturn(assertions);
control.replay();
interceptor.handleMessage(message);
@@ -172,8 +173,8 @@ public class PolicyInterceptorsTest exte
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
ic.add(li.get(0));
EasyMock.expectLastCall();
- Collection<PolicyAssertion> assertions =
- CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class);
+ Collection<Assertion> assertions =
+ CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
EasyMock.expect(endpointPolicy.getVocabulary()).andReturn(assertions);
control.replay();
interceptor.handleMessage(message);
@@ -198,8 +199,8 @@ public class PolicyInterceptorsTest exte
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
ic.add(li.get(0));
EasyMock.expectLastCall();
- Collection<PolicyAssertion> assertions =
- CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class);
+ Collection<Assertion> assertions =
+ CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
EasyMock.expect(effectivePolicy.getChosenAlternative()).andReturn(assertions);
control.replay();
interceptor.handleMessage(message);
@@ -241,8 +242,8 @@ public class PolicyInterceptorsTest exte
EasyMock.expect(message.getInterceptorChain()).andReturn(ic);
ic.add(li.get(0));
EasyMock.expectLastCall();
- Collection<PolicyAssertion> assertions =
- CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class);
+ Collection<Assertion> assertions =
+ CastUtils.cast(Collections.EMPTY_LIST, Assertion.class);
EasyMock.expect(effectivePolicy.getChosenAlternative()).andReturn(assertions);
control.replay();
interceptor.handleMessage(message);
Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelectorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelectorTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelectorTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/FirstAlternativeSelectorTest.java Thu Feb 17 19:50:06 2011
@@ -28,6 +28,7 @@ import org.apache.cxf.ws.policy.PolicyAs
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.policy.TestAssertion;
import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
import org.easymock.classextension.EasyMock;
@@ -74,7 +75,7 @@ public class FirstAlternativeSelectorTes
control.reset();
EasyMock.expect(engine.supportsAlternative(firstAlternative, assertor)).andReturn(true);
control.replay();
- Collection<PolicyAssertion> chosen = selector.selectAlternative(policy, engine, assertor);
+ Collection<Assertion> chosen = selector.selectAlternative(policy, engine, assertor);
assertSame(1, chosen.size());
assertSame(chosen.size(), firstAlternative.size());
assertSame(chosen.iterator().next(), firstAlternative.iterator().next());
Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/MinimalMaximalAlternativeSelectorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/MinimalMaximalAlternativeSelectorTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/MinimalMaximalAlternativeSelectorTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/selector/MinimalMaximalAlternativeSelectorTest.java Thu Feb 17 19:50:06 2011
@@ -28,6 +28,7 @@ import org.apache.cxf.ws.policy.PolicyAs
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.policy.TestAssertion;
import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
import org.easymock.classextension.EasyMock;
@@ -73,7 +74,7 @@ public class MinimalMaximalAlternativeSe
EasyMock.expect(engine.supportsAlternative(minAlternative, assertor)).andReturn(true);
control.replay();
- Collection<PolicyAssertion> choice =
+ Collection<Assertion> choice =
selector.selectAlternative(policy, engine, assertor);
assertEquals(0, choice.size());
control.verify();
@@ -103,7 +104,7 @@ public class MinimalMaximalAlternativeSe
EasyMock.expect(engine.supportsAlternative(minAlternative, assertor)).andReturn(true);
control.replay();
- Collection<PolicyAssertion> choice = selector.selectAlternative(policy, engine, assertor);
+ Collection<Assertion> choice = selector.selectAlternative(policy, engine, assertor);
assertEquals(1, choice.size());
assertSame(a1, choice.iterator().next());
control.verify();
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Thu Feb 17 19:50:06 2011
@@ -59,11 +59,11 @@ import org.apache.cxf.ws.addressing.MAPA
import org.apache.cxf.ws.addressing.Names;
import org.apache.cxf.ws.policy.EffectivePolicy;
import org.apache.cxf.ws.policy.EndpointPolicy;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
import org.apache.cxf.ws.rm.manager.SequenceTerminationPolicyType;
import org.apache.cxf.ws.rm.manager.SourcePolicyType;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
public class RMEndpoint {
@@ -629,7 +629,7 @@ public class RMEndpoint {
interceptors = reg.getInterceptors(endpointPolicy.getChosenAlternative(), outbound, fault);
}
- public Collection<PolicyAssertion> getChosenAlternative() {
+ public Collection<Assertion> getChosenAlternative() {
return endpointPolicy.getChosenAlternative();
}
Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMAssertionBuilder.java Thu Feb 17 19:50:06 2011
@@ -25,7 +25,6 @@ import java.util.List;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
import org.apache.cxf.ws.rm.RMConstants;
@@ -63,11 +62,11 @@ public class RMAssertionBuilder extends
@Override
public boolean equal(PolicyComponent policyComponent) {
if (policyComponent.getType() != Constants.TYPE_ASSERTION
- || !getName().equals(((PolicyAssertion)policyComponent).getName())) {
+ || !getName().equals(((Assertion)policyComponent).getName())) {
return false;
}
JaxbAssertion<RMAssertion> other =
- JaxbAssertion.cast((PolicyAssertion)policyComponent);
+ JaxbAssertion.cast((Assertion)policyComponent);
return PolicyUtils.equals(this.getData(), other.getData());
}
Modified: cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java (original)
+++ cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java Thu Feb 17 19:50:06 2011
@@ -46,9 +46,9 @@ import org.apache.cxf.transport.Conduit;
import org.apache.cxf.ws.addressing.Names;
import org.apache.cxf.ws.policy.EffectivePolicy;
import org.apache.cxf.ws.policy.EndpointPolicy;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
+import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
@@ -287,7 +287,7 @@ public class RMEndpointTest extends Asse
EasyMock.expect(ae.getEndpointInfo()).andReturn(aei);
EndpointPolicy epi = control.createMock(EndpointPolicy.class);
EasyMock.expect(pe.getServerEndpointPolicy(aei, null)).andReturn(epi);
- EasyMock.expect(epi.getChosenAlternative()).andReturn(new ArrayList<PolicyAssertion>());
+ EasyMock.expect(epi.getChosenAlternative()).andReturn(new ArrayList<Assertion>());
pe.setServerEndpointPolicy(ei, epi);
EasyMock.expectLastCall();
@@ -340,7 +340,7 @@ public class RMEndpointTest extends Asse
@Test
public void testEffectivePolicyImpl() {
EndpointPolicy ep = control.createMock(EndpointPolicy.class);
- Collection<PolicyAssertion> alt = new ArrayList<PolicyAssertion>();
+ Collection<Assertion> alt = new ArrayList<Assertion>();
EasyMock.expect(ep.getChosenAlternative()).andReturn(alt).times(2);
PolicyInterceptorProviderRegistry reg = control.createMock(PolicyInterceptorProviderRegistry.class);
List<Interceptor<? extends Message>> li = new ArrayList<Interceptor<? extends Message>>();
Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationInInterceptor.java Thu Feb 17 19:50:06 2011
@@ -57,7 +57,6 @@ import org.apache.cxf.ws.addressing.MAPA
import org.apache.cxf.ws.policy.AssertionInfo;
import org.apache.cxf.ws.policy.AssertionInfoMap;
import org.apache.cxf.ws.policy.EndpointPolicy;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyBuilder;
import org.apache.cxf.ws.policy.PolicyEngine;
import org.apache.cxf.ws.security.SecurityConstants;
@@ -77,6 +76,7 @@ import org.apache.cxf.ws.security.trust.
import org.apache.cxf.ws.security.trust.STSUtils;
import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
import org.apache.ws.security.WSConstants;
@@ -157,7 +157,7 @@ class SecureConversationInInterceptor ex
ExactlyOne ea = new ExactlyOne();
p.addPolicyComponent(ea);
All all = new All();
- PolicyAssertion ass = SecureConversationTokenInterceptorProvider
+ Assertion ass = SecureConversationTokenInterceptorProvider
.getAddressingPolicy(aim, false);
all.addPolicyComponent(ass);
ea.addPolicyComponent(all);
@@ -194,7 +194,7 @@ class SecureConversationInInterceptor ex
ExactlyOne ea = new ExactlyOne();
p.addPolicyComponent(ea);
All all = new All();
- PolicyAssertion ass = SecureConversationTokenInterceptorProvider
+ Assertion ass = SecureConversationTokenInterceptorProvider
.getAddressingPolicy(aim, false);
all.addPolicyComponent(ass);
ea.addPolicyComponent(all);
@@ -247,7 +247,7 @@ class SecureConversationInInterceptor ex
message.getInterceptorChain().add(i);
}
- Collection<PolicyAssertion> assertions = ep.getVocabulary();
+ Collection<Assertion> assertions = ep.getVocabulary();
if (null != assertions) {
message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
}
Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java?rev=1071761&r1=1071760&r2=1071761&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/SecureConversationTokenInterceptorProvider.java Thu Feb 17 19:50:06 2011
@@ -41,7 +41,6 @@ import org.apache.cxf.ws.addressing.poli
import org.apache.cxf.ws.policy.AbstractPolicyInterceptorProvider;
import org.apache.cxf.ws.policy.AssertionInfo;
import org.apache.cxf.ws.policy.AssertionInfoMap;
-import org.apache.cxf.ws.policy.PolicyAssertion;
import org.apache.cxf.ws.policy.PolicyBuilder;
import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
import org.apache.cxf.ws.security.SecurityConstants;
@@ -58,6 +57,7 @@ import org.apache.cxf.ws.security.tokens
import org.apache.cxf.ws.security.tokenstore.TokenStore;
import org.apache.cxf.ws.security.trust.STSClient;
import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
import org.apache.neethi.ExactlyOne;
import org.apache.neethi.Policy;
import org.apache.ws.security.WSSecurityException;
@@ -115,9 +115,9 @@ public class SecureConversationTokenInte
return tokenStore;
}
- static PolicyAssertion getAddressingPolicy(AssertionInfoMap aim, boolean optional) {
+ static Assertion getAddressingPolicy(AssertionInfoMap aim, boolean optional) {
Collection<AssertionInfo> lst = aim.get(MetadataConstants.USING_ADDRESSING_2004_QNAME);
- PolicyAssertion assertion = null;
+ Assertion assertion = null;
if (null != lst && !lst.isEmpty()) {
assertion = lst.iterator().next().getAssertion();
}