use of org.apache.neethi.Policy in project cxf by apache.
the class Wsdl11AttachmentPolicyProvider method getEffectivePolicy.
/**
* The effective policy for a specific WSDL message (input or output) is calculated
* in relation to a specific port, and includes the element policy of the wsdl:message
* element that defines the message's type merged with the element policy of the
* wsdl11:binding and wsdl11:portType message definitions that describe the message.
* For example, the effective policy of a specific input message for a specific port
* would be the (element policies of the) wsdl11:message element defining the message type,
* the wsdl11:portType/wsdl11:operation/wsdl11:input element and the corresponding
* wsdl11:binding/wsdl11:operation/wsdl11:input element for that message.
*
* @param bmi the BindingMessageInfo identifiying the message
* @return the effective policy
*/
public Policy getEffectivePolicy(BindingMessageInfo bmi, Message m) {
ServiceInfo si = bmi.getBindingOperation().getBinding().getService();
DescriptionInfo di = si.getDescription();
Policy p = getElementPolicy(bmi, false, di);
MessageInfo mi = bmi.getMessageInfo();
p = mergePolicies(p, getElementPolicy(mi, true, di));
Extensible ex = getMessageTypeInfo(mi.getName(), di);
p = mergePolicies(p, getElementPolicy(ex, false, di));
return p;
}
use of org.apache.neethi.Policy in project cxf by apache.
the class Wsdl11AttachmentPolicyProvider method resolveReference.
Policy resolveReference(PolicyReference ref, DescriptionInfo di) {
Policy p = null;
if (isExternal(ref)) {
String uri = di.getBaseURI();
if (uri == null) {
uri = Integer.toString(di.hashCode());
}
p = resolveExternal(ref, uri);
} else {
p = resolveLocal(ref, di);
}
checkResolved(ref, p);
return p;
}
use of org.apache.neethi.Policy in project cxf by apache.
the class Wsdl11AttachmentPolicyProvider method getEffectivePolicy.
/**
* The effective policy for a WSDL operation policy subject is calculated in relation to a
* specific port, and includes the element policy of the wsdl11:portType/wsdl11:operation
* element that defines the operation merged with that of the corresponding
* wsdl11:binding/wsdl11:operation element.
*
* @param bi the BindingOperationInfo identifying the operation in relation to a port
* @return the effective policy
*/
public Policy getEffectivePolicy(BindingOperationInfo bi, Message m) {
DescriptionInfo di = bi.getBinding().getDescription();
Policy p = getElementPolicy(bi, false, di);
p = mergePolicies(p, getElementPolicy(bi.getOperationInfo(), false, di));
return p;
}
use of org.apache.neethi.Policy in project cxf by apache.
the class Wsdl11AttachmentPolicyProvider method getEffectivePolicy.
public Policy getEffectivePolicy(BindingFaultInfo bfi, Message m) {
ServiceInfo si = bfi.getBindingOperation().getBinding().getService();
DescriptionInfo di = si.getDescription();
Policy p = getElementPolicy(bfi, false, di);
FaultInfo fi = bfi.getFaultInfo();
p = mergePolicies(p, getElementPolicy(fi, true, di));
Extensible ex = getMessageTypeInfo(fi.getName(), di);
p = mergePolicies(p, getElementPolicy(ex, false, di));
return p;
}
use of org.apache.neethi.Policy in project cxf by apache.
the class AssertionInfoMapTest method testCheckEffectivePolicy.
@Test
public void testCheckEffectivePolicy() {
Policy p = new Policy();
QName aqn = new QName("http://x.y.z", "a");
Assertion a = new PrimitiveAssertion(aqn);
QName bqn = new QName("http://x.y.z", "b");
Assertion b = new PrimitiveAssertion(bqn);
QName cqn = new QName("http://x.y.z", "c");
Assertion c = new PrimitiveAssertion(cqn);
All alt1 = new All();
alt1.addAssertion(a);
alt1.addAssertion(b);
All alt2 = new All();
alt2.addAssertion(c);
ExactlyOne ea = new ExactlyOne();
ea.addPolicyComponent(alt1);
ea.addPolicyComponent(alt2);
p.addPolicyComponent(ea);
AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, PolicyAssertion.class));
AssertionInfo ai = new AssertionInfo(a);
AssertionInfo bi = new AssertionInfo(b);
AssertionInfo ci = new AssertionInfo(c);
aim.put(aqn, Collections.singleton(ai));
aim.put(bqn, Collections.singleton(bi));
aim.put(cqn, Collections.singleton(ci));
try {
aim.checkEffectivePolicy(p);
fail("Expected PolicyException not thrown.");
} catch (PolicyException ex) {
// expected
}
ai.setAsserted(true);
ci.setAsserted(true);
aim.checkEffectivePolicy(p);
}
Aggregations