cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r539451 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ systests/src...
Date Fri, 18 May 2007 13:09:20 GMT
Author: eglynn
Date: Fri May 18 06:09:19 2007
New Revision: 539451

URL: http://svn.apache.org/viewvc?view=rev&rev=539451
Log:
Added Endpoint.getActiveFeatures().


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Endpoint.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/WrappedEndpoint.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/Server.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
Fri May 18 06:09:19 2007
@@ -102,7 +102,7 @@
     }
 
     /**
-     * @param endpoint the endpoint to encapsulate
+     * @param ep the endpoint to encapsulate
      */
     public void setEndpoint(Endpoint ep) {
         endpoint = ep;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Endpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Endpoint.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Endpoint.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Endpoint.java Fri May 18
06:09:19 2007
@@ -19,10 +19,12 @@
 
 package org.apache.cxf.endpoint;
 
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Executor;
 
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -52,4 +54,5 @@
     
     void setOutFaultObserver(MessageObserver observer);
 
+    List<AbstractFeature> getActiveFeatures();
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java
Fri May 18 06:09:19 2007
@@ -69,7 +69,7 @@
     }
 
     /**
-     * @param endpoint the endpoint to encapsulate
+     * @param ep the endpoint to encapsulate
      */
     public void setEndpoint(Endpoint ep) {
         endpoint = ep;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
Fri May 18 06:09:19 2007
@@ -95,7 +95,7 @@
     }
 
     /**
-     * @param endpoint the endpoint to encapsulate
+     * @param ep the endpoint to encapsulate
      */
     public void setEndpoint(Endpoint ep) {
         endpoint = ep;

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/EndpointImpl.java Fri
May 18 06:09:19 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.endpoint;
 
+import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.concurrent.Executor;
@@ -35,6 +36,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurable;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
 import org.apache.cxf.interceptor.InFaultChainInitiatorObserver;
 import org.apache.cxf.interceptor.MessageSenderInterceptor;
@@ -56,6 +58,7 @@
     private Bus bus;
     private MessageObserver inFaultObserver;
     private MessageObserver outFaultObserver;
+    private List<AbstractFeature> activeFeatures;
 
     public EndpointImpl(Bus bus, Service s, QName endpointName) throws EndpointException
{
         this(bus, s, s.getEndpointInfo(endpointName));
@@ -160,4 +163,17 @@
         this.putAll(properties);
     }
     
+    /**
+     * @return the list of fearures <b>already</b> activated for this endpoint.
+     */
+    public List<AbstractFeature> getActiveFeatures() {
+        return activeFeatures;
+    }
+
+    /**
+     * @param the list of fearures <b>already</b> activated for this endpoint.
+     */
+    public void initializeActiveFeatures(List<AbstractFeature> features) {
+        activeFeatures = features;
+    }
 }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
Fri May 18 06:09:19 2007
@@ -39,6 +39,7 @@
 import org.apache.cxf.endpoint.ConduitSelector;
 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.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.service.Service;
@@ -114,6 +115,7 @@
         
         if (ep == null) {
             ep = serviceFactory.createEndpoint(ei);
+            ((EndpointImpl)ep).initializeActiveFeatures(getFeatures());
         }
         
         if (properties != null) {

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/WrappedEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/WrappedEndpoint.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/WrappedEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/WrappedEndpoint.java Fri
May 18 06:09:19 2007
@@ -27,6 +27,7 @@
 
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -148,4 +149,10 @@
         return wrappedEndpoint.values();
     }
     
+    /**
+     * @return the list of fearures <b>already</b> activated for this endpoint.
+     */
+    public List<AbstractFeature> getActiveFeatures() {
+        return wrappedEndpoint.getActiveFeatures();
+    }
 }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/Server.java?view=diff&rev=539451&r1=539450&r2=539451
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/Server.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/clustering/Server.java
Fri May 18 06:09:19 2007
@@ -20,12 +20,20 @@
 package org.apache.cxf.systest.clustering;
 
 
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
 import javax.xml.ws.Endpoint;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.endpoint.ServerLifeCycleListener;
+import org.apache.cxf.endpoint.ServerLifeCycleManager;
+import org.apache.cxf.feature.AbstractFeature;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.ws.addressing.WSAddressingFeature;
 
 public class Server extends AbstractBusTestServerBase {
    
@@ -33,7 +41,10 @@
         "http://localhost:9001/SoapContext/ControlPort";
     private static final String TARGETS_CONFIG =
         "org/apache/cxf/systest/clustering/targets.xml";
+
     
+    private String verified;
+
     protected void run()  {
 
         SpringBusFactory factory = new SpringBusFactory();
@@ -41,6 +52,36 @@
         BusFactory.setDefaultBus(bus);
         setBus(bus);
 
+        ServerLifeCycleManager manager =
+            bus.getExtension(ServerLifeCycleManager.class);
+        if (manager != null) {
+            manager.registerListener(new ServerLifeCycleListener() {
+                public void startServer(org.apache.cxf.endpoint.Server server) {
+                    org.apache.cxf.endpoint.Endpoint endpoint
+                        = server.getEndpoint();
+                    String portName =
+                        endpoint.getEndpointInfo().getName().getLocalPart();
+                    if ("ReplicatedPortA".equals(portName)) {
+                        
+                        List<AbstractFeature> active = endpoint.getActiveFeatures();
+                        if (!(active.size() == 1
+                              && active.get(0) instanceof WSAddressingFeature)) {
+                            verified = "unexpected active features: " + active;
+                        }
+                    } else {
+                        List<AbstractFeature> active = endpoint.getActiveFeatures();
+                        if (!(active == null || active.size() == 0)) {
+                            verified = "unexpected active features: " + active;
+                        }                        
+                    }
+                }
+                public void stopServer(org.apache.cxf.endpoint.Server server) {
+                }                
+            });
+        } else {
+            verified = "cannot access ServerLifeCycleManager";
+        }
+
         ControlImpl implementor = new ControlImpl();
         Endpoint.publish(ADDRESS, implementor);
     }
@@ -56,5 +97,19 @@
             System.out.println("done!");
         }
     }
-
+    
+    /**
+     * Used to facilitate assertions on server-side behaviour.
+     *
+     * @param log logger to use for diagnostics if assertions fail
+     * @return true if assertions hold
+     */
+    protected boolean verify(Logger log) {
+        if (verified != null) {
+            log.log(Level.WARNING, 
+                    "Active Feature verification failed: {0}",
+                    verified);
+        }
+        return verified == null;
+    }
 }



Mime
View raw message