Package org.apache.neethi

Examples of org.apache.neethi.PolicyComponent


    public void testBuildNonNested() throws Exception {
        String resource = "resources/compact1.xml";
        InputStream is = NestedPrimitiveAssertionTest.class.getResourceAsStream(resource);
        Policy policy = builder.getPolicy(is);
        assertEquals(1, policy.getPolicyComponents().size());
        PolicyComponent pc = policy.getFirstPolicyComponent();
        assertTrue(pc instanceof NestedPrimitiveAssertion);
        NestedPrimitiveAssertion npc = (NestedPrimitiveAssertion)pc;
        assertEquals(TEST_NAME1, npc.getName());
        Policy nested = npc.getNested();
        assertTrue(nested.isEmpty());
View Full Code Here


    public void testBuildNested() throws Exception {
        String resource = "resources/compact3.xml";
        InputStream is = NestedPrimitiveAssertionTest.class.getResourceAsStream(resource);
        Policy policy = builder.getPolicy(is);
        assertEquals(1, policy.getPolicyComponents().size());
        PolicyComponent pc = policy.getFirstPolicyComponent();
        assertTrue(pc instanceof NestedPrimitiveAssertion);
        NestedPrimitiveAssertion npc = (NestedPrimitiveAssertion)pc;
        assertEquals(TEST_NAME1, npc.getName());
        Policy nested = npc.getNested();
        assertEquals(2, nested.getPolicyComponents().size());
View Full Code Here

   * @deprecated As of 1.4 release, replaced by
   *             {@link PolicySubject #getAttachedPolicyComponent(String)}
   */
    public Policy getPolicy(String key) {
      if (description != null) {
      PolicyComponent result = description.getPolicySubject()
          .getAttachedPolicyComponent(key);
      if (result != null && result instanceof Policy) {
        return (Policy) result;
      }
    }
View Full Code Here

            for (Iterator policyElements = attachmentElement
                    .getChildrenWithName(new QName(
                            DeploymentConstants.POLICY_NS_URI,
                            DeploymentConstants.TAG_POLICY)); policyElements
                    .hasNext();) {
                PolicyComponent policy = PolicyUtil
                        .getPolicyFromOMElement((OMElement)policyElements
                                .next());
                policyComponents.add(policy);
            }

            // process <wsp:PolicyReference> elements ..
            for (Iterator policyRefElements = attachmentElement
                    .getChildrenWithName(new QName(
                            DeploymentConstants.POLICY_NS_URI,
                            DeploymentConstants.TAG_POLICY_REF)); policyRefElements
                    .hasNext();) {
                PolicyComponent policyRef = PolicyUtil
                        .getPolicyReferenceFromOMElement((OMElement)policyRefElements
                                .next());
                policyComponents.add(policyRef);
            }
View Full Code Here

            buf.append(" (");
            buf.append((Assertion)pc);
            buf.append(")");
            nl(buf);
            if (pc instanceof PolicyContainingAssertion) {
                PolicyComponent nested = ((PolicyContainingAssertion)pc).getPolicy();
                level++;
                printPolicyComponent(nested, buf, level);
                level--;               
            }
        } else {
View Full Code Here

            ExactlyOne ea = new ExactlyOne();
            p.addPolicyComponent(ea);
            All all = new All();
            all.addPolicyComponent(token);
            ea.addPolicyComponent(all);
            PolicyComponent pc = p.normalize(builder.getPolicyRegistry(), true);
            if (pc instanceof Policy) {
                return (Policy)pc;
            } else {
                p = new Policy();
                p.addPolicyComponent(pc);
View Full Code Here

            buf.append(" (");
            buf.append((Assertion)pc);
            buf.append(")");
            nl(buf);
            if (pc instanceof NestedPrimitiveAssertion) {
                PolicyComponent nested = ((NestedPrimitiveAssertion)pc).getPolicy();
                level++;
                printPolicyComponent(nested, buf, level);
                level--;               
            }
        } else {
View Full Code Here

            for (Iterator policyElements = attachmentElement
                    .getChildrenWithName(new QName(
                            DeploymentConstants.POLICY_NS_URI,
                            DeploymentConstants.TAG_POLICY)); policyElements
                    .hasNext();) {
                PolicyComponent policy = PolicyUtil
                        .getPolicyFromOMElement((OMElement)policyElements
                                .next());
                policyComponents.add(policy);
            }

            // process <wsp:PolicyReference> elements ..
            for (Iterator policyRefElements = attachmentElement
                    .getChildrenWithName(new QName(
                            DeploymentConstants.POLICY_NS_URI,
                            DeploymentConstants.TAG_POLICY_REF)); policyRefElements
                    .hasNext();) {
                PolicyComponent policyRef = PolicyUtil
                        .getPolicyReferenceFromOMElement((OMElement)policyRefElements
                                .next());
                policyComponents.add(policyRef);
            }
View Full Code Here

        }
       
        Policy policy = null;
       
        PolicySubject policySubject = subject.getPolicySubject();
    PolicyComponent attachedPolicyComponent = policySubject
        .getAttachedPolicyComponent(key);

    if (attachedPolicyComponent != null
        && attachedPolicyComponent instanceof Policy) {
      policy = (Policy) attachedPolicyComponent;
View Full Code Here

   * @deprecated As of 1.4 release, replaced by
   *             {@link PolicySubject #getAttachedPolicyComponent(String)}
   */
    public Policy getPolicy(String key) {
      if (description != null) {
      PolicyComponent result = description.getPolicySubject()
          .getAttachedPolicyComponent(key);
      if (result != null && result instanceof Policy) {
        return (Policy) result;
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.neethi.PolicyComponent

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.