svn commit: r1042780 - in /camel/trunk: components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/ tests/camel-ite

2010-12-06 Thread gnodet
Author: gnodet
Date: Mon Dec  6 20:29:22 2010
New Revision: 1042780

URL: http://svn.apache.org/viewvc?rev=1042780&view=rev
Log:
[CAMEL-3271] packageScan does not work with camel-blueprint

Added:

camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java

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

camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-4.xml

camel/trunk/tests/camel-itest-osgi/src/test/resources/org/apache/camel/itest/osgi/blueprint/blueprint-5.xml
Modified:

camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java

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

Modified: 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java?rev=1042780&r1=1042779&r2=1042780&view=diff
==
--- 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
 (original)
+++ 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
 Mon Dec  6 20:29:22 2010
@@ -27,12 +27,14 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.aries.blueprint.ExtendedBlueprintContainer;
 import org.apache.camel.RoutesBuilder;
 import org.apache.camel.ShutdownRoute;
 import org.apache.camel.ShutdownRunningTask;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.core.osgi.OsgiCamelContextPublisher;
 import org.apache.camel.core.osgi.OsgiEventAdminNotifier;
+import org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader;
 import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
 import org.apache.camel.core.xml.CamelJMXAgentDefinition;
 import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
@@ -197,6 +199,15 @@ public class CamelContextFactoryBean ext
 
 @Override
 protected void findRouteBuildersByPackageScan(String[] packages, 
PackageScanFilter filter, List builders) throws Exception {
+// add filter to class resolver which then will filter
+getContext().getPackageScanClassResolver().addFilter(filter);
+ClassLoader classLoader = new 
BundleDelegatingClassLoader(((ExtendedBlueprintContainer) 
blueprintContainer).getBundleContext().getBundle());
+PackageScanRouteBuilderFinder finder = new 
PackageScanRouteBuilderFinder(getContext(), packages, classLoader,
+   
  /*getBeanPostProcessor(),*/ getContext().getPackageScanClassResolver());
+finder.appendBuilders(builders);
+
+// and remove the filter
+getContext().getPackageScanClassResolver().removeFilter(filter);
 }
 
 @Override

Added: 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java?rev=1042780&view=auto
==
--- 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java
 (added)
+++ 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/PackageScanRouteBuilderFinder.java
 Mon Dec  6 20:29:22 2010
@@ -0,0 +1,122 @@
+/**
+ * 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.blueprint;
+
+import java.lang.reflect.Modifier;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.spi.Packa

svn commit: r1042753 - /camel/trunk/components/camel-jibx/pom.xml

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 18:17:46 2010
New Revision: 1042753

URL: http://svn.apache.org/viewvc?rev=1042753&view=rev
Log:
Added license to pom.xml

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

Modified: camel/trunk/components/camel-jibx/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jibx/pom.xml?rev=1042753&r1=1042752&r2=1042753&view=diff
==
--- camel/trunk/components/camel-jibx/pom.xml (original)
+++ camel/trunk/components/camel-jibx/pom.xml Mon Dec  6 18:17:46 2010
@@ -1,4 +1,20 @@
 
+
 http://maven.apache.org/POM/4.0.0";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>




[CONF] Apache Camel > Camel 2.6.0 Release

2010-12-06 Thread confluence







Camel 2.6.0 Release
Page edited by William Tam


 Changes (1)
 



...
* The ObjectName for {{processor}} in JMX is now always using the node id it has been assigned in the route. * Using a custom [Processor] which are {{ManagementAware}} will be enlisted in JMX having its custom attributes/operations listed. For example just use the Spring JMX annotations to easily expose the attributes/operations. 
* Camel-cxf component allows users to set a message header CamelDestinationOverrideUrl to dynamically override the target destination Web Service or REST Service address defined in routes.   
 h3. New [Enterprise Integration Patterns] 
...

Full Content

Camel 2.6.0 release (currently in progress)




New and Noteworthy

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


	Fixed issue in OSGi with refreshing Camel bundles causing a race condition when discovering type converters
	Introduced ScheduledRoutePolicy with the Quartz component
	Java DSL RouteBuilder now fails if onException and the likes are not configured before routes, which they must.
	Easier to debug routes from camel-test using the Debugger
	Fixed problem installing camel-cxf feature on Apache Karaf.
	The EIP now supports property placeholders in the String based options (a few spots in Java DSL where its not possible). For example: 

"String" charset="{{foo.myCharset}}"/>

	Introduced ScheduledRoutePolicy to allow you to schedule when routes should be active.
	Introduced stepwise option to FTP component to allow end users to control how to traverse directories of the FTP servers. This allows you to set stepwise=false to return back to the behavior from Camel 2.0 - 2.4. See more at the FTP documentation.
	Added separator option to FTP component to allow end users to control what path separator to use when uploading files to remote FTP servers. For example if a Windows based FTP server only accept Windows paths, then you can set this option to Windows.
	Thread names now outputs CamelContext name which makes it easier to differentiate when running multiple Camel applications in the same JVM.
	Introduced contentCache option to XSLT component to allow easy reloading of stylesheets during development.
	Improved Camel JMX to always find next free name when registering in JMX and existing name exists (to remedy name clash). This makes it easier when deploying muliple WARs in the same JVM where the Camel applications may have same CamelContext id. In OSGi the name in JMX now has the bundle id as prefix.
	Fixed BeanShell language
	Quartz now supports using older versions (eg versions 1.6/1.7) of quartz JARs.
	The Aggregator EIP will use a synchronous invocation when processing completed aggregated Exchanges, when not running in parallel mode. This ensures no internal task queue is used, which otherwise could stack up tasks and under certain conditions eat up memory. Enable parallelProcessing if you want to use a separate thread for processing completed aggregated Exchanges.
	LDAP supports paging.
	CXF and CXFRS use the CXF continuation API when using CXF 2.3.x.
	Fixed a rare situation in which an Exchange could be lost during graceful shutdown on the SEDA endpoints, usually more apparent on high volume systems.
	Improved support for Locale in Bindy for Number and Date formats.
	Fixed Multicast, Splitter, Recipient List to work as the Pipes and Filters would do, breaking to continue routing if a sub exchange failed and was handled by an Exception Clause. Previously you would have to detect this manually in the AggregationStrategy.
	Constant fields from Exchange can be referred in the DSL from a String attribute using the class type style. This makes the Java DSL and Spring XML more similar. And you got type safe as Camel throws exception if you had a typo.
For example: 

"Exchange.FILE_NAME">myfile.txt

 
	Exchange now contains the creation timestamp when it was created as a java.util.Date object stores as a property with the key Exchange.CREATION_TIMESTAMP
	Camel fails fast on startup if Load Balancer has been misconfigured, such as configuring two different load balancers in one
	Fixed markRollbackOnlyLast when used with inner/outer transactions.
	InterceptStrategy is now default ordered in the order they are added to the CamelContext. However you can dictate the order by implementing the org.apache.camel.util.Ordered interface.
	Made it easier to load routes from XML files using loadRoutesDefinition method from CamelContext.
	Added support for custom multipart filters in Jetty.
	Using Processor in routes is now also enlisted in JMX for management.
	The ObjectName for processor in JMX is now always using the node id it has been assigned in the route.
	Using 

[CONF] Apache Camel > CXFRS

2010-12-06 Thread confluence







CXFRS
Page edited by William Tam


 Changes (1)
 



...
|synchronous| New in 2.5, this option will let CxfRsConsumer decide to use sync or async API to do the underlying work. The default value is false which means it will try to use async API by default.| synchronous=true| No | false| |throwExceptionOnFailure| New in 2.6, this option tells the CxfRsProducer to inspect return codes and will generate an Exception if the return code is larger than 207.| throwExceptionOnFailure=true | No | true|   
| {{maxClientCacheSize}} | New in 2.6, you can set a IN message header CamelDestinationOverrideUrl to dynamically override the target destination Web Service or REST Service defined in your routes.  The implementation caches CXF clients or ClientFactoryBean in CxfProvider and CxfRsProvider.  This option allows you to configure the maximum size of the cache.\\ | maxClientCacheSize=5 | No \\ | 10 | 
{div}  
...

Full Content

CXFRS Component

When using CXF as a consumer, the CXF Bean Component allows you to factor out how message payloads are received from their processing as a RESTful or SOAP web service. This has the potential of using a multitude of transports to consume web services. The bean component's configuration is also simpler and provides the fastest method to implement web services using Camel and CXF.

The cxfrs: component provides integration with Apache CXF for connecting to JAX-RS services hosted in CXF.

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



   org.apache.camel
   camel-cxf
   x.x.x  




URI format



cxfrs://address?options


Where address represents the CXF endpoint's address


cxfrs:bean:rsEndpoint


Where rsEndpoint represents the spring bean's name which presents the CXFRS client or server

For either style above, you can append options to the URI as follows:


cxfrs:bean:cxfEndpoint?resourceClass=org.apache.camel.rs.Example



Options



 Name 
 Description 
 Example 
 Required? 
 default value 


 resourceClasses 
 The resource classes which you want to export as REST service 
 resourceClasses =org.apache.camel.rs.Example1,org.apache.camel.rs.Exchange2 
 No 
 None 


 httpClientAPI 
 new to Camel 2.1 If it is true, the CxfRsProducer will use the HttpClientAPI to invoke the service 
If it is false, the CxfRsProducer will use the ProxyClientAPI to invoke the service
 httpClientAPI=true  
No 
 true 


synchronous
 New in 2.5, this option will let CxfRsConsumer decide to use sync or async API to do the underlying work. The default value is false which means it will try to use async API by default.
 synchronous=true
 No 
 false


throwExceptionOnFailure
 New in 2.6, this option tells the CxfRsProducer to inspect return codes and will generate an Exception if the return code is larger than 207.
 throwExceptionOnFailure=true 
 No 
 true


 maxClientCacheSize 
 New in 2.6, you can set a IN message header CamelDestinationOverrideUrl to dynamically override the target destination Web Service or REST Service defined in your routes.  The implementation caches CXF clients or ClientFactoryBean in CxfProvider and CxfRsProvider.  This option allows you to configure the maximum size of the cache. 
 maxClientCacheSize=5 
 No  
 10 





You can also configure the CXF REST endpoint through the spring configuration. Since there are lots of difference between the CXF REST client and CXF REST Server, we provides different configuration for them.
Please check out the schema file and CXF REST user guide for more information.

How to configure the REST endpoint in Camel
In camel-cxf schema file, there are two elements for the REST endpoint definition. cxf:rsServer for REST consumer, cxf:rsClient for REST producer.
You can find an camel REST service route configuration example here.


"http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:cxf="http://camel.apache.org/schema/cxf"
   xmlns:jaxrs="http://cxf.apache.org/jaxrs"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
   http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
   http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
  
  "restService"
		address="http://localhost:9002/rest" 
		staticSubresourceResolution="true">

  "customerService"/>
   
  
  
  "jsonProvider" class="org.apache.cxf.jaxrs.provider.JSONProvider"/>

  "customerService" class="org.apache.camel.component.cxf.jaxrs.testbean.CustomerService" />
   
   
  "rsS

svn commit: r1042677 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/ components/camel-cxf/src/main/java/org/apache/came

2010-12-06 Thread wtam
Author: wtam
Date: Mon Dec  6 15:28:58 2010
New Revision: 1042677

URL: http://svn.apache.org/viewvc?rev=1042677&view=rev
Log:
[CAMEL-3386] Support destination address override by CxfProvider and 
CxfrsProvider

Added:

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageRouterAddressOverrideTest.java
   (with props)

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfRawMessageRouterAddressOverrideTest.java
   (with props)

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSimpleRouterAddressOverrideTest.java
   (with props)

camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerAddressOverrideTest.java
   (with props)

camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducerAddressOverride.xml
   (with props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfSpringEndpoint.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsHeaderFilterStrategy.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java

camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/util/CxfEndpointUtils.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=1042677&r1=1042676&r2=1042677&view=diff
==
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java 
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Mon Dec 
 6 15:28:58 2010
@@ -94,6 +94,7 @@ public interface Exchange {
 
 String DATASET_INDEX = "CamelDataSetIndex";
 String DEFAULT_CHARSET_PROPERTY  = "org.apache.camel.default.charset";
+String DESTINATION_OVERRIDE_URL = "CamelDestinationOverrideUrl";
 String DISABLE_HTTP_STREAM_CACHE = "CamelDisableHttpStreamCache";
 
 String ERRORHANDLER_HANDLED = "CamelErrorHandlerHandled";

Modified: 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1042677&r1=1042676&r2=1042677&view=diff
==
--- 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
 (original)
+++ 
camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
 Mon Dec  6 15:28:58 2010
@@ -98,7 +98,8 @@ public class CxfEndpoint extends Default
 private boolean loggingFeatureEnabled;
 private String address;
 private boolean mtomEnabled;
-
+private int maxClientCacheSize = 10;
+
 public CxfEndpoint(String remaining, CxfComponent cxfComponent) {
 super(remaining, cxfComponent);
 setAddress(remaining);
@@ -246,12 +247,12 @@ public class CxfEndpoint extends Default
 /**
  * Populate a client factory bean
  */
-protected void setupClientFactoryBean(ClientProxyFactoryBean factoryBean, 
Class cls) {   
+protected void setupClientFactoryBean(ClientProxyFactoryBean factoryBean, 
Class cls, String serviceAddress) {   
 // service class
 factoryBean.setServiceClass(cls);
 
 // address
-factoryBean.setAddress(getAddress());
+factoryBean.setAddress(serviceAddress);
 
 // wsdl url
 if (getWsdlURL() != null) {
@@ -289,9 +290,9 @@ public class CxfEndpoint extends Default
 
 }
 
-protected void setupClientFactoryBean(ClientFactoryBean factoryBean) { 
  
+protected void setupClientFactoryBean(ClientFactoryBean factoryBean, 
String serviceAddress) {   
 // address
-factoryBean.setAddress(getAddress());
+factoryBean.setAddress(serviceAddress);
 
 // wsdl url
 if (getWsdlURL() != null) {
@@ -335,6 +336,13 @@ public class CxfEndpoint extends Default
  * Create a CXF client object
  */
 Client createClient() throws Exception {
+return createClient(getAddress());
+}
+
+/**
+   

svn commit: r1042676 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/processor/Splitter.java main/java/org/apache/camel/util/ExchangeHelper.java test/java/org/apache/camel/issues/Splitter

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 15:28:52 2010
New Revision: 1042676

URL: http://svn.apache.org/viewvc?rev=1042676&view=rev
Log:
CAMEL-3395: Fixed Splitter not setting correltion correlation id from splitted 
exchange to their parent exchange.

Added:

camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitterCorrelationIdIssueTest.java
Modified:

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

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

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java?rev=1042676&r1=1042675&r2=1042676&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java 
(original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Splitter.java 
Mon Dec  6 15:28:52 2010
@@ -137,7 +137,7 @@ public class Splitter extends MulticastP
 
 public Object next() {
 Object part = iterator.next();
-Exchange newExchange = exchange.copy();
+Exchange newExchange = 
ExchangeHelper.createCopy(exchange, true);
 if (part instanceof Message) {
 newExchange.setIn((Message)part);
 } else {

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java?rev=1042676&r1=1042675&r2=1042676&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java 
(original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java 
Mon Dec  6 15:28:52 2010
@@ -168,6 +168,8 @@ public final class ExchangeHelper {
  * @param handover whether the on completion callbacks should be handed 
over to the new copy.
  */
 public static Exchange createCorrelatedCopy(Exchange exchange, boolean 
handover) {
+String id = exchange.getExchangeId();
+
 Exchange copy = exchange.copy();
 // do not share the unit of work
 copy.setUnitOfWork(null);
@@ -177,7 +179,23 @@ public final class ExchangeHelper {
 uow.handoverSynchronization(copy);
 }
 // set a correlation id so we can track back the original exchange
-copy.setProperty(Exchange.CORRELATION_ID, exchange.getExchangeId());
+copy.setProperty(Exchange.CORRELATION_ID, id);
+return copy;
+}
+
+/**
+ * Creates a new instance and copies from the current message exchange so 
that it can be
+ * forwarded to another destination as a new instance.
+ *
+ * @param exchange original copy of the exchange
+ * @param preserveExchangeId whether or not the exchange id should be 
preserved
+ * @return the copy
+ */
+public static Exchange createCopy(Exchange exchange, boolean 
preserveExchangeId) {
+Exchange copy = exchange.copy();
+if (preserveExchangeId) {
+copy.setExchangeId(exchange.getExchangeId());
+}
 return copy;
 }
 

Added: 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitterCorrelationIdIssueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitterCorrelationIdIssueTest.java?rev=1042676&view=auto
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitterCorrelationIdIssueTest.java
 (added)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitterCorrelationIdIssueTest.java
 Mon Dec  6 15:28:52 2010
@@ -0,0 +1,74 @@
+/**
+ * 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;
+impo

svn commit: r1042656 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/processor/MulticastProcessor.java test/java/org/apache/camel/issues/SplitterThrowExceptionInExpressionTest.java

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 14:19:33 2010
New Revision: 1042656

URL: http://svn.apache.org/viewvc?rev=1042656&view=rev
Log:
CAMEL-3394: Fixed splitter not using error handling if exception was thrown 
during evaluation of next splitted piece to use.

Added:

camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SplitterThrowExceptionInExpressionTest.java
Modified:

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

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=1042656&r1=1042655&r2=1042656&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
 Mon Dec  6 14:19:33 2010
@@ -174,10 +174,16 @@ public class MulticastProcessor extends 
 
 // multicast uses fine grained error handling on the output processors
 // so use try .. catch to cater for this
+boolean exhaust = false;
 try {
 boolean sync = true;
 
 pairs = createProcessorExchangePairs(exchange);
+
+// after we have created the processors we consider the exchange 
as exhausted if an unhandled
+// exception was thrown, (used in the catch block)
+exhaust = true;
+
 if (isParallelProcessing()) {
 // ensure an executor is set when running in parallel
 ObjectHelper.notNull(executorService, "executorService", this);
@@ -194,14 +200,14 @@ public class MulticastProcessor extends 
 } catch (Throwable e) {
 exchange.setException(e);
 // and do the done work
-doDone(exchange, null, callback, true);
+doDone(exchange, null, callback, true, exhaust);
 return true;
 }
 
 // multicasting was processed successfully
 // and do the done work
 Exchange subExchange = result.get() != null ? result.get() : null;
-doDone(exchange, subExchange, callback, true);
+doDone(exchange, subExchange, callback, true, exhaust);
 return true;
 }
 
@@ -455,7 +461,7 @@ public class MulticastProcessor extends 
 result.set(subExchange);
 }
 // and do the done work
-doDone(original, subExchange, callback, false);
+doDone(original, subExchange, callback, false, true);
 return;
 }
 
@@ -465,7 +471,7 @@ public class MulticastProcessor extends 
 // wrap in exception to explain where it failed
 subExchange.setException(new 
CamelExchangeException("Sequential processing failed for number " + total, 
subExchange, e));
 // and do the done work
-doDone(original, subExchange, callback, false);
+doDone(original, subExchange, callback, false, true);
 return;
 }
 
@@ -501,7 +507,7 @@ public class MulticastProcessor extends 
 result.set(subExchange);
 }
 // and do the done work
-doDone(original, subExchange, callback, false);
+doDone(original, subExchange, callback, false, 
true);
 return;
 }
 
@@ -511,7 +517,7 @@ public class MulticastProcessor extends 
 // wrap in exception to explain where it failed
 subExchange.setException(new 
CamelExchangeException("Sequential processing failed for number " + total, 
subExchange, e));
 // and do the done work
-doDone(original, subExchange, callback, false);
+doDone(original, subExchange, callback, false, 
true);
 return;
 }
 
@@ -520,7 +526,7 @@ public class MulticastProcessor extends 
 
 // do the done work
 subExchange = result.get() != null ? result.get() : null;
-doDone(original, subExchange, callback, false);
+doDone(original, subExchange, callback, false, true);
 }
 });
 } finally {
@@ -589,15 +595,16 @@ public class MulticastProcessor extends 
  * @param subExchange the current sub exchange, can be null for 
the synchronous part
  * @param callbackthe callback
  * @param doneSyncthe doneSync paramete

svn commit: r1042618 - /camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java

2010-12-06 Thread gnodet
Author: gnodet
Date: Mon Dec  6 13:07:59 2010
New Revision: 1042618

URL: http://svn.apache.org/viewvc?rev=1042618&view=rev
Log:
[CAMEL-3381] Add an integration test

Modified:

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

Modified: 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java?rev=1042618&r1=1042617&r2=1042618&view=diff
==
--- 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
 (original)
+++ 
camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/blueprint/OSGiBlueprintTestSupport.java
 Mon Dec  6 13:07:59 2010
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import org.apache.camel.CamelContext;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -56,6 +57,7 @@ public class OSGiBlueprintTestSupport ex
 }
 getInstalledBundle("CamelBlueprintTestBundle1").start();
 getOsgiService(BlueprintContainer.class, 
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle1)", 5000);
+getOsgiService(CamelContext.class, 
"(camel.context.symbolicname=CamelBlueprintTestBundle1)", 5000);
 }
 
 @Test
@@ -74,6 +76,7 @@ public class OSGiBlueprintTestSupport ex
 }
 getInstalledBundle("org.apache.camel.camel-mail").start();
 getOsgiService(BlueprintContainer.class, 
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle2)", 5000);
+getOsgiService(CamelContext.class, 
"(camel.context.symbolicname=CamelBlueprintTestBundle2)", 5000);
 }
 
 @Test
@@ -92,6 +95,7 @@ public class OSGiBlueprintTestSupport ex
 }
 getInstalledBundle("org.apache.camel.camel-jaxb").start();
 getOsgiService(BlueprintContainer.class, 
"(osgi.blueprint.container.symbolicname=CamelBlueprintTestBundle3)", 5000);
+getOsgiService(CamelContext.class, 
"(camel.context.symbolicname=CamelBlueprintTestBundle3)", 5000);
 }
 
 @Before




svn commit: r1042612 - in /camel/trunk/components: camel-blueprint/ camel-blueprint/src/main/java/org/apache/camel/blueprint/ camel-core-osgi/src/main/java/org/apache/camel/core/osgi/ camel-spring/ ca

2010-12-06 Thread gnodet
Author: gnodet
Date: Mon Dec  6 12:58:27 2010
New Revision: 1042612

URL: http://svn.apache.org/viewvc?rev=1042612&view=rev
Log:
[CAMEL-3381][CAMEL-3382] Publish the CamelContext as an OSGi service and 
propagate camel events as EventAdmin events

Added:

camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java

camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiEventAdminNotifier.java
Modified:
camel/trunk/components/camel-blueprint/pom.xml

camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
camel/trunk/components/camel-spring/pom.xml

camel/trunk/components/camel-spring/src/main/java/org/apache/camel/osgi/CamelContextFactoryBean.java

Modified: camel/trunk/components/camel-blueprint/pom.xml
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/pom.xml?rev=1042612&r1=1042611&r2=1042612&view=diff
==
--- camel/trunk/components/camel-blueprint/pom.xml (original)
+++ camel/trunk/components/camel-blueprint/pom.xml Mon Dec  6 12:58:27 2010
@@ -35,6 +35,7 @@
 
 !org.apache.camel.blueprint.*,
 org.apache.camel.*;${camel.osgi.import.strict.version},
+org.osgi.service.event*;resolution:=optional,
 *
 
 

Modified: 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java?rev=1042612&r1=1042611&r2=1042612&view=diff
==
--- 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
 (original)
+++ 
camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
 Mon Dec  6 12:58:27 2010
@@ -31,6 +31,8 @@ import org.apache.camel.RoutesBuilder;
 import org.apache.camel.ShutdownRoute;
 import org.apache.camel.ShutdownRunningTask;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.core.osgi.OsgiCamelContextPublisher;
+import org.apache.camel.core.osgi.OsgiEventAdminNotifier;
 import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
 import org.apache.camel.core.xml.CamelJMXAgentDefinition;
 import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
@@ -50,6 +52,8 @@ import org.apache.camel.model.ThreadPool
 import org.apache.camel.model.config.PropertiesDefinition;
 import org.apache.camel.model.dataformat.DataFormatsDefinition;
 import org.apache.camel.spi.PackageScanFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 
@@ -64,6 +68,7 @@ import org.osgi.service.blueprint.contai
 @XmlRootElement(name = "camelContext")
 @XmlAccessorType(XmlAccessType.FIELD)
 public class CamelContextFactoryBean extends 
AbstractCamelContextFactoryBean {
+private static final Log LOG = 
LogFactory.getLog(CamelContextFactoryBean.class);
 
 @XmlAttribute(name = "depends-on", required = false)
 private String dependsOn;
@@ -198,6 +203,19 @@ public class CamelContextFactoryBean ext
 protected void findRouteBuildersByContextScan(PackageScanFilter filter, 
List builders) throws Exception {
 }
 
+@Override
+public void afterPropertiesSet() throws Exception {
+super.afterPropertiesSet();
+getContext().getManagementStrategy().addEventNotifier(new 
OsgiCamelContextPublisher(bundleContext));
+try {
+
getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
+getContext().getManagementStrategy().addEventNotifier(new 
OsgiEventAdminNotifier(bundleContext));
+} catch (Throwable t) {
+// Ignore, if the EventAdmin package is not available, just don't 
use it
+LOG.debug("EventAdmin package is not available, just don't use 
it");
+}
+}
+
 public String getDependsOn() {
 return dependsOn;
 }

Added: 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java?rev=1042612&view=auto
==
--- 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
 (added)
+++ 
camel/trunk/components/camel-core-osgi/src/main/java/org/apache/camel/core/osgi/OsgiCamelContextPublisher.java
 Mon Dec  6 12:58:27 2010
@@ -0,0 +1,90 @@

svn commit: r1042602 - /camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SetHeaderInDoCatchIssueTest.java

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 12:16:17 2010
New Revision: 1042602

URL: http://svn.apache.org/viewvc?rev=1042602&view=rev
Log:
Added unit test based on user issue.

Added:

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

Added: 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SetHeaderInDoCatchIssueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SetHeaderInDoCatchIssueTest.java?rev=1042602&view=auto
==
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SetHeaderInDoCatchIssueTest.java
 (added)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/SetHeaderInDoCatchIssueTest.java
 Mon Dec  6 12:16:17 2010
@@ -0,0 +1,115 @@
+/**
+ * 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.ExchangeTimedOutException;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.JndiRegistry;
+
+/**
+ * @version $Revision$
+ */
+public class SetHeaderInDoCatchIssueTest extends ContextTestSupport {
+
+public void testSuccess() {
+Exchange exchange = template.request("direct:start", new Processor() {
+public void process(Exchange exchange) throws Exception {
+// empty message
+}
+});
+
+assertEquals("CamsResponse", exchange.getOut().getHeader("Status"));
+}
+
+public void testExchangeTimedOutException() {
+Exchange exchange = template.request("direct:start", new Processor() {
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setBody("ExchangeTimedOutException");
+}
+});
+
+assertEquals("TimeOut", exchange.getOut().getHeader("Status"));
+}
+
+public void testException() {
+Exchange exchange = template.request("direct:start", new Processor() {
+public void process(Exchange exchange) throws Exception {
+exchange.getIn().setBody("Exception");
+}
+});
+
+assertEquals("ExceptionGeneral", 
exchange.getOut().getHeader("Status"));
+}
+
+protected JndiRegistry createRegistry() throws Exception {
+JndiRegistry registry = new JndiRegistry(createJndiContext());
+
+registry.bind("A", new Processor() {
+public void process(Exchange exchange) throws Exception {
+log.info("A headers " + exchange.getIn().getHeaders());
+}
+});
+
+registry.bind("B", new Processor() {
+public void process(Exchange exchange) throws Exception {
+log.info("B headers " + exchange.getIn().getHeaders());
+
+if 
("ExchangeTimedOutException".equals(exchange.getIn().getBody(String.class))) {
+throw new ExchangeTimedOutException(exchange, 1);
+} else if 
("Exception".equals(exchange.getIn().getBody(String.class))) {
+throw new Exception();
+}
+}
+});
+
+registry.bind("C", new Processor() {
+public void process(Exchange exchange) throws Exception {
+log.info("C headers " + exchange.getIn().getHeaders());
+}
+});
+
+return registry;
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+context.setTracing(true);
+
+from("direct:start")
+.doTry()
+.to("A")
+.setHeader("CamelJmsDestinationName", 
constant("queue:outQueue"))
+.inOut("B")
+.setHeader("Status", constant("CamsResponse"))
+.doCatch(ExchangeTimedOutException.class)
+.setHeader("Status", constant("Time

[CONF] Apache Camel > Articles

2010-12-06 Thread confluence







Articles
Page edited by Claus Ibsen


 Changes (1)
 



...
* [Screencast/Demo of Smooks and Apache Camel processing UN/EDIFACT|http://www.screencast.com/users/tfennelly/folders/Camtasia/media/c3cef9dd-e667-41ac-8597-74ca01d39968] - by Tom Fennelly showing how Smooks and Camel works together * [FuseSource YouTube|http://www.youtube.com/fusesource] - FuseSource You Tube Channel with webcasts about Camel and related Apache projects. 
* [Claus Ibsen's|http://davsclaus.blogspot.com/] [Devoxx 2010 talk|http://www.parleys.com/#id=2158&st=5] is all about Apache Camel 
 
h2. Podcasts where Camel is taking part * [James Strachan|http://macstrac.blogspot.com/] was [interviewed|http://briefingsdirect.blogspot.com/2007/08/apache-camel-addresses-need-for.html] by [Dana Gardner|http://www.zoominfo.com/Search/PersonDetail.aspx?PersonID=338181&QueryID=0b37845a-9e13-492a-92e6-7ac8ac9707b7] on [Apache Camel|Index] and its [DSL] and support for [Enterprise Integration Patterns]. Read the [transcript|http://briefingsdirect.blogspot.com/2007/08/apache-camel-addresses-need-for.html] or check out the [podcast|http://interarbor.libsyn.com/index.php?post_id=245998] 
...

Full Content

See alsoSee also Camel User Stories.

Articles on Apache Camel

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

svn commit: r1042552 - in /camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote: FtpOperations.java SftpOperations.java

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 09:06:31 2010
New Revision: 1042552

URL: http://svn.apache.org/viewvc?rev=1042552&view=rev
Log:
MR-385: Fixed ftp producer creating directory using windows path. It should 
normalize the path.

Modified:

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

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

Modified: 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?rev=1042552&r1=1042551&r2=1042552&view=diff
==
--- 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
 (original)
+++ 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
 Mon Dec  6 09:06:31 2010
@@ -237,6 +237,9 @@ public class FtpOperations implements Re
 }
 
 public boolean buildDirectory(String directory, boolean absolute) throws 
GenericFileOperationFailedException {
+// must normalize directory first
+directory = endpoint.getConfiguration().normalizePath(directory);
+
 if (log.isTraceEnabled()) {
 log.trace("buildDirectory(" + directory + ")");
 }
@@ -689,10 +692,11 @@ public class FtpOperations implements Re
 boolean success = false;
 for (String dir : dirs) {
 sb.append(dir).append('/');
-String directory = sb.toString();
+// must normalize the directory name
+String directory = 
endpoint.getConfiguration().normalizePath(sb.toString());
 
-// do not try to build root / folder
-if (!directory.equals("/")) {
+// do not try to build root folder (/ or \)
+if (!(directory.equals("/") || directory.equals("\\"))) {
 if (log.isTraceEnabled()) {
 log.trace("Trying to build remote directory by chunk: " + 
directory);
 }

Modified: 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1042552&r1=1042551&r2=1042552&view=diff
==
--- 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
 (original)
+++ 
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
 Mon Dec  6 09:06:31 2010
@@ -267,6 +267,9 @@ public class SftpOperations implements R
 }
 
 public boolean buildDirectory(String directory, boolean absolute) throws 
GenericFileOperationFailedException {
+// must normalize directory first
+directory = endpoint.getConfiguration().normalizePath(directory);
+
 if (LOG.isTraceEnabled()) {
 LOG.trace("buildDirectory(" + directory + "," + absolute + ")");
 }
@@ -318,14 +321,16 @@ public class SftpOperations implements R
 boolean success = false;
 for (String dir : dirs) {
 sb.append(dir).append('/');
-String directory = sb.toString();
-if (LOG.isTraceEnabled()) {
-LOG.trace("Trying to build remote directory by chunk: " + 
directory);
-}
+// must normalize the directory name
+String directory = 
endpoint.getConfiguration().normalizePath(sb.toString());
 
-// do not try to build root / folder
-if (!directory.equals("/")) {
+// do not try to build root folder (/ or \)
+if (!(directory.equals("/") || directory.equals("\\"))) {
 try {
+if (LOG.isTraceEnabled()) {
+LOG.trace("Trying to build remote directory by chunk: 
" + directory);
+}
+
 channel.mkdir(directory);
 success = true;
 } catch (SftpException e) {




svn commit: r1042547 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ components/camel-guice/src/main/java/org/apache/camel/guice/ components/camel-guice/src/test/resources/ tests/ t

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 08:39:38 2010
New Revision: 1042547

URL: http://svn.apache.org/viewvc?rev=1042547&view=rev
Log:
If needed JARs is not on classpath, then JMX will be disabled and fallback to 
non JMX. Added standalone test to test this.

Added:
camel/trunk/tests/camel-itest-standalone/   (with props)
camel/trunk/tests/camel-itest-standalone/pom.xml   (with props)
camel/trunk/tests/camel-itest-standalone/src/
camel/trunk/tests/camel-itest-standalone/src/main/
camel/trunk/tests/camel-itest-standalone/src/main/resources/
camel/trunk/tests/camel-itest-standalone/src/main/resources/META-INF/

camel/trunk/tests/camel-itest-standalone/src/main/resources/META-INF/LICENSE.txt
   (with props)

camel/trunk/tests/camel-itest-standalone/src/main/resources/META-INF/NOTICE.txt 
  (with props)
camel/trunk/tests/camel-itest-standalone/src/test/
camel/trunk/tests/camel-itest-standalone/src/test/java/
camel/trunk/tests/camel-itest-standalone/src/test/java/org/
camel/trunk/tests/camel-itest-standalone/src/test/java/org/apache/
camel/trunk/tests/camel-itest-standalone/src/test/java/org/apache/camel/

camel/trunk/tests/camel-itest-standalone/src/test/java/org/apache/camel/itest/

camel/trunk/tests/camel-itest-standalone/src/test/java/org/apache/camel/itest/standalone/

camel/trunk/tests/camel-itest-standalone/src/test/java/org/apache/camel/itest/standalone/CamelContextStandaloneTest.java
   (with props)
camel/trunk/tests/camel-itest-standalone/src/test/resources/

camel/trunk/tests/camel-itest-standalone/src/test/resources/log4j.properties   
(with props)
Modified:

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

camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
camel/trunk/components/camel-guice/src/test/resources/log4j.properties
camel/trunk/tests/pom.xml

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=1042547&r1=1042546&r2=1042547&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
 Mon Dec  6 08:39:38 2010
@@ -2174,7 +2174,7 @@ public class DefaultCamelContext extends
 }
 
 protected ManagementStrategy createManagementStrategy() {
-ManagementStrategy answer = null;
+ManagementStrategy answer;
 
 if (disableJMX || Boolean.getBoolean(JmxSystemPropertyKeys.DISABLED)) {
 LOG.info("JMX is disabled. Using DefaultManagementStrategy.");
@@ -2183,17 +2183,22 @@ public class DefaultCamelContext extends
 try {
 LOG.info("JMX enabled. Using ManagedManagementStrategy.");
 answer = new ManagedManagementStrategy(new 
DefaultManagementAgent(this));
+// must start it to ensure JMX works and can load needed 
Spring JARs
+startServices(answer);
 // prefer to have it at first strategy
 lifecycleStrategies.add(0, new 
DefaultManagementLifecycleStrategy(this));
 } catch (NoClassDefFoundError e) {
+answer = null;
+
 // if we can't instantiate the JMX enabled strategy then 
fallback to default
 // could be because of missing .jars on the classpath
-LOG.warn("Could not find needed classes for JMX lifecycle 
strategy."
+LOG.warn("Cannot find needed classes for JMX lifecycle 
strategy."
 + " Needed class is in spring-context.jar using Spring 
2.5 or newer"
 + " (spring-jmx.jar using Spring 2.0.x)."
 + " NoClassDefFoundError: " + e.getMessage());
 } catch (Exception e) {
-LOG.warn("Cannot create JMX lifecycle strategy. Will fallback 
to use non JMX and this exception will be ignored.", e);
+answer = null;
+LOG.warn("Cannot create JMX lifecycle strategy. Fallback to 
using DefaultManagementStrategy (non JMX).", e);
 }
 }
 

Modified: 
camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java?rev=1042547&r1=1042546&r2=1042547&view=diff
==
--- 
camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
 (original)
+++ 
camel/trunk/components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
 Mon

[CONF] Apache Camel > Why is my processor not showing up in JConsole

2010-12-06 Thread confluence







Why is my processor not showing up in JConsole
Page edited by Claus Ibsen


 Changes (1)
 



...
For example the minor ones such as {{setHeader}} does not and thus is not visible in JConsole.  
From *Camel 2.6* onwards your custom {{Processor}} can just implement {{ManagementAware}} and just return {{this}} in the method. Then you can use the Spring JMX annotations on your custom processor to have those attributes and operations enlisted in JMX.  {snippet:id=e1|lang=java|title=Custom processor|url=""   
h3. See also - [Camel JMX] 

Full Content

Why is my processor not showing up in JConsole

Not every processor is managed and thus not all is visible in the JConsole.

A processor must implement the org.apache.camel.Service to be managed. Most EIP processors does this.
For example the minor ones such as setHeader does not and thus is not visible in JConsole.

From Camel 2.6 onwards your custom Processor can just implement ManagementAware and just return this in the method.
Then you can use the Spring JMX annotations on your custom processor to have those attributes and operations enlisted in JMX.

Custom processor
@ManagedResource
public static class MyCustomProcessor implements ManagementAware, Processor {
private String foo = "hey";

public Object getManagedObject(Processor object) {
// just return this as we use Spring JMX annotations to define which attributes/operations
// to be enlisted in JMX
return this;
}

@ManagedAttribute
public String getFoo() {
return foo;
}

@ManagedAttribute
public void setFoo(String foo) {
this.foo = foo;
}

public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader("foo", getFoo());
}
}




See also

	Camel JMX





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









svn commit: r1042541 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/management/ camel-core/src/main/java/org/apache/camel/management/mbean/ camel-core/src/main/java/org/apache/camel/mode

2010-12-06 Thread davsclaus
Author: davsclaus
Date: Mon Dec  6 08:02:24 2010
New Revision: 1042541

URL: http://svn.apache.org/viewvc?rev=1042541&view=rev
Log:
CAMEL-3279, CAMEL-3392: Improved JMX. Any processor used in the route DSL will 
be managed. Allow custom Processor to be ManagementAware and expose its own set 
of attributes/operations with Spring JMX annotations, and have those enlisted 
instead of the default ManagedProcessor mbean. Using node id for ObjectName for 
managed processor.

Added:

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

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

camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedCustomProcessorTest.java
Modified:

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

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

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

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

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

camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java

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

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

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

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

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

camel/trunk/camel-core/src/test/java/org/apache/camel/util/IntrospectionSupportTest.java
camel/trunk/examples/pom.xml

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java?rev=1042541&r1=1042540&r2=1042541&view=diff
==
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
 Mon Dec  6 08:02:24 2010
@@ -32,9 +32,6 @@ import javax.management.MBeanServerFacto
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectInstance;
 import javax.management.ObjectName;
-import javax.management.modelmbean.InvalidTargetObjectTypeException;
-import javax.management.modelmbean.ModelMBeanInfo;
-import javax.management.modelmbean.RequiredModelMBean;
 import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
@@ -46,8 +43,6 @@ import org.apache.camel.spi.ManagementAg
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource;
-import org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler;
 
 /**
  * Default implementation of the Camel JMX service agent
@@ -65,7 +60,7 @@ public class DefaultManagementAgent exte
 private ExecutorService executorService;
 private MBeanServer server;
 private final Set mbeansRegistered = new HashSet();
-private MetadataMBeanInfoAssembler assembler;
+private JmxMBeanAssembler assembler;
 private JMXConnectorServer cs;
 
 private Integer registryPort;
@@ -216,15 +211,8 @@ public class DefaultManagementAgent exte
 registerMBeanWithServer(obj, name, forceRegistration);
 } catch (NotCompliantMBeanException e) {
 // If this is not a "normal" MBean, then try to deploy it using 
JMX annotations
-ModelMBeanInfo mbi;
-mbi = assembler.getMBeanInfo(obj, name.toString());
-RequiredModelMBean mbean = 
(RequiredModelMBean)server.instantiate(RequiredModelMBean.class.getName());
-mbean.setModelMBeanInfo(mbi);
-try {
-mbean.setManagedResource(obj, "ObjectReference");
-} catch (InvalidTargetObjectTypeException itotex) {
-throw new JMException(itotex.getMessage());
-}
+Object mbean = assembler.assemble(obj, name);
+// and register the mbean
 registerMBeanWithServer(mbean, name, forceRegistration);
 }
 }
@@ -245,8 +233,6 @@ public class DefaultManagementAgent exte
 
 protected void doStart() throws