cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1071730 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/ws/policy/src/main/java/org/apache/cxf/ws/p...
Date Thu, 17 Feb 2011 17:56:33 GMT
Author: dkulp
Date: Thu Feb 17 17:56:32 2011
New Revision: 1071730

URL: http://svn.apache.org/viewvc?rev=1071730&view=rev
Log:
Start parsing the ignorable attribute
Use more stuff from Neethi directly.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java Thu Feb 17 17:56:32
2011
@@ -19,10 +19,8 @@
 
 package org.apache.cxf.ws.policy;
 
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Set;
 
 import javax.xml.namespace.QName;
 
@@ -33,30 +31,16 @@ import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.neethi.Constants;
 
 /**
  * Encapsulation of version-specific WS-Policy constants.
  */
 public final class PolicyConstants {
     
-    public static final String NAMESPACE_WS_POLICY
-        = "http://www.w3.org/ns/ws-policy";
+    public static final String WSU_NAMESPACE_URI = Constants.URI_WSU_NS;
+    public static final String WSU_ID_ATTR_NAME = Constants.ATTR_ID;
     
-    public static final String NAMESPACE_W3_200607
-        = "http://www.w3.org/2006/07/ws-policy";
-    
-    public static final String NAMESPACE_XMLSOAP_200409
-        = "http://schemas.xmlsoap.org/ws/2004/09/policy";
-    
-    
-    public static final String POLICY_ELEM_NAME = "Policy";
-    public static final String POLICYREFERENCE_ELEM_NAME = "PolicyReference";
-    public static final String POLICYATTACHMENT_ELEM_NAME = "PolicyAttachment";
-    public static final String APPLIESTO_ELEM_NAME = "AppliesTo";
-
-    public static final String WSU_NAMESPACE_URI = 
-        "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
-    public static final String WSU_ID_ATTR_NAME = "Id";
 
     public static final String POLICY_OVERRIDE 
         = "org.apache.cxf.ws.policy.override";
@@ -85,20 +69,6 @@ public final class PolicyConstants {
         = "org.apache.cxf.ws.policy.server.outfault.assertions";
     
     
-    private static final String ALL_ELEM_NAME = "All";
-    private static final String EXACTLYONE_ELEM_NAME = "ExactlyOne";
-    private static final String OPTIONAL_ATTR_NAME = "Optional"; 
-    private static final String POLICYURIS_ATTR_NAME = "PolicyURIs";
-    
-    
-    
-    private static final Set<String> SUPPORTED_NAMESPACES = new HashSet<String>();
-    static {
-        SUPPORTED_NAMESPACES.add(NAMESPACE_WS_POLICY);
-        SUPPORTED_NAMESPACES.add(NAMESPACE_W3_200607);
-        SUPPORTED_NAMESPACES.add(NAMESPACE_XMLSOAP_200409);
-    }
-    
     private PolicyConstants() {
         //utility class
     }
@@ -112,7 +82,8 @@ public final class PolicyConstants {
         return ret;
     }
     public static void findAllPolicyElementsOfLocalName(Element el, String localName, List<Element>
val) {
-        if (localName.equals(el.getLocalName()) && SUPPORTED_NAMESPACES.contains(el.getNamespaceURI()))
{
+        QName qn = DOMUtils.getElementQName(el);
+        if (localName.equals(qn.getLocalPart()) && Constants.isInPolicyNS(qn)) {
             val.add(el);
         }
         el = DOMUtils.getFirstElement(el);
@@ -135,50 +106,46 @@ public final class PolicyConstants {
         for (int x = 0; x < atts.getLength(); x++) {
             Attr att = (Attr)atts.item(x);
             QName qn = new QName(att.getNamespaceURI(), att.getLocalName());
-            if (isOptionalAttribute(qn)) {
+            if (Constants.isOptionalAttribute(qn)) {
                 return att;
             }
         }
         return null;
     }
 
+    
+    public static boolean isIgnorable(Element e) {
+        Attr at = findIgnorableAttribute(e);
+        if (at != null) {
+            String v = at.getValue();
+            return "true".equalsIgnoreCase(v) || "1".equals(v);
+        }
+        return false;
+    }
+    public static Attr findIgnorableAttribute(Element e) {
+        NamedNodeMap atts = e.getAttributes();
+        for (int x = 0; x < atts.getLength(); x++) {
+            Attr att = (Attr)atts.item(x);
+            QName qn = new QName(att.getNamespaceURI(), att.getLocalName());
+            if (Constants.isIgnorableAttribute(qn)) {
+                return att;
+            }
+        }
+        return null;
+    }
+    
+    
     public static Element findPolicyElement(Element parent) {
         Node nd = parent.getFirstChild();
         while (nd != null) {
-            if (POLICY_ELEM_NAME.equals(nd.getLocalName())
-                && SUPPORTED_NAMESPACES.contains(nd.getNamespaceURI())) {
-                return (Element)nd;
+            if (nd instanceof Element) {
+                QName qn = DOMUtils.getElementQName((Element)nd);
+                if (Constants.isPolicyElement(qn)) {
+                    return (Element)nd;
+                }
             }
             nd = nd.getNextSibling();
         }
         return null;
     }
-    public static boolean isOptionalAttribute(QName qn) {
-        return OPTIONAL_ATTR_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
-    public static boolean isPolicyElem(QName qn) {
-        return POLICY_ELEM_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
-    public static boolean isPolicyRefElem(QName qn) {
-        return POLICYREFERENCE_ELEM_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
-    public static boolean isAppliesToElem(QName qn) {
-        return APPLIESTO_ELEM_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
-    public static boolean isPolicyURIsAttr(QName qn) {
-        return POLICYURIS_ATTR_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
-    public static boolean isExactlyOne(QName qn) {
-        return EXACTLYONE_ELEM_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
-    public static boolean isAll(QName qn) {
-        return ALL_ELEM_NAME.equals(qn.getLocalPart())
-            && SUPPORTED_NAMESPACES.contains(qn.getNamespaceURI());
-    }
 }

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
Thu Feb 17 17:56:32 2011
@@ -36,9 +36,9 @@ import org.apache.cxf.ws.policy.Assertio
 import org.apache.cxf.ws.policy.AssertionInfoMap;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
 import org.apache.neethi.PolicyOperator;
@@ -106,18 +106,18 @@ public class NestedPrimitiveAssertion 
         for (Node nd = elem.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
             if (Node.ELEMENT_NODE == nd.getNodeType()) {
                 QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
-                if (PolicyConstants.isPolicyElem(qn)
+                if (Constants.isPolicyElement(qn)
                     && null == policyElem) {
                     policyElem = (Element)nd;
                 } else {
                     throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC",
BUNDLE, 
-                                                          PolicyConstants.POLICY_ELEM_NAME));
+                                                          Constants.ELEM_POLICY));
                 }                
             }
         }
         if (null == policyElem) {
             throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE,

-                                                  PolicyConstants.POLICY_ELEM_NAME));
+                                                  Constants.ELEM_POLICY));
         }
         nested = builder.getPolicy(policyElem);  
     }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
Thu Feb 17 17:56:32 2011
@@ -84,6 +84,7 @@ import org.apache.cxf.ws.addressing.Vers
 import org.apache.cxf.ws.addressing.WSAddressingFeature;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.neethi.Constants;
 
 /**
  * A JAX-WS specific implementation of the CXF {@link org.apache.cxf.endpoint.Endpoint} interface.
@@ -274,7 +275,7 @@ public class JaxWsEndpointImpl extends E
                 UnknownExtensibilityElement uel = new UnknownExtensibilityElement();
                 
                 W3CDOMStreamWriter writer = new W3CDOMStreamWriter();
-                writer.writeStartElement("wsp", "PolicyReference", PolicyConstants.NAMESPACE_WS_POLICY);
+                writer.writeStartElement("wsp", "PolicyReference", Constants.URI_POLICY_NS);
                 writer.writeAttribute("URI", "#" + polRefId.toString());
                 writer.writeEndElement();
                 Element pr = writer.getDocument().getDocumentElement();
@@ -283,15 +284,15 @@ public class JaxWsEndpointImpl extends E
                 bindingInfo.addExtensor(uel);
                 
                 writer = new W3CDOMStreamWriter();
-                writer.writeStartElement("wsp", "Policy", PolicyConstants.NAMESPACE_WS_POLICY);
+                writer.writeStartElement("wsp", "Policy", Constants.URI_POLICY_NS);
                 writer.writeAttribute("wsu", PolicyConstants.WSU_NAMESPACE_URI,
                                       PolicyConstants.WSU_ID_ATTR_NAME, polRefId.toString());
                 writer.writeStartElement("wsam", "Addressing", JAXWSAConstants.NS_WSAM);
                 if (!addressing.required()) {
-                    writer.writeAttribute("wsp", PolicyConstants.NAMESPACE_WS_POLICY,
+                    writer.writeAttribute("wsp", Constants.URI_POLICY_NS,
                                           "Optional", "true");
                 }
-                writer.writeStartElement("wsp", "Policy", PolicyConstants.NAMESPACE_WS_POLICY);
+                writer.writeStartElement("wsp", "Policy", Constants.URI_POLICY_NS);
                 
                 String s = getAddressingRequirement(addressing);
                 if (s != null) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyAnnotationListener.java
Thu Feb 17 17:56:32 2011
@@ -54,6 +54,7 @@ import org.apache.cxf.service.model.Inte
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.neethi.Constants;
 
 /**
  * 
@@ -327,7 +328,7 @@ public class PolicyAnnotationListener im
     }
     private Element addPolicy(ServiceInfo service, Policy p, Class<?> cls, String defName)
{
         String uri = p.uri();
-        String ns = PolicyConstants.NAMESPACE_WS_POLICY;
+        String ns = Constants.URI_POLICY_NS;
         if (p.includeInWSDL()) {
             ExtendedURIResolver resolver = new ExtendedURIResolver();
             InputSource src = resolver.resolve(uri, "classpath:");
@@ -361,7 +362,7 @@ public class PolicyAnnotationListener im
         }
         Document doc = DOMUtils.createDocument();
         Element el = doc.createElementNS(ns,
-                                         "wsp:" + PolicyConstants.POLICYREFERENCE_ELEM_NAME);
+                                         "wsp:" + Constants.ELEM_POLICY_REF);
         Attr att = doc.createAttribute("URI");
         att.setValue(uri);
         el.setAttributeNodeNS(att);

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServiceModelPolicyUpdater.java
Thu Feb 17 17:56:32 2011
@@ -92,12 +92,12 @@ public class ServiceModelPolicyUpdater {
 
     private void addPolicyRef(Extensible ext, String policyId) {
         Document doc = DOMUtils.createDocument();
-        Element el = doc.createElementNS(Constants.URI_POLICY_NS, Constants.ELEM_POLICY_REF);
+        Element el = doc.createElementNS(Constants.URI_POLICY_13_NS, Constants.ELEM_POLICY_REF);
         el.setPrefix(Constants.ATTR_WSP);
         el.setAttribute(Constants.ATTR_URI, "#" + policyId);
 
         UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
-        uee.setElementType(new QName(Constants.URI_POLICY_NS, Constants.ELEM_POLICY_REF));
+        uee.setElementType(new QName(Constants.URI_POLICY_13_NS, Constants.ELEM_POLICY_REF));
         uee.setElement(el);
         uee.setRequired(true);
 
@@ -114,7 +114,7 @@ public class ServiceModelPolicyUpdater {
             policyEl.removeAttribute("xmlns:xmlns");
 
             UnknownExtensibilityElement uee = new UnknownExtensibilityElement();
-            uee.setElementType(new QName(Constants.URI_POLICY_NS, Constants.ELEM_POLICY));
+            uee.setElementType(new QName(Constants.URI_POLICY_13_NS, Constants.ELEM_POLICY));
             uee.setElement(policyEl);
 
             ei.getService().addExtensor(uee);

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
Thu Feb 17 17:56:32 2011
@@ -46,6 +46,7 @@ import org.apache.cxf.ws.policy.PolicyPr
 import org.apache.cxf.ws.policy.attachment.AbstractPolicyProvider;
 import org.apache.cxf.ws.policy.attachment.reference.LocalDocumentReferenceResolver;
 import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyReference;
 import org.springframework.core.io.Resource;
@@ -161,7 +162,7 @@ public class ExternalAttachmentProvider 
         for (Element ae 
                 : PolicyConstants
                     .findAllPolicyElementsOfLocalName(doc, 
-                                                      PolicyConstants.POLICYATTACHMENT_ELEM_NAME))
{    
+                                                      Constants.ELEM_POLICY_ATTACHMENT))
{    
             PolicyAttachment attachment = new PolicyAttachment();
             
             for (Node nd = ae.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
@@ -169,20 +170,20 @@ public class ExternalAttachmentProvider 
                     continue;
                 }
                 QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
-                if (PolicyConstants.isAppliesToElem(qn)) {
+                if (Constants.isAppliesToElem(qn)) {
                     Collection<DomainExpression> des = readDomainExpressions((Element)nd);
                     if (des.isEmpty()) {
                         // forget about this attachment
                         continue;
                     }
                     attachment.setDomainExpressions(des);                    
-                } else if (PolicyConstants.isPolicyElem(qn)) {
+                } else if (Constants.isPolicyElement(qn)) {
                     Policy p = builder.getPolicy((Element)nd);
                     if (null != attachment.getPolicy()) {
                         p = p.merge(attachment.getPolicy());
                     }
                     attachment.setPolicy(p);
-                } else if (PolicyConstants.isPolicyRefElem(qn)) {
+                } else if (Constants.isPolicyRef(qn)) {
                     PolicyReference ref = builder.getPolicyReference((Element)nd);
                     if (null != ref) {   
                         Policy p = resolveReference(ref, doc);

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java
Thu Feb 17 17:56:32 2011
@@ -26,6 +26,7 @@ import javax.wsdl.extensions.UnknownExte
 import org.apache.cxf.service.model.DescriptionInfo;
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 
 /**
@@ -46,7 +47,7 @@ public class LocalServiceModelReferenceR
             descriptionInfo.getExtensors(UnknownExtensibilityElement.class);
         if (extensions != null) {
             for (UnknownExtensibilityElement e : extensions) {
-                if (PolicyConstants.isPolicyElem(e.getElementType())
+                if (Constants.isPolicyElement(e.getElementType())
                     && uri.equals(e.getElement().getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
                                                                 PolicyConstants.WSU_ID_ATTR_NAME)))
{
                     return builder.getPolicy(e.getElement());

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java
Thu Feb 17 17:56:32 2011
@@ -29,6 +29,7 @@ import org.apache.cxf.resource.ExtendedU
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyException;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 
 /**
@@ -66,7 +67,7 @@ public class RemoteReferenceResolver imp
             String id = uri.substring(pos + 1);
             for (Element elem : PolicyConstants
                     .findAllPolicyElementsOfLocalName(doc,
-                                                      PolicyConstants.POLICY_ELEM_NAME))
{
+                                                      Constants.ELEM_POLICY)) {
                 
                 if (id.equals(elem.getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
                                                   PolicyConstants.WSU_ID_ATTR_NAME))) {

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
Thu Feb 17 17:56:32 2011
@@ -42,12 +42,12 @@ import org.apache.cxf.service.model.Exte
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyProvider;
 import org.apache.cxf.ws.policy.attachment.AbstractPolicyProvider;
 import org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver;
 import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyReference;
 
@@ -175,10 +175,10 @@ public class Wsdl11AttachmentPolicyProvi
         if (null != extensions) {
             for (UnknownExtensibilityElement e : extensions) {
                 Policy p = null;
-                if (PolicyConstants.isPolicyElem(e.getElementType())) {
+                if (Constants.isPolicyElement(e.getElementType())) {
                     p = builder.getPolicy(e.getElement());                    
 
-                } else if (PolicyConstants.isPolicyRefElem(e.getElementType())) {
+                } else if (Constants.isPolicyRef(e.getElementType())) {
                     PolicyReference ref = builder.getPolicyReference(e.getElement());
                     if (null != ref) {
                         p = resolveReference(ref, di);
@@ -195,7 +195,7 @@ public class Wsdl11AttachmentPolicyProvi
         
         if (includeAttributes && ex.getExtensionAttributes() != null) {
             for (Map.Entry<QName, Object> ent : ex.getExtensionAttributes().entrySet())
{
-                if (PolicyConstants.isPolicyURIsAttr(ent.getKey())) {
+                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;

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java (original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java Thu Feb
17 17:56:32 2011
@@ -25,6 +25,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertionBuilder;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.util.PolicyComparator;
 import org.easymock.classextension.EasyMock;
@@ -51,7 +52,7 @@ public class NormalizeTest extends Asser
     
     @Test
     public void testNormalize() throws Exception {
-        Bus bus = createBus(PolicyConstants.NAMESPACE_XMLSOAP_200409);
+        Bus bus = createBus(Constants.URI_POLICY_13_NS);
         PolicyBuilderImpl builder = createBuilder(bus);
         
         int n = 26;
@@ -64,7 +65,7 @@ public class NormalizeTest extends Asser
     
     @Test
     public void testNormalizeDefaultNs() throws Exception {
-        Bus bus = createBus(PolicyConstants.NAMESPACE_WS_POLICY);
+        Bus bus = createBus(Constants.URI_POLICY_NS);
         PolicyBuilderImpl builder = createBuilder(bus);
         
         String sample = "/samples/test1DefaultNs.xml";

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyAnnotationTest.java
Thu Feb 17 17:56:32 2011
@@ -42,6 +42,7 @@ import org.apache.cxf.jaxws.JaxWsServerF
 import org.apache.cxf.transport.local.LocalTransportFactory;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.apache.neethi.Constants;
 
 import org.junit.Assert;
 
@@ -89,7 +90,7 @@ public class PolicyAnnotationTest extend
             ns.put("wsdl", WSDLConstants.NS_WSDL11);
             ns.put("wsu", 
                    "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
-            ns.put("wsp", PolicyConstants.NAMESPACE_XMLSOAP_200409);
+            ns.put("wsp", Constants.URI_POLICY_13_NS);
             XPathUtils xpu = new XPathUtils(ns);
             //org.apache.cxf.helpers.XMLUtils.printDOM(wsdl);
             check(xpu, wsdl, "/wsdl:definitions/wsdl:service/", "TestImplServiceServicePolicy");

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
Thu Feb 17 17:56:32 2011
@@ -31,6 +31,7 @@ import org.w3c.dom.Element;
 import org.apache.cxf.service.model.DescriptionInfo;
 import org.apache.cxf.ws.policy.PolicyBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -70,8 +71,8 @@ public class ReferenceResolverTest exten
         EasyMock.expect(di.getExtensors(UnknownExtensibilityElement.class)).andReturn(extensions);
         Element e = control.createMock(Element.class);
         EasyMock.expect(extension.getElement()).andReturn(e).times(2);
-        QName qn = new QName(PolicyConstants.NAMESPACE_WS_POLICY, 
-                             PolicyConstants.POLICY_ELEM_NAME);
+        QName qn = new QName(Constants.URI_POLICY_NS, 
+                             Constants.ELEM_POLICY);
         EasyMock.expect(extension.getElementType()).andReturn(qn).anyTimes();
         EasyMock.expect(e.getAttributeNS(PolicyConstants.WSU_NAMESPACE_URI,
                                          PolicyConstants.WSU_ID_ATTR_NAME))
@@ -88,12 +89,12 @@ public class ReferenceResolverTest exten
     @Test
     public void testRemoteReferenceResolverWithOlderNs() {
         
-        doTestRemoteResolver(PolicyConstants.NAMESPACE_W3_200607);
+        doTestRemoteResolver(Constants.URI_POLICY_15_DEPRECATED_NS);
     }
     
     @Test
     public void testRemoteReferenceResolverWithDefaultNs() {
-        doTestRemoteResolver(PolicyConstants.NAMESPACE_WS_POLICY);
+        doTestRemoteResolver(Constants.URI_POLICY_NS);
     }
     
     private void doTestRemoteResolver(String policyNs) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -67,6 +67,7 @@ public class HttpsTokenBuilder implement
         
         HttpsToken httpsToken = new HttpsToken(consts);
         httpsToken.setOptional(PolicyConstants.isOptional(element));
+        httpsToken.setIgnorable(PolicyConstants.isIgnorable(element));
 
         if (consts.getVersion() == SPConstants.Version.SP_V11) {
             String attr = DOMUtils.getAttribute(element,

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/InitiatorTokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -60,6 +60,7 @@ public class InitiatorTokenBuilder imple
 
         InitiatorToken initiatorToken = new InitiatorToken(consts, builder);
         initiatorToken.setOptional(PolicyConstants.isOptional(element));
+        initiatorToken.setIgnorable(PolicyConstants.isIgnorable(element));
 
         Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
         policy = (Policy)policy.normalize(builder.getPolicyRegistry(), false);

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/IssuedTokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -63,6 +63,7 @@ public class IssuedTokenBuilder implemen
 
         IssuedToken issuedToken = new IssuedToken(consts);
         issuedToken.setOptional(PolicyConstants.isOptional(element));
+        issuedToken.setIgnorable(PolicyConstants.isIgnorable(element));
 
         String includeAttr = DOMUtils.getAttribute(element, consts.getIncludeToken());
         if (includeAttr != null) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/KeyValueTokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -48,6 +48,7 @@ public class KeyValueTokenBuilder implem
 
         KeyValueToken token = new KeyValueToken(consts);
         token.setOptional(PolicyConstants.isOptional(element));
+        token.setIgnorable(PolicyConstants.isIgnorable(element));
         
         String attribute = element.getAttributeNS(element.getNamespaceURI(), SPConstants.ATTR_INCLUDE_TOKEN);
         if (StringUtils.isEmpty(attribute)) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -31,6 +31,7 @@ import org.apache.cxf.ws.security.policy
 import org.apache.cxf.ws.security.policy.model.SecureConversationToken;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.AssertionBuilderFactory;
+import org.apache.neethi.Constants;
 import org.apache.neethi.Policy;
 import org.apache.neethi.builders.AssertionBuilder;
 
@@ -56,6 +57,7 @@ public class SecureConversationTokenBuil
         
         SecureConversationToken conversationToken = new SecureConversationToken(consts);
         conversationToken.setOptional(PolicyConstants.isOptional(element));
+        conversationToken.setIgnorable(PolicyConstants.isIgnorable(element));
 
         String attribute = DOMUtils.getAttribute(element, consts.getIncludeToken());
         if (attribute == null) {
@@ -71,7 +73,7 @@ public class SecureConversationTokenBuil
         Element elem = DOMUtils.getFirstElement(element);
         while (elem != null) {
             QName qn = DOMUtils.getElementQName(elem);
-            if (PolicyConstants.isPolicyElem(qn)) {
+            if (Constants.isPolicyElement(qn)) {
                 if (DOMUtils.getFirstChildWithName(elem, 
                                                    consts.getNamespace(),
                                                    SPConstants.REQUIRE_DERIVED_KEYS) != null)
{

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/TransportBindingBuilder.java
Thu Feb 17 17:56:32 2011
@@ -24,7 +24,6 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.ws.policy.PolicyBuilder;
-import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
@@ -35,6 +34,7 @@ import org.apache.cxf.ws.security.policy
 import org.apache.cxf.ws.security.policy.model.TransportToken;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.AssertionBuilderFactory;
+import org.apache.neethi.Constants;
 import org.apache.neethi.builders.AssertionBuilder;
 
 public class TransportBindingBuilder implements AssertionBuilder<Element> {
@@ -69,7 +69,7 @@ public class TransportBindingBuilder imp
                                     AssertionBuilderFactory factory) {
         Element polEl = DOMUtils.getFirstElement(element);
         while (polEl != null) {
-            if (PolicyConstants.isPolicyElem(new QName(polEl.getNamespaceURI(),
+            if (Constants.isPolicyElement(new QName(polEl.getNamespaceURI(),
                                                        polEl.getLocalName()))) {
                 Element child = DOMUtils.getFirstElement(polEl);
                 while (child != null) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/UsernameTokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -52,6 +52,7 @@ public class UsernameTokenBuilder implem
 
         UsernameToken usernameToken = new UsernameToken(consts);
         usernameToken.setOptional(PolicyConstants.isOptional(element));
+        usernameToken.setIgnorable(PolicyConstants.isIgnorable(element));
 
         String attribute = element.getAttributeNS(element.getNamespaceURI(), SPConstants.ATTR_INCLUDE_TOKEN);
         if (attribute != null) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java?rev=1071730&r1=1071729&r2=1071730&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java
Thu Feb 17 17:56:32 2011
@@ -53,6 +53,7 @@ public class X509TokenBuilder implements
             ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
         X509Token x509Token = new X509Token(consts);
         x509Token.setOptional(PolicyConstants.isOptional(element));
+        x509Token.setIgnorable(PolicyConstants.isIgnorable(element));
 
         Element policyElement = DOMUtils.getFirstElement(element);
 



Mime
View raw message