You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2011/07/05 10:26:13 UTC

svn commit: r1142920 - in /tuscany/sca-java-2.x/trunk: distribution/all/src/main/release/bin/ modules/ modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/ modules/binding-ws-runtime-axis2/ modules/binding-ws-runtime-axis2/META-INF/ modul...

Author: slaws
Date: Tue Jul  5 08:26:12 2011
New Revision: 1142920

URL: http://svn.apache.org/viewvc?rev=1142920&view=rev
Log:
Re-enable Rampart support in the ws binding so that WS policy can be applied. Add a test which, for the time being, demonstrates integrity. 

Added:
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProviderFactory.java
Modified:
    tuscany/sca-java-2.x/trunk/distribution/all/src/main/release/bin/LICENSE
    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/pom.xml
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/pom.xml
    tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/java/org/apache/tuscany/sca/policy/wspolicy/xml/WSPolicyProcessor.java
    tuscany/sca-java-2.x/trunk/modules/pom.xml
    tuscany/sca-java-2.x/trunk/testing/itest/ws/pom.xml

Modified: tuscany/sca-java-2.x/trunk/distribution/all/src/main/release/bin/LICENSE
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/distribution/all/src/main/release/bin/LICENSE?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/distribution/all/src/main/release/bin/LICENSE (original)
+++ tuscany/sca-java-2.x/trunk/distribution/all/src/main/release/bin/LICENSE Tue Jul  5 08:26:12 2011
@@ -231,7 +231,9 @@ The following components come under Apac
  aspectjrt-1.6.8.jar
  aspectjweaver-1.6.8.jar
  axiom-api-1.2.10.jar
+ axiom-dom-1.2.10.jar
  axiom-impl-1.2.10.jar
+ axis2-mtompolicy-1.5.4.jar
  bsf-utils-3.1.jar
  cglib-2.2.jar
  commons-beanutils-1.7.0.jar
@@ -276,6 +278,7 @@ The following components come under Apac
  juli-6.0.26.jar
  kahadb-5.3.0.jar
  log4j-1.2.15.jar
+ mex-1.5.4-impl.jar
  myfaces-api-1.2.2.jar
  myfaces-impl-1.2.2.jar
  neethi-2.0.4.jar
@@ -295,7 +298,12 @@ The following components come under Apac
  ode-scheduler-simple-1.3.2.jar
  ode-utils-1.3.2.jar
  openjpa-1.2.1.jar
+ opensaml-2.2.3.jar
+ openws-1.2.2.jar
  org.apache.axis2.osgi-1.5.3.jar
+ rampart-core-1.5.1.jar 
+ rampart-policy-1.5.1.jar 
+ rampart-trust-1.5.1.jar 
  regexp-1.3.jar
  spring-aop-3.0.5.RELEASE.jar
  spring-asm-3.0.5.RELEASE.jar
@@ -312,10 +320,13 @@ The following components come under Apac
  wink-common-1.1.3-incubating.jar
  wink-client-1.1.3-incubating.jar
  wink-server-1.1.3-incubating.jar 
+ wss4j-1.5.10.jar
  xalan-2.7.0.jar
  xercesImpl-2.8.1.jar
  xmlbeans-2.3.0.jar
  XmlSchema-1.4.3.jar
+ xmlsec-1.4.4.jar
+ xmltooling-1.2.0.jar
 
 ===============================================================================
 The serp-1.13.1.jar is distributed under the BSD license with the following copyright:

Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHelper.java Tue Jul  5 08:26:12 2011
@@ -37,7 +37,7 @@ import org.apache.tuscany.sca.policy.Pol
  * @tuscany.spi.extension.asclient
  */
 public class PolicyHelper {
-    public PolicySet getPolicySet(PolicySubject subject, QName policySetName) {
+    public static PolicySet getPolicySet(PolicySubject subject, QName policySetName) {
         for (PolicySet ps : subject.getPolicySets()) {
             if (ps.getName().equals(policySetName)) {
                 return ps;
@@ -46,7 +46,7 @@ public class PolicyHelper {
         return null;
     }
 
-    public Intent getIntent(Definitions subject, QName intentName) {
+    public static Intent getIntent(Definitions subject, QName intentName) {
         for (Intent i : subject.getIntents()) {
             if (i.getName().equals(intentName)) {
                 return i;
@@ -55,7 +55,7 @@ public class PolicyHelper {
         return null;
     }
 
-    public PolicySet getPolicySet(Definitions subject, QName policySetName) {
+    public static PolicySet getPolicySet(Definitions subject, QName policySetName) {
         for (PolicySet ps : subject.getPolicySets()) {
             if (ps.getName().equals(policySetName)) {
                 return ps;
@@ -64,7 +64,7 @@ public class PolicyHelper {
         return null;
     }
 
-    public Intent getIntent(PolicySubject subject, QName intentName) {
+    public static Intent getIntent(PolicySubject subject, QName intentName) {
         for (Intent i : subject.getRequiredIntents()) {
             if (i.getName().equals(intentName)) {
                 return i;
@@ -73,7 +73,7 @@ public class PolicyHelper {
         return null;
     }
 
-    public Collection<PolicyExpression> getPolicyExpressions(PolicySubject subject, QName policyName) {
+    public static Collection<PolicyExpression> getPolicyExpressions(PolicySubject subject, QName policyName) {
         Collection<PolicyExpression> policies = new ArrayList<PolicyExpression>();
         for (PolicySet ps : subject.getPolicySets()) {
             for (PolicyExpression exp : ps.getPolicies()) {
@@ -85,7 +85,7 @@ public class PolicyHelper {
         return policies;
     }
 
-    public Collection<Object> getPolicies(PolicySubject subject, QName policyName) {
+    public static Collection<Object> getPolicies(PolicySubject subject, QName policyName) {
         Collection<Object> policies = new ArrayList<Object>();
         for (PolicySet ps : subject.getPolicySets()) {
             for (PolicyExpression exp : ps.getPolicies()) {
@@ -95,36 +95,18 @@ public class PolicyHelper {
             }
         }
         return policies;
-    }
-    
-    public static PolicySet getPolicySet(Binding wsBinding, QName intentName) {
-        PolicySet returnPolicySet = null;
-
-        if (wsBinding instanceof PolicySubject) {
-            PolicySubject policiedBinding = (PolicySubject)wsBinding;
-            for (PolicySet policySet : policiedBinding.getPolicySets()) {
-                for (Intent intent : policySet.getProvidedIntents()) {
-                    if (intent.getName().equals(intentName)) {
-                        returnPolicySet = policySet;
-                        break;
-                    }
-                }
-            }
-        }
+    }   
 
-        return returnPolicySet;
-    }
+    public static boolean isIntentRequired(PolicySubject subject, QName intent) {
 
-    public static boolean isIntentRequired(Binding wsBinding, QName intent) {
-        if (wsBinding instanceof PolicySubject) {
-            List<Intent> intents = ((PolicySubject)wsBinding).getRequiredIntents();
-            for (Intent i : intents) {
-                if (intent.equals(i.getName())) {
-                    return true;
-                }
+        List<Intent> intents = ((PolicySubject)subject).getRequiredIntents();
+        for (Intent i : intents) {
+            if (intent.equals(i.getName())) {
+                return true;
             }
         }
-        return getPolicySet(wsBinding, intent) != null;
+
+        return getPolicySet(subject, intent) != null;
     }    
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF Tue Jul  5 08:26:12 2011
@@ -91,9 +91,11 @@ Import-Package: javax.servlet,
  org.apache.axis2.description,
  org.apache.axis2.engine,
  org.apache.axis2.handlers,
+ org.apache.axis2.i18n,
  org.apache.axis2.receivers,
  org.apache.axis2.transport,
  org.apache.axis2.transport.http,
+ org.apache.axis2.util,
  org.apache.axis2.util.threadpool,
  org.apache.commons.httpclient,
  org.apache.commons.httpclient.params,

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/pom.xml?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/pom.xml Tue Jul  5 08:26:12 2011
@@ -71,16 +71,238 @@
                </exclusion>
            </exclusions>
         </dependency>
+         
+        <dependency>
+            <groupId>org.apache.rampart</groupId>
+            <artifactId>rampart-core</artifactId>
+            <version>1.5.1</version>            
+           <exclusions>    
+               <!--  
+                   We can live without most of the Rampart dependencies. The following
+                   jars were added to Tuscany support Rampart
+                   
+                   axiom-dom-1.2.10.jar, 
+                   mex-1.5.4-impl.jar, 
+                   not-yet-commons-ssl-0.3.9.jar, 
+                   opensaml-2.2.3.jar, 
+                   openws-1.2.2.jar, 
+                   rampart-core-1.5.1.jar, 
+                   rampart-policy-1.5.1.jar, 
+                   rampart-trust-1.5.1.jar,  
+                   wss4j-1.5.10.jar, 
+                   xmlsec-1.4.4.jar, 
+                   xmltooling-1.2.0.jar
+               -->
+               <exclusion>
+                   <groupId>org.apache.axis2</groupId>
+                   <artifactId>axis2-kernel</artifactId>
+               </exclusion>               
+               <exclusion>
+                   <groupId>org.apache.axis2</groupId>
+                   <artifactId>addressing</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>org.opensaml</groupId>
+                   <artifactId>opensaml1</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>bouncycastle</groupId>
+                   <artifactId>bcprov-jdk14</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>org.bouncycastle</groupId>
+                   <artifactId>bcprov-ext-jdk15</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>slf4j-jdk14</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>slf4j-api</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>jcl-over-slf4j</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>log4j-over-slf4j</artifactId>
+               </exclusion>    
+               <exclusion>
+                   <groupId>commons-lang</groupId>
+                   <artifactId>commons-lang</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>joda-time</groupId>
+                   <artifactId>joda-time</artifactId>
+               </exclusion>    
+               <exclusion>
+                   <groupId>net.jcip</groupId>
+                   <artifactId>jcip-annotations</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>commons-collections</groupId>
+                   <artifactId>commons-collections</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>jargs</groupId>
+                   <artifactId>jargs</artifactId>
+               </exclusion>                                                                         
+               <exclusion>
+                   <groupId>velocity</groupId>
+                   <artifactId>velocity</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>xml-apis</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>xercesImpl</artifactId>
+               </exclusion>                
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>resolver</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>serializer</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.apache.geronimo.specs</groupId>
+                   <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+               </exclusion>     
+               <exclusion>
+                   <groupId>org.apache.geronimo.specs</groupId>
+                   <artifactId>geronimo-activation_1.1_spec</artifactId>
+               </exclusion>    
+               <exclusion>
+                   <groupId>org.codehaus.woodstox</groupId>
+                   <artifactId>wstx-asl</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>org.apache.xalan</groupId>
+                   <artifactId>xalan</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>org.apache.santuario</groupId>
+                   <artifactId>xmlsec</artifactId>
+               </exclusion> 
+           </exclusions>                     
+        </dependency> 
+        
+        <!--  replace the Rampart xmlsec with the version Tuscany is using -->
+        <dependency>
+            <groupId>org.apache.santuario</groupId>
+            <artifactId>xmlsec</artifactId>
+            <version>1.4.4</version>
+            <exclusions>           
+               <exclusion>
+                   <groupId>commons-logging</groupId>
+                   <artifactId>commons-logging</artifactId>
+               </exclusion>              
+           </exclusions>
+        </dependency>   
+        
+        <dependency>
+            <groupId>org.opensaml</groupId>
+            <artifactId>opensaml</artifactId>
+            <version>2.2.3</version>
+            <exclusions>
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>slf4j-jdk14</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>slf4j-api</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>jcl-over-slf4j</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>log4j-over-slf4j</artifactId>
+               </exclusion>    
+               <exclusion>
+                   <groupId>commons-lang</groupId>
+                   <artifactId>commons-lang</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>joda-time</groupId>
+                   <artifactId>joda-time</artifactId>
+               </exclusion>    
+               <exclusion>
+                   <groupId>net.jcip</groupId>
+                   <artifactId>jcip-annotations</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>org.bouncycastle</groupId>
+                   <artifactId>bcprov-ext-jdk15</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>org.apache.commons.ssl</groupId>
+                   <artifactId>not-yet-commons-ssl</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>commons-collections</groupId>
+                   <artifactId>commons-collections</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>jargs</groupId>
+                   <artifactId>jargs</artifactId>
+               </exclusion>                                                                         
+               <exclusion>
+                   <groupId>velocity</groupId>
+                   <artifactId>velocity</artifactId>
+               </exclusion>  
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>xml-apis</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>xercesImpl</artifactId>
+               </exclusion>                
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>resolver</artifactId>
+               </exclusion> 
+               <exclusion>
+                   <groupId>org.apache.xerces</groupId>
+                   <artifactId>serializer</artifactId>
+               </exclusion>   
+               <exclusion>
+                   <groupId>org.apache.xalan</groupId>
+                   <artifactId>xalan</artifactId>
+               </exclusion>                                                                            
+            </exclusions>
+        </dependency>               
+   
+        <!--  replace the Rampart xalan with the version Tuscany is using -->
+        <dependency>
+            <groupId>xalan</groupId>
+            <artifactId>xalan</artifactId>
+            <version>2.7.0</version>
+            <exclusions>
+               <exclusion>
+                   <groupId>xml-apis</groupId>
+                   <artifactId>xml-apis</artifactId>
+               </exclusion>                              
+            </exclusions>            
+        </dependency>       
 
         <dependency>
             <groupId>commons-httpclient</groupId>
             <artifactId>commons-httpclient</artifactId>
             <version>3.1</version>
-           <exclusions>
+           <exclusions>           
                <exclusion>
                    <groupId>commons-logging</groupId>
 	               <artifactId>commons-logging</artifactId>
-               </exclusion>
+               </exclusion>              
            </exclusions>
         </dependency>
 
@@ -101,10 +323,12 @@
                	    <groupId>org.apache.geronimo.specs</groupId>
 	                <artifactId>geronimo-stax-api_1.0_spec</artifactId>
                 </exclusion>
+                <!-- needed by rampart
                 <exclusion>
                	    <groupId>jaxen</groupId>
 	                <artifactId>jaxen</artifactId>
                 </exclusion>
+                -->
             </exclusions>
         </dependency> 
         
@@ -150,6 +374,12 @@
             <version>2.5</version>
             <scope>provided</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-policy-wspolicy</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>         
 
         <!--  Runtime dependencies -->
         <dependency>

Added: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProvider.java?rev=1142920&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProvider.java Tue Jul  5 08:26:12 2011
@@ -0,0 +1,67 @@
+/*
+ * 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.tuscany.sca.binding.ws.axis2.policy.wspolicy;
+
+import java.util.logging.Logger;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.sca.binding.ws.axis2.provider.Axis2BaseBindingProvider;
+import org.apache.tuscany.sca.host.http.SecurityContext;
+import org.apache.tuscany.sca.policy.PolicySubject;
+import org.apache.tuscany.sca.policy.security.http.ssl.HTTPSPolicy;
+import org.apache.tuscany.sca.policy.wspolicy.WSPolicy;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev: 918583 $ $Date: 2010-03-03 17:16:15 +0000 (Wed, 03 Mar 2010) $
+ */
+public class WSPolicyProvider extends BasePolicyProvider<WSPolicy> {
+    private final Logger logger = Logger.getLogger(WSPolicyProvider.class.getName());
+
+    public WSPolicyProvider(PolicySubject subject) {
+        super(WSPolicy.class, subject);
+    }
+
+    public void configureBinding(Object context) {
+        ConfigurationContext configContext = ((Axis2BaseBindingProvider)context).getAxisConfigurationContext();
+        
+        for ( Object policy : findPolicies() ) {
+            if ( policy instanceof WSPolicy ) {
+                WSPolicy wsPolicy = (WSPolicy)policy;
+                try {
+                    configContext.getAxisConfiguration().applyPolicy(wsPolicy.getNeethiPolicy());
+                    configContext.getAxisConfiguration().engageModule("rampart");
+                    
+                    // TUSCANY-2824
+                    // hack to make service side pick up rampart policies
+                    // "rampartPolicy" comes from RampartMessageData.KEY_RAMPART_POLICY
+                    // but I'm avoiding adding an explicit dependency just yet. 
+                    // There must be a proper way of getting rampart to recognize
+                    // these policies
+                    configContext.setProperty("rampartPolicy", wsPolicy.getNeethiPolicy());
+                    
+                } catch ( AxisFault e ) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
+}

Added: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProviderFactory.java?rev=1142920&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProviderFactory.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSPolicyProviderFactory.java Tue Jul  5 08:26:12 2011
@@ -0,0 +1,57 @@
+/*
+ * 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.tuscany.sca.binding.ws.axis2.policy.wspolicy;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.policy.wspolicy.WSPolicy;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev: 916317 $ $Date: 2010-02-25 15:16:44 +0000 (Thu, 25 Feb 2010) $
+ */
+public class WSPolicyProviderFactory implements PolicyProviderFactory<WSPolicy> {
+    private ExtensionPointRegistry registry;
+    
+    public WSPolicyProviderFactory(ExtensionPointRegistry registry) {
+        super();
+        this.registry = registry;
+    }
+
+    public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) {
+        return null;
+    }
+
+    public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) {
+        return new WSPolicyProvider(endpointReference);
+    }
+
+    public PolicyProvider createServicePolicyProvider(Endpoint endpoint) {
+        return new WSPolicyProvider(endpoint);
+    }
+
+    public Class<WSPolicy> getModelType() {
+        return WSPolicy.class;
+    }
+
+}

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2EngineIntegration.java Tue Jul  5 08:26:12 2011
@@ -19,7 +19,9 @@
 
 package org.apache.tuscany.sca.binding.ws.axis2.provider;
 
+import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -49,16 +51,24 @@ import org.apache.axis2.addressing.Endpo
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.ModuleBuilder;
 import org.apache.axis2.deployment.URLBasedAxisConfigurator;
 import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.Version;
 import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.description.WSDLToAxisServiceBuilder;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
 import org.apache.tuscany.sca.assembly.AbstractContract;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.common.xml.XMLDocumentHelper;
@@ -135,21 +145,20 @@ public class Axis2EngineIntegration {
             try {
                 axis2Config = AccessController.doPrivileged(new PrivilegedExceptionAction<Axis2Config>() {
                     public Axis2Config run() throws AxisFault, MalformedURLException {
-                        // collect together the classloaders that Axis2 requireds in order to load
-                        // pluggable items such as the Tuscany MessageReceivers and the xerces 
+                        // collect together the classloaders that Axis2 requires in order to load
+                        // pluggable items such as the Tuscany MessageReceivers and the Xerces 
                         // document builder. 
                         ClassLoader wsBindingCL = getClass().getClassLoader();
                         ClassLoader axis2CL = URLBasedAxisConfigurator.class.getClassLoader();
-                        ClassLoaderContext classLoaderContext =
-                            new ClassLoaderContext(wsBindingCL, axis2CL);
+                        ClassLoaderContext classLoaderContext = new ClassLoaderContext(wsBindingCL, axis2CL);
 
-                        classLoaderContext =
-                            new ClassLoaderContext(classLoaderContext.getClassLoader(), serviceDiscovery,
-                                                   XMLInputFactory.class, DocumentBuilderFactory.class);
-
-                        URL axis2xmlURL =
-                            wsBindingCL
-                                .getResource("org/apache/tuscany/sca/binding/ws/axis2/engine/conf/tuscany-axis2.xml");
+                        classLoaderContext = new ClassLoaderContext(classLoaderContext.getClassLoader(), 
+                                                                    serviceDiscovery,
+                                                                    XMLInputFactory.class, 
+                                                                    DocumentBuilderFactory.class);
+
+                        URL axis2xmlURL = wsBindingCL.getResource("org/apache/tuscany/sca/binding/ws/axis2/engine/conf/tuscany-axis2.xml");
+                        
                         if (axis2xmlURL != null) {
                             URL repositoryURL = new URL(axis2xmlURL, "../repository/");
                             Axis2Config config = new Axis2Config();
@@ -190,9 +199,73 @@ public class Axis2EngineIntegration {
         } catch (PrivilegedActionException e) {
             throw new ServiceRuntimeException(e.getException());
         }
-
     }
     
+    // Some code to programatically load an Axis2 module only if we need it
+    // currently hard coded to load rampart only. Needs generalization
+    public synchronized static void loadRampartModule(ConfigurationContext axis2ConfigContext) {
+        try {
+            final AxisConfiguration axisConfiguration = axis2ConfigContext.getAxisConfiguration();
+            final URL rampartURL = new URL(axis2Config.repositoryURL.toString() + "modules/rampart-1.4.mar");
+            
+            ClassLoader deploymentClassLoader = org.apache.axis2.deployment.util.Utils.createClassLoader(
+                    new URL[]{rampartURL},
+                    axisConfiguration.getModuleClassLoader(),
+                    true,
+                    (File) axisConfiguration.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
+            
+            final AxisModule module = new AxisModule();
+            module.setModuleClassLoader(deploymentClassLoader);
+            module.setParent(axisConfiguration);
+
+            if (module.getName() == null) {
+                module.setName("rampart-1.4");
+                module.setVersion(new Version("1.4"));
+            }
+            
+            populateModule(axis2ConfigContext, module, rampartURL);
+            module.setFileName(rampartURL);
+            
+            // Allow privileged access to read properties. Requires PropertiesPermission read in
+            // security policy.
+            try {
+                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
+                    public Object run() throws IOException {
+                        DeploymentEngine.addNewModule(module, axisConfiguration);
+                        return null;
+                    }
+                });
+            } catch (PrivilegedActionException e) {
+                throw (AxisFault)e.getException();
+            }            
+           
+            org.apache.axis2.util.Utils.calculateDefaultModuleVersion(axisConfiguration.getModules(), 
+                                                                      axisConfiguration);
+            axisConfiguration.validateSystemPredefinedPhases();
+        } catch (IOException e) {
+            throw new ServiceRuntimeException(e);
+        } catch (Exception e) {
+            throw new ServiceRuntimeException(e);
+        }
+    }   
+    
+    private static void populateModule(ConfigurationContext axis2ConfigContext, AxisModule module, URL moduleUrl) throws DeploymentException {
+        try {
+            ClassLoader classLoader = module.getModuleClassLoader();
+            InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml");
+            if (moduleStream == null) {
+                moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml");
+            }
+            if (moduleStream == null) {
+                throw new DeploymentException(Messages.getMessage(DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
+            }
+            ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axis2ConfigContext.getAxisConfiguration());
+            moduleBuilder.populateModule();
+        } catch (IOException e) {
+            throw new DeploymentException(e);
+        }
+    }    
+    
     //=========================================================  
     
     /**

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingProvider.java?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingProvider.java Tue Jul  5 08:26:12 2011
@@ -64,6 +64,7 @@ import org.apache.tuscany.sca.interfaced
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.policy.PolicySubject;
 import org.apache.tuscany.sca.policy.util.PolicyHelper;
 import org.apache.tuscany.sca.provider.EndpointReferenceProvider;
 import org.apache.tuscany.sca.provider.PolicyProvider;
@@ -108,17 +109,18 @@ public class Axis2ReferenceBindingProvid
             contract.getInterface().resetDataBinding(OMElement.class.getName());
         }
         
-        isSOAP11Required = PolicyHelper.isIntentRequired(wsBinding, Constants.SOAP11_INTENT);
-        isSOAP12Required = PolicyHelper.isIntentRequired(wsBinding, Constants.SOAP12_INTENT);
-        
-        isMTOMRequired = PolicyHelper.isIntentRequired(wsBinding, Axis2BindingProviderFactory.MTOM_INTENT);
-        
-        // TODO - this is not correct as there may be other, custom, policies that 
-        // require rampart. For example this is not going to pick up the case
-        // of external policy attachment
-        isRampartRequired = PolicyHelper.isIntentRequired(wsBinding, Constants.AUTHENTICATION_INTENT) ||
-                            PolicyHelper.isIntentRequired(wsBinding, Constants.CONFIDENTIALITY_INTENT) ||
-                            PolicyHelper.isIntentRequired(wsBinding, Constants.INTEGRITY_INTENT);          
+        // TODO - why don't intents get aggregated to EPR correctly?
+        isSOAP11Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP11_INTENT);
+        isSOAP12Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP12_INTENT);
+        
+        isMTOMRequired = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Axis2BindingProviderFactory.MTOM_INTENT);
+        
+        // if the endpoint contains any WS Policy expressions then we probably need rampart
+        // TODO - need to take into account Axis configuration policy also
+        QName wsPolicyQName = new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy");
+        if (PolicyHelper.getPolicies(endpointReference, wsPolicyQName).size() > 0){
+            isRampartRequired = true;
+        }         
 
         // Validate the configuration for provided policies
         
@@ -167,6 +169,10 @@ public class Axis2ReferenceBindingProvid
         
         // Apply the configuration from any other policies
         
+        if (isRampartRequired){
+            Axis2EngineIntegration.loadRampartModule(configContext);
+        }
+        
         for (PolicyProvider pp : this.endpointReference.getPolicyProviders()) {
             pp.configureBinding(this);
         }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java Tue Jul  5 08:26:12 2011
@@ -23,6 +23,7 @@ import java.net.URISyntaxException;
 import java.util.logging.Logger;
 
 import javax.wsdl.Port;
+import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
@@ -35,6 +36,7 @@ import org.apache.tuscany.sca.core.Exten
 import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.PolicySubject;
 import org.apache.tuscany.sca.policy.util.PolicyHelper;
 import org.apache.tuscany.sca.provider.PolicyProvider;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
@@ -90,24 +92,18 @@ public class Axis2ServiceBindingProvider
         configContext.setContextRoot(servletHost.getContextPath());
         
         // Determine the configuration from the bindings "mayProvides" intents
-           
-        isSOAP12Required = PolicyHelper.isIntentRequired(wsBinding, Constants.SOAP12_INTENT);
-        
-        isMTOMRequired = PolicyHelper.isIntentRequired(wsBinding, Axis2BindingProviderFactory.MTOM_INTENT);
-        
-        // this is not correct as there may be other, custom, policies that 
-        // require rampart. For example this is not going to pick up the case
-        // of external policy attachment
-        isRampartRequired = PolicyHelper.isIntentRequired(wsBinding, Constants.AUTHENTICATION_INTENT) ||
-                            PolicyHelper.isIntentRequired(wsBinding, Constants.CONFIDENTIALITY_INTENT) ||
-                            PolicyHelper.isIntentRequired(wsBinding, Constants.INTEGRITY_INTENT);                  
-        
+        // TODO - why don't intents get aggregated to EP correctly?
+        isSOAP12Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP12_INTENT);
         
-        // Apply the configuration from any other policies
+        isMTOMRequired = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Axis2BindingProviderFactory.MTOM_INTENT);
         
-        for (PolicyProvider pp : endpoint.getPolicyProviders()) {
-            pp.configureBinding(this);
-        }  
+        // if the endpoint contains any WS Policy expressions then we probably need rampart
+        // TODO - need to take into account Axis configuration policy also
+        QName wsPolicyQName = new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy");
+        if (PolicyHelper.getPolicies(endpoint, wsPolicyQName).size() > 0){
+            isRampartRequired = true;
+        }               
+          
 
         // Update port addresses with runtime information
         // We can safely assume there is only one port here because you configure
@@ -142,7 +138,7 @@ public class Axis2ServiceBindingProvider
         // Apply the configuration from the mayProvides intents        
         
         if (isRampartRequired){
-            // TODO - do we need to go back to configurator?
+            Axis2EngineIntegration.loadRampartModule(configContext);
         }
         
         if (isMTOMRequired) {
@@ -152,6 +148,7 @@ public class Axis2ServiceBindingProvider
         if (isJMSRequired){
             // TODO - do we need to go back to configurator?
         }  
+        
         wsBinding.setURI(deployedURI);
         
         // Check the WSDL style as we only support some of them
@@ -178,6 +175,12 @@ public class Axis2ServiceBindingProvider
     public void start() {
         try {
             createAxisService(deployedURI, wsdlPort);
+            
+            // Apply the configuration from any other policies
+            
+            for (PolicyProvider pp : endpoint.getPolicyProviders()) {
+                pp.configureBinding(this);
+            }
            
             if (deployedURI.startsWith("http://") || 
                 deployedURI.startsWith("https://") || 

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory Tue Jul  5 08:26:12 2011
@@ -18,3 +18,4 @@
 # Implementation class for binding-ws-runtime-axis2 specific policy extensions
 org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.basic.BasicAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy
 org.apache.tuscany.sca.binding.ws.axis2.policy.security.http.ssl.HTTPSPolicyProviderFactory;model=org.apache.tuscany.sca.policy.security.http.ssl.HTTPSPolicy
+org.apache.tuscany.sca.binding.ws.axis2.policy.wspolicy.WSPolicyProviderFactory;model=org.apache.tuscany.sca.policy.wspolicy.WSPolicy

Modified: tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/pom.xml?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/pom.xml Tue Jul  5 08:26:12 2011
@@ -36,26 +36,24 @@
             <version>2.0-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-assembly-xml</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>
-		
+        
         <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-contribution</artifactId>
-            <version>2.0-SNAPSHOT</version>
+            <groupId>org.apache.neethi</groupId>
+            <artifactId>neethi</artifactId>
+            <version>2.0.4</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>wsdl4j</groupId>
+                    <artifactId>wsdl4j</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.woodstox</groupId>
+                    <artifactId>wstx-asl</artifactId>
+                </exclusion>
+            </exclusions>                
         </dependency>
         
         <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-core-spi</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>        
-
-        <dependency>
             <groupId>org.apache.ws.commons.axiom</groupId>
             <artifactId>axiom-api</artifactId>
             <version>1.2.10</version>
@@ -76,24 +74,12 @@
                     <groupId>xml-apis</groupId>
                     <artifactId>xml-apis</artifactId>
                 </exclusion>
-            </exclusions>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.neethi</groupId>
-            <artifactId>neethi</artifactId>
-            <version>2.0.4</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>wsdl4j</groupId>
-                    <artifactId>wsdl4j</artifactId>
-                </exclusion>
                 <exclusion>
-                    <groupId>org.codehaus.woodstox</groupId>
-                    <artifactId>wstx-asl</artifactId>
-                </exclusion>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+                </exclusion>                
             </exclusions>
-        </dependency>
+        </dependency>        
 
         <dependency>
             <groupId>org.apache.ws.commons.axiom</groupId>
@@ -105,9 +91,17 @@
                     <groupId>javax.mail</groupId>
                     <artifactId>mail</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.woodstox</groupId>
+                    <artifactId>wstx-asl</artifactId>
+                </exclusion>   
+                <exclusion>
+                    <groupId>org.apache.geronimo.specs</groupId>
+                    <artifactId>geronimo-stax-api_1.0_spec</artifactId>
+                </exclusion>                              
             </exclusions>
         </dependency>
-                
+<!-- 
         <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
@@ -119,7 +113,8 @@
                    <artifactId>commons-logging</artifactId>
                </exclusion>
             </exclusions>
-        </dependency>        
+        </dependency>   
+-->        
     </dependencies>
 
 </project>

Modified: tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/java/org/apache/tuscany/sca/policy/wspolicy/xml/WSPolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/java/org/apache/tuscany/sca/policy/wspolicy/xml/WSPolicyProcessor.java?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/java/org/apache/tuscany/sca/policy/wspolicy/xml/WSPolicyProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-wspolicy/src/main/java/org/apache/tuscany/sca/policy/wspolicy/xml/WSPolicyProcessor.java Tue Jul  5 08:26:12 2011
@@ -97,7 +97,13 @@ public class WSPolicyProcessor extends B
         
         // normalize the neethi tree so we can easily identify
         // the policy alternatives
-        neethiPolicy.normalize(true);
+/*  Messes up the hierarchy if rampart config policies included      
+        try {
+            neethiPolicy.normalize(true);
+        } catch (UnsupportedOperationException ex){
+            // RampartConfig policies don't support this yet
+        }
+*/        
         
         // top-level children of ExactlyOne are policy alternatives so
         // for each child create a policy model list and pull the 
@@ -138,6 +144,10 @@ public class WSPolicyProcessor extends B
                 XMLStreamWriter writer = outputFactory.createXMLStreamWriter(outputStream);
                 
                 policyComponent.serialize(writer);
+                writer.flush();
+                writer.close();
+                outputStream.flush();
+                outputStream.close();
                 
                 ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
                 XMLStreamReader reader = inputFactory.createXMLStreamReader(inputStream);

Modified: tuscany/sca-java-2.x/trunk/modules/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/pom.xml?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/pom.xml Tue Jul  5 08:26:12 2011
@@ -118,13 +118,12 @@
         <module>node-launcher</module>
         <module>node-launcher-equinox</module>
         <module>node-manager</module>
-        <module>policy-security</module>
-        <module>policy-wspolicy</module>
-        <!--module>policy-xml-ws</module-->
         <module>policy-logging</module>
+        <module>policy-security</module>
         <module>policy-transaction</module>
         <module>policy-transaction-runtime</module>
-        <module>policy-transaction-runtime-geronimo</module>        
+        <module>policy-transaction-runtime-geronimo</module>
+        <module>policy-wspolicy</module>        
         <module>shell</module>
         <module>sca-api</module>
         <module>sca-client-impl</module>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/pom.xml?rev=1142920&r1=1142919&r2=1142920&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/pom.xml Tue Jul  5 08:26:12 2011
@@ -37,6 +37,7 @@
     <module>endpoints</module>
     <module>endpoint-references</module>
     <module>holder-ws-service-multiple-outputs</module>
+    <module>wspolicy</module>
 <!--
     <module>jms</module>
     <module>mtom</module>