git commit: CAMEL-7622: Fixed bug with adviceWith after last code change in this area.

2014-07-22 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master bea22a4fe - faa20255e


CAMEL-7622: Fixed bug with adviceWith after last code change in this area.


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

Branch: refs/heads/master
Commit: faa20255e236fcdb44879c84ab9bb086a8671f72
Parents: bea22a4
Author: Claus Ibsen davscl...@apache.org
Authored: Tue Jul 22 11:16:22 2014 +0200
Committer: Claus Ibsen davscl...@apache.org
Committed: Tue Jul 22 11:16:22 2014 +0200

--
 .../apache/camel/builder/AdviceWithTasks.java   | 11 ++--
 .../camel/issues/AdviceWithOnExceptionTest.java | 62 
 2 files changed, 66 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/faa20255/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java 
b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
index 69f5a0a..694841c 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/AdviceWithTasks.java
@@ -312,7 +312,7 @@ public final class AdviceWithTasks {
 /**
  * Gets the outputs from the given parent.
  * p/
- * This implementation deals with that outputs can be abstract and 
retrieves the correct non-nested output.
+ * This implementation deals with that outputs can be abstract and 
retrieves the icorrect/i parent output.
  *
  * @param parent the parent
  * @return ttnull/tt if no parent
@@ -323,12 +323,9 @@ public final class AdviceWithTasks {
 return null;
 }
 ListProcessorDefinition outputs = parent.getOutputs();
-if (outputs.size() = 1) {
-// if the 1st output is abstract, then its 
onException,transacted,intercept etc so we should
-// get the 'actual' outputs from that
-if (outputs.get(0).isAbstract()) {
-outputs = outputs.get(0).getOutputs();
-}
+if (outputs.size() == 1  outputs.get(0).isAbstract()) {
+// if the output is abstract then get its output, as
+outputs = outputs.get(0).getOutputs();
 }
 return outputs;
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/faa20255/camel-core/src/test/java/org/apache/camel/issues/AdviceWithOnExceptionTest.java
--
diff --git 
a/camel-core/src/test/java/org/apache/camel/issues/AdviceWithOnExceptionTest.java
 
b/camel-core/src/test/java/org/apache/camel/issues/AdviceWithOnExceptionTest.java
new file mode 100644
index 000..4772baa
--- /dev/null
+++ 
b/camel-core/src/test/java/org/apache/camel/issues/AdviceWithOnExceptionTest.java
@@ -0,0 +1,62 @@
+/**
+ * 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.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.AdviceWithRouteBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.RouteDefinition;
+
+/**
+ * @version 
+ */
+public class AdviceWithOnExceptionTest extends ContextTestSupport {
+
+public void testAdviceWithOnException() throws Exception {
+RouteDefinition route = context.getRouteDefinitions().get(0);
+route.adviceWith(context, new AdviceWithRouteBuilder() {
+@Override
+public void configure() throws Exception {
+weaveById(b).after().to(mock:result);
+}
+});
+context.start();
+
+getMockEndpoint(mock:a).expectedMessageCount(1);
+getMockEndpoint(mock:b).expectedMessageCount(1);
+getMockEndpoint(mock:result).expectedMessageCount(1);
+
+template.sendBody(direct:start, Hello 

buildbot failure in ASF Buildbot on camel-site-production

2014-07-22 Thread buildbot
The Buildbot has detected a new failure on builder camel-site-production while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/camel-site-production/builds/2196

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-cms-slave

Build Reason: The Nightly scheduler named 'camel-site-production' triggered 
this build
Build Source Stamp: [branch camel/website] HEAD
Blamelist: 

BUILD FAILED: failed compile

sincerely,
 -The Buildbot





[1/3] CAMEL-7618: Enhancement for xmlsecurity Component: Detached XML Signatures. Thanks to Franz Forsthofer for the patch.

2014-07-22 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master faa20255e - 122419876


http://git-wip-us.apache.org/repos/asf/camel/blob/12241987/components/camel-xmlsecurity/src/test/resources/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml
--
diff --git 
a/components/camel-xmlsecurity/src/test/resources/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml
 
b/components/camel-xmlsecurity/src/test/resources/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml
index 13eb958..8ce4688 100644
--- 
a/components/camel-xmlsecurity/src/test/resources/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml
+++ 
b/components/camel-xmlsecurity/src/test/resources/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml
@@ -1,405 +1,439 @@
 ?xml version=1.0 encoding=UTF-8?
-!--
-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.
---
+!-- 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. --
 beans xmlns=http://www.springframework.org/schema/beans;
-   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
-   xsi:schemaLocation=
+xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
+xsi:schemaLocation=
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
 
 
-   camelContext id=camel xmlns=http://camel.apache.org/schema/spring;
-   onException
-   
exceptionorg.apache.camel.component.xmlsecurity.api.XmlSignatureException
-   /exception
-   handled
-   constantfalse/constant
-   /handled
-   to uri=mock:exception /
-   /onException
-
-   !-- START SNIPPET: enveloping XML signature --
-   route
-   from uri=direct:enveloping /
-   to 
uri=xmlsecurity:sign://enveloping?keyAccessor=#accessorRsa /
-   to 
uri=xmlsecurity:verify://enveloping?keySelector=#selectorRsa /
-   to uri=mock:result /
-   /route
-   !-- END SNIPPET: enveloping XML signature --
-
-   !-- START SNIPPET: enveloping XML signature with plain text --
-   route
-   from uri=direct:plaintext /
-   to
-   
uri=xmlsecurity:sign://plaintext?keyAccessor=#accessorRsaamp;plainText=trueamp;plainTextEncoding=UTF-8
 /
-   to 
uri=xmlsecurity:verify://plaintext?keySelector=#selectorRsa /
-   to uri=mock:result /
-   /route
-   !-- END SNIPPET: enveloping XML signature with plain text --
-
-   !-- START SNIPPET: enveloped XML signature --
-   route
-   from uri=direct:enveloped /
-   to
-   
uri=xmlsecurity:sign://enveloped?keyAccessor=#accessorRsaamp;parentLocalName=rootamp;parentNamespace=http://test/test;
 /
-   to 
uri=xmlsecurity:verify://enveloped?keySelector=#selectorRsa /
-   to uri=mock:result /
-   /route
-   !-- END SNIPPET: enveloped XML signature --
-
-   !-- START SNIPPET: 

[CONF] Apache Camel JSON

2014-07-22 Thread Claus Ibsen (Confluence)














  


Claus Ibsen edited the page:
 


JSON   






...



 Code Block








language
xml


 




 from uri=direct:inPojoAgeView/
  marshal
json library=Jackson unmarshalTypeName=org.apache.camel.component.jackson.TestPojoView jsonView=org.apache.camel.component.jackson.Views$Age/
  /marshal
 



 Setting serialization include option for Jackson marshal 
 Available as of Camel 2.13.3/2.14 
 If you want to marshal a pojo to JSON, and the pojo has some fields with null values. And you want to skip these null values, then you need to set either an annotation on the pojo, 



 Code Block




 
@JsonInclude(Include.NON_NULL)
public class MyPojo {
   ...
}
 



 But this requires you to include that annotation in your pojo source code. You can also configure the Camel JsonDataFormat to set the include option, as shown below: 



 Code Block




 
JacksonDataFormat format = new 

[2/2] git commit: CAMEL-7624: camel-jackson allow to configure include option to make it easy to skip null fields.

2014-07-22 Thread davsclaus
CAMEL-7624: camel-jackson allow to configure include option to make it easy to 
skip null fields.


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

Branch: refs/heads/camel-2.13.x
Commit: c23789af5cb5770b692cc79d8aed24d096332d99
Parents: 3039e87
Author: Claus Ibsen davscl...@apache.org
Authored: Tue Jul 22 12:34:55 2014 +0200
Committer: Claus Ibsen davscl...@apache.org
Committed: Tue Jul 22 12:35:11 2014 +0200

--
 .../apache/camel/builder/DataFormatClause.java  | 18 ++-
 .../camel/model/dataformat/JsonDataFormat.java  | 14 -
 .../component/jackson/JacksonDataFormat.java| 28 --
 .../jackson/JacksonIncludeDefaultTest.java  | 53 +++
 .../jackson/JacksonIncludeNotNulllTest.java | 54 
 .../camel/component/jackson/TestOtherPojo.java  | 40 +++
 6 files changed, 201 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/c23789af/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java 
b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index b28d062..508b9fb 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -359,9 +359,8 @@ public class DataFormatClauseT extends 
ProcessorDefinition? {
 }
 
 /**
- * Uses the JSON data format
+ * Uses the Jackson JSON data format
  *
- * @param type  the json type to use
  * @param unmarshalType unmarshal type for json jackson type
  * @param jsonView  the view type for json jackson type
  */
@@ -373,6 +372,21 @@ public class DataFormatClauseT extends 
ProcessorDefinition? {
 }
 
 /**
+ * Uses the Jackson JSON data format
+ *
+ * @param unmarshalType unmarshal type for json jackson type
+ * @param jsonView  the view type for json jackson type
+ * @param include   include such as ttALWAYS/tt, 
ttNON_NULL/tt, etc.
+ */
+public T json(Class? unmarshalType, Class? jsonView, String include) {
+JsonDataFormat json = new JsonDataFormat(JsonLibrary.Jackson);
+json.setUnmarshalType(unmarshalType);
+json.setJsonView(jsonView);
+json.setInclude(include);
+return dataFormat(json);
+}
+
+/**
  * Uses the protobuf data format
  */
 public T protobuf() {

http://git-wip-us.apache.org/repos/asf/camel/blob/c23789af/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index 2cf7cf7..d72492a 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -46,6 +46,8 @@ public class JsonDataFormat extends DataFormatDefinition {
 private Class? unmarshalType;
 @XmlAttribute
 private Class? jsonView;
+@XmlAttribute
+private String include;
 
 public JsonDataFormat() {
 }
@@ -94,6 +96,14 @@ public class JsonDataFormat extends DataFormatDefinition {
 this.jsonView = jsonView;
 }
 
+public String getInclude() {
+return include;
+}
+
+public void setInclude(String include) {
+this.include = include;
+}
+
 @Override
 protected DataFormat createDataFormat(RouteContext routeContext) {
 if (library == JsonLibrary.XStream) {
@@ -123,10 +133,12 @@ public class JsonDataFormat extends DataFormatDefinition {
 if (prettyPrint != null) {
 setProperty(camelContext, dataFormat, prettyPrint, 
unmarshalType);
 }
-
 if (jsonView != null) {
 setProperty(camelContext, dataFormat, jsonView, jsonView);
 }
+if (include != null) {
+setProperty(camelContext, dataFormat, include, include);
+}
 }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c23789af/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
--
diff --git 
a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
 

[1/2] git commit: CAMEL-7624: camel-jackson allow to configure include option to make it easy to skip null fields.

2014-07-22 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/camel-2.13.x 3039e87fe - c23789af5
  refs/heads/master 122419876 - d5394d3b4


CAMEL-7624: camel-jackson allow to configure include option to make it easy to 
skip null fields.


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

Branch: refs/heads/master
Commit: d5394d3b47988e38c27ad54a9db5628b9772d81f
Parents: 1224198
Author: Claus Ibsen davscl...@apache.org
Authored: Tue Jul 22 12:34:55 2014 +0200
Committer: Claus Ibsen davscl...@apache.org
Committed: Tue Jul 22 12:34:55 2014 +0200

--
 .../apache/camel/builder/DataFormatClause.java  | 18 ++-
 .../camel/model/dataformat/JsonDataFormat.java  | 14 -
 .../component/jackson/JacksonDataFormat.java| 28 --
 .../jackson/JacksonIncludeDefaultTest.java  | 53 +++
 .../jackson/JacksonIncludeNotNulllTest.java | 54 
 .../camel/component/jackson/TestOtherPojo.java  | 40 +++
 6 files changed, 201 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/d5394d3b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java 
b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index b28d062..508b9fb 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -359,9 +359,8 @@ public class DataFormatClauseT extends 
ProcessorDefinition? {
 }
 
 /**
- * Uses the JSON data format
+ * Uses the Jackson JSON data format
  *
- * @param type  the json type to use
  * @param unmarshalType unmarshal type for json jackson type
  * @param jsonView  the view type for json jackson type
  */
@@ -373,6 +372,21 @@ public class DataFormatClauseT extends 
ProcessorDefinition? {
 }
 
 /**
+ * Uses the Jackson JSON data format
+ *
+ * @param unmarshalType unmarshal type for json jackson type
+ * @param jsonView  the view type for json jackson type
+ * @param include   include such as ttALWAYS/tt, 
ttNON_NULL/tt, etc.
+ */
+public T json(Class? unmarshalType, Class? jsonView, String include) {
+JsonDataFormat json = new JsonDataFormat(JsonLibrary.Jackson);
+json.setUnmarshalType(unmarshalType);
+json.setJsonView(jsonView);
+json.setInclude(include);
+return dataFormat(json);
+}
+
+/**
  * Uses the protobuf data format
  */
 public T protobuf() {

http://git-wip-us.apache.org/repos/asf/camel/blob/d5394d3b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index 2cf7cf7..d72492a 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -46,6 +46,8 @@ public class JsonDataFormat extends DataFormatDefinition {
 private Class? unmarshalType;
 @XmlAttribute
 private Class? jsonView;
+@XmlAttribute
+private String include;
 
 public JsonDataFormat() {
 }
@@ -94,6 +96,14 @@ public class JsonDataFormat extends DataFormatDefinition {
 this.jsonView = jsonView;
 }
 
+public String getInclude() {
+return include;
+}
+
+public void setInclude(String include) {
+this.include = include;
+}
+
 @Override
 protected DataFormat createDataFormat(RouteContext routeContext) {
 if (library == JsonLibrary.XStream) {
@@ -123,10 +133,12 @@ public class JsonDataFormat extends DataFormatDefinition {
 if (prettyPrint != null) {
 setProperty(camelContext, dataFormat, prettyPrint, 
unmarshalType);
 }
-
 if (jsonView != null) {
 setProperty(camelContext, dataFormat, jsonView, jsonView);
 }
+if (include != null) {
+setProperty(camelContext, dataFormat, include, include);
+}
 }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/d5394d3b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
--
diff --git 

buildbot failure in ASF Buildbot on camel-site-production

2014-07-22 Thread buildbot
The Buildbot has detected a new failure on builder camel-site-production while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/camel-site-production/builds/2198

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-cms-slave

Build Reason: The Nightly scheduler named 'camel-site-production' triggered 
this build
Build Source Stamp: [branch camel/website] HEAD
Blamelist: 

BUILD FAILED: failed compile

sincerely,
 -The Buildbot





svn commit: r917090 [3/3] - in /websites/production/camel/content: book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache json.html

2014-07-22 Thread buildbot
Modified: websites/production/camel/content/json.html
==
--- websites/production/camel/content/json.html (original)
+++ websites/production/camel/content/json.html Tue Jul 22 12:18:33 2014
@@ -252,7 +252,19 @@ from(quot;direct:inPojoAgeViewquot;).
 lt;json library=quot;Jacksonquot; 
unmarshalTypeName=quot;org.apache.camel.component.jackson.TestPojoViewquot; 
jsonView=quot;org.apache.camel.component.jackson.Views$Agequot;/gt;
   lt;/marshalgt;
 ]]/script
-/div/divh3 id=JSON-DependenciesforXStreamDependencies for 
XStream/h3pTo use JSON in your camel routes you need to add the a 
dependency on strongcamel-xstream/strong which implements this data 
format./ppIf you use maven you could just add the following to your 
pom.xml, substituting the version number for the latest amp; greatest release 
(see a shape=rect href=download.htmlthe download page for the latest 
versions/a)./pdiv class=code panel pdl style=border-width: 1px;div 
class=codeContent panelContent pdl
+/div/divh3 
id=JSON-SettingserializationincludeoptionforJacksonmarshalSetting 
serialization include option for Jackson marshal/h3pstrongAvailable as of 
Camel 2.13.3/2.14/strong/ppIf you want to marshal a pojo to JSON, and the 
pojo has some fields with null values. And you want to skip these null values, 
then you need to set either an annotation on the pojo,#160;/pdiv 
class=code panel pdl style=border-width: 1px;div class=codeContent 
panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[@JsonInclude(Include.NON_NULL)
+public class MyPojo {
+   ...
+}]]/script
+/div/divpBut this requires you to include that annotation in your pojo 
source code. You can also configure the Camel JsonDataFormat to set the include 
option, as shown below:/pdiv class=code panel pdl style=border-width: 
1px;div class=codeContent panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[JacksonDataFormat format = new 
JacksonDataFormat();
+format.setInclude(quot;NON_NULLquot;);]]/script
+/div/divpOr from XML DSL you configure this as/pdiv class=code panel 
pdl style=border-width: 1px;div class=codeContent panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[lt;dataFormatsgt;
+  lt;json id=quot;jsonquot; library=quot;Jacksonquot; 
include=quot;NOT_NULLquot;/gt;
+lt;/dataFormatsgt;]]/script
+/div/divp#160;/ph3 id=JSON-DependenciesforXStreamDependencies for 
XStream/h3pTo use JSON in your camel routes you need to add the a 
dependency on strongcamel-xstream/strong which implements this data 
format./ppIf you use maven you could just add the following to your 
pom.xml, substituting the version number for the latest amp; greatest release 
(see a shape=rect href=download.htmlthe download page for the latest 
versions/a)./pdiv class=code panel pdl style=border-width: 1px;div 
class=codeContent panelContent pdl
 script class=theme: Default; brush: xml; gutter: false 
type=syntaxhighlighter![CDATA[lt;dependencygt;
   lt;groupIdgt;org.apache.camellt;/groupIdgt;
   lt;artifactIdgt;camel-xstreamlt;/artifactIdgt;




buildbot success in ASF Buildbot on camel-site-production

2014-07-22 Thread buildbot
The Buildbot has detected a restored build on builder camel-site-production 
while building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/camel-site-production/builds/2199

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-cms-slave

Build Reason: The Nightly scheduler named 'camel-site-production' triggered 
this build
Build Source Stamp: [branch camel/website] HEAD
Blamelist: 

Build succeeded!

sincerely,
 -The Buildbot





svn commit: r917090 [1/3] - in /websites/production/camel/content: book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache json.html

2014-07-22 Thread buildbot
Author: buildbot
Date: Tue Jul 22 12:18:33 2014
New Revision: 917090

Log:
Production update by buildbot for camel

Modified:
websites/production/camel/content/book-dataformat-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/json.html

Modified: websites/production/camel/content/book-dataformat-appendix.html
==
--- websites/production/camel/content/book-dataformat-appendix.html (original)
+++ websites/production/camel/content/book-dataformat-appendix.html Tue Jul 22 
12:18:33 2014
@@ -907,7 +907,19 @@ from(quot;direct:inPojoAgeViewquot;).
 lt;json library=quot;Jacksonquot; 
unmarshalTypeName=quot;org.apache.camel.component.jackson.TestPojoViewquot; 
jsonView=quot;org.apache.camel.component.jackson.Views$Agequot;/gt;
   lt;/marshalgt;
 ]]/script
-/div/divh3 
id=BookDataFormatAppendix-DependenciesforXStreamDependencies for 
XStream/h3pTo use JSON in your camel routes you need to add the a 
dependency on strongcamel-xstream/strong which implements this data 
format./ppIf you use maven you could just add the following to your 
pom.xml, substituting the version number for the latest amp; greatest release 
(see a shape=rect href=download.htmlthe download page for the latest 
versions/a)./pdiv class=code panel pdl style=border-width: 1px;div 
class=codeContent panelContent pdl
+/div/divh3 
id=BookDataFormatAppendix-SettingserializationincludeoptionforJacksonmarshalSetting
 serialization include option for Jackson marshal/h3pstrongAvailable as 
of Camel 2.13.3/2.14/strong/ppIf you want to marshal a pojo to JSON, and 
the pojo has some fields with null values. And you want to skip these null 
values, then you need to set either an annotation on the pojo,#160;/pdiv 
class=code panel pdl style=border-width: 1px;div class=codeContent 
panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[@JsonInclude(Include.NON_NULL)
+public class MyPojo {
+   ...
+}]]/script
+/div/divpBut this requires you to include that annotation in your pojo 
source code. You can also configure the Camel JsonDataFormat to set the include 
option, as shown below:/pdiv class=code panel pdl style=border-width: 
1px;div class=codeContent panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[JacksonDataFormat format = new 
JacksonDataFormat();
+format.setInclude(quot;NON_NULLquot;);]]/script
+/div/divpOr from XML DSL you configure this as/pdiv class=code panel 
pdl style=border-width: 1px;div class=codeContent panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[lt;dataFormatsgt;
+  lt;json id=quot;jsonquot; library=quot;Jacksonquot; 
include=quot;NOT_NULLquot;/gt;
+lt;/dataFormatsgt;]]/script
+/div/divp#160;/ph3 
id=BookDataFormatAppendix-DependenciesforXStreamDependencies for 
XStream/h3pTo use JSON in your camel routes you need to add the a 
dependency on strongcamel-xstream/strong which implements this data 
format./ppIf you use maven you could just add the following to your 
pom.xml, substituting the version number for the latest amp; greatest release 
(see a shape=rect href=download.htmlthe download page for the latest 
versions/a)./pdiv class=code panel pdl style=border-width: 1px;div 
class=codeContent panelContent pdl
 script class=theme: Default; brush: xml; gutter: false 
type=syntaxhighlighter![CDATA[lt;dependencygt;
   lt;groupIdgt;org.apache.camellt;/groupIdgt;
   lt;artifactIdgt;camel-xstreamlt;/artifactIdgt;




[14/26] CAMEL-6555 Updated the scheme of camel-netty4

2014-07-22 Thread ningjiang
http://git-wip-us.apache.org/repos/asf/camel/blob/e166efcd/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPMulticastAsyncTest.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPMulticastAsyncTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPMulticastAsyncTest.java
index 6e8ad60..4d42422 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPMulticastAsyncTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPMulticastAsyncTest.java
@@ -71,7 +71,7 @@ public class NettyUDPMulticastAsyncTest extends BaseNettyTest 
{
 mock.message(0).body().startsWith(Song Of A Dream.getBytes());
 
 // any IP in the range of 224.0.0.0 through 239.255.255.255 does the 
job
-sendFile(netty:udp://224.1.2.3:{{port}}?sync=false);
+sendFile(netty4:udp://224.1.2.3:{{port}}?sync=false);
 
 mock.assertIsSatisfied();
 }
@@ -81,7 +81,7 @@ public class NettyUDPMulticastAsyncTest extends BaseNettyTest 
{
 return new RouteBuilder() {
 @Override
 public void configure() throws Exception {
-
from(netty:udp://224.1.2.3:{{port}}?sync=falsenetworkInterface=en0)
+
from(netty4:udp://224.1.2.3:{{port}}?sync=falsenetworkInterface=en0)
 .to(mock:result)
 .to(log:Message); 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/e166efcd/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPObjectSyncTest.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPObjectSyncTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPObjectSyncTest.java
index 28c41f3..5d2111d 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPObjectSyncTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPObjectSyncTest.java
@@ -26,7 +26,7 @@ public class NettyUDPObjectSyncTest extends BaseNettyTest {
 @Test
 public void testUDPObjectInOutWithNettyConsumer() throws Exception {
 Poetry poetry = new Poetry();
-Poetry response = 
template.requestBody(netty:udp://localhost:{{port}}?sync=true, poetry, 
Poetry.class);
+Poetry response = 
template.requestBody(netty4:udp://localhost:{{port}}?sync=true, poetry, 
Poetry.class);
 assertEquals(Dr. Sarojini Naidu, response.getPoet());
 }
 
@@ -35,7 +35,7 @@ public class NettyUDPObjectSyncTest extends BaseNettyTest {
 return new RouteBuilder() {
 @Override
 public void configure() throws Exception {
-from(netty:udp://localhost:{{port}}?sync=true)
+from(netty4:udp://localhost:{{port}}?sync=true)
 .process(new Processor() {
 public void process(Exchange exchange) throws 
Exception {
 Poetry poetry = (Poetry) 
exchange.getIn().getBody();

http://git-wip-us.apache.org/repos/asf/camel/blob/e166efcd/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
index a8b4407..b9ad248 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
@@ -27,7 +27,7 @@ public class NettyUDPSyncTest extends BaseNettyTest {
 public void testUDPStringInOutWithNettyConsumer() throws Exception {
 for (int i = 0; i  5; i++) {
 String response = template.requestBody(
-netty:udp://localhost:{{port}}?sync=true,
+netty4:udp://localhost:{{port}}?sync=true,
 After the Battle of Thermopylae in 480 BC - Simonides of Ceos 
(c. 556 BC-468 BC), Greek lyric poet wrote ?, String.class);
 assertEquals(Go tell the Spartans, thou that passest by, That 
faithful to their precepts here we lie., response);
 }
@@ -38,7 +38,7 @@ public class NettyUDPSyncTest extends BaseNettyTest {
 return new RouteBuilder() {
 @Override
 public void configure() throws Exception {
-from(netty:udp://localhost:{{port}}?sync=true)
+from(netty4:udp://localhost:{{port}}?sync=true)
 

[12/26] git commit: CAMEL-6555 Removed the files which are useless in camel-netty4

2014-07-22 Thread ningjiang
CAMEL-6555 Removed the files which are useless in camel-netty4


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

Branch: refs/heads/master
Commit: 66ccde6317ff099ed8c3e257c45329a93ad36fdc
Parents: 6cfee23
Author: Willem Jiang willem.ji...@gmail.com
Authored: Fri Jul 18 23:13:01 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:18 2014 +0800

--
 .../netty4/CamelNettyThreadNameDeterminer.java  | 36 -
 .../netty4/NettyClientBossPoolBuilder.java  | 78 
 2 files changed, 114 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/66ccde63/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/CamelNettyThreadNameDeterminer.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/CamelNettyThreadNameDeterminer.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/CamelNettyThreadNameDeterminer.java
deleted file mode 100644
index 441a763..000
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/CamelNettyThreadNameDeterminer.java
+++ /dev/null
@@ -1,36 +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.netty4;
-
-import org.apache.camel.util.concurrent.ThreadHelper;
-import io.netty.util.ThreadNameDeterminer;
-
-public class CamelNettyThreadNameDeterminer implements ThreadNameDeterminer {
-
-private final String pattern;
-private final String name;
-
-public CamelNettyThreadNameDeterminer(String pattern, String name) {
-this.pattern = pattern;
-this.name = name;
-}
-
-@Override
-public String determineThreadName(String currentThreadName, String 
proposedThreadName) throws Exception {
-return ThreadHelper.resolveThreadName(pattern, name);
-}
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/66ccde63/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyClientBossPoolBuilder.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyClientBossPoolBuilder.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyClientBossPoolBuilder.java
deleted file mode 100644
index f0fc18f..000
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyClientBossPoolBuilder.java
+++ /dev/null
@@ -1,78 +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.netty4;
-
-import java.util.concurrent.Executors;
-
-import io.netty.channel.socket.nio.BossPool;
-import io.netty.channel.socket.nio.NioClientBossPool;
-import io.netty.util.Timer;
-
-/**
- * A builder to create Netty {@link io.netty.channel.socket.nio.BossPool} 
which can be used for sharing boos pools
- * with multiple Netty {@link NettyServerBootstrapFactory} server bootstrap 
configurations.
- */
-public final class NettyClientBossPoolBuilder {
-
-

[19/26] git commit: CAMEL-6555 Polish the code of MyCustomCodec to flow the Netty4 code stander

2014-07-22 Thread ningjiang
CAMEL-6555 Polish the code of MyCustomCodec to flow the Netty4 code stander


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

Branch: refs/heads/master
Commit: f6036424ac021d76250be9889346929c8c1210c4
Parents: db9a749
Author: Willem Jiang willem.ji...@gmail.com
Authored: Mon Jul 21 14:29:58 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:19 2014 +0800

--
 .../camel/component/netty4/MyCustomCodec.java   | 44 +++-
 1 file changed, 16 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/f6036424/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
index c9ecf46..4fe97de 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
@@ -17,10 +17,8 @@
 package org.apache.camel.component.netty4;
 
 import java.util.List;
-
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
-import io.netty.buffer.EmptyByteBuf;
 import io.netty.buffer.Unpooled;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
@@ -49,43 +47,33 @@ public final class MyCustomCodec {
 }
 
 @ChannelHandler.Sharable
-public static class BytesDecoder extends MessageToMessageDecoderObject {
+public static class BytesDecoder extends MessageToMessageDecoderByteBuf {
 
 @Override
-protected void decode(ChannelHandlerContext ctx, Object msg, 
ListObject out) throws Exception {
-if (!(msg instanceof ByteBuf)) {
-out.add(msg);
+protected void decode(ChannelHandlerContext ctx, ByteBuf msg, 
ListObject out) throws Exception {
+// it may be empty, then return null
+if (msg.isReadable()) {
+// ByteBuf may not expose array method for accessing the under 
layer bytes
+byte[] bytes = new byte[msg.readableBytes()];
+int readerIndex = msg.readerIndex();
+msg.getBytes(readerIndex, bytes);
+out.add(bytes);
 } else {
-// it may be empty, then return null
-ByteBuf cb = (ByteBuf) msg;
-if (cb.isReadable()) {
-// ByteBuf may not expose array method for accessing the 
under layer bytes
-byte[] bytes = new byte[cb.readableBytes()];
-int readerIndex = cb.readerIndex();
-cb.getBytes(readerIndex, bytes);
-out.add(bytes);
-} else {
-out.add((Object)null);
-}
+out.add((byte[])null);
 }
-
 }
 
 }
 
 @ChannelHandler.Sharable
-public static class BytesEncoder extends MessageToMessageEncoderObject {
+public static class BytesEncoder extends MessageToMessageEncoderbyte[] {
 
 @Override
-protected void encode(ChannelHandlerContext ctx, Object msg, 
ListObject out) throws Exception {
-if (msg instanceof byte[]) {
-byte[] bytes = (byte[])msg;
-ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(bytes.length);
-buf.writeBytes(bytes);
-out.add(buf);
-} else {
-out.add(msg);
-}
+protected void encode(ChannelHandlerContext ctx, byte[] msg, 
ListObject out) throws Exception {
+byte[] bytes = (byte[])msg;
+ByteBuf buf = ByteBufAllocator.DEFAULT.buffer(bytes.length);
+buf.writeBytes(bytes);
+out.add(buf);
 }
 }
 }



[16/26] git commit: CAMEL-6555 Try to fix the compile errors in camel-netty4 src

2014-07-22 Thread ningjiang
CAMEL-6555 Try to fix the compile errors in camel-netty4 src


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

Branch: refs/heads/master
Commit: 6cfee23d93b0dcb10f6337d0655a27f8c6b14b39
Parents: ccc3c8f
Author: Willem Jiang willem.ji...@gmail.com
Authored: Fri Jul 18 15:52:22 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:18 2014 +0800

--
 .../netty4/DefaultClientPipelineFactory.java|  2 +-
 .../netty4/DefaultServerPipelineFactory.java| 24 ++---
 .../camel/component/netty4/NettyComponent.java  | 23 +++--
 .../component/netty4/NettyConfiguration.java|  3 +-
 .../camel/component/netty4/NettyEndpoint.java   |  4 +-
 .../camel/component/netty4/NettyProducer.java   | 44 +
 .../NettyServerBootstrapConfiguration.java  | 40 
 .../netty4/NettyServerBootstrapFactory.java | 14 +--
 .../netty4/NettyServerBossPoolBuilder.java  | 12 +--
 .../netty4/NettyWorkerPoolBuilder.java  | 17 ++--
 .../SingleTCPNettyServerBootstrapFactory.java   | 96 ++--
 .../SingleUDPNettyServerBootstrapFactory.java   | 25 +++--
 12 files changed, 161 insertions(+), 143 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/6cfee23d/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
index 0c0f4d6..3e5998a 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.component.netty4;
 
-import java.nio.channels.Channels;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
@@ -28,6 +27,7 @@ import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
 import io.netty.handler.ssl.SslHandler;
 import io.netty.handler.timeout.ReadTimeoutHandler;
+
 import org.apache.camel.component.netty4.handlers.ClientChannelHandler;
 import org.apache.camel.component.netty4.ssl.SSLEngineFactory;
 import org.apache.camel.util.ObjectHelper;

http://git-wip-us.apache.org/repos/asf/camel/blob/6cfee23d/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
index f981fce..cf9e57e 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
@@ -28,6 +28,7 @@ import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
 import io.netty.handler.ssl.SslHandler;
+import io.netty.util.concurrent.EventExecutorGroup;
 import org.apache.camel.component.netty4.handlers.ServerChannelHandler;
 import org.apache.camel.component.netty4.ssl.SSLEngineFactory;
 import org.apache.camel.util.ObjectHelper;
@@ -101,18 +102,15 @@ public class DefaultServerPipelineFactory extends 
ServerPipelineFactory {
 }
 
 if (consumer.getConfiguration().isOrderedThreadPoolExecutor()) {
-// this must be added just before the ServerChannelHandler
-// use ordered thread pool, to ensure we process the events in 
order, and can send back
-// replies in the expected order. eg this is required by TCP.
-// and use a Camel thread factory so we have consistent thread 
namings
-ExecutionHandler executionHandler = new 
ExecutionHandler(consumer.getEndpoint().getComponent().getExecutorService());
-addToPipeline(executionHandler, channelPipeline, 
executionHandler);
-LOG.debug(Using OrderedMemoryAwareThreadPoolExecutor with core 
pool size: {}, consumer.getConfiguration().getMaximumPoolSize());
-}
-
-// our handler must be added last
-addToPipeline(handler, channelPipeline, new 
ServerChannelHandler(consumer));
+// Just use EventExecutorGroup from the Netty 

[11/26] git commit: CAMEL-6555 Fixed the compile errors in camel-netty4

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed the compile errors in camel-netty4


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

Branch: refs/heads/master
Commit: fa1cdc43f742e7f1f8ed442907dbff2cd9d2d264
Parents: 66ccde6
Author: Willem Jiang willem.ji...@gmail.com
Authored: Fri Jul 18 23:14:04 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:18 2014 +0800

--
 .../netty4/DefaultServerPipelineFactory.java|  5 +-
 .../SingleTCPNettyServerBootstrapFactory.java   |  7 ++-
 .../netty4/handlers/ClientChannelHandler.java   |  7 +--
 .../netty4/handlers/ServerChannelHandler.java   |  2 +-
 .../camel/component/netty4/MyCustomCodec.java   | 49 +++-
 5 files changed, 39 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/fa1cdc43/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
index cf9e57e..92c1b21 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
@@ -16,19 +16,18 @@
  */
 package org.apache.camel.component.netty4;
 
-import java.nio.channels.Channels;
 import java.util.List;
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.util.ObjectHelper;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
 import io.netty.handler.ssl.SslHandler;
 import io.netty.util.concurrent.EventExecutorGroup;
+
+import org.apache.camel.CamelContext;
 import org.apache.camel.component.netty4.handlers.ServerChannelHandler;
 import org.apache.camel.component.netty4.ssl.SSLEngineFactory;
 import org.apache.camel.util.ObjectHelper;

http://git-wip-us.apache.org/repos/asf/camel/blob/fa1cdc43/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
index 6df8b06..dbc668c 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleTCPNettyServerBootstrapFactory.java
@@ -108,7 +108,9 @@ public class SingleTCPNettyServerBootstrapFactory extends 
ServiceSupport impleme
 if (!future.isSuccess()) {
 // if we cannot bind, the re-create channel
 allChannels.remove(channel);
-channel = serverBootstrap.bind(new 
InetSocketAddress(configuration.getHost(), configuration.getPort()));
+future = serverBootstrap.bind(new 
InetSocketAddress(configuration.getHost(), configuration.getPort()));
+future.awaitUninterruptibly();
+channel = future.channel();
 allChannels.add(channel);
 }
 }
@@ -118,7 +120,8 @@ public class SingleTCPNettyServerBootstrapFactory extends 
ServiceSupport impleme
 protected void doSuspend() throws Exception {
 if (channel != null) {
 LOG.debug(ServerBootstrap unbinding from {}:{}, 
configuration.getHost(), configuration.getPort());
-ChannelFuture future = channel.unbind();
+//TODO need to check if it's good way to unbinding the channel
+ChannelFuture future = channel.close();
 future.awaitUninterruptibly();
 }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/fa1cdc43/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/handlers/ClientChannelHandler.java
index c975afd..d4651a9 100644
--- 

[13/26] git commit: CAMEL-6555 Fixed the build error of camel-netty4

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed the build error of camel-netty4


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

Branch: refs/heads/master
Commit: fa2481202bc6c343a087a4974470a462334e7270
Parents: fa1cdc4
Author: Willem Jiang willem.ji...@gmail.com
Authored: Sun Jul 20 11:27:30 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:18 2014 +0800

--
 .../camel/component/netty4/NettyProducer.java   | 154 ---
 .../NettyServerBootstrapConfiguration.java  |  12 +-
 .../SingleTCPNettyServerBootstrapFactory.java   |   5 +-
 .../SingleUDPNettyServerBootstrapFactory.java   | 100 ++--
 4 files changed, 115 insertions(+), 156 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/fa248120/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
index c94a4dc..b252527 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
@@ -25,6 +25,21 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import io.netty.bootstrap.Bootstrap;
+import io.netty.bootstrap.ChannelFactory;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelFuture;
+import io.netty.channel.ChannelFutureListener;
+import io.netty.channel.ChannelOption;
+import io.netty.channel.EventLoopGroup;
+import io.netty.channel.group.ChannelGroup;
+import io.netty.channel.group.ChannelGroupFuture;
+import io.netty.channel.group.DefaultChannelGroup;
+import io.netty.channel.socket.nio.NioDatagramChannel;
+import io.netty.channel.socket.nio.NioSocketChannel;
+import io.netty.util.HashedWheelTimer;
+import io.netty.util.Timer;
+import io.netty.util.concurrent.ImmediateEventExecutor;
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelException;
@@ -37,25 +52,6 @@ import org.apache.camel.util.IOHelper;
 import org.apache.commons.pool.ObjectPool;
 import org.apache.commons.pool.PoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericObjectPool;
-import io.netty.bootstrap.ClientBootstrap;
-import io.netty.bootstrap.ConnectionlessBootstrap;
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFactory;
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelFutureListener;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.group.ChannelGroup;
-import io.netty.channel.group.ChannelGroupFuture;
-import io.netty.channel.group.DefaultChannelGroup;
-import io.netty.channel.socket.DatagramChannelFactory;
-import io.netty.channel.socket.nio.BossPool;
-import io.netty.channel.socket.nio.NioClientSocketChannelFactory;
-import io.netty.channel.socket.nio.NioDatagramChannelFactory;
-import io.netty.channel.socket.nio.NioDatagramWorkerPool;
-import io.netty.channel.socket.nio.WorkerPool;
-import io.netty.util.HashedWheelTimer;
-import io.netty.util.Timer;
-import io.netty.util.concurrent.ImmediateEventExecutor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -64,11 +60,8 @@ public class NettyProducer extends DefaultAsyncProducer {
 private final ChannelGroup allChannels = new 
DefaultChannelGroup(NettyProducer, ImmediateEventExecutor.INSTANCE);
 private CamelContext context;
 private NettyConfiguration configuration;
-private ChannelFactory channelFactory;
-private DatagramChannelFactory datagramChannelFactory;
 private ClientPipelineFactory pipelineFactory;
 private CamelLogger noReplyLogger;
-private EventLoopGroup bossGroup;
 private EventLoopGroup workerGroup;
 private ObjectPoolChannel pool;
 private Timer timer;
@@ -140,12 +133,6 @@ public class NettyProducer extends DefaultAsyncProducer {
 pipelineFactory = new DefaultClientPipelineFactory(this);
 }
 
-if (isTcp()) {
-setupTCPCommunication();
-} else {
-setupUDPCommunication();
-}
-
 if (!configuration.isLazyChannelCreation()) {
 // ensure the connection can be established when we start up
 Channel channel = pool.borrowObject();
@@ -162,10 +149,6 @@ public class NettyProducer extends DefaultAsyncProducer {
 

[24/26] git commit: CAMEL-6555 Fixed UDPMulticastAsyncTest error and polish the test code

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed UDPMulticastAsyncTest error and polish the test code


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

Branch: refs/heads/master
Commit: 5bcdda6efa9410f2d4fd64ba8703ae5717d9a89c
Parents: 706d1b4
Author: Willem Jiang willem.ji...@gmail.com
Authored: Tue Jul 22 21:24:46 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:20 2014 +0800

--
 .../netty4/SingleUDPNettyServerBootstrapFactory.java | 5 -
 .../org/apache/camel/component/netty4/NettyUDPSyncTest.java  | 8 +---
 2 files changed, 9 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/5bcdda6e/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
index c6b63a8..935b714 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SingleUDPNettyServerBootstrapFactory.java
@@ -163,7 +163,10 @@ public class SingleUDPNettyServerBootstrapFactory extends 
ServiceSupport impleme
 SubnetUtils multicastSubnet = new SubnetUtils(MULTICAST_SUBNET);
 
 if (multicastSubnet.getInfo().isInRange(configuration.getHost())) {
-datagramChannel = (DatagramChannel)bootstrap.bind(hostAddress);
+ChannelFuture channelFuture = bootstrap.bind(hostAddress);
+channelFuture.awaitUninterruptibly();
+channel = channelFuture.channel();
+DatagramChannel datagramChannel = (DatagramChannel) channel;
 String networkInterface = configuration.getNetworkInterface() == 
null ? LOOPBACK_INTERFACE : configuration.getNetworkInterface();
 multicastNetworkInterface = 
NetworkInterface.getByName(networkInterface);
 ObjectHelper.notNull(multicastNetworkInterface, No network 
interface found for ' + networkInterface + '.);

http://git-wip-us.apache.org/repos/asf/camel/blob/5bcdda6e/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
index b9ad248..3731732 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUDPSyncTest.java
@@ -22,14 +22,16 @@ import org.apache.camel.builder.RouteBuilder;
 import org.junit.Test;
 
 public class NettyUDPSyncTest extends BaseNettyTest {
+private static final String RESPONSE = Go tell the Spartans, thou that 
passest by, That faithful to their precepts here we lie.;
+private static final String REQUEST = After the Battle of Thermopylae in 
480 BC - Simonides of Ceos (c. 556 BC-468 BC), Greek lyric poet wrote ;
 
 @Test
 public void testUDPStringInOutWithNettyConsumer() throws Exception {
 for (int i = 0; i  5; i++) {
 String response = template.requestBody(
 netty4:udp://localhost:{{port}}?sync=true,
-After the Battle of Thermopylae in 480 BC - Simonides of Ceos 
(c. 556 BC-468 BC), Greek lyric poet wrote ?, String.class);
-assertEquals(Go tell the Spartans, thou that passest by, That 
faithful to their precepts here we lie., response);
+REQUEST, String.class);
+assertEquals(RESPONSE, response);
 }
 }
 
@@ -41,7 +43,7 @@ public class NettyUDPSyncTest extends BaseNettyTest {
 from(netty4:udp://localhost:{{port}}?sync=true)
 .process(new Processor() {
 public void process(Exchange exchange) throws 
Exception {
-exchange.getOut().setBody(Go tell the Spartans, 
thou that passest by, That faithful to their precepts here we lie.);   

+exchange.getOut().setBody(RESPONSE);   

 }
 });
 }



[23/26] git commit: CAMEL-6555 Fixed the test errors of SharedWorkerThreadPool

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed the test errors of SharedWorkerThreadPool


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

Branch: refs/heads/master
Commit: 5022509b450e5ec1fd9b9a88dc4cb9fbd8731402
Parents: c761731
Author: Willem Jiang willem.ji...@gmail.com
Authored: Tue Jul 22 21:18:01 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:20 2014 +0800

--
 .../netty4/NettyServerBootstrapConfiguration.java   |  4 ++--
 .../NettyUseSharedWorkerThreadPoolManyRoutesTest.java   |  2 +-
 .../netty4/NettyUseSharedWorkerThreadPoolTest.java  | 12 ++--
 .../SpringNettyUseSharedWorkerThreadPoolTest.java   |  2 +-
 .../netty4/SpringNettyUseSharedWorkerThreadPoolTest.xml |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/5022509b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java
index a60b45f..bf55073 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java
@@ -308,7 +308,7 @@ public class NettyServerBootstrapConfiguration implements 
Cloneable {
 return bossGroup;
 }
 
-public void setBossPool(EventLoopGroup bossGroup) {
+public void setBossGroup(EventLoopGroup bossGroup) {
 this.bossGroup = bossGroup;
 }
 
@@ -316,7 +316,7 @@ public class NettyServerBootstrapConfiguration implements 
Cloneable {
 return workerGroup;
 }
 
-public void setWorkerPool(EventLoopGroup workerGroup) {
+public void setWorkerGroup(EventLoopGroup workerGroup) {
 this.workerGroup = workerGroup;
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/5022509b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
index c40fb80..fa71b39 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolManyRoutesTest.java
@@ -71,7 +71,7 @@ public class NettyUseSharedWorkerThreadPoolManyRoutesTest 
extends BaseNettyTest
 
 for (int i = 0; i  100; i++) {
 from(netty4:tcp://localhost: + getNextPort() + 
?textline=truesync=trueorderedThreadPoolExecutor=false
-+ bossPool=#sharedBossworkerPool=#sharedWorker)
++ 
bossGroup=#sharedBossworkerGroup=#sharedWorker)
 .validate(body().isInstanceOf(String.class))
 .to(log:result)
 .to(mock:result)

http://git-wip-us.apache.org/repos/asf/camel/blob/5022509b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
index ccf6fed..31a5be9 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyUseSharedWorkerThreadPoolTest.java
@@ -49,13 +49,13 @@ public class NettyUseSharedWorkerThreadPoolTest extends 
BaseNettyTest {
 getMockEndpoint(mock:result).expectedMessageCount(30);
 
 for (int i = 0; i  10; i++) {
-String reply = template.requestBody(netty4:tcp://localhost: + 
port + ?textline=truesync=trueworkerPool=#sharedClientPool, Hello World, 
String.class);
+String reply = 

[25/26] git commit: CAMEL-6555 Fixed the UDP related test errors

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed the UDP related test errors


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

Branch: refs/heads/master
Commit: 706d1b44bcad170508fa31e55d8b3ed4e4ef0bbd
Parents: 5022509
Author: Willem Jiang willem.ji...@gmail.com
Authored: Tue Jul 22 21:22:32 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:20 2014 +0800

--
 .../netty4/ChannelHandlerFactories.java | 92 +++-
 .../component/netty4/NettyConfiguration.java| 16 ++--
 .../camel/component/netty4/NettyHelper.java | 12 +--
 .../component/netty4/NettyPayloadHelper.java| 18 
 .../camel/component/netty4/NettyProducer.java   |  7 +-
 .../netty4/codec/DatagramPacketDecoder.java | 40 +
 .../codec/DatagramPacketDelimiterDecoder.java   | 47 ++
 .../netty4/codec/DatagramPacketEncoder.java | 42 +
 .../codec/DatagramPacketObjectDecoder.java  | 51 +++
 .../codec/DatagramPacketObjectEncoder.java  | 51 +++
 .../codec/DatagramPacketStringDecoder.java  | 62 +
 .../codec/DatagramPacketStringEncoder.java  | 69 +++
 .../codec/DelimiterBasedFrameDecoder.java   | 34 
 .../component/netty4/codec/ObjectDecoder.java   | 38 
 .../component/netty4/codec/ObjectEncoder.java   | 34 
 .../netty4/handlers/ServerChannelHandler.java   |  4 +-
 .../camel/component/netty4/MyCustomCodec.java   |  2 +-
 .../netty4/NettyManualEndpointTest.java |  6 +-
 18 files changed, 585 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/706d1b44/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ChannelHandlerFactories.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ChannelHandlerFactories.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ChannelHandlerFactories.java
index 65d1162..edd387f 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ChannelHandlerFactories.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/ChannelHandlerFactories.java
@@ -27,6 +27,13 @@ import io.netty.handler.codec.serialization.ObjectDecoder;
 import io.netty.handler.codec.serialization.ObjectEncoder;
 import io.netty.handler.codec.string.StringDecoder;
 import io.netty.handler.codec.string.StringEncoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketDecoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketDelimiterDecoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketEncoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketObjectDecoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketObjectEncoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketStringDecoder;
+import org.apache.camel.component.netty4.codec.DatagramPacketStringEncoder;
 
 
 
@@ -38,34 +45,73 @@ public final class ChannelHandlerFactories {
 private ChannelHandlerFactories() {
 }
 
-public static ChannelHandlerFactory newStringEncoder(Charset charset) {
-return new ShareableChannelHandlerFactory(new StringEncoder(charset));
+public static ChannelHandlerFactory newStringEncoder(Charset charset, 
String protocol) {
+if (udp.equalsIgnoreCase(protocol)) {
+return new ShareableChannelHandlerFactory(new 
DatagramPacketStringEncoder(charset));
+} else {
+return new ShareableChannelHandlerFactory(new 
StringEncoder(charset));
+}
 }
 
-public static ChannelHandlerFactory newStringDecoder(Charset charset) {
-return new ShareableChannelHandlerFactory(new StringDecoder(charset));
+public static ChannelHandlerFactory newStringDecoder(Charset charset, 
String protocol) {
+if (udp.equalsIgnoreCase(protocol)) {
+return new ShareableChannelHandlerFactory(new 
DatagramPacketStringDecoder(charset)); 
+} else {
+return new ShareableChannelHandlerFactory(new 
StringDecoder(charset));
+}
 }
-
-public static ChannelHandlerFactory newObjectDecoder() {
-return new DefaultChannelHandlerFactory() {
-@Override
-public ChannelHandler newChannelHandler() {
-return new 
ObjectDecoder(ClassResolvers.weakCachingResolver(null));
-}
-};
+
+
+public static ChannelHandlerFactory newObjectDecoder(String protocol) {
+if (udp.equalsIgnoreCase(protocol)) {
+

[10/26] git commit: CAMEL-6555 Fixed the NettyConverter to bytes test issue

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed the NettyConverter to bytes test issue


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

Branch: refs/heads/master
Commit: 6d5064063ef1461ee440237b73672655f404f9da
Parents: fa24812
Author: Willem Jiang willem.ji...@gmail.com
Authored: Sun Jul 20 16:09:34 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:18 2014 +0800

--
 .../java/org/apache/camel/component/netty4/NettyConverter.java  | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/6d506406/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java
index 6800209..9278a18 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConverter.java
@@ -51,7 +51,10 @@ public final class NettyConverter {
 
 @Converter
 public static byte[] toByteArray(ByteBuf buffer, Exchange exchange) {
-return buffer.array();
+byte[] bytes = new byte[buffer.readableBytes()];
+int readerIndex = buffer.readerIndex();
+buffer.getBytes(readerIndex, bytes);
+return bytes;
 }
 
 @Converter



[20/26] git commit: CAMEL-6555 Added the missed file of SubnetUtils

2014-07-22 Thread ningjiang
CAMEL-6555 Added the missed file of SubnetUtils


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

Branch: refs/heads/master
Commit: b0b7c4cdbf78a8f154691c012f977a25fe449b5a
Parents: e166efc
Author: Willem Jiang willem.ji...@gmail.com
Authored: Mon Jul 21 10:28:12 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:19 2014 +0800

--
 .../component/netty4/util/SubnetUtils.java  | 355 +++
 1 file changed, 355 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/b0b7c4cd/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
new file mode 100644
index 000..a6c90e6
--- /dev/null
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
@@ -0,0 +1,355 @@
+/**
+ * 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.netty4.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * A class that performs some subnet calculations given a network address and 
a subnet mask.
+ * @see http://www.faqs.org/rfcs/rfc1519.html;
+ * This class is copied from apache common net 
+ */
+public class SubnetUtils {
+
+private static final String IP_ADDRESS = 
(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3});
+private static final String SLASH_FORMAT = IP_ADDRESS + /(\\d{1,3});
+private static final Pattern ADDRESS_PATTERN = Pattern.compile(IP_ADDRESS);
+private static final Pattern CIDR_PATTERN = Pattern.compile(SLASH_FORMAT);
+private static final int NBITS = 32;
+
+private int netmask;
+private int address;
+private int network;
+private int broadcast;
+
+/** Whether the broadcast/network address are included in host count */
+private boolean inclusiveHostCount;
+
+
+/**
+ * Constructor that takes a CIDR-notation string, e.g. 192.168.0.1/16
+ * @param cidrNotation A CIDR-notation string, e.g. 192.168.0.1/16
+ * @throws IllegalArgumentException if the parameter is invalid,
+ * i.e. does not match n.n.n.n/m where n=1-3 decimal digits, m = 1-3 
decimal digits in range 1-32
+ */
+public SubnetUtils(String cidrNotation) {
+calculate(cidrNotation);
+}
+
+/**
+ * Constructor that takes a dotted decimal address and a dotted decimal 
mask.
+ * @param address An IP address, e.g. 192.168.0.1
+ * @param mask A dotted decimal netmask e.g. 255.255.0.0
+ * @throws IllegalArgumentException if the address or mask is invalid,
+ * i.e. does not match n.n.n.n where n=1-3 decimal digits and the mask is 
not all zeros
+ */
+public SubnetUtils(String address, String mask) {
+calculate(toCidrNotation(address, mask));
+}
+
+
+/**
+ * Returns codetrue/code if the return value of {@link 
SubnetInfo#getAddressCount()}
+ * includes the network and broadcast addresses.
+ * @since 2.2
+ * @return true if the hostcount includes the network and broadcast 
addresses
+ */
+public boolean isInclusiveHostCount() {
+return inclusiveHostCount;
+}
+
+/**
+ * Set to codetrue/code if you want the return value of {@link 
SubnetInfo#getAddressCount()}
+ * to include the network and broadcast addresses.
+ * @param inclusiveHostCount true if network and broadcast addresses are 
to be included
+ * @since 2.2
+ */
+public void setInclusiveHostCount(boolean inclusiveHostCount) {
+this.inclusiveHostCount = inclusiveHostCount;
+}
+
+
+
+/**
+ * Convenience container for subnet summary information.
+  

[21/26] git commit: CAMEL-6555 Don't throw exception when the host is not IP address

2014-07-22 Thread ningjiang
CAMEL-6555 Don't throw exception when the host is not IP address


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

Branch: refs/heads/master
Commit: efd5de71770ab23817789847b80514395f1669e1
Parents: e236e6a
Author: Willem Jiang willem.ji...@gmail.com
Authored: Mon Jul 21 14:13:04 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:19 2014 +0800

--
 .../org/apache/camel/component/netty4/util/SubnetUtils.java   | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/efd5de71/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
index a6c90e6..9edba1a 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/util/SubnetUtils.java
@@ -122,7 +122,12 @@ public class SubnetUtils {
  * @return True if in range, false otherwise
  */
 public boolean isInRange(String address) {
-return isInRange(toInteger(address));
+Matcher matcher = ADDRESS_PATTERN.matcher(address);
+if (matcher.matches()) {
+return isInRange(toInteger(address));
+} else {
+return false;
+}
 }
 
 private boolean isInRange(int address) {



[17/26] git commit: CAMEL-6555 Removed the useless option setting

2014-07-22 Thread ningjiang
CAMEL-6555 Removed the useless option setting


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

Branch: refs/heads/master
Commit: e236e6ab8bdaffd313eb705956334149680c527d
Parents: b0b7c4c
Author: Willem Jiang willem.ji...@gmail.com
Authored: Mon Jul 21 14:12:05 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:19 2014 +0800

--
 .../main/java/org/apache/camel/component/netty4/NettyProducer.java | 2 --
 1 file changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/e236e6ab/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
index b252527..1082acd 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java
@@ -368,8 +368,6 @@ public class NettyProducer extends DefaultAsyncProducer {
 Bootstrap connectionlessClientBootstrap = new Bootstrap();
 connectionlessClientBootstrap.channel(NioDatagramChannel.class);
 connectionlessClientBootstrap.group(getWorkerGroup());
-connectionlessClientBootstrap.option(ChannelOption.SO_KEEPALIVE, 
configuration.isKeepAlive());
-connectionlessClientBootstrap.option(ChannelOption.SO_REUSEADDR, 
configuration.isReuseAddress());
 
connectionlessClientBootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 
configuration.getConnectTimeout());
 connectionlessClientBootstrap.option(ChannelOption.SO_BROADCAST, 
configuration.isBroadcast());
 connectionlessClientBootstrap.option(ChannelOption.SO_SNDBUF, 
configuration.getSendBufferSize());



[18/26] git commit: CAMEL-6555 Fixed bunch of Unit tests error which are related to TCP

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed bunch of Unit tests error which are related to TCP


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

Branch: refs/heads/master
Commit: db9a749fbf0dce5e1fd4d64cd91b95523aea577a
Parents: efd5de7
Author: Willem Jiang willem.ji...@gmail.com
Authored: Mon Jul 21 14:18:51 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:19 2014 +0800

--
 .../org/apache/camel/component/netty4/NettyEndpoint.java |  2 +-
 .../org/apache/camel/component/netty4/NettyHelper.java   | 10 ++
 .../org/apache/camel/component/netty4/MyCustomCodec.java | 11 ---
 .../apache/camel/component/netty4/NettyFileTcpTest.java  |  2 +-
 .../apache/camel/component/netty4/NettyProxyTest.java|  2 +-
 .../NettyUseSharedWorkerThreadPoolManyRoutesTest.java|  4 ++--
 6 files changed, 19 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/db9a749f/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
index 79d30e4..62d1d13 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
@@ -100,7 +100,7 @@ public class NettyEndpoint extends DefaultEndpoint {
 @Override
 protected String createEndpointUri() {
 ObjectHelper.notNull(configuration, configuration);
-return netty: + getConfiguration().getProtocol() + :// + 
getConfiguration().getHost() + : + getConfiguration().getPort();
+return netty4: + getConfiguration().getProtocol() + :// + 
getConfiguration().getHost() + : + getConfiguration().getPort();
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/db9a749f/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyHelper.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyHelper.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyHelper.java
index 83520f5..76f1f52 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyHelper.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyHelper.java
@@ -21,7 +21,7 @@ import java.net.SocketAddress;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
-
+import io.netty.channel.socket.DatagramPacket;
 import org.apache.camel.Exchange;
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.slf4j.Logger;
@@ -91,14 +91,16 @@ public final class NettyHelper {
 if (log.isDebugEnabled()) {
 log.debug(Channel: {} remote address: {} writing body: {}, 
new Object[]{channel, remoteAddress, body});
 }
-//TODO need to check if we don't need to set the remoteAddress for 
the UDP channel
+System.out.println(The remote address is  + remoteAddress);
+// TODO Do we need to setup the remoteAddress this time
 //future = channel.write(body, remoteAddress);
-future = channel.write(body);
+future = channel.writeAndFlush(body);
 } else {
 if (log.isDebugEnabled()) {
 log.debug(Channel: {} writing body: {}, new 
Object[]{channel, body});
 }
-future = channel.write(body);
+// In netty4 we need to call channel flush to send out the message 
+future = channel.writeAndFlush(body);
 }
 
 if (listener != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/db9a749f/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
--
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
index 08a9ebc..c9ecf46 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/MyCustomCodec.java
@@ -21,6 +21,7 @@ import 

[02/26] git commit: CAMEL-6555 Updated the handlers to netty4 API

2014-07-22 Thread ningjiang
CAMEL-6555 Updated the handlers to netty4 API


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

Branch: refs/heads/master
Commit: 08630d219384d8d56cf1ffe7cf97bbba27e6caae
Parents: 28551f2
Author: Willem Jiang willem.ji...@gmail.com
Authored: Thu Jul 17 17:01:18 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:25:17 2014 +0800

--
 .../netty4/DefaultClientPipelineFactory.java|  2 +-
 .../netty4/DefaultServerPipelineFactory.java| 21 +++---
 .../component/netty4/NettyConfiguration.java| 13 ++--
 .../camel/component/netty4/NettyConverter.java  | 35 +-
 .../camel/component/netty4/NettyEndpoint.java   | 23 ---
 .../camel/component/netty4/NettyHelper.java |  9 ++-
 .../camel/component/netty4/NettyProducer.java   |  2 +-
 .../component/netty4/ServerPipelineFactory.java |  8 ++-
 .../netty4/ShareableChannelHandlerFactory.java  | 19 ++
 .../netty4/handlers/ClientChannelHandler.java   | 57 
 .../netty4/handlers/ServerChannelHandler.java   | 72 ++--
 .../handlers/ServerResponseFutureListener.java  |  9 +--
 12 files changed, 151 insertions(+), 119 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/08630d21/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
index cb53264..0c0f4d6 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultClientPipelineFactory.java
@@ -86,7 +86,7 @@ public class DefaultClientPipelineFactory extends 
ClientPipelineFactory  {
 if (LOG.isTraceEnabled()) {
 LOG.trace(Using request timeout {} millis, 
producer.getConfiguration().getRequestTimeout());
 }
-ChannelHandler timeout = new 
ReadTimeoutHandler(NettyComponent.getTimer(), 
producer.getConfiguration().getRequestTimeout(), TimeUnit.MILLISECONDS);
+ChannelHandler timeout = new 
ReadTimeoutHandler(producer.getConfiguration().getRequestTimeout(), 
TimeUnit.MILLISECONDS);
 addToPipeline(timeout, channelPipeline, timeout);
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/08630d21/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
index e09a5b6..f981fce 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/DefaultServerPipelineFactory.java
@@ -16,20 +16,21 @@
  */
 package org.apache.camel.component.netty4;
 
+import java.nio.channels.Channels;
 import java.util.List;
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.component.netty4.handlers.ServerChannelHandler;
-import org.apache.camel.component.netty4.ssl.SSLEngineFactory;
 import org.apache.camel.util.ObjectHelper;
+import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
-import io.netty.channel.Channels;
-import io.netty.handler.execution.ExecutionHandler;
 import io.netty.handler.ssl.SslHandler;
+import org.apache.camel.component.netty4.handlers.ServerChannelHandler;
+import org.apache.camel.component.netty4.ssl.SSLEngineFactory;
+import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -67,13 +68,14 @@ public class DefaultServerPipelineFactory extends 
ServerPipelineFactory {
 }
 
 @Override
-public ChannelPipeline getPipeline() throws Exception {
-ChannelPipeline channelPipeline = Channels.pipeline();
+protected void initChannel(Channel ch) throws Exception {
+// create a new pipeline
+ChannelPipeline channelPipeline = ch.pipeline();
 
 SslHandler sslHandler = configureServerSSLOnDemand();
 if (sslHandler != 

[26/26] git commit: CAMEL-6555 Fixed the test error of NettyComponentConfigurationAndDocumentationTest

2014-07-22 Thread ningjiang
CAMEL-6555 Fixed the test error of 
NettyComponentConfigurationAndDocumentationTest


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

Branch: refs/heads/master
Commit: bbb972a244d9bff9bdb86592eb60f24ed200e2b3
Parents: 5bcdda6
Author: Willem Jiang willem.ji...@gmail.com
Authored: Tue Jul 22 21:50:20 2014 +0800
Committer: Willem Jiang willem.ji...@gmail.com
Committed: Tue Jul 22 21:50:20 2014 +0800

--
 .../main/java/org/apache/camel/component/netty4/NettyEndpoint.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/bbb972a2/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
--
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
index 62d1d13..017727e 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyEndpoint.java
@@ -38,7 +38,7 @@ import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.ObjectHelper;
 
-@UriEndpoint(scheme = netty, consumerClass = NettyConsumer.class)
+@UriEndpoint(scheme = netty4, consumerClass = NettyConsumer.class)
 public class NettyEndpoint extends DefaultEndpoint {
 @UriParam
 private NettyConfiguration configuration;



buildbot failure in ASF Buildbot on camel-site-production

2014-07-22 Thread buildbot
The Buildbot has detected a new failure on builder camel-site-production while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/camel-site-production/builds/2202

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-cms-slave

Build Reason: The Nightly scheduler named 'camel-site-production' triggered 
this build
Build Source Stamp: [branch camel/website] HEAD
Blamelist: 

BUILD FAILED: failed compile

sincerely,
 -The Buildbot





buildbot success in ASF Buildbot on camel-site-production

2014-07-22 Thread buildbot
The Buildbot has detected a restored build on builder camel-site-production 
while building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/camel-site-production/builds/2203

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-cms-slave

Build Reason: The Nightly scheduler named 'camel-site-production' triggered 
this build
Build Source Stamp: [branch camel/website] HEAD
Blamelist: 

Build succeeded!

sincerely,
 -The Buildbot





[2/3] git commit: CAMEL-7629: camel-jackson now supports a header that dynamic can determine the pojo class name when using unmarshal to pojo.

2014-07-22 Thread davsclaus
CAMEL-7629: camel-jackson now supports a header that dynamic can determine the 
pojo class name when using unmarshal to pojo.


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

Branch: refs/heads/master
Commit: 619b1b9b17ab8aca4f181b3748157e359129cdce
Parents: 52150ce
Author: Claus Ibsen davscl...@apache.org
Authored: Tue Jul 22 20:36:22 2014 +0200
Committer: Claus Ibsen davscl...@apache.org
Committed: Tue Jul 22 20:36:22 2014 +0200

--
 .../camel/model/dataformat/JsonDataFormat.java  | 13 +
 .../component/jackson/JackconConstants.java | 25 +
 .../component/jackson/JacksonDataFormat.java| 27 +-
 .../jackson/JacksonMarshalAllowJMSTypeTest.java | 56 
 .../JacksonMarshalUnmarshalTypeHeaderTest.java  | 56 
 5 files changed, 176 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/619b1b9b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
index d72492a..73ef918 100644
--- 
a/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
+++ 
b/camel-core/src/main/java/org/apache/camel/model/dataformat/JsonDataFormat.java
@@ -48,6 +48,8 @@ public class JsonDataFormat extends DataFormatDefinition {
 private Class? jsonView;
 @XmlAttribute
 private String include;
+@XmlAttribute
+private Boolean allowJmsType;
 
 public JsonDataFormat() {
 }
@@ -104,6 +106,14 @@ public class JsonDataFormat extends DataFormatDefinition {
 this.include = include;
 }
 
+public Boolean getAllowJmsType() {
+return allowJmsType;
+}
+
+public void setAllowJmsType(Boolean allowJmsType) {
+this.allowJmsType = allowJmsType;
+}
+
 @Override
 protected DataFormat createDataFormat(RouteContext routeContext) {
 if (library == JsonLibrary.XStream) {
@@ -139,6 +149,9 @@ public class JsonDataFormat extends DataFormatDefinition {
 if (include != null) {
 setProperty(camelContext, dataFormat, include, include);
 }
+if (allowJmsType != null) {
+setProperty(camelContext, dataFormat, allowJmsType, 
allowJmsType);
+}
 }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/619b1b9b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JackconConstants.java
--
diff --git 
a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JackconConstants.java
 
b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JackconConstants.java
new file mode 100644
index 000..2e4890b
--- /dev/null
+++ 
b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JackconConstants.java
@@ -0,0 +1,25 @@
+/**
+ * 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.jackson;
+
+public final class JackconConstants {
+
+public static final String UNMARSHAL_TYPE = CamelJacksonUnmarshalType;
+
+private JackconConstants() {
+}
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/619b1b9b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
--
diff --git 
a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
 
b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/JacksonDataFormat.java
index a537e33..75a1d94 100644
--- 

[1/3] git commit: CAMEL-7619: Rest DSL - adding support for xml/json binding using Camel's data formats. Work in progress.

2014-07-22 Thread davsclaus
Repository: camel
Updated Branches:
  refs/heads/master a0b54c08c - f41a7e4d5


CAMEL-7619: Rest DSL - adding support for xml/json binding using Camel's data 
formats. Work in progress.


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

Branch: refs/heads/master
Commit: 52150ce0ab3c9d59234db4c4516aa24e05628dd8
Parents: a0b54c0
Author: Claus Ibsen davscl...@apache.org
Authored: Tue Jul 22 20:14:20 2014 +0200
Committer: Claus Ibsen davscl...@apache.org
Committed: Tue Jul 22 20:14:20 2014 +0200

--
 .../camel/model/rest/RestBindingDefinition.java | 120 +++
 .../apache/camel/model/rest/RestDefinition.java |  30 +
 .../apache/camel/model/rest/VerbDefinition.java |  22 
 .../processor/binding/RestBindingProcessor.java |  93 ++
 components/camel-restlet/pom.xml|  14 ++-
 .../RestRestletPostJsonJaxbPojoTest.java|  60 ++
 .../restlet/RestRestletPostJsonPojoTest.java|  60 ++
 .../restlet/RestRestletPostXmlJaxbPojoTest.java |  78 
 .../camel/component/restlet/UserJaxbPojo.java   |  48 
 .../camel/component/restlet/UserPojo.java   |  39 ++
 10 files changed, 563 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/camel/blob/52150ce0/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
--
diff --git 
a/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
 
b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
new file mode 100644
index 000..f1ef7a8
--- /dev/null
+++ 
b/camel-core/src/main/java/org/apache/camel/model/rest/RestBindingDefinition.java
@@ -0,0 +1,120 @@
+/**
+ * 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.model.rest;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Processor;
+import org.apache.camel.model.NoOutputDefinition;
+import org.apache.camel.processor.binding.RestBindingProcessor;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.IntrospectionSupport;
+
+@XmlRootElement(name = restBinding)
+@XmlAccessorType(XmlAccessType.FIELD)
+public class RestBindingDefinition extends NoOutputDefinition {
+
+@XmlAttribute
+private String jsonDataFormat;
+
+@XmlAttribute
+private String xmlDataFormat;
+
+@XmlAttribute
+private String classType;
+
+@XmlTransient
+private Class? resolvedClassType;
+
+@Override
+public String toString() {
+return RestBinding;
+}
+
+@Override
+public String getShortName() {
+return rest;
+}
+
+// TODO: allow to configure if json/jaxb is mandatory, or optional
+
+@Override
+public Processor createProcessor(RouteContext routeContext) throws 
Exception {
+CamelContext context = routeContext.getCamelContext();
+
+// setup json data format
+String name = jsonDataFormat;
+if (name == null) {
+name = json-jackson;
+}
+DataFormat json = context.resolveDataFormat(name);
+if (json == null) {
+throw new IllegalArgumentException(DataFormat  + name +  not 
found.);
+}
+if (resolvedClassType == null  classType != null) {
+resolvedClassType = 
context.getClassResolver().resolveMandatoryClass(classType);
+}
+if (resolvedClassType != null) {
+IntrospectionSupport.setProperty(context.getTypeConverter(), json, 
unmarshalType, 

[CONF] Apache Camel JSON

2014-07-22 Thread Claus Ibsen (Confluence)














  


Claus Ibsen edited the page:
 


JSON   






...



 Code Block




 dataFormats
  json id=json library=Jackson include=NOT_NULL/
/dataFormats 



 Unmarshalling from json to POJO with dynamic class name 
 Available as of Camel 2.14 
 If you use jackson to unmarshal json to POJO, then you can now specify a header in the message that indicate which class name to unmarshal to.  The header has key CamelJacksonUnmarshalTypeif that header is present in the message, then Jackson will use that as FQN for the POJO class to unmarshal the json payload as. Notice that behavior is enabled out of the box from Camel 2.14 onwards. 
 For JMS end users there is the JMSType header from the JMS spec that indicates that also. To enable support for JMSType you would need to turn that on, on the jackson data format as shown: 



 Code Block




 
JacksonDataFormat format = new JacksonDataFormat();
format.setAllowJmsType(true);
 



 Or from XML DSL you configure this as 



 Code Block




 
dataFormats
  json id=json library=Jackson allowJmsType=true/
/dataFormats
 



Dependencies for XStream
To use JSON in your camel routes you need to add the a dependency on camel-xstream which implements this data format.
...




  

[CONF] Apache Camel Camel 2.14.0 Release

2014-07-22 Thread Claus Ibsen (Confluence)














  


Claus Ibsen edited the page:
 


Camel 2.14.0 Release   






...

Support for running on Java 1.8 JVMs
Spring 4.x supported.
 REST DSL to define REST services using a REST style with verbs such as get/post/put/delete etc. The Rest DSL supports Java and XML DSL.
Simple language defined in routes using resultType as boolean is now evaluated as predicate instead of as _expression_.
Introduced RuntimeEndpointRegistry to capture runtime usage of endpoints in use during routing, such as dynamic endpoints from dynamic EIPs.
Added event notification for routes added and removed.
Allow to configure cache size in Recipient List, Routing Slip and Dynamic Router EIPs; and as well turn caching off.
 Netty HTTPproducer now supports the CamelHttpPath header to define a dynamic context-path and query parameters to call the remote http server. 
 Polling Consumerallows to configure initial queue size and whether to block when full when using the defaultEventDrivenPollingConsumer which most components does. We now block by default, as otherwise the message may be lost if the queue was full, and a new message was offered. 
 Added a generic callback to configure the APNS service builder. 
 AddedStreamList option to theJDBC component 
Allow to define Simple expressions for sql parameters of the SQL component.   
A new XML tokenizer that is truly XML-aware (e.g., supporting XML namespaces and complex hierarchical structures)
Added optionparallelAggregate to Multicast, Splitter and Recipient ListEIPs
Support to set the variable map from message header in Velocity, Freemarker, StringTemplate.
 Added HazelcastInstance option toHazelcast component. 
Producers from static EIPs such as to is is now also enlisted in JMX when Camel is starting routes.
 Unmarshal json to pojo usingcamel-jackson now supports a header to tell Camel what the pojo class name is, to allow more dynamic behavior, as otherwise the class name would be hardcoded. 
 Also allow to configurecamel-jackson to skip null values, by setting includes toNOT_NULL. 

Fixed Issues

Timer consumer is now scheduled after CamelContext has started all routes, to ensure other routes is running when timer routes is triggered to run.
 Netty HTTP now returns HTTP status 404 if resource not found instead of 503.
Fixed the MongoDBreadPreferenceoption which used to cause an IllegalArgumentExceptionto be thrown.
Fixed issue with Netty producer may leak 

svn commit: r917128 - in /websites/production/camel/content: book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache camel-2140-release.html json.html

2014-07-22 Thread buildbot
Author: buildbot
Date: Tue Jul 22 19:18:21 2014
New Revision: 917128

Log:
Production update by buildbot for camel

Modified:
websites/production/camel/content/book-dataformat-appendix.html
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/camel-2140-release.html
websites/production/camel/content/json.html

Modified: websites/production/camel/content/book-dataformat-appendix.html
==
--- websites/production/camel/content/book-dataformat-appendix.html (original)
+++ websites/production/camel/content/book-dataformat-appendix.html Tue Jul 22 
19:18:21 2014
@@ -919,7 +919,14 @@ format.setInclude(quot;NON_NULLquot;);
 script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[lt;dataFormatsgt;
   lt;json id=quot;jsonquot; library=quot;Jacksonquot; 
include=quot;NOT_NULLquot;/gt;
 lt;/dataFormatsgt;]]/script
-/div/divp#160;/ph3 
id=BookDataFormatAppendix-DependenciesforXStreamDependencies for 
XStream/h3pTo use JSON in your camel routes you need to add the a 
dependency on strongcamel-xstream/strong which implements this data 
format./ppIf you use maven you could just add the following to your 
pom.xml, substituting the version number for the latest amp; greatest release 
(see a shape=rect href=download.htmlthe download page for the latest 
versions/a)./pdiv class=code panel pdl style=border-width: 1px;div 
class=codeContent panelContent pdl
+/div/divh3 
id=BookDataFormatAppendix-UnmarshallingfromjsontoPOJOwithdynamicclassnameUnmarshalling
 from json to POJO with dynamic class name/h3pstrongAvailable as of Camel 
2.14/strong/ppIf you use jackson to unmarshal json to POJO, then you can 
now specify a header in the message that indicate which class name to unmarshal 
to.br clear=nonespan style=line-height: 1.4285715;The header has key 
/spancode style=line-height: 
1.4285715;CamelJacksonUnmarshalType/codespan style=line-height: 
1.4285715;#160;if that header is present in the message, then Jackson will 
use that as FQN for the POJO class to unmarshal the json payload as. Notice 
that behavior is enabled out of the box from Camel 2.14 
onwards.#160;/span/ppspan style=line-height: 
1.4285715;#160;/spanspan style=line-height: 1.4285715;For JMS end 
users there is the JMSType header from the JMS spec that indicates that also. 
To enable support for JMSType you would need to turn tha
 t on, on the jackson data format as shown:/span/pdiv class=code panel 
pdl style=border-width: 1px;div class=codeContent panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[JacksonDataFormat format = new 
JacksonDataFormat();
+format.setAllowJmsType(true);]]/script
+/div/divpOr from XML DSL you configure this as/pdiv class=code panel 
pdl style=border-width: 1px;div class=codeContent panelContent pdl
+script class=theme: Default; brush: java; gutter: false 
type=syntaxhighlighter![CDATA[lt;dataFormatsgt;
+  lt;json id=quot;jsonquot; library=quot;Jacksonquot; 
allowJmsType=quot;truequot;/gt;
+lt;/dataFormatsgt;]]/script
+/div/divh3 
id=BookDataFormatAppendix-DependenciesforXStreamDependencies for 
XStream/h3pTo use JSON in your camel routes you need to add the a 
dependency on strongcamel-xstream/strong which implements this data 
format./ppIf you use maven you could just add the following to your 
pom.xml, substituting the version number for the latest amp; greatest release 
(see a shape=rect href=download.htmlthe download page for the latest 
versions/a)./pdiv class=code panel pdl style=border-width: 1px;div 
class=codeContent panelContent pdl
 script class=theme: Default; brush: xml; gutter: false 
type=syntaxhighlighter![CDATA[lt;dependencygt;
   lt;groupIdgt;org.apache.camellt;/groupIdgt;
   lt;artifactIdgt;camel-xstreamlt;/artifactIdgt;

Modified: websites/production/camel/content/book-in-one-page.html
==
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Tue Jul 22 19:18:21 
2014
@@ -4153,11 +4153,11 @@ While not actual tutorials you might fin
 /div
 /div
 h2 id=BookInOnePage-PrefacePreface/h2pThis tutorial aims to guide the 
reader through the stages of creating a project which uses Camel to facilitate 
the routing of messages from a JMS queue to a a shape=rect 
class=external-link href=http://www.springramework.org; 
rel=nofollowSpring/a service. The route works in a synchronous fashion 
returning a response to the client./ppstyle type=text/css/*![CDATA[*/
-div.rbtoc1406031449524 {padding: 0px;}
-div.rbtoc1406031449524 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1406031449524 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1406056637850 {padding: 0px;}