Package org.apache.neethi

Examples of org.apache.neethi.Policy


  public static SandeshaPolicyBean loadPropertiesFromModuleDescPolicy(AxisModule desc,
      SandeshaPolicyBean parentPropertyBean) throws SandeshaException {
   
        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();

    Policy policy = desc.getPolicyInclude().getEffectivePolicy();

    if (policy == null) {
      return null; // no pilicy is available in the module description
    }
       
        Iterator iterator = policy.getAlternatives();
        if (! iterator.hasNext()) {
            throw new SandeshaException("No Policy Alternative found");
        }

        List assertionList = (List) iterator.next();
View Full Code Here


  public static SandeshaPolicyBean loadPropertiesFromAxisDescription(AxisDescription desc,
      SandeshaPolicyBean parentPropertyBean) throws SandeshaException {
   
        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();

        Policy policy = desc.getPolicyInclude().getEffectivePolicy();

        if (policy == null) {
            return null; // no pilicy is available in the module description
        }
       
        Iterator iterator = policy.getAlternatives();
        if (! iterator.hasNext()) {
            throw new SandeshaException("No Policy Alternative found");
        }

        List assertionList = (List) iterator.next();
View Full Code Here

        }
    }

    private void putAssertionInfo(Assertion a) {
        if (a instanceof PolicyContainingAssertion) {
            Policy p = ((PolicyContainingAssertion)a).getPolicy();
            if (p != null) {
                List<Assertion> pcs = new ArrayList<Assertion>();
                getAssertions(p, pcs);
                for (Assertion na : pcs) {
                    putAssertionInfo(na);
View Full Code Here

                errors.add(ass.getName());
                return false;
            }
        }
        if (assertion instanceof PolicyContainingAssertion) {
            Policy p = ((PolicyContainingAssertion)assertion).getPolicy();
            if (p != null) {
                Iterator<List<Assertion>> alternatives = p.getAlternatives();
                while (alternatives.hasNext()) {
                    List<Assertion> pc = alternatives.next();
                    for (Assertion p2 : pc) {
                        pass &= supportsAlternative(p2, errors);
                    }
View Full Code Here

    public Assertion build(OMElement element, AssertionBuilderFactory factory)
            throws IllegalArgumentException {

        SandeshaPolicyBean propertyBean = new SandeshaPolicyBean();
        Policy policy = PolicyEngine.getPolicy(element.getFirstElement());

        processElements(policy.getPolicyComponents(), propertyBean);
        return propertyBean;
    }
View Full Code Here

        if (a1.getName().equals(a2.getName())) {
            if (a1 instanceof PolicyContainingAssertion
                && a2 instanceof PolicyContainingAssertion) {
                PolicyContainingAssertion pc1 = (PolicyContainingAssertion)a1;
                PolicyContainingAssertion pc2 = (PolicyContainingAssertion)a2;
                Policy p1 = pc1.getPolicy();
                Policy p2 = pc2.getPolicy();
                PolicyIntersector pi = new PolicyIntersector(strict);
                if (pi.compatiblePolicies(p1, p2)) {
                    return a1;
                }
            } else {
View Full Code Here

   
    public Policy intersect(Policy p1, Policy p2) {
        return intersect(p1, p2, false);
    }
    public Policy intersect(Policy p1, Policy p2, boolean allowDups) {
        Policy compatible = new Policy(p1.getPolicyRegistry(), p1.getNamespace());
        ExactlyOne eo = new ExactlyOne(compatible);
        if (!compatiblePolicies(p1, p2)) {
            return compatible;
        }
        Iterator<List<Assertion>> i1 = p1.getAlternatives();
View Full Code Here

     * Returns the partial normalized version of the wrapped Element, that is
     * assumed to be an assertion.
     */
    public PolicyComponent normalize() {
        if (optional) {
            Policy policy = new Policy();
            ExactlyOne exactlyOne = new ExactlyOne();

            All all = new All();
            Element el = (Element)this.element.cloneNode(true);
            Attr attr = el.getAttributeNodeNS(Constants.URI_POLICY_13_NS, Constants.ATTR_OPTIONAL);
            if (attr != null) {
                el.removeAttributeNode(attr);
            }
            attr = el.getAttributeNodeNS(Constants.URI_POLICY_15_NS, Constants.ATTR_OPTIONAL);
            if (attr != null) {
                el.removeAttributeNode(attr);
            }
            all.addPolicyComponent(new XmlPrimitiveAssertion(el));
            exactlyOne.addPolicyComponent(all);

            exactlyOne.addPolicyComponent(new All());
            policy.addPolicyComponent(exactlyOne);

            return policy;
        }

        return this;
View Full Code Here

        ignorable = i;
    }
   
    public PolicyComponent normalize() {
        if (isOptional()) {
            Policy policy = new Policy();
            ExactlyOne exactlyOne = new ExactlyOne();

            All all = new All();
            all.addPolicyComponent(clone(false));
            exactlyOne.addPolicyComponent(all);
            exactlyOne.addPolicyComponent(new All());
            policy.addPolicyComponent(exactlyOne);

            return policy;
        }

        return clone(false);
View Full Code Here

        super(name, optional, ignorable, atts);
        this.nested = p;
    }

    public PolicyComponent normalize() {
        Policy normalisedNested
            = (Policy)nested.normalize(true);
       
        Policy p = new Policy(nested.getPolicyRegistry(), nested.getNamespace());
        ExactlyOne ea = new ExactlyOne();
        p.addPolicyComponent(ea);
        if (isOptional()) {
            ea.addPolicyComponent(new All());
        }
        // for all alternatives in normalized nested policy
        Iterator<List<Assertion>> alternatives = normalisedNested.getAlternatives();
        while (alternatives.hasNext()) {
            All all = new All();
            List<Assertion> alternative = alternatives.next();
            Policy n = new Policy(nested.getPolicyRegistry(), nested.getNamespace());
            Assertion a = clone(false, n);
            ExactlyOne nea = new ExactlyOne();
            n.addPolicyComponent(nea);
            All na = new All();
            nea.addPolicyComponent(na);
            na.addPolicyComponents(alternative);
            all.addPolicyComponent(a);
            ea.addPolicyComponent(all);           
View Full Code Here

TOP

Related Classes of org.apache.neethi.Policy

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.