camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/6] git commit: CAMEL-7788: Support for rfc 5424/5425/6587 in syslog component
Date Sun, 07 Sep 2014 07:22:50 GMT
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 <davsclaus@apache.org>
Authored: Sun Sep 7 09:14:12 2014 +0200
Committer: Claus Ibsen <davsclaus@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'>


Mime
View raw message