Package org.apache.neethi.builders.xml

Examples of org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder


            boolean optional = XMLPrimitiveAssertionBuilder.isOptional(elem);
            String lname = elem.getLocalName();
            if (RM11Constants.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);
View Full Code Here


            if (!alreadyWarned) {
                ignored.add(qname);
                Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
                LOG.warning(m.toString());
            }
            return new XMLPrimitiveAssertionBuilder();
        } else {
            Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
            throw new PolicyException(m);
        }
    }
View Full Code Here

            if (!alreadyWarned) {
                ignored.add(qname);
                Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
                LOG.warning(m.toString());
            }
            return new XMLPrimitiveAssertionBuilder();
        } else {
            Message m = new Message("NO_ASSERTIONBUILDER_EXC", BUNDLE, qname.toString());
            throw new PolicyException(m);
        }
    }
View Full Code Here

    public void testPrimitiveBuilder() throws Exception {
        String text = "<ns1:MaximumRetransmissionCount FooAtt=\"blah\" xmlns:ns1=\"http://foo\">10"
            + "</ns1:MaximumRetransmissionCount>";
       
       
        Assertion as = new XMLPrimitiveAssertionBuilder().build(getElementFromString(text),
                                                                policyEngine.getAssertionBuilderFactory());
        assertNotNull(as);
        PrimitiveAssertion pas = (PrimitiveAssertion)as;
        assertEquals("10", pas.getTextValue());
        assertEquals("blah", pas.getAttribute(new QName("FooAtt")));
View Full Code Here

                      + "<sp:MustSupportRefThumbprint/>"
                      + "<sp:MustSupportRefEncryptedKey/>"
                      + "</wsp:Policy></sp:Wss11>";
                                                                                       

        Assertion as = new XMLPrimitiveAssertionBuilder().build(getElementFromString(text),
                                                                policyEngine.getAssertionBuilderFactory());
        assertNotNull(as);
       
       
        StringWriter writer = new StringWriter();
View Full Code Here

            + "<sp:Body />"
            + "<sp:Header Name=\"To\" Namespace=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"/>"
            + "<sp:Header Name=\"From\" Namespace=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" />"
            + "</sp:SignedParts>";

        Assertion as = new XMLPrimitiveAssertionBuilder().build(getElementFromString(text),
                                                                policyEngine.getAssertionBuilderFactory());
        assertNotNull(as);
       
       
        StringWriter writer = new StringWriter();
View Full Code Here

    public void testPrimitiveBuilder() throws Exception {
        String text = "<ns1:MaximumRetransmissionCount FooAtt=\"blah\" xmlns:ns1=\"http://foo\">10"
            + "</ns1:MaximumRetransmissionCount>";
       
       
        Assertion as = new XMLPrimitiveAssertionBuilder().build(getElementFromString(text),
                                                                pb.getAssertionBuilderFactory());
        assertNotNull(as);
        PrimitiveAssertion pas = (PrimitiveAssertion)as;
        assertEquals("10", pas.getTextValue());
        assertEquals("blah", pas.getAttribute(new QName("FooAtt")));
View Full Code Here

                      + "<sp:MustSupportRefThumbprint/>"
                      + "<sp:MustSupportRefEncryptedKey/>"
                      + "</wsp:Policy></sp:Wss11>";
                                                                                       

        Assertion as = new XMLPrimitiveAssertionBuilder().build(getElementFromString(text),
                                                                pb.getAssertionBuilderFactory());
        assertNotNull(as);
       
       
        StringWriter writer = new StringWriter();
View Full Code Here

            + "<sp:Body />"
            + "<sp:Header Name=\"To\" Namespace=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\"/>"
            + "<sp:Header Name=\"From\" Namespace=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" />"
            + "</sp:SignedParts>";

        Assertion as = new XMLPrimitiveAssertionBuilder().build(getElementFromString(text),
                                                                pb.getAssertionBuilderFactory());
        assertNotNull(as);
       
       
        StringWriter writer = new StringWriter();
View Full Code Here

TOP

Related Classes of org.apache.neethi.builders.xml.XMLPrimitiveAssertionBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.