use of org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder in project cxf by apache.
the class AssertionBuilderRegistryImpl method handleNoRegisteredBuilder.
protected AssertionBuilder<?> handleNoRegisteredBuilder(QName qname) {
if (ignoreUnknownAssertions) {
boolean alreadyWarned = ignored.contains(qname);
if (!alreadyWarned) {
ignored.add(qname);
Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
LOG.warning(m.toString());
}
return new XMLPrimitiveAssertionBuilder();
}
Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
throw new PolicyException(m);
}
use of org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder in project cxf by apache.
the class AddressingAssertionBuilder method build.
public Assertion build(Element elem, AssertionBuilderFactory factory) {
String localName = elem.getLocalName();
QName qn = new QName(elem.getNamespaceURI(), localName);
boolean optional = false;
Attr attribute = PolicyConstants.findOptionalAttribute(elem);
if (attribute != null) {
optional = Boolean.valueOf(attribute.getValue());
}
if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn) || MetadataConstants.ADDRESSING_ASSERTION_QNAME_0705.equals(qn)) {
Assertion nap = new XMLPrimitiveAssertionBuilder() {
public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
return new PrimitiveAssertion(MetadataConstants.ADDRESSING_ASSERTION_QNAME, isOptional(element), isIgnorable(element), mp);
}
public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp, Policy policy) {
return new PolicyContainingPrimitiveAssertion(MetadataConstants.ADDRESSING_ASSERTION_QNAME, isOptional(element), isIgnorable(element), mp, policy);
}
}.build(elem, factory);
if (!(nap instanceof PolicyContainingPrimitiveAssertion || nap instanceof org.apache.neethi.builders.PrimitiveAssertion)) {
// this happens when neethi fails to recognize the specified addressing policy element
LOG.warning("Unable to recognize the addressing policy");
}
return nap;
} else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn) || MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME_0705.equals(qn)) {
return new PrimitiveAssertion(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME, optional);
} else if (MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME.getLocalPart().equals(localName) || MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME_0705.getLocalPart().equals(localName)) {
return new PrimitiveAssertion(MetadataConstants.NON_ANON_RESPONSES_ASSERTION_QNAME, optional);
}
return null;
}
use of org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder in project cxf by apache.
the class RM12AssertionBuilder method build.
/**
* @see org.apache.neethi.builders.AssertionBuilder#build(org.w3c.dom.Element,
* org.apache.neethi.AssertionBuilderFactory)
*/
public Assertion build(Element elem, AssertionBuilderFactory factory) throws IllegalArgumentException {
Assertion assertion = null;
if (RM11Constants.WSRMP_NAMESPACE_URI.equals(elem.getNamespaceURI())) {
boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
String lname = elem.getLocalName();
if (RMConstants.RMASSERTION_NAME.equals(lname)) {
// top-level RMAssertion, with nested policy
XMLPrimitiveAssertionBuilder nesting = new XMLPrimitiveAssertionBuilder() {
public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
return new PrimitiveAssertion(RM11Constants.WSRMP_RMASSERTION_QNAME, isOptional(element), isIgnorable(element), mp);
}
public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp, Policy policy) {
return new PolicyContainingPrimitiveAssertion(RM11Constants.WSRMP_RMASSERTION_QNAME, isOptional(element), isIgnorable(element), mp, policy);
}
};
assertion = nesting.build(elem, factory);
} else if (SEQUENCESTR_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(SEQSTR_QNAME, optional);
} else if (SEQUENCETRANSEC_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(SEQTRANSSEC_QNAME, optional);
} else if (DELIVERYASSURANCE_NAME.equals(lname)) {
// DeliveryAssurance, with nested policy
XMLPrimitiveAssertionBuilder nesting = new XMLPrimitiveAssertionBuilder() {
public Assertion newPrimitiveAssertion(Element element, Map<QName, String> mp) {
return new PrimitiveAssertion(DELIVERYASSURANCE_QNAME, isOptional(element), isIgnorable(element), mp);
}
public Assertion newPolicyContainingAssertion(Element element, Map<QName, String> mp, Policy policy) {
return new PolicyContainingPrimitiveAssertion(DELIVERYASSURANCE_QNAME, isOptional(element), isIgnorable(element), mp, policy);
}
};
assertion = nesting.build(elem, factory);
} else if (EXACTLYONCE_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(EXACTLYONCE_QNAME, optional);
} else if (ATLEASTONCE_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(ATLEASTONCE_QNAME, optional);
} else if (ATMOSTONCE_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(ATMOSTONCE_QNAME, optional);
} else if (INORDER_NAME.equals(lname)) {
assertion = new PrimitiveAssertion(INORDER_QNAME, optional);
}
}
return assertion;
}
Aggregations