activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r523016 - in /activemq/camel/trunk/camel-mina: ./ src/main/java/org/apache/camel/component/mina/
Date Tue, 27 Mar 2007 17:48:16 GMT
Author: jstrachan
Date: Tue Mar 27 10:48:15 2007
New Revision: 523016

URL: http://svn.apache.org/viewvc?view=rev&rev=523016
Log:
fixed the TCP test case

Modified:
    activemq/camel/trunk/camel-mina/pom.xml
    activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
    activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
    activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
    activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java

Modified: activemq/camel/trunk/camel-mina/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-mina/pom.xml?view=diff&rev=523016&r1=523015&r2=523016
==============================================================================
--- activemq/camel/trunk/camel-mina/pom.xml (original)
+++ activemq/camel/trunk/camel-mina/pom.xml Tue Mar 27 10:48:15 2007
@@ -76,7 +76,6 @@
             <include>**/*Test.*</include>
           </includes>
           <excludes>
-            <exclude>**/MinaTcpTest.*</exclude>
             <exclude>**/MinaMulticastTest.*</exclude>
           </excludes>
         </configuration>

Modified: activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java?view=diff&rev=523016&r1=523015&r2=523016
==============================================================================
--- activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
(original)
+++ activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
Tue Mar 27 10:48:15 2007
@@ -21,10 +21,15 @@
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoConnector;
+import org.apache.mina.common.IoServiceConfig;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
 import org.apache.mina.transport.socket.nio.DatagramAcceptor;
 import org.apache.mina.transport.socket.nio.DatagramConnector;
 import org.apache.mina.transport.socket.nio.SocketAcceptor;
 import org.apache.mina.transport.socket.nio.SocketConnector;
+import org.apache.mina.transport.socket.nio.SocketConnectorConfig;
+import org.apache.mina.transport.socket.nio.DatagramConnectorConfig;
 import org.apache.mina.transport.vmpipe.VmPipeAcceptor;
 import org.apache.mina.transport.vmpipe.VmPipeAddress;
 import org.apache.mina.transport.vmpipe.VmPipeConnector;
@@ -34,7 +39,6 @@
 import java.net.SocketAddress;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -80,21 +84,30 @@
         IoAcceptor acceptor = new VmPipeAcceptor();
         SocketAddress address = new VmPipeAddress(connectUri.getPort());
         IoConnector connector = new VmPipeConnector();
-
-        return new MinaEndpoint(uri, getContext(), address, acceptor, connector);
+        return new MinaEndpoint(uri, getContext(), address, acceptor, connector, null);
     }
 
     protected MinaEndpoint createSocketEndpoint(String uri, URI connectUri) {
         IoAcceptor acceptor = new SocketAcceptor();
         SocketAddress address = new InetSocketAddress(connectUri.getHost(), connectUri.getPort());
         IoConnector connector = new SocketConnector();
-        return new MinaEndpoint(uri, getContext(), address, acceptor, connector);
+
+        // TODO customize the config via URI
+        SocketConnectorConfig config = new SocketConnectorConfig();
+        config.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
+
+        return new MinaEndpoint(uri, getContext(), address, acceptor, connector, config);
     }
 
     protected MinaEndpoint createDatagramEndpoint(String uri, URI connectUri) {
         IoAcceptor acceptor = new DatagramAcceptor();
         SocketAddress address = new InetSocketAddress(connectUri.getHost(), connectUri.getPort());
         IoConnector connector = new DatagramConnector();
-        return new MinaEndpoint(uri, getContext(), address, acceptor, connector);
+
+        // TODO customize the config via URI
+        DatagramConnectorConfig config = new DatagramConnectorConfig();
+        config.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
+
+        return new MinaEndpoint(uri, getContext(), address, acceptor, connector, config);
     }
 }

Modified: activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java?view=diff&rev=523016&r1=523015&r2=523016
==============================================================================
--- activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
(original)
+++ activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaConsumer.java
Tue Mar 27 10:48:15 2007
@@ -61,7 +61,7 @@
             }
         };
 
-        acceptor.bind(address, handler);
+        acceptor.bind(address, handler, endpoint.getConfig());
     }
 
     @Override

Modified: activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java?view=diff&rev=523016&r1=523015&r2=523016
==============================================================================
--- activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
(original)
+++ activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java
Tue Mar 27 10:48:15 2007
@@ -26,6 +26,7 @@
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.IoConnector;
+import org.apache.mina.common.IoServiceConfig;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -40,10 +41,11 @@
     private final IoAcceptor acceptor;
     private final SocketAddress address;
     private final IoConnector connector;
+    private final IoServiceConfig config;
 
-
-    public MinaEndpoint(String endpointUri, CamelContext container, SocketAddress address,
IoAcceptor acceptor, IoConnector connector) {
+    public MinaEndpoint(String endpointUri, CamelContext container, SocketAddress address,
IoAcceptor acceptor, IoConnector connector, IoServiceConfig config) {
         super(endpointUri, container);
+        this.config = config;
         this.address = address;
         this.acceptor = acceptor;
         this.connector = connector;
@@ -82,6 +84,11 @@
         return connector;
     }
 
+    public IoServiceConfig getConfig() {
+        return config;
+    }
+
+    
     // Implementation methods
     //-------------------------------------------------------------------------
 
@@ -94,4 +101,5 @@
     protected void doDeactivate() {
         acceptor.unbindAll();
     }
+
 }

Modified: activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java?view=diff&rev=523016&r1=523015&r2=523016
==============================================================================
--- activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
(original)
+++ activemq/camel/trunk/camel-mina/src/main/java/org/apache/camel/component/mina/MinaProducer.java
Tue Mar 27 10:48:15 2007
@@ -26,6 +26,8 @@
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoHandlerAdapter;
 import org.apache.mina.common.IoSession;
+import org.apache.mina.common.IoServiceConfig;
+import org.apache.mina.transport.socket.nio.SocketConnectorConfig;
 
 import java.net.SocketAddress;
 
@@ -70,7 +72,7 @@
                 super.messageReceived(ioSession, object);    /** TODO */
             }
         };
-        ConnectFuture future = connector.connect(address, ioHandler);
+        ConnectFuture future = connector.connect(address, ioHandler, endpoint.getConfig());
         future.join();
         session = future.getSession();
     }



Mime
View raw message