You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/07/09 22:11:48 UTC

svn commit: r675332 [1/6] - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/helpers/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ rt/ws/security/src/m...

Author: dkulp
Date: Wed Jul  9 13:11:45 2008
New Revision: 675332

URL: http://svn.apache.org/viewvc?rev=675332&view=rev
Log:
Start working on some ws-secritypolicy stuff by porting the policy things from rampart and then cleaning it up to be java5 friendly and remove a TON of duplicate code. 

(this is just a starting point.  None of the "buildCompatible" methods are implemented, it's not wired into anything yet, etc...  It's just a lot of work I don't want lost if my machine dies.)

Added:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java   (contents, props changed)
      - copied, changed from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP11Constants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java   (contents, props changed)
      - copied, changed from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP12Constants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java   (contents, props changed)
      - copied, changed from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java   (with props)
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/   (props changed)
      - copied from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java   (with props)
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/HttpsTokenBuilder.java   (with props)
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RequiredPartsBuilder.java   (with props)
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokens12Builder.java   (with props)
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/Trust13Builder.java   (contents, props changed)
      - copied, changed from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/Trust13Builder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/   (props changed)
      - copied from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/model/
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Messages.properties   (with props)
Removed:
    cxf/trunk/rt/ws/security/src/main/resources/schemas/
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AlgorithmSuiteBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/EncryptedElementsBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/EncryptedPartsBuilder.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/LayoutBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ProtectionTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RecipientTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/RequiredElementsBuilder.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/SecurityContextTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SignedElementsBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SignedPartsBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SupportingTokensBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SymmetricBindingBuilder.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/TransportTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/Trust10Builder.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/WSS10Builder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/WSS11Builder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/X509TokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractConfigurableSecurityAssertion.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AbstractSecurityAssertion.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmSuite.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AlgorithmWrapper.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/AsymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Binding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ContentEncryptedElements.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/EncryptionToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Header.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/HttpsToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/InitiatorToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Token.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TokenWrapper.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportBinding.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/TransportToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust10.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Trust13.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/UsernameToken.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss10.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Wss11.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/X509Token.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=675332&r1=675331&r2=675332&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/DOMUtils.java Wed Jul  9 13:11:45 2008
@@ -24,6 +24,7 @@
 import java.io.OutputStream;
 import java.io.StringReader;
 
+import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -141,6 +142,9 @@
         }
         return attN.getNodeValue();
     }
+    public static String getAttribute(Element element, QName attName) {
+        return element.getAttributeNS(attName.getNamespaceURI(), attName.getLocalPart());
+    }
 
     public static void setAttribute(Node node, String attName, String val) {
         NamedNodeMap attributes = node.getAttributes();
@@ -210,6 +214,10 @@
         }
         return null;
     }
+    
+    public static QName getElementQName(Element el) {
+        return new QName(el.getNamespaceURI(), el.getLocalName());
+    }
     /**
      * Get the first direct child with a given type
      */
@@ -223,7 +231,20 @@
         }
         return (Element) n;
     }
-
+    public static Element getFirstChildWithName(Element parent, QName q) { 
+        String ns = q.getNamespaceURI();
+        String lp = q.getLocalPart();
+        return getFirstChildWithName(parent, ns, lp);
+    }
+    public static Element getFirstChildWithName(Element parent, String ns, String lp) { 
+        Node n = parent.getFirstChild();
+        while (n != null 
+            && !ns.equals(n.getNamespaceURI())
+            && !lp.equals(n.getLocalName())) {
+            n = n.getNextSibling();
+        }
+        return (Element)n;
+    }
     /**
      * Get the first direct child with a given type
      */

Copied: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java (from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP11Constants.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java?p2=cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java&p1=webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP11Constants.java&r1=674910&r2=675332&rev=675332&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP11Constants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java Wed Jul  9 13:11:45 2008
@@ -1,32 +1,54 @@
-package org.apache.ws.secpolicy;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.security.policy;
 
 import javax.xml.namespace.QName;
 
-public class SP11Constants {
+public final class SP11Constants extends SPConstants {
     
-    public final static String SP_NS = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
+    public static final SP11Constants INSTANCE = new SP11Constants();
+    
+    
+    public static final String SP_NS = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";
 
-    public final static String SP_PREFIX = "sp";
+    public static final String SP_PREFIX = "sp";
     
     
     public static final QName INCLUDE_TOKEN = new QName(SP_NS, SPConstants.ATTR_INCLUDE_TOKEN,
             SP11Constants.SP_PREFIX);
     
-    public final static String INCLUDE_NEVER = SP11Constants.SP_NS + 
-                                                                SPConstants.INCLUDE_TOKEN_NEVER_SUFFIX;
+    public static final String INCLUDE_NEVER = SP11Constants.SP_NS
+        + SPConstants.INCLUDE_TOKEN_NEVER_SUFFIX;
 
-    public final static String INCLUDE_ONCE = SP11Constants.SP_NS + 
-                                                                SPConstants.INCLUDE_TOKEN_ONCE_SUFFIX;
+    public static final String INCLUDE_ONCE = SP11Constants.SP_NS 
+        + SPConstants.INCLUDE_TOKEN_ONCE_SUFFIX;
 
-    public final static String INCLUDE_ALWAYS_TO_RECIPIENT = SP11Constants.SP_NS
+    public static final String INCLUDE_ALWAYS_TO_RECIPIENT = SP11Constants.SP_NS
         + SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT_SUFFIX;
 
-    public final static String INCLUDE_ALWAYS = SP11Constants.SP_NS
+    public static final String INCLUDE_ALWAYS = SP11Constants.SP_NS
         + SPConstants.INCLUDE_TOEKN_ALWAYS_SUFFIX;
     
     // /////////////////////////////////////////////////////////////////////
 
-    public static final QName ATTR_XPATH_VERSION = new QName(SP_NS, SPConstants.XPATH_VERSION, SP11Constants.SP_PREFIX);
+    public static final QName ATTR_XPATH_VERSION = new QName(SP_NS, SPConstants.XPATH_VERSION,
+                                                             SP11Constants.SP_PREFIX);
     
     ////////////////////////////////////////////////////////////////////////
 
@@ -172,7 +194,7 @@
             SP11Constants.SP_PREFIX);
 
     public static final QName REQUIRE_EMBEDDED_TOKEN_REFERENCE = new QName(
-            SP11Constants.SP_NS,SPConstants.REQUIRE_EMBEDDED_TOKEN_REFERENCE,
+            SP11Constants.SP_NS, SPConstants.REQUIRE_EMBEDDED_TOKEN_REFERENCE,
             SP11Constants.SP_PREFIX);
 
     public static final QName REQUIRE_THUMBPRINT_REFERENCE = new QName(
@@ -183,7 +205,7 @@
             SP11Constants.SP_NS, SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER , SP11Constants.SP_PREFIX);
 
     public static final QName MUST_SUPPORT_REF_ISSUER_SERIAL = new QName(
-            SP11Constants.SP_NS,SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL, SP11Constants.SP_PREFIX);
+            SP11Constants.SP_NS, SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL, SP11Constants.SP_PREFIX);
 
     public static final QName MUST_SUPPORT_REF_EXTERNAL_URI = new QName(
             SP11Constants.SP_NS, SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI , SP11Constants.SP_PREFIX);
@@ -215,7 +237,7 @@
             SP11Constants.SP_NS, SPConstants.MUST_SUPPORT_CLIENT_CHALLENGE, SP11Constants.SP_PREFIX);
 
     public static final QName MUST_SUPPORT_SERVER_CHALLENGE = new QName(
-            SP11Constants.SP_NS,SPConstants.MUST_SUPPORT_SERVER_CHALLENGE , SP11Constants.SP_PREFIX);
+            SP11Constants.SP_NS, SPConstants.MUST_SUPPORT_SERVER_CHALLENGE , SP11Constants.SP_PREFIX);
 
     public static final QName REQUIRE_CLIENT_ENTROPY = new QName(
             SP11Constants.SP_NS, SPConstants.REQUIRE_CLIENT_ENTROPY, SP11Constants.SP_PREFIX);
@@ -233,7 +255,7 @@
             SPConstants.REQUIRE_DERIVED_KEYS, SP11Constants.SP_PREFIX);
 
     public static final QName REQUIRE_EXTERNAL_URI_REFERNCE = new QName(
-            SP11Constants.SP_NS,SPConstants.REQUIRE_EXTERNAL_URI_REFERNCE, SP11Constants.SP_PREFIX);
+            SP11Constants.SP_NS, SPConstants.REQUIRE_EXTERNAL_URI_REFERNCE, SP11Constants.SP_PREFIX);
 
     public static final QName REQUIRE_EXTERNAL_REFERNCE = new QName(
             SP11Constants.SP_NS, SPConstants.REQUIRE_EXTERNAL_REFERNCE , SP11Constants.SP_PREFIX);
@@ -251,43 +273,147 @@
     public static final QName BOOTSTRAP_POLICY = new QName(SP11Constants.SP_NS,
             SPConstants.BOOTSTRAP_POLICY , SP11Constants.SP_PREFIX);
 
-    public final static QName XPATH = new QName(SP11Constants.SP_NS, SPConstants.XPATH_EXPR,
+    public static final QName XPATH = new QName(SP11Constants.SP_NS, SPConstants.XPATH_EXPR,
             SP11Constants.SP_PREFIX);
     
-    public static final QName HEADER = new QName(SP11Constants.SP_NS, "Header");
-
-    public static final QName BODY = new QName(SP11Constants.SP_NS, "Body");
     
-    public static int getInclusionFromAttributeValue(String value ) {
+    private SP11Constants() {
+        //utility class
+    }
+    
+    public IncludeTokenType getInclusionFromAttributeValue(String value) {
         
         if (INCLUDE_ALWAYS.equals(value)) {
-            return SPConstants.INCLUDE_TOEKN_ALWAYS;
+            return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
         } else if (INCLUDE_ALWAYS_TO_RECIPIENT.equals(value)) {
-            return SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT;
+            return IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT;
         } else if (INCLUDE_NEVER.equals(value)) {
-            return SPConstants.INCLUDE_TOKEN_NEVER;
+            return IncludeTokenType.INCLUDE_TOKEN_NEVER;
         } else if (INCLUDE_ONCE.equals(value)) {
-            return SPConstants.INCLUDE_TOKEN_ONCE;
+            return IncludeTokenType.INCLUDE_TOKEN_ONCE;
         } else {
-            return -1;
+            return null;
         }   
     }
     
-    public static String getAttributeValueFromInclusion(int value) {
+    public String getAttributeValueFromInclusion(IncludeTokenType value) {
         
         switch(value) {
-            case SPConstants.INCLUDE_TOEKN_ALWAYS:
-                return SP11Constants.INCLUDE_ALWAYS;
-            case SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT:
-                return SP11Constants.INCLUDE_ALWAYS_TO_RECIPIENT;
-            case SPConstants.INCLUDE_TOKEN_NEVER:
-                return SP11Constants.INCLUDE_NEVER;
-            case SPConstants.INCLUDE_TOKEN_ONCE:
-                return SP11Constants.INCLUDE_ONCE;
-            default :
-                return null;
+        case INCLUDE_TOKEN_ALWAYS:
+            return SP11Constants.INCLUDE_ALWAYS;
+        case INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT:
+            return SP11Constants.INCLUDE_ALWAYS_TO_RECIPIENT;
+        case INCLUDE_TOKEN_NEVER:
+            return SP11Constants.INCLUDE_NEVER;
+        case INCLUDE_TOKEN_ONCE:
+            return SP11Constants.INCLUDE_ONCE;
+        default :
+            return null;
         }
         
     }
+    
+    public Version getVersion() {
+        return Version.SP_V11;
+    }
+    
+    public String getNamespace() {
+        return SP_NS;
+    }
+    public QName getWSS10() {
+        return WSS10;
+    }
+    public QName getWSS11() {
+        return WSS11;
+    }
+    public QName getAlgorithmSuite() {
+        return ALGORITHM_SUITE;
+    }
+    public QName getAsymmetricBinding() {
+        return ASYMMETRIC_BINDING;
+    }
+    public QName getEncryptionToken() {
+        return ENCRYPTION_TOKEN;
+    }
+    public QName getHttpsToken() {
+        return HTTPS_TOKEN;
+    }
+    public QName getInitiatorToken() {
+        return INITIATOR_TOKEN;
+    }
+    public QName getIssuedToken() {
+        return ISSUED_TOKEN;
+    }
+    public QName getLayout() {
+        return LAYOUT;
+    }
+    public QName getProtectionToken() {
+        return PROTECTION_TOKEN;
+    }
+    public QName getRecipientToken() {
+        return RECIPIENT_TOKEN;
+    }
+    public QName getRequiredElements() {
+        return REQUIRED_ELEMENTS;
+    }
+    public QName getSecureConversationToken() {
+        return SECURE_CONVERSATION_TOKEN;
+    }
+    public QName getSecurityContextToken() {
+        return SECURITY_CONTEXT_TOKEN;
+    }
+    public QName getSignatureToken() {
+        return SIGNATURE_TOKEN;
+    }
+    public QName getSignedElements() {
+        return SIGNED_ELEMENTS;
+    }
+    public QName getEncryptedElements() {
+        return ENCRYPTED_ELEMENTS;
+    }
+    public QName getSignedParts() {
+        return SIGNED_PARTS;
+    }
+    public QName getEncryptedParts() {
+        return ENCRYPTED_PARTS;
+    }  
+    public QName getSymmetricBinding() {
+        return SYMMETRIC_BINDING;
+    }
+    public QName getTransportBinding() {
+        return TRANSPORT_BINDING;
+    }
+    public QName getTransportToken() {
+        return TRANSPORT_TOKEN;
+    }
+    public QName getUserNameToken() {
+        return USERNAME_TOKEN;
+    }
+    public QName getX509Token() {
+        return X509_TOKEN;
+    }
 
+    
+    public QName getSupportingTokens() {
+        return SUPPORTING_TOKENS;
+    }
+    public QName getSignedSupportingTokens() {
+        return SIGNED_SUPPORTING_TOKENS;
+    }
+    public QName getEndorsingSupportingTokens() {
+        return ENDORSING_SUPPORTING_TOKENS;
+    }
+    public QName getSignedEndorsingSupportingTokens() {
+        return SIGNED_ENDORSING_SUPPORTING_TOKENS;
+    }
+
+    public QName getIncludeToken() {
+        return INCLUDE_TOKEN;
+    }
+
+    public QName getRequiredDerivedKeys() {
+        return REQUIRE_DERIVED_KEYS;
+    }
+
+    
 }

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP11Constants.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java (from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP12Constants.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java?p2=cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java&p1=webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP12Constants.java&r1=674910&r2=675332&rev=675332&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SP12Constants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java Wed Jul  9 13:11:45 2008
@@ -1,43 +1,69 @@
-package org.apache.ws.secpolicy;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.security.policy;
 
 import javax.xml.namespace.QName;
 
-public class SP12Constants {
+import org.apache.cxf.ws.security.policy.SPConstants.Version;
 
-    public final static String SP_NS = "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";
+public final class SP12Constants extends SPConstants {
 
-    public final static String SP_PREFIX = "sp";
+    public static final SP12Constants INSTANCE = new SP12Constants();
+    
+    public static final String SP_NS = "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";
+
+    public static final String SP_PREFIX = "sp";
     
     public static final QName INCLUDE_TOKEN = new QName(SP_NS, SPConstants.ATTR_INCLUDE_TOKEN,
             SP12Constants.SP_PREFIX);
     
-    public final static String INCLUDE_NEVER = SP12Constants.SP_NS + 
-                                                                SPConstants.INCLUDE_TOKEN_NEVER_SUFFIX;
+    public static final String INCLUDE_NEVER = SP12Constants.SP_NS
+        + SPConstants.INCLUDE_TOKEN_NEVER_SUFFIX;
 
-    public final static String INCLUDE_ONCE = SP12Constants.SP_NS + 
-                                                                SPConstants.INCLUDE_TOKEN_ONCE_SUFFIX;
+    public static final String INCLUDE_ONCE = SP12Constants.SP_NS 
+        + SPConstants.INCLUDE_TOKEN_ONCE_SUFFIX;
 
-    public final static String INCLUDE_ALWAYS_TO_RECIPIENT = SP12Constants.SP_NS
+    public static final String INCLUDE_ALWAYS_TO_RECIPIENT = SP12Constants.SP_NS
         + SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT_SUFFIX;
     
-    public final static String INCLUDE_ALWAYS_TO_INITIATOR = SP12Constants.SP_NS
-    + SPConstants.INCLUDE_TOEKN_ALWAYS_TO_INITIATOR_SUFFIX;
+    public static final String INCLUDE_ALWAYS_TO_INITIATOR = SP12Constants.SP_NS
+        + SPConstants.INCLUDE_TOEKN_ALWAYS_TO_INITIATOR_SUFFIX;
 
-    public final static String INCLUDE_ALWAYS = SP12Constants.SP_NS
+    public static final String INCLUDE_ALWAYS = SP12Constants.SP_NS
         + SPConstants.INCLUDE_TOEKN_ALWAYS_SUFFIX;
     
     public static final QName TRUST_13 = new QName(SP11Constants.SP_NS, SPConstants.TRUST_13,
             SP11Constants.SP_PREFIX);
     
-    public final static QName REQUIRE_CLIENT_CERTIFICATE = new QName(SP12Constants.SP_NS, "RequireClientCertificate", SP12Constants.SP_PREFIX); 
+    public static final QName REQUIRE_CLIENT_CERTIFICATE 
+        = new QName(SP12Constants.SP_NS, "RequireClientCertificate", SP12Constants.SP_PREFIX); 
     
-    public final static QName HTTP_BASIC_AUTHENTICATION = new QName(SP12Constants.SP_NS, "HttpBasicAuthentication", SP12Constants.SP_PREFIX);
+    public static final QName HTTP_BASIC_AUTHENTICATION 
+        = new QName(SP12Constants.SP_NS, "HttpBasicAuthentication", SP12Constants.SP_PREFIX);
     
-    public final static QName HTTP_DIGEST_AUTHENTICATION = new QName(SP12Constants.SP_NS, "HttpDigestAuthentication", SP12Constants.SP_PREFIX);
+    public static final QName HTTP_DIGEST_AUTHENTICATION 
+        = new QName(SP12Constants.SP_NS, "HttpDigestAuthentication", SP12Constants.SP_PREFIX);
     
     // /////////////////////////////////////////////////////////////////////
 
-    public static final QName ATTR_XPATH_VERSION = new QName(SP_NS, SPConstants.XPATH_VERSION, SP12Constants.SP_PREFIX);
+    public static final QName ATTR_XPATH_VERSION 
+        = new QName(SP_NS, SPConstants.XPATH_VERSION, SP12Constants.SP_PREFIX);
     
     ////////////////////////////////////////////////////////////////////////
 
@@ -75,7 +101,7 @@
             SPConstants.SIGN_BEFORE_ENCRYPTING, SP12Constants.SP_PREFIX);
     
     public static final QName ONLY_SIGN_ENTIRE_HEADERS_AND_BODY = new QName(SP12Constants.SP_NS,
-            SPConstants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY,SP12Constants.SP_PREFIX);
+            SPConstants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY, SP12Constants.SP_PREFIX);
 
     public static final QName TRANSPORT_TOKEN = new QName(SP_NS,
             SPConstants.TRANSPORT_TOKEN, SP12Constants.SP_PREFIX);
@@ -211,7 +237,7 @@
             SP12Constants.SP_PREFIX);
 
     public static final QName REQUIRE_EMBEDDED_TOKEN_REFERENCE = new QName(
-            SP12Constants.SP_NS,SPConstants.REQUIRE_EMBEDDED_TOKEN_REFERENCE,
+            SP12Constants.SP_NS, SPConstants.REQUIRE_EMBEDDED_TOKEN_REFERENCE,
             SP12Constants.SP_PREFIX);
 
     public static final QName REQUIRE_THUMBPRINT_REFERENCE = new QName(
@@ -222,7 +248,7 @@
             SP12Constants.SP_NS, SPConstants.MUST_SUPPORT_REF_KEY_IDENTIFIER , SP12Constants.SP_PREFIX);
 
     public static final QName MUST_SUPPORT_REF_ISSUER_SERIAL = new QName(
-            SP12Constants.SP_NS,SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL, SP12Constants.SP_PREFIX);
+            SP12Constants.SP_NS, SPConstants.MUST_SUPPORT_REF_ISSUER_SERIAL, SP12Constants.SP_PREFIX);
 
     public static final QName MUST_SUPPORT_REF_EXTERNAL_URI = new QName(
             SP12Constants.SP_NS, SPConstants.MUST_SUPPORT_REF_EXTERNAL_URI , SP12Constants.SP_PREFIX);
@@ -250,7 +276,7 @@
             SP12Constants.SP_NS, SPConstants.MUST_SUPPORT_CLIENT_CHALLENGE, SP12Constants.SP_PREFIX);
 
     public static final QName MUST_SUPPORT_SERVER_CHALLENGE = new QName(
-            SP12Constants.SP_NS,SPConstants.MUST_SUPPORT_SERVER_CHALLENGE , SP12Constants.SP_PREFIX);
+            SP12Constants.SP_NS, SPConstants.MUST_SUPPORT_SERVER_CHALLENGE , SP12Constants.SP_PREFIX);
 
     public static final QName REQUIRE_CLIENT_ENTROPY = new QName(
             SP12Constants.SP_NS, SPConstants.REQUIRE_CLIENT_ENTROPY, SP12Constants.SP_PREFIX);
@@ -262,7 +288,8 @@
             SP12Constants.SP_NS, SPConstants.MUST_SUPPORT_ISSUED_TOKENS , SP12Constants.SP_PREFIX);
     
     public static final QName REQUIRE_REQUEST_SECURITY_TOKEN_COLLECTION = new QName(
-            SP12Constants.SP_NS, SPConstants.REQUIRE_REQUEST_SECURITY_TOKEN_COLLECTION , SP12Constants.SP_PREFIX);
+            SP12Constants.SP_NS, SPConstants.REQUIRE_REQUEST_SECURITY_TOKEN_COLLECTION,
+            SP12Constants.SP_PREFIX);
     
     public static final QName REQUIRE_APPLIES_TO = new QName(
             SP12Constants.SP_NS, SPConstants.REQUIRE_APPLIES_TO, SP12Constants.SP_PREFIX);
@@ -280,7 +307,7 @@
             SPConstants.REQUIRE_EXPLICIT_DERIVED_KEYS, SP12Constants.SP_PREFIX);
     
     public static final QName REQUIRE_EXTERNAL_URI_REFERNCE = new QName(
-            SP12Constants.SP_NS,SPConstants.REQUIRE_EXTERNAL_URI_REFERNCE, SP12Constants.SP_PREFIX);
+            SP12Constants.SP_NS, SPConstants.REQUIRE_EXTERNAL_URI_REFERNCE, SP12Constants.SP_PREFIX);
 
     public static final QName REQUIRE_EXTERNAL_REFERNCE = new QName(
             SP12Constants.SP_NS, SPConstants.REQUIRE_EXTERNAL_REFERNCE , SP12Constants.SP_PREFIX);
@@ -298,7 +325,7 @@
     public static final QName BOOTSTRAP_POLICY = new QName(SP12Constants.SP_NS,
             SPConstants.BOOTSTRAP_POLICY , SP12Constants.SP_PREFIX);
 
-    public final static QName XPATH = new QName(SP12Constants.SP_NS, SPConstants.XPATH_EXPR,
+    public static final QName XPATH = new QName(SP12Constants.SP_NS, SPConstants.XPATH_EXPR,
             SP12Constants.SP_PREFIX);
     
     public static final QName NO_PASSWORD = new QName(SP12Constants.SP_NS, SPConstants.NO_PASSWORD,
@@ -309,48 +336,148 @@
 
     // /////////////////////////////////////////////////////////////////////////////////////////////
     
-    public static final QName HEADER = new QName(SP12Constants.SP_NS, SPConstants.HEADER);
-    
-    public static final QName BODY = new QName(SP12Constants.SP_NS, SPConstants.BODY);
-    
     public static final QName ATTACHMENTS = new QName(SP12Constants.SP_NS, SPConstants.ATTACHMENTS);
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
+    private SP12Constants() {
+        
+    }
+    
     
-    public static int getInclusionFromAttributeValue(String value ) {
+    public IncludeTokenType getInclusionFromAttributeValue(String value) {
         
         if (INCLUDE_ALWAYS.equals(value)) {
-            return SPConstants.INCLUDE_TOEKN_ALWAYS;
+            return IncludeTokenType.INCLUDE_TOKEN_ALWAYS;
         } else if (INCLUDE_ALWAYS_TO_RECIPIENT.equals(value)) {
-            return SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT;
+            return IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT;
         } else if (INCLUDE_ALWAYS_TO_INITIATOR.equals(value)) { 
-            return SPConstants.INCLUDE_TOEKN_ALWAYS_TO_INITIATOR;
+            return IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_INITIATOR;
         } else if (INCLUDE_NEVER.equals(value)) {
-            return SPConstants.INCLUDE_TOKEN_NEVER;
+            return IncludeTokenType.INCLUDE_TOKEN_NEVER;
         } else if (INCLUDE_ONCE.equals(value)) {
-            return SPConstants.INCLUDE_TOKEN_ONCE;
+            return IncludeTokenType.INCLUDE_TOKEN_ONCE;
         } else {
-            return -1;
+            return null;
         }   
     }
     
-    public static String getAttributeValueFromInclusion(int value) {
+    public String getAttributeValueFromInclusion(IncludeTokenType value) {
         
         switch(value) {
-            case SPConstants.INCLUDE_TOEKN_ALWAYS:
-                return SP12Constants.INCLUDE_ALWAYS;
-            case SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT:
-                return SP12Constants.INCLUDE_ALWAYS_TO_RECIPIENT;
-            case SPConstants.INCLUDE_TOEKN_ALWAYS_TO_INITIATOR:
-                return SP12Constants.INCLUDE_ALWAYS_TO_INITIATOR;
-            case SPConstants.INCLUDE_TOKEN_NEVER:
-                return SP12Constants.INCLUDE_NEVER;
-            case SPConstants.INCLUDE_TOKEN_ONCE:
-                return SP12Constants.INCLUDE_ONCE;
-            default :
-                return null;
+        case INCLUDE_TOKEN_ALWAYS:
+            return SP12Constants.INCLUDE_ALWAYS;
+        case INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT:
+            return SP12Constants.INCLUDE_ALWAYS_TO_RECIPIENT;
+        case INCLUDE_TOKEN_ALWAYS_TO_INITIATOR:
+            return SP12Constants.INCLUDE_ALWAYS_TO_INITIATOR;
+        case INCLUDE_TOKEN_NEVER:
+            return SP12Constants.INCLUDE_NEVER;
+        case INCLUDE_TOKEN_ONCE:
+            return SP12Constants.INCLUDE_ONCE;
+        default:
+            return null;
         }
         
     }
+    public Version getVersion() {
+        return Version.SP_V12;
+    }
+
+    public String getNamespace() {
+        return SP_NS;
+    }
+    public QName getWSS10() {
+        return WSS10;
+    }
+    public QName getWSS11() {
+        return WSS11;
+    }
+    public QName getAlgorithmSuite() {
+        return ALGORITHM_SUITE;
+    }
+    public QName getAsymmetricBinding() {
+        return ASYMMETRIC_BINDING;
+    }
+    public QName getEncryptionToken() {
+        return ENCRYPTION_TOKEN;
+    }
+    public QName getHttpsToken() {
+        return HTTPS_TOKEN;
+    }
+    public QName getInitiatorToken() {
+        return INITIATOR_TOKEN;
+    }
+    public QName getIssuedToken() {
+        return ISSUED_TOKEN;
+    }
+    public QName getLayout() {
+        return LAYOUT;
+    }
+    public QName getProtectionToken() {
+        return PROTECTION_TOKEN;
+    }
+    public QName getRecipientToken() {
+        return RECIPIENT_TOKEN;
+    }
+    public QName getRequiredElements() {
+        return REQUIRED_ELEMENTS;
+    }
+    public QName getSecureConversationToken() {
+        return SECURE_CONVERSATION_TOKEN;
+    }
+    public QName getSecurityContextToken() {
+        return SECURITY_CONTEXT_TOKEN;
+    }
+    public QName getSignatureToken() {
+        return SIGNATURE_TOKEN;
+    }
+    public QName getSignedElements() {
+        return SIGNED_ELEMENTS;
+    }
+    public QName getEncryptedElements() {
+        return ENCRYPTED_ELEMENTS;
+    }
+    public QName getSignedParts() {
+        return SIGNED_PARTS;
+    }
+    public QName getEncryptedParts() {
+        return ENCRYPTED_PARTS;
+    }
+    public QName getSymmetricBinding() {
+        return SYMMETRIC_BINDING;
+    }
+    public QName getTransportBinding() {
+        return TRANSPORT_BINDING;
+    }
+    public QName getTransportToken() {
+        return TRANSPORT_TOKEN;
+    }
+    public QName getUserNameToken() {
+        return USERNAME_TOKEN;
+    }
+    public QName getX509Token() {
+        return X509_TOKEN;
+    }
+    
+    
+    public QName getSupportingTokens() {
+        return SUPPORTING_TOKENS;
+    }
+    public QName getSignedSupportingTokens() {
+        return SIGNED_SUPPORTING_TOKENS;
+    }
+    public QName getEndorsingSupportingTokens() {
+        return ENDORSING_SUPPORTING_TOKENS;
+    }
+    public QName getSignedEndorsingSupportingTokens() {
+        return SIGNED_ENDORSING_SUPPORTING_TOKENS;
+    }
+    
+    public QName getIncludeToken() {
+        return INCLUDE_TOKEN;
+    }
+    public QName getRequiredDerivedKeys() {
+        return REQUIRE_DERIVED_KEYS;
+    }
 
 }

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SP12Constants.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java (from r674910, webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java?p2=cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java&p1=webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java&r1=674910&r2=675332&rev=675332&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy/SPConstants.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java Wed Jul  9 13:11:45 2008
@@ -1,24 +1,26 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
-
-package org.apache.ws.secpolicy;
+package org.apache.cxf.ws.security.policy;
 
 import javax.xml.namespace.QName;
 
-public class SPConstants {
+public abstract class SPConstants {
     
     public static final String P_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
 
@@ -26,266 +28,267 @@
 
     public static final QName POLICY = new QName(P_NS, "Policy", P_PREFIX);
     
-    public static final int SP_V11 = 1;
     
-    public static final int SP_V12 = 2;
+    public enum Version {
+        SP_V11,
+        SP_V12
+    };
+
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public final static String LAYOUT = "Layout";
+    public static final String LAYOUT = "Layout";
 
     /**
      * Security Header Layout : Strict
      */
-    public final static String LAYOUT_STRICT = "Strict";
+    public static final String LAYOUT_STRICT = "Strict";
 
     /**
      * Security Header Layout : Lax
      */
-    public final static String LAYOUT_LAX = "Lax";
+    public static final String LAYOUT_LAX = "Lax";
 
     /**
      * Security Header Layout : LaxTimestampFirst
      */
-    public final static String LAYOUT_LAX_TIMESTAMP_FIRST = "LaxTimestampFirst";
+    public static final String LAYOUT_LAX_TIMESTAMP_FIRST = "LaxTimestampFirst";
 
     /**
      * Security Header Layout : LaxTimestampLast
      */
-    public final static String LAYOUT_LAX_TIMESTAMP_LAST = "LaxTimestampLast";
+    public static final String LAYOUT_LAX_TIMESTAMP_LAST = "LaxTimestampLast";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
 
     /**
      * Protection Order : EncryptBeforeSigning
      */
-    public final static String ENCRYPT_BEFORE_SIGNING = "EncryptBeforeSigning";
+    public static final String ENCRYPT_BEFORE_SIGNING = "EncryptBeforeSigning";
 
     /**
      * Protection Order : SignBeforeEncrypting
      */
-    public final static String SIGN_BEFORE_ENCRYPTING = "SignBeforeEncrypting";
+    public static final String SIGN_BEFORE_ENCRYPTING = "SignBeforeEncrypting";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public final static String ENCRYPT_SIGNATURE = "EncryptSignature";
+    public static final String ENCRYPT_SIGNATURE = "EncryptSignature";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public final static String PROTECT_TOKENS = "ProtectTokens";
+    public static final String PROTECT_TOKENS = "ProtectTokens";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public final static String ONLY_SIGN_ENTIRE_HEADERS_AND_BODY = "OnlySignEntireHeadersAndBody";
+    public static final String ONLY_SIGN_ENTIRE_HEADERS_AND_BODY = "OnlySignEntireHeadersAndBody";
      
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public final static String INCLUDE_TIMESTAMP = "IncludeTimestamp";
+    public static final String INCLUDE_TIMESTAMP = "IncludeTimestamp";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public final static String SIGNED_PARTS = "SignedParts";
+    public static final String SIGNED_PARTS = "SignedParts";
     
-    public final static String ENCRYPTED_PARTS = "EncryptedParts";
+    public static final String ENCRYPTED_PARTS = "EncryptedParts";
     
-    public final static String SIGNED_ELEMENTS = "SignedElements";
+    public static final String SIGNED_ELEMENTS = "SignedElements";
     
-    public final static String ENCRYPTED_ELEMENTS = "EncryptedElements";
+    public static final String ENCRYPTED_ELEMENTS = "EncryptedElements";
     
-    public final static String REQUIRED_ELEMENTS = "RequiredElements";
+    public static final String REQUIRED_ELEMENTS = "RequiredElements";
     
-    public final static String CONTENT_ENCRYPTED_ELEMENTS = "ContentEncryptedElements";
+    public static final String CONTENT_ENCRYPTED_ELEMENTS = "ContentEncryptedElements";
     
-    public final static String REQUIRED_PARTS = "RequiredParts";
+    public static final String REQUIRED_PARTS = "RequiredParts";
     
-    public final static String XPATH_VERSION = "XPathVersion";
+    public static final String XPATH_VERSION = "XPathVersion";
     
-    public final static String XPATH_EXPR = "XPath";
+    public static final String XPATH_EXPR = "XPath";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
     // X509 Token types 
     
-    public final static String X509_TOKEN = "X509Token";
+    public static final String X509_TOKEN = "X509Token";
 
-    public final static String WSS_X509_V1_TOKEN10 = "WssX509V1Token10";
+    public static final String WSS_X509_V1_TOKEN10 = "WssX509V1Token10";
 
-    public final static String WSS_X509_V3_TOKEN10 = "WssX509V3Token10";
+    public static final String WSS_X509_V3_TOKEN10 = "WssX509V3Token10";
 
-    public final static String WSS_X509_PKCS7_TOKEN10 = "WssX509Pkcs7Token10";
+    public static final String WSS_X509_PKCS7_TOKEN10 = "WssX509Pkcs7Token10";
 
-    public final static String WSS_X509_PKI_PATH_V1_TOKEN10 = "WssX509PkiPathV1Token10";
+    public static final String WSS_X509_PKI_PATH_V1_TOKEN10 = "WssX509PkiPathV1Token10";
 
-    public final static String WSS_X509_V1_TOKEN11 = "WssX509V1Token11";
+    public static final String WSS_X509_V1_TOKEN11 = "WssX509V1Token11";
 
-    public final static String WSS_X509_V3_TOKEN11 = "WssX509V3Token11";
+    public static final String WSS_X509_V3_TOKEN11 = "WssX509V3Token11";
 
-    public final static String WSS_X509_PKCS7_TOKEN11 = "WssX509Pkcs7Token11";
+    public static final String WSS_X509_PKCS7_TOKEN11 = "WssX509Pkcs7Token11";
 
-    public final static String WSS_X509_PKI_PATH_V1_TOKEN11 = "WssX509PkiPathV1Token11";
+    public static final String WSS_X509_PKI_PATH_V1_TOKEN11 = "WssX509PkiPathV1Token11";
     
     
-    public final static String USERNAME_TOKEN = "UsernameToken";
+    public static final String USERNAME_TOKEN = "UsernameToken";
     
-    public final static String USERNAME_TOKEN10 = "WssUsernameToken10";
+    public static final String USERNAME_TOKEN10 = "WssUsernameToken10";
     
-    public final static String USERNAME_TOKEN11 = "WssUsernameToken11";
+    public static final String USERNAME_TOKEN11 = "WssUsernameToken11";
 
     
-    public final static String TRANSPORT_TOKEN = "TransportToken";
+    public static final String TRANSPORT_TOKEN = "TransportToken";
     
-    public final static String HTTPS_TOKEN = "HttpsToken";
+    public static final String HTTPS_TOKEN = "HttpsToken";
     
-    public final static QName REQUIRE_CLIENT_CERTIFICATE = new QName("RequireClientCertificate");
+    public static final QName REQUIRE_CLIENT_CERTIFICATE = new QName("RequireClientCertificate");
     
-    public final static QName HTTP_BASIC_AUTHENTICATION = new QName("HttpBasicAuthentication");
+    public static final QName HTTP_BASIC_AUTHENTICATION = new QName("HttpBasicAuthentication");
     
-    public final static QName HTTP_DIGEST_AUTHENTICATION = new QName("HttpDigestAuthentication");
+    public static final QName HTTP_DIGEST_AUTHENTICATION = new QName("HttpDigestAuthentication");
     
-    public final static String SECURITY_CONTEXT_TOKEN = "SecurityContextToken";
+    public static final String SECURITY_CONTEXT_TOKEN = "SecurityContextToken";
     
-    public final static String SECURE_CONVERSATION_TOKEN = "SecureConversationToken";
+    public static final String SECURE_CONVERSATION_TOKEN = "SecureConversationToken";
     
-    public final static String ISSUED_TOKEN = "IssuedToken";
+    public static final String ISSUED_TOKEN = "IssuedToken";
     
 
-    public final static String SIGNATURE_TOKEN = "SignatureToken";
-    
-    public final static String ENCRYPTION_TOKEN = "EncryptionToken";
+    public static final String SIGNATURE_TOKEN = "SignatureToken";
     
-    public final static String PROTECTION_TOKEN = "ProtectionToken";
+    public static final String ENCRYPTION_TOKEN = "EncryptionToken";
     
-    public final static String INITIATOR_TOKEN = "InitiatorToken";
+    public static final String PROTECTION_TOKEN = "ProtectionToken";
     
-    public final static String RECIPIENT_TOKEN = "RecipientToken";
+    public static final String INITIATOR_TOKEN = "InitiatorToken";
     
+    public static final String RECIPIENT_TOKEN = "RecipientToken";
     
     
-    public final static String SUPPORTING_TOKENS = "SupportingTokens";
     
-    public final static String SIGNED_SUPPORTING_TOKENS = "SignedSupportingTokens";
+    public static final String SUPPORTING_TOKENS = "SupportingTokens";
     
-    public final static String ENDORSING_SUPPORTING_TOKENS = "EndorsingSupportingTokens";
+    public static final String SIGNED_SUPPORTING_TOKENS = "SignedSupportingTokens";
     
-    public final static String SIGNED_ENDORSING_SUPPORTING_TOKENS = "SignedEndorsingSupportingTokens";
+    public static final String ENDORSING_SUPPORTING_TOKENS = "EndorsingSupportingTokens";
     
-    public final static String ENCRYPTED_SUPPORTING_TOKENS = "EncryptedSupportingTokens";
+    public static final String SIGNED_ENDORSING_SUPPORTING_TOKENS = "SignedEndorsingSupportingTokens";
     
-    public final static String SIGNED_ENCRYPTED_SUPPORTING_TOKENS = "SignedEncryptedSupportingTokens";
+    public static final String ENCRYPTED_SUPPORTING_TOKENS = "EncryptedSupportingTokens";
     
-    public final static String ENDORSING_ENCRYPTED_SUPPORTING_TOKENS = "EndorsingEncryptedSupportingTokens";
+    public static final String SIGNED_ENCRYPTED_SUPPORTING_TOKENS = "SignedEncryptedSupportingTokens";
     
-    public final static String SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS = "SignedEndorsingEncryptedSupportingTokens";   
-    
-    public final static int SUPPORTING_TOKEN_SUPPORTING = 1;
-
-    public final static int SUPPORTING_TOKEN_ENDORSING = 2;
-
-    public final static int SUPPORTING_TOKEN_SIGNED = 3;
-
-    public final static int SUPPORTING_TOKEN_SIGNED_ENDORSING = 4;
+    public static final String ENDORSING_ENCRYPTED_SUPPORTING_TOKENS = "EndorsingEncryptedSupportingTokens";
     
-    public final static int SUPPORTING_TOKEN_SIGNED_ENCRYPTED = 5;
+    public static final String SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS 
+        = "SignedEndorsingEncryptedSupportingTokens";   
     
-    public final static int SUPPORTING_TOKEN_ENCRYPTED = 6;
     
-    public final static int SUPPORTING_TOKEN_ENDORSING_ENCRYPTED = 7;
-    
-    public final static int SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED = 8;
+    public enum SupportTokenType {
+        SUPPORTING_TOKEN_SUPPORTING,
+        SUPPORTING_TOKEN_ENDORSING,
+        SUPPORTING_TOKEN_SIGNED,
+        SUPPORTING_TOKEN_SIGNED_ENDORSING,
+        SUPPORTING_TOKEN_SIGNED_ENCRYPTED,
+        SUPPORTING_TOKEN_ENCRYPTED,
+        SUPPORTING_TOKEN_ENDORSING_ENCRYPTED,
+        SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED
+    }
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
 
     
-    public final static String ALGO_SUITE = "AlgorithmSuite";
+    public static final String ALGO_SUITE = "AlgorithmSuite";
     
     
     // /
     // /Algorithm Suites
     // /
-    public final static String ALGO_SUITE_BASIC256 = "Basic256";
+    public static final String ALGO_SUITE_BASIC256 = "Basic256";
 
-    public final static String ALGO_SUITE_BASIC192 = "Basic192";
+    public static final String ALGO_SUITE_BASIC192 = "Basic192";
 
-    public final static String ALGO_SUITE_BASIC128 = "Basic128";
+    public static final String ALGO_SUITE_BASIC128 = "Basic128";
 
-    public final static String ALGO_SUITE_TRIPLE_DES = "TripleDes";
+    public static final String ALGO_SUITE_TRIPLE_DES = "TripleDes";
 
-    public final static String ALGO_SUITE_BASIC256_RSA15 = "Basic256Rsa15";
+    public static final String ALGO_SUITE_BASIC256_RSA15 = "Basic256Rsa15";
 
-    public final static String ALGO_SUITE_BASIC192_RSA15 = "Basic192Rsa15";
+    public static final String ALGO_SUITE_BASIC192_RSA15 = "Basic192Rsa15";
 
-    public final static String ALGO_SUITE_BASIC128_RSA15 = "Basic128Rsa15";
+    public static final String ALGO_SUITE_BASIC128_RSA15 = "Basic128Rsa15";
 
-    public final static String ALGO_SUITE_TRIPLE_DES_RSA15 = "TripleDesRsa15";
+    public static final String ALGO_SUITE_TRIPLE_DES_RSA15 = "TripleDesRsa15";
 
-    public final static String ALGO_SUITE_BASIC256_SHA256 = "Basic256Sha256";
+    public static final String ALGO_SUITE_BASIC256_SHA256 = "Basic256Sha256";
 
-    public final static String ALGO_SUITE_BASIC192_SHA256 = "Basic192Sha256";
+    public static final String ALGO_SUITE_BASIC192_SHA256 = "Basic192Sha256";
 
-    public final static String ALGO_SUITE_BASIC128_SHA256 = "Basic128Sha256";
+    public static final String ALGO_SUITE_BASIC128_SHA256 = "Basic128Sha256";
 
-    public final static String ALGO_SUITE_TRIPLE_DES_SHA256 = "TripleDesSha256";
+    public static final String ALGO_SUITE_TRIPLE_DES_SHA256 = "TripleDesSha256";
 
-    public final static String ALGO_SUITE_BASIC256_SHA256_RSA15 = "Basic256Sha256Rsa15";
+    public static final String ALGO_SUITE_BASIC256_SHA256_RSA15 = "Basic256Sha256Rsa15";
 
-    public final static String ALGO_SUITE_BASIC192_SHA256_RSA15 = "Basic192Sha256Rsa15";
+    public static final String ALGO_SUITE_BASIC192_SHA256_RSA15 = "Basic192Sha256Rsa15";
 
-    public final static String ALGO_SUITE_BASIC128_SHA256_RSA15 = "Basic128Sha256Rsa15";
+    public static final String ALGO_SUITE_BASIC128_SHA256_RSA15 = "Basic128Sha256Rsa15";
 
-    public final static String ALGO_SUITE_TRIPLE_DES_SHA256_RSA15 = "TripleDesSha256Rsa15";
+    public static final String ALGO_SUITE_TRIPLE_DES_SHA256_RSA15 = "TripleDesSha256Rsa15";
 
     // /
     // /Algorithms
     // /
-    public final static String HMAC_SHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
+    public static final String HMAC_SHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
 
-    public final static String RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+    public static final String RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
 
-    public final static String SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
+    public static final String SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
 
-    public final static String SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
+    public static final String SHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
 
-    public final static String SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
+    public static final String SHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
 
-    public final static String AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
+    public static final String AES128 = "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
 
-    public final static String AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
+    public static final String AES192 = "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
 
-    public final static String AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
+    public static final String AES256 = "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
 
-    public final static String TRIPLE_DES = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
+    public static final String TRIPLE_DES = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
 
-    public final static String KW_AES128 = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
+    public static final String KW_AES128 = "http://www.w3.org/2001/04/xmlenc#kw-aes128";
 
-    public final static String KW_AES192 = "http://www.w3.org/2001/04/xmlenc#kw-aes192";
+    public static final String KW_AES192 = "http://www.w3.org/2001/04/xmlenc#kw-aes192";
 
-    public final static String KW_AES256 = "http://www.w3.org/2001/04/xmlenc#kw-aes256";
+    public static final String KW_AES256 = "http://www.w3.org/2001/04/xmlenc#kw-aes256";
 
-    public final static String KW_TRIPLE_DES = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
+    public static final String KW_TRIPLE_DES = "http://www.w3.org/2001/04/xmlenc#kw-tripledes";
 
-    public final static String KW_RSA_OAEP = "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p";
+    public static final String KW_RSA_OAEP = "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p";
 
-    public final static String KW_RSA15 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";
+    public static final String KW_RSA15 = "http://www.w3.org/2001/04/xmlenc#rsa-1_5";
 
-    public final static String P_SHA1 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+    public static final String P_SHA1 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
 
-    public final static String P_SHA1_L128 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+    public static final String P_SHA1_L128 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
 
-    public final static String P_SHA1_L192 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+    public static final String P_SHA1_L192 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
 
-    public final static String P_SHA1_L256 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
+    public static final String P_SHA1_L256 = "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1";
 
-    public final static String XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+    public static final String XPATH = "http://www.w3.org/TR/1999/REC-xpath-19991116";
 
-    public final static String XPATH20 = "http://www.w3.org/2002/06/xmldsig-filter2";
+    public static final String XPATH20 = "http://www.w3.org/2002/06/xmldsig-filter2";
 
-    public final static String C14N = "http://www.w3.org/2001/10/xml-c14n#";
+    public static final String C14N = "http://www.w3.org/2001/10/xml-c14n#";
 
-    public final static String EX_C14N = "http://www.w3.org/2001/10/xml-exc-c14n#";
+    public static final String EX_C14N = "http://www.w3.org/2001/10/xml-exc-c14n#";
 
-    public final static String SNT = "http://www.w3.org/TR/soap12-n11n";
+    public static final String SNT = "http://www.w3.org/TR/soap12-n11n";
 
-    public final static String STRT10 = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
+    public static final String STRT10 
+        = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform";
 
     // /////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -301,48 +304,35 @@
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
-    public final static String ATTR_INCLUDE_TOKEN = "IncludeToken";
-    
+    public static final String ATTR_INCLUDE_TOKEN = "IncludeToken";
     public static final String INCLUDE_TOKEN_NEVER_SUFFIX = "/IncludeToken/Never";
-    
     public static final String INCLUDE_TOKEN_ONCE_SUFFIX = "/IncludeToken/Once";
-    
     public static final String INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT_SUFFIX = "/IncludeToken/AlwaysToRecipient";
-    
     public static final String INCLUDE_TOEKN_ALWAYS_TO_INITIATOR_SUFFIX = "/IncludeToken/AlwaysToInitiator";
-    
     public static final String INCLUDE_TOEKN_ALWAYS_SUFFIX = "/IncludeToken/Always";
     
-    public static final int INCLUDE_TOKEN_NEVER = 1;
-    
-    public static final int INCLUDE_TOKEN_ONCE = 2;
-    
-    public static final int INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT = 3;
-    
-    public static final int INCLUDE_TOEKN_ALWAYS_TO_INITIATOR = 4;
-    
-    public static final int INCLUDE_TOEKN_ALWAYS = 5;
     
+    public enum IncludeTokenType {
+        INCLUDE_TOKEN_NEVER,
+        INCLUDE_TOKEN_ONCE,
+        INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT,
+        INCLUDE_TOKEN_ALWAYS_TO_INITIATOR,
+        INCLUDE_TOKEN_ALWAYS
+    };
     
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
     public static final String TRANSPORT_BINDING = "TransportBinding";
-    
     public static final String ASYMMETRIC_BINDING = "AsymmetricBinding";
-    
     public static final String SYMMETRIC_BINDING = "SymmetricBinding";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
     public static final String REQUIRE_KEY_IDENTIFIRE_REFERENCE = "RequireKeyIdentifireReference";
-    
     public static final String REQUIRE_ISSUER_SERIAL_REFERENCE = "RequireIssuerSerialReference";
-    
     public static final String REQUIRE_EMBEDDED_TOKEN_REFERENCE = "RequireEmbeddedTokenReference";
-    
     public static final String REQUIRE_THUMBPRINT_REFERENCE = "RequireThumbprintReference";
-    
     public static final String REQUIRE_SIGNATURE_CONFIRMATION = "RequireSignatureConfirmation";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
@@ -381,7 +371,8 @@
     
     public static final String MUST_SUPPORT_ISSUED_TOKENS = "MustSupportIssuedTokens";
     
-    public static final String REQUIRE_REQUEST_SECURITY_TOKEN_COLLECTION = "RequireRequestSecurityTokenCollection";
+    public static final String REQUIRE_REQUEST_SECURITY_TOKEN_COLLECTION 
+        = "RequireRequestSecurityTokenCollection";
     
     public static final String REQUIRE_APPLIES_TO = "RequireAppliesTo";
     
@@ -409,13 +400,13 @@
     
     public static final String HEADER = "Header";
     
-    public static final String BODY = "Body" ;
+    public static final String BODY = "Body";
     
     public static final String ATTACHMENTS = "Attachments";
     
-    public static final QName NAME = new QName("Name");
+    public static final String NAME = "Name";
     
-    public static final QName NAMESPACE = new QName("Namespace");
+    public static final String NAMESPACE = "Namespace";
     
     ////////////////////////////////////////////////////////////////////////////////////////////////
     
@@ -423,7 +414,49 @@
     
     public static final String HASH_PASSWORD = "HashPassword";
     
+    
+    
+    public abstract Version getVersion();
+    
+    public abstract String getNamespace();
+    public abstract QName getWSS10();
+    public abstract QName getWSS11();
+    public abstract QName getAlgorithmSuite();
+    public abstract QName getAsymmetricBinding();
+    public abstract QName getEncryptionToken();
+    public abstract QName getHttpsToken();
+    public abstract QName getInitiatorToken();
+    public abstract QName getIssuedToken();
+    public abstract QName getIncludeToken();
+    public abstract QName getLayout();
+    public abstract QName getProtectionToken();
+    public abstract QName getRecipientToken();
+    public abstract QName getRequiredElements();
+    public abstract QName getSecureConversationToken();
+    public abstract QName getSecurityContextToken();
+    public abstract QName getSignatureToken();
+    public abstract QName getSignedElements();
+    public abstract QName getEncryptedElements();
+    public abstract QName getSignedParts();
+    public abstract QName getEncryptedParts();
+    
+    public abstract QName getSymmetricBinding();
+    public abstract QName getTransportBinding();
+    public abstract QName getTransportToken();
+    public abstract QName getUserNameToken();
+    public abstract QName getX509Token();
+    
+    public abstract QName getSupportingTokens();
+    public abstract QName getSignedSupportingTokens();
+    public abstract QName getEndorsingSupportingTokens();
+    public abstract QName getSignedEndorsingSupportingTokens();
+
 
+    //For X509 tokens
+    public abstract QName getRequiredDerivedKeys();
+    
     
+    public abstract IncludeTokenType getInclusionFromAttributeValue(String value);
+    public abstract String getAttributeValueFromInclusion(IncludeTokenType value);
 
 }

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/SPConstants.java
------------------------------------------------------------------------------
    svn:mergeinfo = 

Added: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java?rev=675332&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java (added)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java Wed Jul  9 13:11:45 2008
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.security.policy;
+
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.i18n.UncheckedException;
+
+public class WSSPolicyException extends UncheckedException {
+    public WSSPolicyException(Message msg, Throwable t) {
+        super(msg, t);
+    }
+
+    public WSSPolicyException(Message msg) {
+        super(msg);
+    }
+
+    public WSSPolicyException(Throwable cause) {
+        super(cause);
+    }
+
+
+}

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/WSSPolicyException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AlgorithmSuiteBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AlgorithmSuiteBuilder.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AlgorithmSuiteBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AlgorithmSuiteBuilder.java Wed Jul  9 13:11:45 2008
@@ -1,48 +1,71 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
-package org.apache.ws.secpolicy11.builders;
+package org.apache.cxf.ws.security.policy.builders;
 
-import org.apache.axiom.om.OMElement;
-import org.apache.neethi.Assertion;
-import org.apache.neethi.AssertionBuilderFactory;
-import org.apache.neethi.builders.AssertionBuilder;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.apache.ws.secpolicy.WSSPolicyException;
-import org.apache.ws.secpolicy.model.AlgorithmSuite;
+
+import java.util.Arrays;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Element;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.PolicyAssertion;
+import org.apache.cxf.ws.security.policy.SP11Constants;
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.cxf.ws.security.policy.WSSPolicyException;
+import org.apache.cxf.ws.security.policy.model.AlgorithmSuite;
+
+
 public class AlgorithmSuiteBuilder implements AssertionBuilder {
+    private static final List<QName> KNOWN_ELEMENTS 
+        = Arrays.asList(SP11Constants.ALGORITHM_SUITE, SP12Constants.ALGORITHM_SUITE);
+    
+    
+    public PolicyAssertion build(Element element)
+        throws IllegalArgumentException {
         
-    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
-        AlgorithmSuite algorithmSuite = new AlgorithmSuite(SPConstants.SP_V11);
-        
-        OMElement policyElem = element.getFirstElement();
-        
+        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
+            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
+
+        AlgorithmSuite algorithmSuite = new AlgorithmSuite(consts);
+
+        Element policyElem = DOMUtils.getFirstElement(element);
         try {
-            algorithmSuite.setAlgorithmSuite(policyElem.getFirstElement().getLocalName());
+            algorithmSuite.setAlgorithmSuite(DOMUtils.getFirstElement(policyElem).getLocalName());
         } catch (WSSPolicyException e) {
             throw new IllegalArgumentException(e);
         }
-        
+
         return algorithmSuite;
     }
+
+    public List<QName> getKnownElements() {
+        return KNOWN_ELEMENTS;
+    }
+
     
-    public QName[] getKnownElements() {
-        return new QName[] {SP11Constants.ALGORITHM_SUITE};
+    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
+        // TODO Auto-generated method stub
+        return null;
     }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/AsymmetricBindingBuilder.java Wed Jul  9 13:11:45 2008
@@ -1,105 +1,135 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
-package org.apache.ws.secpolicy11.builders;
+package org.apache.cxf.ws.security.policy.builders;
 
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
 import javax.xml.namespace.QName;
 
-import org.apache.axiom.om.OMElement;
+import org.w3c.dom.Element;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.PolicyAssertion;
+import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.security.policy.SP11Constants;
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.cxf.ws.security.policy.model.AlgorithmSuite;
+import org.apache.cxf.ws.security.policy.model.AsymmetricBinding;
+import org.apache.cxf.ws.security.policy.model.InitiatorToken;
+import org.apache.cxf.ws.security.policy.model.Layout;
+import org.apache.cxf.ws.security.policy.model.RecipientToken;
 import org.apache.neethi.Assertion;
-import org.apache.neethi.AssertionBuilderFactory;
 import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyEngine;
-import org.apache.neethi.builders.AssertionBuilder;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SPConstants;
-import org.apache.ws.secpolicy.model.AlgorithmSuite;
-import org.apache.ws.secpolicy.model.AsymmetricBinding;
-import org.apache.ws.secpolicy.model.InitiatorToken;
-import org.apache.ws.secpolicy.model.Layout;
-import org.apache.ws.secpolicy.model.RecipientToken;
 
 public class AsymmetricBindingBuilder implements AssertionBuilder {
+    private static final List<QName> KNOWN_ELEMENTS 
+        = Arrays.asList(SP11Constants.ASYMMETRIC_BINDING, SP12Constants.ASYMMETRIC_BINDING);
+
+    PolicyBuilder builder;
+    public AsymmetricBindingBuilder(PolicyBuilder b) {
+        builder = b;
+    }    
+    public List<QName> getKnownElements() {
+        return KNOWN_ELEMENTS;
+    }
+    
+    public PolicyAssertion build(Element element)
+        throws IllegalArgumentException {
+
+        SPConstants consts = SP11Constants.SP_NS.equals(element.getNamespaceURI())
+            ? SP11Constants.INSTANCE : SP12Constants.INSTANCE;
 
-    public Assertion build(OMElement element, AssertionBuilderFactory factory) throws IllegalArgumentException {
-        
-        AsymmetricBinding asymmetricBinding =  new AsymmetricBinding(SPConstants.SP_V11);
-        
-        Policy policy = PolicyEngine.getPolicy(element.getFirstElement());
-        policy = (Policy) policy.normalize(false);
         
+        AsymmetricBinding asymmetricBinding = new AsymmetricBinding(consts);
+
+        Policy policy = builder.getPolicy(DOMUtils.getFirstElement(element));
+        policy = (Policy)policy.normalize(false);
+
         for (Iterator iterator = policy.getAlternatives(); iterator.hasNext();) {
-            processAlternative((List) iterator.next(), asymmetricBinding);
-            
+            processAlternative((List)iterator.next(), asymmetricBinding, consts);
+
             /*
              * since there should be only one alternative
              */
             break;
         }
-        
+
         return asymmetricBinding;
     }
-    
-    private void processAlternative(List assertions, AsymmetricBinding asymmetricBinding) {
-               
+
+    private void processAlternative(List assertions, 
+                                    AsymmetricBinding asymmetricBinding,
+                                    SPConstants consts) {
+
         Assertion assertion;
         QName name;
-        
+
         for (Iterator iterator = assertions.iterator(); iterator.hasNext();) {
-            assertion = (Assertion) iterator.next();
+            assertion = (Assertion)iterator.next();
             name = assertion.getName();
+
+            if (!consts.getNamespace().equals(name.getNamespaceURI())) {
+                continue;
+            }
+
             
-            if (SP11Constants.INITIATOR_TOKEN.equals(name)) {
-                asymmetricBinding.setInitiatorToken((InitiatorToken) assertion);
-                
-            } else if (SP11Constants.RECIPIENT_TOKEN.equals(name)){
-                asymmetricBinding.setRecipientToken((RecipientToken) assertion);
-                
-            } else if (SP11Constants.ALGORITHM_SUITE.equals(name)) {
-                asymmetricBinding.setAlgorithmSuite((AlgorithmSuite) assertion);
-            
-            } else if (SP11Constants.LAYOUT.equals(name)) {
-                asymmetricBinding.setLayout((Layout) assertion);
-                
-            } else if (SP11Constants.INCLUDE_TIMESTAMP.equals(name)) {
+            if (SPConstants.INITIATOR_TOKEN.equals(name.getLocalPart())) {
+                asymmetricBinding.setInitiatorToken((InitiatorToken)assertion);
+
+            } else if (SPConstants.RECIPIENT_TOKEN.equals(name.getLocalPart())) {
+                asymmetricBinding.setRecipientToken((RecipientToken)assertion);
+
+            } else if (SPConstants.ALGO_SUITE.equals(name.getLocalPart())) {
+                asymmetricBinding.setAlgorithmSuite((AlgorithmSuite)assertion);
+
+            } else if (SPConstants.LAYOUT.equals(name.getLocalPart())) {
+                asymmetricBinding.setLayout((Layout)assertion);
+
+            } else if (SPConstants.INCLUDE_TIMESTAMP.equals(name.getLocalPart())) {
                 asymmetricBinding.setIncludeTimestamp(true);
 
             } else if (SPConstants.ENCRYPT_BEFORE_SIGNING.equals(name.getLocalPart())) {
                 asymmetricBinding.setProtectionOrder(SPConstants.ENCRYPT_BEFORE_SIGNING);
-                
+
             } else if (SPConstants.SIGN_BEFORE_ENCRYPTING.equals(name.getLocalPart())) {
                 asymmetricBinding.setProtectionOrder(SPConstants.SIGN_BEFORE_ENCRYPTING);
-                
+
             } else if (SPConstants.ENCRYPT_SIGNATURE.equals(name.getLocalPart())) {
                 asymmetricBinding.setSignatureProtection(true);
-                
+
             } else if (SPConstants.PROTECT_TOKENS.equals(name.getLocalPart())) {
                 asymmetricBinding.setTokenProtection(true);
-                
+
             } else if (SPConstants.ONLY_SIGN_ENTIRE_HEADERS_AND_BODY.equals(name.getLocalPart())) {
                 asymmetricBinding.setEntireHeadersAndBodySignatures(true);
             }
         }
     }
-    
-    public QName[] getKnownElements() {
-        return new QName[]{SP11Constants.ASYMMETRIC_BINDING};
+
+
+    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
+        // TODO Auto-generated method stub
+        return null;
     }
-    
+
 }
- 
\ No newline at end of file

Added: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java?rev=675332&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java (added)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java Wed Jul  9 13:11:45 2008
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.security.policy.builders;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.PolicyAssertion;
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.cxf.ws.security.policy.model.ContentEncryptedElements;
+
+
+public class ContentEncryptedElementsBuilder implements AssertionBuilder {
+
+    
+    public PolicyAssertion build(Element element) {
+        
+        ContentEncryptedElements contentEncryptedElements 
+            = new ContentEncryptedElements(SP12Constants.INSTANCE);
+        String attrXPathVersion = DOMUtils.getAttribute(element, SP12Constants.ATTR_XPATH_VERSION);
+        
+        if (attrXPathVersion != null) {
+            contentEncryptedElements.setXPathVersion(attrXPathVersion);
+        }
+        Node nd = element.getFirstChild();
+        while (nd != null) {
+            if (nd instanceof Element) {
+                processElement((Element)nd, contentEncryptedElements);                
+            }
+            nd = nd.getNextSibling();
+        }
+        
+        return contentEncryptedElements;
+    }
+    public List<QName> getKnownElements() {
+        return Collections.singletonList(SP12Constants.CONTENT_ENCRYPTED_ELEMENTS);
+    }
+    private void processElement(Element element, ContentEncryptedElements parent) {
+        if (SPConstants.XPATH_EXPR.equals(element.getLocalName())) {
+            parent.addXPathExpression(DOMUtils.getRawContent(element));
+            addNamespaces(element, parent);
+        }
+    }
+    private void addNamespaces(Node element, ContentEncryptedElements parent) {
+        if (element.getParentNode() != null) {
+            addNamespaces(element.getParentNode(), parent);
+        }
+        if (element instanceof Element) {
+            Element el = (Element)element;
+            NamedNodeMap map = el.getAttributes();
+            for (int x = 0; x < map.getLength(); x++) {
+                Attr attr = (Attr)map.item(x);
+                if ("xmlns".equals(attr.getPrefix())) {
+                    parent.addDeclaredNamespaces(attr.getValue(), attr.getLocalName());
+                }
+            }
+        }
+    }
+
+    public PolicyAssertion buildCompatible(PolicyAssertion a, PolicyAssertion b) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+}

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ContentEncryptedElementsBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain