Package org.apache.ws.policy

Examples of org.apache.ws.policy.Policy


      }
      catch (WSException wse)
      {
         //OK
      }
      Policy policy = new Policy();
      deployer.deployServerside(policy, null);
   }
View Full Code Here


   public void testDeploySingleAssertion() throws Exception
   {
      Map<String,Class> map = new HashMap<String,Class>();
      map.put("http://www.jboss.com/test/policy", NopAssertionDeployer.class);
      PolicyDeployer deployer = PolicyDeployer.newInstance(map);
      Policy policy = new Policy("myID");
      PrimitiveAssertion assertion = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy","test"));
      policy.addTerm(assertion);
      deployer.deployServerside(policy, null);
     
      policy.remove(assertion);
      policy.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy2","test")));
      try
      {
         deployer.deployServerside(policy, null);
         fail("deployServerSide shouldn't be able to deploy this policy!");
      }
View Full Code Here

      Map<String,Class> map = new HashMap<String,Class>();
      map.put("http://www.jboss.com/test/policy", NopAssertionDeployer.class);
      map.put("http://www.jboss.com/test/policy2", NopAssertionDeployer.class);
      map.put("http://www.jboss.com/test/policy3", NopAssertionDeployer.class);
      PolicyDeployer deployer = PolicyDeployer.newInstance(map);
      Policy policy = new Policy("myID");
      policy.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy","test")));
      policy.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy2","test2")));
      deployer.deployServerside(policy, null);
     
      policy.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!");
      }
View Full Code Here

   {
      Map<String,Class> map = new HashMap<String,Class>();
      map.put("http://www.jboss.com/test/policy", NopAssertionDeployer.class);
      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);
View Full Code Here

      Map<String,Class> map = new HashMap<String,Class>();
      map.put("http://www.jboss.com/test/policy", NopAssertionDeployer.class);
      map.put("http://www.jboss.com/test/policy2", NopAssertionDeployer.class);
      map.put("http://www.jboss.com/test/policy3", 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"));
      PrimitiveAssertion assertion3 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy3","test3"));
      PrimitiveAssertion assertion4 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy4","test4"));
      AndCompositeAssertion andAssertion1 = new AndCompositeAssertion();
      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
      {
View Full Code Here

         "  </wsp:ExactlyOne>" +
         "</wsp:Policy>";

      PolicyReader reader = PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
      PolicyWriter writer = PolicyFactory.getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
      Policy p = reader.readPolicy(new ByteArrayInputStream(inStr.getBytes()));

      //writer.writePolicy(p, System.out);     
   }
View Full Code Here

     * @param rootElement
     */
    protected void addEndpoint(Document doc, Element rootElement) throws Exception {
        WSDLEndpoint endpoint = infoHolder.getPort();

        Policy endpointPolicy = attachmentUtil.getPolicyForEndPoint(endpoint.getName());

        if (endpointPolicy != null) {
          String policyString = PolicyUtil.getPolicyAsString(endpointPolicy);
          addAttribute(doc, "policy", policyString, rootElement);
        }
View Full Code Here

                 * Setting the policy of the operation
                 */
                WSDLEndpoint endpoint = infoHolder.getPort();

                if (endpoint != null) {
                  Policy policy = attachmentUtil.getOperationPolicy(endpoint.getName(), operation.getName());

                  if (policy != null) {
                    addAttribute(doc, "policy", PolicyUtil.getPolicyAsString(policy), methodElement);
                  }
                }


                methodElement.appendChild(getInputElement(doc, operation, soapHeaderInputParameterList));
                methodElement.appendChild(getOutputElement(doc, operation, soapHeaderOutputParameterList));
                rootElement.appendChild(methodElement);
                //////////////////////
            }else{
                //mep is present - we move ahead only if the given mep matches the mep of this operation

                if (mep.equals(operation.getMessageExchangePattern())){
                    //at this point we know it's true
                    opsFound = true;
                    List soapHeaderInputParameterList = new ArrayList();
                    List soapHeaderOutputParameterList = new ArrayList();
                    methodElement = doc.createElement("method");
                    String localPart = operation.getName().getLocalPart();

                    addAttribute(doc, "name", localPart, methodElement);
                    addAttribute(doc, "namespace", operation.getName().getNamespaceURI(), methodElement);
                    addAttribute(doc, "style", operation.getStyle(), methodElement);
                    addAttribute(doc, "dbsupportname", portTypeName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
                            methodElement);

                    addAttribute(doc, "mep", operation.getMessageExchangePattern(), methodElement);

                    if (null != binding) {
                        WSDLBindingOperation bindingOperation = binding.getBindingOperation(operation.getName());

                        // todo This can be a prob !!!!!
                        if (bindingOperation != null) {
                            addSOAPAction(doc, methodElement, bindingOperation);
                            addHeaderOperations(soapHeaderInputParameterList, bindingOperation, true);
                            addHeaderOperations(soapHeaderOutputParameterList, bindingOperation, false);
                        }
                    }

                    /*
                     * Setting the policy of the operation
                     */
                    WSDLEndpoint endpoint = infoHolder.getPort();
                    Policy policy = attachmentUtil.getOperationPolicy(endpoint.getName(), operation.getName());

                    if (policy != null) {
                      addAttribute(doc, "policy", PolicyUtil.getPolicyAsString(policy), methodElement);
                    }

View Full Code Here

      wsdlInterface = wsdlBinding.getBoundInterface();

      for (Iterator iterator = wsdlInterface.getOperations().values()
          .iterator(); iterator.hasNext();) {
        WSDLOperation wsdlOperation = (WSDLOperation) iterator.next();
        Policy policy = util.getPolicyForOperation(wsdlEndpoint.getName(),
            wsdlOperation.getName());

        if (policy != null) {
          processPolicies(document, rootElement, policy,
              wsdlEndpoint, wsdlOperation);
View Full Code Here

        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);
View Full Code Here

TOP

Related Classes of org.apache.ws.policy.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.