camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r722854 - in /activemq/camel/branches/camel-1.x: ./ components/camel-mina/src/main/java/org/apache/camel/component/mina/ components/camel-mina/src/test/java/org/apache/camel/component/mina/
Date Wed, 03 Dec 2008 12:11:51 GMT
Author: davsclaus
Date: Wed Dec  3 04:11:51 2008
New Revision: 722854

URL: http://svn.apache.org/viewvc?rev=722854&view=rev
Log:
Merged revisions 722845 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r722845 | davsclaus | 2008-12-03 12:53:48 +0100 (on, 03 dec 2008) | 1 line
  
  CAMEL-1141: Added textlineDelimiter option for textline codec.
........

Added:
    activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/TextLineCodecFactory.java
      - copied unchanged from r722845, activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/TextLineCodecFactory.java
    activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/TextLineDelimiter.java
      - copied unchanged from r722845, activemq/camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/TextLineDelimiter.java
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaInOutRouteTextLineDelimiterTest.java
      - copied unchanged from r722845, activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaInOutRouteTextLineDelimiterTest.java
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpLineDelimiterUsingPlainSocketTest.java
      - copied unchanged from r722845, activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpLineDelimiterUsingPlainSocketTest.java
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpTextlineDelimiterTest.java
      - copied unchanged from r722845, activemq/camel/trunk/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpTextlineDelimiterTest.java
Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpWithInOutUsingPlainSocketTest.java

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Dec  3 04:11:51 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java?rev=722854&r1=722853&r2=722854&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaComponent.java
Wed Dec  3 04:11:51 2008
@@ -44,7 +44,7 @@
 import org.apache.mina.filter.codec.ProtocolEncoder;
 import org.apache.mina.filter.codec.ProtocolEncoderOutput;
 import org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory;
-import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
+import org.apache.mina.filter.codec.textline.LineDelimiter;
 import org.apache.mina.transport.socket.nio.DatagramAcceptor;
 import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
 import org.apache.mina.transport.socket.nio.DatagramConnector;
@@ -68,6 +68,7 @@
     private static final long DEFAULT_CONNECT_TIMEOUT = 30000;
     private boolean sync = true;
     private boolean textline;
+    private TextLineDelimiter textlineDelimiter;
     private String codec;
     private String encoding;
     private long timeout;
@@ -163,10 +164,11 @@
         if (codecFactory == null) {
             if (textline) {
                 Charset charset = getEncodingParameter(type, encoding);
-                codecFactory = new TextLineCodecFactory(charset);
+                LineDelimiter delimiter = getLineDelimiterParameter();
+                codecFactory = new TextLineCodecFactory(charset, delimiter);
                 if (LOG.isDebugEnabled()) {
                     LOG.debug(type + ": Using TextLineCodecFactory: " + codecFactory + "
using encoding: "
-                              + encoding);
+                              + charset + " and line delimiter: " + textlineDelimiter + "("
+ delimiter + ")");
                 }
             } else {
                 codecFactory = new ObjectSerializationCodecFactory();
@@ -281,7 +283,7 @@
             encoder = charset.newEncoder();
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug(type + ": Using CodecFactory: " + codecFactory + " using encoding:
" + encoding);
+                LOG.debug(type + ": Using CodecFactory: " + codecFactory + " using encoding:
" + charset);
             }
         }
 
@@ -318,6 +320,25 @@
         config.getFilterChain().addLast("codec", new ProtocolCodecFilter(codecFactory));
     }
 
+    private LineDelimiter getLineDelimiterParameter() {
+        if (textlineDelimiter == null) {
+            return LineDelimiter.AUTO;
+        }
+
+        switch (textlineDelimiter) {
+        case AUTO:
+            return LineDelimiter.AUTO;
+        case UNIX:
+            return LineDelimiter.UNIX;
+        case WINDOWS:
+            return LineDelimiter.WINDOWS;
+        case MAC:
+            return LineDelimiter.MAC;
+        default:
+            throw new IllegalArgumentException("Unknown textline delimiter: " + textlineDelimiter);
+        }
+    }
+
     // Properties
     //-------------------------------------------------------------------------
 
@@ -337,6 +358,14 @@
         this.textline = textline;
     }
 
+    public TextLineDelimiter getTextlineDelimiter() {
+        return textlineDelimiter;
+    }
+
+    public void setTextlineDelimiter(TextLineDelimiter textlineDelimiter) {
+        this.textlineDelimiter = textlineDelimiter;
+    }
+
     public String getCodec() {
         return codec;
     }
@@ -384,4 +413,5 @@
     public void setMinaLogger(boolean minaLogger) {
         this.minaLogger = minaLogger;
     }
+
 }

Modified: activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpWithInOutUsingPlainSocketTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpWithInOutUsingPlainSocketTest.java?rev=722854&r1=722853&r2=722854&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpWithInOutUsingPlainSocketTest.java
(original)
+++ activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaTcpWithInOutUsingPlainSocketTest.java
Wed Dec  3 04:11:51 2008
@@ -133,8 +133,7 @@
                             e.getOut().setBody(null);
                             throw new IllegalArgumentException("Forced exception");
                         } else {
-                            // append newline as stop character for textline codec
-                            e.getOut().setBody("Hello " + in + "\n");
+                            e.getOut().setBody("Hello " + in);
                         }
                     }
                 });



Mime
View raw message