[CONF] Apache Camel Simple

2011-07-26 Thread confluence







Simple
Page edited by Claus Ibsen


 Changes (1)
 




...
| out.headers.foo | Object | refer to the out header foo | | headerAs(_key_,_type_) | Type | *Camel 2.5:* Converts the header to the given type determined by its classname | 
| headers | Map | *Camel 2.9:* refer to the input headers | | in.headers | Map | *Camel 2.9:* refer to the input headers | 
| property.foo | Object | refer to the foo property on the exchange | | property.foo.*OGNL* | Object | *Camel 2.8:* refer to the foo property on the exchange and invoke its value using a Camel OGNL _expression_. | 
...


Full Content

Simple _expression_ Language

The Simple _expression_ Language was a really simple language you can use, but has since grown more powerful. Its primarily intended for being a really small and simple language for evaluating _expression_ and Predicate without requiring any new dependencies or knowledge of XPath; so its ideal for testing in camel-core. Its ideal to cover 95% of the common use cases when you need a little bit of _expression_ based script in your Camel routes.

However for much more complex use cases you are generally recommended to choose a more expressive and powerful language such as: 

	_javascript_
	EL
	OGNL
	Mvel
	Groovy
	one of the supported Scripting Languages



The simple language uses ${body} placeholders for complex expressions where the _expression_ contains constant literals. The ${ } placeholders can be omitted if the _expression_ is only the token itself.

Alternative syntaxFrom Camel 2.5 onwards you can also use the alternative syntax which uses $simple{ } as placeholders.
This can be used in situations to avoid clashes when using for example Spring property placeholder together with Camel.

Configuring result typeFrom Camel 2.8 onwards you can configure the result type of the Simple _expression_. For example to set the type as a java.lang.Boolean or a java.lang.Integer etc.

To get the body of the in message: "body", or "in.body" or "${body}".

A complex _expression_ must use ${ } placeholders, such as: "Hello ${in.header.name} how are you?".

You can have multiple tokens in the same _expression_: "Hello ${in.header.name} this is ${in.header.me} speaking".
However you can not nest tokens (i.e. having another ${ } placeholder in an existing, is not allowed).

File language is now merged with Simple languageFrom Camel 2.2 onwards, the File Language is now merged with Simple language which means you can use all the file syntax directly within the simple language.

Variables




 Variable 
 Type 
  Description 


 exchangeId 
 String 
 Camel 2.3: the exchange id 


 id 
 String 
 the input message id 


 body 
 Object 
 the input body 


 in.body 
 Object 
 the input body 


 body.OGNL 
 Object 
 Camel 2.3: the input body invoked using a Camel OGNL _expression_. 


 in.body.OGNL 
 Object 
 Camel 2.3: the input body invoked using a Camel OGNL _expression_. 


 bodyAs(type) 
 Type 
 Camel 2.3: Converts the body to the given type determined by its classname. The converted body can be null. 


 mandatoryBodyAs(type) 
 Type 
 Camel 2.5: Converts the body to the given type determined by its classname, and expects the body to be not null. 


 out.body 
 Object 
 the output body 


 header.foo 
 Object 
 refer to the input foo header 


 headers.foo 
 Object 
 refer to the input foo header 


 in.header.foo 
 Object 
 refer to the input foo header 


 in.headers.foo 
 Object 
 refer to the input foo header 


 header.foo[bar] 
 Object 
 Camel 2.3: regard input foo header as a map and perform lookup on the map with bar as key 


 in.header.foo[bar] 
 Object 
 Camel 2.3: regard input foo header as a map and perform lookup on the map with bar as key 


 in.headers.foo[bar] 
 Object 
 Camel 2.3: regard input foo header as a map and perform lookup on the map with bar as key 


 header.foo.OGNL 
 Object 
 Camel 2.3: refer to the input foo header and invoke its value using a Camel OGNL _expression_. 


 in.header.foo.OGNL 
 Object 
 Camel 2.3: refer to the input foo header and invoke its value using a Camel OGNL _expression_. 


 in.headers.foo.OGNL 
 Object 
 Camel 2.3: refer to the input foo header and invoke its value using a Camel OGNL _expression_. 


 out.header.foo 
 Object 
 refer to the out header foo 


 out.headers.foo 
 Object 
 refer to the out header foo 


 headerAs(key,type) 
 Type 
 Camel 2.5: Converts the header to the given type determined by its classname 


 headers 
 Map 
 Camel 2.9: refer to the input headers 


 in.headers 
 Map 
 Camel 2.9: refer to the input headers 


 property.foo 
 Object 
 refer to the foo property on the exchange 


 property.foo.OGNL 
 Object 
 Camel 2.8: refer to the foo property on the exchange and invoke its 

[CONF] Apache Camel Bean Binding

2011-07-26 Thread confluence







Bean Binding
Page edited by Claus Ibsen


 Changes (1)
 




...
{tip}  
Besides the message body, you can pass in the message headers as a {{java.util.Map}} type, and declare it as follows: {code}.bean(OrderService.class, doSomethingWithHeaders(${body}, ${headers})) {code}  
You can also pass in other fixed values than boolean values. For example to pass in an String and integer do as follows: {code} 
...


Full Content

Bean Binding

The Bean Binding in Camel defines both which methods are invoked and also how the Message is converted into the parameters of the method when it is invoked.

Choosing the method to invoke

The binding of a Camel Message to a bean method call can occur in different ways, order if importance:


	if the message contains the header CamelBeanMethodName then that method is invoked, converting the body to whatever the argument is to the method.
	
		From Camel 2.8 onwards you can qualify parameter types to exact pin-point which method to use when using overloaded methods with the same name (see further below for more details).
		From Camel 2.9 onwards you can specify parameter values directly in the method option (see further below for more details).
	
	
	the method name can be specified explicitly in the DSL or when using POJO Consuming or POJO Producing
	if the bean has a method that is marked with @Handler annotation then that method is selected
	if the bean can be converted to a Processor using the Type Converter mechanism then this is used to process the message. This mechanism is used by the ActiveMQ component to allow any JMS MessageListener to be invoked directly by Camel without having to write any integration glue code. You can use the same mechanism to integrate Camel into any other messaging/remoting frameworks.
	if the body of the message can be converted to a BeanInvocation (the default payload used by the ProxyHelper) - then that its used to invoke the method and pass the arguments
	otherwise the type of the method body is used to try find a method which matches; an error is thrown if a single method cannot be chosen unambiguously.
	you can also use Exchange as the parameter itself, but then the return type must be void.



In case where Camel will not be able to choose a method to invoke an AmbiguousMethodCallException is thrown. 

By default the return value is set on the outbound message body.


Parameter binding
When a method have been chosen to be invoked Camel will bind to the parameters of the method.

The following Camel specific types is automatic binded:

	org.apache.camel.Exchange
	org.apache.camel.Message
	org.apache.camel.CamelContext
	org.apache.camel.TypeConverter
	org.apache.camel.spi.Registry
	java.lang.Exception



So if you declare any of the given type above they will be provided by Camel. A note on the Exception is that it will bind to the caught exception of the Exchange. So its often usable if you use a Pojo to handle a given using using eg an onException route. 

What is most interresting is that Camel will also try to bind the body of the Exchange to the first parameter of the method signature (albeit not of any of the types above). So if we for instance declare e parameter as: String body then Camel will bind the IN body to this type. Camel will also automatic type convert to the given type declared.

Okay lets show some examples.

Below is just a simple method with a body binding. Camel will bind the IN body to the body parameter and convert it to a String type.


public String doSomething(String body)



And in this sample we got one of the automatic binded type as well, for instance the Registry that we can use to lookup beans.


public String doSomething(String body, Registry registry)



And we can also use Exchange as well:


public String doSomething(String body, Exchange exchange)



You can have multiple types as well


public String doSomething(String body, Exchange exchange, TypeConverter converter)



And imagine you use a Pojo to handle a given custom exception InvalidOrderException then we can bind that as well:
Notice we can bind to it even if we use a sub type of java.lang.Exception as Camel still knows its an exception and thus can bind the caused exception (if any exists).


public String badOrder(String body, InvalidOrderException invalid)



So what about headers and other stuff? Well now it gets a bit tricky so we can use annotations to help us, or specify the binding in the method name option.
See the following sections for more details.

Binding Annotations

You can use the Parameter Binding Annotations to customize how parameter values are created from the Message

Examples

For example a Bean such as:


public class Bar {

public String doSomething(String 

svn commit: r1150997 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/language/simple/SimpleLanguage.java test/java/org/apache/camel/component/bean/BeanParameterValueTest.java test/java/or

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 07:05:59 2011
New Revision: 1150997

URL: http://svn.apache.org/viewvc?rev=1150997view=rev
Log:
CAMEL-3961: Added headers to simple language to you can refer to the headers as 
a Map, and use that for bean parameter binding in the method name option.

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java

camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java?rev=1150997r1=1150996r2=1150997view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/language/simple/SimpleLanguage.java
 Tue Jul 26 07:05:59 2011
@@ -222,6 +222,11 @@ public class SimpleLanguage extends Simp
 return ExpressionBuilder.headerExpression(key, type);
 }
 
+// headers expression
+if (in.headers.equals(expression) || headers.equals(expression)) {
+return ExpressionBuilder.headersExpression();
+}
+
 // in header expression
 remainder = ifStartsWithReturnRemainder(in.headers, expression);
 if (remainder == null) {

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java?rev=1150997r1=1150996r2=1150997view=diff
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
 Tue Jul 26 07:05:59 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.bean;
 
+import java.util.Map;
+
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
@@ -73,6 +75,14 @@ public class BeanParameterValueTest exte
 assertMockEndpointsSatisfied();
 }
 
+public void testBeanParameterValueMap() throws Exception {
+getMockEndpoint(mock:result).expectedBodiesReceived(Hello World);
+
+template.sendBodyAndHeader(direct:heads, World, hello, Hello);
+
+assertMockEndpointsSatisfied();
+}
+
 @Override
 protected JndiRegistry createRegistry() throws Exception {
 JndiRegistry jndi = super.createRegistry();
@@ -108,6 +118,10 @@ public class BeanParameterValueTest exte
 from(direct:echo2)
 .to(bean:foo?method=echo(*, ${in.header.times}))
 .to(mock:result);
+
+from(direct:heads)
+.to(bean:foo?method=heads(${body}, ${headers}))
+.to(mock:result);
 }
 };
 }
@@ -133,5 +147,10 @@ public class BeanParameterValueTest exte
 
 return body;
 }
+
+public String heads(String body, Map headers) {
+return headers.get(hello) +   + body;
+}
+
 }
 }

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java?rev=1150997r1=1150996r2=1150997view=diff
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java 
(original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/language/SimpleTest.java 
Tue Jul 26 07:05:59 2011
@@ -411,6 +411,16 @@ public class SimpleTest extends Language
 }
 }
 
+public void testHeaders() throws Exception {
+Map headers = exchange.getIn().getHeaders();
+assertEquals(2, headers.size());
+
+assertExpression(headers, headers);
+assertExpression(${headers}, headers);
+assertExpression(in.headers, headers);
+assertExpression(${in.headers}, headers);
+}
+
 public void testHeaderAs() throws Exception {
 assertExpression(${headerAs(foo,String)}, abc);
 




svn commit: r1150999 - /camel/trunk/parent/pom.xml

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 07:11:40 2011
New Revision: 1150999

URL: http://svn.apache.org/viewvc?rev=1150999view=rev
Log:
Upgraded to jackson 1.8.4

Modified:
camel/trunk/parent/pom.xml

Modified: camel/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1150999r1=1150998r2=1150999view=diff
==
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Tue Jul 26 07:11:40 2011
@@ -93,7 +93,7 @@
 httpclient4-version4.1.1/httpclient4-version
 httpclient-version3.1/httpclient-version
 icu4j-version4.0.1/icu4j-version
-jackson-version1.8.2/jackson-version
+jackson-version1.8.4/jackson-version
 jain-sip-ri-bundle-version1.2.154_1/jain-sip-ri-bundle-version
 jasypt-version1.7/jasypt-version
 java-apns-version0.1.6/java-apns-version




svn commit: r1151000 - /camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 07:14:46 2011
New Revision: 1151000

URL: http://svn.apache.org/viewvc?rev=1151000view=rev
Log:
CAMEL-4265: Closing file resource after loading properties. Thanks to Edge Wang 
for the patch.

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java?rev=1151000r1=1150999r2=1151000view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
 Tue Jul 26 07:14:46 2011
@@ -24,6 +24,7 @@ import java.util.Map;
 import java.util.Properties;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.util.IOHelper;
 import org.apache.camel.util.ObjectHelper;
 
 /**
@@ -61,25 +62,42 @@ public class DefaultPropertiesResolver i
 }
 
 protected Properties loadPropertiesFromFilePath(CamelContext context, 
String path) throws IOException {
+Properties answer = null;
+
 if (path.startsWith(file:)) {
 path = ObjectHelper.after(path, file:);
 }
+
 InputStream is = new FileInputStream(path);
-Properties answer = new Properties();
-answer.load(is);
+try {
+answer = new Properties();
+answer.load(is);
+} finally {
+IOHelper.close(is);
+}
+
 return answer;
 }
 
 protected Properties loadPropertiesFromClasspath(CamelContext context, 
String path) throws IOException {
+Properties answer = null;
+
 if (path.startsWith(classpath:)) {
 path = ObjectHelper.after(path, classpath:);
 }
+
 InputStream is = context.getClassResolver().loadResourceAsStream(path);
 if (is == null) {
 throw new FileNotFoundException(Properties file  + path +  not 
found in classpath);
 }
-Properties answer = new Properties();
-answer.load(is);
+
+try {
+answer = new Properties();
+answer.load(is);
+} finally {
+IOHelper.close(is);
+}
+
 return answer;
 }
 




[CONF] Apache Camel Bean Binding

2011-07-26 Thread confluence







Bean Binding
Page edited by Claus Ibsen


 Changes (3)
 




...
So if you declare any of the given type above they will be provided by Camel. A *note* on the {{Exception}} is that it will bind to the caught exception of the [Exchange]. So its often usable if you use a [POJO] to handle a given using using eg an {{onException}} route.   
What is most interresting is that Camel will also try to bind the body of the [Exchange] to the first parameter of the method signature (albeit not of any of the types above). So if we for instance declare e parameter as: {{String body}} then Camel will bind the IN body to this type. Camel will also automatic type convert to the given type declared. 
 Okay lets show some examples. 
...
- The value is a numeric value such as {{123}} or {{7}} - The value is a String enclosed with either single or double quotes 
- The value is {{null}} which denotes a {{null} value 
- It can be evaluated using the [Simple] language, which means you can use eg body, header.foo and other [Simple] tokens.  
...
{tip}  
If you want to pass in a {{null} value, then you can explicit define this in the method option as shown below: {code}.to(bean:orderService?method=doSomething(null, true)) {code} By specifying {{null}} as a parameter value, it instructs Camel to force passing in a {{null}} value.  
Besides the message body, you can pass in the message headers as a {{java.util.Map}} type, and declare it as follows: {code} 
...


Full Content

Bean Binding

The Bean Binding in Camel defines both which methods are invoked and also how the Message is converted into the parameters of the method when it is invoked.

Choosing the method to invoke

The binding of a Camel Message to a bean method call can occur in different ways, order if importance:


	if the message contains the header CamelBeanMethodName then that method is invoked, converting the body to whatever the argument is to the method.
	
		From Camel 2.8 onwards you can qualify parameter types to exact pin-point which method to use when using overloaded methods with the same name (see further below for more details).
		From Camel 2.9 onwards you can specify parameter values directly in the method option (see further below for more details).
	
	
	the method name can be specified explicitly in the DSL or when using POJO Consuming or POJO Producing
	if the bean has a method that is marked with @Handler annotation then that method is selected
	if the bean can be converted to a Processor using the Type Converter mechanism then this is used to process the message. This mechanism is used by the ActiveMQ component to allow any JMS MessageListener to be invoked directly by Camel without having to write any integration glue code. You can use the same mechanism to integrate Camel into any other messaging/remoting frameworks.
	if the body of the message can be converted to a BeanInvocation (the default payload used by the ProxyHelper) - then that its used to invoke the method and pass the arguments
	otherwise the type of the method body is used to try find a method which matches; an error is thrown if a single method cannot be chosen unambiguously.
	you can also use Exchange as the parameter itself, but then the return type must be void.



In case where Camel will not be able to choose a method to invoke an AmbiguousMethodCallException is thrown. 

By default the return value is set on the outbound message body.


Parameter binding
When a method have been chosen to be invoked Camel will bind to the parameters of the method.

The following Camel specific types is automatic binded:

	org.apache.camel.Exchange
	org.apache.camel.Message
	org.apache.camel.CamelContext
	org.apache.camel.TypeConverter
	org.apache.camel.spi.Registry
	java.lang.Exception



So if you declare any of the given type above they will be provided by Camel. A note on the Exception is that it will bind to the caught exception of the Exchange. So its often usable if you use a Pojo to handle a given using using eg an onException route. 

What is most interesting is that Camel will also try to bind the body of the Exchange to the first parameter of the method signature (albeit not of any of the types above). So if we for instance declare e parameter as: String body then Camel will bind the IN body to this type. Camel will also automatic type convert to the given type declared.

Okay lets show some examples.

Below is just a simple method with a body binding. Camel will bind the IN body to the body parameter and convert it to a String type.


public String doSomething(String body)



And in this sample we got one of the automatic binded type 

svn commit: r1151027 - in /camel/trunk: components/camel-xmpp/pom.xml parent/pom.xml platforms/karaf/features/pom.xml

2011-07-26 Thread cmueller
Author: cmueller
Date: Tue Jul 26 09:03:56 2011
New Revision: 1151027

URL: http://svn.apache.org/viewvc?rev=1151027view=rev
Log:
CAMEL-4134: Upgrade to Smack 3.2.0 - Thanks Jean-Baptiste for the patch

Modified:
camel/trunk/components/camel-xmpp/pom.xml
camel/trunk/parent/pom.xml
camel/trunk/platforms/karaf/features/pom.xml

Modified: camel/trunk/components/camel-xmpp/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-xmpp/pom.xml?rev=1151027r1=1151026r2=1151027view=diff
==
--- camel/trunk/components/camel-xmpp/pom.xml (original)
+++ camel/trunk/components/camel-xmpp/pom.xml Tue Jul 26 09:03:56 2011
@@ -36,12 +36,11 @@
   /properties
 
   repositories
-   !-- Smack repo to grab new smack releases. We currently get smack from 
Central.
repository
-   idm2-repository-smack/id
-   nameSmakc Maven2 Repository/name
-   urlhttp://maven.reucon.com/public/url
-   /repository --
+   idm2-repository-smx/id
+   nameServiceMix Maven2 Repository/name
+   urlhttp://svn.apache.org/repos/asf/servicemix/m2-repo/url
+   /repository
   /repositories
 
   dependencies

Modified: camel/trunk/parent/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1151027r1=1151026r2=1151027view=diff
==
--- camel/trunk/parent/pom.xml (original)
+++ camel/trunk/parent/pom.xml Tue Jul 26 09:03:56 2011
@@ -137,7 +137,7 @@
 servicemix-specs-version1.8.0/servicemix-specs-version
 shiro-bundle-version1.1.0_1/shiro-bundle-version
 slf4j-version1.6.1/slf4j-version
-smack-version3.1.0/smack-version
+smack-version3.2.0/smack-version
 snmp4j-version1.8.1_3/snmp4j-version
 smpp-version2.1.0_1/smpp-version
 spring-integration-version2.0.5.RELEASE/spring-integration-version

Modified: camel/trunk/platforms/karaf/features/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/pom.xml?rev=1151027r1=1151026r2=1151027view=diff
==
--- camel/trunk/platforms/karaf/features/pom.xml (original)
+++ camel/trunk/platforms/karaf/features/pom.xml Tue Jul 26 09:03:56 2011
@@ -122,7 +122,7 @@
   jaxws.api.version2.2/jaxws.api.version
   servlet-api-2.5-version1.1.2/servlet-api-2.5-version
   serp-bundle-version1.13.1_2/serp-bundle-version
-  smack-bundle-version3.1.0_1/smack-bundle-version  
+  smack-bundle-version3.2.0_1-SNAPSHOT/smack-bundle-version
   spring-version3.0.5.RELEASE/spring-version
   spring-osgi-version1.2.1/spring-osgi-version
   spring-castor-bundle-version1.2.0/spring-castor-bundle-version




[CONF] Apache Camel Camel 2.9.0 Release

2011-07-26 Thread confluence







Camel 2.9.0 Release
Page edited by Christian Mueller


 Changes (1)
 




...
* Fixed issue with [Component]s or [Endpoint]s not being registered in [JMX|Camel JMX] when using [POJO Producing], [POJO Consuming] or other Camel bean annotations. * The [Bean] component now supports specifying parameter values to use directly in the method syntax. See more details at [Bean Binding]. For example to invoke a bean with body as first parameter, and a boolean true as second you can now do: {{.to(bean:myBean?method=myMethod(body, true))}} 
* Upgraded [XMPP] from Smack 3.1.0 to 3.2.0 
 h3. New [Enterprise Integration Patterns] 
...


Full Content

Camel 2.9.0 release (currently in progress)




New and Noteworthy

Welcome to the 2.9.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...)


	Fixed issue with Properties component may cache duplicates and thus take up unnecessary memory in the cache
	Fixed issue with Tracer out exchanges when using Asynchronous Processing by the Asynchronous Routing Engine
	Fixed issue with Components or Endpoints not being registered in JMX when using POJO Producing, POJO Consuming or other Camel bean annotations.
	The Bean component now supports specifying parameter values to use directly in the method syntax. See more details at Bean Binding. For example to invoke a bean with body as first parameter, and a boolean true as second you can now do: .to("bean:myBean?method=myMethod(body, true)")
	Upgraded XMPP from Smack 3.1.0 to 3.2.0



New Enterprise Integration Patterns

New Components

DSL Changes

New Annotations

New Data Formats

New Languages

New Examples

New Tutorials

API breaking

Known Issues


	The Tracer may not output all details for some situations such as when using onCompletion or intercept etc.
	The project cannot fully build the site using Maven (eg running "mvn site". There is no plan to make this work as the project do not use the maven site.



Important changes to consider when upgrading


	Removed ANT support for the Examples



Notice


	The camel-example-axis has been removed



Getting the Distributions

Binary Distributions




 Description 
 Download Link 
 PGP Signature file of download 


 Windows Distribution 
 apache-camel-2.9.0.zip 
 apache-camel-2.9.0.zip.asc 


 Unix/Linux/Cygwin Distribution 
 apache-camel-2.9.0.tar.gz 
 apache-camel-2.9.0.tar.gz.asc 




The above URLs use redirectionThe above URLs use the Apache Mirror system to redirect you to a suitable mirror for your download. Some users have experienced issues with some versions of browsers (e.g. some Safari browsers). If the download doesn't seem to work for you from the above URL then try using FireFox

Source Distributions




 Description 
 Download Link 
 PGP Signature file of download 


 Source for Windows 
 apache-camel-2.9.0-src.zip 
 apache-camel-2.9.0-src.zip.asc 








 Source for Unix/Linux/Cygwin 
 apache-camel-2.9.0-src.tar.gz 
 apache-camel-2.9.0-src.tar.gz.asc 





Getting the Binaries using Maven 2

To use this release in your maven project, the proper dependency configuration that you should use in your Maven POM is:


dependency
  groupIdorg.apache.camel/groupId
  artifactIdcamel-core/artifactId
  version2.9.0/version
/dependency



SVN Tag Checkout



svn co http://svn.apache.org/repos/asf/camel/tags/camel-2.9.0



Changelog

For a more detailed view of new features and bug fixes, see the:
TODO: Update link

	release notes for 2.9.0





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









svn commit: r1151048 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/ main/java/org/apache/camel/component/bean/ test/java/org/apache/camel/component/bean/

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 10:00:12 2011
New Revision: 1151048

URL: http://svn.apache.org/viewvc?rev=1151048view=rev
Log:
CAMEL-3961: Added support for explicit null parameter in method name option. 
Added better error message if simple language cannot parse the option name 
syntax.

Added:

camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
  - copied, changed from r1150997, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterValueTest.java
Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/ExpressionEvaluationException.java

camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java

camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/ExpressionEvaluationException.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/ExpressionEvaluationException.java?rev=1151048r1=1151047r2=1151048view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/ExpressionEvaluationException.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/ExpressionEvaluationException.java
 Tue Jul 26 10:00:12 2011
@@ -34,6 +34,12 @@ public class ExpressionEvaluationExcepti
 this.exchange = exchange;
 }
 
+public ExpressionEvaluationException(Expression expression, String 
message, Exchange exchange, Throwable cause) {
+super(message, cause);
+this.expression = expression;
+this.exchange = exchange;
+}
+
 public Expression getExpression() {
 return expression;
 }

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java?rev=1151048r1=1151047r2=1151048view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java
 Tue Jul 26 10:00:12 2011
@@ -60,6 +60,11 @@ public final class BeanHelper {
 return true;
 }
 
+// null is valid (to force a null value)
+if (value.equals(null)) {
+return true;
+}
+
 // simple language tokens is valid
 if (StringHelper.hasStartToken(value, simple)) {
 return true;

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java?rev=1151048r1=1151047r2=1151048view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
 Tue Jul 26 10:00:12 2011
@@ -33,6 +33,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Expression;
+import org.apache.camel.ExpressionEvaluationException;
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Pattern;
 import org.apache.camel.Processor;
@@ -389,7 +390,9 @@ public class MethodInfo {
 }
 
 // remember the value to use
-answer[i] = value;
+if (value != Void.TYPE) {
+answer[i] = value;
+}
 }
 
 return (T) answer;
@@ -397,6 +400,13 @@ public class MethodInfo {
 
 /**
  * Evaluate using parameter values where the values can be 
provided in the method name syntax.
+ * p/
+ * This methods returns accordingly:
+ * ul
+ * littnull/tt - if not a parameter value/li
+ * littVoid.TYPE/tt - if an explicit null, forcing Camel 
to pass in ttnull/tt for that given parameter/li
+ * lia non ttnull/tt value - if the parameter was a 
parameter value, and to be used/li
+ * /ul
  *
  * @since 2.9
  */
@@ -422,8 +432,23 @@ public class MethodInfo {
 }
 
 // use simple language to evaluate the expression, as it 
may use the simple language to refer to message body, headers etc.
-parameterValue = 
exchange.getContext().resolveLanguage(simple).createExpression(exp).evaluate(exchange,
 Object.class);
+Expression expression = 

svn commit: r1151054 - /camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java

2011-07-26 Thread cmueller
Author: cmueller
Date: Tue Jul 26 10:21:11 2011
New Revision: 1151054

URL: http://svn.apache.org/viewvc?rev=1151054view=rev
Log:
CAMEL-4264: The routeContext stack of DefaultUnitOfWork should be thread safe - 
Thanks Matthias for pointing this out

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java?rev=1151054r1=1151053r2=1151054view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultUnitOfWork.java
 Tue Jul 26 10:21:11 2011
@@ -141,8 +141,10 @@ public class DefaultUnitOfWork implement
 if (transactedBy != null) {
 transactedBy.clear();
 }
-if (!routeContextStack.isEmpty()) {
-routeContextStack.clear();
+synchronized (routeContextStack) {
+if (!routeContextStack.isEmpty()) {
+routeContextStack.clear();
+}
 }
 if (subUnitOfWorks != null) {
 subUnitOfWorks.clear();
@@ -270,7 +272,7 @@ public class DefaultUnitOfWork implement
 }
 
 public void pushRouteContext(RouteContext routeContext) {
-synchronized (routeContext) {
+synchronized (routeContextStack) {
 routeContextStack.add(routeContext);
 }
 }




[CONF] Apache Camel Articles

2011-07-26 Thread confluence







Articles
Page edited by Claus Ibsen


 Changes (1)
 




...
* [Using NetBeans 7.0 to create a new Apache Camel project|http://coders-unite.blogspot.com/2011/07/using-netbeans-70-to-create-new-project.html] shows how to start from scratch in NetBeans to setup a Apache Camel project (tutorial style with screenshots) * [Using NetBeans 7.0 to create a new Apache Camel project without Spring dependency|http://coders-unite.blogspot.com/2011/07/using-netbeans-70-to-create-apache.html] shows how to start from scratch in NetBeans to setup a Apache Camel project (tutorial style with screenshots) without any Spring dependency 
* [Error handling in Camel for JMS consumer endpoint|http://tmielke.blogspot.com/2011/07/error-handling-in-camel-for-jms.html] by Torsten Mielke explains some of the options you have for error handling when using [JMS]. 
  
...


Full Content

See alsoSee also Camel User Stories.

Articles on Apache Camel

	Wanna try our Apache Camel developer tools for Enterprise Integration Patterns?  by James Strachan
	A bit more meat: Camel applied : JMS to File by Mike McLean
	Matteo wrote a blog entry about using Camel with iBatis
	Knowledge Tree integration using Apache Camel
	Integrating Apache Camel with JBoss ESB by Edgar Ankiewsky
	Simple DSL OSGi bundle example by Andrej Koelewijn
	Realization of EAI Patterns with Apache Camel by Pascal Kolb at the Universität Stuttgart
	Spring Remoting with JMS Example on Amin Abbaspour's Weblog
	Implementing Fuji integration scenario using Camel SE by Louis Polycarpou on using Camel with Open ESB
	Using the Camel aggregator correctly by Torsten Mielke, a great blog entry how to use the Camel aggregator.
	Camel routes and HL7 by Roger Searjeant on using Camel and its HL7 support in the health care space.
	Combining ApacheCamel+BSF to make JBoss ESB polyglot by Edgard Ankiewsky Silva, a JBoss employeer.
	Groovy and Grape - easiest way to send gtalk message with Apache Camel by Andrej Koelewijn how easy it is to use Groovy and Grape to quickly try out new frameworks such as Apache Camel.
	Domain-Specific Languages (DSLs) in Apache Camel (Spanish) by Gema Perdiguero, Tecsisa.
	Apache Camel integration in ServiceMix (Spanish) by Sebastián Gómez, Tecsisa.
	Open Source Integration with Apache Camel and How Fuse IDE Can Help by Jonathan Anstey. Updated article of the  Apache Camel: Integration Nirvana. Great for learning what Camel is and what it can do
	Leverage EIP with Apache Camel and Twitter by Bruno Borges
	Apache Camel Reference Card at DZone (the first card out of two) by Claus Ibsen
	Updated Apache Camel Reference Card at DZone by Claus Ibsen, updated for Camel 2.x Reference Card
	Using RSS with Apache Camel by Jeroen Reijn
	Using Groovy and Camel to pool Google Analyst email reports by Mr. Haki
	Using grails-camel plugin to work with Camel in Grails land by Mr. Haki
	Send mail with Apache Camel from Gails by Mr. Haki
	Navigating the Integration Landscape - Claus Ibsen on Apache Camel Claus Ibsen was interviewed at DZone discussing the integration landscape
	Apache Camel: Enterprise Integration met scripttalen en DSLs (Dutch) by Peter Maas, Finalist IT Group.
	Axis 2 ride with Camel how to use Axis 2 with the Camel report incident tutorial by Sagara
	Introduction to the Open eHealth Integration Platform (based on top of Apache Camel) Excellent DZone article by Martin Krasser
	An IRC alerter written using Apache Camel and Java how to easily integrate IRC with Camel to monitor and do alerts.
	Entreprise Integration Pattern with Apache Camel 2.0 by Julien Dechmann, how to use Camel to split and transform CSV files to POJO and XML and sending to a JMS destination
	A Camel based XML payload HTTP polling provider by Christopher Hunt to use Camel with AJAX. Interesting read.
	Camel vs. JBI by Adrian Trenaman.
	Things to consider when selecting between Apache Camel and Apache Servicemix by Ashwin Karpe
	Groovy and Camel for monitoring ActiveMQ by Eric Hauser how to monitor AMQ Advisory queues from a single groovy file.
	Camellos - Discovering Apache Camel by Gunnar Hillert. A very nice and short blog series about Camel showing its powers in a simple and intuitive way. Highly recommended for new users
	Apache Camel alternatives by Gunnar Hillert. He presents a brief overview of other projects in the integration space.
	First steps with Apache Camel on Google App Engine by Martin Krasser posts his findings to get Camel running on the GAE.
	A jira notification system for irc using Camel by Guillaume Nodet - all code is in a single XML hot deployed in Apache Karaf.
	Camel, CXF and JMS by Example by Silvester van der Bijl. Good blog entry how to use CXF and Camel together.
	A simple file monitoring console with camel, 

[CONF] Apache Camel Camel 2.9.0 Release

2011-07-26 Thread confluence







Camel 2.9.0 Release
Page edited by Christian Mueller


 Changes (1)
 




...
* The [Bean] component now supports specifying parameter values to use directly in the method syntax. See more details at [Bean Binding]. For example to invoke a bean with body as first parameter, and a boolean true as second you can now do: {{.to(bean:myBean?method=myMethod(body, true))}} * Upgraded [XMPP] from Smack 3.1.0 to 3.2.0 
* Fixed issue which cause DefaultUnitOfWork to throw a java.util.EmptyStackException 
 h3. New [Enterprise Integration Patterns] 
...


Full Content

Camel 2.9.0 release (currently in progress)




New and Noteworthy

Welcome to the 2.9.0 release which approx XXX issues resolved (new features, improvements and bug fixes such as...)


	Fixed issue with Properties component may cache duplicates and thus take up unnecessary memory in the cache
	Fixed issue with Tracer out exchanges when using Asynchronous Processing by the Asynchronous Routing Engine
	Fixed issue with Components or Endpoints not being registered in JMX when using POJO Producing, POJO Consuming or other Camel bean annotations.
	The Bean component now supports specifying parameter values to use directly in the method syntax. See more details at Bean Binding. For example to invoke a bean with body as first parameter, and a boolean true as second you can now do: .to("bean:myBean?method=myMethod(body, true)")
	Upgraded XMPP from Smack 3.1.0 to 3.2.0
	Fixed issue which cause DefaultUnitOfWork to throw a java.util.EmptyStackException



New Enterprise Integration Patterns

New Components

DSL Changes

New Annotations

New Data Formats

New Languages

New Examples

New Tutorials

API breaking

Known Issues


	The Tracer may not output all details for some situations such as when using onCompletion or intercept etc.
	The project cannot fully build the site using Maven (eg running "mvn site". There is no plan to make this work as the project do not use the maven site.



Important changes to consider when upgrading


	Removed ANT support for the Examples



Notice


	The camel-example-axis has been removed



Getting the Distributions

Binary Distributions




 Description 
 Download Link 
 PGP Signature file of download 


 Windows Distribution 
 apache-camel-2.9.0.zip 
 apache-camel-2.9.0.zip.asc 


 Unix/Linux/Cygwin Distribution 
 apache-camel-2.9.0.tar.gz 
 apache-camel-2.9.0.tar.gz.asc 




The above URLs use redirectionThe above URLs use the Apache Mirror system to redirect you to a suitable mirror for your download. Some users have experienced issues with some versions of browsers (e.g. some Safari browsers). If the download doesn't seem to work for you from the above URL then try using FireFox

Source Distributions




 Description 
 Download Link 
 PGP Signature file of download 


 Source for Windows 
 apache-camel-2.9.0-src.zip 
 apache-camel-2.9.0-src.zip.asc 








 Source for Unix/Linux/Cygwin 
 apache-camel-2.9.0-src.tar.gz 
 apache-camel-2.9.0-src.tar.gz.asc 





Getting the Binaries using Maven 2

To use this release in your maven project, the proper dependency configuration that you should use in your Maven POM is:


dependency
  groupIdorg.apache.camel/groupId
  artifactIdcamel-core/artifactId
  version2.9.0/version
/dependency



SVN Tag Checkout



svn co http://svn.apache.org/repos/asf/camel/tags/camel-2.9.0



Changelog

For a more detailed view of new features and bug fixes, see the:
TODO: Update link

	release notes for 2.9.0





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









svn commit: r1151059 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/component/bean/MethodInfo.java test/java/org/apache/camel/component/bean/BeanParameterNoBeanBindingTest.java

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 10:45:12 2011
New Revision: 1151059

URL: http://svn.apache.org/viewvc?rev=1151059view=rev
Log:
CAMEL-3961: Improved error message if invalid arguments when invoking bean 
using bean component.

Added:

camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterNoBeanBindingTest.java
  - copied, changed from r1151048, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java?rev=1151059r1=1151058r2=1151059view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/MethodInfo.java
 Tue Jul 26 10:45:12 2011
@@ -37,6 +37,7 @@ import org.apache.camel.ExpressionEvalua
 import org.apache.camel.NoTypeConversionAvailableException;
 import org.apache.camel.Pattern;
 import org.apache.camel.Processor;
+import org.apache.camel.RuntimeExchangeException;
 import org.apache.camel.impl.ExpressionAdapter;
 import org.apache.camel.processor.DynamicRouter;
 import org.apache.camel.processor.RecipientList;
@@ -329,7 +330,11 @@ public class MethodInfo {
 }
 
 protected Object invoke(Method mth, Object pojo, Object[] arguments, 
Exchange exchange) throws IllegalAccessException, InvocationTargetException {
-return mth.invoke(pojo, arguments);
+try {
+return mth.invoke(pojo, arguments);
+} catch (IllegalArgumentException e) {
+throw new RuntimeExchangeException(IllegalArgumentException 
occurred invoking method:  + mth +  using arguments:  + 
Arrays.asList(arguments), exchange, e);
+}
 }
 
 protected Expression createParametersExpression() {

Copied: 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterNoBeanBindingTest.java
 (from r1151048, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterNoBeanBindingTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterNoBeanBindingTest.javap1=camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.javar1=1151048r2=1151059rev=1151059view=diff
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterInvalidValueTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanParameterNoBeanBindingTest.java
 Tue Jul 26 10:45:12 2011
@@ -16,19 +16,16 @@
  */
 package org.apache.camel.component.bean;
 
-import java.util.Map;
-
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.ExpressionEvaluationException;
-import org.apache.camel.NoTypeConversionAvailableException;
+import org.apache.camel.RuntimeExchangeException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.JndiRegistry;
 
 /**
  *
  */
-public class BeanParameterInvalidValueTest extends ContextTestSupport {
+public class BeanParameterNoBeanBindingTest extends ContextTestSupport {
 
 public void testBeanParameterInvalidValueA() throws Exception {
 getMockEndpoint(mock:result).expectedMessageCount(0);
@@ -37,49 +34,10 @@ public class BeanParameterInvalidValueTe
 template.sendBody(direct:a, World);
 fail(Should have thrown exception);
 } catch (CamelExecutionException e) {
-NoTypeConversionAvailableException cause = 
assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause());
-assertEquals(String.class, cause.getFromType());
-assertEquals(int.class, cause.getToType());
-assertEquals(A, cause.getValue());
-}
-
-assertMockEndpointsSatisfied();
-}
-
-public void testBeanParameterInvalidValueB() throws Exception {
-getMockEndpoint(mock:result).expectedMessageCount(0);
-
-try {
-template.sendBody(direct:b, World);
-fail(Should have thrown exception);
-} catch (CamelExecutionException e) {
-NoTypeConversionAvailableException cause = 
assertIsInstanceOf(NoTypeConversionAvailableException.class, e.getCause());
-assertEquals(String.class, cause.getFromType());
-assertEquals(int.class, cause.getToType());
-

[CONF] Apache Camel Add New Component Guide

2011-07-26 Thread confluence







Add New Component Guide
Page edited by Christian Mueller


 Changes (7)
 




...
If you would like to contribute a new component as a patch (we love contributions), please refer to [Contributing|http://camel.apache.org/contributing.html] (look for {{Creating patches}}) for instructions.  
h2. 34. Add the new component 
Add the new component into the components pom modules section (note the alphabetical order of the project names). After that, add the new component to the components folder.  
h2. 45. Check the sources and resources 
The source and resources have to follow some Apache/Camel coding rules: - Make sure every added source and resource contains the Apache license header. 
...
- Make sure the log output is adequate on the INFO log level.  
h2. 56. Check whether all dependencies are available as OSGI bundles 
If a dependency is not available as an OSGI bundle, ask the Apache Servicemix guys for an OSGI-fied version of this dependency. You should do this by opening a JIRA issue at https://issues.apache.org/jira/browse/SMX4 The issue type should be Task. A sample can be found here: https://issues.apache.org/jira/browse/SMX4-723  
h2. 67. Add a new feature 
Add a new feature definition for this component to the feature file (under platforms/karaf/features). Next, validate the correctness of this feature file as described in [Working with features|http://camel.apache.org/building.html] (look for {{Working with features}})  
h2. 78. Add the wiki page 
Each component requires its own wiki page to document the component. If you dont have the *karma* to edit the wiki pages, plese refer to [how do I edit the website|http://camel.apache.org/how-do-i-edit-the-website.html]. Add the new component wiki page to the [Components|https://cwiki.apache.org/confluence/display/CAMEL/Components] list by editing [Component List|https://cwiki.apache.org/confluence/display/CAMEL/Component+List] wiki page. 
...
Check whether other sites needs to be updated.  
h2. 89. Run a complete build 
To ensure you do not break the build, run a complete build from the new component directory: {code} 
...
{code}  
h2. 9. 10. Add the component to distribution 
Add the new component to the following files - parent/pom.xml 
...


Full Content

How to add a new component

1. Open an JIRA issue
Open a JIRA issue at https://issues.apache.org/jira/browse/CAMEL, if does not already exist.
The issue type should be "New Feature". A sample can be found here: https://issues.apache.org/jira/browse/CAMEL-3468

2. Check the license of all dependencies
You have to check whether or not all required dependencies have an Apache compatible license.
Please refer to Third-Party Licensing Policy for detailed information and acceptable licenses.
This doesn't mean, if one of the dependencies are not compatible with the Apache license we can't accept the component. In this case, we might have to add the component to the Camel-Extra repository.

3. Providing a patch
If you would like to contribute a new component as a patch (we love contributions), please refer to Contributing (look for Creating patches) for instructions.

4. Add the new component
Add the new component into the components pom modules section (note the alphabetical order of the project names).
After that, add the new component to the components folder.

5. Check the sources and resources
The source and resources have to follow some Apache/Camel coding rules:

	Make sure every added source and resource contains the Apache license header.
	Make sure the new component has an adequate test coverage.
	Run a build with checkstyle to ensure the sources are conform with the Apache Camel coding rules: Building Camel (look for Building with checkstyle)
	Make sure the log output is adequate on the INFO log level.



6. Check whether all dependencies are available as OSGI bundles
If a dependency is not available as an OSGI bundle, ask the Apache Servicemix guys for an OSGI-fied version of this dependency. You should do this by opening a JIRA issue at https://issues.apache.org/jira/browse/SMX4
The issue type should be "Task". A sample can be found here: https://issues.apache.org/jira/browse/SMX4-723

7. Add a new feature
Add a new feature definition for this component to the feature file (under platforms/karaf/features).
Next, validate the correctness of this feature file as described in Working with features (look for Working with features)

8. Add the wiki page
Each component requires its own wiki page to document the component. If you don't 

svn commit: r1151087 - /camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 13:25:27 2011
New Revision: 1151087

URL: http://svn.apache.org/viewvc?rev=1151087view=rev
Log:
CAMEL-4269: Ftp consumer on disconnect should eager set loggedIn flag to false, 
in case the ftp API may not properly disconnect, causing the next pool to fail. 
Thanks to Marek for the patch.

Modified:

camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java

Modified: 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java?rev=1151087r1=1151086r2=1151087view=diff
==
--- 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
 (original)
+++ 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
 Tue Jul 26 13:25:27 2011
@@ -90,10 +90,12 @@ public abstract class RemoteFileConsumer
 }
 
 protected void disconnect() {
-// disconnect when stopping
+// eager indicate we are no longer logged in
+loggedIn = false;
+
+// disconnect
 try {
 if (getOperations().isConnected()) {
-loggedIn = false;
 if (log.isDebugEnabled()) {
 log.debug(Disconnecting from: {}, remoteServer());
 }
@@ -101,7 +103,7 @@ public abstract class RemoteFileConsumer
 }
 } catch (GenericFileOperationFailedException e) {
 // ignore just log a warning
-log.warn(e.getMessage());
+log.warn(Error occurred while disconnecting from  + 
remoteServer() +  due:  + e.getMessage() + . This exception will be 
ignored.);
 }
 }
 




svn commit: r1151107 - /camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeAlterFileNameHeaderIssueTest.java

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 14:16:54 2011
New Revision: 1151107

URL: http://svn.apache.org/viewvc?rev=1151107view=rev
Log:
CAMEL-4270: Added unit test

Added:

camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeAlterFileNameHeaderIssueTest.java
  - copied, changed from r1151087, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.java

Copied: 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeAlterFileNameHeaderIssueTest.java
 (from r1151087, 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeAlterFileNameHeaderIssueTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeAlterFileNameHeaderIssueTest.javap1=camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.javar1=1151087r2=1151107rev=1151107view=diff
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeAlterFileNameHeaderIssueTest.java
 Tue Jul 26 14:16:54 2011
@@ -24,35 +24,125 @@ import org.apache.camel.builder.RouteBui
 import org.apache.camel.component.mock.MockEndpoint;
 
 /**
- * Unit test for consuming the same filename only.
+ *
  */
-public class FileConsumeCharsetTest extends ContextTestSupport {
+public class FileConsumeAlterFileNameHeaderIssueTest extends 
ContextTestSupport {
 
 @Override
 protected void setUp() throws Exception {
 deleteDirectory(target/files);
 super.setUp();
-template.sendBodyAndHeader(file://target/files?charset=UTF-8, Hello 
World \u4f60\u597d, Exchange.FILE_NAME, report.txt);
 }
 
-public void testConsumeAndDelete() throws Exception {
+@Override
+public boolean isUseRouteBuilder() {
+return false;
+}
+
+public void testConsumeAndDeleteRemoveAllHeaders() throws Exception {
+context.addRoutes(new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from(file://target/files?delete=true)
+// remove all headers
+.removeHeaders(*)
+.to(mock:result);
+}
+});
+context.start();
+
 MockEndpoint mock = getMockEndpoint(mock:result);
-mock.expectedBodiesReceived(Hello World \u4f60\u597d);
+mock.expectedBodiesReceived(Hello World);
+
+template.sendBodyAndHeader(file://target/files, Hello World, 
Exchange.FILE_NAME, hello.txt);
 
 assertMockEndpointsSatisfied();
+oneExchangeDone.matchesMockWaitTime();
+
+assertFalse(Headers should have been removed, 
mock.getExchanges().get(0).getIn().hasHeaders());
+
+// the original file should have been deleted, as the file consumer 
should be resilient against
+// end users deleting headers
+assertFalse(File should been deleted, new 
File(target/files/hello.txt).getAbsoluteFile().exists());
+}
+
+public void testConsumeAndDeleteChangeFileHeader() throws Exception {
+context.addRoutes(new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+from(file://target/files?delete=true)
+// change file header
+.setHeader(Exchange.FILE_NAME, constant(bye.txt))
+.to(mock:result);
+}
+});
+context.start();
+
+MockEndpoint mock = getMockEndpoint(mock:result);
+mock.expectedBodiesReceived(Hello World);
+mock.expectedHeaderReceived(Exchange.FILE_NAME, bye.txt);
+
+template.sendBodyAndHeader(file://target/files, Hello World, 
Exchange.FILE_NAME, hello.txt);
 
+assertMockEndpointsSatisfied();
 oneExchangeDone.matchesMockWaitTime();
 
-// file should not exists
-assertFalse(File should been deleted, new 
File(target/files/report.txt).getAbsoluteFile().exists());
+// the original file should have been deleted, as the file consumer 
should be resilient against
+// end users changing headers
+assertFalse(File should been deleted, new 
File(target/files/hello.txt).getAbsoluteFile().exists());
 }
 
-@Override
-protected RouteBuilder createRouteBuilder() throws Exception {
-return new RouteBuilder() {
+public void testConsumeAndMoveRemoveAllHeaders() throws Exception {
+context.addRoutes(new RouteBuilder() {
+@Override
 public void configure() throws Exception {
-

[CONF] Apache Camel Cometd

2011-07-26 Thread confluence







Cometd
Page
comment added by  GUYOT Alexandre



   In options : resourceBase is not reconized in the new version it renamed "baseResource" !




   
Change Notification Preferences
   
   View Online
  |
   Reply To This
   









[CONF] Apache Camel Cometd

2011-07-26 Thread confluence







Cometd
Comment edited by GUYOT Alexandre
 :

Changes (2)





In options : resourceBase is not reconized in the new version it renamed baseResource ! baseResource. 
(I work with camel 2.7.1 and resourceBase doesnt work, you need to use baseResource) 


Full Content
  
In options : resourceBase is not reconized in the new version it renamed "baseResource".
(I work with camel 2.7.1 and resourceBase doesn't work, you need to use "baseResource")



   
Change Notification Preferences
   
   View Online
  |
   Reply To This
   









[CONF] Apache Camel Cometd

2011-07-26 Thread confluence







Cometd
Page edited by Claus Ibsen


 Changes (2)
 




...
{div:class=confluenceTableSmall} || Name || Default Value || Description || 
| {{resourceBase}}  | | The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar. Notice this option has been renamed to {{baseResource}} from *Camel 2.8* onwards. | 
| {{baseResource}} | | *Camel 2.8:* The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar | 
| {{timeout}} | {{24}} | The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. | | {{interval}} |  {{0}}  | The client side poll timeout in milliseconds. How long a client will wait between reconnects| 
...


Full Content

Cometd Component

The cometd: component is a transport for working with the jetty implementation of the cometd/bayeux protocol.
Using this component in combination with the dojo toolkit library it's possible to push Camel messages directly into the browser using an AJAX based mechanism.

Maven users will need to add the following dependency to their pom.xml for this component:


dependency
groupIdorg.apache.camel/groupId
artifactIdcamel-cometd/artifactId
versionx.x.x/version
!-- use the same version as your Camel core version --
/dependency



URI format



cometd://host:port/channelName[?options]



The channelName represents a topic that can be subscribed to by the Camel endpoints.

Examples

cometd://localhost:8080/service/mychannel
cometds://localhost:8443/service/mychannel


where cometds: represents an SSL configured endpoint.

See this blog entry by David Greco who contributed this component to Apache Camel, for a full sample. 

Options



 Name 
 Default Value 
 Description 


 resourceBase  

 The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar. Notice this option has been renamed to baseResource from Camel 2.8 onwards. 


 baseResource 

 Camel 2.8: The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar 


 timeout 
 24 
 The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. 


 interval 
  0  
 The client side poll timeout in milliseconds. How long a client will wait between reconnects


 maxInterval 
 3 
 The max client side poll timeout in milliseconds. A client will be removed if a connection is not received in this time. 


 multiFrameInterval   
 1500 
 The client side poll timeout, if multiple connections are detected from the same browser. 


 jsonCommented 
 true 
  If true, the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment. This is a defence against Ajax Hijacking. 


 logLevel 
 1 
 0=none, 1=info, 2=debug. 





You can append query options to the URI in the following format, ?option=valueoption=value...

Here is some examples on How to pass the parameters

For file (for webapp resources located in the Web Application directory -- cometd://localhost:8080?resourceBase=file./webapp
For classpath (when by example the web resources are packaged inside the webapp folder -- cometd://localhost:8080?resourceBase=classpath:webapp

Authentication
Available as of Camel 2.8

You can configure custom SecurityPolicy and Extension's to the CometdComponent which allows you to use authentication as documented here

See Also

	Configuring Camel
	Component
	Endpoint
	Getting Started





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









[CONF] Apache Camel Cometd

2011-07-26 Thread confluence







Cometd
Page edited by Claus Ibsen


 Changes (2)
 




...
{div:class=confluenceTableSmall} || Name || Default Value || Description || 
| {{resourceBase}}  | | The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar. Notice this option has been renamed to {{baseResource}} from *Camel 2.87* onwards. | 
| {{baseResource}} | | *Camel 2.87:* The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar | 
| {{timeout}} | {{24}} | The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. | | {{interval}} |  {{0}}  | The client side poll timeout in milliseconds. How long a client will wait between reconnects| 
...


Full Content

Cometd Component

The cometd: component is a transport for working with the jetty implementation of the cometd/bayeux protocol.
Using this component in combination with the dojo toolkit library it's possible to push Camel messages directly into the browser using an AJAX based mechanism.

Maven users will need to add the following dependency to their pom.xml for this component:


dependency
groupIdorg.apache.camel/groupId
artifactIdcamel-cometd/artifactId
versionx.x.x/version
!-- use the same version as your Camel core version --
/dependency



URI format



cometd://host:port/channelName[?options]



The channelName represents a topic that can be subscribed to by the Camel endpoints.

Examples

cometd://localhost:8080/service/mychannel
cometds://localhost:8443/service/mychannel


where cometds: represents an SSL configured endpoint.

See this blog entry by David Greco who contributed this component to Apache Camel, for a full sample. 

Options



 Name 
 Default Value 
 Description 


 resourceBase  

 The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar. Notice this option has been renamed to baseResource from Camel 2.7 onwards. 


 baseResource 

 Camel 2.7: The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar 


 timeout 
 24 
 The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. 


 interval 
  0  
 The client side poll timeout in milliseconds. How long a client will wait between reconnects


 maxInterval 
 3 
 The max client side poll timeout in milliseconds. A client will be removed if a connection is not received in this time. 


 multiFrameInterval   
 1500 
 The client side poll timeout, if multiple connections are detected from the same browser. 


 jsonCommented 
 true 
  If true, the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment. This is a defence against Ajax Hijacking. 


 logLevel 
 1 
 0=none, 1=info, 2=debug. 





You can append query options to the URI in the following format, ?option=valueoption=value...

Here is some examples on How to pass the parameters

For file (for webapp resources located in the Web Application directory -- cometd://localhost:8080?resourceBase=file./webapp
For classpath (when by example the web resources are packaged inside the webapp folder -- cometd://localhost:8080?resourceBase=classpath:webapp

Authentication
Available as of Camel 2.8

You can configure custom SecurityPolicy and Extension's to the CometdComponent which allows you to use authentication as documented here

See Also

	Configuring Camel
	Component
	Endpoint
	Getting Started





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









[CONF] Apache Camel Cometd

2011-07-26 Thread confluence







Cometd
Page
comment added by  Claus Ibsen



   Thanks I have fixed this



In reply to a comment by GUYOT Alexandre:
In options : resourceBase is not reconized in the new version it renamed "baseResource".
(I work with camel 2.7.1 and resourceBase doesn't work, you need to use "baseResource")



   
Change Notification Preferences
   
   View Online
  |
   Reply To This
   









svn commit: r1151126 - in /camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc: JdbcEndpoint.java JdbcProducer.java

2011-07-26 Thread ningjiang
Author: ningjiang
Date: Tue Jul 26 15:05:42 2011
New Revision: 1151126

URL: http://svn.apache.org/viewvc?rev=1151126view=rev
Log:
 CAMEL-4272 camel-jdbc should provide a option not set the autoCommit flag

Modified:

camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java

camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java

Modified: 
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java?rev=1151126r1=1151125r2=1151126view=diff
==
--- 
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcEndpoint.java
 Tue Jul 26 15:05:42 2011
@@ -31,6 +31,7 @@ import org.apache.camel.impl.DefaultEndp
 public class JdbcEndpoint extends DefaultEndpoint {
 private int readSize;
 private boolean transacted;
+private boolean resetAutoCommit = true;
 private DataSource dataSource;
 private MapString, Object parameters;
 private boolean useJDBC4ColumnNameAndLabelSemantics = true;
@@ -71,6 +72,14 @@ public class JdbcEndpoint extends Defaul
 this.transacted = transacted;
 }
 
+public boolean isResetAutoCommit() {
+return resetAutoCommit;
+}
+
+public void setResetAutoCommit(boolean resetAutoCommit) {
+this.resetAutoCommit = resetAutoCommit;
+}
+
 public DataSource getDataSource() {
 return dataSource;
 }

Modified: 
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java?rev=1151126r1=1151125r2=1151126view=diff
==
--- 
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
 (original)
+++ 
camel/trunk/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
 Tue Jul 26 15:05:42 2011
@@ -58,23 +58,34 @@ public class JdbcProducer extends Defaul
  * Execute sql of exchange and set results on output
  */
 public void process(Exchange exchange) throws Exception {
+if (getEndpoint().isResetAutoCommit()) {
+processingSqlBySettingAutoCommit(exchange);
+} else {
+processingSqlWithoutSettingAutoCommit(exchange);
+}
+// populate headers
+exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
+}
+
+private void processingSqlBySettingAutoCommit(Exchange exchange) throws 
Exception {
 String sql = exchange.getIn().getBody(String.class);
 Connection conn = null;
 Statement stmt = null;
 ResultSet rs = null;
 Boolean autoCommit = null;
-
 try {
 conn = dataSource.getConnection();
 autoCommit = conn.getAutoCommit();
-conn.setAutoCommit(false);
-
+if (autoCommit) {
+conn.setAutoCommit(false);
+}
+
 stmt = conn.createStatement();
-
+
 if (parameters != null  !parameters.isEmpty()) {
 IntrospectionSupport.setProperties(stmt, parameters);
 }
-
+
 LOG.debug(Executing JDBC statement: {}, sql);
 
 if (stmt.execute(sql)) {
@@ -98,9 +109,36 @@ public class JdbcProducer extends Defaul
 resetAutoCommit(conn, autoCommit);
 closeQuietly(conn);
 }
+}
 
-// populate headers
-exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
+private void processingSqlWithoutSettingAutoCommit(Exchange exchange) 
throws Exception {
+String sql = exchange.getIn().getBody(String.class);
+Connection conn = null;
+Statement stmt = null;
+ResultSet rs = null;
+try {
+conn = dataSource.getConnection();
+
+stmt = conn.createStatement();
+
+if (parameters != null  !parameters.isEmpty()) {
+IntrospectionSupport.setProperties(stmt, parameters);
+}
+
+LOG.debug(Executing JDBC statement: {}, sql);
+
+if (stmt.execute(sql)) {
+rs = stmt.getResultSet();
+setResultSet(exchange, rs);
+} else {
+int updateCount = stmt.getUpdateCount();
+exchange.getOut().setHeader(JdbcConstants.JDBC_UPDATE_COUNT, 
updateCount);
+}
+} finally {
+closeQuietly(rs);
+

[CONF] Apache Camel JDBC

2011-07-26 Thread confluence







JDBC
Page edited by willem jiang


 Changes (1)
 




...
| {{statement.xxx}} | {{null}} | *Camel 2.1:* Sets additional options on the {{java.sql.Statement}} that is used behind the scenes to execute the queries. For instance, {{statement.maxRows=10}}. For detailed documentation, see the [{{java.sql.Statement}} javadoc|http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Statement.html] documentation. | | {{useJDBC4ColumnNameAndLabelSemantics}} | {{true}} | *Camel 1.6.3/2.2:* Sets whether to use JDBC 4/3 column label/name semantics. You can use this option to turn it {{false}} in case you have issues with your JDBC driver to select data. This only applies when using {{SQL SELECT}} using aliases (e.g. {{SQL SELECT id as identifier, name as given_name from persons}}). | 
| {{resetAutoCommit}} | {{true}} | *Camel 2.9:* Camel will set the autoCommit on the JDBC connection to be false, commit the change after executed the statement and reset the autoCommit flag of the connection at the end, if the resetAutoCommit is true. If the JDBC connection doesnt support to reset the autoCommit flag, you can set the resetAutoCommit flag to be false, and Camel will not try to reset the autoCommit flag.| 
 h3. Result 
...


Full Content

JDBC Component

The jdbc component enables you to access databases through JDBC, where SQL queries and operations are sent in the message body. This component uses the standard JDBC API, unlike the SQL Component component, which uses spring-jdbc.

Maven users will need to add the following dependency to their pom.xml for this component:


dependency
groupIdorg.apache.camel/groupId
artifactIdcamel-jdbc/artifactId
versionx.x.x/version
!-- use the same version as your Camel core version --
/dependency



This component can only be used to define producer endpoints, which means that you cannot use the JDBC component in a from() statement.

This component can not be used as a Transactional Client. If you need transaction support in your route, you should use the SQL component instead.

URI format



jdbc:dataSourceName[?options]



This component only supports producer endpoints.

You can append query options to the URI in the following format, ?option=valueoption=value...

Options




 Name 
 Default Value 
 Description 


 readSize 
 0 / 2000 
 The default maximum number of rows that can be read by a polling query. The default value is 2000 for Camel 1.5.0 or older. In newer releases the default value is 0. 


 statement.xxx 
 null 
 Camel 2.1: Sets additional options on the java.sql.Statement that is used behind the scenes to execute the queries. For instance, statement.maxRows=10. For detailed documentation, see the java.sql.Statement javadoc documentation. 


 useJDBC4ColumnNameAndLabelSemantics 
 true 
 Camel 1.6.3/2.2: Sets whether to use JDBC 4/3 column label/name semantics. You can use this option to turn it false in case you have issues with your JDBC driver to select data. This only applies when using SQL SELECT using aliases (e.g. SQL SELECT id as identifier, name as given_name from persons). 


 resetAutoCommit 
 true 
 Camel 2.9: Camel will set the autoCommit on the JDBC connection to be false, commit the change after executed the statement and reset the autoCommit flag of the connection at the end, if the resetAutoCommit is true. If the JDBC connection doesn't support to reset the autoCommit flag, you can set the resetAutoCommit flag to be false, and Camel will not try to reset the autoCommit flag.





Result
The result is returned in the OUT body as an ArrayListHashMapString, Object. The List object contains the list of rows and the Map objects contain each row with the String key as the column name.

Note: This component fetches ResultSetMetaData to be able to return the column name as the key in the Map.

Message Headers



 Header 
 Description 


 CamelJdbcRowCount 
 If the query is a SELECT, query the row count is returned in this OUT header. 


 CamelJdbcUpdateCount 
 If the query is an UPDATE, query the update count is returned in this OUT header. 





Samples

In the following example, we fetch the rows from the customer table.

First we register our datasource in the Camel registry as testdb:

JndiRegistry reg = super.createRegistry();
reg.bind("testdb", ds);
return reg;



Then we configure a route that routes to the JDBC component, so the SQL will be executed. Note how we refer to the testdb datasource that was bound in the previous step:


// lets add simple route
public void configure() throws Exception {
from("direct:hello").to("jdbc:testdb?readSize=100");
}



Or you can create a DataSource in Spring like this:


camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
  route

svn commit: r1151153 - /camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 16:18:02 2011
New Revision: 1151153

URL: http://svn.apache.org/viewvc?rev=1151153view=rev
Log:
Fixed CS

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java?rev=1151153r1=1151152r2=1151153view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanHelper.java
 Tue Jul 26 16:18:02 2011
@@ -100,21 +100,17 @@ public final class BeanHelper {
 // if its a class, then it should be assignable
 Class? parameterClass = resolver.resolveClass(parameterType);
 if (parameterClass == null  
parameterType.equals(expectedType.getSimpleName())) {
-// it was not the FQN class name, but the simple name instead, so 
we can infer the type
-parameterClass = expectedType;
+// it was not the FQN class name, but the simple name instead, 
which matched
+return true;
 }
 
-// if there was a class, then it must be assignable to match
-if (parameterClass != null) {
-if (!parameterClass.isAssignableFrom(expectedType)) {
-return false;
-} else {
-return true;
-}
+// not a class so return null
+if (parameterClass == null) {
+return null;
 }
 
-// not a class so return null
-return null;
+// if there was a class, then it must be assignable to match
+return parameterClass.isAssignableFrom(expectedType);
 }
 
 }




svn commit: r1151158 - in /camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi: cxf/blueprint/CxfBlueprintRouterTest.java ftp/FtpConsumeTest.java

2011-07-26 Thread davsclaus
Author: davsclaus
Date: Tue Jul 26 16:23:43 2011
New Revision: 1151158

URL: http://svn.apache.org/viewvc?rev=1151158view=rev
Log:
Fixed CS

Modified:

camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java

camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ftp/FtpConsumeTest.java

Modified: 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java?rev=1151158r1=1151157r2=1151158view=diff
==
--- 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java
 (original)
+++ 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/cxf/blueprint/CxfBlueprintRouterTest.java
 Tue Jul 26 16:23:43 2011
@@ -44,7 +44,8 @@ import static org.ops4j.pax.swissbox.tin
 @RunWith(JUnit4TestRunner.class)
 @Ignore(This test will be failed with CXF 2.4.1, we need to use CXF 2.4.2)
 public class CxfBlueprintRouterTest extends OSGiBlueprintTestSupport {
- private static Server server;
+private static Server server;
+
 @BeforeClass
 public static void startServer() {
 JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();

Modified: 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ftp/FtpConsumeTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ftp/FtpConsumeTest.java?rev=1151158r1=1151157r2=1151158view=diff
==
--- 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ftp/FtpConsumeTest.java
 (original)
+++ 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/ftp/FtpConsumeTest.java
 Tue Jul 26 16:23:43 2011
@@ -48,7 +48,7 @@ public class FtpConsumeTest extends OSGi
 // using the features to install the camel components
 scanFeatures(getCamelKarafFeatureUrl(), camel-ftp)
 
-);
+);
 
 return options;
 }




svn commit: r1151223 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/properties/ camel-core/src/main/java/org/apache/camel/management/ camel-core/src/test/java/org/apache/camel/

2011-07-26 Thread dkulp
Author: dkulp
Date: Tue Jul 26 20:11:46 2011
New Revision: 1151223

URL: http://svn.apache.org/viewvc?rev=1151223view=rev
Log:
Fix a bunch of warnings in eclipse

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java

camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java

camel/trunk/camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentEIPRoutingSlipTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/issues/TryCatchWithSplitNotHandledIssueTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/model/XmlParseTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutingSlipInOutAndInOnlyTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ToEndpointPropertyTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TryProcessorHandledTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionUseOriginalMessageTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipDataModificationTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipIgnoreInvalidEndpointsTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithErrorHandlerTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/view/DotViewTest.java

camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java

camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/HttpProducerTwoParametersWithSameKeyTest.java

camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettySimulateInOnlyTest.java

camel/trunk/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/jettyproducer/HttpJettyProducerTwoParametersWithSameKeyTest.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java?rev=1151223r1=1151222r2=1151223view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
 Tue Jul 26 20:11:46 2011
@@ -212,10 +212,6 @@ public class PropertiesComponent extends
 this.locations = locations;
 }
 
-public String[] getLocations() {
-return locations;
-}
-
 @Override
 public boolean equals(Object o) {
 if (this == o) {

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java?rev=1151223r1=1151222r2=1151223view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
 Tue Jul 26 20:11:46 2011
@@ -56,7 +56,6 @@ import org.apache.camel.processor.SendPr
 import org.apache.camel.processor.Throttler;
 import org.apache.camel.spi.BrowsableEndpoint;
 import org.apache.camel.spi.EventNotifier;
-import org.apache.camel.spi.ManagementAware;
 import org.apache.camel.spi.ManagementObjectStrategy;
 import org.apache.camel.spi.RouteContext;
 
@@ -71,9 +70,10 @@ public class DefaultManagementObjectStra
 return mc;
 }
 
+@SuppressWarnings({deprecation, unchecked})
 public Object getManagedObjectForComponent(CamelContext context, Component 
component, String name) {
-if (component instanceof ManagementAware) {
-return ((ManagementAware) component).getManagedObject(component);
+if (component instanceof org.apache.camel.spi.ManagementAware) {
+return ((org.apache.camel.spi.ManagementAwareComponent) 
component).getManagedObject(component);
 } else {
 ManagedComponent mc = new ManagedComponent(name, component);
 mc.init(context.getManagementStrategy());
@@ -81,14 +81,15 @@ public class 

svn commit: r1151313 [3/3] - in /camel/trunk/components/camel-cxf: ./ src/test/java/org/apache/camel/component/cxf/ src/test/java/org/apache/camel/component/cxf/cxfbean/ src/test/java/org/apache/camel

2011-07-26 Thread dkulp
Modified: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml?rev=1151313r1=1151312r2=1151313view=diff
==
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanAndIoCTest-context.xml
 Wed Jul 27 02:36:21 2011
@@ -21,13 +21,16 @@
http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
 
 
+bean 
class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer/
+
   bean class=org.apache.camel.wsdl_first.PersonImplWithWsdl id=jaxwsBean
   property name=reply value=Bye/
   /bean
 
   camelContext id=camel xmlns=http://camel.apache.org/schema/spring;
+  endpoint id=ep1 
uri=jetty:http://localhost:${CxfBeanWithWsdlLocationInBeanAndIoCTest.1}?matchOnUriPrefix=true;
 /
 route
-  from uri=jetty:http://localhost:9090?matchOnUriPrefix=true; /
+  from ref=ep1/
   to uri=cxfbean:jaxwsBean /
 /route
   /camelContext

Modified: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml?rev=1151313r1=1151312r2=1151313view=diff
==
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanWithWsdlLocationInBeanTest-context.xml
 Wed Jul 27 02:36:21 2011
@@ -20,12 +20,14 @@
http://camel.apache.org/schema/spring  
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
 
+  bean 
class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer/
 
   bean class=org.apache.camel.wsdl_first.PersonImplWithWsdl id=jaxwsBean 
/
 
   camelContext id=camel xmlns=http://camel.apache.org/schema/spring;
+endpoint id=ep1 
uri=jetty:http://localhost:${CxfBeanWithWsdlLocationInBeanTest.1}?matchOnUriPrefix=true;
 /
 route
-  from uri=jetty:http://localhost:9090?matchOnUriPrefix=true; /
+  from ref=ep1 /
   to uri=cxfbean:jaxwsBean /
 /route
   /camelContext

Modified: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml?rev=1151313r1=1151312r2=1151313view=diff
==
--- 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadMode12Test-context.xml
 Wed Jul 27 02:36:21 2011
@@ -24,10 +24,11 @@
http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
 
+bean 
class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer/
 
   !-- START SNIPPET: enableMtom --
 
-   cxf:cxfEndpoint id=routerEndpoint 
address=http://localhost:9091/jaxws-mtom/hello;
+   cxf:cxfEndpoint id=routerEndpoint 
address=http://localhost:${CXFTestSupport.port1}/CxfMtomRouterPayloadMode12Test/jaxws-mtom/hello;
 wsdlURL=mtom.wsdl
 serviceName=ns:HelloService12
 endpointName=ns:HelloPort
@@ -54,7 +55,7 @@

/cxf:cxfEndpoint
 
-   cxf:cxfEndpoint id=serviceEndpoint 
address=http://localhost:9092/jaxws-mtom/hello;
+   cxf:cxfEndpoint id=serviceEndpoint 
address=http://localhost:${CXFTestSupport.port2}/CxfMtomRouterPayloadMode12Test/jaxws-mtom/hello;
 wsdlURL=mtom.wsdl
 serviceName=ns:HelloService12
 endpointName=ns:HelloPort

Modified: 
camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterPayloadModeTest-context.xml
URL: 

svn commit: r1151319 - in /camel/trunk/components/camel-cxf: ./ src/test/java/org/apache/camel/component/cxf/

2011-07-26 Thread dkulp
Author: dkulp
Date: Wed Jul 27 03:05:54 2011
New Revision: 1151319

URL: http://svn.apache.org/viewvc?rev=1151319view=rev
Log:
Start playing with parallel testing.   Lots of work to do.

Modified:
camel/trunk/components/camel-cxf/pom.xml

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterConverterRouterTest.java

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterMessageRouterTest.java

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadRouterTest.java

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterPayLoadWithFeatureRouterTest.java

Modified: camel/trunk/components/camel-cxf/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/pom.xml?rev=1151319r1=1151318r2=1151319view=diff
==
--- camel/trunk/components/camel-cxf/pom.xml (original)
+++ camel/trunk/components/camel-cxf/pom.xml Wed Jul 27 03:05:54 2011
@@ -215,6 +215,9 @@
   reportFormatbrief/reportFormat
   useFilefalse/useFile
   runOrderalphabetical/runOrder
+  !--parallelclasses/parallel
+  perCoreThreadCounttrue/perCoreThreadCount
+  threads2/threads--
   systemPropertyVariables
 
java.util.logging.config.file${basedir}/target/test-classes/logging.properties/java.util.logging.config.file
   /systemPropertyVariables

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java?rev=1151319r1=1151318r2=1151319view=diff
==
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java
 Wed Jul 27 03:05:54 2011
@@ -37,7 +37,6 @@ import org.springframework.context.suppo
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public abstract class AbstractCXFGreeterRouterTest extends CamelTestSupport {
-protected static Endpoint endpoint;
 protected AbstractXmlApplicationContext applicationContext;
 
 private final QName serviceName = new 
QName(http://apache.org/hello_world_soap_http;,
@@ -79,13 +78,6 @@ public abstract class AbstractCXFGreeter
 }
 
 
-@AfterClass
-public static void stopService() {
-if (endpoint != null) {
-endpoint.stop();
-}
-}
-
 @Test
 public void testInvokingServiceFromCXFClient() throws Exception {
 Service service = Service.create(serviceName);

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java?rev=1151319r1=1151318r2=1151319view=diff
==
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CXFGreeterRouterTest.java
 Wed Jul 27 03:05:54 2011
@@ -39,6 +39,14 @@ import org.springframework.context.suppo
 
 public class CXFGreeterRouterTest extends AbstractCXFGreeterRouterTest {
 
+protected static Endpoint endpoint;
+@AfterClass
+public static void stopService() {
+if (endpoint != null) {
+endpoint.stop();
+}
+}
+
 
 @BeforeClass
 public static void startService() {

Modified: 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterConverterRouterTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterConverterRouterTest.java?rev=1151319r1=1151318r2=1151319view=diff
==
--- 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterConverterRouterTest.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfGreeterConverterRouterTest.java
 Wed Jul 27 03:05:54 2011
@@ -21,12 +21,20 @@ import javax.xml.ws.Endpoint;
 
 import org.apache.camel.test.AvailablePortFinder;
 import