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 [5/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...

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/IssuedToken.java Wed Jul  9 13:11:45 2008
@@ -1,61 +1,62 @@
-/*
- * Copyright 2004,2005 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
+/**
+ * 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
+ * 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.model;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.w3c.dom.Element;
+
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.security.policy.SPConstants;
+
 /**
  * Model bean for the IssuedToken assertion.
  */
 public class IssuedToken extends Token {
 
-    private OMElement issuerEpr;
-    
-    private OMElement issuerMex;
-
-    private OMElement rstTemplate;
-
-    boolean requireExternalReference;
-
-    boolean requireInternalReference;
-    
-    public IssuedToken(int version) {
-        setVersion(version);
+    private Element issuerEpr;
+
+    private Element issuerMex;
+
+    private Element rstTemplate;
+
+    private boolean requireExternalReference;
+
+    private boolean requireInternalReference;
+
+    public IssuedToken(SPConstants version) {
+        super(version);
     }
 
     /**
      * @return Returns the issuerEpr.
      */
-    public OMElement getIssuerEpr() {
+    public Element getIssuerEpr() {
         return issuerEpr;
     }
 
     /**
-     * @param issuerEpr
-     *            The issuerEpr to set.
+     * @param issuerEpr The issuerEpr to set.
      */
-    public void setIssuerEpr(OMElement issuerEpr) {
+    public void setIssuerEpr(Element issuerEpr) {
         this.issuerEpr = issuerEpr;
     }
 
@@ -67,8 +68,7 @@
     }
 
     /**
-     * @param requireExternalReference
-     *            The requireExternalReference to set.
+     * @param requireExternalReference The requireExternalReference to set.
      */
     public void setRequireExternalReference(boolean requireExternalReference) {
         this.requireExternalReference = requireExternalReference;
@@ -82,8 +82,7 @@
     }
 
     /**
-     * @param requireInternalReference
-     *            The requireInternalReference to set.
+     * @param requireInternalReference The requireInternalReference to set.
      */
     public void setRequireInternalReference(boolean requireInternalReference) {
         this.requireInternalReference = requireInternalReference;
@@ -92,24 +91,19 @@
     /**
      * @return Returns the rstTemplate.
      */
-    public OMElement getRstTemplate() {
+    public Element getRstTemplate() {
         return rstTemplate;
     }
 
     /**
-     * @param rstTemplate
-     *            The rstTemplate to set.
+     * @param rstTemplate The rstTemplate to set.
      */
-    public void setRstTemplate(OMElement rstTemplate) {
+    public void setRstTemplate(Element rstTemplate) {
         this.rstTemplate = rstTemplate;
     }
 
     public QName getName() {
-        if (version == SPConstants.SP_V12) {
-            return SP12Constants.ISSUED_TOKEN;
-        } else {
-            return SP11Constants.ISSUED_TOKEN; 
-        }      
+        return constants.getIssuedToken();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
@@ -135,29 +129,22 @@
         }
 
         String inclusion;
-        
-        if (version == SPConstants.SP_V12) {
-            inclusion = SP12Constants.getAttributeValueFromInclusion(getInclusion());
-        } else {
-            inclusion = SP11Constants.getAttributeValueFromInclusion(getInclusion()); 
-        }
-        
+
+        inclusion = constants.getAttributeValueFromInclusion(getInclusion());
+
         if (inclusion != null) {
-            writer.writeAttribute(prefix, namespaceURI,
-                    SPConstants.ATTR_INCLUDE_TOKEN, inclusion);
+            writer.writeAttribute(prefix, namespaceURI, SPConstants.ATTR_INCLUDE_TOKEN, inclusion);
         }
 
         if (issuerEpr != null) {
-            writer.writeStartElement(prefix, SPConstants.ISSUER,
-                    namespaceURI);
-            issuerEpr.serialize(writer);
+            writer.writeStartElement(prefix, SPConstants.ISSUER, namespaceURI);
+            StaxUtils.copy(issuerEpr, writer);
             writer.writeEndElement();
         }
 
         if (rstTemplate != null) {
             // <sp:RequestSecurityTokenTemplate>
-            rstTemplate.serialize(writer);
-
+            StaxUtils.copy(rstTemplate, writer);
         }
 
         String policyLocalName = SPConstants.POLICY.getLocalPart();
@@ -174,12 +161,10 @@
             wspPrefix = wspWriterPrefix;
         }
 
-        if (isRequireExternalReference() || isRequireInternalReference() ||
-                this.isDerivedKeys()) {
+        if (isRequireExternalReference() || isRequireInternalReference() || this.isDerivedKeys()) {
 
             // <wsp:Policy>
-            writer.writeStartElement(wspPrefix, policyLocalName,
-                    policyNamespaceURI);
+            writer.writeStartElement(wspPrefix, policyLocalName, policyNamespaceURI);
 
             if (wspWriterPrefix == null) {
                 // xmlns:wsp=".."
@@ -188,22 +173,19 @@
 
             if (isRequireExternalReference()) {
                 // <sp:RequireExternalReference />
-                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_EXTERNAL_REFERNCE,
-                        namespaceURI);
+                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_EXTERNAL_REFERNCE, namespaceURI);
             }
 
             if (isRequireInternalReference()) {
                 // <sp:RequireInternalReference />
-                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_INTERNAL_REFERNCE,
-                        namespaceURI);
+                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_INTERNAL_REFERNCE, namespaceURI);
             }
 
             if (this.isDerivedKeys()) {
                 // <sp:RequireDerivedKeys />
-                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_DERIVED_KEYS,
-                        namespaceURI);
+                writer.writeEmptyElement(prefix, SPConstants.REQUIRE_DERIVED_KEYS, namespaceURI);
             }
-            
+
             // <wsp:Policy>
             writer.writeEndElement();
         }
@@ -212,11 +194,11 @@
         writer.writeEndElement();
     }
 
-    public OMElement getIssuerMex() {
+    public Element getIssuerMex() {
         return issuerMex;
     }
 
-    public void setIssuerMex(OMElement issuerMex) {
+    public void setIssuerMex(Element issuerMex) {
         this.issuerMex = issuerMex;
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Layout.java Wed Jul  9 13:11:45 2008
@@ -1,36 +1,36 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class Layout extends AbstractSecurityAssertion {
 
     private String value = SPConstants.LAYOUT_LAX;
-    
-    public Layout(int version) {
-        setVersion(version);
+
+    public Layout(SPConstants version) {
+        super(version);
     }
 
     /**
@@ -41,14 +41,12 @@
     }
 
     /**
-     * @param value
-     *            The value to set.
+     * @param value The value to set.
      */
     public void setValue(String value) {
-        if (SPConstants.LAYOUT_LAX.equals(value)
-                || SPConstants.LAYOUT_STRICT.equals(value)
-                || SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value)
-                || SPConstants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
+        if (SPConstants.LAYOUT_LAX.equals(value) || SPConstants.LAYOUT_STRICT.equals(value)
+            || SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value)
+            || SPConstants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
             this.value = value;
         } else {
             // throw new WSSPolicyException("Incorrect layout value : " +
@@ -57,11 +55,7 @@
     }
 
     public QName getName() {
-        if ( version == SPConstants.SP_V12 ) {
-            return SP12Constants.LAYOUT;
-        } else {
-            return SP11Constants.LAYOUT; 
-        }  
+        return constants.getLayout();
     }
 
     public PolicyComponent normalize() {
@@ -84,28 +78,28 @@
         writer.writeStartElement(prefix, localName, namespaceURI);
 
         // <wsp:Policy>
-        writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY
-                .getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+        writer.writeStartElement(SPConstants.POLICY.getPrefix(), SPConstants.POLICY.getLocalPart(),
+                                 SPConstants.POLICY.getNamespaceURI());
 
         // .. <sp:Strict /> | <sp:Lax /> | <sp:LaxTsFirst /> | <sp:LaxTsLast /> ..
         if (SPConstants.LAYOUT_STRICT.equals(value)) {
             writer.writeStartElement(prefix, SPConstants.LAYOUT_STRICT, namespaceURI);
-            
+
         } else if (SPConstants.LAYOUT_LAX.equals(value)) {
             writer.writeStartElement(prefix, SPConstants.LAYOUT_LAX, namespaceURI);
-            
+
         } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST.equals(value)) {
             writer.writeStartElement(prefix, SPConstants.LAYOUT_LAX_TIMESTAMP_FIRST, namespaceURI);
-            
+
         } else if (SPConstants.LAYOUT_LAX_TIMESTAMP_LAST.equals(value)) {
             writer.writeStartElement(prefix, SPConstants.LAYOUT_LAX_TIMESTAMP_LAST, namespaceURI);
         }
-        
+
         writer.writeEndElement();
-        
+
         // </wsp:Policy>
         writer.writeEndElement();
-        
+
         // </sp:Layout>
         writer.writeEndElement();
     }

Added: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Messages.properties?rev=675332&view=auto
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Messages.properties (added)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/Messages.properties Wed Jul  9 13:11:45 2008
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+INVALID_ALGORITHM=Invalid algorithm suite {}
\ No newline at end of file

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

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

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

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/ProtectionToken.java Wed Jul  9 13:11:45 2008
@@ -1,36 +1,36 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class ProtectionToken extends AbstractSecurityAssertion implements TokenWrapper {
-    
+
     private Token protectionToken;
-    
-    public ProtectionToken(int version) {
-        setVersion(version);
+
+    public ProtectionToken(SPConstants version) {
+        super(version);
     }
 
     /**
@@ -50,19 +50,15 @@
     public void setToken(Token tok) {
         this.setProtectionToken(tok);
     }
-    
+
     public QName getName() {
-        if ( version == SPConstants.SP_V12) {
-            return SP12Constants.PROTECTION_TOKEN;
-        } else {
-            return SP11Constants.PROTECTION_TOKEN;
-        }     
+        return constants.getProtectionToken();
     }
 
     public PolicyComponent normalize() {
         /*
-         *  ProtectionToken can not contain multiple values. Hence we consider it
-         *  to always be in the normalized format.
+         * ProtectionToken can not contain multiple values. Hence we consider it to always be in the
+         * normalized format.
          */
         return this;
     }
@@ -70,58 +66,58 @@
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
         String localname = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
-        
+
         String prefix;
-        
+
         String writerPrefix = writer.getPrefix(namespaceURI);
         if (writerPrefix == null) {
             prefix = getName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
-            
+
         } else {
             prefix = writerPrefix;
         }
-        
+
         // <sp:ProtectionToken>
         writer.writeStartElement(prefix, localname, namespaceURI);
-        
+
         if (writerPrefix == null) {
             // xmlns:sp=".."
             writer.writeNamespace(prefix, namespaceURI);
         }
-        
+
         String policyLocalName = SPConstants.POLICY.getLocalPart();
         String policyNamespaceURI = SPConstants.POLICY.getNamespaceURI();
-        
+
         String wspPrefix;
-        
+
         String wspWriterPrefix = writer.getPrefix(policyNamespaceURI);
-        
+
         if (wspWriterPrefix == null) {
             wspPrefix = SPConstants.POLICY.getPrefix();
             writer.setPrefix(wspPrefix, policyNamespaceURI);
         } else {
             wspPrefix = wspWriterPrefix;
         }
-        
+
         // <wsp:Policy>
         writer.writeStartElement(wspPrefix, policyLocalName, policyNamespaceURI);
-        
+
         if (wspWriterPrefix == null) {
             // xmlns:wsp=".."
             writer.writeNamespace(wspPrefix, policyNamespaceURI);
         }
-        
+
         if (protectionToken == null) {
             throw new RuntimeException("ProtectionToken is not set");
         }
-        
+
         protectionToken.serialize(writer);
-        
+
         // </wsp:Policy>
         writer.writeEndElement();
 
         // </sp:ProtectionToken>
         writer.writeEndElement();
-    }    
+    }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RecipientToken.java Wed Jul  9 13:11:45 2008
@@ -1,38 +1,38 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class RecipientToken extends AbstractSecurityAssertion implements TokenWrapper {
-    
+
     private Token receipientToken;
-    
-    public RecipientToken(int version) {
-        setVersion(version);
+
+    public RecipientToken(SPConstants version) {
+        super(version);
     }
-   
+
     /**
      * @return Returns the receipientToken.
      */
@@ -47,7 +47,8 @@
         this.receipientToken = receipientToken;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
      * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
      */
     public void setToken(Token tok) {
@@ -55,11 +56,7 @@
     }
 
     public QName getName() {
-        if ( version == SPConstants.SP_V12) {
-            return SP12Constants.RECIPIENT_TOKEN;
-        } else {
-            return SP11Constants.RECIPIENT_TOKEN;
-        }     
+        return constants.getRecipientToken();
     }
 
     public PolicyComponent normalize() {
@@ -76,29 +73,30 @@
             prefix = getName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
-        
+
         // <sp:RecipientToken>
         writer.writeStartElement(prefix, localName, namespaceURI);
-        
+
         String pPrefix = writer.getPrefix(SPConstants.POLICY.getNamespaceURI());
         if (pPrefix == null) {
             pPrefix = SPConstants.POLICY.getPrefix();
             writer.setPrefix(pPrefix, SPConstants.POLICY.getNamespaceURI());
         }
-        
+
         // <wsp:Policy>
-        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY.getNamespaceURI());
+        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY
+            .getNamespaceURI());
 
         Token token = getReceipientToken();
         if (token == null) {
             throw new RuntimeException("RecipientToken doesn't contain any token assertions");
         }
         token.serialize(writer);
-        
+
         // </wsp:Policy>
         writer.writeEndElement();
-        
+
         // </sp:RecipientToken>
         writer.writeEndElement();
-    }    
+    }
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredElements.java Wed Jul  9 13:11:45 2008
@@ -1,50 +1,52 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class RequiredElements extends AbstractSecurityAssertion {
 
-    private ArrayList xPathExpressions = new ArrayList();
-    
-    private HashMap declaredNamespaces = new HashMap();
+    private List<String> xPathExpressions = new ArrayList<String>();
+
+    private Map<String, String> declaredNamespaces = new HashMap<String, String>();
 
     private String xPathVersion;
 
-    public RequiredElements(int version) {
-        setVersion(version);
+    public RequiredElements(SPConstants version) {
+        super(version);
     }
 
     /**
      * @return Returns the xPathExpressions.
      */
-    public ArrayList getXPathExpressions() {
+    public List<String> getXPathExpressions() {
         return xPathExpressions;
     }
 
@@ -60,21 +62,20 @@
     }
 
     /**
-     * @param pathVersion
-     *            The xPathVersion to set.
+     * @param pathVersion The xPathVersion to set.
      */
     public void setXPathVersion(String pathVersion) {
         xPathVersion = pathVersion;
     }
-    
-    public HashMap getDeclaredNamespaces () {
+
+    public Map<String, String> getDeclaredNamespaces() {
         return declaredNamespaces;
     }
-    
-    public void addDeclaredNamespaces(String uri, String prefix ) {
+
+    public void addDeclaredNamespaces(String uri, String prefix) {
         declaredNamespaces.put(prefix, uri);
     }
-        
+
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
         String localName = getName().getLocalPart();
@@ -90,9 +91,9 @@
             prefix = writerPrefix;
         }
 
-        //  <sp:RequiredElements>
+        // <sp:RequiredElements>
         writer.writeStartElement(prefix, localName, namespaceURI);
-        
+
         // xmlns:sp=".."
         writer.writeNamespace(prefix, namespaceURI);
 
@@ -107,25 +108,20 @@
 
         String xpathExpression;
 
-        for (Iterator iterator = xPathExpressions.iterator(); iterator
-                .hasNext();) {
-            xpathExpression = (String) iterator.next();
+        for (Iterator iterator = xPathExpressions.iterator(); iterator.hasNext();) {
+            xpathExpression = (String)iterator.next();
             // <sp:XPath ..>
             writer.writeStartElement(prefix, SPConstants.XPATH_EXPR, namespaceURI);
             writer.writeCharacters(xpathExpression);
             writer.writeEndElement();
         }
 
-        //</sp:RequiredElements>
+        // </sp:RequiredElements>
         writer.writeEndElement();
     }
 
     public QName getName() {
-        if (version == SPConstants.SP_V12) {
-            return SP12Constants.REQUIRED_ELEMENTS;
-        } else {
-            return SP11Constants.REQUIRED_ELEMENTS;
-        }      
+        return constants.getRequiredElements();
     }
 
     public PolicyComponent normalize() {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/RequiredParts.java Wed Jul  9 13:11:45 2008
@@ -1,45 +1,47 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class RequiredParts extends AbstractSecurityAssertion {
-    
-    private ArrayList headers = new ArrayList();
-    
-    public RequiredParts(int version) {
-        setVersion(version);
+
+    private List<Header> headers = new ArrayList<Header>();
+
+    public RequiredParts(SPConstants version) {
+        super(version);
     }
 
     /**
      * @return Returns the headers.
      */
-    public ArrayList getHeaders() {
+    public List<Header> getHeaders() {
         return this.headers;
     }
 
@@ -50,9 +52,8 @@
         this.headers.add(header);
     }
 
-
     public QName getName() {
-         return SP12Constants.REQUIRED_PARTS;         
+        return SP12Constants.REQUIRED_PARTS;
     }
 
     public PolicyComponent normalize() {
@@ -69,16 +70,16 @@
             prefix = getName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
-            
-        // <sp:RequiredParts> 
+
+        // <sp:RequiredParts>
         writer.writeStartElement(prefix, localName, namespaceURI);
-        
+
         // xmlns:sp=".."
         writer.writeNamespace(prefix, namespaceURI);
-        
-        Header header;        
+
+        Header header;
         for (Iterator iterator = headers.iterator(); iterator.hasNext();) {
-            header = (Header) iterator.next();
+            header = (Header)iterator.next();
             // <sp:Header Name=".." Namespace=".." />
             writer.writeStartElement(prefix, SPConstants.HEADER, namespaceURI);
             // Name attribute is optional
@@ -86,13 +87,12 @@
                 writer.writeAttribute("Name", header.getName());
             }
             writer.writeAttribute("Namespace", header.getNamespace());
-            
+
             writer.writeEndElement();
         }
-        
+
         // </sp:RequiredParts>
         writer.writeEndElement();
-    }    
-    
-    
+    }
+
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecureConversationToken.java Wed Jul  9 13:11:45 2008
@@ -1,31 +1,33 @@
-/*
- * Copyright 2004,2005 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
+/**
+ * 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
+ * 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.model;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.neethi.Policy;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.w3c.dom.Element;
+
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.neethi.Policy;
+
 /**
  * Model class of SecureConversationToken assertion
  */
@@ -33,9 +35,9 @@
 
     private Policy bootstrapPolicy;
 
-    private OMElement issuerEpr;
-    
-    public SecureConversationToken(int version) {
+    private Element issuerEpr;
+
+    public SecureConversationToken(SPConstants version) {
         super(version);
     }
 
@@ -47,8 +49,7 @@
     }
 
     /**
-     * @param bootstrapPolicy
-     *            The bootstrapPolicy to set.
+     * @param bootstrapPolicy The bootstrapPolicy to set.
      */
     public void setBootstrapPolicy(Policy bootstrapPolicy) {
         this.bootstrapPolicy = bootstrapPolicy;
@@ -56,15 +57,10 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see org.apache.neethi.Assertion#getName()
      */
     public QName getName() {
-        if ( version == SPConstants.SP_V12) {
-            return SP12Constants.SECURE_CONVERSATION_TOKEN;
-        } else {
-            return SP11Constants.SECURE_CONVERSATION_TOKEN; 
-        }      
+        return constants.getSecureConversationToken();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
@@ -91,12 +87,8 @@
         }
 
         String inclusion;
-        
-        if (version == SPConstants.SP_V12) {
-            inclusion = SP12Constants.getAttributeValueFromInclusion(getInclusion());
-        } else {
-            inclusion = SP11Constants.getAttributeValueFromInclusion(getInclusion()); 
-        }
+
+        inclusion = constants.getAttributeValueFromInclusion(getInclusion());
 
         if (inclusion != null) {
             writer.writeAttribute(prefix, namespaceURI, SPConstants.ATTR_INCLUDE_TOKEN, inclusion);
@@ -104,15 +96,15 @@
 
         if (issuerEpr != null) {
             // <sp:Issuer>
-            writer.writeStartElement(prefix, SPConstants.ISSUER , namespaceURI);
+            writer.writeStartElement(prefix, SPConstants.ISSUER, namespaceURI);
 
-            issuerEpr.serialize(writer);
+            StaxUtils.copy(issuerEpr, writer);
 
             writer.writeEndElement();
         }
 
-        if (isDerivedKeys() || isRequireExternalUriRef()
-                || isSc10SecurityContextToken() || (bootstrapPolicy != null)) {
+        if (isDerivedKeys() || isRequireExternalUriRef() || isSc10SecurityContextToken()
+            || bootstrapPolicy != null) {
 
             String wspNamespaceURI = SPConstants.POLICY.getNamespaceURI();
 
@@ -129,29 +121,28 @@
             }
 
             // <wsp:Policy>
-            writer.writeStartElement(wspPrefix,
-                    SPConstants.POLICY.getLocalPart(), wspNamespaceURI);
+            writer.writeStartElement(wspPrefix, SPConstants.POLICY.getLocalPart(), wspNamespaceURI);
 
             if (wspWriterPrefix == null) {
                 // xmlns:wsp=".."
                 writer.writeNamespace(wspPrefix, wspNamespaceURI);
             }
-            
+
             if (isDerivedKeys()) {
                 // <sp:RequireDerivedKeys />
                 writer.writeEmptyElement(prefix, SPConstants.REQUIRE_DERIVED_KEYS, namespaceURI);
             }
-            
+
             if (isRequireExternalUriRef()) {
                 // <sp:RequireExternalUriReference />
                 writer.writeEmptyElement(prefix, SPConstants.REQUIRE_EXTERNAL_URI_REFERNCE, namespaceURI);
             }
-            
+
             if (isSc10SecurityContextToken()) {
                 // <sp:SC10SecurityContextToken />
                 writer.writeEmptyElement(prefix, SPConstants.SC10_SECURITY_CONTEXT_TOKEN, namespaceURI);
             }
-            
+
             if (bootstrapPolicy != null) {
                 // <sp:BootstrapPolicy ..>
                 writer.writeStartElement(prefix, SPConstants.BOOTSTRAP_POLICY, namespaceURI);
@@ -170,15 +161,14 @@
     /**
      * @return Returns the issuerEpr.
      */
-    public OMElement getIssuerEpr() {
+    public Element getIssuerEpr() {
         return issuerEpr;
     }
 
     /**
-     * @param issuerEpr
-     *            The issuerEpr to set.
+     * @param issuerEpr The issuerEpr to set.
      */
-    public void setIssuerEpr(OMElement issuerEpr) {
+    public void setIssuerEpr(Element issuerEpr) {
         this.issuerEpr = issuerEpr;
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SecurityContextToken.java Wed Jul  9 13:11:45 2008
@@ -1,43 +1,43 @@
-/*
- * Copyright 2004,2005 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
+/**
+ * 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
+ * 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.model;
-
-import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.neethi.PolicyComponent;
+
 /**
  * Model class of SecurityContextToken assertion
  */
 public class SecurityContextToken extends Token {
 
     boolean requireExternalUriRef;
-    
+
     boolean sc10SecurityContextToken;
-    
-    public SecurityContextToken(int version) {
-        setVersion(version);
+
+    public SecurityContextToken(SPConstants version) {
+        super(version);
     }
-    
+
     /**
      * @return Returns the requireExternalUriRef.
      */
@@ -66,18 +66,16 @@
         this.sc10SecurityContextToken = sc10SecurityContextToken;
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
      * @see org.apache.neethi.Assertion#getName()
      */
     public QName getName() {
-        if ( version == SPConstants.SP_V12) {
-            return SP12Constants.SECURITY_CONTEXT_TOKEN;
-        } else {
-            return SP11Constants.SECURITY_CONTEXT_TOKEN;
-        }   
+        return constants.getSecurityContextToken();
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
      * @see org.apache.neethi.Assertion#normalize()
      */
     public PolicyComponent normalize() {
@@ -85,7 +83,8 @@
         throw new UnsupportedOperationException("TODO Sanka");
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
      * @see org.apache.neethi.PolicyComponent#serialize(javax.xml.stream.XMLStreamWriter)
      */
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignatureToken.java Wed Jul  9 13:11:45 2008
@@ -1,35 +1,35 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
+import org.apache.cxf.ws.security.policy.SPConstants;
 
 public class SignatureToken extends AbstractSecurityAssertion implements TokenWrapper {
 
     private Token signatureToken;
-    
-    public SignatureToken(int version){
-        setVersion(version);
+
+    public SignatureToken(SPConstants version) {
+        super(version);
     }
 
     /**
@@ -51,69 +51,64 @@
     }
 
     public QName getName() {
-        if ( version == SPConstants.SP_V12 ) {
-            return SP12Constants.SIGNATURE_TOKEN;
-        } else {
-            return SP11Constants.SIGNATURE_TOKEN;
-        }    
+        return constants.getSignatureToken();
     }
 
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        
+
         String localname = getName().getLocalPart();
         String namespaceURI = getName().getNamespaceURI();
-        
+
         String prefix;
         String writerPrefix = writer.getPrefix(namespaceURI);
-        
+
         if (writerPrefix == null) {
             prefix = getName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
-            
+
         } else {
             prefix = writerPrefix;
         }
-        
+
         // <sp:SignatureToken>
         writer.writeStartElement(prefix, localname, namespaceURI);
-        
+
         if (writerPrefix == null) {
             // xmlns:sp=".."
             writer.writeNamespace(prefix, namespaceURI);
         }
-        
-        
+
         String wspNamespaceURI = SPConstants.POLICY.getNamespaceURI();
-        
+
         String wspPrefix;
-        
+
         String wspWriterPrefix = writer.getPrefix(wspNamespaceURI);
-        
+
         if (wspWriterPrefix == null) {
             wspPrefix = SPConstants.POLICY.getPrefix();
             writer.setPrefix(wspPrefix, wspNamespaceURI);
-            
+
         } else {
             wspPrefix = wspWriterPrefix;
         }
-        
+
         // <wsp:Policy>
         writer.writeStartElement(wspPrefix, SPConstants.POLICY.getLocalPart(), wspNamespaceURI);
-        
+
         if (wspWriterPrefix == null) {
             // xmlns:wsp=".."
             writer.writeNamespace(wspPrefix, wspNamespaceURI);
         }
-        
+
         if (signatureToken == null) {
             throw new RuntimeException("EncryptionToken is not set");
         }
-        
+
         signatureToken.serialize(writer);
-        
+
         // </wsp:Policy>
         writer.writeEndElement();
-        
+
         // </sp:SignatureToken>
         writer.writeEndElement();
     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedElements.java Wed Jul  9 13:11:45 2008
@@ -1,57 +1,58 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class SignedEncryptedElements extends AbstractSecurityAssertion {
 
-    private ArrayList xPathExpressions = new ArrayList();
-    
-    private HashMap declaredNamespaces = new HashMap();
+    private List<String> xPathExpressions = new ArrayList<String>();
+
+    private Map<String, String> declaredNamespaces = new HashMap<String, String>();
 
     private String xPathVersion;
 
     /**
-     * Just a flag to identify whether this holds sign element info or encr
-     * elements info
+     * Just a flag to identify whether this holds sign element info or encr elements info
      */
     private boolean signedElemets;
 
-    public SignedEncryptedElements(boolean signedElements, int version) {
+    public SignedEncryptedElements(boolean signedElements, SPConstants version) {
+        super(version);
         this.signedElemets = signedElements;
-        setVersion(version);
     }
 
     /**
      * @return Returns the xPathExpressions.
      */
-    public ArrayList getXPathExpressions() {
+    public List<String> getXPathExpressions() {
         return xPathExpressions;
     }
 
@@ -67,8 +68,7 @@
     }
 
     /**
-     * @param pathVersion
-     *            The xPathVersion to set.
+     * @param pathVersion The xPathVersion to set.
      */
     public void setXPathVersion(String pathVersion) {
         xPathVersion = pathVersion;
@@ -80,15 +80,15 @@
     public boolean isSignedElemets() {
         return signedElemets;
     }
-    
-    public HashMap getDeclaredNamespaces () {
+
+    public Map<String, String> getDeclaredNamespaces() {
         return declaredNamespaces;
     }
-    
-    public void addDeclaredNamespaces(String uri, String prefix ) {
+
+    public void addDeclaredNamespaces(String uri, String prefix) {
         declaredNamespaces.put(prefix, uri);
     }
-        
+
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
 
         String localName = getName().getLocalPart();
@@ -103,7 +103,7 @@
 
         // <sp:SignedElements> | <sp:EncryptedElements>
         writer.writeStartElement(prefix, localName, namespaceURI);
-        
+
         // xmlns:sp=".."
         writer.writeNamespace(prefix, namespaceURI);
 
@@ -113,9 +113,8 @@
 
         String xpathExpression;
 
-        for (Iterator iterator = xPathExpressions.iterator(); iterator
-                .hasNext();) {
-            xpathExpression = (String) iterator.next();
+        for (Iterator iterator = xPathExpressions.iterator(); iterator.hasNext();) {
+            xpathExpression = (String)iterator.next();
             // <sp:XPath ..>
             writer.writeStartElement(prefix, SPConstants.XPATH_EXPR, namespaceURI);
             writer.writeCharacters(xpathExpression);
@@ -128,19 +127,9 @@
 
     public QName getName() {
         if (signedElemets) {
-            if (version == SPConstants.SP_V12) {
-                return SP12Constants.SIGNED_ELEMENTS;
-            } else {
-                return SP11Constants.SIGNED_ELEMENTS;
-            }
-            
-        } 
-        
-        if (version == SPConstants.SP_V12) {
-            return SP12Constants.ENCRYPTED_ELEMENTS;
-        } else {
-            return SP11Constants.ENCRYPTED_ELEMENTS;
+            return constants.getSignedElements();
         }
+        return constants.getEncryptedElements();
     }
 
     public PolicyComponent normalize() {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SignedEncryptedParts.java Wed Jul  9 13:11:45 2008
@@ -1,46 +1,47 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SPConstants;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
 public class SignedEncryptedParts extends AbstractSecurityAssertion {
 
     private boolean body;
-    
+
     private boolean attachments;
-    
-    private ArrayList headers = new ArrayList();
-    
+
+    private List<Header> headers = new ArrayList<Header>();
+
     private boolean signedParts;
-    
-    public SignedEncryptedParts(boolean signedParts, int version) {
+
+    public SignedEncryptedParts(boolean signedParts, SPConstants version) {
+        super(version);
         this.signedParts = signedParts;
-        setVersion(version);
     }
 
     /**
@@ -56,7 +57,7 @@
     public void setBody(boolean body) {
         this.body = body;
     }
-    
+
     /**
      * @return Returns the attachments.
      */
@@ -74,7 +75,7 @@
     /**
      * @return Returns the headers.
      */
-    public ArrayList getHeaders() {
+    public List<Header> getHeaders() {
         return this.headers;
     }
 
@@ -94,19 +95,9 @@
 
     public QName getName() {
         if (signedParts) {
-            if ( version == SPConstants.SP_V12) {
-                return SP12Constants.SIGNED_PARTS;
-            } else {
-                return SP11Constants.SIGNED_PARTS;
-            }           
+            return constants.getSignedParts();
         }
-        
-        if ( version == SPConstants.SP_V12) {
-            return SP12Constants.ENCRYPTED_PARTS;
-        } else {
-            return SP11Constants.ENCRYPTED_PARTS;
-        }
-        
+        return constants.getEncryptedParts();
     }
 
     public PolicyComponent normalize() {
@@ -123,22 +114,22 @@
             prefix = getName().getPrefix();
             writer.setPrefix(prefix, namespaceURI);
         }
-            
-        // <sp:SignedParts> | <sp:EncryptedParts> 
+
+        // <sp:SignedParts> | <sp:EncryptedParts>
         writer.writeStartElement(prefix, localName, namespaceURI);
-        
+
         // xmlns:sp=".."
         writer.writeNamespace(prefix, namespaceURI);
-        
+
         if (isBody()) {
             // <sp:Body />
             writer.writeStartElement(prefix, SPConstants.BODY, namespaceURI);
             writer.writeEndElement();
         }
-        
-        Header header;        
+
+        Header header;
         for (Iterator iterator = headers.iterator(); iterator.hasNext();) {
-            header = (Header) iterator.next();
+            header = (Header)iterator.next();
             // <sp:Header Name=".." Namespace=".." />
             writer.writeStartElement(prefix, SPConstants.HEADER, namespaceURI);
             // Name attribute is optional
@@ -146,19 +137,18 @@
                 writer.writeAttribute("Name", header.getName());
             }
             writer.writeAttribute("Namespace", header.getNamespace());
-            
+
             writer.writeEndElement();
         }
-        
-        if (isAttachments() && version == SPConstants.SP_V12) {
+
+        if (isAttachments() && constants.getVersion() == SPConstants.Version.SP_V12) {
             // <sp:Attachments />
             writer.writeStartElement(prefix, SPConstants.ATTACHMENTS, namespaceURI);
             writer.writeEndElement();
         }
-        
+
         // </sp:SignedParts> | </sp:EncryptedParts>
         writer.writeEndElement();
-    }    
-    
-    
+    }
+
 }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SupportingToken.java Wed Jul  9 13:11:45 2008
@@ -1,35 +1,37 @@
-/*
- * 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.model;
+package org.apache.cxf.ws.security.policy.model;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.ws.security.policy.SP12Constants;
+import org.apache.cxf.ws.security.policy.SPConstants;
+import org.apache.cxf.ws.security.policy.SPConstants.SupportTokenType;
 import org.apache.neethi.PolicyComponent;
-import org.apache.ws.secpolicy.SP11Constants;
-import org.apache.ws.secpolicy.SP12Constants;
-import org.apache.ws.secpolicy.SPConstants;
 
-public class SupportingToken extends AbstractSecurityAssertion implements
-        AlgorithmWrapper, TokenWrapper {
+public class SupportingToken extends AbstractSecurityAssertion implements AlgorithmWrapper, TokenWrapper {
 
     /**
      * Type of SupportingToken
@@ -39,11 +41,11 @@
      * @see SupportingToken#SIGNED
      * @see SupportingToken#SIGNED_ENDORSING
      */
-    private int type;
+    private SupportTokenType type;
 
     private AlgorithmSuite algorithmSuite;
 
-    private ArrayList tokens = new ArrayList();
+    private List<Token> tokens = new ArrayList<Token>();
 
     private SignedEncryptedElements signedElements;
 
@@ -53,11 +55,11 @@
 
     private SignedEncryptedParts encryptedParts;
 
-    public SupportingToken(int type, int version ) {
+    public SupportingToken(SupportTokenType type, SPConstants version) {
+        super(version);
         this.type = type;
-        setVersion(version);
     }
-    
+
     /**
      * @return Returns the algorithmSuite.
      */
@@ -66,8 +68,7 @@
     }
 
     /**
-     * @param algorithmSuite
-     *            The algorithmSuite to set.
+     * @param algorithmSuite The algorithmSuite to set.
      */
     public void setAlgorithmSuite(AlgorithmSuite algorithmSuite) {
         this.algorithmSuite = algorithmSuite;
@@ -76,13 +77,12 @@
     /**
      * @return Returns the token.
      */
-    public ArrayList getTokens() {
+    public List<Token> getTokens() {
         return tokens;
     }
 
     /**
-     * @param token
-     *            The token to set.
+     * @param token The token to set.
      */
     public void addToken(Token token) {
         this.tokens.add(token);
@@ -91,16 +91,15 @@
     /**
      * @return Returns the type.
      */
-    public int getTokenType() {
+    public SupportTokenType getTokenType() {
         return type;
     }
 
     /**
-     * @param type
-     *            The type to set.
+     * @param type The type to set.
      */
-    public void setTokenType(int type) {
-        this.type = type;
+    public void setTokenType(SupportTokenType t) {
+        this.type = t;
     }
 
     /**
@@ -111,8 +110,7 @@
     }
 
     /**
-     * @param encryptedElements
-     *            The encryptedElements to set.
+     * @param encryptedElements The encryptedElements to set.
      */
     public void setEncryptedElements(SignedEncryptedElements encryptedElements) {
         this.encryptedElements = encryptedElements;
@@ -126,8 +124,7 @@
     }
 
     /**
-     * @param encryptedParts
-     *            The encryptedParts to set.
+     * @param encryptedParts The encryptedParts to set.
      */
     public void setEncryptedParts(SignedEncryptedParts encryptedParts) {
         this.encryptedParts = encryptedParts;
@@ -141,8 +138,7 @@
     }
 
     /**
-     * @param signedElements
-     *            The signedElements to set.
+     * @param signedElements The signedElements to set.
      */
     public void setSignedElements(SignedEncryptedElements signedElements) {
         this.signedElements = signedElements;
@@ -156,8 +152,7 @@
     }
 
     /**
-     * @param signedParts
-     *            The signedParts to set.
+     * @param signedParts The signedParts to set.
      */
     public void setSignedParts(SignedEncryptedParts signedParts) {
         this.signedParts = signedParts;
@@ -165,7 +160,6 @@
 
     /*
      * (non-Javadoc)
-     * 
      * @see org.apache.ws.security.policy.TokenWrapper#setToken(org.apache.ws.security.policy.Token)
      */
     public void setToken(Token tok) {
@@ -173,64 +167,49 @@
     }
 
     public QName getName() {
-        //TODO Should we refactor this class ?? with a SuppotingTokenBase and sub classes 
+        QName ret = null;
+        
         switch (type) {
-        case SPConstants.SUPPORTING_TOKEN_SUPPORTING:
-            return version == SPConstants.SP_V12 ? SP12Constants.SUPPORTING_TOKENS : 
-                                                                    SP11Constants.SUPPORTING_TOKENS;
-        case SPConstants.SUPPORTING_TOKEN_SIGNED:
-            return version == SPConstants.SP_V12 ? SP12Constants.SIGNED_SUPPORTING_TOKENS : 
-                                                             SP11Constants.SIGNED_SUPPORTING_TOKENS;
-        case SPConstants.SUPPORTING_TOKEN_ENDORSING:
-            return version == SPConstants.SP_V12 ? SP12Constants.ENDORSING_SUPPORTING_TOKENS :
-                                                          SP11Constants.ENDORSING_SUPPORTING_TOKENS;
-        case SPConstants.SUPPORTING_TOKEN_SIGNED_ENDORSING:
-            return version == SPConstants.SP_V12 ? SP12Constants.SIGNED_ENDORSING_SUPPORTING_TOKENS: 
-                                                   SP11Constants.SIGNED_ENDORSING_SUPPORTING_TOKENS;
-        case SPConstants.SUPPORTING_TOKEN_ENCRYPTED:
-            return SP12Constants.ENCRYPTED_SUPPORTING_TOKENS;
-            
-        case SPConstants.SUPPORTING_TOKEN_SIGNED_ENCRYPTED:
-            return SP12Constants.SIGNED_ENCRYPTED_SUPPORTING_TOKENS;
-            
-        case SPConstants.SUPPORTING_TOKEN_ENDORSING_ENCRYPTED:
-            return SP12Constants.ENDORSING_ENCRYPTED_SUPPORTING_TOKENS;
-            
-        case SPConstants.SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED:
-            return SP12Constants.SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS;
+        case SUPPORTING_TOKEN_SUPPORTING:
+            ret = constants.getSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_SIGNED:
+            ret = constants.getSignedSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_ENDORSING:
+            ret = constants.getEndorsingSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_SIGNED_ENDORSING:
+            ret = constants.getSignedEndorsingSupportingTokens();
+            break;
+        case SUPPORTING_TOKEN_ENCRYPTED:
+            ret = SP12Constants.ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        case SUPPORTING_TOKEN_SIGNED_ENCRYPTED:
+            ret = SP12Constants.SIGNED_ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        case SUPPORTING_TOKEN_ENDORSING_ENCRYPTED:
+            ret = SP12Constants.ENDORSING_ENCRYPTED_SUPPORTING_TOKENS;
+            break;
+        case SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED:
+            ret = SP12Constants.SIGNED_ENDORSING_ENCRYPTED_SUPPORTING_TOKENS;
+            break;
         default:
-            return null;
+            ret = null;
+            break;
         }
+        return ret;
     }
-    
+
     /**
      * @return true if the supporting token should be encrypted
      */
-    
+
     public boolean isEncryptedToken() {
-        
-        switch (type) {
-        case SPConstants.SUPPORTING_TOKEN_SUPPORTING:
-            return false;
-        case SPConstants.SUPPORTING_TOKEN_SIGNED:
-            return false;
-        case SPConstants.SUPPORTING_TOKEN_ENDORSING:
-            return false;
-        case SPConstants.SUPPORTING_TOKEN_SIGNED_ENDORSING:
-            return false;
-        case SPConstants.SUPPORTING_TOKEN_ENCRYPTED:
-            return true;        
-        case SPConstants.SUPPORTING_TOKEN_SIGNED_ENCRYPTED:
-            return true;         
-        case SPConstants.SUPPORTING_TOKEN_ENDORSING_ENCRYPTED:
-            return true;          
-        case SPConstants.SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED:
-            return true;
-        default:
-            return false;
-        }
-        
-        
+        return type == SPConstants.SupportTokenType.SUPPORTING_TOKEN_ENCRYPTED
+            || type == SPConstants.SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENCRYPTED
+            || type == SPConstants.SupportTokenType.SUPPORTING_TOKEN_ENDORSING_ENCRYPTED
+            || type == SPConstants.SupportTokenType.SUPPORTING_TOKEN_SIGNED_ENDORSING_ENCRYPTED;
     }
 
     public PolicyComponent normalize() {
@@ -254,7 +233,7 @@
 
         // <sp:SupportingToken>
         writer.writeStartElement(prefix, localname, namespaceURI);
-        
+
         // xmlns:sp=".."
         writer.writeNamespace(prefix, namespaceURI);
 
@@ -264,26 +243,25 @@
             writer.setPrefix(pPrefix, SPConstants.POLICY.getNamespaceURI());
         }
         // <wsp:Policy>
-        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(),
-                SPConstants.POLICY.getNamespaceURI());
+        writer.writeStartElement(pPrefix, SPConstants.POLICY.getLocalPart(), SPConstants.POLICY
+            .getNamespaceURI());
 
         Token token;
         for (Iterator iterator = getTokens().iterator(); iterator.hasNext();) {
             // [Token Assertion] +
-            token = (Token) iterator.next();
+            token = (Token)iterator.next();
             token.serialize(writer);
         }
 
-        
         if (signedParts != null) {
             signedParts.serialize(writer);
-            
+
         } else if (signedElements != null) {
             signedElements.serialize(writer);
-            
+
         } else if (encryptedParts != null) {
             encryptedParts.serialize(writer);
-            
+
         } else if (encryptedElements != null) {
             encryptedElements.serialize(writer);
         }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java?rev=675332&r1=674910&r2=675332&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/model/SymmetricAsymmetricBindingBase.java Wed Jul  9 13:11:45 2008
@@ -1,34 +1,36 @@
-/*
- * 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.cxf.ws.security.policy.model;
 
-package org.apache.ws.secpolicy.model;
-
-import org.apache.ws.secpolicy.SPConstants;
+import org.apache.cxf.ws.security.policy.SPConstants;
 
 public abstract class SymmetricAsymmetricBindingBase extends Binding {
 
     private String protectionOrder = SPConstants.SIGN_BEFORE_ENCRYPTING;
-    
+
     private boolean signatureProtection;
-    
+
     private boolean tokenProtection;
-    
+
     private boolean entireHeadersAndBodySignatures;
-    
-    public SymmetricAsymmetricBindingBase(int version) {
+
+    public SymmetricAsymmetricBindingBase(SPConstants version) {
         super(version);
     }
 
@@ -42,8 +44,7 @@
     /**
      * @param entireHeaderAndBodySignatures The entireHeaderAndBodySignatures to set.
      */
-    public void setEntireHeadersAndBodySignatures(
-            boolean entireHeaderAndBodySignatures) {
+    public void setEntireHeadersAndBodySignatures(boolean entireHeaderAndBodySignatures) {
         this.entireHeadersAndBodySignatures = entireHeaderAndBodySignatures;
     }
 
@@ -58,12 +59,12 @@
      * @param protectionOrder The protectionOrder to set.
      */
     public void setProtectionOrder(String protectionOrder) {
-        if(SPConstants.ENCRYPT_BEFORE_SIGNING.equals(protectionOrder) ||
-           SPConstants.SIGN_BEFORE_ENCRYPTING.equals(protectionOrder)) {
+        if (SPConstants.ENCRYPT_BEFORE_SIGNING.equals(protectionOrder)
+            || SPConstants.SIGN_BEFORE_ENCRYPTING.equals(protectionOrder)) {
             this.protectionOrder = protectionOrder;
         } else {
-//            throw new WSSPolicyException("Incorrect protection order value : "
-//                    + protectionOrder);
+            // throw new WSSPolicyException("Incorrect protection order value : "
+            // + protectionOrder);
         }
     }
 
@@ -94,7 +95,5 @@
     public void setTokenProtection(boolean tokenProtection) {
         this.tokenProtection = tokenProtection;
     }
-    
-    
-    
+
 }