Package org.apache.ws.policy

Examples of org.apache.ws.policy.XorCompositeAssertion


        if (!policy.isNormalized()) {
            throw new RuntimeException("Policy is not in normalized format");
        }

        XorCompositeAssertion xor = (XorCompositeAssertion) policy.getTerms()
                .get(0);
        List listOfPolicyAlternatives = xor.getTerms();

        boolean success = false;
        int numberOfAlternatives = listOfPolicyAlternatives.size();

        for (int i = 0; !success && i < numberOfAlternatives; i++) {
View Full Code Here


  public boolean processPolicy(Policy policy) {
    if (!policy.isNormalized()) {
      policy = (Policy) policy.normalize();
    }

    XorCompositeAssertion xor = (XorCompositeAssertion) policy.getTerms()
        .get(0);
    List listOfPolicyAlternatives = xor.getTerms();

    boolean success = false;
    int numberOfAlternatives = listOfPolicyAlternatives.size();

    for (int i = 0; !success && i < numberOfAlternatives; i++) {
View Full Code Here

      if(policy != null){
        if (!policy.isNormalized()) {
          policy = (Policy) policy.normalize();
        }

        XorCompositeAssertion XOR = (XorCompositeAssertion) policy.getTerms()
            .get(0);
        AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms().get(
            0);
       
        Iterator pAsserations = AND.getTerms().iterator();
        while(pAsserations.hasNext()){
          PrimitiveAssertion pa = (PrimitiveAssertion) pAsserations.next();
View Full Code Here

      {
         policy = (Policy)policy.normalize();
      }

      //in normal form we have just one wsp:ExactlyOne element containg unbounded wsp:All (alternative)
      XorCompositeAssertion exactlyOne = (XorCompositeAssertion)policy.getTerms().get(0);
      log.debug("####" + exactlyOne.getClass());
      log.debug("####" + exactlyOne.getTerms());
      for (AndCompositeAssertion alternative : (List<AndCompositeAssertion>)exactlyOne.getTerms())
      {
         log.debug("alternative");
         try
         {
            deployAlternativeServerSide(alternative, extMetaData);
View Full Code Here

      if (!policy.isNormalized())
      {
         policy = (Policy)policy.normalize();
      }
      //in normal form we have just one wsp:ExactlyOne element containg unbounded wsp:All (alternative)
      XorCompositeAssertion exactlyOne = (XorCompositeAssertion)policy.getTerms().get(0);
      for (AndCompositeAssertion alternative : (List<AndCompositeAssertion>)exactlyOne.getTerms())
      {
         for (Assertion assertion : (List<Assertion>)alternative.getTerms())
         {
            if (assertion instanceof PrimitiveAssertion)
            {
View Full Code Here

      map.put("http://www.jboss.com/test/policy2", NopAssertionDeployer.class);
      PolicyDeployer deployer = PolicyDeployer.newInstance(map);
      Policy policy = new Policy("myID");
      PrimitiveAssertion assertion1 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy","test"));
      PrimitiveAssertion assertion2 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy2","test2"));
      XorCompositeAssertion xorAssertion = new XorCompositeAssertion();
      xorAssertion.addTerm(assertion1);
      xorAssertion.addTerm(assertion2);
      policy.addTerm(xorAssertion);
      deployer.deployServerside(policy, null);
     
      xorAssertion.remove(assertion2);
      xorAssertion.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy3","test3")));
      deployer.deployServerside(policy, null);
     
      xorAssertion.remove(assertion1);
      xorAssertion.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy4","test4")));
      try
      {
         deployer.deployServerside(policy, null);
         fail("deployServerSide shouldn't be able to deploy this policy (no alternative supported)!");
      }
View Full Code Here

      andAssertion1.addTerm(assertion1);
      andAssertion1.addTerm(assertion2);
      AndCompositeAssertion andAssertion2 = new AndCompositeAssertion();
      andAssertion2.addTerm(assertion3);
      andAssertion2.addTerm(assertion4);
      XorCompositeAssertion xorAssertion = new XorCompositeAssertion();
      xorAssertion.addTerm(andAssertion1);
      xorAssertion.addTerm(andAssertion2);
      policy.addTerm(xorAssertion);
      deployer.deployServerside(policy, null);
     
      xorAssertion.remove(andAssertion1);
      try
      {
         deployer.deployServerside(policy, null);
         fail("deployServerSide shouldn't be able to deploy this policy (no alternative supported)!");
      }
View Full Code Here

      policy = (Policy) policy.normalize();
    }

    HashMap map = new HashMap();

    XorCompositeAssertion XOR = (XorCompositeAssertion) policy.getTerms()
        .get(0);
    AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms().get(
        0);

    for (Iterator iterator = AND.getTerms().iterator(); iterator.hasNext();) {

      AndCompositeAssertion nAND = new AndCompositeAssertion();
      PrimitiveAssertion pa = (PrimitiveAssertion) iterator.next();

      String namespace = pa.getName().getNamespaceURI();
      nAND.addTerm(pa);

      while (iterator.hasNext()) {
        pa = (PrimitiveAssertion) iterator.next();

        if (namespace.equals(pa.getName().getNamespaceURI())) {
          nAND.addTerm(pa);
        }
      }

      map.put(namespace, nAND);
      AND.getTerms().removeAll(nAND.getTerms());

      iterator = AND.getTerms().iterator();
    }

    for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
      String namespace = (String) iterator.next();
            PolicyExtension policyExtension = (PolicyExtension) ns2Exts.get(namespace);
           
//      AxisModule axisModule = (AxisModule) ns2modules.get(namespace);

      if (policyExtension == null) {
        System.err.println("cannot find a PolicyExtension to process "
            + namespace + "type assertions");
        continue;
      }

      Policy nPolicy = new Policy();
      XorCompositeAssertion nXOR = new XorCompositeAssertion();
      nPolicy.addTerm(nXOR);

      AndCompositeAssertion nAND = (AndCompositeAssertion) map
          .get(namespace);
      nXOR.addTerm(nAND);

            QName operationName = operation.getName();
      policyExtension.addMethodsToStub(document, rootElement, operationName, nPolicy);
    }
View Full Code Here

    if (!policy.isNormalized()) {
      throw new RuntimeException("Policy is not in normalized format");
    }

    XorCompositeAssertion xor = (XorCompositeAssertion) policy.getTerms()
        .get(0);
    List listOfPolicyAlternatives = xor.getTerms();

    boolean success = false;
    int numberOfAlternatives = listOfPolicyAlternatives.size();

    for (int i = 0; !success && i < numberOfAlternatives; i++) {
View Full Code Here

      {
         policy = (Policy)policy.normalize();
      }

      //in normal form we have just one wsp:ExactlyOne element containg unbounded wsp:All (alternative)
      XorCompositeAssertion exactlyOne = (XorCompositeAssertion)policy.getTerms().get(0);
      log.debug("####" + exactlyOne.getClass());
      log.debug("####" + exactlyOne.getTerms());
      for (AndCompositeAssertion alternative : (List<AndCompositeAssertion>)exactlyOne.getTerms())
      {
         log.debug("alternative");
         try
         {
            deployAlternativeServerSide(alternative, extMetaData);
View Full Code Here

TOP

Related Classes of org.apache.ws.policy.XorCompositeAssertion

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.