svn commit: r1381457 - in /camel/trunk/components/camel-cdi/src: main/java/org/apache/camel/cdi/ main/java/org/apache/camel/component/cdi/internal/ test/java/org/apache/camel/cdi/

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Thu Sep  6 02:03:18 2012
New Revision: 1381457

URL: http://svn.apache.org/viewvc?rev=1381457&view=rev
Log:
Fixed the CS errors of camel-cdi

Modified:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java

camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java

camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java?rev=1381457&r1=1381456&r2=1381457&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java
 Thu Sep  6 02:03:18 2012
@@ -1,5 +1,4 @@
 /**
- *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -32,7 +31,11 @@ import org.apache.camel.util.ObjectHelpe
 /**
  * A helper class for loading route definitions from a file, URL or the 
classpath
  */
-public class RoutesXml {
+public final class RoutesXml {
+
+private RoutesXml() {
+//The helper class
+}
 
 /**
  * Loads the routes from the given XML content
@@ -77,7 +80,7 @@ public class RoutesXml {
  * Loads the routes from a {@link File}
  */
 public static RoutesDefinition loadRoutesFromFile(String fileName)
-throws JAXBException, FileNotFoundException {
+throws JAXBException, FileNotFoundException {
 return loadRoutesFromFile(new File(fileName));
 }
 

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java?rev=1381457&r1=1381456&r2=1381457&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
 Thu Sep  6 02:03:18 2012
@@ -1,5 +1,4 @@
 /**
- *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
  *
- * http://www.apache.org/licenses/LICENSE-2.0
+ *  http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java?rev=1381457&r1=1381456&r2=1381457&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java
 Thu Sep  6 02:03:18 2012
@@ -1,5 +1,4 @@
 /**
- *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -7,7 +6,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obta

svn commit: r1381456 - /camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Thu Sep  6 02:02:33 2012
New Revision: 1381456

URL: http://svn.apache.org/viewvc?rev=1381456&view=rev
Log:
Fixed the CS error of camel-core

Modified:

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

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java?rev=1381456&r1=1381455&r2=1381456&view=diff
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
 Thu Sep  6 02:02:33 2012
@@ -27,24 +27,29 @@ import org.apache.camel.builder.RouteBui
 public class RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest extends 
ContextTestSupport {
 
 private class FirstException extends Exception {
+
+private static final long serialVersionUID = 1L;
 }
 
 private class SecondException extends Exception {
+   
+private static final long serialVersionUID = 1L;
 }
 
 private class ExceptionThrowingProcessor implements Processor {
 
 @Override
 public void process(Exchange exchange) throws Exception {
-String camelRedeliveryCounter = 
exchange.getIn().getHeader(Exchange.REDELIVERY_COUNTER, String.class);
+String camelRedeliveryCounter = 
exchange.getIn().getHeader(Exchange.REDELIVERY_COUNTER,
+   
String.class);
 int redeliveries = camelRedeliveryCounter == null ? 0 : 
Integer.valueOf(camelRedeliveryCounter);
 switch (redeliveries) {
-case 0:
-throw new FirstException();
-case 1:
-throw new SecondException();
-default:
-break; // no-op
+case 0:
+throw new FirstException();
+case 1:
+throw new SecondException();
+default:
+break; // no-op
 }
 }
 }




svn commit: r1381329 - in /camel/branches/camel-2.9.x/components/camel-aws/src: main/java/org/apache/camel/component/aws/sqs/ test/java/org/apache/camel/component/aws/sqs/

2012-09-05 Thread cmueller
Author: cmueller
Date: Wed Sep  5 19:58:14 2012
New Revision: 1381329

URL: http://svn.apache.org/viewvc?rev=1381329&view=rev
Log:
CAMEL-5414: SqsEndpoint can't retrieve existing queue url with visibility 
timeout different than default

Added:

camel/branches/camel-2.9.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointUseExistingQueueTest.java
Modified:

camel/branches/camel-2.9.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java

camel/branches/camel-2.9.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java

Modified: 
camel/branches/camel-2.9.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java?rev=1381329&r1=1381328&r2=1381329&view=diff
==
--- 
camel/branches/camel-2.9.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
 (original)
+++ 
camel/branches/camel-2.9.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
 Wed Sep  5 19:58:14 2012
@@ -23,6 +23,7 @@ import com.amazonaws.auth.BasicAWSCreden
 import com.amazonaws.services.sqs.AmazonSQSClient;
 import com.amazonaws.services.sqs.model.CreateQueueRequest;
 import com.amazonaws.services.sqs.model.CreateQueueResult;
+import com.amazonaws.services.sqs.model.ListQueuesResult;
 import com.amazonaws.services.sqs.model.QueueAttributeName;
 
 import org.apache.camel.Consumer;
@@ -73,27 +74,41 @@ public class SqsEndpoint extends Schedul
 protected void doStart() throws Exception {
 client = getConfiguration().getAmazonSQSClient() != null
 ? getConfiguration().getAmazonSQSClient() : getClient();
-
-// creates a new queue, or returns the URL of an existing one
-CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
-if (getConfiguration().getDefaultVisibilityTimeout() != null) {
-
request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), 
String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
-}
-if (getConfiguration().getMaximumMessageSize() != null) {
-
request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), 
String.valueOf(getConfiguration().getMaximumMessageSize()));
-}
-if (getConfiguration().getMessageRetentionPeriod() != null) {
-
request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), 
String.valueOf(getConfiguration().getMessageRetentionPeriod()));
+
+// check whether the queue already exists
+ListQueuesResult listQueuesResult = client.listQueues();
+for (String url : listQueuesResult.getQueueUrls()) {
+if (url.endsWith("/" + configuration.getQueueName())) {
+queueUrl = url;
+LOG.trace("Queue available at '{}'. Using existing queue 
attributes!", queueUrl);
+break;
+}
 }
-if (getConfiguration().getPolicy() != null) {
-request.getAttributes().put(QueueAttributeName.Policy.name(), 
String.valueOf(getConfiguration().getPolicy()));
-}
-LOG.trace("Creating queue [{}] with request [{}]...", 
configuration.getQueueName(), request);
 
-CreateQueueResult queueResult = client.createQueue(request);
-queueUrl = queueResult.getQueueUrl();
-
-LOG.trace("Queue created and available at: {}", queueUrl);
+if (queueUrl == null) {
+LOG.trace("Queue '{}' doesn't exist. Will create it...", 
configuration.getQueueName());
+
+// creates a new queue, or returns the URL of an existing one
+CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
+if (getConfiguration().getDefaultVisibilityTimeout() != null) {
+
request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), 
String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
+}
+if (getConfiguration().getMaximumMessageSize() != null) {
+
request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), 
String.valueOf(getConfiguration().getMaximumMessageSize()));
+}
+if (getConfiguration().getMessageRetentionPeriod() != null) {
+
request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), 
String.valueOf(getConfiguration().getMessageRetentionPeriod()));
+}
+if (getConfiguration().getPolicy() != null) {
+request.getAttributes().put(QueueAttributeName.Policy.name(), 
String.valueOf(getConfiguration().getPolicy(

svn commit: r1381328 - in /camel/branches/camel-2.10.x/components/camel-aws/src: main/java/org/apache/camel/component/aws/sqs/ test/java/org/apache/camel/component/aws/sqs/

2012-09-05 Thread cmueller
Author: cmueller
Date: Wed Sep  5 19:57:23 2012
New Revision: 1381328

URL: http://svn.apache.org/viewvc?rev=1381328&view=rev
Log:
CAMEL-5414: SqsEndpoint can't retrieve existing queue url with visibility 
timeout different than default

Added:

camel/branches/camel-2.10.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointUseExistingQueueTest.java
Modified:

camel/branches/camel-2.10.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java

camel/branches/camel-2.10.x/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java

Modified: 
camel/branches/camel-2.10.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java?rev=1381328&r1=1381327&r2=1381328&view=diff
==
--- 
camel/branches/camel-2.10.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
 (original)
+++ 
camel/branches/camel-2.10.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
 Wed Sep  5 19:57:23 2012
@@ -23,6 +23,7 @@ import com.amazonaws.auth.BasicAWSCreden
 import com.amazonaws.services.sqs.AmazonSQSClient;
 import com.amazonaws.services.sqs.model.CreateQueueRequest;
 import com.amazonaws.services.sqs.model.CreateQueueResult;
+import com.amazonaws.services.sqs.model.ListQueuesResult;
 import com.amazonaws.services.sqs.model.QueueAttributeName;
 
 import org.apache.camel.Consumer;
@@ -74,27 +75,41 @@ public class SqsEndpoint extends Schedul
 protected void doStart() throws Exception {
 client = getConfiguration().getAmazonSQSClient() != null
 ? getConfiguration().getAmazonSQSClient() : getClient();
-
-// creates a new queue, or returns the URL of an existing one
-CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
-if (getConfiguration().getDefaultVisibilityTimeout() != null) {
-
request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), 
String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
-}
-if (getConfiguration().getMaximumMessageSize() != null) {
-
request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), 
String.valueOf(getConfiguration().getMaximumMessageSize()));
-}
-if (getConfiguration().getMessageRetentionPeriod() != null) {
-
request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), 
String.valueOf(getConfiguration().getMessageRetentionPeriod()));
+
+// check whether the queue already exists
+ListQueuesResult listQueuesResult = client.listQueues();
+for (String url : listQueuesResult.getQueueUrls()) {
+if (url.endsWith("/" + configuration.getQueueName())) {
+queueUrl = url;
+LOG.trace("Queue available at '{}'. Using existing queue 
attributes!", queueUrl);
+break;
+}
 }
-if (getConfiguration().getPolicy() != null) {
-request.getAttributes().put(QueueAttributeName.Policy.name(), 
String.valueOf(getConfiguration().getPolicy()));
-}
-LOG.trace("Creating queue [{}] with request [{}]...", 
configuration.getQueueName(), request);
 
-CreateQueueResult queueResult = client.createQueue(request);
-queueUrl = queueResult.getQueueUrl();
-
-LOG.trace("Queue created and available at: {}", queueUrl);
+if (queueUrl == null) {
+LOG.trace("Queue '{}' doesn't exist. Will create it...", 
configuration.getQueueName());
+
+// creates a new queue, or returns the URL of an existing one
+CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
+if (getConfiguration().getDefaultVisibilityTimeout() != null) {
+
request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), 
String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
+}
+if (getConfiguration().getMaximumMessageSize() != null) {
+
request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), 
String.valueOf(getConfiguration().getMaximumMessageSize()));
+}
+if (getConfiguration().getMessageRetentionPeriod() != null) {
+
request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), 
String.valueOf(getConfiguration().getMessageRetentionPeriod()));
+}
+if (getConfiguration().getPolicy() != null) {
+request.getAttributes().put(QueueAttributeName.Policy.name(), 
String.valueOf(getConfiguration().get

svn commit: r1381327 - in /camel/trunk/components/camel-aws/src: main/java/org/apache/camel/component/aws/sqs/ test/java/org/apache/camel/component/aws/sqs/

2012-09-05 Thread cmueller
Author: cmueller
Date: Wed Sep  5 19:55:09 2012
New Revision: 1381327

URL: http://svn.apache.org/viewvc?rev=1381327&view=rev
Log:
CAMEL-5414: SqsEndpoint can't retrieve existing queue url with visibility 
timeout different than default

Added:

camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/SqsEndpointUseExistingQueueTest.java
Modified:

camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java

camel/trunk/components/camel-aws/src/test/java/org/apache/camel/component/aws/sqs/AmazonSQSClientMock.java

Modified: 
camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java?rev=1381327&r1=1381326&r2=1381327&view=diff
==
--- 
camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsEndpoint.java
 Wed Sep  5 19:55:09 2012
@@ -23,6 +23,7 @@ import com.amazonaws.auth.BasicAWSCreden
 import com.amazonaws.services.sqs.AmazonSQSClient;
 import com.amazonaws.services.sqs.model.CreateQueueRequest;
 import com.amazonaws.services.sqs.model.CreateQueueResult;
+import com.amazonaws.services.sqs.model.ListQueuesResult;
 import com.amazonaws.services.sqs.model.QueueAttributeName;
 
 import org.apache.camel.Consumer;
@@ -74,27 +75,41 @@ public class SqsEndpoint extends Schedul
 protected void doStart() throws Exception {
 client = getConfiguration().getAmazonSQSClient() != null
 ? getConfiguration().getAmazonSQSClient() : getClient();
-
-// creates a new queue, or returns the URL of an existing one
-CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
-if (getConfiguration().getDefaultVisibilityTimeout() != null) {
-
request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), 
String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
-}
-if (getConfiguration().getMaximumMessageSize() != null) {
-
request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), 
String.valueOf(getConfiguration().getMaximumMessageSize()));
-}
-if (getConfiguration().getMessageRetentionPeriod() != null) {
-
request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), 
String.valueOf(getConfiguration().getMessageRetentionPeriod()));
+
+// check whether the queue already exists
+ListQueuesResult listQueuesResult = client.listQueues();
+for (String url : listQueuesResult.getQueueUrls()) {
+if (url.endsWith("/" + configuration.getQueueName())) {
+queueUrl = url;
+LOG.trace("Queue available at '{}'. Using existing queue 
attributes!", queueUrl);
+break;
+}
 }
-if (getConfiguration().getPolicy() != null) {
-request.getAttributes().put(QueueAttributeName.Policy.name(), 
String.valueOf(getConfiguration().getPolicy()));
-}
-LOG.trace("Creating queue [{}] with request [{}]...", 
configuration.getQueueName(), request);
 
-CreateQueueResult queueResult = client.createQueue(request);
-queueUrl = queueResult.getQueueUrl();
-
-LOG.trace("Queue created and available at: {}", queueUrl);
+if (queueUrl == null) {
+LOG.trace("Queue '{}' doesn't exist. Will create it...", 
configuration.getQueueName());
+
+// creates a new queue, or returns the URL of an existing one
+CreateQueueRequest request = new 
CreateQueueRequest(configuration.getQueueName());
+if (getConfiguration().getDefaultVisibilityTimeout() != null) {
+
request.getAttributes().put(QueueAttributeName.VisibilityTimeout.name(), 
String.valueOf(getConfiguration().getDefaultVisibilityTimeout()));
+}
+if (getConfiguration().getMaximumMessageSize() != null) {
+
request.getAttributes().put(QueueAttributeName.MaximumMessageSize.name(), 
String.valueOf(getConfiguration().getMaximumMessageSize()));
+}
+if (getConfiguration().getMessageRetentionPeriod() != null) {
+
request.getAttributes().put(QueueAttributeName.MessageRetentionPeriod.name(), 
String.valueOf(getConfiguration().getMessageRetentionPeriod()));
+}
+if (getConfiguration().getPolicy() != null) {
+request.getAttributes().put(QueueAttributeName.Policy.name(), 
String.valueOf(getConfiguration().getPolicy()));
+}
+LOG.trace("Creating queue [{}] with request [{}]...", 
configura

svn commit: r1381278 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ components/camel-cdi/src/main/java/org/apache/camel/cdi/ components/camel-cdi/src/main/java/org/apache/camel/co

2012-09-05 Thread jstrachan
Author: jstrachan
Date: Wed Sep  5 18:15:15 2012
New Revision: 1381278

URL: http://svn.apache.org/viewvc?rev=1381278&view=rev
Log:
initial implementation of CAMEL-5554 so we can easily reuse XML based route 
definitions from inside CDI

Added:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java
   (with props)

camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java
   (with props)

camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java
   (with props)
camel/trunk/components/camel-cdi/src/test/resources/routes.xml   (with 
props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelHelper.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Mock.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/CdiBeanRegistry.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextBean.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java

camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/EndpointDefinedUsingConfigPropertyTest.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelHelper.java?rev=1381278&r1=1381277&r2=1381278&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelHelper.java 
(original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelHelper.java 
Wed Sep  5 18:15:15 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.model;
 
+import java.io.InputStream;
 import java.io.StringReader;
 import java.io.StringWriter;
 import javax.xml.bind.JAXBContext;
@@ -43,9 +44,7 @@ public final class ModelHelper {
  * @throws JAXBException is throw if error marshalling to XML
  */
 public static String dumpModelAsXml(NamedNode definition) throws 
JAXBException {
-// create a new jaxb context
-// must use classloader from CamelContext to have JAXB working
-JAXBContext jaxbContext = 
JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES, 
CamelContext.class.getClassLoader());
+JAXBContext jaxbContext = createJaxbContext();
 
 Marshaller marshaller = jaxbContext.createMarshaller();
 marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
@@ -64,10 +63,7 @@ public final class ModelHelper {
  * @throws javax.xml.bind.JAXBException is thrown if error unmarshalling 
from xml to model
  */
 public static  T createModelFromXml(String xml, 
Class type) throws JAXBException {
-// create a new jaxb context
-// must use classloader from CamelContext to have JAXB working
-JAXBContext jaxbContext = 
JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES, 
CamelContext.class.getClassLoader());
-
+JAXBContext jaxbContext = createJaxbContext();
 StringReader reader = new StringReader(xml);
 Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
 Object result = unmarshaller.unmarshal(reader);
@@ -76,7 +72,26 @@ public final class ModelHelper {
 if (result == null) {
 throw new JAXBException("Cannot unmarshal to " + type + " using 
JAXB from XML: " + xml);
 }
+return type.cast(result);
+}
 
+/**
+ * Marshal the xml to the model definition
+ *
+ * @param stream the xml stream
+ * @param type the definition type to return, will throw a {@link 
ClassCastException} if not the expected type
+ * @return the model definition
+ * @throws javax.xml.bind.JAXBException is thrown if error unmarshalling 
from xml to model
+ */
+public static  T createModelFromXml(InputStream 
stream, Class type) throws JAXBException {
+JAXBContext jaxbContext = createJaxbContext();
+Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+Object result = unmarshaller.unmarshal(stream);
 return type.cast(result);
 }
+
+public static JAXBContext createJaxbContext() throws JAXBException {
+// must use classloader from CamelContext to have JAXB working
+return JAXBContext.newInstance(Constants.JAXB_CONTEXT_PACKAGES, 
CamelContext.class.getClassLoader());
+}
 }

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Mock.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/Mock.java?rev=1381278&r1=1381277&r2=1381278&view=diff
=

svn commit: r1381224 - in /camel/trunk: components/camel-cdi/src/main/java/org/apache/camel/cdi/ components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/ tests/camel-itest-cdi/src/m

2012-09-05 Thread jstrachan
Author: jstrachan
Date: Wed Sep  5 15:24:46 2012
New Revision: 1381224

URL: http://svn.apache.org/viewvc?rev=1381224&view=rev
Log:
lets go with the more DRY @ContextName("foo") for CAMEL-5566

Modified:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextA.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextB.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextC.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextD.java

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java?rev=1381224&r1=1381223&r2=1381224&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
 Wed Sep  5 15:24:46 2012
@@ -36,5 +36,5 @@ public @interface ContextName {
  * Returns the name of the CamelContext to add the routes to.
  * If no value is specified then the default CamelContext is used.
  */
-String contextName() default "";
+String value() default "";
 }

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java?rev=1381224&r1=1381223&r2=1381224&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
 Wed Sep  5 15:24:46 2012
@@ -69,11 +69,12 @@ public class CamelExtension implements E
 }
 
 /**
- * If no context name is specified then default it to the value from the 
{@link org.apache.camel.cdi.ContextName} annotation
+ * If no context name is specified then default it to the value from
+ * the {@link org.apache.camel.cdi.ContextName} annotation
  */
 public static String getCamelContextName(String context, ContextName 
annotation) {
 if (ObjectHelper.isEmpty(context) && annotation != null) {
-return annotation.contextName();
+return annotation.value();
 }
 return context;
 }
@@ -164,7 +165,7 @@ public class CamelExtension implements E
 
 private void addRouteBuilderBean(Bean bean, ContextName annotation) {
 if (annotation != null) {
-String contextName = annotation.contextName();
+String contextName = annotation.value();
 CamelContextConfig config = camelContextConfigMap.get(contextName);
 if (config == null) {
 config = new CamelContextConfig();

Modified: 
camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java?rev=1381224&r1=1381223&r2=1381224&view=diff
==
--- 
camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java
 (original)
+++ 
camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java
 Wed Sep  5 15:24:46 2012
@@ -28,13 +28,13 @@ import org.apache.camel.cdi.ContextName;
 public class MyConfig {
 
 @Produces
-@ContextName(contextName = "contextE")
+@ContextName("contextE")
 public RouteBuilder createRouteA() {
 return new MyRouteBuilder("seda:E.a", "mock:E.b");
 }
 
 @Produces
-@ContextName(contextName = "contextE")
+@ContextName("contextE")
 public RouteBuilder createRouteB() {
 return new MyRouteBuilder("seda:E.c", "mock:E.d");
 }

Modified: 
camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextA.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextA.java?rev=1381224&r1=1381223&r2=1381224&view=diff
==
--- 
camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextA.java
 (orig

svn commit: r1381222 - in /camel/trunk: components/camel-cdi/src/main/java/org/apache/camel/cdi/ components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/ examples/camel-example-cdi/

2012-09-05 Thread jstrachan
Author: jstrachan
Date: Wed Sep  5 15:17:52 2012
New Revision: 1381222

URL: http://svn.apache.org/viewvc?rev=1381222&view=rev
Log:
renamed @CamelStartup to @ContextName which seems a bit more general; and means 
we can use the same annotation to also do injection of CamelContexts too for 
CAMEL-5566

Added:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
   (contents, props changed)
  - copied, changed from r1381215, 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java
Removed:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java
Modified:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelFactory.java

camel/trunk/examples/camel-example-cdi/src/main/java/org/apache/camel/example/cdi/MyRoutes.java

camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextA.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextB.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextC.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/RoutesContextD.java

camel/trunk/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/IntegrationTest.java

Copied: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
 (from r1381215, 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java)
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java?p2=camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java&p1=camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java&r1=1381215&r2=1381222&rev=1381222&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
 Wed Sep  5 15:17:52 2012
@@ -25,12 +25,12 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
 
 /**
- * Used to annotate a {@link RouteBuilder} class to bind it to a
- * {@link CamelContext} instance on startup so that it can startup 
automatically
+ * Used to bind objects to a named {@link CamelContext} instance 
+ * such as {@link RouteBuilder} instances.
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, 
ElementType.PARAMETER})
-public @interface CamelStartup {
+public @interface ContextName {
 
 /**
  * Returns the name of the CamelContext to add the routes to.

Propchange: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/ContextName.java
--
svn:eol-style = native

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java?rev=1381222&r1=1381221&r2=1381222&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java
 Wed Sep  5 15:17:52 2012
@@ -24,7 +24,7 @@ import java.util.List;
 import org.apache.camel.Consume;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
-import org.apache.camel.cdi.CamelStartup;
+import org.apache.camel.cdi.ContextName;
 import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
 
 /**
@@ -36,9 +36,9 @@ public class BeanAdapter {
 private final List endpointMethods = new ArrayList();
 private final List produceFields = new ArrayList();
 private final List endpointFields = new ArrayList();
-private final CamelStartup startup;
+private final ContextName startup;
 
-public BeanAdapter(CamelStartup startup) {
+public BeanAdapter(ContextName startup) {
 this.startup = startup;
 }
 

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
URL: 
htt

svn commit: r1381216 - /camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java

2012-09-05 Thread jstrachan
Author: jstrachan
Date: Wed Sep  5 15:08:00 2012
New Revision: 1381216

URL: http://svn.apache.org/viewvc?rev=1381216&view=rev
Log:
simplfied integration test using @CamelStartup

Modified:

camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java

Modified: 
camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java?rev=1381216&r1=1381215&r2=1381216&view=diff
==
--- 
camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java
 (original)
+++ 
camel/trunk/examples/camel-example-cdi/src/test/java/org/apache/camel/example/cdi/IntegrationTest.java
 Wed Sep  5 15:08:00 2012
@@ -21,6 +21,7 @@ import javax.inject.Inject;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.CamelStartup;
 import org.apache.camel.cdi.Mock;
 import org.apache.camel.component.cdi.internal.CamelExtension;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -44,13 +45,11 @@ public class IntegrationTest {
 MyRoutes config;
 
 @Inject
-CamelContext camelContext;
-
-@Inject
 @Mock
 MockEndpoint result;
 
 @Produces
+@CamelStartup
 public RouteBuilder createRoutes() {
 return new RouteBuilder() {
 public void configure() {
@@ -61,17 +60,9 @@ public class IntegrationTest {
 
 @Test
 public void integrationTest() throws Exception {
-assertNotNull("CamelContext not injected!", camelContext);
-assertTrue("CamelContext is started", 
camelContext.getStatus().isStarted());
-
 assertNotNull("config not injected!", config);
 assertNotNull("MockEndpoint result not injected!", result);
 
-//camelContext.setTracing(true);
-
-// TODO we could maybe auto-register this?
-camelContext.addRoutes(createRoutes());
-
 result.expectedMessageCount(2);
 result.assertIsSatisfied();
 }




svn commit: r1381202 - in /camel/trunk: components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/ tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/ tests/camel-itest-cd

2012-09-05 Thread jstrachan
Author: jstrachan
Date: Wed Sep  5 14:42:52 2012
New Revision: 1381202

URL: http://svn.apache.org/viewvc?rev=1381202&view=rev
Log:
improved CAMEL-5566 so we can use @CamelStartup on @Produces methods too; for 
example when reusing a RouteBuilder class multiple times with different 
configurations/injections

Added:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
   (with props)

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyConfig.java
   (with props)

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/MyRouteBuilder.java
   (with props)
Modified:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextBean.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java

camel/trunk/tests/camel-itest-cdi/src/main/java/org/apache/camel/itest/cdi/Constants.java

camel/trunk/tests/camel-itest-cdi/src/test/java/org/apache/camel/itest/cdi/IntegrationTest.java

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextBean.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextBean.java?rev=1381202&r1=1381201&r2=1381202&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextBean.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextBean.java
 Wed Sep  5 14:42:52 2012
@@ -47,19 +47,19 @@ public class CamelContextBean implements
 private final BeanManager beanManager;
 private final String name;
 private final String camelContextName;
-private final List> routeBuilderBeans;
 private final InjectionTarget target;
+private final CamelContextConfig config;
 
 public CamelContextBean(BeanManager beanManager) {
-this(beanManager, "CamelContext", "", Collections.EMPTY_LIST);
+this(beanManager, "CamelContext", "", new CamelContextConfig());
 }
 
 public CamelContextBean(BeanManager beanManager, String name, String 
camelContextName,
-List> routeBuilderBeans) {
+CamelContextConfig config) {
 this.beanManager = beanManager;
 this.name = name;
 this.camelContextName = camelContextName;
-this.routeBuilderBeans = routeBuilderBeans;
+this.config = config;
 this.target = 
beanManager.createInjectionTarget(beanManager.createAnnotatedType(CdiCamelContext.class));
 }
 
@@ -131,14 +131,6 @@ public class CamelContextBean implements
 }
 
 public void configureCamelContext(CdiCamelContext camelContext) {
-for (Bean bean : routeBuilderBeans) {
-CreationalContext creationalContext = 
beanManager.createCreationalContext(bean);
-RouteBuilder routeBuilder = 
(RouteBuilder)beanManager.getReference(bean, RouteBuilder.class, 
creationalContext);
-try {
-camelContext.addRoutes(routeBuilder);
-} catch (Exception e) {
-throw new RuntimeCamelException("Could not add route builder " 
+ routeBuilder + ". Reason: " + e, e);
-}
-}
+config.configure(camelContext, beanManager);
 }
 }

Added: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java?rev=1381202&view=auto
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
 (added)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java
 Wed Sep  5 14:42:52 2012
@@ -0,0 +1,53 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitatio

svn commit: r1381197 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 14:28:57 2012
New Revision: 1381197

URL: http://svn.apache.org/viewvc?rev=1381197&view=rev
Log:
Better name in JMX for default error handler redelivery thread pool

Modified:
camel/branches/camel-2.10.x/   (props changed)

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java

Propchange: camel/branches/camel-2.10.x/
--
  Merged /camel/trunk:r1381196

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

Modified: 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1381197&r1=1381196&r2=1381197&view=diff
==
--- 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 Wed Sep  5 14:28:57 2012
@@ -1565,7 +1565,7 @@ public class DefaultCamelContext extends
 
 // setup default thread pool for error handler
 if (errorHandlerExecutorService == null || 
errorHandlerExecutorService.isShutdown()) {
-errorHandlerExecutorService = 
getExecutorServiceManager().newDefaultScheduledThreadPool(this, 
"ErrorHandlerRedeliveryTask");
+errorHandlerExecutorService = 
getExecutorServiceManager().newDefaultScheduledThreadPool("ErrorHandlerRedeliveryThreadPool",
 "ErrorHandlerRedeliveryTask");
 }
 
 // start the route definitions before the routes is started




svn commit: r1381196 - /camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 14:25:04 2012
New Revision: 1381196

URL: http://svn.apache.org/viewvc?rev=1381196&view=rev
Log:
Better name in JMX for default error handler redelivery thread pool

Modified:

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

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1381196&r1=1381195&r2=1381196&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 Wed Sep  5 14:25:04 2012
@@ -1564,7 +1564,7 @@ public class DefaultCamelContext extends
 
 // setup default thread pool for error handler
 if (errorHandlerExecutorService == null || 
errorHandlerExecutorService.isShutdown()) {
-errorHandlerExecutorService = 
getExecutorServiceManager().newDefaultScheduledThreadPool(this, 
"ErrorHandlerRedeliveryTask");
+errorHandlerExecutorService = 
getExecutorServiceManager().newDefaultScheduledThreadPool("ErrorHandlerRedeliveryThreadPool",
 "ErrorHandlerRedeliveryTask");
 }
 
 // start the route definitions before the routes is started




svn commit: r831212 - in /websites/production/camel/content: cache/main.pageCache camel-2110-release.html

2012-09-05 Thread buildbot
Author: buildbot
Date: Wed Sep  5 14:17:40 2012
New Revision: 831212

Log:
Production update by buildbot for camel

Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/camel-2110-release.html

Modified: websites/production/camel/content/cache/main.pageCache
==
Binary files - no diff available.

Modified: websites/production/camel/content/camel-2110-release.html
==
--- websites/production/camel/content/camel-2110-release.html (original)
+++ websites/production/camel/content/camel-2110-release.html Wed Sep  5 
14:17:40 2012
@@ -89,7 +89,7 @@
 
 Fixed issues
 
-Fixed RoutePolicy used from Spring XML with 
routePolicyRef may not invoke all callbacks on the 
policy.Fixed MINA 
consumer to force disconnect upon timeout when doing request/reply, as late 
replies may cause side effects otherwise.Fixed Simple language with empty quoted 
literals in predicates, so you can compare against empty strings.Fixed 
SOAP data format to set SOAP 
1.1 namespace when marhsalling faults.Fixed SEDA producer to send to the right 
BlockingQueue being attached on the SEDA endpoint so that the sent messages don't get 
lost.Fixed using sendEmptyMessageWhenIdle=true on a batch 
consume
 r such as File now working 
with Aggregate 
EIP when using completionFromBatchConsumerFixed 
MockEndpoint.expectedBodiesReceivedInAnyOrder to allow asserting on 
multiple arrival of the same/equal bodies.Fixed MyBatis to demarcate the running 
transactions properly while reading/writing from/to database.Fixed Jetty, HTTP, HTTP4, and AHC http components not working in bridge mode if content path 
have spacesFixed the CXF fallback convertor issue which camel will unregister it 
when the converter return null.Fixed the issue that title="File2">File2 endpoints on windows without volume name in the path 
 >url.Fixed the issue of unmarshaling pgp messages encrypted with 
 >ElGamal.Fixed random title="Load Balancer">Load Balancer to be even spread (before was a 
 >little less likely to pick the 1st)Fixed href="timer.html" title="Timer">Timer to not fire during starting shape="rect" href="camelcontext.html" 
 >title="CamelContext">CamelContextFixed href="xmlsecurity-dataformat.html" title="XMLSecurity DataFormat">XMLSecurity 
 >DataFormat to enable retrieval of password-protected private keys for 
 >asymmetric decryption
+Fixed RoutePolicy used from Spring XML with 
routePolicyRef may not invoke all callbacks on the 
policy.Fixed MINA 
consumer to force disconnect upon timeout when doing request/reply, as late 
replies may cause side effects otherwise.Fixed Simple language with empty quoted 
literals in predicates, so you can compare against empty strings.Fixed 
SOAP data format to set SOAP 
1.1 namespace when marhsalling faults.Fixed SEDA producer to send to the right 
BlockingQueue being attached on the SEDA endpoint so that the sent messages don't get 
lost.Fixed using sendEmptyMessageWhenIdle=true on a batch 
consume
 r such as File now working 
with Aggregate 
EIP when using completionFromBatchConsumerFixed 
MockEndpoint.expectedBodiesReceivedInAnyOrder to allow asserting on 
multiple arrival of the same/equal bodies.Fixed MyBatis to demarcate the running 
transactions properly while reading/writing from/to database.Fixed Jetty, HTTP, HTTP4, and AHC http components not working in bridge mode if content path 
have spacesFixed the CXF fallback convertor issue which camel will unregister it 
when the converter return null.Fixed the issue that title="File2">File2 endpoints on windows without volume name in the path 
 >url.Fixed the issue of unmarshaling pgp messages encrypted with 
 >ElGamal.Fixed random title="Load Balancer">Load Balancer to be even spread (before was a 
 >little less likely to pick the 1st)Fixed href="timer.html" title="Timer">Timer to not fire during starting shape="rect" href="camelcontext.html" 
 >title="CamelContext">CamelContextFixed href="xmlsecurity-dataformat.html" title="XMLSecurity DataFormat">XMLSecurity 
 >DataFormat to enable retrieval of password-protected private keys for 
 >asymmetric decryptionFixed href="exception-clause.html" title="Exception Clause">Exception Clause 
 >using maximumRedeliveries(-1) may be wrongly inherited by another 
 >onException during a redelivery
  process.
 
 
 New Enterprise Integration Patterns




[CONF] Apache Camel > Camel 2.11.0 Release

2012-09-05 Thread confluence







Camel 2.11.0 Release
Page edited by Claus Ibsen


 Changes (1)
 




...
* Fixed [Timer] to not fire during starting [CamelContext] * Fixed [XMLSecurity DataFormat] to enable retrieval of password-protected private keys for asymmetric decryption 
* Fixed [Exception Clause] using {{maximumRedeliveries(-1)}} may be wrongly inherited by another {{onException}} during a redelivery process. 
 h3. New [Enterprise Integration Patterns] 
...


Full Content

Camel 2.11.0 release (currently in progress)




New and Noteworthy

Welcome to the 2.11.0 release with approximately XXX issues resolved - including new features, improvements, and bug fixes, such as: 


	Added support for SOAP 1.2 in SOAP data format.
	Cache operation for add/update now supports expiry headers to control time to live/idle/eternal.
	Added allowNullBody option to JMS to configure whether sending messages with no body is allowed.
	Added connectOnStartup option to HDFS to allow to connect on demand, to avoid having Hadoop block for long time connecting to the HDFS cluster, as it has a hardcoded 15 minute retry mechanism.
	Added support for daily and weekly trends to Twitter component.
	The Camel Maven Archetypes now generates projects without any license headers.
	Added 'rejectOld' option to the Resequencer to prevent out of order messages from being delivered after capacity/timeout events occur
	Further optimized XPath under concurrent load, and as well ensured resources are cleaned up eagerly
	Added options allowNullBody and readLockMinLength to the File and FTP components.
	Made changed read lock strategy on FTP go faster (eg when the FTP server has a lot of files in the directory) if you enable the fastExistsCheck=true option as well. Notice that some FTP server may not support this.
	HL7 moves to HAPI 2.0 and supports using a dedicated Parser instance in the HL7 MLLP codec and DataFormat. Added "Terser" language and _expression_ to be able to extract fields from a parsed message. HL7 now uses Apache Mina 2.x.
	Add an option HttpMethodRestrict to restrict HTTP method in Jetty and SERVLET
	Add support for selection of Direct-VM consumers by using ant-like path _expression_.
	The POJO Producing, and POJO Consuming with @Consume, @Produce, @EndpointInject now supports a new {{property} attribute to get the endpoint configuration from a bean property (eg using a getter method); this allows you to configure this on the bean using conventional bean configuration.
	Testing with camel-test-blueprint on Windows no longer tries to cleanup after testing taking up 5 seconds and logging WARNs.
	The File, and FTP components now support fileExist=Move option to move any existing files before writing a file.
	Added option loadStatisticsEnabled on Camel JMX to allow to disable load statistics if not needed (avoids a background thread being in use, to calculate the load stats).
	Enabled "lazy connections" for XMPP providers via the testConnectionOnStartup option
	Added a connection monitor to detect and fix dropped XMPP consumer connections at configurable connectionPollDelay intervals
	Added an org.apache.camel.builder.ExchangeBuilder to build the Exchange using a builder pattern.
	Camel will now by default shutdown thread pools more graceful, waiting up till 5 seconds, before shutting down aggressively. The timeout value can be customized, see details at Threading Model.
	The Camel Run Maven Goal can now run CDI applications.
	The Camel CDI component has improved a lot.



Fixed issues


	Fixed RoutePolicy used from Spring XML with routePolicyRef may not invoke all callbacks on the policy.
	Fixed MINA consumer to force disconnect upon timeout when doing request/reply, as late replies may cause side effects otherwise.
	Fixed Simple language with empty quoted literals in predicates, so you can compare against empty strings.
	Fixed SOAP data format to set SOAP 1.1 namespace when marhsalling faults.
	Fixed SEDA producer to send to the right BlockingQueue being attached on the SEDA endpoint so that the sent messages don't get lost.
	Fixed using sendEmptyMessageWhenIdle=true on a batch consumer such as File now working with Aggregate EIP when using completionFromBatchConsumer
	Fixed MockEndpoint.expectedBodiesReceivedInAnyOrder to allow asserting on multiple arrival of the same/equal bodies.
	Fixed MyBatis to demarcate the running transactions properly while reading/writing from/to database.
	Fixed Jetty, HTTP, HTTP4, and AHC http components not working in bridge mode if content path have spaces
	Fixed the CXF fallback convertor issue which camel will unregister it when the converter return null.
	Fixed the issue that File2 endpoints on windows without volume name in the path url.
	Fixed the issue of unmarshal

svn commit: r1381184 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOn

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 13:51:57 2012
New Revision: 1381184

URL: http://svn.apache.org/viewvc?rev=1381184&view=rev
Log:
CAMEL-5570: Fixed issue with onException and using -1 for maximumRedelivieries 
may cause side effect on other onException. Thanks to Øyvind Ingebrigtsen 
Øvergaard for the patch.

Added:

camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
  - copied unchanged from r1381183, 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
Modified:
camel/branches/camel-2.9.x/   (props changed)

camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java

Propchange: camel/branches/camel-2.9.x/
--
  Merged /camel/trunk:r1381182
  Merged /camel/branches/camel-2.10.x:r1381183

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

Modified: 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java?rev=1381184&r1=1381183&r2=1381184&view=diff
==
--- 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
 (original)
+++ 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
 Wed Sep  5 13:51:57 2012
@@ -145,7 +145,7 @@ public class OnExceptionDefinition exten
 return CamelContextHelper.mandatoryLookup(context, 
redeliveryPolicyRef, RedeliveryPolicy.class);
 } else if (redeliveryPolicy != null) {
 return redeliveryPolicy.createRedeliveryPolicy(context, 
parentPolicy);
-} else if (!outputs.isEmpty() && parentPolicy.getMaximumRedeliveries() 
> 0) {
+} else if (!outputs.isEmpty() && parentPolicy.getMaximumRedeliveries() 
!= 0) {
 // if we have outputs, then do not inherit parent 
maximumRedeliveries
 // as you would have to explicit configure maximumRedeliveries on 
this onException to use it
 // this is the behavior Camel has always had




svn commit: r1381183 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyO

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 13:50:09 2012
New Revision: 1381183

URL: http://svn.apache.org/viewvc?rev=1381183&view=rev
Log:
CAMEL-5570: Fixed issue with onException and using -1 for maximumRedelivieries 
may cause side effect on other onException. Thanks to Øyvind Ingebrigtsen 
Øvergaard for the patch.

Added:

camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
  - copied unchanged from r1381182, 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
Modified:
camel/branches/camel-2.10.x/   (props changed)

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java

Propchange: camel/branches/camel-2.10.x/
--
  Merged /camel/trunk:r1381182

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

Modified: 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java?rev=1381183&r1=1381182&r2=1381183&view=diff
==
--- 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
 Wed Sep  5 13:50:09 2012
@@ -144,7 +144,7 @@ public class OnExceptionDefinition exten
 return CamelContextHelper.mandatoryLookup(context, 
redeliveryPolicyRef, RedeliveryPolicy.class);
 } else if (redeliveryPolicy != null) {
 return redeliveryPolicy.createRedeliveryPolicy(context, 
parentPolicy);
-} else if (!outputs.isEmpty() && parentPolicy.getMaximumRedeliveries() 
> 0) {
+} else if (!outputs.isEmpty() && parentPolicy.getMaximumRedeliveries() 
!= 0) {
 // if we have outputs, then do not inherit parent 
maximumRedeliveries
 // as you would have to explicit configure maximumRedeliveries on 
this onException to use it
 // this is the behavior Camel has always had




svn commit: r1381182 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/model/OnExceptionDefinition.java test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTe

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 13:47:17 2012
New Revision: 1381182

URL: http://svn.apache.org/viewvc?rev=1381182&view=rev
Log:
CAMEL-5570: Fixed issue with onException and using -1 for maximumRedelivieries 
may cause side effect on other onException. Thanks to Øyvind Ingebrigtsen 
Øvergaard for the patch.

Added:

camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
   (with props)
Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java?rev=1381182&r1=1381181&r2=1381182&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
 Wed Sep  5 13:47:17 2012
@@ -144,7 +144,7 @@ public class OnExceptionDefinition exten
 return CamelContextHelper.mandatoryLookup(context, 
redeliveryPolicyRef, RedeliveryPolicy.class);
 } else if (redeliveryPolicy != null) {
 return redeliveryPolicy.createRedeliveryPolicy(context, 
parentPolicy);
-} else if (!outputs.isEmpty() && parentPolicy.getMaximumRedeliveries() 
> 0) {
+} else if (!outputs.isEmpty() && parentPolicy.getMaximumRedeliveries() 
!= 0) {
 // if we have outputs, then do not inherit parent 
maximumRedeliveries
 // as you would have to explicit configure maximumRedeliveries on 
this onException to use it
 // this is the behavior Camel has always had

Added: 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java?rev=1381182&view=auto
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
 (added)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest.java
 Wed Sep  5 13:47:17 2012
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.issues;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ *
+ */
+public class RedeliveryPolicyOnExceptionWhileRedeliveringIssueTest extends 
ContextTestSupport {
+
+private class FirstException extends Exception {
+}
+
+private class SecondException extends Exception {
+}
+
+private class ExceptionThrowingProcessor implements Processor {
+
+@Override
+public void process(Exchange exchange) throws Exception {
+String camelRedeliveryCounter = 
exchange.getIn().getHeader(Exchange.REDELIVERY_COUNTER, String.class);
+int redeliveries = camelRedeliveryCounter == null ? 0 : 
Integer.valueOf(camelRedeliveryCounter);
+switch (redeliveries) {
+case 0:
+throw new FirstException();
+case 1:
+throw new SecondException();
+default:
+break; // no-op
+}
+}
+}
+public void testMessageShouldGoToError() throws Exception {
+String msg = "payload";
+
+getMockEndpoint("mock:destination").expectedMessageCount(0);
+getMockEndpoint("mock:error").expectedMessageCount(1);
+getMockEndpoint("mock:error").expectedBodiesReceived(msg);
+
+template.sendBody("direct:source", msg);
+
+assertMockEndpointsSatisfied();
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder()

svn commit: r1381155 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/management/ camel-core/src/main/java/org/apache/came

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 12:16:15 2012
New Revision: 1381155

URL: http://svn.apache.org/viewvc?rev=1381155&view=rev
Log:
CAMEL-5564: Ensure default error handler thread pool and management load task 
pool is shutdown properly.

Modified:
camel/branches/camel-2.9.x/   (props changed)

camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java

camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java

camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java

camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java

camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/management/LoadTimerTest.java

camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/support/TimerListenerManagerTest.java

Propchange: camel/branches/camel-2.9.x/
--
  Merged /camel/trunk:r1381089
  Merged /camel/branches/camel-2.10.x:r1381138

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

Modified: 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1381155&r1=1381154&r2=1381155&view=diff
==
--- 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 (original)
+++ 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 Wed Sep  5 12:16:15 2012
@@ -1561,6 +1561,12 @@ public class DefaultCamelContext extends
 
 // the stop order is important
 
+// shutdown default error handler thread pool
+if (errorHandlerExecutorService != null) {
+getExecutorServiceManager().shutdown(errorHandlerExecutorService);
+errorHandlerExecutorService = null;
+}
+
 // shutdown debugger
 ServiceHelper.stopAndShutdownService(getDebugger());
 

Modified: 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=1381155&r1=1381154&r2=1381155&view=diff
==
--- 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 (original)
+++ 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 Wed Sep  5 12:16:15 2012
@@ -81,7 +81,6 @@ import org.apache.camel.support.ServiceS
 import org.apache.camel.support.TimerListenerManager;
 import org.apache.camel.util.KeyValueHolder;
 import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -788,11 +787,10 @@ public class DefaultManagementLifecycleS
 boolean enabled = 
camelContext.getManagementStrategy().getStatisticsLevel() != 
ManagementStatisticsLevel.Off;
 if (enabled) {
 LOG.info("StatisticsLevel at {} so enabling load performance 
statistics", camelContext.getManagementStrategy().getStatisticsLevel());
-ScheduledExecutorService executorService = 
camelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(this, 
"ManagementLoadTask");
-timerListenerManager.setExecutorService(executorService);
 // must use 1 sec interval as the load statistics is based on 1 
sec calculations
 timerListenerManager.setInterval(1000);
-ServiceHelper.startService(timerListenerManager);
+// add as a service so we can manage its lifecycle
+getCamelContext().addService(timerListenerManager);
 }
 }
 
@@ -803,7 +801,6 @@ public class DefaultManagementLifecycleS
 preServices.clear();
 wrappedProcessors.clear();
 managedTracers.clear();
-ServiceHelper.stopService(timerListenerManager);
 }
 
 /**

Modified: 
camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java?rev=1381155&r1=1381154&r2=1381155&view=diff
==
--- 
camel/branches/cam

svn commit: r1381153 - /camel/trunk/.gitignore

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Wed Sep  5 12:11:21 2012
New Revision: 1381153

URL: http://svn.apache.org/viewvc?rev=1381153&view=rev
Log:
Updated the .gitignore file as Aki suggested

Modified:
camel/trunk/.gitignore

Modified: camel/trunk/.gitignore
URL: 
http://svn.apache.org/viewvc/camel/trunk/.gitignore?rev=1381153&r1=1381152&r2=1381153&view=diff
==
--- camel/trunk/.gitignore (original)
+++ camel/trunk/.gitignore Wed Sep  5 12:11:21 2012
@@ -1,5 +1,7 @@
 target
-*.i??
+*.iml
+*.ipr
+*.iws
 .idea
 .DS_Store
 .classpath




svn commit: r1381140 - in /camel/branches/camel-2.10.x: ./ camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 11:02:31 2012
New Revision: 1381140

URL: http://svn.apache.org/viewvc?rev=1381140&view=rev
Log:
CAMEL-5563: Camel now shutdown thread pools graceful at first and then fallback 
to be aggresive as before. Added more logging details during shutdown, as well 
logging if the shutdown takes a while. As well if there was any thread pools 
when Camel shutdown that wasnt properly shutdown beforehand. The graceful 
shutdown uses a 30 sec timeout.

Modified:
camel/branches/camel-2.10.x/   (props changed)

camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java

Propchange: camel/branches/camel-2.10.x/
--
  Merged /camel/trunk:r1381137

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

Modified: 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java?rev=1381140&r1=1381139&r2=1381140&view=diff
==
--- 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
 Wed Sep  5 11:02:31 2012
@@ -51,8 +51,9 @@ public class MultipleLifecycleStrategyTe
 context.stop();
 
 List expectedEvents = Arrays.asList("onContextStart", 
"onServiceAdd", "onServiceAdd", "onServiceAdd",
-"onServiceAdd", "onServiceAdd", "onServiceAdd", 
"onServiceAdd", "onThreadPoolAdd", "onThreadPoolAdd",
-"onComponentAdd", "onEndpointAdd", "onComponentRemove", 
"onContextStop"); 
+"onServiceAdd", "onServiceAdd", "onServiceAdd", 
"onServiceAdd", "onThreadPoolAdd", "onServiceAdd",
+"onThreadPoolAdd", "onComponentAdd", "onEndpointAdd", 
"onComponentRemove", "onContextStop");
+
 assertEquals(expectedEvents, dummy1.getEvents());
 assertEquals(expectedEvents, dummy2.getEvents());
 }




svn commit: r1381138 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/management/ camel-core/src/main/java/org/apache/cam

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 10:59:28 2012
New Revision: 1381138

URL: http://svn.apache.org/viewvc?rev=1381138&view=rev
Log:
CAMEL-5564: Ensure default error handler thread pool and management load task 
pool is shutdown properly.

Modified:
camel/branches/camel-2.10.x/   (props changed)

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java

camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/management/LoadTimerTest.java

camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddRemoveTest.java

camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/support/TimerListenerManagerTest.java

Propchange: camel/branches/camel-2.10.x/
--
  Merged /camel/trunk:r1381089

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

Modified: 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1381138&r1=1381137&r2=1381138&view=diff
==
--- 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 Wed Sep  5 10:59:28 2012
@@ -1604,6 +1604,12 @@ public class DefaultCamelContext extends
 
 // the stop order is important
 
+// shutdown default error handler thread pool
+if (errorHandlerExecutorService != null) {
+getExecutorServiceManager().shutdown(errorHandlerExecutorService);
+errorHandlerExecutorService = null;
+}
+
 // shutdown debugger
 ServiceHelper.stopAndShutdownService(getDebugger());
 

Modified: 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=1381138&r1=1381137&r2=1381138&view=diff
==
--- 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 Wed Sep  5 10:59:28 2012
@@ -85,7 +85,6 @@ import org.apache.camel.support.ServiceS
 import org.apache.camel.support.TimerListenerManager;
 import org.apache.camel.util.KeyValueHolder;
 import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -857,12 +856,10 @@ public class DefaultManagementLifecycleS
 boolean enabled = 
camelContext.getManagementStrategy().getStatisticsLevel() != 
ManagementStatisticsLevel.Off;
 if (enabled) {
 LOG.info("StatisticsLevel at {} so enabling load performance 
statistics", camelContext.getManagementStrategy().getStatisticsLevel());
-// we have to defer creating this until CamelContext has been 
started
-ScheduledExecutorService executorService = 
camelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(this, 
"ManagementLoadTask");
-timerListenerManager.setExecutorService(executorService);
 // must use 1 sec interval as the load statistics is based on 
1 sec calculations
 timerListenerManager.setInterval(1000);
-ServiceHelper.startService(timerListenerManager);
+// we have to defer enlisting timer lister manager as a 
service until CamelContext has been started
+getCamelContext().addService(timerListenerManager);
 }
 }
 }
@@ -875,7 +872,6 @@ public class DefaultManagementLifecycleS
 wrappedProcessors.clear();
 managedTracers.clear();
 managedThreadPools.clear();
-ServiceHelper.stopService(timerListenerManager);
 }
 
 /**

Modified: 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/

svn commit: r1381137 - /camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 10:58:58 2012
New Revision: 1381137

URL: http://svn.apache.org/viewvc?rev=1381137&view=rev
Log:
CAMEL-5563: Camel now shutdown thread pools graceful at first and then fallback 
to be aggresive as before. Added more logging details during shutdown, as well 
logging if the shutdown takes a while. As well if there was any thread pools 
when Camel shutdown that wasnt properly shutdown beforehand. The graceful 
shutdown uses a 30 sec timeout.

Modified:

camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java?rev=1381137&r1=1381136&r2=1381137&view=diff
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/impl/MultipleLifecycleStrategyTest.java
 Wed Sep  5 10:58:58 2012
@@ -51,8 +51,8 @@ public class MultipleLifecycleStrategyTe
 context.stop();
 
 List expectedEvents = Arrays.asList("onContextStart", 
"onServiceAdd", "onServiceAdd", "onServiceAdd",
-"onServiceAdd", "onServiceAdd", "onServiceAdd", 
"onServiceAdd", "onThreadPoolAdd", "onThreadPoolAdd",
-"onComponentAdd", "onEndpointAdd", "onComponentRemove", 
"onContextStop");
+"onServiceAdd", "onServiceAdd", "onServiceAdd", 
"onServiceAdd", "onThreadPoolAdd", "onServiceAdd",
+"onThreadPoolAdd", "onComponentAdd", "onEndpointAdd", 
"onComponentRemove", "onContextStop");
 
 assertEquals(expectedEvents, dummy1.getEvents());
 assertEquals(expectedEvents, dummy2.getEvents());




svn commit: r1381120 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/component/dataset/ camel-core/src/main/java/org/apache/camel/component/seda/ camel-core/src/main/ja

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 09:53:23 2012
New Revision: 1381120

URL: http://svn.apache.org/viewvc?rev=1381120&view=rev
Log:
CAMEL-5563: Camel now shutdown thread pools graceful at first and then fallback 
to be aggresive as before. Added more logging details during shutdown, as well 
logging if the shutdown takes a while. As well if there was any thread pools 
when Camel shutdown that wasnt properly shutdown beforehand. The graceful 
shutdown uses a 30 sec timeout.

Modified:
camel/branches/camel-2.10.x/   (props changed)

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/ThroughputLogger.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/concurrent/CamelThreadFactory.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableScheduledThreadPoolExecutor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableThreadPoolExecutor.java

camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/util/concurrent/SizedScheduledExecutorService.java

camel/branches/camel-2.10.x/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceManagerTest.java
camel/branches/camel-2.10.x/camel-core/src/test/resources/log4j.properties

camel/branches/camel-2.10.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java

camel/branches/camel-2.10.x/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java

camel/branches/camel-2.10.x/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java

camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java

camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java

camel/branches/camel-2.10.x/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java

camel/branches/camel-2.10.x/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java

camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java

camel/branches/camel-2.10.x/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java

camel/branches/camel-2.10.x/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java

Propchange: camel/branches/camel-2.10.x/
--
  Merged /camel/trunk:r1381072

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

Modified: 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java?rev=1381120&r1=1381119&r2=1381120&view=diff
==
--- 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
 (original)
+++ 
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
 Wed Sep  5 09:

svn commit: r1381096 - /camel/trunk/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/policy/ZookeeperElectionTest.java

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Wed Sep  5 09:24:15 2012
New Revision: 1381096

URL: http://svn.apache.org/viewvc?rev=1381096&view=rev
Log:
Try to fix the test error of ZookeeperElectionTest

Modified:

camel/trunk/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/policy/ZookeeperElectionTest.java

Modified: 
camel/trunk/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/policy/ZookeeperElectionTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/policy/ZookeeperElectionTest.java?rev=1381096&r1=1381095&r2=1381096&view=diff
==
--- 
camel/trunk/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/policy/ZookeeperElectionTest.java
 (original)
+++ 
camel/trunk/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/policy/ZookeeperElectionTest.java
 Wed Sep  5 09:24:15 2012
@@ -88,6 +88,8 @@ public class ZookeeperElectionTest exten
 ZooKeeperElection electionCandidate1 = 
createElectionCandidate(candidateOneContext, 2);
 assertTrue("The first candidate was not elected.", 
electionCandidate1.isMaster());
 ZooKeeperElection electionCandidate2 = 
createElectionCandidate(candidateTwoContext, 2);
+// Need to wait for a while to Candidate2 to be elected.
+Thread.sleep(2000);
 assertTrue("The second candidate should also be a master.", 
electionCandidate2.isMaster());
 }
 




svn commit: r831193 - in /websites/production/camel/content: cache/main.pageCache threading-model.html

2012-09-05 Thread buildbot
Author: buildbot
Date: Wed Sep  5 09:17:40 2012
New Revision: 831193

Log:
Production update by buildbot for camel

Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/threading-model.html

Modified: websites/production/camel/content/cache/main.pageCache
==
Binary files - no diff available.

Modified: websites/production/camel/content/threading-model.html
==
--- websites/production/camel/content/threading-model.html (original)
+++ websites/production/camel/content/threading-model.html Wed Sep  5 09:17:40 
2012
@@ -172,7 +172,10 @@ See the org.apache.camel.spi.Executo
 
 The ExecutorServiceManager has APIs for shutting down thread pools 
graceful and aggressively. Its encourage to use this API for creating and 
shutting down thread pools.
 
-From Camel 2.10.2 onwards Camel the graceful 
shutdown(executorService) method from ExecutorServiceManager 
will shutdown graceful at first, until a timeout value is hit. After that it 
shutdown aggressively. The timeout value is by default 5000 millis. 
You can configure a custom value on the ExecutorServiceManager if 
needed.
+From Camel 2.10.2 onwards Camel the graceful 
shutdown(executorService) method from ExecutorServiceManager 
will shutdown graceful at first, until a timeout value is hit. After that it 
shutdown aggressively, again using the timeout value to wait for the operation 
to complete. This means you can wait at most 2 x timeout for shutting down the 
thread pool.
+The timeout value is by default 3 millis. You can configure a 
custom value on the ExecutorServiceManager if needed.
+
+During shutdown Camel will log every 5th second at INFO level progress of 
shutting down the thread pool. For example in case a shutdown takes a while, 
then there is activity in the logs.
 
 See Also
 ArchitectureAsync




svn commit: r1381089 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/ main/java/org/apache/camel/management/ main/java/org/apache/camel/support/ test/java/org/apache/camel/management

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 09:16:40 2012
New Revision: 1381089

URL: http://svn.apache.org/viewvc?rev=1381089&view=rev
Log:
CAMEL-5564: Ensure default error handler thread pool and management load task 
pool is shutdown properly.

Modified:

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

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

camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java

camel/trunk/camel-core/src/test/java/org/apache/camel/management/LoadTimerTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedRouteAddRemoveTest.java

camel/trunk/camel-core/src/test/java/org/apache/camel/support/TimerListenerManagerTest.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1381089&r1=1381088&r2=1381089&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
 Wed Sep  5 09:16:40 2012
@@ -1603,6 +1603,12 @@ public class DefaultCamelContext extends
 
 // the stop order is important
 
+// shutdown default error handler thread pool
+if (errorHandlerExecutorService != null) {
+getExecutorServiceManager().shutdown(errorHandlerExecutorService);
+errorHandlerExecutorService = null;
+}
+
 // shutdown debugger
 ServiceHelper.stopAndShutdownService(getDebugger());
 

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java?rev=1381089&r1=1381088&r2=1381089&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
 Wed Sep  5 09:16:40 2012
@@ -85,7 +85,6 @@ import org.apache.camel.support.ServiceS
 import org.apache.camel.support.TimerListenerManager;
 import org.apache.camel.util.KeyValueHolder;
 import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ServiceHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -859,13 +858,10 @@ public class DefaultManagementLifecycleS
 || 
camelContext.getManagementStrategy().getStatisticsLevel() == 
ManagementStatisticsLevel.Off;
 if (!disabled) {
 LOG.info("Load performance statistics enabled.");
-// we have to defer creating this until CamelContext has been 
started
-// (the thread pool will be shutdown automatic by CamelContext 
when its stopped)
-ScheduledExecutorService executorService = 
camelContext.getExecutorServiceManager().newSingleThreadScheduledExecutor(this, 
"ManagementLoadTask");
-timerListenerManager.setExecutorService(executorService);
 // must use 1 sec interval as the load statistics is based on 
1 sec calculations
 timerListenerManager.setInterval(1000);
-ServiceHelper.startService(timerListenerManager);
+// we have to defer enlisting timer lister manager as a 
service until CamelContext has been started
+getCamelContext().addService(timerListenerManager);
 }
 }
 }
@@ -878,7 +874,6 @@ public class DefaultManagementLifecycleS
 wrappedProcessors.clear();
 managedTracers.clear();
 managedThreadPools.clear();
-ServiceHelper.stopService(timerListenerManager);
 }
 
 /**

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java?rev=1381089&r1=1381088&r2=1381089&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/support/TimerListenerManager.java
 Wed Sep  5 09:16:40 2012
@@ -22,6 +22,8 @@ import java.util.concurrent.ScheduledExe
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Tim

[CONF] Apache Camel > Threading Model

2012-09-05 Thread confluence







Threading Model
Page edited by Claus Ibsen


 Changes (3)
 




...
The {{ExecutorServiceManager}} has APIs for shutting down thread pools graceful and aggressively. Its encourage to use this API for creating and shutting down thread pools.  
From *Camel 2.10.2* onwards Camel the graceful {{shutdown(executorService)}} method from {{ExecutorServiceManager}} will shutdown graceful at first, until a timeout value is hit. After that it shutdown aggressively. The timeout value is by default {{5000}} millis. You can configure a custom value on the {{ExecutorServiceManager}} if needed. 
From *Camel 2.10.2* onwards Camel the graceful {{shutdown(executorService)}} method from {{ExecutorServiceManager}} will shutdown graceful at first, until a timeout value is hit. After that it shutdown aggressively, again using the timeout value to wait for the operation to complete. This means you can wait at most 2 x timeout for shutting down the thread pool. The timeout value is by default {{3}} millis. You can configure a custom value on the {{ExecutorServiceManager}} if needed. 
 
During shutdown Camel will log every 5th second at INFO level progress of shutting down the thread pool. For example in case a shutdown takes a while, then there is activity in the logs.  
h3. See Also - [Architecture] 
...


Full Content

Threading Model
Available as of Camel 2.3

The threading model in Camel is based on leveraging the JDK concurrency API which provides thread pools, named ExecutorService.

Camel leverages thread pools in the following places:

	several EIP patterns supports using thread pools for concurrency
	SEDA component for asynchronous connectivity
	Threads DSL in the Camel route
	ServicePool for pooling services
	And some component provide thread pools by nature such as JMS, Jetty



Thread pool profiles
By default when a thread pool is to be created then its based on the default thread pool profile which is:


"defaultThreadPoolProfile" defaultProfile="true"
   poolSize="10" maxPoolSize="20" maxQueueSize="1000"
   rejectedPolicy="CallerRuns"/>



What that means is that for example when you use Multicast with parallelProcessing=true enabled, then it would create a thread pool based on the profile above. The rejectedPolicy has four options: Abort, CallerRuns, Discard, DiscardOldest which corresponds to the same four options provided out of the box in the JDK. 

You can define as many thread pool profiles as you like. But there must only one default profile. A custom thread pool profile will inherit from the default profile. Which means that any option you do not explicit define will fallback and use the option from the default profile.

You can use -1 in maxQueueSize to indicate a unbounded queue.

In Java DSL you can configure the default thread pool profile from the ExecutorServiceStrategy/ExecutorServiceManager which you access from CamelContext.

Using thread pool profiles

Suppose you want to use a custom thread pool profile for a Multicast EIP pattern in a Camel route you can do it using the executorServiceRef attribute as shown:



...
"fooProfile" 
   poolSize="20" maxPoolSize="50" maxQueueSize="-1"/>
...


   ...
   "myStrategy" executorServiceRef="fooProfile">
  ...
   
  ...




What Camel will do at runtime is to lookup in the Registry for a ExecutorService with the id = fooProfile. If none found it will fallback and see if there is a ThreadPoolProfile defined with that id. And in this example there is and so the profile is used for creating a new ExecutorService which is handed back to the Multicast EIP to use in the route.

Create custom thread pool
You can also use the  tag in Spring XML to create a specific thread pool (eg ExecutorService). Notice that any options you do not explicit define, will have Camel to use the default thread pool profile as fallback. For example if you omit setting the maxQueueSize then Camel will fallback and use the value from the default thread pool profiles, which by default is 1000. 

Management
All the thread pools that Camel creates are managed and thus you can see them in JConsole under the threadpools category.

ExecutorServiceStrategy
Available as of Camel 2.3 to 2.8.x
Camel provides a pluggable strategy to hook in your own thread pool provider, for example from a WorkManager in a J2EE server etc.
See the org.apache.camel.spi.ExecutorServiceStrategy interface which you should implement and hook into the WorkManager.

See Advanced configuration of CamelContext using Spring for how to configure it.

You can configure it on the CamelContext from Java DSL using the getter/setter.

svn commit: r1381072 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/dataset/ camel-core/src/main/java/org/apache/camel/component/seda/ camel-core/src/main/java/org/apache/camel

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 08:44:51 2012
New Revision: 1381072

URL: http://svn.apache.org/viewvc?rev=1381072&view=rev
Log:
CAMEL-5563: Camel now shutdown thread pools graceful at first and then fallback 
to be aggresive as before. Added more logging details during shutdown, as well 
logging if the shutdown takes a while. As well if there was any thread pools 
when Camel shutdown that wasnt properly shutdown beforehand. The graceful 
shutdown uses a 30 sec timeout.

Modified:

camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java

camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java

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

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

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

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelayProcessorSupport.java

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/OnCompletionProcessor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThreadsProcessor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/ThroughputLogger.java

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/WireTapProcessor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java

camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/CamelThreadFactory.java

camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableScheduledThreadPoolExecutor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/RejectableThreadPoolExecutor.java

camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/SizedScheduledExecutorService.java

camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultExecutorServiceManagerTest.java
camel/trunk/camel-core/src/test/resources/log4j.properties

camel/trunk/components/camel-aws/src/main/java/org/apache/camel/component/aws/sqs/SqsConsumer.java

camel/trunk/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbConsumer.java

camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/seda/HazelcastSedaConsumer.java

camel/trunk/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java

camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java

camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/ReplyManagerSupport.java

camel/trunk/components/camel-kestrel/src/main/java/org/apache/camel/component/kestrel/KestrelConsumer.java

camel/trunk/components/camel-mina/src/main/java/org/apache/camel/component/mina/MinaEndpoint.java

camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConsumer.java

camel/trunk/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java

camel/trunk/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java

camel/trunk/components/camel-xmpp/src/main/java/org/apache/camel/component/xmpp/XmppConsumer.java

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java?rev=1381072&r1=1381071&r2=1381072&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/dataset/DataSetConsumer.java
 Wed Sep  5 08:44:51 2012
@@ -77,7 +77,7 @@ public class DataSetConsumer extends Def
 super.doStop();
 
 if (executorService != null) {
-
camelContext.getExecutorServiceManager().shutdownNow(executorService);
+camelContext.getExecutorServiceManager().shutdown(executorService);
 executorService = null;
 }
 }

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=1381072&r1=1381071&r2=1381072&view=diff
==
--- 
camel

svn commit: r1381065 - in /camel/trunk/components/camel-servlet: pom.xml src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Wed Sep  5 08:33:42 2012
New Revision: 1381065

URL: http://svn.apache.org/viewvc?rev=1381065&view=rev
Log:
Fixed the Servlet test failures which is caused by upgrading httpunit

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

camel/trunk/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java

Modified: camel/trunk/components/camel-servlet/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-servlet/pom.xml?rev=1381065&r1=1381064&r2=1381065&view=diff
==
--- camel/trunk/components/camel-servlet/pom.xml (original)
+++ camel/trunk/components/camel-servlet/pom.xml Wed Sep  5 08:33:42 2012
@@ -109,6 +109,12 @@
   
   test
 
+ 
+  rhino
+  js
+  1.7R1
+  test
+
 
   org.springframework
   spring-web

Modified: 
camel/trunk/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java?rev=1381065&r1=1381064&r2=1381065&view=diff
==
--- 
camel/trunk/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
 (original)
+++ 
camel/trunk/components/camel-servlet/src/test/java/org/apache/camel/component/servlet/HttpClientRouteTest.java
 Wed Sep  5 08:33:42 2012
@@ -34,12 +34,12 @@ import org.junit.Test;
 
 public class HttpClientRouteTest extends ServletCamelRouterTestSupport {
 private static final String POST_DATA = " hello world ";
-private static final String CONTENT_TYPE = "text/xml";
+private static final String CONTENT_TYPE = "text/xml; charset=UTF-8";
 private static final String UNICODE_TEXT = "B\u00FCe W\u00F6rld";
 
 @Test
 public void testHttpClient() throws Exception {
-WebRequest req = new PostMethodWebRequest(CONTEXT_URL + 
"/services/hello", new ByteArrayInputStream(POST_DATA.getBytes()), "text/xml; 
charset=UTF-8");
+WebRequest req = new PostMethodWebRequest(CONTEXT_URL + 
"/services/hello", new ByteArrayInputStream(POST_DATA.getBytes()), 
CONTENT_TYPE);
 ServletUnitClient client = newClient();
 WebResponse response = client.getResponse(req);
 
@@ -48,7 +48,7 @@ public class HttpClientRouteTest extends
 assertEquals("Get a wrong message header", "/hello", 
response.getHeaderField("PATH"));
 assertEquals("The response message is wrong ", "OK", 
response.getResponseMessage());
 
-req = new PostMethodWebRequest(CONTEXT_URL + "/services/helloworld", 
new ByteArrayInputStream(POST_DATA.getBytes()), "text/xml; charset=UTF-8");
+req = new PostMethodWebRequest(CONTEXT_URL + "/services/helloworld", 
new ByteArrayInputStream(POST_DATA.getBytes()), CONTENT_TYPE);
 response = client.getResponse(req);
 
 assertEquals("Get wrong content type", "text/xml", 
response.getContentType());
@@ -95,7 +95,6 @@ public class HttpClientRouteTest extends
 WebResponse response = client.getResponse(req);
 assertEquals("The response message is wrong ", "OK", 
response.getResponseMessage());
 assertEquals("The response body is wrong", UNICODE_TEXT, 
response.getText());
-System.out.println(response.getText());
 }
 
 @Test




svn commit: r831188 - in /websites/production/camel/content: cache/main.pageCache camel-2110-release.html

2012-09-05 Thread buildbot
Author: buildbot
Date: Wed Sep  5 08:17:48 2012
New Revision: 831188

Log:
Production update by buildbot for camel

Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/camel-2110-release.html

Modified: websites/production/camel/content/cache/main.pageCache
==
Binary files - no diff available.

Modified: websites/production/camel/content/camel-2110-release.html
==
--- websites/production/camel/content/camel-2110-release.html (original)
+++ websites/production/camel/content/camel-2110-release.html Wed Sep  5 
08:17:48 2012
@@ -84,7 +84,7 @@
 
 Welcome to the 2.11.0 release with approximately XXX issues resolved - 
including new features, improvements, and bug fixes, such as: 
 
-Added support for SOAP 1.2 in SOAP data format.Cache operation for add/update now supports expiry headers to 
control time to live/idle/eternal.Added allowNullBody option 
to JMS to configure whether 
sending messages with no body is allowed.Added 
connectOnStartup option to HDFS to allow to connect on demand, to avoid having Hadoop 
block for long time connecting to the HDFS cluster, as it has a hardcoded 15 
minute retry mechanism.Added support for daily and weekly trends to Twitter 
component.The Camel Maven Archetypes now generates 
projects without any license headers.Added 'rejectOld' option to the title="Resequencer">Resequencer to prevent out of order messages from 
 >being delivered after capacity/timeout events occurFurther optimized 
 >XPath under concurrent 
 >load, and as well ensured resources are cleaned up eagerlyAdded 
 >options allowNullBody and readLockMinLength to the shape="rect" href="file2.html" title="File2">File and href="ftp2.html" title="FTP2">FTP components.Made 
 >changed read lock strategy on title="FTP2">FTP go faster (eg when the FTP server has a lot of files in 
 >the directory) if you enable the fastExistsCheck=true option as 
 >well. Notice that some FTP server may not support this.shape="rect" href="hl7.html" title="HL7">HL7 moves the HAPI 2.0 and 
 >supports Parser instance into unmarshal an
 d "Terser" language and expression to be able to extract fields from a parsed 
message. HL7 also upgraded to 
now use Apache Mina 2.x.Add an option HttpMethodRestrict to 
restrict HTTP method in Jetty and SERVLETAdd support for selection of Direct-VM consumers by 
using ant-like path expression.The POJO Producing, and POJO 
Consuming with @Consume, @Produce, @EndpointInject now supports a new 
{{property} attribute to get the endpoint configuration from a bean property 
(eg using a getter method); this allows you to configure this on the bean using 
conventional bean configuration.Testing 
 with camel-test-blueprint on Windows no longer tries to cleanup after 
testing taking up 5 seconds and logging WARNs.The File, and FTP components now support fileExist=Move option to 
move any existing files before writing a file.Added option 
loadStatisticsEnabled on Camel JMX to allow to disable load statistics if not 
needed (avoids a background thread being in use, to calculate the load 
stats).Enabled "lazy connections" for XMPP providers via the testConnectionOnStartup 
optionAdded a connection monitor to detect and fix dropped XMPP consumer connections at 
configurable connectionPollDelay intervalsAdded an 
org.apache.camel.bu
 ilder.ExchangeBuilder to build the Exchange using a builder pattern.Camel will now 
by default shutdown thread pools more graceful, waiting up till 5 seconds, 
before shutting down aggressively. The timeout value can be customized, see 
details at Threading Model.The Camel Run Maven 
Goal can now run CDI 
applications.The Camel CDI component has improved a lot.
+Added support for SOAP 1.2 in SOAP data format.Cache operation for add/update now supports expiry headers to 
control time to live/idle/eternal.Added allowNullBody option 
to JMS to configure whether 
sending messages with no body is allowed.Added 
connectOnStartup option to HDFS to allow to connect on demand, to avoid having Hadoop 
block for long time connecting to the HDFS cluster, as it has a hardcoded 15 
minute retry mechanism.Added support for daily and weekly trends to Twitter 
component.The Camel Maven Archetypes now generates 
projects without any license headers.Added 'rejectOld' option to the title="Resequencer">Resequencer to prevent out of order messages from 
 >being delivered after capacity/timeout events occurFurther optimized 
 >XPath under concurrent 
 >load, and as well ensured resources are cleaned up eagerlyAdded 
 >options allowNullBody and readLockMinLength to the shape="rect" href="file2.html" title="File2">File and href="ftp2.html" title="FTP2">FTP components.Made 
 >changed read lock strategy on title="FTP2">FTP go faster (eg when the FTP server has a lot of files in 
 >the directory) if you enable the f

svn commit: r1381044 - in /camel/trunk/components: camel-cmis/src/main/java/org/apache/camel/component/cmis/RecursiveTreeWalker.java camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Wed Sep  5 07:33:39 2012
New Revision: 1381044

URL: http://svn.apache.org/viewvc?rev=1381044&view=rev
Log:
clean up the codes

Modified:

camel/trunk/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/RecursiveTreeWalker.java

camel/trunk/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java

Modified: 
camel/trunk/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/RecursiveTreeWalker.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/RecursiveTreeWalker.java?rev=1381044&r1=1381043&r2=1381044&view=diff
==
--- 
camel/trunk/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/RecursiveTreeWalker.java
 (original)
+++ 
camel/trunk/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/RecursiveTreeWalker.java
 Wed Sep  5 07:33:39 2012
@@ -24,7 +24,6 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.api.Folder;
 import org.apache.chemistry.opencmis.client.api.ItemIterable;
 import org.apache.chemistry.opencmis.client.api.OperationContext;
-import org.apache.chemistry.opencmis.client.runtime.OperationContextImpl;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: 
camel/trunk/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java?rev=1381044&r1=1381043&r2=1381044&view=diff
==
--- 
camel/trunk/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java
 (original)
+++ 
camel/trunk/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastAtomicnumberProducerForSpringTest.java
 Wed Sep  5 07:33:39 2012
@@ -16,12 +16,8 @@
  */
 package org.apache.camel.component.hazelcast;
 
-import com.hazelcast.core.Hazelcast;
-
 import org.apache.camel.test.junit4.CamelSpringTestSupport;
-
 import org.junit.Test;
-
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 




svn commit: r1381042 - in /camel/trunk/components/camel-http4: pom.xml src/main/java/org/apache/camel/component/http4/HttpComponent.java src/main/java/org/apache/camel/component/http4/HttpProducer.jav

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Wed Sep  5 07:32:56 2012
New Revision: 1381042

URL: http://svn.apache.org/viewvc?rev=1381042&view=rev
Log:
Upgarde the http client of camel-http4 to 4.2.x

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

camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java

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

Modified: camel/trunk/components/camel-http4/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/pom.xml?rev=1381042&r1=1381041&r2=1381042&view=diff
==
--- camel/trunk/components/camel-http4/pom.xml (original)
+++ camel/trunk/components/camel-http4/pom.xml Wed Sep  5 07:32:56 2012
@@ -32,9 +32,9 @@
 Camel HTTP (Apache HttpClient 4.x) support
 
 
-   
+   

-   org.apache.http.*;version="[4.1,5)"
+   org.apache.http.*;version="[4.2,5)"


org.apache.camel.component.http4.*
 

Modified: 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java?rev=1381042&r1=1381041&r2=1381042&view=diff
==
--- 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 (original)
+++ 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpComponent.java
 Wed Sep  5 07:32:56 2012
@@ -30,7 +30,6 @@ import org.apache.camel.util.jsse.SSLCon
 import org.apache.http.auth.params.AuthParamBean;
 import org.apache.http.client.params.ClientParamBean;
 import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.params.ConnConnectionParamBean;
 import org.apache.http.conn.params.ConnRouteParamBean;
 import org.apache.http.conn.scheme.PlainSocketFactory;
 import org.apache.http.conn.scheme.Scheme;
@@ -39,7 +38,7 @@ import org.apache.http.conn.ssl.BrowserC
 import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.conn.ssl.X509HostnameVerifier;
 import org.apache.http.cookie.params.CookieSpecParamBean;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpConnectionParamBean;
 import org.apache.http.params.HttpParams;
@@ -292,7 +291,7 @@ public class HttpComponent extends Heade
 protected ClientConnectionManager createConnectionManager() {
 SchemeRegistry schemeRegistry = new SchemeRegistry();
 
-ThreadSafeClientConnManager answer = new 
ThreadSafeClientConnManager(schemeRegistry);
+PoolingClientConnectionManager answer = new 
PoolingClientConnectionManager(schemeRegistry);
 if (getMaxTotalConnections() > 0) {
 answer.setMaxTotal(getMaxTotalConnections());
 }
@@ -312,10 +311,7 @@ public class HttpComponent extends Heade
 
 ClientParamBean clientParamBean = new ClientParamBean(clientParams);
 IntrospectionSupport.setProperties(clientParamBean, parameters, 
"httpClient.");
-
-ConnConnectionParamBean connConnectionParamBean = new 
ConnConnectionParamBean(clientParams);
-IntrospectionSupport.setProperties(connConnectionParamBean, 
parameters, "httpClient.");
-
+
 ConnRouteParamBean connRouteParamBean = new 
ConnRouteParamBean(clientParams);
 IntrospectionSupport.setProperties(connRouteParamBean, parameters, 
"httpClient.");
 

Modified: 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java?rev=1381042&r1=1381041&r2=1381042&view=diff
==
--- 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
 (original)
+++ 
camel/trunk/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
 Wed Sep  5 07:32:56 2012
@@ -52,6 +52,7 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.FileEntity;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
@@ -408,9 +409,12 @@ public class HttpProducer extends Defaul
 try {
 Object data = in.getBody();
 

svn commit: r1381041 - in /camel/trunk/components/camel-cdi/src/main/java/org/apache/camel: cdi/CamelStartup.java component/cdi/internal/BeanAdapter.java component/cdi/internal/CamelExtension.java

2012-09-05 Thread ningjiang
Author: ningjiang
Date: Wed Sep  5 07:32:26 2012
New Revision: 1381041

URL: http://svn.apache.org/viewvc?rev=1381041&view=rev
Log:
Fixed the eclipse warning of came-cdi

Modified:

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java

camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java?rev=1381041&r1=1381040&r2=1381041&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/CamelStartup.java
 Wed Sep  5 07:32:26 2012
@@ -20,8 +20,9 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import javax.enterprise.util.Nonbinding;
-import javax.inject.Qualifier;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
 
 /**
  * Used to annotate a {@link RouteBuilder} class to bind it to a

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java?rev=1381041&r1=1381040&r2=1381041&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/BeanAdapter.java
 Wed Sep  5 07:32:26 2012
@@ -24,7 +24,6 @@ import java.util.List;
 import org.apache.camel.Consume;
 import org.apache.camel.EndpointInject;
 import org.apache.camel.Produce;
-import org.apache.camel.impl.CamelPostProcessorHelper;
 import org.apache.camel.impl.DefaultCamelBeanPostProcessor;
 
 /**

Modified: 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java?rev=1381041&r1=1381040&r2=1381041&view=diff
==
--- 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
 (original)
+++ 
camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java
 Wed Sep  5 07:32:26 2012
@@ -163,7 +163,6 @@ public class CamelExtension implements E
 Set, BeanAdapter>> entries = eagerBeans.entrySet();
 for (Map.Entry, BeanAdapter> entry : entries) {
 Bean bean = entry.getKey();
-BeanAdapter adapter = entry.getValue();
 CreationalContext creationalContext = 
beanManager.createCreationalContext(bean);
 
 // force lazy creation




[CONF] Apache Camel > Camel 2.11.0 Release

2012-09-05 Thread confluence







Camel 2.11.0 Release
Page edited by Christian Ohr


 Changes (4)
 




...
* Added options {{allowNullBody}} and {{readLockMinLength}} to the [File|File2] and [FTP|FTP2] components. * Made {{changed}} read lock strategy on [FTP|FTP2] go faster (eg when the FTP server has a lot of files in the directory) if you enable the {{fastExistsCheck=true}} option as well. Notice that some FTP server may not support this. 
* [HL7] moves the HAPI 2.0 and supports Parser instance into unmarshal and "Terser" language and _expression_ to be able to extract fields from a parsed message. [HL7] also upgraded to now use Apache Mina 2.x. 
* [HL7] moves to HAPI 2.0 and supports using a dedicated Parser instance in the [HL7] MLLP codec and DataFormat. Added "Terser" language and _expression_ to be able to extract fields from a parsed message. [HL7] now uses Apache Mina 2.x. 
* Add an option {{HttpMethodRestrict}} to restrict HTTP method in [Jetty] and [Servlet] * Add support for selection of [direct-vm] consumers by using ant-like path _expression_. 
...
 * {{camel-mina2}} now uses {{OrderedThreadPoolExecutor}} by default. There is a new option {{orderedThreadPoolExecutor}} you can configure it to {{false}} to revert back to unordered if needed. Mina that using SSL etc. requires ordered. 
* The default value of the {{delay}} option on [Timer] has been changed from {{0}} to {{1000}} 
* The default value of the {{convertLFtoCR}} option of the [HL7] MLLP codec has been changed from {{true}} to {{false}}. Likewise, the [HL7] DataFormat and TypeConverter do not perform this conversion anymore. 
 h2. Notice 
...


Full Content

Camel 2.11.0 release (currently in progress)




New and Noteworthy

Welcome to the 2.11.0 release with approximately XXX issues resolved - including new features, improvements, and bug fixes, such as: 


	Added support for SOAP 1.2 in SOAP data format.
	Cache operation for add/update now supports expiry headers to control time to live/idle/eternal.
	Added allowNullBody option to JMS to configure whether sending messages with no body is allowed.
	Added connectOnStartup option to HDFS to allow to connect on demand, to avoid having Hadoop block for long time connecting to the HDFS cluster, as it has a hardcoded 15 minute retry mechanism.
	Added support for daily and weekly trends to Twitter component.
	The Camel Maven Archetypes now generates projects without any license headers.
	Added 'rejectOld' option to the Resequencer to prevent out of order messages from being delivered after capacity/timeout events occur
	Further optimized XPath under concurrent load, and as well ensured resources are cleaned up eagerly
	Added options allowNullBody and readLockMinLength to the File and FTP components.
	Made changed read lock strategy on FTP go faster (eg when the FTP server has a lot of files in the directory) if you enable the fastExistsCheck=true option as well. Notice that some FTP server may not support this.
	HL7 moves to HAPI 2.0 and supports using a dedicated Parser instance in the HL7 MLLP codec and DataFormat. Added "Terser" language and _expression_ to be able to extract fields from a parsed message. HL7 now uses Apache Mina 2.x.
	Add an option HttpMethodRestrict to restrict HTTP method in Jetty and SERVLET
	Add support for selection of Direct-VM consumers by using ant-like path _expression_.
	The POJO Producing, and POJO Consuming with @Consume, @Produce, @EndpointInject now supports a new {{property} attribute to get the endpoint configuration from a bean property (eg using a getter method); this allows you to configure this on the bean using conventional bean configuration.
	Testing with camel-test-blueprint on Windows no longer tries to cleanup after testing taking up 5 seconds and logging WARNs.
	The File, and FTP components now support fileExist=Move option to move any existing files before writing a file.
	Added option loadStatisticsEnabled on Camel JMX to allow to disable load statistics if not needed (avoids a background thread being in use, to calculate the load stats).
	Enabled "lazy connections" for XMPP providers via the testConnectionOnStartup option
	Added a connection monitor to detect and fix dropped XMPP consumer connections at configurable connectionPollDelay intervals
	Added an org.apache.camel.builder.ExchangeBuilder to build the Exchange using a builder pattern.
	Camel will now by default shutdown thread pools more graceful, waiting up till 5 seconds, before shutting down aggressively. The timeout value can be customized, see details at Threading Model.
	The Camel Run Maven Goal can now run CDI applications.
	The Camel CDI component has improved a lot.



Fixed issu

svn commit: r1381034 - in /camel/trunk/components/camel-hl7: ./ src/main/java/org/apache/camel/component/hl7/ src/test/java/org/apache/camel/component/hl7/

2012-09-05 Thread davsclaus
Author: davsclaus
Date: Wed Sep  5 07:08:21 2012
New Revision: 1381034

URL: http://svn.apache.org/viewvc?rev=1381034&view=rev
Log:
CAMEL-5304: camel-hl7 line terminator default changed. Thanks to Christian Ohr 
for the patch.

Added:

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/ConvertLineFeedTest.java
   (with props)
Modified:
camel/trunk/components/camel-hl7/   (props changed)

camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7.java

camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java

camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7MLLPCodec.java

camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7MLLPConfig.java

camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7MLLPDecoder.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/AckExpressionTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7DataFormatTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7MLLPCodecTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7RouteTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7ValidateTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/HL7XmlDataFormatTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/MessageValidatorTest.java

camel/trunk/components/camel-hl7/src/test/java/org/apache/camel/component/hl7/TerserExpressionTest.java

Propchange: camel/trunk/components/camel-hl7/
--
--- svn:ignore (original)
+++ svn:ignore Wed Sep  5 07:08:21 2012
@@ -14,3 +14,5 @@ eclipse-classes
 *.ipr
 *.iml
 *.iws
+*.idea
+id_file

Modified: 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7.java?rev=1381034&r1=1381033&r2=1381034&view=diff
==
--- 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7.java
 (original)
+++ 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7.java
 Wed Sep  5 07:08:21 2012
@@ -18,12 +18,14 @@ package org.apache.camel.component.hl7;
 
 import ca.uhn.hl7v2.validation.ValidationContext;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.ValueBuilder;
+import org.apache.camel.support.ExpressionAdapter;
 
 public final class HL7 {
-
+
 private HL7() {
 // Helper class
 }
@@ -40,11 +42,25 @@ public final class HL7 {
 return new AckExpression(code);
 }
 
-public static Expression ack(AckCode code, String errorMessage, int 
errorCode) {
+public static Expression convertLFToCR() {
+return new ExpressionAdapter() {
+
+@Override
+public Object evaluate(Exchange exchange) {
+String s = exchange.getIn().getBody(String.class);
+return s != null ? s.replace('\n', '\r') : null;
+}
+
+};
+}
+
+public static Expression ack(AckCode code, String errorMessage,
+int errorCode) {
 return new AckExpression(code, errorMessage, errorCode);
 }
 
-public static Predicate messageConformsTo(ValidationContext 
validationContext) {
+public static Predicate messageConformsTo(
+ValidationContext validationContext) {
 return new ValidationContextPredicate(validationContext);
 }
 

Modified: 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java?rev=1381034&r1=1381033&r2=1381034&view=diff
==
--- 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java
 (original)
+++ 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/component/hl7/HL7Converter.java
 Wed Sep  5 07:08:21 2012
@@ -44,8 +44,6 @@ public final class HL7Converter {
 }
 
 static Message parse(String body, Parser parser) throws HL7Exception {
-// replace \n with \r as HL7 uses 0x0d = \r as segment terminators and 
HAPI only parses with \r
-body = body.replace('\n', '\r');
 return parser.parse(body);
 }
 

Modified: 
camel/trunk/components/camel-hl7/src/main/java/org/apache/camel/co