cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r525926 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/transport/ buildtools/src/main/resources/ integration/jbi/src/main/java/org/apache/cxf/jbi/transport/ rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ rt/bin...
Date Thu, 05 Apr 2007 18:51:28 GMT
Author: dandiep
Date: Thu Apr  5 11:51:24 2007
New Revision: 525926

URL: http://svn.apache.org/viewvc?view=rev&rev=525926
Log:
o Rename Conduit.send(Message) to Conduit.prepare(Message);
o Save created JettyHTTPDestinations inside the JettyHTTPTransport.
o Few changes to objectbinding config which are half finished (too much work to
  exclude it for this commit, will clean up shortly)
o Disable checkstyle rule which forced Abstract/Factory/Base for abstract classes


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java
    incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
    incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfigBean.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
    incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
    incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
    incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
    incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Conduit.java Thu Apr  5
11:51:24 2007
@@ -47,11 +47,12 @@
 public interface Conduit extends Observable {
     
     /**
-     * Send an outbound message.
+     * Prepare the message for sending. This will typically involve setting
+     * an OutputStream on the message, but it may do nothing at all.
      * 
      * @param message the message to be sent.
      */
-    void send(Message message) throws IOException;
+    void prepare(Message message) throws IOException;
     
     /**
      * Close the connections associated with the message

Modified: incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml (original)
+++ incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle.xml Thu Apr  5 11:51:24
2007
@@ -57,10 +57,7 @@
 
 
         <!-- Checks for Naming Conventions.                  -->
-        <!-- See http://checkstyle.sf.net/config_naming.html -->
-        <module name="AbstractClassName">
-        	<property name="format" value="^Abstract.*$|^.*Factory$|^.*Bus$|^.*ConfigurationRepository$|^.*Base$|^Exception$|^.*Builder$"/>
-        </module>        
+        <!-- See http://checkstyle.sf.net/config_naming.html -->      
         <module name="ConstantName"/>
         <module name="LocalFinalVariableName"/>
         <module name="LocalVariableName"/>

Modified: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
(original)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIConduit.java
Thu Apr  5 11:51:24 2007
@@ -49,7 +49,7 @@
         return LOG;
     }
     
-    public void send(Message message) throws IOException {
+    public void prepare(Message message) throws IOException {
         getLogger().log(Level.FINE, "JBIConduit send message");
                 
         message.setContent(OutputStream.class,

Modified: incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
(original)
+++ incubator/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/transport/JBIDestination.java
Thu Apr  5 11:51:24 2007
@@ -119,7 +119,7 @@
          * 
          * @param message the message to be sent.
          */
-        public void send(Message message) throws IOException {
+        public void prepare(Message message) throws IOException {
             // setup the message to be send back
             message.put(JBIConstants.MESSAGE_EXCHANGE_PROPERTY, 
                 inMessage.get(JBIConstants.MESSAGE_EXCHANGE_PROPERTY));

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java
(original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java
Thu Apr  5 11:51:24 2007
@@ -27,7 +27,7 @@
 
     public static final String OPERATION = "objectBinding.operationName";
     public static final String BINDING = "objectBinding.bindingName";
-    
+
     public Message createMessage() {
         return new MessageImpl();
     }
@@ -35,4 +35,5 @@
     public Message createMessage(Message m) {
         return m;
     }
+
 }

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfigBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfigBean.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfigBean.java
(original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingConfigBean.java
Thu Apr  5 11:51:24 2007
@@ -18,6 +18,26 @@
  */
 package org.apache.cxf.binding.object;
 
+import java.util.Set;
+
 public class ObjectBindingConfigBean {
+    private boolean stopAfterLogicalPhases = true;
+    private Set<String> skipPhases;
+
+    public Set<String> getSkipPhases() {
+        return skipPhases;
+    }
+
+    public void setSkipPhases(Set<String> skipPhases) {
+        this.skipPhases = skipPhases;
+    }
+
+    public boolean isStopAfterLogicalPhases() {
+        return stopAfterLogicalPhases;
+    }
 
+    public void setStopAfterLogicalPhases(boolean stopAfterLogicalPhases) {
+        this.stopAfterLogicalPhases = stopAfterLogicalPhases;
+    }
+    
 }

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
(original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
Thu Apr  5 11:51:24 2007
@@ -32,6 +32,8 @@
 
 public class ObjectBindingFactory extends AbstractBindingFactory {
     public static final String BINDING_ID = "http://cxf.apache.org/binding/object";
+    public static final String STOP_AFTER_LOGICAL  = "objectBinding.stopAfterLogical";
+    
     private Collection<String> activationNamespaces;    
 
     public Collection<String> getActivationNamespaces() {
@@ -53,6 +55,12 @@
 
     public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object config)
{
         BindingInfo info = super.createBindingInfo(si, bindingid, config);
+        
+        if (config instanceof ObjectBindingConfigBean) {
+            ObjectBindingConfigBean c = (ObjectBindingConfigBean) config;
+            
+            info.setProperty(STOP_AFTER_LOGICAL, c.isStopAfterLogicalPhases());
+        }
         
         info.setName(new QName(si.getName().getNamespaceURI(), 
                                si.getName().getLocalPart() + "ObjectBinding"));

Modified: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java
(original)
+++ incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java
Thu Apr  5 11:51:24 2007
@@ -84,8 +84,9 @@
                 response = message;
             }
         });
-        c.send(m);
-
+        c.prepare(m);
+        c.close(m);
+        
         Thread.sleep(1000);
         assertNotNull(response);
 
@@ -119,8 +120,8 @@
                 inMsg.getExchange().setInMessage(outMsg);
                 try {
                     Conduit backChannel = d.getBackChannel(inMsg, null, null);
-                    backChannel.send(outMsg);
-                    backChannel.close();
+                    backChannel.prepare(outMsg);
+                    backChannel.close(outMsg);
                 } catch (IOException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java
Thu Apr  5 11:51:24 2007
@@ -53,7 +53,7 @@
                 : null;
 
         try {
-            conduit.send(message);
+            conduit.prepare(message);
 
             if (message.getInterceptorChain().doIntercept(message)) {
                 conduit.close(message);

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java Thu
Apr  5 11:51:24 2007
@@ -112,7 +112,7 @@
         conduit.setMessageObserver(obs);
         
         Message m = new MessageImpl();
-        conduit.send(m);
+        conduit.prepare(m);
 
         OutputStream os = m.getContent(OutputStream.class);
         InputStream is = getResourceAsStream(message);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/EndpointImplTest.java
Thu Apr  5 11:51:24 2007
@@ -153,7 +153,7 @@
             try {
                 Conduit backChannel = message.getDestination().getBackChannel(message, null,
null);
 
-                backChannel.send(message);
+                backChannel.prepare(message);
 
                 OutputStream out = message.getContent(OutputStream.class);
                 assertNotNull(out);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/MessageReplayObserver.java
Thu Apr  5 11:51:24 2007
@@ -45,7 +45,7 @@
             
             Conduit backChannel = message.getDestination().getBackChannel(message, null,
null);
 
-            backChannel.send(message);
+            backChannel.prepare(message);
 
             OutputStream out = message.getContent(OutputStream.class);
             Assert.assertNotNull(out);
@@ -55,6 +55,7 @@
             res.close();
             in.close();
             out.close();
+            backChannel.close(message);
         } catch (Exception e) {
             e.printStackTrace();
         }

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Thu Apr  5 11:51:24 2007
@@ -47,7 +47,8 @@
 
     protected ServerEngine engine;
     protected ServerEngine alternateEngine;
-
+    protected JettyHTTPTransportFactory transportFactory;
+    
     /**
      * Constructor, using Jetty server engine.
      * 
@@ -56,8 +57,10 @@
      * @param endpointInfo the endpoint info of the destination
      * @throws IOException
      */
-    public JettyHTTPDestination(Bus b, ConduitInitiator ci, EndpointInfo endpointInfo) throws
IOException {
+    public JettyHTTPDestination(Bus b, JettyHTTPTransportFactory ci, 
+                                EndpointInfo endpointInfo) throws IOException {
         this(b, ci, endpointInfo, null);
+        this.transportFactory = ci;
     }
 
     /**
@@ -69,11 +72,13 @@
      * @param eng the server engine
      * @throws IOException
      */
-    public JettyHTTPDestination(Bus b, ConduitInitiator ci, EndpointInfo endpointInfo, ServerEngine
eng)
+    public JettyHTTPDestination(Bus b, JettyHTTPTransportFactory ci, 
+                                EndpointInfo endpointInfo, ServerEngine eng)
         throws IOException {
         //Add the defualt port if the address is missing it
         super(b, ci, endpointInfo, true);
         alternateEngine = eng;
+        this.transportFactory = ci;
     }
 
     protected Logger getLogger() {
@@ -188,6 +193,13 @@
                 LOG.fine("Finished servicing http request on thread: " + Thread.currentThread());
             }
         }
+    }
+
+    @Override
+    public void shutdown() {
+        transportFactory.destinations.remove(endpointInfo.getAddress());
+        
+        super.shutdown();
     }
    
 }

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPTransportFactory.java
Thu Apr  5 11:51:24 2007
@@ -19,6 +19,8 @@
 package org.apache.cxf.transport.http_jetty;
 
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
@@ -28,12 +30,13 @@
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.http.AbstractHTTPTransportFactory;
 import org.apache.cxf.transport.https_jetty.JettySslConnectorFactory;
-
 import org.mortbay.jetty.AbstractConnector;
 import org.mortbay.jetty.nio.SelectChannelConnector;
 
 
 public class JettyHTTPTransportFactory extends AbstractHTTPTransportFactory {
+    Map<String, JettyHTTPDestination> destinations = new HashMap<String, JettyHTTPDestination>();
+    
     public JettyHTTPTransportFactory() {
         super();
         
@@ -46,12 +49,29 @@
 
     @Override
     public Destination getDestination(EndpointInfo endpointInfo) throws IOException {
-        JettyHTTPDestination destination = new JettyHTTPDestination(getBus(), this, endpointInfo);
-        configure(destination);
-        destination.retrieveEngine();        
+        String addr = endpointInfo.getAddress();
+        JettyHTTPDestination destination = destinations.get(addr);
+        if (destination == null) {
+            destination = createDestination(endpointInfo);
+        }
+           
         return destination;
     }
     
+    private synchronized JettyHTTPDestination createDestination(EndpointInfo endpointInfo)

+        throws IOException {
+        JettyHTTPDestination destination = destinations.get(endpointInfo.getAddress());
+        if (destination == null) {
+            destination = new JettyHTTPDestination(getBus(), this, endpointInfo);
+            
+            destinations.put(endpointInfo.getAddress(), destination);
+            
+            configure(destination);
+            destination.retrieveEngine(); 
+        }
+        return destination;
+    }
+
     protected static JettyConnectorFactory getConnectorFactory(SSLServerPolicy policy) {
         return policy == null
                ? new JettyConnectorFactory() {                     

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Thu Apr  5 11:51:24 2007
@@ -21,6 +21,7 @@
 
 
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URL;
 import java.util.ArrayList;
@@ -46,7 +47,7 @@
 import org.apache.cxf.security.transport.TLSSessionInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.ConduitInitiator;
+import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.http.WSDLQueryHandler;
 import org.apache.cxf.transports.http.QueryHandler;
@@ -76,7 +77,6 @@
     private static final String DIGEST_CHALLENGE = "Digest realm=luna";
     private static final String CUSTOM_CHALLENGE = "Custom realm=sol";
     private Bus bus;
-    private ConduitInitiator conduitInitiator;
     private Conduit decoupledBackChannel;
     private EndpointInfo endpointInfo;
     private EndpointReferenceType address;
@@ -93,13 +93,14 @@
     private ServletOutputStream os;
     private WSDLQueryHandler wsdlQueryHandler;
     private QueryHandlerRegistry  queryHandlerRegistry;
-    private List<QueryHandler> queryHandlerList; 
+    private List<QueryHandler> queryHandlerList;
+    private JettyHTTPTransportFactory transportFactory; 
 
     @After
     public void tearDown() {
        
         bus = null;
-        conduitInitiator = null;
+        transportFactory = null;
         decoupledBackChannel = null;
         address = null;
         replyTo = null;
@@ -124,6 +125,25 @@
     }
     
     @Test
+    public void testGetMultiple() throws Exception {
+        transportFactory = new JettyHTTPTransportFactory();
+        transportFactory.setBus(new CXFBusImpl());
+        
+        EndpointInfo ei = new EndpointInfo();
+        ei.setAddress("http://foo");
+        Destination d1 = transportFactory.getDestination(ei);
+        
+        Destination d2 = transportFactory.getDestination(ei);
+        assertEquals(d1, d2);
+        
+        d2.shutdown();
+        
+        Destination d3 = transportFactory.getDestination(ei);
+        assertNotSame(d1, d3);
+    }
+    
+    
+    @Test
     public void testRemoveServant() throws Exception {
         destination = setUpDestination();
         setUpRemoveServant();
@@ -211,7 +231,7 @@
         Conduit backChannel =
             destination.getBackChannel(inMessage, null, null);
         outMessage = setUpOutMessage();
-        backChannel.send(outMessage);
+        backChannel.prepare(outMessage);
         verifyBackChannelSend(backChannel, outMessage, 200);
     }
 
@@ -224,7 +244,7 @@
         Conduit backChannel =
             destination.getBackChannel(inMessage, null, null);
         outMessage = setUpOutMessage();
-        backChannel.send(outMessage);
+        backChannel.prepare(outMessage);
         verifyBackChannelSend(backChannel, outMessage, 500);
     }
     
@@ -237,7 +257,7 @@
         Conduit backChannel =
             destination.getBackChannel(inMessage, null, null);
         outMessage = setUpOutMessage();
-        backChannel.send(outMessage);
+        backChannel.prepare(outMessage);
         verifyBackChannelSend(backChannel, outMessage, 500, true);
     }
 
@@ -255,7 +275,7 @@
         assertEquals("unexpected response code",
                      202,
                      partialResponse.get(Message.RESPONSE_CODE));
-        partialBackChannel.send(partialResponse);
+        partialBackChannel.prepare(partialResponse);
         verifyBackChannelSend(partialBackChannel, partialResponse, 202);
 
         outMessage = setUpOutMessage();
@@ -264,7 +284,7 @@
         assertSame("unexpected back channel",
                    fullBackChannel,
                    decoupledBackChannel);
-        fullBackChannel.send(outMessage);
+        fullBackChannel.prepare(outMessage);
     }
     
     @Test
@@ -274,7 +294,7 @@
         address = getEPR("bar/foo");
         bus = new CXFBusImpl();
         
-        conduitInitiator = EasyMock.createMock(ConduitInitiator.class);
+        transportFactory = new JettyHTTPTransportFactory();
         endpointInfo = new EndpointInfo();
         endpointInfo.addExtensor(policy); 
         endpointInfo.addExtensor(new SSLServerPolicy()); 
@@ -284,7 +304,7 @@
         endpointInfo.setAddress(NOWHERE + "bar/foo");
         
         JettyHTTPDestination dest = new JettyHTTPDestination(bus,
-                                                             conduitInitiator,
+                                                             transportFactory,
                                                              endpointInfo,
                                                              engine);
         assertEquals(policy, dest.getServer());
@@ -308,7 +328,15 @@
             EasyMock.replay(bus);
         }
         
-        conduitInitiator = EasyMock.createMock(ConduitInitiator.class);
+        transportFactory = new JettyHTTPTransportFactory() {
+            @Override
+            public Conduit getConduit(EndpointInfo epi,
+                                      EndpointReferenceType target) throws IOException {
+                return decoupledBackChannel;
+            }
+        };
+        transportFactory.setBus(bus);
+        
         engine = EasyMock.createMock(ServerEngine.class);
         endpointInfo = new EndpointInfo();
         endpointInfo.setAddress(NOWHERE + "bar/foo");
@@ -322,7 +350,7 @@
         EasyMock.replay(engine);
         
         JettyHTTPDestination dest = new JettyHTTPDestination(bus,
-                                                             conduitInitiator,
+                                                             transportFactory,
                                                              endpointInfo,
                                                              engine);
         dest.retrieveEngine();
@@ -457,13 +485,9 @@
         
         if (decoupled) {
             decoupledBackChannel = EasyMock.createMock(Conduit.class);
-            conduitInitiator.getConduit(EasyMock.isA(EndpointInfo.class),
-                                        EasyMock.eq(replyTo));
-            EasyMock.expectLastCall().andReturn(decoupledBackChannel);
             decoupledBackChannel.setMessageObserver(EasyMock.isA(MessageObserver.class));
          
-            decoupledBackChannel.send(EasyMock.isA(Message.class));
+            decoupledBackChannel.prepare(EasyMock.isA(Message.class));
             EasyMock.expectLastCall();
-            EasyMock.replay(conduitInitiator);
             EasyMock.replay(decoupledBackChannel);
         }
         EasyMock.replay(response);

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Thu Apr  5 11:51:24 2007
@@ -342,7 +342,7 @@
          * 
          * @param message the message to be sent.
          */
-        public void send(Message message) throws IOException {
+        public void prepare(Message message) throws IOException {
             message.put(HTTP_RESPONSE, response);
             message.setContent(OutputStream.class, new WrappedOutputStream(message, response));
         }

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Thu Apr  5 11:51:24 2007
@@ -151,11 +151,11 @@
     }
    
     /**
-     * Send an outbound message.
+     * Prepare the outbound message for sending.
      * 
      * @param message the message to be sent.
      */
-    public void send(Message message) throws IOException {
+    public void prepare(Message message) throws IOException {
         Map<String, List<String>> headers = setHeaders(message);
         URL currentURL = setupURL(message);        
         URLConnection connection = 

Modified: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/HTTPConduitTest.java
Thu Apr  5 11:51:24 2007
@@ -109,7 +109,7 @@
     public void testSend() throws Exception {
         HTTPConduit conduit = setUpConduit(true, false, false);
         Message message = new MessageImpl();
-        conduit.send(message);
+        conduit.prepare(message);
         verifySentMessage(conduit, message);
     }
     
@@ -118,7 +118,7 @@
         HTTPConduit conduit = setUpConduit(true, false, false);
         Message message = new MessageImpl();
         setUpHeaders(message);
-        conduit.send(message);
+        conduit.prepare(message);
         verifySentMessage(conduit, message, true);
     }
     
@@ -126,7 +126,7 @@
     public void testSendHttpConnection() throws Exception {
         HTTPConduit conduit = setUpConduit(true, true, false);
         Message message = new MessageImpl();
-        conduit.send(message);
+        conduit.prepare(message);
         verifySentMessage(conduit, message);
     }
 
@@ -134,7 +134,7 @@
     public void testSendHttpConnectionAutoRedirect() throws Exception {
         HTTPConduit conduit = setUpConduit(true, true, true);
         Message message = new MessageImpl();
-        conduit.send(message);
+        conduit.prepare(message);
         verifySentMessage(conduit, message);
     }
     
@@ -142,7 +142,7 @@
     public void testSendDecoupled() throws Exception {
         HTTPConduit conduit = setUpConduit(true, false, false, true);
         Message message = new MessageImpl();
-        conduit.send(message);
+        conduit.prepare(message);
         verifySentMessage(conduit, message, false, true);
     }
     

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Thu Apr  5 11:51:24 2007
@@ -78,7 +78,7 @@
     } 
     
     // prepare the message for send out , not actually send out the message
-    public void send(Message message) throws IOException {        
+    public void prepare(Message message) throws IOException {        
         getLogger().log(Level.FINE, "JMSConduit send message");
 
         try {

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Thu Apr  5 11:51:24 2007
@@ -363,7 +363,7 @@
          * 
          * @param message the message to be sent.
          */
-        public void send(Message message) throws IOException {
+        public void prepare(Message message) throws IOException {
             // setup the message to be send back
             message.put(JMSConstants.JMS_REQUEST_MESSAGE, 
                         inMessage.get(JMSConstants.JMS_REQUEST_MESSAGE));

Modified: incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
Thu Apr  5 11:51:24 2007
@@ -94,7 +94,7 @@
         message.setExchange(exchange);
         exchange.setInMessage(message);
         try {
-            conduit.send(message);
+            conduit.prepare(message);
         } catch (IOException ex) {
             assertFalse("JMSConduit can't perpare to send out message", false);
             ex.printStackTrace();            

Modified: incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
Thu Apr  5 11:51:24 2007
@@ -77,7 +77,7 @@
         JMSConduit conduit = setupJMSConduit(false, false);
         Message message = new MessageImpl();
         try {
-            conduit.send(message);
+            conduit.prepare(message);
         } catch (Exception ex) {
             ex.printStackTrace();            
         }

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalConduit.java
Thu Apr  5 11:51:24 2007
@@ -50,12 +50,19 @@
         this.destination = destination;
     }
     
-    public void send(final Message message) throws IOException {
-        if (Boolean.TRUE.equals(message.get(DIRECT_DISPATCH))) {
-            dispatchDirect(message);
-        } else {
+    public void prepare(final Message message) throws IOException {
+        if (!Boolean.TRUE.equals(message.get(DIRECT_DISPATCH))) {
             dispatchViaPipe(message);
         }
+    }
+
+    @Override
+    public void close(Message message) throws IOException {
+        if (Boolean.TRUE.equals(message.get(DIRECT_DISPATCH))) {
+            dispatchDirect(message);
+        } 
+        
+        super.close(message);
     }
 
     private void dispatchDirect(Message message) {

Modified: incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/local/src/main/java/org/apache/cxf/transport/local/LocalDestination.java
Thu Apr  5 11:51:24 2007
@@ -73,7 +73,7 @@
             this.conduit = conduit;
         }
 
-        public void send(final Message message) throws IOException {
+        public void prepare(final Message message) throws IOException {
             final Exchange exchange = (Exchange)message.getExchange().get(LocalConduit.IN_EXCHANGE);
             
             if (Boolean.TRUE.equals(message.get(LocalConduit.DIRECT_DISPATCH))) {

Modified: incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/local/src/test/java/org/apache/cxf/transport/local/LocalTransportFactoryTest.java
Thu Apr  5 11:51:24 2007
@@ -55,7 +55,7 @@
         conduit.setMessageObserver(obs);
         
         Message m = new MessageImpl();
-        conduit.send(m);
+        conduit.prepare(m);
 
         OutputStream out = m.getContent(OutputStream.class);
         out.write("hello".getBytes());
@@ -86,10 +86,10 @@
         m.put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
         m.setDestination(d);
         m.setContent(InputStream.class, new ByteArrayInputStream("hello".getBytes()));
-        conduit.send(m);
+        conduit.prepare(m);
+        conduit.close(m);
 
         assertEquals("hello", obs.getResponseStream().toString());
-
     }
     static class EchoObserver implements MessageObserver {
 
@@ -98,7 +98,7 @@
                 Conduit backChannel = message.getDestination().getBackChannel(message, null,
null);
                 message.remove(LocalConduit.DIRECT_DISPATCH);
                 
-                backChannel.send(message);
+                backChannel.prepare(message);
 
                 OutputStream out = message.getContent(OutputStream.class);
                 assertNotNull(out);

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
(original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
Thu Apr  5 11:51:24 2007
@@ -288,7 +288,7 @@
                 callbacks = ((AbstractCachedOutputStream)os).getCallbacks();
             }
 
-            c.send(message);
+            c.prepare(message);
 
             os = message.getContent(OutputStream.class);
             if (os instanceof AbstractCachedOutputStream && callbacks.size() >
1) {

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java?view=diff&rev=525926&r1=525925&r2=525926
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/MtomServerTest.java
Thu Apr  5 11:51:24 2007
@@ -73,7 +73,7 @@
                     + "boundary=\"----=_Part_4_701508.1145579811786\"";
 
         m.put(Message.CONTENT_TYPE, ct);
-        conduit.send(m);
+        conduit.prepare(m);
 
         OutputStream os = m.getContent(OutputStream.class);
         InputStream is = getResourceAsStream("request");



Mime
View raw message