You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/09/07 09:22:46 UTC

[1/6] git commit: - Added support for rfc5424 Syslog messages - Added support for sending and receiving syslog messages using rfc 5426/rfc6587 (syslog over SSL/TCP)

Repository: camel
Updated Branches:
  refs/heads/master 5db09a809 -> 808b0176e


- Added support for rfc5424 Syslog messages
- Added support for sending and receiving syslog messages using rfc 5426/rfc6587 (syslog over SSL/TCP)


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/372ab5b5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/372ab5b5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/372ab5b5

Branch: refs/heads/master
Commit: 372ab5b54dc0c0a8c5a9218629dca0a3f5db3017
Parents: 5ab32ac
Author: svenrienstra <sv...@topicus.nl>
Authored: Fri May 30 11:28:19 2014 +0200
Committer: svenrienstra <sv...@topicus.nl>
Committed: Fri May 30 11:28:19 2014 +0200

----------------------------------------------------------------------
 .../syslog/Rfc3164SyslogConverter.java          | 270 --------------
 .../syslog/Rfc3164SyslogDataFormat.java         |  68 ----
 .../component/syslog/Rfc5424SyslogMessage.java  |  76 ++++
 .../camel/component/syslog/SyslogConverter.java | 371 +++++++++++++++++++
 .../component/syslog/SyslogDataFormat.java      |  70 ++++
 .../camel/component/syslog/SyslogMessage.java   |  12 +-
 .../component/syslog/netty/Rfc5426Encoder.java  |  38 ++
 .../syslog/netty/Rfc5426FrameDecoder.java       | 100 +++++
 .../services/org/apache/camel/TypeConverter     |   2 +-
 .../services/org/apache/camel/dataformat/syslog |   2 +-
 .../syslog/AutomatedConversionTest.java         |  30 +-
 .../component/syslog/MinaDataFormatTest.java    |   2 +-
 .../syslog/MinaManyUDPMessagesTest.java         |   2 +-
 .../component/syslog/NettyDataFormatTest.java   |   2 +-
 .../syslog/NettyManyUDPMessagesTest.java        |   2 +-
 .../syslog/NettyRfc5426LongMessageTest.java     |  88 +++++
 .../component/syslog/NettyRfc5426Test.java      |  91 +++++
 .../component/syslog/SyslogSpringMinaTest.java  |   2 +-
 18 files changed, 865 insertions(+), 363 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogConverter.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogConverter.java
deleted file mode 100644
index e65684e..0000000
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogConverter.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.syslog;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.camel.Converter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Converter
-public final class Rfc3164SyslogConverter {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Rfc3164SyslogConverter.class);
-
-    private static enum MONTHS {
-        jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
-    }
-
-    private static Map<String, MONTHS> monthValueMap = new HashMap<String, MONTHS>() {
-        private static final long serialVersionUID = 1L;
-        {
-            put("jan", MONTHS.jan);
-            put("feb", MONTHS.feb);
-            put("mar", MONTHS.mar);
-            put("apr", MONTHS.apr);
-            put("may", MONTHS.may);
-            put("jun", MONTHS.jun);
-            put("jul", MONTHS.jul);
-            put("aug", MONTHS.aug);
-            put("sep", MONTHS.sep);
-            put("oct", MONTHS.oct);
-            put("nov", MONTHS.nov);
-            put("dec", MONTHS.dec);
-        }
-    };
-
-    private Rfc3164SyslogConverter() {
-        //Utility class
-    }
-
-    @Converter
-    public static String toString(SyslogMessage message) {
-        StringBuilder sbr = new StringBuilder();
-        sbr.append("<");
-        if (message.getFacility() == null) {
-            message.setFacility(SyslogFacility.USER);
-        }
-        if (message.getSeverity() == null) {
-            message.setSeverity(SyslogSeverity.INFO);
-        }
-        if (message.getHostname() == null) {
-            //This is massively ugly..
-            try {
-                message.setHostname(InetAddress.getLocalHost().toString());
-            } catch (UnknownHostException e) {
-                message.setHostname("UNKNOWN_HOST");
-            }
-        }
-        sbr.append(message.getFacility().ordinal() * 8 + message.getSeverity().ordinal());
-        sbr.append(">");
-        if (message.getTimestamp() == null) {
-            message.setTimestamp(new Date());
-        }
-
-        //SDF isn't going to help much here.
-
-        Calendar cal = Calendar.getInstance();
-        cal.setTime(message.getTimestamp());
-
-        String firstLetter = MONTHS.values()[cal.get(Calendar.MONTH)].toString().substring(0, 1);  // Get first letter
-        String remainder = MONTHS.values()[cal.get(Calendar.MONTH)].toString().substring(1);    // Get remainder of word.
-        String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
-
-        sbr.append(capitalized);
-        sbr.append(" ");
-
-        if (cal.get(Calendar.DAY_OF_MONTH) < 10) {
-            sbr.append(" ").append(cal.get(Calendar.DAY_OF_MONTH));
-        } else {
-            sbr.append(cal.get(Calendar.DAY_OF_MONTH));
-        }
-
-        sbr.append(" ");
-
-        if (cal.get(Calendar.HOUR_OF_DAY) < 10) {
-            sbr.append("0").append(cal.get(Calendar.HOUR_OF_DAY));
-        } else {
-            sbr.append(cal.get(Calendar.HOUR_OF_DAY));
-        }
-        sbr.append(":");
-
-        if (cal.get(Calendar.MINUTE) < 10) {
-            sbr.append("0").append(cal.get(Calendar.MINUTE));
-        } else {
-            sbr.append(cal.get(Calendar.MINUTE));
-        }
-        sbr.append(":");
-
-        if (cal.get(Calendar.SECOND) < 10) {
-            sbr.append("0").append(cal.get(Calendar.SECOND));
-        } else {
-            sbr.append(cal.get(Calendar.SECOND));
-        }
-        sbr.append(" ");
-
-        sbr.append(message.getHostname());
-        sbr.append(" ");
-        sbr.append(message.getLogMessage());
-        return sbr.toString();
-    }
-
-    @Converter
-    public static SyslogMessage toSyslogMessage(String body) {
-        return parseMessage(body.getBytes());
-    }
-
-    public static SyslogMessage parseMessage(byte[] bytes) {
-        ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
-        byteBuffer.put(bytes);
-        byteBuffer.rewind();
-
-        SyslogMessage syslogMessage = new SyslogMessage();
-        Character charFound = (char) byteBuffer.get();
-
-        while (charFound != '<') {
-            //Ignore noise in beginning of message.
-            charFound = (char) byteBuffer.get();
-        }
-        char priChar = 0;
-        if (charFound == '<') {
-            int facility = 0;
-
-            while (Character.isDigit(priChar = (char) (byteBuffer.get() & 0xff))) {
-                facility *= 10;
-                facility += Character.digit(priChar, 10);
-            }
-            syslogMessage.setFacility(SyslogFacility.values()[facility >> 3]);
-            syslogMessage.setSeverity(SyslogSeverity.values()[facility & 0x07]);
-        }
-
-        if (priChar != '>') {
-            //Invalid character - this is not a well defined syslog message.
-            LOG.error("Invalid syslog message, missing a > in the Facility/Priority part");
-        }
-
-        //Done parsing severity and facility
-        //<169>Oct 22 10:52:01 TZ-6 scapegoat.dmz.example.org 10.1.2.3 sched[0]: That's All Folks!
-        //Need to parse the date.
-
-        /**
-         The TIMESTAMP field is the local time and is in the format of "Mmm dd
-         hh:mm:ss" (without the quote marks) where:
-
-         Mmm is the English language abbreviation for the month of the
-         year with the first character in uppercase and the other two
-         characters in lowercase.  The following are the only acceptable
-         values:
-
-         Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
-
-         dd is the day of the month.  If the day of the month is less
-         than 10, then it MUST be represented as a space and then the
-         number.  For example, the 7th day of August would be
-         represented as "Aug  7", with two spaces between the "g" and
-         the "7".
-
-         hh:mm:ss is the local time.  The hour (hh) is represented in a
-         24-hour format.  Valid entries are between 00 and 23,
-         inclusive.  The minute (mm) and second (ss) entries are between
-         00 and 59 inclusive.
-
-
-         */
-
-        char[] month = new char[3];
-        for (int i = 0; i < 3; i++) {
-            month[i] = (char) (byteBuffer.get() & 0xff);
-        }
-        charFound = (char) byteBuffer.get();
-        if (charFound != ' ') {
-            //Invalid Message - missing mandatory space.
-            LOG.error("Invalid syslog message, missing a mandatory space after month");
-        }
-        charFound = (char) (byteBuffer.get() & 0xff);
-
-        int day = 0;
-        if (charFound == ' ') {
-            //Extra space for the day - this is okay.
-            //Just ignored per the spec.
-        } else {
-            day *= 10;
-            day += Character.digit(charFound, 10);
-        }
-
-        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
-            day *= 10;
-            day += Character.digit(charFound, 10);
-        }
-
-        int hour = 0;
-        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
-            hour *= 10;
-            hour += Character.digit(charFound, 10);
-        }
-
-        int minute = 0;
-        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
-            minute *= 10;
-            minute += Character.digit(charFound, 10);
-        }
-
-        int second = 0;
-        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
-            second *= 10;
-            second += Character.digit(charFound, 10);
-        }
-
-        //The host is the char sequence until the next ' '
-
-        StringBuilder host = new StringBuilder();
-        while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
-            host.append(charFound);
-        }
-
-        syslogMessage.setHostname(host.toString());
-
-        StringBuilder msg = new StringBuilder();
-        while (byteBuffer.hasRemaining()) {
-            charFound = (char) (byteBuffer.get() & 0xff);
-            msg.append(charFound);
-        }
-
-        Calendar calendar = new GregorianCalendar();
-        calendar.set(Calendar.MONTH, monthValueMap.get(String.valueOf(month).toLowerCase()).ordinal());
-        calendar.set(Calendar.DAY_OF_MONTH, day);
-        calendar.set(Calendar.HOUR_OF_DAY, hour);
-        calendar.set(Calendar.MINUTE, minute);
-        calendar.set(Calendar.SECOND, second);
-
-        syslogMessage.setTimestamp(calendar.getTime());
-
-        syslogMessage.setLogMessage(msg.toString());
-        LOG.trace("Syslog message : {}", syslogMessage.toString());
-
-        return syslogMessage;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogDataFormat.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogDataFormat.java
deleted file mode 100644
index add81ee..0000000
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc3164SyslogDataFormat.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.syslog;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.util.ExchangeHelper;
-
-public class Rfc3164SyslogDataFormat implements DataFormat {
-    public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
-        SyslogMessage message = ExchangeHelper.convertToMandatoryType(exchange, SyslogMessage.class, body);
-        stream.write(Rfc3164SyslogConverter.toString(message).getBytes());
-    }
-
-    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
-
-        String body = ExchangeHelper.convertToMandatoryType(exchange, String.class, inputStream);
-        SyslogMessage message = Rfc3164SyslogConverter.parseMessage(body.getBytes());
-
-        exchange.getOut().setHeader(SyslogConstants.SYSLOG_FACILITY, message.getFacility());
-        exchange.getOut().setHeader(SyslogConstants.SYSLOG_SEVERITY, message.getSeverity());
-        exchange.getOut().setHeader(SyslogConstants.SYSLOG_HOSTNAME, message.getHostname());
-        exchange.getOut().setHeader(SyslogConstants.SYSLOG_TIMESTAMP, message.getTimestamp());
-
-        //Since we are behind the fact of being in an Endpoint...
-        //We need to pull in the remote/local via either Mina or Netty.
-
-        if (exchange.getIn().getHeader("CamelMinaLocalAddress") != null) {
-            message.setLocalAddress(exchange.getIn().getHeader("CamelMinaLocalAddress", String.class));
-            exchange.getOut().setHeader(SyslogConstants.SYSLOG_LOCAL_ADDRESS, message.getLocalAddress());
-        }
-
-        if (exchange.getIn().getHeader("CamelMinaRemoteAddress") != null) {
-            message.setRemoteAddress(exchange.getIn().getHeader("CamelMinaRemoteAddress", String.class));
-            exchange.getOut().setHeader(SyslogConstants.SYSLOG_REMOTE_ADDRESS, message.getRemoteAddress());
-        }
-        
-        if (exchange.getIn().getHeader("CamelNettyLocalAddress") != null) {
-            message.setLocalAddress(exchange.getIn().getHeader("CamelNettyLocalAddress", String.class));
-            exchange.getOut().setHeader(SyslogConstants.SYSLOG_LOCAL_ADDRESS, message.getLocalAddress());
-        }
-
-        if (exchange.getIn().getHeader("CamelNettyRemoteAddress") != null) {
-            message.setRemoteAddress(exchange.getIn().getHeader("CamelNettyRemoteAddress", String.class));
-            exchange.getOut().setHeader(SyslogConstants.SYSLOG_REMOTE_ADDRESS, message.getRemoteAddress());
-        }
-
-        return message;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
new file mode 100644
index 0000000..c9da66c
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
@@ -0,0 +1,76 @@
+/**
+ * 
+ */
+package org.apache.camel.component.syslog;
+
+/**
+ * @author svenrienstra
+ * 
+ */
+public class Rfc5424SyslogMessage extends SyslogMessage {
+    private String appName = "-";
+    private String procId = "-";
+    private String msgId = "-";
+    private String structuredData = "-";
+
+    /**
+     * @return the appName
+     */
+    public String getAppName() {
+	return appName;
+    }
+
+    /**
+     * @param appName
+     *            the appName to set
+     */
+    public void setAppName(String appName) {
+	this.appName = appName;
+    }
+
+    /**
+     * @return the procId
+     */
+    public String getProcId() {
+	return procId;
+    }
+
+    /**
+     * @param procId
+     *            the procId to set
+     */
+    public void setProcId(String procId) {
+	this.procId = procId;
+    }
+
+    /**
+     * @return the msgId
+     */
+    public String getMsgId() {
+	return msgId;
+    }
+
+    /**
+     * @param msgId
+     *            the msgId to set
+     */
+    public void setMsgId(String msgId) {
+	this.msgId = msgId;
+    }
+
+    /**
+     * @return the structuredData
+     */
+    public String getStructuredData() {
+	return structuredData;
+    }
+
+    /**
+     * @param structuredData
+     *            the structuredData to set
+     */
+    public void setStructuredData(String structuredData) {
+	this.structuredData = structuredData;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
new file mode 100644
index 0000000..b4e86f7
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
@@ -0,0 +1,371 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.DatatypeConverter;
+
+import org.apache.camel.Converter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Converter
+public final class SyslogConverter {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SyslogConverter.class);
+
+    private static enum MONTHS {
+        jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
+    }
+
+    private static Map<String, MONTHS> monthValueMap = new HashMap<String, MONTHS>() {
+        private static final long serialVersionUID = 1L;
+        {
+            put("jan", MONTHS.jan);
+            put("feb", MONTHS.feb);
+            put("mar", MONTHS.mar);
+            put("apr", MONTHS.apr);
+            put("may", MONTHS.may);
+            put("jun", MONTHS.jun);
+            put("jul", MONTHS.jul);
+            put("aug", MONTHS.aug);
+            put("sep", MONTHS.sep);
+            put("oct", MONTHS.oct);
+            put("nov", MONTHS.nov);
+            put("dec", MONTHS.dec);
+        }
+    };
+
+    private SyslogConverter() {
+        // Utility class
+    }
+
+    @Converter
+    public static String toString(SyslogMessage message) {
+
+        boolean isRfc5424 = message instanceof Rfc5424SyslogMessage;
+
+        StringBuilder sbr = new StringBuilder();
+        sbr.append("<");
+        if (message.getFacility() == null) {
+            message.setFacility(SyslogFacility.USER);
+        }
+        if (message.getSeverity() == null) {
+            message.setSeverity(SyslogSeverity.INFO);
+        }
+        if (message.getHostname() == null) {
+            // This is massively ugly..
+            try {
+                message.setHostname(InetAddress.getLocalHost().toString());
+            } catch (UnknownHostException e) {
+                message.setHostname("UNKNOWN_HOST");
+            }
+        }
+        sbr.append(message.getFacility().ordinal() * 8 + message.getSeverity().ordinal());
+        sbr.append(">");
+
+        // version number
+        if (isRfc5424) {
+            sbr.append("1");
+            sbr.append(" ");
+        }
+
+        if (message.getTimestamp() == null) {
+            message.setTimestamp(Calendar.getInstance());
+        }
+
+        if (isRfc5424) {
+            sbr.append(DatatypeConverter.printDateTime(message.getTimestamp()));
+        } else {
+            addRfc3164TimeStamp(sbr, message);
+        }
+        sbr.append(" ");
+
+        sbr.append(message.getHostname());
+        sbr.append(" ");
+
+        if (isRfc5424) {
+            Rfc5424SyslogMessage rfc5424SyslogMessage = (Rfc5424SyslogMessage)message;
+
+            sbr.append(rfc5424SyslogMessage.getAppName());
+            sbr.append(" ");
+
+            sbr.append(rfc5424SyslogMessage.getProcId());
+            sbr.append(" ");
+
+            sbr.append(rfc5424SyslogMessage.getMsgId());
+            sbr.append(" ");
+
+            sbr.append(rfc5424SyslogMessage.getStructuredData());
+            sbr.append(" ");
+        }
+
+        sbr.append(message.getLogMessage());
+
+        return sbr.toString();
+    }
+
+    @Converter
+    public static SyslogMessage toSyslogMessage(String body) {
+        return parseMessage(body.getBytes());
+    }
+
+    public static SyslogMessage parseMessage(byte[] bytes) {
+        ByteBuffer byteBuffer = ByteBuffer.allocate(bytes.length);
+        byteBuffer.put(bytes);
+        byteBuffer.rewind();
+
+        Character charFound = (char)byteBuffer.get();
+
+        SyslogFacility foundFacility = null;
+        SyslogSeverity foundSeverity = null;
+
+        while (charFound != '<') {
+            // Ignore noise in beginning of message.
+            charFound = (char)byteBuffer.get();
+        }
+        char priChar = 0;
+        if (charFound == '<') {
+            int facility = 0;
+
+            while (Character.isDigit(priChar = (char)(byteBuffer.get() & 0xff))) {
+                facility *= 10;
+                facility += Character.digit(priChar, 10);
+            }
+            foundFacility = SyslogFacility.values()[facility >> 3];
+            foundSeverity = SyslogSeverity.values()[facility & 0x07];
+        }
+
+        if (priChar != '>') {
+            // Invalid character - this is not a well defined syslog message.
+            LOG.error("Invalid syslog message, missing a > in the Facility/Priority part");
+        }
+
+        SyslogMessage syslogMessage = new SyslogMessage();
+        boolean isRfc5424 = false;
+        // Read next character
+        charFound = (char)byteBuffer.get();
+        // If next character is a 1, we have probably found an rfc 5424 message
+        // message
+        if (charFound == '1') {
+            syslogMessage = new Rfc5424SyslogMessage();
+            isRfc5424 = true;
+        } else {
+            // go back one to parse the rfc3164 date
+            byteBuffer.position(byteBuffer.position() - 1);
+        }
+
+        syslogMessage.setFacility(foundFacility);
+        syslogMessage.setSeverity(foundSeverity);
+
+        if (!isRfc5424) {
+            // Parse rfc 3164 date
+            syslogMessage.setTimestamp(parseRfc3164Date(byteBuffer));
+        } else {
+
+            charFound = (char)byteBuffer.get();
+            if (charFound != ' ') {
+                LOG.error("Invalid syslog message, missing a mandatory space after version");
+            }
+
+            // This should be the timestamp
+            StringBuilder date = new StringBuilder();
+            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+                date.append(charFound);
+            }
+
+            syslogMessage.setTimestamp(DatatypeConverter.parseDateTime(date.toString()));
+        }
+
+        // The host is the char sequence until the next ' '
+
+        StringBuilder host = new StringBuilder();
+        while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+            host.append(charFound);
+        }
+
+        syslogMessage.setHostname(host.toString());
+
+        if (isRfc5424) {
+            Rfc5424SyslogMessage rfc5424SyslogMessage = (Rfc5424SyslogMessage)syslogMessage;
+            StringBuilder appName = new StringBuilder();
+            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+                appName.append(charFound);
+            }
+            rfc5424SyslogMessage.setAppName(appName.toString());
+
+            StringBuilder procId = new StringBuilder();
+            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+                procId.append(charFound);
+            }
+            rfc5424SyslogMessage.setProcId(procId.toString());
+
+            StringBuilder msgId = new StringBuilder();
+            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+                msgId.append(charFound);
+            }
+            rfc5424SyslogMessage.setMsgId(msgId.toString());
+
+            StringBuilder structuredData = new StringBuilder();
+            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+                structuredData.append(charFound);
+            }
+            rfc5424SyslogMessage.setStructuredData(structuredData.toString());
+        }
+
+        StringBuilder msg = new StringBuilder();
+        while (byteBuffer.hasRemaining()) {
+            charFound = (char)(byteBuffer.get() & 0xff);
+            msg.append(charFound);
+        }
+
+        syslogMessage.setLogMessage(msg.toString());
+        LOG.trace("Syslog message : {}", syslogMessage.toString());
+
+        return syslogMessage;
+    }
+
+    private static void addRfc3164TimeStamp(StringBuilder sbr, SyslogMessage message) {
+        // SDF isn't going to help much here.
+
+        Calendar cal = message.getTimestamp();
+
+        String firstLetter = MONTHS.values()[cal.get(Calendar.MONTH)].toString().substring(0, 1); // Get
+                                                                                                  // first
+                                                                                                  // letter
+        String remainder = MONTHS.values()[cal.get(Calendar.MONTH)].toString().substring(1); // Get
+                                                                                             // remainder
+                                                                                             // of
+                                                                                             // word.
+        String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
+
+        sbr.append(capitalized);
+        sbr.append(" ");
+
+        if (cal.get(Calendar.DAY_OF_MONTH) < 10) {
+            sbr.append(" ").append(cal.get(Calendar.DAY_OF_MONTH));
+        } else {
+            sbr.append(cal.get(Calendar.DAY_OF_MONTH));
+        }
+
+        sbr.append(" ");
+
+        if (cal.get(Calendar.HOUR_OF_DAY) < 10) {
+            sbr.append("0").append(cal.get(Calendar.HOUR_OF_DAY));
+        } else {
+            sbr.append(cal.get(Calendar.HOUR_OF_DAY));
+        }
+        sbr.append(":");
+
+        if (cal.get(Calendar.MINUTE) < 10) {
+            sbr.append("0").append(cal.get(Calendar.MINUTE));
+        } else {
+            sbr.append(cal.get(Calendar.MINUTE));
+        }
+        sbr.append(":");
+
+        if (cal.get(Calendar.SECOND) < 10) {
+            sbr.append("0").append(cal.get(Calendar.SECOND));
+        } else {
+            sbr.append(cal.get(Calendar.SECOND));
+        }
+    }
+
+    private static Calendar parseRfc3164Date(ByteBuffer byteBuffer) {
+        char charFound;
+
+        // Done parsing severity and facility
+        // <169>Oct 22 10:52:01 TZ-6 scapegoat.dmz.example.org 10.1.2.3
+        // sched[0]: That's All Folks!
+        // Need to parse the date.
+
+        /**
+         * The TIMESTAMP field is the local time and is in the format of
+         * "Mmm dd hh:mm:ss" (without the quote marks) where: Mmm is the English
+         * language abbreviation for the month of the year with the first
+         * character in uppercase and the other two characters in lowercase. The
+         * following are the only acceptable values: Jan, Feb, Mar, Apr, May,
+         * Jun, Jul, Aug, Sep, Oct, Nov, Dec dd is the day of the month. If the
+         * day of the month is less than 10, then it MUST be represented as a
+         * space and then the number. For example, the 7th day of August would
+         * be represented as "Aug  7", with two spaces between the "g" and the
+         * "7". hh:mm:ss is the local time. The hour (hh) is represented in a
+         * 24-hour format. Valid entries are between 00 and 23, inclusive. The
+         * minute (mm) and second (ss) entries are between 00 and 59 inclusive.
+         */
+
+        char[] month = new char[3];
+        for (int i = 0; i < 3; i++) {
+            month[i] = (char)(byteBuffer.get() & 0xff);
+        }
+        charFound = (char)byteBuffer.get();
+        if (charFound != ' ') {
+            // Invalid Message - missing mandatory space.
+            LOG.error("Invalid syslog message, missing a mandatory space after month");
+        }
+        charFound = (char)(byteBuffer.get() & 0xff);
+
+        int day = 0;
+        if (charFound == ' ') {
+            // Extra space for the day - this is okay.
+            // Just ignored per the spec.
+        } else {
+            day *= 10;
+            day += Character.digit(charFound, 10);
+        }
+
+        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+            day *= 10;
+            day += Character.digit(charFound, 10);
+        }
+
+        int hour = 0;
+        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+            hour *= 10;
+            hour += Character.digit(charFound, 10);
+        }
+
+        int minute = 0;
+        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+            minute *= 10;
+            minute += Character.digit(charFound, 10);
+        }
+
+        int second = 0;
+        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+            second *= 10;
+            second += Character.digit(charFound, 10);
+        }
+
+        Calendar calendar = new GregorianCalendar();
+        calendar.set(Calendar.MONTH, monthValueMap.get(String.valueOf(month).toLowerCase()).ordinal());
+        calendar.set(Calendar.DAY_OF_MONTH, day);
+        calendar.set(Calendar.HOUR_OF_DAY, hour);
+        calendar.set(Calendar.MINUTE, minute);
+        calendar.set(Calendar.SECOND, second);
+
+        return calendar;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
new file mode 100644
index 0000000..3fd0192
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.util.ExchangeHelper;
+
+public class SyslogDataFormat implements DataFormat {
+    @Override
+    public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
+        SyslogMessage message = ExchangeHelper.convertToMandatoryType(exchange, SyslogMessage.class, body);
+        stream.write(SyslogConverter.toString(message).getBytes());
+    }
+
+    @Override
+    public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
+
+        String body = ExchangeHelper.convertToMandatoryType(exchange, String.class, inputStream);
+        SyslogMessage message = SyslogConverter.parseMessage(body.getBytes());
+
+        exchange.getOut().setHeader(SyslogConstants.SYSLOG_FACILITY, message.getFacility());
+        exchange.getOut().setHeader(SyslogConstants.SYSLOG_SEVERITY, message.getSeverity());
+        exchange.getOut().setHeader(SyslogConstants.SYSLOG_HOSTNAME, message.getHostname());
+        exchange.getOut().setHeader(SyslogConstants.SYSLOG_TIMESTAMP, message.getTimestamp());
+
+        // Since we are behind the fact of being in an Endpoint...
+        // We need to pull in the remote/local via either Mina or Netty.
+
+        if (exchange.getIn().getHeader("CamelMinaLocalAddress") != null) {
+            message.setLocalAddress(exchange.getIn().getHeader("CamelMinaLocalAddress", String.class));
+            exchange.getOut().setHeader(SyslogConstants.SYSLOG_LOCAL_ADDRESS, message.getLocalAddress());
+        }
+
+        if (exchange.getIn().getHeader("CamelMinaRemoteAddress") != null) {
+            message.setRemoteAddress(exchange.getIn().getHeader("CamelMinaRemoteAddress", String.class));
+            exchange.getOut().setHeader(SyslogConstants.SYSLOG_REMOTE_ADDRESS, message.getRemoteAddress());
+        }
+
+        if (exchange.getIn().getHeader("CamelNettyLocalAddress") != null) {
+            message.setLocalAddress(exchange.getIn().getHeader("CamelNettyLocalAddress", String.class));
+            exchange.getOut().setHeader(SyslogConstants.SYSLOG_LOCAL_ADDRESS, message.getLocalAddress());
+        }
+
+        if (exchange.getIn().getHeader("CamelNettyRemoteAddress") != null) {
+            message.setRemoteAddress(exchange.getIn().getHeader("CamelNettyRemoteAddress", String.class));
+            exchange.getOut().setHeader(SyslogConstants.SYSLOG_REMOTE_ADDRESS, message.getRemoteAddress());
+        }
+
+        return message;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
index 6eba3be..f156bdb 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
@@ -17,7 +17,7 @@
 
 package org.apache.camel.component.syslog;
 
-import java.util.Date;
+import java.util.Calendar;
 
 public class SyslogMessage {
 
@@ -28,7 +28,7 @@ public class SyslogMessage {
     private String hostname;
     private String logMessage;
 
-    private Date timestamp;
+    private Calendar timestamp;
 
     public String getLogMessage() {
         return logMessage;
@@ -54,11 +54,11 @@ public class SyslogMessage {
         this.facility = facility;
     }
 
-    public Date getTimestamp() {
+    public Calendar getTimestamp() {
         return timestamp;
     }
 
-    public void setTimestamp(Date timestamp) {
+    public void setTimestamp(Calendar timestamp) {
         this.timestamp = timestamp;
     }
 
@@ -88,7 +88,7 @@ public class SyslogMessage {
 
     @Override
     public String toString() {
-        return "SyslogMessage{" + "content='" + logMessage + '\'' + ", facility=" + facility + ", severity=" + severity + ", remoteAddress='"
-               + remoteAddress + '\'' + ", localAddress='" + localAddress + '\'' + ", hostname='" + hostname + '\'' + ", messageTime=" + timestamp + '}';
+        return "SyslogMessage{" + "content='" + logMessage + '\'' + ", facility=" + facility + ", severity=" + severity + ", remoteAddress='" + remoteAddress + '\''
+               + ", localAddress='" + localAddress + '\'' + ", hostname='" + hostname + '\'' + ", messageTime=" + timestamp + '}';
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java
new file mode 100644
index 0000000..7dce437
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java
@@ -0,0 +1,38 @@
+/**
+ * 
+ */
+package org.apache.camel.component.syslog.netty;
+
+import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer;
+
+import java.nio.charset.Charset;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
+
+/**
+ * @author svenrienstra
+ */
+@Sharable
+public class Rfc5426Encoder extends OneToOneEncoder {
+
+    @Override
+    protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
+        if (!(msg instanceof ChannelBuffer)) {
+            return msg;
+        }
+
+        ChannelBuffer src = (ChannelBuffer)msg;
+        int length = src.readableBytes();
+
+        String headerString = length + " ";
+
+        ChannelBuffer header = channel.getConfig().getBufferFactory().getBuffer(src.order(), headerString.getBytes(Charset.forName("UTF8")).length);
+        header.writeBytes(headerString.getBytes(Charset.forName("UTF8")));
+
+        return wrappedBuffer(header, src);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java
new file mode 100644
index 0000000..e3bbf10
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java
@@ -0,0 +1,100 @@
+/**
+ * 
+ */
+package org.apache.camel.component.syslog.netty;
+
+import org.apache.camel.component.netty.ChannelHandlerFactory;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.frame.FrameDecoder;
+
+/**
+ * @author svenrienstra
+ */
+public class Rfc5426FrameDecoder extends FrameDecoder implements ChannelHandlerFactory {
+
+    private Integer currentFramelength;
+
+    /**
+     * @see org.jboss.netty.handler.codec.frame.FrameDecoder#decode(org.jboss.netty.channel.ChannelHandlerContext,
+     *      org.jboss.netty.channel.Channel,
+     *      org.jboss.netty.buffer.ChannelBuffer)
+     */
+    @Override
+    protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
+        if (currentFramelength == null) {
+            // find index of the first space, it should be after the length
+            // field
+            int index = indexOf(buffer, ChannelBuffers.wrappedBuffer(new byte[] {' '}));
+
+            // Read part until the first space, if we have found one
+            StringBuffer lengthbuffer = new StringBuffer();
+            if (index > -1) {
+                lengthbuffer.append(new String(buffer.readBytes(index).array()));
+            }
+
+            int length;
+            try {
+                // add one because we have to take in account the space after
+                // the length field
+                length = Integer.parseInt(lengthbuffer.toString()) + 1;
+            } catch (NumberFormatException e) {
+                length = -1;
+            }
+
+            // We have not found the length field, reset the buffer so we can
+            // retry next time
+            if (length < 0) {
+                buffer.resetReaderIndex();
+                return null;
+            }
+            currentFramelength = length;
+        }
+
+        // Buffer does not contain enough data yet, wait until it does
+        if (buffer.readableBytes() < currentFramelength) {
+            return null;
+        }
+
+        // read the message
+        int lengthToRead = currentFramelength;
+        currentFramelength = null;
+        return buffer.readBytes(lengthToRead);
+    }
+
+    /**
+     * Borrowed from the DelimiterBasedFrameDecoder Returns the number of bytes
+     * between the readerIndex of the haystack and the first needle found in the
+     * haystack. -1 is returned if no needle is found in the haystack.
+     */
+    private static int indexOf(ChannelBuffer haystack, ChannelBuffer needle) {
+        for (int i = haystack.readerIndex(); i < haystack.writerIndex(); i++) {
+            int haystackIndex = i;
+            int needleIndex;
+            for (needleIndex = 0; needleIndex < needle.capacity(); needleIndex++) {
+                if (haystack.getByte(haystackIndex) != needle.getByte(needleIndex)) {
+                    break;
+                } else {
+                    haystackIndex++;
+                    if (haystackIndex == haystack.writerIndex() && needleIndex != needle.capacity() - 1) {
+                        return -1;
+                    }
+                }
+            }
+
+            if (needleIndex == needle.capacity()) {
+                // Found the needle from the haystack!
+                return i - haystack.readerIndex();
+            }
+        }
+        return -1;
+    }
+
+    @Override
+    public ChannelHandler newChannelHandler() {
+        return new Rfc5426FrameDecoder();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/TypeConverter b/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
index 2ce7fd2..6b23066 100644
--- a/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
+++ b/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/TypeConverter
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.camel.component.syslog.Rfc3164SyslogConverter
\ No newline at end of file
+org.apache.camel.component.syslog.SyslogConverter
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/dataformat/syslog
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/dataformat/syslog b/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/dataformat/syslog
index 213aa5d..808fa12 100644
--- a/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/dataformat/syslog
+++ b/components/camel-syslog/src/main/resources/META-INF/services/org/apache/camel/dataformat/syslog
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-class=org.apache.camel.component.syslog.Rfc3164SyslogDataFormat
\ No newline at end of file
+class=org.apache.camel.component.syslog.SyslogDataFormat
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
index fb32e55..6a1f897 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
@@ -35,30 +35,35 @@ public class AutomatedConversionTest extends CamelTestSupport {
 
     private static int serverPort;
     private final int messageCount = 1;
-    private final String message =
-        "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
-            + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
+    private final String rfc3164Message = "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
+                                          + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
+    private final String rfc5424Message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
 
     @BeforeClass
     public static void initPort() {
         serverPort = AvailablePortFinder.getNextAvailable();
     }
-    
+
     @Test
     public void testSendingRawUDP() throws IOException, InterruptedException {
 
         MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
         MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
-        mock.expectedMessageCount(1);
-        mock2.expectedMessageCount(1);
-        mock2.expectedBodiesReceived(message);
-        
+        mock.expectedMessageCount(2);
+        mock2.expectedMessageCount(2);
+        mock2.expectedBodiesReceived(rfc3164Message, rfc5424Message);
 
         DatagramSocket socket = new DatagramSocket();
         try {
             InetAddress address = InetAddress.getByName("127.0.0.1");
             for (int i = 0; i < messageCount; i++) {
-                byte[] data = message.getBytes();
+                byte[] data = rfc3164Message.getBytes();
+                DatagramPacket packet = new DatagramPacket(data, data.length, address, serverPort);
+                socket.send(packet);
+                Thread.sleep(100);
+            }
+            for (int i = 0; i < messageCount; i++) {
+                byte[] data = rfc5424Message.getBytes();
                 DatagramPacket packet = new DatagramPacket(data, data.length, address, serverPort);
                 socket.send(packet);
                 Thread.sleep(100);
@@ -73,14 +78,15 @@ public class AutomatedConversionTest extends CamelTestSupport {
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
+            @Override
             public void configure() throws Exception {
-                // we setup a Syslog  listener on a random port.
+                // we setup a Syslog listener on a random port.
                 from("mina:udp://127.0.0.1:" + serverPort).unmarshal().syslog().process(new Processor() {
+                    @Override
                     public void process(Exchange ex) {
                         assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
                     }
-                }).to("mock:syslogReceiver").
-                    marshal().syslog().to("mock:syslogReceiver2");
+                }).to("mock:syslogReceiver").marshal().syslog().to("mock:syslogReceiver2");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
index 1dcdded..dc79f22 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
@@ -77,7 +77,7 @@ public class MinaDataFormatTest extends CamelTestSupport {
             public void configure() throws Exception {
 
                 //context.setTracing(true);
-                DataFormat syslogDataFormat = new Rfc3164SyslogDataFormat();
+                DataFormat syslogDataFormat = new SyslogDataFormat();
 
                 // we setup a Syslog  listener on a random port.
                 from("mina:udp://127.0.0.1:" + serverPort).unmarshal(syslogDataFormat).process(new Processor() {

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
index 45c8ebb..90e7b69 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
@@ -74,7 +74,7 @@ public class MinaManyUDPMessagesTest extends CamelTestSupport {
             public void configure() throws Exception {
 
                 //context.setTracing(true);
-                DataFormat syslogDataFormat = new Rfc3164SyslogDataFormat();
+                DataFormat syslogDataFormat = new SyslogDataFormat();
 
                 // we setup a Syslog  listener on a random port.
                 from("mina:udp://127.0.0.1:" + serverPort).unmarshal(syslogDataFormat).process(new Processor() {

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
index 7488898..398efc5 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
@@ -77,7 +77,7 @@ public class NettyDataFormatTest extends CamelTestSupport {
             public void configure() throws Exception {
 
                 context.setTracing(true);
-                DataFormat syslogDataFormat = new Rfc3164SyslogDataFormat();
+                DataFormat syslogDataFormat = new SyslogDataFormat();
 
                 // we setup a Syslog  listener on a random port.
                 from("netty:udp://127.0.0.1:" + serverPort + "?sync=false&allowDefaultCodec=false").unmarshal(syslogDataFormat)

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
index fbbbcf8..5fcb8cf 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
@@ -74,7 +74,7 @@ public class NettyManyUDPMessagesTest extends CamelTestSupport {
             public void configure() throws Exception {
 
                 //context.setTracing(true);
-                DataFormat syslogDataFormat = new Rfc3164SyslogDataFormat();
+                DataFormat syslogDataFormat = new SyslogDataFormat();
 
                 // we setup a Syslog  listener on a random port.
                 from("netty:udp://127.0.0.1:" + serverPort + "?sync=false&allowDefaultCodec=false").unmarshal(syslogDataFormat)

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
new file mode 100644
index 0000000..5f029a3
--- /dev/null
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.syslog.netty.Rfc5426Encoder;
+import org.apache.camel.component.syslog.netty.Rfc5426FrameDecoder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NettyRfc5426LongMessageTest extends CamelTestSupport {
+
+    private static String uri;
+    private static int serverPort;
+    private final String message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - Lorem ipsum dolor sit amet, tempor democritum vix ad, est partiendo laboramus ei. Munere laudem commune vis ad, et qui altera singulis. Ut assum deleniti sit, vix constituto assueverit appellantur at, et meis voluptua usu. Quem imperdiet in ius, mei ex dictas mandamus, ut pri tation appetere oportere. Et est harum dictas. \n Omnis quaestio mel te, ex duo autem molestie. Ei sed dico minim, nominavi facilisis evertitur quo an, te adipiscing contentiones his. Cum partem deseruisse at, ne iuvaret mediocritatem pro. Ex prima utinam convenire usu, volumus legendos nec et, natum putant quo ne. Invidunt necessitatibus at ius, ne eum wisi dicat mediocrem. \n Cu usu odio labores sententiae. Ex eos duis singulis necessitatibus, dico omittam vix at. Sit iudico option detracto an, sit no modus exerci oportere. Vix dicta munere at, no vis feugiat omnesque convenire. Duo at quod illum dolor, nec am
 et tantas iisque no, mei quod graece volutpat ea.\n Ornatus legendos theophrastus id mei. Cum alia assum abhorreant et, nam indoctum intellegebat ei. Unum constituto quo cu. Vero tritani sit ei, ea commodo menandri usu, ponderum hendrerit voluptatibus sed te. \n Semper aliquid fabulas ei mel. Vix ei nullam malorum bonorum, movet nemore scaevola cu vel. Quo ut esse dictas incorrupte, ex denique splendide nec, mei dicit doming omnium no. Nulla putent nec id, vis vide ignota eligendi in.";
+
+    @BeforeClass
+    public static void initPort() {
+        serverPort = AvailablePortFinder.getNextAvailable();
+        uri = "netty:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("decoder", new Rfc5426FrameDecoder());
+        jndi.bind("encoder", new Rfc5426Encoder());
+        return jndi;
+    }
+
+    @Test
+    public void testSendingCamel() throws Exception {
+
+        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
+        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
+        mock.expectedMessageCount(1);
+        mock2.expectedMessageCount(1);
+        mock2.expectedBodiesReceived(message);
+
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(message.getBytes("UTF8")));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5426FrameDecoder());
+
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setTracing(true);
+                DataFormat syslogDataFormat = new SyslogDataFormat();
+
+                // we setup a Syslog listener on a random port.
+                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
+                    @Override
+                    public void process(Exchange ex) {
+                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
+                    }
+                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
new file mode 100644
index 0000000..179988c
--- /dev/null
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.syslog.netty.Rfc5426Encoder;
+import org.apache.camel.component.syslog.netty.Rfc5426FrameDecoder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NettyRfc5426Test extends CamelTestSupport {
+
+    private static String uri;
+    private static int serverPort;
+    private final String rfc3164Message = "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
+                                          + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
+    private final String rfc5424Message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
+
+    @BeforeClass
+    public static void initPort() {
+        serverPort = AvailablePortFinder.getNextAvailable();
+        uri = "netty:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("decoder", new Rfc5426FrameDecoder());
+        jndi.bind("encoder", new Rfc5426Encoder());
+        return jndi;
+    }
+
+    @Test
+    public void testSendingCamel() throws Exception {
+
+        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
+        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
+        mock.expectedMessageCount(2);
+        mock2.expectedMessageCount(2);
+        mock2.expectedBodiesReceived(rfc3164Message, rfc5424Message);
+
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc3164Message.getBytes("UTF8")));
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc5424Message.getBytes("UTF8")));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5426FrameDecoder());
+
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setTracing(true);
+                DataFormat syslogDataFormat = new SyslogDataFormat();
+
+                // we setup a Syslog listener on a random port.
+                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
+                    @Override
+                    public void process(Exchange ex) {
+                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
+                    }
+                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/372ab5b5/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
index 3dff15f..0c612e6 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
@@ -42,7 +42,7 @@ public class SyslogSpringMinaTest extends CamelSpringTestSupport {
         serverPort = AvailablePortFinder.getNextAvailable(3000);
         System.setProperty("server-port", new Integer(serverPort).toString());
     }
-    
+
     @Override
     protected AbstractXmlApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext("org/apache/camel/component/syslog/applicationContext-Mina.xml");


[6/6] git commit: CAMEL-7788: Support for rfc 5424/5425/6587 in syslog component

Posted by da...@apache.org.
CAMEL-7788: Support for rfc 5424/5425/6587 in syslog component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/808b0176
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/808b0176
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/808b0176

Branch: refs/heads/master
Commit: 808b0176ee9ba0309a7cb25594000c12a62bfc56
Parents: b293ac1
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Sep 7 09:14:54 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Sep 7 09:22:34 2014 +0200

----------------------------------------------------------------------
 .../org/apache/camel/component/syslog/SyslogDataFormat.java    | 2 +-
 .../java/org/apache/camel/itest/osgi/syslog/SyslogTest.java    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/808b0176/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
index 782c89a..cdc2146 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
@@ -24,6 +24,7 @@ import org.apache.camel.spi.DataFormat;
 import org.apache.camel.util.ExchangeHelper;
 
 public class SyslogDataFormat implements DataFormat {
+
     @Override
     public void marshal(Exchange exchange, Object body, OutputStream stream) throws Exception {
         SyslogMessage message = ExchangeHelper.convertToMandatoryType(exchange, SyslogMessage.class, body);
@@ -32,7 +33,6 @@ public class SyslogDataFormat implements DataFormat {
 
     @Override
     public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
-
         String body = ExchangeHelper.convertToMandatoryType(exchange, String.class, inputStream);
         SyslogMessage message = SyslogConverter.parseMessage(body.getBytes());
 

http://git-wip-us.apache.org/repos/asf/camel/blob/808b0176/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
index ae0b606..37ebec8 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/syslog/SyslogTest.java
@@ -26,7 +26,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.syslog.Rfc3164SyslogDataFormat;
+import org.apache.camel.component.syslog.SyslogDataFormat;
 import org.apache.camel.component.syslog.SyslogMessage;
 import org.apache.camel.itest.osgi.OSGiIntegrationTestSupport;
 import org.apache.camel.spi.DataFormat;
@@ -80,7 +80,7 @@ public class SyslogTest extends OSGiIntegrationTestSupport {
             public void configure() throws Exception {
 
                 //context.setTracing(true);
-                DataFormat syslogDataFormat = new Rfc3164SyslogDataFormat();
+                DataFormat syslogDataFormat = new SyslogDataFormat();
 
                 // we setup a Syslog  listener on a random port.
                 from("mina:udp://127.0.0.1:" + serverPort).unmarshal(syslogDataFormat).process(new Processor() {
@@ -98,7 +98,7 @@ public class SyslogTest extends OSGiIntegrationTestSupport {
         Option[] options = combine(
             getDefaultCamelKarafOptions(),
             // using the features to install the other camel components             
-            loadCamelFeatures("camel-mina", "camel-syslog"));
+            loadCamelFeatures("camel-mina", "camel-netty", "camel-syslog"));
         
         return options;
     }


[5/6] git commit: CAMEL-7788: Support for rfc 5424/5425/6587 in syslog component

Posted by da...@apache.org.
CAMEL-7788: Support for rfc 5424/5425/6587 in syslog component


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b293ac1a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b293ac1a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b293ac1a

Branch: refs/heads/master
Commit: b293ac1acfbe03127d27a2a29f07f6dc9c1e72ba
Parents: ad51b20
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Sep 7 09:14:12 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Sep 7 09:14:12 2014 +0200

----------------------------------------------------------------------
 components/camel-syslog/pom.xml                 | 105 ++++++++++---------
 .../component/syslog/Rfc5424SyslogMessage.java  |  34 +++---
 .../camel/component/syslog/SyslogConstants.java |   2 +-
 .../camel/component/syslog/SyslogConverter.java |  55 +++++-----
 .../component/syslog/SyslogDataFormat.java      |   1 -
 .../camel/component/syslog/SyslogFacility.java  |   1 -
 .../camel/component/syslog/SyslogMessage.java   |   3 +-
 .../camel/component/syslog/SyslogSeverity.java  |   1 -
 .../component/syslog/netty/Rfc5425Encoder.java  |  11 +-
 .../syslog/netty/Rfc5425FrameDecoder.java       |  15 +--
 .../syslog/AutomatedConversionTest.java         |   1 -
 .../component/syslog/MinaDataFormatTest.java    |   1 -
 .../syslog/MinaManyUDPMessagesTest.java         |   1 -
 .../component/syslog/NettyDataFormatTest.java   |   1 -
 .../syslog/NettyManyUDPMessagesTest.java        |   1 -
 .../syslog/NettyRfc5425LongMessageTest.java     |   1 -
 .../component/syslog/NettyRfc5425Test.java      |   1 -
 .../camel/component/syslog/SyslogEnumsTest.java |   1 -
 .../component/syslog/SyslogSpringMinaTest.java  |   1 -
 .../component/syslog/SyslogSpringNettyTest.java |   1 -
 .../src/test/resources/log4j.properties         |   2 +-
 .../syslog/applicationContext-Mina.xml          |  64 +++++------
 .../syslog/applicationContext-Netty.xml         |  32 +++---
 .../features/src/main/resources/features.xml    |   1 +
 24 files changed, 153 insertions(+), 184 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-syslog/pom.xml b/components/camel-syslog/pom.xml
index a4014ae..7fac85a 100644
--- a/components/camel-syslog/pom.xml
+++ b/components/camel-syslog/pom.xml
@@ -15,62 +15,63 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.camel</groupId>
-        <artifactId>components</artifactId>
-        <version>2.14-SNAPSHOT</version>
-    </parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>components</artifactId>
+    <version>2.14-SNAPSHOT</version>
+  </parent>
 
-    <artifactId>camel-syslog</artifactId>
-    <packaging>bundle</packaging>
-    <name>Camel :: Syslog</name>
-    <description>Camel Syslog support</description>
+  <artifactId>camel-syslog</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Syslog</name>
+  <description>Camel Syslog support</description>
 
-    <properties>
-        <camel.osgi.export.pkg>org.apache.camel.component.syslog.*</camel.osgi.export.pkg>
-        <camel.osgi.export.service>org.apache.camel.spi.DataFormatResolver;dataformat=syslog</camel.osgi.export.service>
-    </properties>
+  <properties>
+    <camel.osgi.export.pkg>org.apache.camel.component.syslog.*</camel.osgi.export.pkg>
+    <camel.osgi.export.service>org.apache.camel.spi.DataFormatResolver;dataformat=syslog</camel.osgi.export.service>
+  </properties>
 
-    <dependencies>
+  <dependencies>
 
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-core</artifactId>
-        </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
 
-        <!-- test dependencies -->
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-test-spring</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-mina</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-netty</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>test</scope>
-        </dependency>
-         <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-test</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-netty</artifactId>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-mina</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
index c9da66c..d52b471 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/Rfc5424SyslogMessage.java
@@ -1,12 +1,8 @@
 /**
- * 
+ *
  */
 package org.apache.camel.component.syslog;
 
-/**
- * @author svenrienstra
- * 
- */
 public class Rfc5424SyslogMessage extends SyslogMessage {
     private String appName = "-";
     private String procId = "-";
@@ -17,60 +13,56 @@ public class Rfc5424SyslogMessage extends SyslogMessage {
      * @return the appName
      */
     public String getAppName() {
-	return appName;
+        return appName;
     }
 
     /**
-     * @param appName
-     *            the appName to set
+     * @param appName the appName to set
      */
     public void setAppName(String appName) {
-	this.appName = appName;
+        this.appName = appName;
     }
 
     /**
      * @return the procId
      */
     public String getProcId() {
-	return procId;
+        return procId;
     }
 
     /**
-     * @param procId
-     *            the procId to set
+     * @param procId the procId to set
      */
     public void setProcId(String procId) {
-	this.procId = procId;
+        this.procId = procId;
     }
 
     /**
      * @return the msgId
      */
     public String getMsgId() {
-	return msgId;
+        return msgId;
     }
 
     /**
-     * @param msgId
-     *            the msgId to set
+     * @param msgId the msgId to set
      */
     public void setMsgId(String msgId) {
-	this.msgId = msgId;
+        this.msgId = msgId;
     }
 
     /**
      * @return the structuredData
      */
     public String getStructuredData() {
-	return structuredData;
+        return structuredData;
     }
 
     /**
-     * @param structuredData
-     *            the structuredData to set
+     * @param structuredData the structuredData to set
      */
     public void setStructuredData(String structuredData) {
-	this.structuredData = structuredData;
+        this.structuredData = structuredData;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConstants.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConstants.java
index c43b937..0162a2a 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConstants.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConstants.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 public final class SyslogConstants {
@@ -23,6 +22,7 @@ public final class SyslogConstants {
      * The socket address of local machine that received the message.
      */
     public static final String SYSLOG_LOCAL_ADDRESS = "CamelSyslogLocalAddress";
+
     /**
      * The socket address of the remote machine that send the message.
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
index b4e86f7..ea91800 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.net.InetAddress;
@@ -24,7 +23,6 @@ import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.Map;
-
 import javax.xml.bind.DatatypeConverter;
 
 import org.apache.camel.Converter;
@@ -42,6 +40,7 @@ public final class SyslogConverter {
 
     private static Map<String, MONTHS> monthValueMap = new HashMap<String, MONTHS>() {
         private static final long serialVersionUID = 1L;
+
         {
             put("jan", MONTHS.jan);
             put("feb", MONTHS.feb);
@@ -107,7 +106,7 @@ public final class SyslogConverter {
         sbr.append(" ");
 
         if (isRfc5424) {
-            Rfc5424SyslogMessage rfc5424SyslogMessage = (Rfc5424SyslogMessage)message;
+            Rfc5424SyslogMessage rfc5424SyslogMessage = (Rfc5424SyslogMessage) message;
 
             sbr.append(rfc5424SyslogMessage.getAppName());
             sbr.append(" ");
@@ -137,20 +136,20 @@ public final class SyslogConverter {
         byteBuffer.put(bytes);
         byteBuffer.rewind();
 
-        Character charFound = (char)byteBuffer.get();
+        Character charFound = (char) byteBuffer.get();
 
         SyslogFacility foundFacility = null;
         SyslogSeverity foundSeverity = null;
 
         while (charFound != '<') {
             // Ignore noise in beginning of message.
-            charFound = (char)byteBuffer.get();
+            charFound = (char) byteBuffer.get();
         }
         char priChar = 0;
         if (charFound == '<') {
             int facility = 0;
 
-            while (Character.isDigit(priChar = (char)(byteBuffer.get() & 0xff))) {
+            while (Character.isDigit(priChar = (char) (byteBuffer.get() & 0xff))) {
                 facility *= 10;
                 facility += Character.digit(priChar, 10);
             }
@@ -166,7 +165,7 @@ public final class SyslogConverter {
         SyslogMessage syslogMessage = new SyslogMessage();
         boolean isRfc5424 = false;
         // Read next character
-        charFound = (char)byteBuffer.get();
+        charFound = (char) byteBuffer.get();
         // If next character is a 1, we have probably found an rfc 5424 message
         // message
         if (charFound == '1') {
@@ -185,14 +184,14 @@ public final class SyslogConverter {
             syslogMessage.setTimestamp(parseRfc3164Date(byteBuffer));
         } else {
 
-            charFound = (char)byteBuffer.get();
+            charFound = (char) byteBuffer.get();
             if (charFound != ' ') {
                 LOG.error("Invalid syslog message, missing a mandatory space after version");
             }
 
             // This should be the timestamp
             StringBuilder date = new StringBuilder();
-            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                 date.append(charFound);
             }
 
@@ -202,34 +201,34 @@ public final class SyslogConverter {
         // The host is the char sequence until the next ' '
 
         StringBuilder host = new StringBuilder();
-        while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+        while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
             host.append(charFound);
         }
 
         syslogMessage.setHostname(host.toString());
 
         if (isRfc5424) {
-            Rfc5424SyslogMessage rfc5424SyslogMessage = (Rfc5424SyslogMessage)syslogMessage;
+            Rfc5424SyslogMessage rfc5424SyslogMessage = (Rfc5424SyslogMessage) syslogMessage;
             StringBuilder appName = new StringBuilder();
-            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                 appName.append(charFound);
             }
             rfc5424SyslogMessage.setAppName(appName.toString());
 
             StringBuilder procId = new StringBuilder();
-            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                 procId.append(charFound);
             }
             rfc5424SyslogMessage.setProcId(procId.toString());
 
             StringBuilder msgId = new StringBuilder();
-            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                 msgId.append(charFound);
             }
             rfc5424SyslogMessage.setMsgId(msgId.toString());
 
             StringBuilder structuredData = new StringBuilder();
-            while ((charFound = (char)(byteBuffer.get() & 0xff)) != ' ') {
+            while ((charFound = (char) (byteBuffer.get() & 0xff)) != ' ') {
                 structuredData.append(charFound);
             }
             rfc5424SyslogMessage.setStructuredData(structuredData.toString());
@@ -237,7 +236,7 @@ public final class SyslogConverter {
 
         StringBuilder msg = new StringBuilder();
         while (byteBuffer.hasRemaining()) {
-            charFound = (char)(byteBuffer.get() & 0xff);
+            charFound = (char) (byteBuffer.get() & 0xff);
             msg.append(charFound);
         }
 
@@ -253,12 +252,12 @@ public final class SyslogConverter {
         Calendar cal = message.getTimestamp();
 
         String firstLetter = MONTHS.values()[cal.get(Calendar.MONTH)].toString().substring(0, 1); // Get
-                                                                                                  // first
-                                                                                                  // letter
+        // first
+        // letter
         String remainder = MONTHS.values()[cal.get(Calendar.MONTH)].toString().substring(1); // Get
-                                                                                             // remainder
-                                                                                             // of
-                                                                                             // word.
+        // remainder
+        // of
+        // word.
         String capitalized = firstLetter.toUpperCase() + remainder.toLowerCase();
 
         sbr.append(capitalized);
@@ -318,14 +317,14 @@ public final class SyslogConverter {
 
         char[] month = new char[3];
         for (int i = 0; i < 3; i++) {
-            month[i] = (char)(byteBuffer.get() & 0xff);
+            month[i] = (char) (byteBuffer.get() & 0xff);
         }
-        charFound = (char)byteBuffer.get();
+        charFound = (char) byteBuffer.get();
         if (charFound != ' ') {
             // Invalid Message - missing mandatory space.
             LOG.error("Invalid syslog message, missing a mandatory space after month");
         }
-        charFound = (char)(byteBuffer.get() & 0xff);
+        charFound = (char) (byteBuffer.get() & 0xff);
 
         int day = 0;
         if (charFound == ' ') {
@@ -336,25 +335,25 @@ public final class SyslogConverter {
             day += Character.digit(charFound, 10);
         }
 
-        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
             day *= 10;
             day += Character.digit(charFound, 10);
         }
 
         int hour = 0;
-        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
             hour *= 10;
             hour += Character.digit(charFound, 10);
         }
 
         int minute = 0;
-        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
             minute *= 10;
             minute += Character.digit(charFound, 10);
         }
 
         int second = 0;
-        while (Character.isDigit(charFound = (char)(byteBuffer.get() & 0xff))) {
+        while (Character.isDigit(charFound = (char) (byteBuffer.get() & 0xff))) {
             second *= 10;
             second += Character.digit(charFound, 10);
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
index 3fd0192..782c89a 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.io.InputStream;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogFacility.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogFacility.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogFacility.java
index 5dbf961..08b98e6 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogFacility.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogFacility.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 public enum SyslogFacility {

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
index f156bdb..ad82bfc 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogMessage.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.util.Calendar;
@@ -89,6 +88,6 @@ public class SyslogMessage {
     @Override
     public String toString() {
         return "SyslogMessage{" + "content='" + logMessage + '\'' + ", facility=" + facility + ", severity=" + severity + ", remoteAddress='" + remoteAddress + '\''
-               + ", localAddress='" + localAddress + '\'' + ", hostname='" + hostname + '\'' + ", messageTime=" + timestamp + '}';
+                + ", localAddress='" + localAddress + '\'' + ", hostname='" + hostname + '\'' + ", messageTime=" + timestamp + '}';
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogSeverity.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogSeverity.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogSeverity.java
index 0f4842c..68484fa 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogSeverity.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogSeverity.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 public enum SyslogSeverity {

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
index d353725..1d39e51 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
@@ -1,10 +1,8 @@
 /**
- * 
+ *
  */
 package org.apache.camel.component.syslog.netty;
 
-import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer;
-
 import java.nio.charset.Charset;
 
 import org.jboss.netty.buffer.ChannelBuffer;
@@ -13,9 +11,8 @@ import org.jboss.netty.channel.ChannelHandler.Sharable;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
 
-/**
- * @author svenrienstra
- */
+import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer;
+
 @Sharable
 public class Rfc5425Encoder extends OneToOneEncoder {
 
@@ -25,7 +22,7 @@ public class Rfc5425Encoder extends OneToOneEncoder {
             return msg;
         }
 
-        ChannelBuffer src = (ChannelBuffer)msg;
+        ChannelBuffer src = (ChannelBuffer) msg;
         int length = src.readableBytes();
 
         String headerString = length + " ";

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
index 3c7a67a..340b0e0 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package org.apache.camel.component.syslog.netty;
 
@@ -11,24 +11,15 @@ import org.jboss.netty.channel.ChannelHandler;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.handler.codec.frame.FrameDecoder;
 
-/**
- * @author svenrienstra
- */
 public class Rfc5425FrameDecoder extends FrameDecoder implements ChannelHandlerFactory {
 
     private Integer currentFramelength;
 
-    /**
-     * @see org.jboss.netty.handler.codec.frame.FrameDecoder#decode(org.jboss.netty.channel.ChannelHandlerContext,
-     *      org.jboss.netty.channel.Channel,
-     *      org.jboss.netty.buffer.ChannelBuffer)
-     */
     @Override
     protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
         if (currentFramelength == null) {
-            // find index of the first space, it should be after the length
-            // field
-            int index = indexOf(buffer, ChannelBuffers.wrappedBuffer(new byte[] {' '}));
+            // find index of the first space, it should be after the length field
+            int index = indexOf(buffer, ChannelBuffers.wrappedBuffer(new byte[]{' '}));
 
             // Read part until the first space, if we have found one
             StringBuffer lengthbuffer = new StringBuffer();

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
index 6a1f897..6b762d9 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/AutomatedConversionTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
index dc79f22..af43b5a 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaDataFormatTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
index 90e7b69..2990234 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/MinaManyUDPMessagesTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.net.DatagramPacket;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
index 398efc5..81564b7 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyDataFormatTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
index 5fcb8cf..9598d29 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyManyUDPMessagesTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.net.DatagramPacket;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
index 0ef956e..16af90a 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import org.apache.camel.Exchange;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
index e206833..81134b8 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import org.apache.camel.Exchange;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogEnumsTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogEnumsTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogEnumsTest.java
index 98d9ae4..5acf61e 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogEnumsTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogEnumsTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import junit.framework.TestCase;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
index 0c612e6..c8c92c9 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringMinaTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringNettyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringNettyTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringNettyTest.java
index 96cc1ee..906d9cc 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringNettyTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/SyslogSpringNettyTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.component.syslog;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/resources/log4j.properties b/components/camel-syslog/src/test/resources/log4j.properties
index 115b40c..a0427ad 100644
--- a/components/camel-syslog/src/test/resources/log4j.properties
+++ b/components/camel-syslog/src/test/resources/log4j.properties
@@ -20,7 +20,7 @@
 #
 log4j.rootLogger=INFO, file
 
-# debug loging for Camel
+# debug logging for Camel
 #log4j.logger.org.apache.camel.component.syslog=DEBUG
 
 # CONSOLE appender not used by default

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Mina.xml
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Mina.xml b/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Mina.xml
index 31ecec8..68839fd 100644
--- a/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Mina.xml
+++ b/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Mina.xml
@@ -21,44 +21,44 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
-<bean id="propertyConfigurer"
-	class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
-</bean>
+  <bean id="propertyConfigurer"
+        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+  </bean>
 
-    <bean id="myMinaFactory" class="org.apache.camel.component.mina.MinaComponent">
-        <!-- we must provide a camel context so we refer to it by its id -->
-        <constructor-arg index="0" ref="myCamel"/>
-    </bean>
+  <bean id="myMinaFactory" class="org.apache.camel.component.mina.MinaComponent">
+    <!-- we must provide a camel context so we refer to it by its id -->
+    <constructor-arg index="0" ref="myCamel"/>
+  </bean>
 
-    <bean id="minaSyslog"
-          factory-bean="myMinaFactory"
-          factory-method="createEndpoint">
-        <!-- and here we can pass it our configuration -->
-        <constructor-arg index="0" ref="minaSyslogConfig"/>
-    </bean>
+  <bean id="minaSyslog"
+        factory-bean="myMinaFactory"
+        factory-method="createEndpoint">
+    <!-- and here we can pass it our configuration -->
+    <constructor-arg index="0" ref="minaSyslogConfig"/>
+  </bean>
 
-    <!-- this is our mina configuration with plain properties -->
-    <bean id="minaSyslogConfig" class="org.apache.camel.component.mina.MinaConfiguration">
-        <property name="protocol" value="udp"/>
-        <property name="host" value="localhost"/>
-        <property name="port" value="${server-port}"/>
-        <property name="sync" value="false"/>
-    </bean>
+  <!-- this is our mina configuration with plain properties -->
+  <bean id="minaSyslogConfig" class="org.apache.camel.component.mina.MinaConfiguration">
+    <property name="protocol" value="udp"/>
+    <property name="host" value="localhost"/>
+    <property name="port" value="${server-port}"/>
+    <property name="sync" value="false"/>
+  </bean>
 
-    <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
+  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
 
-        <dataFormats>
-            <syslog id="mySyslog"/>
-        </dataFormats>
+    <dataFormats>
+      <syslog id="mySyslog"/>
+    </dataFormats>
 
-        <route>
-            <from ref="minaSyslog"/>
-            <unmarshal ref="mySyslog"/>
-            <to uri="mock:stop1"/>
-            <marshal ref="mySyslog"/>
-            <to uri="mock:stop2"/>
-        </route>
+    <route>
+      <from ref="minaSyslog"/>
+      <unmarshal ref="mySyslog"/>
+      <to uri="mock:stop1"/>
+      <marshal ref="mySyslog"/>
+      <to uri="mock:stop2"/>
+    </route>
 
-    </camelContext>
+  </camelContext>
 
 </beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Netty.xml
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Netty.xml b/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Netty.xml
index 827747b..9b3a624 100644
--- a/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Netty.xml
+++ b/components/camel-syslog/src/test/resources/org/apache/camel/component/syslog/applicationContext-Netty.xml
@@ -22,20 +22,22 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
 
-    <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
-		<propertyPlaceholder id="properties" location="org/apache/camel/component/syslog/camel.properties"/>
-        <dataFormats>
-            <syslog id="mySyslog"/>
-        </dataFormats>
-
-        <route>
-            <from uri="netty:udp://localhost:{{server-port}}?sync=false&amp;allowDefaultCodec=false"/>
-            <unmarshal ref="mySyslog"/>
-            <to uri="mock:stop1"/>
-            <marshal ref="mySyslog"/>
-            <to uri="mock:stop2"/>
-        </route>
-
-    </camelContext>
+  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/spring">
+
+    <propertyPlaceholder id="properties" location="org/apache/camel/component/syslog/camel.properties"/>
+
+    <dataFormats>
+      <syslog id="mySyslog"/>
+    </dataFormats>
+
+    <route>
+      <from uri="netty:udp://localhost:{{server-port}}?sync=false&amp;allowDefaultCodec=false"/>
+      <unmarshal ref="mySyslog"/>
+      <to uri="mock:stop1"/>
+      <marshal ref="mySyslog"/>
+      <to uri="mock:stop2"/>
+    </route>
+
+  </camelContext>
 
 </beans>

http://git-wip-us.apache.org/repos/asf/camel/blob/b293ac1a/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index b65dfba..e530190 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -1260,6 +1260,7 @@
   </feature>
   <feature name='camel-syslog' version='${project.version}' resolver='(obr)' start-level='50'>
     <feature version='${project.version}'>camel-core</feature>
+    <feature version='${project.version}'>camel-netty</feature>
     <bundle>mvn:org.apache.camel/camel-syslog/${project.version}</bundle>
   </feature>
   <feature name='camel-tagsoup' version='${project.version}' resolver='(obr)' start-level='50'>


[4/6] git commit: Merge branch 'master' of https://github.com/svenrienstra/camel

Posted by da...@apache.org.
Merge branch 'master' of https://github.com/svenrienstra/camel


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ad51b204
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ad51b204
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ad51b204

Branch: refs/heads/master
Commit: ad51b2043964bdd6db85e16bbdc6efa43f52277f
Parents: 5db09a8 35eaafc
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Sep 7 09:02:51 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Sep 7 09:02:51 2014 +0200

----------------------------------------------------------------------
 .../syslog/Rfc3164SyslogConverter.java          | 270 --------------
 .../syslog/Rfc3164SyslogDataFormat.java         |  68 ----
 .../component/syslog/Rfc5424SyslogMessage.java  |  76 ++++
 .../camel/component/syslog/SyslogConverter.java | 371 +++++++++++++++++++
 .../component/syslog/SyslogDataFormat.java      |  70 ++++
 .../camel/component/syslog/SyslogMessage.java   |  12 +-
 .../component/syslog/netty/Rfc5425Encoder.java  |  38 ++
 .../syslog/netty/Rfc5425FrameDecoder.java       | 100 +++++
 .../services/org/apache/camel/TypeConverter     |   2 +-
 .../services/org/apache/camel/dataformat/syslog |   2 +-
 .../syslog/AutomatedConversionTest.java         |  30 +-
 .../component/syslog/MinaDataFormatTest.java    |   2 +-
 .../syslog/MinaManyUDPMessagesTest.java         |   2 +-
 .../component/syslog/NettyDataFormatTest.java   |   2 +-
 .../syslog/NettyManyUDPMessagesTest.java        |   2 +-
 .../syslog/NettyRfc5425LongMessageTest.java     |  88 +++++
 .../component/syslog/NettyRfc5425Test.java      |  91 +++++
 .../component/syslog/SyslogSpringMinaTest.java  |   2 +-
 18 files changed, 865 insertions(+), 363 deletions(-)
----------------------------------------------------------------------



[3/6] git commit: Also use the correct rfc number in unit test

Posted by da...@apache.org.
Also use the correct rfc number in unit test


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/35eaafca
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/35eaafca
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/35eaafca

Branch: refs/heads/master
Commit: 35eaafca2d5f1d08e1c268fc6176bd687bc3dd21
Parents: c3663ef
Author: svenrienstra <sv...@topicus.nl>
Authored: Fri May 30 11:34:28 2014 +0200
Committer: svenrienstra <sv...@topicus.nl>
Committed: Fri May 30 11:34:28 2014 +0200

----------------------------------------------------------------------
 .../syslog/NettyRfc5425LongMessageTest.java     | 88 +++++++++++++++++++
 .../component/syslog/NettyRfc5425Test.java      | 91 ++++++++++++++++++++
 .../syslog/NettyRfc5426LongMessageTest.java     | 88 -------------------
 .../component/syslog/NettyRfc5426Test.java      | 91 --------------------
 4 files changed, 179 insertions(+), 179 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
new file mode 100644
index 0000000..0ef956e
--- /dev/null
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425LongMessageTest.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
+import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NettyRfc5425LongMessageTest extends CamelTestSupport {
+
+    private static String uri;
+    private static int serverPort;
+    private final String message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - Lorem ipsum dolor sit amet, tempor democritum vix ad, est partiendo laboramus ei. Munere laudem commune vis ad, et qui altera singulis. Ut assum deleniti sit, vix constituto assueverit appellantur at, et meis voluptua usu. Quem imperdiet in ius, mei ex dictas mandamus, ut pri tation appetere oportere. Et est harum dictas. \n Omnis quaestio mel te, ex duo autem molestie. Ei sed dico minim, nominavi facilisis evertitur quo an, te adipiscing contentiones his. Cum partem deseruisse at, ne iuvaret mediocritatem pro. Ex prima utinam convenire usu, volumus legendos nec et, natum putant quo ne. Invidunt necessitatibus at ius, ne eum wisi dicat mediocrem. \n Cu usu odio labores sententiae. Ex eos duis singulis necessitatibus, dico omittam vix at. Sit iudico option detracto an, sit no modus exerci oportere. Vix dicta munere at, no vis feugiat omnesque convenire. Duo at quod illum dolor, nec am
 et tantas iisque no, mei quod graece volutpat ea.\n Ornatus legendos theophrastus id mei. Cum alia assum abhorreant et, nam indoctum intellegebat ei. Unum constituto quo cu. Vero tritani sit ei, ea commodo menandri usu, ponderum hendrerit voluptatibus sed te. \n Semper aliquid fabulas ei mel. Vix ei nullam malorum bonorum, movet nemore scaevola cu vel. Quo ut esse dictas incorrupte, ex denique splendide nec, mei dicit doming omnium no. Nulla putent nec id, vis vide ignota eligendi in.";
+
+    @BeforeClass
+    public static void initPort() {
+        serverPort = AvailablePortFinder.getNextAvailable();
+        uri = "netty:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("decoder", new Rfc5425FrameDecoder());
+        jndi.bind("encoder", new Rfc5425Encoder());
+        return jndi;
+    }
+
+    @Test
+    public void testSendingCamel() throws Exception {
+
+        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
+        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
+        mock.expectedMessageCount(1);
+        mock2.expectedMessageCount(1);
+        mock2.expectedBodiesReceived(message);
+
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(message.getBytes("UTF8")));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
+
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setTracing(true);
+                DataFormat syslogDataFormat = new SyslogDataFormat();
+
+                // we setup a Syslog listener on a random port.
+                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
+                    @Override
+                    public void process(Exchange ex) {
+                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
+                    }
+                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
new file mode 100644
index 0000000..e206833
--- /dev/null
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5425Test.java
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.syslog;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
+import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class NettyRfc5425Test extends CamelTestSupport {
+
+    private static String uri;
+    private static int serverPort;
+    private final String rfc3164Message = "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
+                                          + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
+    private final String rfc5424Message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
+
+    @BeforeClass
+    public static void initPort() {
+        serverPort = AvailablePortFinder.getNextAvailable();
+        uri = "netty:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
+    }
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        JndiRegistry jndi = super.createRegistry();
+        jndi.bind("decoder", new Rfc5425FrameDecoder());
+        jndi.bind("encoder", new Rfc5425Encoder());
+        return jndi;
+    }
+
+    @Test
+    public void testSendingCamel() throws Exception {
+
+        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
+        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
+        mock.expectedMessageCount(2);
+        mock2.expectedMessageCount(2);
+        mock2.expectedBodiesReceived(rfc3164Message, rfc5424Message);
+
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc3164Message.getBytes("UTF8")));
+        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc5424Message.getBytes("UTF8")));
+
+        assertMockEndpointsSatisfied();
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
+
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                context.setTracing(true);
+                DataFormat syslogDataFormat = new SyslogDataFormat();
+
+                // we setup a Syslog listener on a random port.
+                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
+                    @Override
+                    public void process(Exchange ex) {
+                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
+                    }
+                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
deleted file mode 100644
index 859efdd..0000000
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.syslog;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
-import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class NettyRfc5426LongMessageTest extends CamelTestSupport {
-
-    private static String uri;
-    private static int serverPort;
-    private final String message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - Lorem ipsum dolor sit amet, tempor democritum vix ad, est partiendo laboramus ei. Munere laudem commune vis ad, et qui altera singulis. Ut assum deleniti sit, vix constituto assueverit appellantur at, et meis voluptua usu. Quem imperdiet in ius, mei ex dictas mandamus, ut pri tation appetere oportere. Et est harum dictas. \n Omnis quaestio mel te, ex duo autem molestie. Ei sed dico minim, nominavi facilisis evertitur quo an, te adipiscing contentiones his. Cum partem deseruisse at, ne iuvaret mediocritatem pro. Ex prima utinam convenire usu, volumus legendos nec et, natum putant quo ne. Invidunt necessitatibus at ius, ne eum wisi dicat mediocrem. \n Cu usu odio labores sententiae. Ex eos duis singulis necessitatibus, dico omittam vix at. Sit iudico option detracto an, sit no modus exerci oportere. Vix dicta munere at, no vis feugiat omnesque convenire. Duo at quod illum dolor, nec am
 et tantas iisque no, mei quod graece volutpat ea.\n Ornatus legendos theophrastus id mei. Cum alia assum abhorreant et, nam indoctum intellegebat ei. Unum constituto quo cu. Vero tritani sit ei, ea commodo menandri usu, ponderum hendrerit voluptatibus sed te. \n Semper aliquid fabulas ei mel. Vix ei nullam malorum bonorum, movet nemore scaevola cu vel. Quo ut esse dictas incorrupte, ex denique splendide nec, mei dicit doming omnium no. Nulla putent nec id, vis vide ignota eligendi in.";
-
-    @BeforeClass
-    public static void initPort() {
-        serverPort = AvailablePortFinder.getNextAvailable();
-        uri = "netty:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
-    }
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry jndi = super.createRegistry();
-        jndi.bind("decoder", new Rfc5425FrameDecoder());
-        jndi.bind("encoder", new Rfc5425Encoder());
-        return jndi;
-    }
-
-    @Test
-    public void testSendingCamel() throws Exception {
-
-        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
-        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
-        mock.expectedMessageCount(1);
-        mock2.expectedMessageCount(1);
-        mock2.expectedBodiesReceived(message);
-
-        template.sendBody(uri, new BigEndianHeapChannelBuffer(message.getBytes("UTF8")));
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
-
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                context.setTracing(true);
-                DataFormat syslogDataFormat = new SyslogDataFormat();
-
-                // we setup a Syslog listener on a random port.
-                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
-                    @Override
-                    public void process(Exchange ex) {
-                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
-                    }
-                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/35eaafca/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
deleted file mode 100644
index 22b22bd..0000000
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.camel.component.syslog;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
-import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
-import org.apache.camel.impl.JndiRegistry;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.test.AvailablePortFinder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.jboss.netty.buffer.BigEndianHeapChannelBuffer;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class NettyRfc5426Test extends CamelTestSupport {
-
-    private static String uri;
-    private static int serverPort;
-    private final String rfc3164Message = "<165>Aug  4 05:34:00 mymachine myproc[10]: %% It's\n         time to make the do-nuts.  %%  Ingredients: Mix=OK, Jelly=OK #\n"
-                                          + "         Devices: Mixer=OK, Jelly_Injector=OK, Frier=OK # Transport:\n" + "         Conveyer1=OK, Conveyer2=OK # %%";
-    private final String rfc5424Message = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
-
-    @BeforeClass
-    public static void initPort() {
-        serverPort = AvailablePortFinder.getNextAvailable();
-        uri = "netty:tcp://localhost:" + serverPort + "?sync=false&allowDefaultCodec=false&decoders=#decoder&encoder=#encoder";
-    }
-
-    @Override
-    protected JndiRegistry createRegistry() throws Exception {
-        JndiRegistry jndi = super.createRegistry();
-        jndi.bind("decoder", new Rfc5425FrameDecoder());
-        jndi.bind("encoder", new Rfc5425Encoder());
-        return jndi;
-    }
-
-    @Test
-    public void testSendingCamel() throws Exception {
-
-        MockEndpoint mock = getMockEndpoint("mock:syslogReceiver");
-        MockEndpoint mock2 = getMockEndpoint("mock:syslogReceiver2");
-        mock.expectedMessageCount(2);
-        mock2.expectedMessageCount(2);
-        mock2.expectedBodiesReceived(rfc3164Message, rfc5424Message);
-
-        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc3164Message.getBytes("UTF8")));
-        template.sendBody(uri, new BigEndianHeapChannelBuffer(rfc5424Message.getBytes("UTF8")));
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
-
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                context.setTracing(true);
-                DataFormat syslogDataFormat = new SyslogDataFormat();
-
-                // we setup a Syslog listener on a random port.
-                from(uri).unmarshal(syslogDataFormat).process(new Processor() {
-                    @Override
-                    public void process(Exchange ex) {
-                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
-                    }
-                }).to("mock:syslogReceiver").marshal(syslogDataFormat).to("mock:syslogReceiver2");
-            }
-        };
-    }
-}


[2/6] git commit: Used wrong rfc number

Posted by da...@apache.org.
Used wrong rfc number


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c3663ef6
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c3663ef6
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c3663ef6

Branch: refs/heads/master
Commit: c3663ef6e665daf9595bc35e7b8a532f6a71eaf5
Parents: 372ab5b
Author: svenrienstra <sv...@topicus.nl>
Authored: Fri May 30 11:31:57 2014 +0200
Committer: svenrienstra <sv...@topicus.nl>
Committed: Fri May 30 11:31:57 2014 +0200

----------------------------------------------------------------------
 .../component/syslog/netty/Rfc5425Encoder.java  |  38 +++++++
 .../syslog/netty/Rfc5425FrameDecoder.java       | 100 +++++++++++++++++++
 .../component/syslog/netty/Rfc5426Encoder.java  |  38 -------
 .../syslog/netty/Rfc5426FrameDecoder.java       | 100 -------------------
 .../syslog/NettyRfc5426LongMessageTest.java     |  10 +-
 .../component/syslog/NettyRfc5426Test.java      |  10 +-
 6 files changed, 148 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c3663ef6/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
new file mode 100644
index 0000000..d353725
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425Encoder.java
@@ -0,0 +1,38 @@
+/**
+ * 
+ */
+package org.apache.camel.component.syslog.netty;
+
+import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer;
+
+import java.nio.charset.Charset;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler.Sharable;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
+
+/**
+ * @author svenrienstra
+ */
+@Sharable
+public class Rfc5425Encoder extends OneToOneEncoder {
+
+    @Override
+    protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
+        if (!(msg instanceof ChannelBuffer)) {
+            return msg;
+        }
+
+        ChannelBuffer src = (ChannelBuffer)msg;
+        int length = src.readableBytes();
+
+        String headerString = length + " ";
+
+        ChannelBuffer header = channel.getConfig().getBufferFactory().getBuffer(src.order(), headerString.getBytes(Charset.forName("UTF8")).length);
+        header.writeBytes(headerString.getBytes(Charset.forName("UTF8")));
+
+        return wrappedBuffer(header, src);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c3663ef6/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
new file mode 100644
index 0000000..3c7a67a
--- /dev/null
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5425FrameDecoder.java
@@ -0,0 +1,100 @@
+/**
+ * 
+ */
+package org.apache.camel.component.syslog.netty;
+
+import org.apache.camel.component.netty.ChannelHandlerFactory;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.frame.FrameDecoder;
+
+/**
+ * @author svenrienstra
+ */
+public class Rfc5425FrameDecoder extends FrameDecoder implements ChannelHandlerFactory {
+
+    private Integer currentFramelength;
+
+    /**
+     * @see org.jboss.netty.handler.codec.frame.FrameDecoder#decode(org.jboss.netty.channel.ChannelHandlerContext,
+     *      org.jboss.netty.channel.Channel,
+     *      org.jboss.netty.buffer.ChannelBuffer)
+     */
+    @Override
+    protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
+        if (currentFramelength == null) {
+            // find index of the first space, it should be after the length
+            // field
+            int index = indexOf(buffer, ChannelBuffers.wrappedBuffer(new byte[] {' '}));
+
+            // Read part until the first space, if we have found one
+            StringBuffer lengthbuffer = new StringBuffer();
+            if (index > -1) {
+                lengthbuffer.append(new String(buffer.readBytes(index).array()));
+            }
+
+            int length;
+            try {
+                // add one because we have to take in account the space after
+                // the length field
+                length = Integer.parseInt(lengthbuffer.toString()) + 1;
+            } catch (NumberFormatException e) {
+                length = -1;
+            }
+
+            // We have not found the length field, reset the buffer so we can
+            // retry next time
+            if (length < 0) {
+                buffer.resetReaderIndex();
+                return null;
+            }
+            currentFramelength = length;
+        }
+
+        // Buffer does not contain enough data yet, wait until it does
+        if (buffer.readableBytes() < currentFramelength) {
+            return null;
+        }
+
+        // read the message
+        int lengthToRead = currentFramelength;
+        currentFramelength = null;
+        return buffer.readBytes(lengthToRead);
+    }
+
+    /**
+     * Borrowed from the DelimiterBasedFrameDecoder Returns the number of bytes
+     * between the readerIndex of the haystack and the first needle found in the
+     * haystack. -1 is returned if no needle is found in the haystack.
+     */
+    private static int indexOf(ChannelBuffer haystack, ChannelBuffer needle) {
+        for (int i = haystack.readerIndex(); i < haystack.writerIndex(); i++) {
+            int haystackIndex = i;
+            int needleIndex;
+            for (needleIndex = 0; needleIndex < needle.capacity(); needleIndex++) {
+                if (haystack.getByte(haystackIndex) != needle.getByte(needleIndex)) {
+                    break;
+                } else {
+                    haystackIndex++;
+                    if (haystackIndex == haystack.writerIndex() && needleIndex != needle.capacity() - 1) {
+                        return -1;
+                    }
+                }
+            }
+
+            if (needleIndex == needle.capacity()) {
+                // Found the needle from the haystack!
+                return i - haystack.readerIndex();
+            }
+        }
+        return -1;
+    }
+
+    @Override
+    public ChannelHandler newChannelHandler() {
+        return new Rfc5425FrameDecoder();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/c3663ef6/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java
deleted file mode 100644
index 7dce437..0000000
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426Encoder.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 
- */
-package org.apache.camel.component.syslog.netty;
-
-import static org.jboss.netty.buffer.ChannelBuffers.wrappedBuffer;
-
-import java.nio.charset.Charset;
-
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandler.Sharable;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
-
-/**
- * @author svenrienstra
- */
-@Sharable
-public class Rfc5426Encoder extends OneToOneEncoder {
-
-    @Override
-    protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
-        if (!(msg instanceof ChannelBuffer)) {
-            return msg;
-        }
-
-        ChannelBuffer src = (ChannelBuffer)msg;
-        int length = src.readableBytes();
-
-        String headerString = length + " ";
-
-        ChannelBuffer header = channel.getConfig().getBufferFactory().getBuffer(src.order(), headerString.getBytes(Charset.forName("UTF8")).length);
-        header.writeBytes(headerString.getBytes(Charset.forName("UTF8")));
-
-        return wrappedBuffer(header, src);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/c3663ef6/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java
deleted file mode 100644
index e3bbf10..0000000
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/netty/Rfc5426FrameDecoder.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 
- */
-package org.apache.camel.component.syslog.netty;
-
-import org.apache.camel.component.netty.ChannelHandlerFactory;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandler;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.handler.codec.frame.FrameDecoder;
-
-/**
- * @author svenrienstra
- */
-public class Rfc5426FrameDecoder extends FrameDecoder implements ChannelHandlerFactory {
-
-    private Integer currentFramelength;
-
-    /**
-     * @see org.jboss.netty.handler.codec.frame.FrameDecoder#decode(org.jboss.netty.channel.ChannelHandlerContext,
-     *      org.jboss.netty.channel.Channel,
-     *      org.jboss.netty.buffer.ChannelBuffer)
-     */
-    @Override
-    protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception {
-        if (currentFramelength == null) {
-            // find index of the first space, it should be after the length
-            // field
-            int index = indexOf(buffer, ChannelBuffers.wrappedBuffer(new byte[] {' '}));
-
-            // Read part until the first space, if we have found one
-            StringBuffer lengthbuffer = new StringBuffer();
-            if (index > -1) {
-                lengthbuffer.append(new String(buffer.readBytes(index).array()));
-            }
-
-            int length;
-            try {
-                // add one because we have to take in account the space after
-                // the length field
-                length = Integer.parseInt(lengthbuffer.toString()) + 1;
-            } catch (NumberFormatException e) {
-                length = -1;
-            }
-
-            // We have not found the length field, reset the buffer so we can
-            // retry next time
-            if (length < 0) {
-                buffer.resetReaderIndex();
-                return null;
-            }
-            currentFramelength = length;
-        }
-
-        // Buffer does not contain enough data yet, wait until it does
-        if (buffer.readableBytes() < currentFramelength) {
-            return null;
-        }
-
-        // read the message
-        int lengthToRead = currentFramelength;
-        currentFramelength = null;
-        return buffer.readBytes(lengthToRead);
-    }
-
-    /**
-     * Borrowed from the DelimiterBasedFrameDecoder Returns the number of bytes
-     * between the readerIndex of the haystack and the first needle found in the
-     * haystack. -1 is returned if no needle is found in the haystack.
-     */
-    private static int indexOf(ChannelBuffer haystack, ChannelBuffer needle) {
-        for (int i = haystack.readerIndex(); i < haystack.writerIndex(); i++) {
-            int haystackIndex = i;
-            int needleIndex;
-            for (needleIndex = 0; needleIndex < needle.capacity(); needleIndex++) {
-                if (haystack.getByte(haystackIndex) != needle.getByte(needleIndex)) {
-                    break;
-                } else {
-                    haystackIndex++;
-                    if (haystackIndex == haystack.writerIndex() && needleIndex != needle.capacity() - 1) {
-                        return -1;
-                    }
-                }
-            }
-
-            if (needleIndex == needle.capacity()) {
-                // Found the needle from the haystack!
-                return i - haystack.readerIndex();
-            }
-        }
-        return -1;
-    }
-
-    @Override
-    public ChannelHandler newChannelHandler() {
-        return new Rfc5426FrameDecoder();
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/c3663ef6/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
index 5f029a3..859efdd 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426LongMessageTest.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.syslog.netty.Rfc5426Encoder;
-import org.apache.camel.component.syslog.netty.Rfc5426FrameDecoder;
+import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
+import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.test.AvailablePortFinder;
@@ -46,8 +46,8 @@ public class NettyRfc5426LongMessageTest extends CamelTestSupport {
     @Override
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry jndi = super.createRegistry();
-        jndi.bind("decoder", new Rfc5426FrameDecoder());
-        jndi.bind("encoder", new Rfc5426Encoder());
+        jndi.bind("decoder", new Rfc5425FrameDecoder());
+        jndi.bind("encoder", new Rfc5425Encoder());
         return jndi;
     }
 
@@ -67,7 +67,7 @@ public class NettyRfc5426LongMessageTest extends CamelTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5426FrameDecoder());
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
 
         return new RouteBuilder() {
             @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/c3663ef6/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
index 179988c..22b22bd 100644
--- a/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
+++ b/components/camel-syslog/src/test/java/org/apache/camel/component/syslog/NettyRfc5426Test.java
@@ -21,8 +21,8 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.component.syslog.netty.Rfc5426Encoder;
-import org.apache.camel.component.syslog.netty.Rfc5426FrameDecoder;
+import org.apache.camel.component.syslog.netty.Rfc5425Encoder;
+import org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder;
 import org.apache.camel.impl.JndiRegistry;
 import org.apache.camel.spi.DataFormat;
 import org.apache.camel.test.AvailablePortFinder;
@@ -48,8 +48,8 @@ public class NettyRfc5426Test extends CamelTestSupport {
     @Override
     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry jndi = super.createRegistry();
-        jndi.bind("decoder", new Rfc5426FrameDecoder());
-        jndi.bind("encoder", new Rfc5426Encoder());
+        jndi.bind("decoder", new Rfc5425FrameDecoder());
+        jndi.bind("encoder", new Rfc5425Encoder());
         return jndi;
     }
 
@@ -70,7 +70,7 @@ public class NettyRfc5426Test extends CamelTestSupport {
 
     @Override
     protected RouteBuilder createRouteBuilder() throws Exception {
-        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5426FrameDecoder());
+        context().getRegistry(JndiRegistry.class).bind("rfc5426FrameDecoder", new Rfc5425FrameDecoder());
 
         return new RouteBuilder() {
             @Override