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 2009/10/20 17:54:16 UTC

svn commit: r827711 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java systests/uncategorized/pom.xml

Author: dkulp
Date: Tue Oct 20 15:54:16 2009
New Revision: 827711

URL: http://svn.apache.org/viewvc?rev=827711&view=rev
Log:
[CXF-2484] Update STSClient to allow interceptors/features to be configured on it

Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
    cxf/trunk/systests/uncategorized/pom.xml

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=827711&r1=827710&r2=827711&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java (original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Tue Oct 20 15:54:16 2009
@@ -52,6 +52,7 @@
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.ModCountCopyOnWriteArrayList;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.Configurable;
 import org.apache.cxf.configuration.Configurer;
@@ -61,9 +62,12 @@
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.endpoint.EndpointImpl;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
@@ -112,9 +116,9 @@
 /**
  * 
  */
-public class STSClient implements Configurable {
+public class STSClient implements Configurable, InterceptorProvider {
     private static final Logger LOG = LogUtils.getL7dLogger(STSClient.class);
-
+    
     Bus bus;
     String name = "default.sts-client";
     Client client;
@@ -137,6 +141,12 @@
     int ttl = 300;
 
     Map<String, Object> ctx = new HashMap<String, Object>();
+    
+    List<Interceptor> in = new ModCountCopyOnWriteArrayList<Interceptor>();
+    List<Interceptor> out = new ModCountCopyOnWriteArrayList<Interceptor>();
+    List<Interceptor> outFault  = new ModCountCopyOnWriteArrayList<Interceptor>();
+    List<Interceptor> inFault  = new ModCountCopyOnWriteArrayList<Interceptor>();
+    List<AbstractFeature> features;
 
     public STSClient(Bus b) {
         bus = b;
@@ -281,6 +291,20 @@
 
             client = new ClientImpl(bus, endpoint);
         }
+        
+        client.getInFaultInterceptors().addAll(inFault);
+        client.getInInterceptors().addAll(in);
+        client.getOutInterceptors().addAll(out);
+        client.getOutFaultInterceptors().addAll(outFault);
+        in = null;
+        out = null;
+        inFault = null;
+        outFault = null;
+        if (features != null) {
+            for (AbstractFeature f : features) {
+                f.initialize(client, bus);
+            }
+        }
     }
 
     private BindingOperationInfo findOperation(String suffix) {
@@ -865,5 +889,55 @@
     public void setTemplate(Element rstTemplate) {
         template = rstTemplate;
     }
+    
+    public List<Interceptor> getOutFaultInterceptors() {
+        if (client != null) {
+            return client.getOutFaultInterceptors();
+        }
+        return outFault;
+    }
+
+    public List<Interceptor> getInFaultInterceptors() {
+        if (client != null) {
+            return client.getInFaultInterceptors();
+        }
+        return inFault;
+    }
+
+    public List<Interceptor> getInInterceptors() {
+        if (client != null) {
+            return client.getInInterceptors();
+        }
+        return in;
+    }
+
+    public List<Interceptor> getOutInterceptors() {
+        if (client != null) {
+            return client.getOutInterceptors();
+        }
+        return out;
+    }
+
+    public void setInInterceptors(List<Interceptor> interceptors) {
+        getInInterceptors().addAll(interceptors);
+    }
 
+    public void setInFaultInterceptors(List<Interceptor> interceptors) {
+        getInFaultInterceptors().addAll(interceptors);
+    }
+
+    public void setOutInterceptors(List<Interceptor> interceptors) {
+        getOutInterceptors().addAll(interceptors);
+    }
+
+    public void setOutFaultInterceptors(List<Interceptor> interceptors) {
+        getOutFaultInterceptors().addAll(interceptors);
+    }
+    
+    public void setFeatures(List<AbstractFeature> f) {
+        features = f;
+    }
+    public List<AbstractFeature> getFeatures() {
+        return features;
+    }
 }

Modified: cxf/trunk/systests/uncategorized/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/uncategorized/pom.xml?rev=827711&r1=827710&r2=827711&view=diff
==============================================================================
--- cxf/trunk/systests/uncategorized/pom.xml (original)
+++ cxf/trunk/systests/uncategorized/pom.xml Tue Oct 20 15:54:16 2009
@@ -231,11 +231,11 @@
             <artifactId>cxf-rt-ws-policy</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
+        <!--dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-security</artifactId>
             <version>${project.version}</version>
-        </dependency>
+        </dependency-->
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>