Package org.apache.neethi

Examples of org.apache.neethi.PolicyReference


       
        // id has no #
        engine.getRegistry().register("ab", p);
       
        // local reference is an id + #
        PolicyReference pr = new PolicyReference();
        pr.setURI("#ab");
               
        engine.addAssertions(pr, false, assertions);
        assertEquals(1, assertions.size());
        assertSame(a, assertions.iterator().next());      
    }
View Full Code Here


                    loadedPolicies.add(builder.getPolicy(e));
                }
            }
            if (null != policyReferenceElements) {
                for (Element e : policyReferenceElements) {
                    PolicyReference pr = builder.getPolicyReference(e);
                    Policy resolved = resolveReference(pr, e, builder, bus);
                    if (null != resolved) {
                        loadedPolicies.add(resolved);
                    }
                }
View Full Code Here

                    if (null != attachment.getPolicy()) {
                        p = p.merge(attachment.getPolicy());
                    }
                    attachment.setPolicy(p);
                } else if (PolicyConstants.isPolicyRefElem(qn)) {
                    PolicyReference ref = builder.getPolicyReference((Element)nd);
                    if (null != ref) {  
                        Policy p = resolveReference(ref, doc);
                        if (null != attachment.getPolicy()) {
                            p = p.merge(attachment.getPolicy());
                        }
View Full Code Here

            }
            return;
        }
   
        if (Constants.TYPE_POLICY_REF == pc.getType()) {
            PolicyReference pr = (PolicyReference)pc;
            pc = pr.normalize(registry, false);
        }

        PolicyOperator po = (PolicyOperator)pc;

        List<PolicyComponent> pcs = CastUtils.cast(po.getPolicyComponents(), PolicyComponent.class);
View Full Code Here

    @Test
    public void testGetPolicyReference() throws Exception {
        String name = "/samples/test26.xml";
        InputStream is = PolicyBuilderTest.class.getResourceAsStream(name);       
       
        PolicyReference pr = builder.getPolicyReference(is);
        assertEquals("#PolicyA", pr.getURI());
       
        name = "/samples/test27.xml";
        is = PolicyBuilderTest.class.getResourceAsStream(name);       
       
        pr = builder.getPolicyReference(is);
        assertEquals("http://sample.org/test.wsdl#PolicyA", pr.getURI());  
    }
View Full Code Here

       
        // id has no #
        engine.getRegistry().register("ab", p);
       
        // local reference is an id + #
        PolicyReference pr = new PolicyReference();
        pr.setURI("#ab");
               
        engine.addAssertions(pr, false, assertions);
        assertEquals(1, assertions.size());
        assertSame(a, assertions.iterator().next());      
    }
View Full Code Here

            }
            return;
        }
   
        if (Constants.TYPE_POLICY_REF == pc.getType()) {
            PolicyReference pr = (PolicyReference)pc;
            pc = pr.normalize(registry, false);
        }

        PolicyOperator po = (PolicyOperator)pc;

        List<PolicyComponent> pcs = CastUtils.cast(po.getPolicyComponents(), PolicyComponent.class);
View Full Code Here

                    loadedPolicies.add(builder.getPolicy(e));
                }
            }
            if (null != policyReferenceElements) {
                for (Element e : policyReferenceElements) {
                    PolicyReference pr = builder.getPolicyReference(e);
                    Policy resolved = resolveReference(pr, e, builder, bus);
                    if (null != resolved) {
                        loadedPolicies.add(resolved);
                    }
                }
View Full Code Here

                Policy p = null;
                if (Constants.isPolicyElement(e.getElementType())) {
                    p = builder.getPolicy(e.getElement());

                } else if (Constants.isPolicyRef(e.getElementType())) {
                    PolicyReference ref = builder.getPolicyReference(e.getElement());
                    if (null != ref) {
                        p = resolveReference(ref, di);
                    }
                }
                if (null != p) {
                    if (elementPolicy == null) {
                        elementPolicy = new Policy();
                    }
                    elementPolicy = elementPolicy.merge(p);
                }
            }
        }
       
        if (includeAttributes && ex.getExtensionAttributes() != null) {
            for (Map.Entry<QName, Object> ent : ex.getExtensionAttributes().entrySet()) {
                if (Constants.isPolicyURIsAttr(ent.getKey())) {
                    Object attr = ent.getValue();
                    // can be of type a String, a QName, a list of Srings or a list of QNames
                    String uris = null;
                    if (attr instanceof QName) {
                        uris = ((QName)attr).getLocalPart();
                    } else if (attr instanceof String) {
                        uris = (String)attr;
                    }
                    if (null != uris) {
                        StringTokenizer st = new StringTokenizer(uris);
                        while (st.hasMoreTokens()) {
                            String uri = st.nextToken();
                            PolicyReference ref = new PolicyReference();
                            ref.setURI(uri);
                            Policy p = resolveReference(ref, di);
                            if (null != p) {
                                elementPolicy = elementPolicy == null
                                    ? new Policy().merge(p) : elementPolicy.merge(p);
                            }
View Full Code Here

                    if (null != attachment.getPolicy()) {
                        p = p.merge(attachment.getPolicy());
                    }
                    attachment.setPolicy(p);
                } else if (Constants.isPolicyRef(qn)) {
                    PolicyReference ref = builder.getPolicyReference((Element)nd);
                    if (null != ref) {  
                        Policy p = resolveReference(ref, doc);
                        if (null != attachment.getPolicy()) {
                            p = p.merge(attachment.getPolicy());
                        }
View Full Code Here

TOP

Related Classes of org.apache.neethi.PolicyReference

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.