Package org.apache.neethi

Examples of org.apache.neethi.PolicyReference


                Policy p = null;
                if (PolicyConstants.isPolicyElem(e.getElementType())) {
                    p = builder.getPolicy(e.getElement());                   

                } else if (PolicyConstants.isPolicyRefElem(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 (PolicyConstants.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


                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

            }
            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

       
        // 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

            if (value instanceof Policy) {
                Policy policy = (Policy) value;
                policyList.add(PolicyUtil.getPolicyAsString(policy));
            } else if (value instanceof PolicyReference) {

                PolicyReference policyReference = (PolicyReference) value;
                Policy policy = registry.lookup(policyReference.getURI());

                if (policy == null) {
                    throw new RuntimeException(policyReference.getURI() +
                                               " cannot be resolved");
                }
                policyList.add(PolicyUtil.getPolicyAsString(policy));
            }
        }
View Full Code Here

            ;
            if (policyElement instanceof Policy) {
                policy = (policy == null) ? (Policy) policyElement : (Policy) policy.merge((Policy) policyElement);
               
            } else {
                PolicyReference policyReference = (PolicyReference) policyElement;
                Policy policy2 = (Policy) policyReference.normalize(new AxisPolicyLocator(description), false);
                policy = (policy == null) ? policy2 : (Policy) policy.merge(policy2);                
            }
        }
       
       
View Full Code Here

                } else if (WSDLConstants.WSDL11Constants.POLICY_REFERENCE
                        .equals(type)) {
                    if (isTraceEnabled) {
                        log.trace("copyExtensibleElements:: PolicyReference found " + unknown);
                    }
                    PolicyReference policyReference = (PolicyReference) PolicyUtil
                            .getPolicyComponent(unknown.getElement());
                    int attachmentScope =
                            getPolicyAttachmentPoint(description, originOfExtensibilityElements);
                    if (attachmentScope > -1) {
                        description.getPolicyInclude().addPolicyRefElement(
View Full Code Here

                String policyURIs = value.getLocalPart();

                if (policyURIs.length() != 0) {
                    String[] uris = policyURIs.split(" ");

                    PolicyReference ref;
                    for (int i = 0; i < uris.length; i++) {
                        ref = new PolicyReference();
                        ref.setURI(uris[i]);

                        if (PORT_TYPE.equals(origin)) {
                            PolicyInclude include = description
                                    .getPolicyInclude();
                            include.addPolicyRefElement(
View Full Code Here

    protected void processPolicyRefElements(int type,
                                            Iterator policyRefElements,
                                            PolicyInclude policyInclude) {

        while (policyRefElements.hasNext()) {
            PolicyReference policyReference = PolicyEngine
                    .getPolicyReference((OMElement) policyRefElements.next());
            policyInclude.addPolicyRefElement(type, policyReference);
        }
    }
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.