svn commit: r826091 - in /websites/production/camel/content: book-in-one-page.html book-pattern-appendix.html cache/main.pageCache camel-2110-release.html resequencer.html
Author: buildbot Date: Tue Jul 17 06:20:20 2012 New Revision: 826091 Log: Production update by buildbot for camel Modified: websites/production/camel/content/book-in-one-page.html websites/production/camel/content/book-pattern-appendix.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/camel-2110-release.html websites/production/camel/content/resequencer.html Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Tue Jul 17 06:20:20 2012 @@ -16928,6 +16928,22 @@ resequencer(header(Reject Old Exchanges +Available as of Camel 2.11 + +This option can be used to prevent out of order messages from being sent regardless of the event that delivered messages downstream (capacity, timeout, etc). If enabled using rejectOld(), the Resequencer will throw a MessageRejectedException when an incoming Exchange is "older" (based on the Comparator) than the last delivered message. This provides an extra level of control with regards to delayed message ordering. + + + +from("direct:start") +.onException(MessageRejectedException.class).handled(true).to("mock:error").end() +.resequence(header("seqno")).stream().timeout(1000).rejectOld() +.to("mock:result"); + + + +This option is available for the stream resequencer only. + Stream Resequencing The next example shows how to use the stream-processing resequencer. Messages are re-ordered based on their sequence numbers given by a seqnum header using gap detection and timeouts on the level of individual messages. Modified: websites/production/camel/content/book-pattern-appendix.html == --- websites/production/camel/content/book-pattern-appendix.html (original) +++ websites/production/camel/content/book-pattern-appendix.html Tue Jul 17 06:20:20 2012 @@ -2664,6 +2664,22 @@ resequencer(header(Reject Old Exchanges +Available as of Camel 2.11 + +This option can be used to prevent out of order messages from being sent regardless of the event that delivered messages downstream (capacity, timeout, etc). If enabled using rejectOld(), the Resequencer will throw a MessageRejectedException when an incoming Exchange is "older" (based on the Comparator) than the last delivered message. This provides an extra level of control with regards to delayed message ordering. + + + +from("direct:start") +.onException(MessageRejectedException.class).handled(true).to("mock:error").end() +.resequence(header("seqno")).stream().timeout(1000).rejectOld() +.to("mock:result"); + + + +This option is available for the stream resequencer only. + Stream Resequencing The next example shows how to use the stream-processing resequencer. Messages are re-ordered based on their sequence numbers given by a seqnum header using gap detection and timeouts on the level of individual messages. 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 Tue Jul 17 06:20:20 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 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="Reseq
[CONF] Apache Camel > Camel 2.11.0 Release
Camel 2.11.0 Release Page edited by Ben O'Day Comment: * per CAMEL-4327 added "rejectOld" option to the Resequencer EIP Changes (1) ... * 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 h3. Fixed issues ... * Fixed using {{sendEmptyMessageWhenIdle=true}} on a batch consumer such as [File|File2] now working with [Aggregate|Aggregator2] EIP when using {{completionFromBatchConsumer}} 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 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 New Enterprise Integration Patterns New Camel Karaf Command New Components DSL Changes New Annotations New Data Formats New Languages New Examples New Tutorials API changes/breaking Changes goes here!!! Internal/Non API refactorings that may affect users Changes goes here!!! Known Issues The Tracer may not output all details for some situations, such as when using onCompletion or intercept, etc. The project cannot fully build the site using Maven (e.g. running "mvn site"). There is no plan to fix this, as the project does not use maven site. JBoss 7 may log a WARNing when running Camel as a WAR file. Dependency Upgrades Axiom 1.2.10 to 1.2.13 BeanIO 2.0.0 to 2.0.1 Ehcache bundle 2.5.1_1 to 2.5.2_1 Netty 3.5.1 to 3.5.2 Ognl bundle 3.0.4_1 to 3.0.5_1 Spring Framework 3.1.1 to 3.1.2 Spring Integration 2.1.2 to 2.1.3 Woodstox 4.1.2 to 4.1.3 Important changes to consider when upgrading Important stuff goes here!!! Notice Maven 3.0.2 or better is required to build the Source If you want to deploy Apache Camel 2.11.0 into Apache Karaf, we highly recommend to use the 'jre.properties.cxf' configuration, which is part of Apache Karaf 2.2.5 onwards. For example camel-cxf, camel-mail, and camel-spring-ws requires this to be installable; as well other features may as well. Getting the Distributions Binary Distributions Description Download Link PGP Signature file of download Windows Distribution apache-camel-2.11.0.zip apache-camel-2.11.0.zip.asc Unix/Linux/Cygwin Distribution apache-camel-2.11.0.tar.gz apache-camel-2.11.0.tar.gz.asc Source Distributions Description Download Link PGP Signature file of download Source Distribution apache-camel-2.11.0-src.zip apache-camel-2.11.0-src.zip.asc Change Notification Preferences View Online | View Changes | Add Comment
[CONF] Apache Camel > Resequencer
Resequencer Page edited by Ben O'Day Comment: per CAMEL-4327 added "rejectOld" option to the Resequencer EIP Changes (1) ... This option is available for both batch and stream resequencer. h4. Reject Old Exchanges *Available as of Camel 2.11* This option can be used to preserve ordering regardless of the event that delivered messages downstream (capacity, timeout, etc). If enabled using {{rejectOld()}}, the [Resequencer] will throw a {{MessageRejectedException}} when an incoming [Exchange] is "older" (based on the Comparator) than the last delivered message. This provides an extra level of control with regards to delayed message ordering. {code} from("direct:start") .onException(MessageRejectedException.class).handled(true).to("mock:error").end() .resequence(header("seqno")).stream().timeout(1000).rejectOld() .to("mock:result"); {code} This option is available for the stream resequencer only. h3. Stream Resequencing ... Full Content Resequencer The Resequencer from the EIP patterns allows you to reorganise messages based on some comparator. By default in Camel we use an _expression_ to create the comparator; so that you can compare by a message header or the body or a piece of a message etc. Change in Camel 2.7The and tags in XML DSL in the Resequencer EIP must now be configured in the top, and not in the bottom. So if you use those, then move them up just below the EIP starts in the XML. If you are using Camel older than 2.7, then those configs should be at the bottom. Camel supports two resequencing algorithms: Batch resequencing collects messages into a batch, sorts the messages and sends them to their output. Stream resequencing re-orders (continuous) message streams based on the detection of gaps between messages. By default the Resequencer does not support duplicate messages and will only keep the last message, in case a message arrives with the same message _expression_. However in the batch mode you can enable it to allow duplicates. Batch Resequencing The following example shows how to use the batch-processing resequencer so that messages are sorted in order of the body() _expression_. That is messages are collected into a batch (either by a maximum number of messages per batch or using a timeout) then they are sorted in order and then sent out to their output. Using the Fluent Builders from("direct:start") .resequence().body() .to("mock:result"); This is equvalent to from("direct:start") .resequence(body()).batch() .to("mock:result"); The batch-processing resequencer can be further configured via the size() and timeout() methods. from("direct:start") .resequence(body()).batch().size(300).timeout(4000L) .to("mock:result") This sets the batch size to 300 and the batch timeout to 4000 ms (by default, the batch size is 100 and the timeout is 1000 ms). Alternatively, you can provide a configuration object. from("direct:start") .resequence(body()).batch(new BatchResequencerConfig(300, 4000L)) .to("mock:result") So the above example will reorder messages from endpoint direct:a in order of their bodies, to the endpoint mock:result. Typically you'd use a header rather than the body to order things; or maybe a part of the body. So you could replace this _expression_ with resequencer(header("mySeqNo")) for example to reorder messages using a custom sequence number in the header mySeqNo. You can of course use many different _expression_ languages such as XPath, XQuery, SQL or various Scripting Languages. Using the Spring XML Extensions "camel" xmlns="http://camel.apache.org/schema/spring"> "direct:start" /> body "mock:result" /> "300" batchTimeout="4000" /> Allow Duplicates Available as of Camel 2.4 In the batch mode, you can now allow duplicates. In Java DSL there is a allowDuplicates() method and in Spring XML there is an allowDuplicates=true attribute on the you can use to enable it. Reverse Available as of Camel 2.4 In the batch mode, you can now reverse the _expression_ ordering. By default the order is based on 0..9,A..Z, which would let messages with low numbers be ordered first, and thus also also outgoing first. In some cases you want to reverse order, which is now possible. In Java DSL there is a reverse() method and in Spring XML there is an reverse=true attribute on the you can use to enable it. Resequence JMS messages based on JMSPriority Available as of Camel 2.4 It's now much easier to use the Resequencer to resequence messages from JMS queues based on JMSPriority. For that to work you need to use the two new options allowDuplicates
svn commit: r1362216 - /camel/branches/camel-2.9.x/
Author: dkulp Date: Mon Jul 16 19:14:19 2012 New Revision: 1362216 URL: http://svn.apache.org/viewvc?rev=1362216&view=rev Log: Recording revisions 1362211 via git from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x Modified: camel/branches/camel-2.9.x/ (props changed) Propchange: camel/branches/camel-2.9.x/ -- Binary property 'svnmerge-integrated' - no diff available.
svn commit: r1362215 - in /camel/branches/camel-2.9.x: camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converte
Author: dkulp Date: Mon Jul 16 19:14:14 2012 New Revision: 1362215 URL: http://svn.apache.org/viewvc?rev=1362215&view=rev Log: Merged revisions 1362211 via git cherry-pick from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x r1362211 | dkulp | 2012-07-16 15:12:53 -0400 (Mon, 16 Jul 2012) | 12 lines Merged revisions 1362210 via git cherry-pick from https://svn.apache.org/repos/asf/camel/trunk r1362210 | dkulp | 2012-07-16 15:11:29 -0400 (Mon, 16 Jul 2012) | 4 lines [CXF-5449] Provide a direct CxfPayload -> Source conversion so XSLT component can bypass the current CxfPayload(StaxSource) -> NodeList -> DOMSource -> InputStream -> StreamSource thing it currently does. Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1362215&r1=1362214&r2=1362215&view=diff == --- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original) +++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Mon Jul 16 19:14:14 2012 @@ -47,6 +47,7 @@ import org.apache.camel.ExpectedBodyType import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.RuntimeTransformException; +import org.apache.camel.TypeConverter; import org.apache.camel.converter.jaxp.XmlConverter; import org.apache.camel.converter.jaxp.XmlErrorListener; import org.apache.camel.support.SynchronizationAdapter; @@ -424,8 +425,10 @@ public class XsltBuilder implements Proc return false; } else if (body instanceof Node) { return false; +} else if (exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass()) != null) { +//there is a direct and hopefully optimized converter to Source +return false; } - // yes an input stream is needed return true; } @@ -446,9 +449,15 @@ public class XsltBuilder implements Proc if (body instanceof Source) { return (Source) body; } - Source source = null; -if (isAllowStAX()) { +if (body != null) { +TypeConverter tc = exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass()); +if (tc != null) { +source = tc.convertTo(Source.class, body); +} +} + +if (source == null && isAllowStAX()) { source = exchange.getContext().getTypeConverter().tryConvertTo(StAXSource.class, exchange, body); } if (source == null) { Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1362215&r1=1362214&r2=1362215&view=diff == --- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java (original) +++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Mon Jul 16 19:14:14 2012 @@ -90,6 +90,16 @@ public final class CxfPayloadConverter { } return null; } + +@Converter +public static Source cxfPayLoadToSource(CxfPayload payload, Exchange exchange) { +List payloadBody = payload.getBodySources(); + +if (payloadBody.size() > 0) { +return payloadBody.get(0); +} +return null; +} @SuppressWarnings("unchecked") @FallbackConverter @@ -130,6 +140,14 @@ public final class CxfPayloadConverter { } // Convert a CxfPayload into something else if (CxfPayload.class.isAssignableFrom(value.getClass())) { +CxfPayload payload = (CxfPayload) value; + +if (payload.getBodySources().size() == 1) { +TypeConverter tc = registry.lookup(type, Source.class); +if (tc != null) { +return tc.convertTo(type, payload.getBodySources().get(0)); +} +} TypeConverter tc = registry.lookup(type, NodeList.class); if (tc != null)
svn commit: r1362212 - /camel/branches/camel-2.10.x/
Author: dkulp Date: Mon Jul 16 19:12:59 2012 New Revision: 1362212 URL: http://svn.apache.org/viewvc?rev=1362212&view=rev Log: Recording revisions 1362210 via git from https://svn.apache.org/repos/asf/camel/trunk Modified: camel/branches/camel-2.10.x/ (props changed) Propchange: camel/branches/camel-2.10.x/ -- --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Jul 16 19:12:59 2012 @@ -1 +1 @@ -/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973,1362123,1362126 +/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973,1362123,1362126,1362210
svn commit: r1362211 - in /camel/branches/camel-2.10.x: camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java components/camel-cxf/src/main/java/org/apache/camel/component/cxf/convert
Author: dkulp Date: Mon Jul 16 19:12:53 2012 New Revision: 1362211 URL: http://svn.apache.org/viewvc?rev=1362211&view=rev Log: Merged revisions 1362210 via git cherry-pick from https://svn.apache.org/repos/asf/camel/trunk r1362210 | dkulp | 2012-07-16 15:11:29 -0400 (Mon, 16 Jul 2012) | 4 lines [CXF-5449] Provide a direct CxfPayload -> Source conversion so XSLT component can bypass the current CxfPayload(StaxSource) -> NodeList -> DOMSource -> InputStream -> StreamSource thing it currently does. Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1362211&r1=1362210&r2=1362211&view=diff == --- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original) +++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Mon Jul 16 19:12:53 2012 @@ -47,6 +47,7 @@ import org.apache.camel.ExpectedBodyType import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.RuntimeTransformException; +import org.apache.camel.TypeConverter; import org.apache.camel.converter.jaxp.XmlConverter; import org.apache.camel.converter.jaxp.XmlErrorListener; import org.apache.camel.support.SynchronizationAdapter; @@ -424,8 +425,10 @@ public class XsltBuilder implements Proc return false; } else if (body instanceof Node) { return false; +} else if (exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass()) != null) { +//there is a direct and hopefully optimized converter to Source +return false; } - // yes an input stream is needed return true; } @@ -446,9 +449,15 @@ public class XsltBuilder implements Proc if (body instanceof Source) { return (Source) body; } - Source source = null; -if (isAllowStAX()) { +if (body != null) { +TypeConverter tc = exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass()); +if (tc != null) { +source = tc.convertTo(Source.class, body); +} +} + +if (source == null && isAllowStAX()) { source = exchange.getContext().getTypeConverter().tryConvertTo(StAXSource.class, exchange, body); } if (source == null) { Modified: camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1362211&r1=1362210&r2=1362211&view=diff == --- camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java (original) +++ camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Mon Jul 16 19:12:53 2012 @@ -90,6 +90,16 @@ public final class CxfPayloadConverter { } return null; } + +@Converter +public static Source cxfPayLoadToSource(CxfPayload payload, Exchange exchange) { +List payloadBody = payload.getBodySources(); + +if (payloadBody.size() > 0) { +return payloadBody.get(0); +} +return null; +} @SuppressWarnings("unchecked") @FallbackConverter @@ -130,6 +140,14 @@ public final class CxfPayloadConverter { } // Convert a CxfPayload into something else if (CxfPayload.class.isAssignableFrom(value.getClass())) { +CxfPayload payload = (CxfPayload) value; + +if (payload.getBodySources().size() == 1) { +TypeConverter tc = registry.lookup(type, Source.class); +if (tc != null) { +return tc.convertTo(type, payload.getBodySources().get(0)); +} +} TypeConverter tc = registry.lookup(type, NodeList.class); if (tc != null) { return tc.convertTo(type, cxfPayloadToNodeList((CxfPayload) value, exchange));
svn commit: r1362210 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadCon
Author: dkulp Date: Mon Jul 16 19:11:29 2012 New Revision: 1362210 URL: http://svn.apache.org/viewvc?rev=1362210&view=rev Log: [CXF-5449] Provide a direct CxfPayload -> Source conversion so XSLT component can bypass the current CxfPayload(StaxSource) -> NodeList -> DOMSource -> InputStream -> StreamSource thing it currently does. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1362210&r1=1362209&r2=1362210&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Mon Jul 16 19:11:29 2012 @@ -47,6 +47,7 @@ import org.apache.camel.ExpectedBodyType import org.apache.camel.Message; import org.apache.camel.Processor; import org.apache.camel.RuntimeTransformException; +import org.apache.camel.TypeConverter; import org.apache.camel.converter.jaxp.XmlConverter; import org.apache.camel.converter.jaxp.XmlErrorListener; import org.apache.camel.support.SynchronizationAdapter; @@ -424,8 +425,10 @@ public class XsltBuilder implements Proc return false; } else if (body instanceof Node) { return false; +} else if (exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass()) != null) { +//there is a direct and hopefully optimized converter to Source +return false; } - // yes an input stream is needed return true; } @@ -446,9 +449,15 @@ public class XsltBuilder implements Proc if (body instanceof Source) { return (Source) body; } - Source source = null; -if (isAllowStAX()) { +if (body != null) { +TypeConverter tc = exchange.getContext().getTypeConverterRegistry().lookup(Source.class, body.getClass()); +if (tc != null) { +source = tc.convertTo(Source.class, body); +} +} + +if (source == null && isAllowStAX()) { source = exchange.getContext().getTypeConverter().tryConvertTo(StAXSource.class, exchange, body); } if (source == null) { Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1362210&r1=1362209&r2=1362210&view=diff == --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Mon Jul 16 19:11:29 2012 @@ -90,6 +90,16 @@ public final class CxfPayloadConverter { } return null; } + +@Converter +public static Source cxfPayLoadToSource(CxfPayload payload, Exchange exchange) { +List payloadBody = payload.getBodySources(); + +if (payloadBody.size() > 0) { +return payloadBody.get(0); +} +return null; +} @SuppressWarnings("unchecked") @FallbackConverter @@ -130,6 +140,14 @@ public final class CxfPayloadConverter { } // Convert a CxfPayload into something else if (CxfPayload.class.isAssignableFrom(value.getClass())) { +CxfPayload payload = (CxfPayload) value; + +if (payload.getBodySources().size() == 1) { +TypeConverter tc = registry.lookup(type, Source.class); +if (tc != null) { +return tc.convertTo(type, payload.getBodySources().get(0)); +} +} TypeConverter tc = registry.lookup(type, NodeList.class); if (tc != null) { return tc.convertTo(type, cxfPayloadToNodeList((CxfPayload) value, exchange));
svn commit: r1362163 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/config/ camel-core/src/main/java/org/apache/camel/processor/ ca
Author: boday Date: Mon Jul 16 17:51:17 2012 New Revision: 1362163 URL: http://svn.apache.org/viewvc?rev=1362163&view=rev Log: CAMEL-4327 added "rejectOld" option to the Resequencer EIP to throw an error if older messages are received after the last delivered message Added: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/resequencer/MessageRejectedException.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ResequenceStreamRejectOldExchangesTest.java camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringResequenceStreamRejectOldExchangesTest.java camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/resequencerRejectOld.xml Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/resequencer/ResequencerEngine.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java?rev=1362163&r1=1362162&r2=1362163&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequenceDefinition.java Mon Jul 16 17:51:17 2012 @@ -150,6 +150,18 @@ public class ResequenceDefinition extend } /** + * Sets the rejectOld flag to throw an error when a message older than the last delivered message is processed + * @return the builder + */ +public ResequenceDefinition rejectOld() { +if (streamConfig == null) { +throw new IllegalStateException("rejectOld() only supported for stream resequencer"); +} +streamConfig.setRejectOld(true); +return this; +} + +/** * Sets the in batch size for number of exchanges received * @param batchSize the batch size * @return the builder @@ -368,6 +380,7 @@ public class ResequenceDefinition extend StreamResequencer resequencer = new StreamResequencer(routeContext.getCamelContext(), processor, comparator); resequencer.setTimeout(config.getTimeout()); resequencer.setCapacity(config.getCapacity()); +resequencer.setRejectOld(config.getRejectOld()); if (config.getIgnoreInvalidExchanges() != null) { resequencer.setIgnoreInvalidExchanges(config.getIgnoreInvalidExchanges()); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java?rev=1362163&r1=1362162&r2=1362163&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/config/StreamResequencerConfig.java Mon Jul 16 17:51:17 2012 @@ -19,6 +19,7 @@ package org.apache.camel.model.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; @@ -41,6 +42,8 @@ public class StreamResequencerConfig ext private Boolean ignoreInvalidExchanges; @XmlTransient private ExpressionResultComparator comparator; +@XmlElement +private Boolean rejectOld; /** * Creates a new {@link StreamResequencerConfig} instance using default @@ -123,5 +126,13 @@ public class StreamResequencerConfig ext public void setComparator(ExpressionResultComparator comparator) { this.comparator = comparator; } - + +public void setRejectOld(boolean value) { +this.rejectOld = value; +} + +public Boolean getRejectOld() { +return rejectOld; +} + } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java?rev=1362163&r1=1362162&r2=1362163&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/StreamResequencer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/pr
svn commit: r1362157 - in /camel/branches/camel-2.9.x: camel-core/src/test/java/org/apache/camel/issues/ components/camel-cxf/src/test/java/org/apache/camel/component/cxf/
Author: dkulp Date: Mon Jul 16 17:31:30 2012 New Revision: 1362157 URL: http://svn.apache.org/viewvc?rev=1362157&view=rev Log: Fix some checkstyle issues on 2.9.x Modified: camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryErrorHandlerAsyncDelayedTwoCamelContextIssueTest.java camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java Modified: camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryErrorHandlerAsyncDelayedTwoCamelContextIssueTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryErrorHandlerAsyncDelayedTwoCamelContextIssueTest.java?rev=1362157&r1=1362156&r2=1362157&view=diff == --- camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryErrorHandlerAsyncDelayedTwoCamelContextIssueTest.java (original) +++ camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/RedeliveryErrorHandlerAsyncDelayedTwoCamelContextIssueTest.java Mon Jul 16 17:31:30 2012 @@ -1,3 +1,19 @@ +/** + * 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.ConsumerTemplate; @@ -59,7 +75,7 @@ public class RedeliveryErrorHandlerAsync } public static class ProblematicBean { -int counter = 0; +int counter; public void doSomething() { if (counter++ < 2) { Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java?rev=1362157&r1=1362156&r2=1362157&view=diff == --- camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java (original) +++ camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadBareSoapTest.java Mon Jul 16 17:31:30 2012 @@ -16,6 +16,12 @@ */ package org.apache.camel.component.cxf; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; +import javax.xml.ws.Endpoint; + import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.AvailablePortFinder; import org.apache.camel.test.junit4.CamelTestSupport; @@ -23,10 +29,6 @@ import org.apache.cxf.frontend.ClientPro import org.junit.BeforeClass; import org.junit.Test; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.ws.Endpoint; -import java.util.concurrent.atomic.AtomicInteger; import static org.junit.Assert.assertEquals; @@ -78,7 +80,7 @@ public class CxfPayLoadBareSoapTest exte @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface BareSoapService { -public void doSomething(); +void doSomething(); }
svn commit: r1362156 - /camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java
Author: dkulp Date: Mon Jul 16 17:31:25 2012 New Revision: 1362156 URL: http://svn.apache.org/viewvc?rev=1362156&view=rev Log: Fix compile failure on 2.9.x Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java?rev=1362156&r1=1362155&r2=1362156&view=diff == --- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java (original) +++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java Mon Jul 16 17:31:25 2012 @@ -132,16 +132,16 @@ public class CxfRsEndpoint extends Defau } } -@SuppressWarnings({"rawtypes", "unchecked"}) +@SuppressWarnings({"rawtypes"}) protected void setupJAXRSServerFactoryBean(JAXRSServerFactoryBean sfb) { // address if (getAddress() != null) { sfb.setAddress(getAddress()); } if (getResourceClasses() != null) { -List> res = CastUtils.cast(getResourceClasses()); +List res = CastUtils.cast(getResourceClasses()); // setup the resource providers -for (Class clazz : res) { +for (Class clazz : res) { sfb.setResourceProvider(clazz, new CamelResourceProvider(clazz)); } sfb.setResourceClasses(res);
svn commit: r826012 - in /websites/production/camel/content: book-component-appendix.html book-in-one-page.html cache/main.pageCache xslt.html
Author: buildbot Date: Mon Jul 16 17:21:26 2012 New Revision: 826012 Log: Production update by buildbot for camel Modified: websites/production/camel/content/book-component-appendix.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/xslt.html Modified: websites/production/camel/content/book-component-appendix.html == --- websites/production/camel/content/book-component-appendix.html (original) +++ websites/production/camel/content/book-component-appendix.html Mon Jul 16 17:21:26 2012 @@ -16937,7 +16937,7 @@ xslt:templateName[?options] Options Name Default Value Description converter null Option to override default http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/converter/jaxp/XmlConverter.html";>XmlConverter. Will lookup for the converter in the Registry. The provided converted must be of type org.apache.camel.converter.jaxp.XmlConverter. transformerFactory null < /td> Camel 1.6 Option to override default http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html"; rel="nofollow">TransformerFactory. Will lookup for the transformerFactory in the Registry. The provided transformer factory must be of type javax.xml.transform.TransformerFactory. transformerFactoryClass null Camel 1.6 Option to override default http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html"; rel="nofollow">TransformerFactory. Will create a TransformerFactoryClass instance and set it to the converter. < tr> uriResolver null Camel 2.3: Allows you to use a custom javax.xml.transformation.URIResolver. Camel will by default use its own implementation org.apache.camel.builder.xml.XsltUriResolver which is capable of loading from classpath. resultHandlerFactory null Camel 2.3: Allows you to use a custom org.apache.camel.builder.xml.ResultHandlerFactory which is capable of using custom org.apache.camel.builder.xml.ResultHandler types. failOnNullBody true Camel 2.3: Whether or not to throw an exception if the input body is null. deleteOutputFile false Camel 2.6: If you have output=file then this option dictates whether or not the output file should be deleted when the Exchange is done processing. For example suppose the output file is a temporary file, then it can be a good idea to delete it after use. output string Camel 2.3: Option to specify which output type to use. Possible values are: string, bytes, DOM, file. The first three options are all in memory based, where as file is streamed directly to a java.io.File. For file you must specify the filename in the IN header with the key Exchange.XSLT_FILE_NAME which is also CamelXsltFileName. Also any paths leading to the filename must be created beforehand, otherwise an exception is thrown at runtime. contentCache true Camel 2.6: Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reload the stylesheet file on each message processing. This is good for development. -Note: from Camel 2.9 a cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. allowStAX false Camel 2.8.3/2.9: Whether to allow using StAX as the javax.xml.transform.Source. +Note: from Camel 2.9 a cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. allowStAX false Camel 2.8.3/2.9: Whether to allow using StAX as the javax.xml.transform.Source. transformerCacheSize 0 Camel 2.9.3/2.10.1: The number of javax.xml.transform.Transformer object that are cached for reuse to avoid calls to Template.newTransformer(). Modified: websites/production/camel/content/book-in-one-page.html == --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Mon Jul 16 17:21:26 2012 @@ -37429,7 +37429,7 @@ xslt:templateName[?options] Options Name Default Value Description converter null Option to override default http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/converter/jaxp/XmlConverter.html";>XmlConverter. Will lookup for the converter in the Registry. The provided converted must be of type org.apache.camel.converter.jaxp.XmlConverter. transformerFactory null < /td> Camel 1.6 Option to override default http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/TransformerFactory.html"; rel="nofollow">TransformerFactory. Will lookup for the transformerFactory in the Registry. The provided transformer factory must be of type javax.xml.transform.TransformerFactory. transformerFactoryClass null Camel 1.6 Option to override default http://java.sun
svn commit: r1362146 - /camel/branches/camel-2.9.x/
Author: dkulp Date: Mon Jul 16 17:16:51 2012 New Revision: 1362146 URL: http://svn.apache.org/viewvc?rev=1362146&view=rev Log: Blocking revisions 1359197,1359200,1362129,1362131 via git from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x r1359200 | davsclaus | 2012-07-09 10:57:57 -0400 (Mon, 09 Jul 2012) | 2 lines CAMEL-5431: Added trends to camel-twitter. And more javadoc etc. Thanks to Brett for the patch. r1362129 | dkulp | 2012-07-16 12:56:14 -0400 (Mon, 16 Jul 2012) | 3 lines Recording revisions 1362123 via git from https://svn.apache.org/repos/asf/camel/trunk r1362131 | dkulp | 2012-07-16 12:56:45 -0400 (Mon, 16 Jul 2012) | 3 lines Recording revisions 1362126 via git from https://svn.apache.org/repos/asf/camel/trunk Modified: camel/branches/camel-2.9.x/ (props changed) Propchange: camel/branches/camel-2.9.x/ -- Binary property 'svnmerge-blocked' - no diff available.
svn commit: r1362145 - /camel/branches/camel-2.9.x/
Author: dkulp Date: Mon Jul 16 17:16:49 2012 New Revision: 1362145 URL: http://svn.apache.org/viewvc?rev=1362145&view=rev Log: Recording revisions 1359013,1359226,1359265,1359341,1360042,1362128,1362130 via git from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x Modified: camel/branches/camel-2.9.x/ (props changed) Propchange: camel/branches/camel-2.9.x/ -- Binary property 'svnmerge-integrated' - no diff available.
svn commit: r1362144 - in /camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel: builder/xml/XsltBuilder.java component/xslt/XsltComponent.java
Author: dkulp Date: Mon Jul 16 17:16:44 2012 New Revision: 1362144 URL: http://svn.apache.org/viewvc?rev=1362144&view=rev Log: Merged revisions 1362130 via git cherry-pick from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x r1362130 | dkulp | 2012-07-16 12:56:40 -0400 (Mon, 16 Jul 2012) | 12 lines Merged revisions 1362126 via git cherry-pick from https://svn.apache.org/repos/asf/camel/trunk r1362126 | dkulp | 2012-07-16 12:53:57 -0400 (Mon, 16 Jul 2012) | 4 lines [CAMEL-5450] Add support to xslt component to cache the transformers (off by default, but likely could/should be on and set to something like 5 or 10) Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1362144&r1=1362143&r2=1362144&view=diff == --- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original) +++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Mon Jul 16 17:16:44 2012 @@ -23,6 +23,9 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; + import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.Result; @@ -69,6 +72,7 @@ public class XsltBuilder implements Proc private Map parameters = new HashMap(); private XmlConverter converter = new XmlConverter(); private Templates template; +private volatile BlockingQueue transformers; private ResultHandlerFactory resultHandlerFactory = new StringResultHandlerFactory(); private boolean failOnNullBody = true; private URIResolver uriResolver; @@ -97,7 +101,7 @@ public class XsltBuilder implements Proc exchange.addOnCompletion(new XsltBuilderOnCompletion(fileName)); } -Transformer transformer = getTemplate().newTransformer(); +Transformer transformer = getTransformer(); configureTransformer(transformer, exchange); transformer.setErrorListener(new DefaultTransformErrorHandler()); ResultHandler resultHandler = resultHandlerFactory.createResult(exchange); @@ -124,6 +128,7 @@ public class XsltBuilder implements Proc LOG.trace("Transform complete with result {}", result); resultHandler.setBody(out); } finally { +releaseTransformer(transformer); // IOHelper can handle if is is null IOHelper.close(is); } @@ -238,6 +243,16 @@ public class XsltBuilder implements Proc setAllowStAX(true); return this; } + + +public XsltBuilder transformerCacheSize(int numberToCache) { +if (numberToCache > 0) { +transformers = new ArrayBlockingQueue(numberToCache); +} else { +transformers = null; +} +return this; +} // Properties // - @@ -252,6 +267,9 @@ public class XsltBuilder implements Proc public void setTemplate(Templates template) { this.template = template; +if (transformers != null) { +transformers.clear(); +} } public Templates getTemplate() { @@ -365,6 +383,23 @@ public class XsltBuilder implements Proc // Implementation methods // - +private void releaseTransformer(Transformer transformer) { +if (transformers != null) { +transformer.reset(); +transformers.offer(transformer); +} +} + +private Transformer getTransformer() throws TransformerConfigurationException { +Transformer t = null; +if (transformers != null) { +t = transformers.poll(); +} +if (t == null) { +t = getTemplate().newTransformer(); +} +return t; +} /** * Checks whether we need an {@link InputStream} to access the message body. Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java?rev=1362144&r1=1362143&r2=1362144&view=diff =
svn commit: r1362143 - in /camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: CxfEndpoint.java converter/CxfPayloadConverter.java
Author: dkulp Date: Mon Jul 16 17:16:39 2012 New Revision: 1362143 URL: http://svn.apache.org/viewvc?rev=1362143&view=rev Log: Merged revisions 1362128 via git cherry-pick from https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x r1362128 | dkulp | 2012-07-16 12:56:09 -0400 (Mon, 16 Jul 2012) | 10 lines Merged revisions 1362123 via git cherry-pick from https://svn.apache.org/repos/asf/camel/trunk r1362123 | dkulp | 2012-07-16 12:53:52 -0400 (Mon, 16 Jul 2012) | 2 lines [CAMEL-5449] Try converting to Source first Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1362143&r1=1362142&r2=1362143&view=diff == --- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original) +++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Jul 16 17:16:39 2012 @@ -29,6 +29,7 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stax.StAXSource; +import javax.xml.transform.stream.StreamSource; import javax.xml.ws.WebServiceProvider; import javax.xml.ws.handler.Handler; @@ -86,6 +87,7 @@ import org.apache.cxf.service.factory.Re import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.MessagePartInfo; import org.apache.cxf.staxutils.StaxSource; +import org.apache.cxf.staxutils.StaxUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -900,6 +902,19 @@ public class CxfEndpoint extends Default } } return r.getLocalName(); +} else if (source instanceof StreamSource) { +//flip to stax so we can get the name +XMLStreamReader reader = StaxUtils.createXMLStreamReader(source); +StaxSource src2 = new StaxSource(reader); +sources.set(i, src2); +if (reader.getEventType() == XMLStreamReader.START_DOCUMENT) { +try { +reader.nextTag(); +} catch (XMLStreamException e) { +//ignore +} +} +return reader.getLocalName(); } return null; } Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1362143&r1=1362142&r2=1362143&view=diff == --- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java (original) +++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Mon Jul 16 17:16:39 2012 @@ -20,6 +20,8 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import javax.xml.transform.Source; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -65,6 +67,14 @@ public final class CxfPayloadConverter { } return new CxfPayload(headers, body); } + +@Converter +public static CxfPayload sourceToCxfPayload(Source src, Exchange exchange) { +List headers = new ArrayList(); +List body = new ArrayList(); +body.add(src); +return new CxfPayload(headers, body, null); +} @Converter public static NodeList cxfPayloadToNodeList(CxfPayload payload, Exchange exchange) { @@ -87,6 +97,13 @@ public final class CxfPayloadConverter { // use fallback type converter, so we can probably convert into // CxfPayloads from other types if (type.isAssignableFrom(CxfPayload.class)) { +if (!value.getClass().isArray()) { +TypeConverter tc = registry.lookup(Source.class, value.getClass()); +if (tc != null) { +Source src = tc.convertTo(Source.class, exchange, value); +return (T) sourceToCxfPayload(src, exchange); +}
svn commit: r1362142 - /camel/branches/camel-2.8.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
Author: gnodet Date: Mon Jul 16 17:15:18 2012 New Revision: 1362142 URL: http://svn.apache.org/viewvc?rev=1362142&view=rev Log: [CAMEL-5451] Camel-Blueprint should wait for camel-core to be started since there is a strong dependency Conflicts: components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java Modified: camel/branches/camel-2.8.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Modified: camel/branches/camel-2.8.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java?rev=1362142&r1=1362141&r2=1362142&view=diff == --- camel/branches/camel-2.8.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java (original) +++ camel/branches/camel-2.8.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Mon Jul 16 17:15:18 2012 @@ -178,7 +178,11 @@ public class CamelNamespaceHandler imple CamelContextFactoryBean ccfb = (CamelContextFactoryBean) value; ccfb.setImplicitId(implicitId); - + +// The properties component is always used / created by the CamelContextFactoryBean +// so we need to ensure that the resolver is ready to use +ComponentMetadata propertiesComponentResolver = getComponentResolverReference(context, "properties"); + MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class); factory.setId(".camelBlueprint.passThrough." + contextId); factory.setObject(new PassThroughCallable(value)); @@ -191,6 +195,7 @@ public class CamelNamespaceHandler imple factory2.setDestroyMethod("destroy"); factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); factory2.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); +factory2.addDependsOn(propertiesComponentResolver.getId()); context.getComponentDefinitionRegistry().registerComponentDefinition(factory2); MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class); @@ -464,6 +469,96 @@ public class CamelNamespaceHandler imple return r; } +private static ComponentMetadata getDataformatResolverReference(ParserContext context, String dataformat) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver." + dataformat); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +svc.setId(".camelBlueprint.dataformatResolver." + dataformat); +svc.setFilter("(dataformat=" + dataformat + ")"); + svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(dataformat) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY); +try { +// Try to set the runtime interface (only with aries blueprint > 0.1 +svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, DataFormatResolver.class); +} catch (Throwable t) { +// Check if the bundle can see the class +try { +PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle"); +Bundle b = (Bundle) ptm.getObject(); +if (b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) { +throw new UnsupportedOperationException(); +} +svc.setInterface(DataFormatResolver.class.getName()); +} catch (Throwable t2) { +throw new UnsupportedOperationException(); +} +} +componentDefinitionRegistry.registerComponentDefinition(svc); +cm = svc; +} +return cm; +} + +private static ComponentMetadata getLanguageResolverReference(ParserContext context, String language) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver." + language); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +svc.setId(".camelBlueprint.languageResolver."
svn commit: r1362141 - /camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
Author: gnodet Date: Mon Jul 16 17:14:31 2012 New Revision: 1362141 URL: http://svn.apache.org/viewvc?rev=1362141&view=rev Log: [CAMEL-5451] Camel-Blueprint should wait for camel-core to be started since there is a strong dependency Conflicts: components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Modified: camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java?rev=1362141&r1=1362140&r2=1362141&view=diff == --- camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java (original) +++ camel/branches/camel-2.9.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Mon Jul 16 17:14:31 2012 @@ -179,7 +179,11 @@ public class CamelNamespaceHandler imple CamelContextFactoryBean ccfb = (CamelContextFactoryBean) value; ccfb.setImplicitId(implicitId); - + +// The properties component is always used / created by the CamelContextFactoryBean +// so we need to ensure that the resolver is ready to use +ComponentMetadata propertiesComponentResolver = getComponentResolverReference(context, "properties"); + MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class); factory.setId(".camelBlueprint.passThrough." + contextId); factory.setObject(new PassThroughCallable(value)); @@ -192,6 +196,7 @@ public class CamelNamespaceHandler imple factory2.setDestroyMethod("destroy"); factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); factory2.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); +factory2.addDependsOn(propertiesComponentResolver.getId()); context.getComponentDefinitionRegistry().registerComponentDefinition(factory2); MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class); @@ -503,6 +508,96 @@ public class CamelNamespaceHandler imple return r; } +private static ComponentMetadata getDataformatResolverReference(ParserContext context, String dataformat) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver." + dataformat); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +svc.setId(".camelBlueprint.dataformatResolver." + dataformat); +svc.setFilter("(dataformat=" + dataformat + ")"); + svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(dataformat) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY); +try { +// Try to set the runtime interface (only with aries blueprint > 0.1 +svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, DataFormatResolver.class); +} catch (Throwable t) { +// Check if the bundle can see the class +try { +PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle"); +Bundle b = (Bundle) ptm.getObject(); +if (b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) { +throw new UnsupportedOperationException(); +} +svc.setInterface(DataFormatResolver.class.getName()); +} catch (Throwable t2) { +throw new UnsupportedOperationException(); +} +} +componentDefinitionRegistry.registerComponentDefinition(svc); +cm = svc; +} +return cm; +} + +private static ComponentMetadata getLanguageResolverReference(ParserContext context, String language) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver." + language); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +svc.setId(".camelBlueprint.languageResolver."
svn commit: r1362139 - in /camel/branches/camel-2.10.x/components: camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/ camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/
Author: gnodet Date: Mon Jul 16 17:13:16 2012 New Revision: 1362139 URL: http://svn.apache.org/viewvc?rev=1362139&view=rev Log: [CAMEL-5451] Camel-Blueprint should wait for camel-core to be started since there is a strong dependency Added: camel/branches/camel-2.10.x/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPropertiesTest.java Modified: camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java camel/branches/camel-2.10.x/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java Modified: camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java?rev=1362139&r1=1362138&r2=1362139&view=diff == --- camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java (original) +++ camel/branches/camel-2.10.x/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Mon Jul 16 17:13:16 2012 @@ -181,7 +181,11 @@ public class CamelNamespaceHandler imple CamelContextFactoryBean ccfb = (CamelContextFactoryBean) value; ccfb.setImplicitId(implicitId); - + +// The properties component is always used / created by the CamelContextFactoryBean +// so we need to ensure that the resolver is ready to use +ComponentMetadata propertiesComponentResolver = getComponentResolverReference(context, "properties"); + MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class); factory.setId(".camelBlueprint.passThrough." + contextId); factory.setObject(new PassThroughCallable(value)); @@ -194,6 +198,7 @@ public class CamelNamespaceHandler imple factory2.setDestroyMethod("destroy"); factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); factory2.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); +factory2.addDependsOn(propertiesComponentResolver.getId()); context.getComponentDefinitionRegistry().registerComponentDefinition(factory2); MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class); @@ -514,6 +519,96 @@ public class CamelNamespaceHandler imple return r; } +private static ComponentMetadata getDataformatResolverReference(ParserContext context, String dataformat) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver." + dataformat); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +svc.setId(".camelBlueprint.dataformatResolver." + dataformat); +svc.setFilter("(dataformat=" + dataformat + ")"); + svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(dataformat) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY); +try { +// Try to set the runtime interface (only with aries blueprint > 0.1 +svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, DataFormatResolver.class); +} catch (Throwable t) { +// Check if the bundle can see the class +try { +PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle"); +Bundle b = (Bundle) ptm.getObject(); +if (b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) { +throw new UnsupportedOperationException(); +} +svc.setInterface(DataFormatResolver.class.getName()); +} catch (Throwable t2) { +throw new UnsupportedOperationException(); +} +} +componentDefinitionRegistry.registerComponentDefinition(svc); +cm = svc; +} +return cm; +} + +private static ComponentMetadata getLanguageResolverReference(ParserContext context, String language) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver." + language); +if (cm == null)
svn commit: r1362137 - in /camel/trunk/components: camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/ camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/ camel-test-blue
Author: gnodet Date: Mon Jul 16 17:00:52 2012 New Revision: 1362137 URL: http://svn.apache.org/viewvc?rev=1362137&view=rev Log: [CAMEL-5451] Camel-Blueprint should wait for camel-core to be started since there is a strong dependency Added: camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintPropertiesTest.java Modified: camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java camel/trunk/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java Modified: camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java?rev=1362137&r1=1362136&r2=1362137&view=diff == --- camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java (original) +++ camel/trunk/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java Mon Jul 16 17:00:52 2012 @@ -181,7 +181,11 @@ public class CamelNamespaceHandler imple CamelContextFactoryBean ccfb = (CamelContextFactoryBean) value; ccfb.setImplicitId(implicitId); - + +// The properties component is always used / created by the CamelContextFactoryBean +// so we need to ensure that the resolver is ready to use +ComponentMetadata propertiesComponentResolver = getComponentResolverReference(context, "properties"); + MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class); factory.setId(".camelBlueprint.passThrough." + contextId); factory.setObject(new PassThroughCallable(value)); @@ -194,6 +198,7 @@ public class CamelNamespaceHandler imple factory2.setDestroyMethod("destroy"); factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer")); factory2.addProperty("bundleContext", createRef(context, "blueprintBundleContext")); +factory2.addDependsOn(propertiesComponentResolver.getId()); context.getComponentDefinitionRegistry().registerComponentDefinition(factory2); MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class); @@ -514,6 +519,96 @@ public class CamelNamespaceHandler imple return r; } +private static ComponentMetadata getDataformatResolverReference(ParserContext context, String dataformat) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver." + dataformat); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +svc.setId(".camelBlueprint.dataformatResolver." + dataformat); +svc.setFilter("(dataformat=" + dataformat + ")"); + svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(dataformat) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY); +try { +// Try to set the runtime interface (only with aries blueprint > 0.1 +svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, DataFormatResolver.class); +} catch (Throwable t) { +// Check if the bundle can see the class +try { +PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle"); +Bundle b = (Bundle) ptm.getObject(); +if (b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) { +throw new UnsupportedOperationException(); +} +svc.setInterface(DataFormatResolver.class.getName()); +} catch (Throwable t2) { +throw new UnsupportedOperationException(); +} +} +componentDefinitionRegistry.registerComponentDefinition(svc); +cm = svc; +} +return cm; +} + +private static ComponentMetadata getLanguageResolverReference(ParserContext context, String language) { +ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry(); +ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver." + language); +if (cm == null) { +MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class); +
svn commit: r1362131 - /camel/branches/camel-2.10.x/
Author: dkulp Date: Mon Jul 16 16:56:45 2012 New Revision: 1362131 URL: http://svn.apache.org/viewvc?rev=1362131&view=rev Log: Recording revisions 1362126 via git from https://svn.apache.org/repos/asf/camel/trunk Modified: camel/branches/camel-2.10.x/ (props changed) Propchange: camel/branches/camel-2.10.x/ -- --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Jul 16 16:56:45 2012 @@ -1 +1 @@ -/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973,1362123 +/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973,1362123,1362126
svn commit: r1362130 - in /camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel: builder/xml/XsltBuilder.java component/xslt/XsltComponent.java
Author: dkulp Date: Mon Jul 16 16:56:40 2012 New Revision: 1362130 URL: http://svn.apache.org/viewvc?rev=1362130&view=rev Log: Merged revisions 1362126 via git cherry-pick from https://svn.apache.org/repos/asf/camel/trunk r1362126 | dkulp | 2012-07-16 12:53:57 -0400 (Mon, 16 Jul 2012) | 4 lines [CAMEL-5450] Add support to xslt component to cache the transformers (off by default, but likely could/should be on and set to something like 5 or 10) Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1362130&r1=1362129&r2=1362130&view=diff == --- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original) +++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Mon Jul 16 16:56:40 2012 @@ -23,6 +23,9 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; + import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.Result; @@ -69,6 +72,7 @@ public class XsltBuilder implements Proc private Map parameters = new HashMap(); private XmlConverter converter = new XmlConverter(); private Templates template; +private volatile BlockingQueue transformers; private ResultHandlerFactory resultHandlerFactory = new StringResultHandlerFactory(); private boolean failOnNullBody = true; private URIResolver uriResolver; @@ -97,7 +101,7 @@ public class XsltBuilder implements Proc exchange.addOnCompletion(new XsltBuilderOnCompletion(fileName)); } -Transformer transformer = getTemplate().newTransformer(); +Transformer transformer = getTransformer(); configureTransformer(transformer, exchange); transformer.setErrorListener(new DefaultTransformErrorHandler()); ResultHandler resultHandler = resultHandlerFactory.createResult(exchange); @@ -124,6 +128,7 @@ public class XsltBuilder implements Proc LOG.trace("Transform complete with result {}", result); resultHandler.setBody(out); } finally { +releaseTransformer(transformer); // IOHelper can handle if is is null IOHelper.close(is); } @@ -238,6 +243,16 @@ public class XsltBuilder implements Proc setAllowStAX(true); return this; } + + +public XsltBuilder transformerCacheSize(int numberToCache) { +if (numberToCache > 0) { +transformers = new ArrayBlockingQueue(numberToCache); +} else { +transformers = null; +} +return this; +} // Properties // - @@ -252,6 +267,9 @@ public class XsltBuilder implements Proc public void setTemplate(Templates template) { this.template = template; +if (transformers != null) { +transformers.clear(); +} } public Templates getTemplate() { @@ -365,6 +383,23 @@ public class XsltBuilder implements Proc // Implementation methods // - +private void releaseTransformer(Transformer transformer) { +if (transformers != null) { +transformer.reset(); +transformers.offer(transformer); +} +} + +private Transformer getTransformer() throws TransformerConfigurationException { +Transformer t = null; +if (transformers != null) { +t = transformers.poll(); +} +if (t == null) { +t = getTemplate().newTransformer(); +} +return t; +} /** * Checks whether we need an {@link InputStream} to access the message body. Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java?rev=1362130&r1=1362129&r2=1362130&view=diff == --- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java (original) +++ camel/branches/camel-2.10.x/camel-
svn commit: r1362129 - /camel/branches/camel-2.10.x/
Author: dkulp Date: Mon Jul 16 16:56:14 2012 New Revision: 1362129 URL: http://svn.apache.org/viewvc?rev=1362129&view=rev Log: Recording revisions 1362123 via git from https://svn.apache.org/repos/asf/camel/trunk Modified: camel/branches/camel-2.10.x/ (props changed) Propchange: camel/branches/camel-2.10.x/ -- --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Jul 16 16:56:14 2012 @@ -1 +1 @@ -/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973 +/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973,1362123
svn commit: r1362128 - in /camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: CxfEndpoint.java converter/CxfPayloadConverter.java
Author: dkulp Date: Mon Jul 16 16:56:09 2012 New Revision: 1362128 URL: http://svn.apache.org/viewvc?rev=1362128&view=rev Log: Merged revisions 1362123 via git cherry-pick from https://svn.apache.org/repos/asf/camel/trunk r1362123 | dkulp | 2012-07-16 12:53:52 -0400 (Mon, 16 Jul 2012) | 2 lines [CAMEL-5449] Try converting to Source first Modified: camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Modified: camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java?rev=1362128&r1=1362127&r2=1362128&view=diff == --- camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java (original) +++ camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java Mon Jul 16 16:56:09 2012 @@ -29,6 +29,7 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stax.StAXSource; +import javax.xml.transform.stream.StreamSource; import javax.xml.ws.WebServiceProvider; import javax.xml.ws.handler.Handler; @@ -88,6 +89,7 @@ import org.apache.cxf.service.factory.Re import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.MessagePartInfo; import org.apache.cxf.staxutils.StaxSource; +import org.apache.cxf.staxutils.StaxUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -916,6 +918,19 @@ public class CxfEndpoint extends Default } } return r.getLocalName(); +} else if (source instanceof StreamSource) { +//flip to stax so we can get the name +XMLStreamReader reader = StaxUtils.createXMLStreamReader(source); +StaxSource src2 = new StaxSource(reader); +sources.set(i, src2); +if (reader.getEventType() == XMLStreamReader.START_DOCUMENT) { +try { +reader.nextTag(); +} catch (XMLStreamException e) { +//ignore +} +} +return reader.getLocalName(); } return null; } Modified: camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1362128&r1=1362127&r2=1362128&view=diff == --- camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java (original) +++ camel/branches/camel-2.10.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Mon Jul 16 16:56:09 2012 @@ -20,6 +20,8 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import javax.xml.transform.Source; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -65,6 +67,14 @@ public final class CxfPayloadConverter { } return new CxfPayload(headers, body); } + +@Converter +public static CxfPayload sourceToCxfPayload(Source src, Exchange exchange) { +List headers = new ArrayList(); +List body = new ArrayList(); +body.add(src); +return new CxfPayload(headers, body, null); +} @Converter public static NodeList cxfPayloadToNodeList(CxfPayload payload, Exchange exchange) { @@ -87,6 +97,13 @@ public final class CxfPayloadConverter { // use fallback type converter, so we can probably convert into // CxfPayloads from other types if (type.isAssignableFrom(CxfPayload.class)) { +if (!value.getClass().isArray()) { +TypeConverter tc = registry.lookup(Source.class, value.getClass()); +if (tc != null) { +Source src = tc.convertTo(Source.class, exchange, value); +return (T) sourceToCxfPayload(src, exchange); +} +} TypeConverter tc = registry.lookup(NodeList.class, value.getClass()); if (tc != null) { NodeList nodeList = tc.convertTo(NodeList.class, exchange, value
svn commit: r1362126 - in /camel/trunk/camel-core/src/main/java/org/apache/camel: builder/xml/XsltBuilder.java component/xslt/XsltComponent.java
Author: dkulp Date: Mon Jul 16 16:53:57 2012 New Revision: 1362126 URL: http://svn.apache.org/viewvc?rev=1362126&view=rev Log: [CAMEL-5450] Add support to xslt component to cache the transformers (off by default, but likely could/should be on and set to something like 5 or 10) Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java camel/trunk/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java?rev=1362126&r1=1362125&r2=1362126&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/xml/XsltBuilder.java Mon Jul 16 16:53:57 2012 @@ -23,6 +23,9 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; import java.util.Set; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; + import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.ErrorListener; import javax.xml.transform.Result; @@ -69,6 +72,7 @@ public class XsltBuilder implements Proc private Map parameters = new HashMap(); private XmlConverter converter = new XmlConverter(); private Templates template; +private volatile BlockingQueue transformers; private ResultHandlerFactory resultHandlerFactory = new StringResultHandlerFactory(); private boolean failOnNullBody = true; private URIResolver uriResolver; @@ -97,7 +101,7 @@ public class XsltBuilder implements Proc exchange.addOnCompletion(new XsltBuilderOnCompletion(fileName)); } -Transformer transformer = getTemplate().newTransformer(); +Transformer transformer = getTransformer(); configureTransformer(transformer, exchange); transformer.setErrorListener(new DefaultTransformErrorHandler()); ResultHandler resultHandler = resultHandlerFactory.createResult(exchange); @@ -124,6 +128,7 @@ public class XsltBuilder implements Proc LOG.trace("Transform complete with result {}", result); resultHandler.setBody(out); } finally { +releaseTransformer(transformer); // IOHelper can handle if is is null IOHelper.close(is); } @@ -238,6 +243,16 @@ public class XsltBuilder implements Proc setAllowStAX(true); return this; } + + +public XsltBuilder transformerCacheSize(int numberToCache) { +if (numberToCache > 0) { +transformers = new ArrayBlockingQueue(numberToCache); +} else { +transformers = null; +} +return this; +} // Properties // - @@ -252,6 +267,9 @@ public class XsltBuilder implements Proc public void setTemplate(Templates template) { this.template = template; +if (transformers != null) { +transformers.clear(); +} } public Templates getTemplate() { @@ -365,6 +383,23 @@ public class XsltBuilder implements Proc // Implementation methods // - +private void releaseTransformer(Transformer transformer) { +if (transformers != null) { +transformer.reset(); +transformers.offer(transformer); +} +} + +private Transformer getTransformer() throws TransformerConfigurationException { +Transformer t = null; +if (transformers != null) { +t = transformers.poll(); +} +if (t == null) { +t = getTemplate().newTransformer(); +} +return t; +} /** * Checks whether we need an {@link InputStream} to access the message body. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java?rev=1362126&r1=1362125&r2=1362126&view=diff == --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/xslt/XsltComponent.java Mon Jul 16 16:53:57 2012 @@ -110,6 +110,9 @@ public class XsltComponent extends Defau } String output = getAndRemoveParameter(parameters, "output", String.class); configureOutput(xslt, output); + +Integer cs = getAndRemoveParameter(parameters,
svn commit: r1362123 - in /camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf: CxfEndpoint.java converter/CxfPayloadConverter.java
Author: dkulp Date: Mon Jul 16 16:53:52 2012 New Revision: 1362123 URL: http://svn.apache.org/viewvc?rev=1362123&view=rev Log: [CAMEL-5449] Try converting to Source first Modified: 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/converter/CxfPayloadConverter.java 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=1362123&r1=1362122&r2=1362123&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 Jul 16 16:53:52 2012 @@ -29,6 +29,7 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stax.StAXSource; +import javax.xml.transform.stream.StreamSource; import javax.xml.ws.WebServiceProvider; import javax.xml.ws.handler.Handler; @@ -88,6 +89,7 @@ import org.apache.cxf.service.factory.Re import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.MessagePartInfo; import org.apache.cxf.staxutils.StaxSource; +import org.apache.cxf.staxutils.StaxUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -916,6 +918,19 @@ public class CxfEndpoint extends Default } } return r.getLocalName(); +} else if (source instanceof StreamSource) { +//flip to stax so we can get the name +XMLStreamReader reader = StaxUtils.createXMLStreamReader(source); +StaxSource src2 = new StaxSource(reader); +sources.set(i, src2); +if (reader.getEventType() == XMLStreamReader.START_DOCUMENT) { +try { +reader.nextTag(); +} catch (XMLStreamException e) { +//ignore +} +} +return reader.getLocalName(); } return null; } Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java?rev=1362123&r1=1362122&r2=1362123&view=diff == --- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java (original) +++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/converter/CxfPayloadConverter.java Mon Jul 16 16:53:52 2012 @@ -20,6 +20,8 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import javax.xml.transform.Source; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -65,6 +67,14 @@ public final class CxfPayloadConverter { } return new CxfPayload(headers, body); } + +@Converter +public static CxfPayload sourceToCxfPayload(Source src, Exchange exchange) { +List headers = new ArrayList(); +List body = new ArrayList(); +body.add(src); +return new CxfPayload(headers, body, null); +} @Converter public static NodeList cxfPayloadToNodeList(CxfPayload payload, Exchange exchange) { @@ -87,6 +97,13 @@ public final class CxfPayloadConverter { // use fallback type converter, so we can probably convert into // CxfPayloads from other types if (type.isAssignableFrom(CxfPayload.class)) { +if (!value.getClass().isArray()) { +TypeConverter tc = registry.lookup(Source.class, value.getClass()); +if (tc != null) { +Source src = tc.convertTo(Source.class, exchange, value); +return (T) sourceToCxfPayload(src, exchange); +} +} TypeConverter tc = registry.lookup(NodeList.class, value.getClass()); if (tc != null) { NodeList nodeList = tc.convertTo(NodeList.class, exchange, value);
[CONF] Apache Camel > XSLT
XSLT Page edited by Daniel Kulp Changes (1) ... | {{allowStAX}} | {{false}} | *Camel 2.8.3/2.9:* Whether to allow using StAX as the {{javax.xml.transform.Source}}. | {div} | {{transformerCacheSize}} | {{0}} | *Camel 2.9.3/2.10.1:* The number of {{javax.xml.transform.Transformer}} object that are cached for reuse to avoid calls to {{Template.newTransformer()}}. | {div} h3. Using XSLT endpoints ... Full Content XSLT The xslt: component allows you to process a message using an XSLT template. This can be ideal when using Templating to generate respopnses for requests. URI format xslt:templateName[?options] Where templateName is the classpath-local URI of the template to invoke; or the complete URL of the remote template. Refer to the Spring Documentation for more detail of the URI syntax You can append query options to the URI in the following format, ?option=value&option=value&... Here are some example URIs URI Description xslt:com/acme/mytransform.xsl refers to the file com/acme/mytransform.xsl on the classpath xslt:file:///foo/bar.xsl refers to the file /foo/bar.xsl xslt:http://acme.com/cheese/foo.xsl refers to the remote http resource Maven users will need to add the following dependency to their pom.xml for this component when using Camel 2.8 or older: org.apache.camel camel-spring x.x.x From Camel 2.9 onwards the XSLT component is provided directly in the camel-core. Options Name Default Value Description converter null Option to override default XmlConverter. Will lookup for the converter in the Registry. The provided converted must be of type org.apache.camel.converter.jaxp.XmlConverter. transformerFactory null Camel 1.6 Option to override default TransformerFactory. Will lookup for the transformerFactory in the Registry. The provided transformer factory must be of type javax.xml.transform.TransformerFactory. transformerFactoryClass null Camel 1.6 Option to override default TransformerFactory. Will create a TransformerFactoryClass instance and set it to the converter. uriResolver null Camel 2.3: Allows you to use a custom javax.xml.transformation.URIResolver. Camel will by default use its own implementation org.apache.camel.builder.xml.XsltUriResolver which is capable of loading from classpath. resultHandlerFactory null Camel 2.3: Allows you to use a custom org.apache.camel.builder.xml.ResultHandlerFactory which is capable of using custom org.apache.camel.builder.xml.ResultHandler types. failOnNullBody true Camel 2.3: Whether or not to throw an exception if the input body is null. deleteOutputFile false Camel 2.6: If you have output=file then this option dictates whether or not the output file should be deleted when the Exchange is done processing. For example suppose the output file is a temporary file, then it can be a good idea to delete it after use. output string Camel 2.3: Option to specify which output type to use. Possible values are: string, bytes, DOM, file. The first three options are all in memory based, where as file is streamed directly to a java.io.File. For file you must specify the filename in the IN header with the key Exchange.XSLT_FILE_NAME which is also CamelXsltFileName. Also any paths leading to the filename must be created beforehand, otherwise an exception is thrown at runtime. contentCache true Camel 2.6: Cache for the resource content (the stylesheet file) when it is loaded. If set to false Camel will reload the stylesheet file on each message processing. This is good for development. Note: from Camel 2.9 a cached stylesheet can be forced to reload at runtime via JMX using the clearCachedStylesheet operation. allowStAX false Camel 2.8.3/2.9: Whether to allow using StAX as the javax.xml.transform.Source. transformerCacheSize 0 Camel 2.9.3/2.10.1: The number of javax.xml.transform.Transformer object that are cached for reuse to avoid calls to Template.newTransformer(). Using XSLT endpoints For example you could use something like from("activemq:My.Queue"). to("xslt:com/acme/mytransform.xsl"); To use an XSLT template to formulate a response for a message for InOut message exchanges (where there is a JMSReplyTo header). If you want to use InOnly and consume the message and send it to another destination you could use the following route: from("activemq:My.Queue"). to("xslt:com/acme/mytransform.xsl"). to("activemq:Another.Queue"); Getting Parameters into the XSLT to work with By default, all headers are added as parameters which are available in the XSLT. To do this you will need to declare the parameter so it is
svn commit: r1361975 - in /camel/branches/camel-2.10.x: ./ camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
Author: davsclaus Date: Mon Jul 16 11:26:49 2012 New Revision: 1361975 URL: http://svn.apache.org/viewvc?rev=1361975&view=rev Log: CAMEL-5445: TimerManagerLoadTask thread name is now using the same name pattern as all the other threads. Have to defer starting it until CamelContext fully started. Modified: camel/branches/camel-2.10.x/ (props changed) camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java Propchange: camel/branches/camel-2.10.x/ -- Merged /camel/trunk:r1361973 Propchange: camel/branches/camel-2.10.x/ -- --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Jul 16 11:26:49 2012 @@ -1 +1 @@ -/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919 +/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919,1361973 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=1361975&r1=1361974&r2=1361975&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 Mon Jul 16 11:26:49 2012 @@ -42,6 +42,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.Route; import org.apache.camel.Service; +import org.apache.camel.StartupListener; import org.apache.camel.TimerListener; import org.apache.camel.VetoCamelContextStartException; import org.apache.camel.api.management.PerformanceCounter; @@ -105,6 +106,7 @@ public class DefaultManagementLifecycleS new HashMap, InstrumentationProcessor>>(); private final List preServices = new ArrayList(); private final TimerListenerManager timerListenerManager = new TimerListenerManager(); +private final TimerListenerManagerStartupListener timerManagerStartupListener = new TimerListenerManagerStartupListener(); private volatile CamelContext camelContext; private volatile ManagedCamelContext camelContextMBean; private volatile boolean initialized; @@ -844,14 +846,24 @@ public class DefaultManagementLifecycleS protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext"); -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); +// defer starting the timer manager until CamelContext has been fully started +camelContext.addStartupListener(timerManagerStartupListener); +} + +private final class TimerListenerManagerStartupListener implements StartupListener { + +@Override +public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception { +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); +} } }
svn commit: r1361973 - /camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java
Author: davsclaus Date: Mon Jul 16 11:25:37 2012 New Revision: 1361973 URL: http://svn.apache.org/viewvc?rev=1361973&view=rev Log: CAMEL-5445: TimerManagerLoadTask thread name is now using the same name pattern as all the other threads. Have to defer starting it until CamelContext fully started. Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java 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=1361973&r1=1361972&r2=1361973&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 Mon Jul 16 11:25:37 2012 @@ -42,6 +42,7 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.Route; import org.apache.camel.Service; +import org.apache.camel.StartupListener; import org.apache.camel.TimerListener; import org.apache.camel.VetoCamelContextStartException; import org.apache.camel.api.management.PerformanceCounter; @@ -105,6 +106,7 @@ public class DefaultManagementLifecycleS new HashMap, InstrumentationProcessor>>(); private final List preServices = new ArrayList(); private final TimerListenerManager timerListenerManager = new TimerListenerManager(); +private final TimerListenerManagerStartupListener timerManagerStartupListener = new TimerListenerManagerStartupListener(); private volatile CamelContext camelContext; private volatile ManagedCamelContext camelContextMBean; private volatile boolean initialized; @@ -844,14 +846,24 @@ public class DefaultManagementLifecycleS protected void doStart() throws Exception { ObjectHelper.notNull(camelContext, "CamelContext"); -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); +// defer starting the timer manager until CamelContext has been fully started +camelContext.addStartupListener(timerManagerStartupListener); +} + +private final class TimerListenerManagerStartupListener implements StartupListener { + +@Override +public void onCamelContextStarted(CamelContext context, boolean alreadyStarted) throws Exception { +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); +} } }
svn commit: r825951 [2/2] - in /websites/production/camel/content: articles.html book-component-appendix.html book-in-one-page.html cache/main.pageCache jms.html
Modified: websites/production/camel/content/jms.html == --- websites/production/camel/content/jms.html (original) +++ websites/production/camel/content/jms.html Mon Jul 16 07:19:57 2012 @@ -81,6 +81,8 @@ https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"; width="16" height="16" alt="" border="0">Transacted and cachingSee section Transactions and Cache Levels below if you are using transactions with JMS as it can impact performance. +https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"; width="16" height="16" alt="" border="0">Request/Reply over JMSMake sure to read the section Request-reply over JMS further below on this page for important notes about request/reply, as Camel offers a number of options to configure for performance, and clustered environments. + The JMS component allows messages to be sent to (or consumed from) a http://java.sun.com/products/jms/"; rel="nofollow">JMS Queue or Topic. The implementation of the JMS Component uses Spring's JMS support for declarative transactions, using Spring's JmsTemplate for sending and a MessageListenerContainer for consuming. Maven users will need to add the following dependency to their pom.xml for this component: @@ -177,7 +179,7 @@ In Camel 2.8 onwards, the default settin Most commonly used options - Option Default Value Description clientId null Sets the JMS client ID to use. Note that this value, if specified, must be unique and can only be used by a single JMS connection instance. It is typically only required for durable topic subscriptions. You may prefer to use http://activemq.apache.org/virtual-destinations.html";>Virtual Topics instead. concurrentConsumers 1 Specifies the default number of concurrent consumers. disableReplyTo false If true, a producer will behave like a InOnly exchange with the exception that JMSReplyTo header is sent out and not be suppressed like in the case of InOnly. Like InOnly the producer will not wait for a reply. A consumer with this flag will behave like InOnly. This feature can be used to bridge InOut requests to another queue so that a route on the other queue will send it´s response directly back to the original JMSReplyTo. durableSubscriptionName null The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well. maxConcurrentConsumers 1 Specifies the maximum number of concurrent consumers. preserveMessageQos false Set to true, if you want to send message using the QoS settings specified on the message, instead of the QoS settings on the JMS endpoint. The following three headers are considered JMSPriority, JMSDeliveryMode, and JMSExpiration. You can provide all or only some of them. If not provided, Camel will fall back to u se the values from the endpoint instead. So, when using this option, the headers override the values from the endpoint. The explicitQosEnabled option, by contrast, will only use options set on the endpoint, and not values from the message header. replyTo null Provides an explicit ReplyTo destination, which overrides any incoming value of Message.getJMSReplyTo(). If you do Request Reply over JMS then read the section further below for more details. replyToType null Camel 2.9: Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary, Shared, or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured, then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See further below for more details, and especially the notes about the implications if running in a clustered environment. requestTimeout 2 Producer only: The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). The default is 20 seconds. See below in section About time to live for more details. See also the requestTimeoutCheckerInterval option. selector null Sets the JMS Selector, which is an SQL 92 predicate that is used to filter messages within the broker. You may have to encode special characters such as = as %3D Before Camel 2.3.0, we don't support this option in CamelConsumerTemplate timeToLive null When sending messages, specifies the time-to-live of the message (in milliseconds). See below in section About time to live for more details. transacted false Specifies whether to use transacted mode for sending/receiving messages using the InOnly Exchange Pattern. testConnectionOnStartup false Camel 2.1: Specifies whether to test the connection on startup. This ensures that when Camel starts that all the JMS consumers have a valid connection to the JMS broker. If a connection cannot be granted then Camel throws an exception on startup. This en
[CONF] Apache Camel > Articles
Articles Page edited by Claus Ibsen Changes (1) ... * [Using Quartz, Camel and Spring for Distributed Service Orchestration|http://thinkinginsoftware.blogspot.se/2012/05/using-quartz-camel-and-spring-for.html] \- by Nestor Urquiza blogs about using Quartz and Camel to build a distributed solution running a clustered Camel application on multiple Tomcat instances. * [Camel and MongoDB: a match made in heaven|http://blog.raulkr.net/2012/06/camel-and-mongodb-match-made-in-heaven.html] \- Introduction to the Camel MongoDB component launched with the Camel 2.10 release. * [EIP in Action|http://michalwarecki.blogspot.com/2012/07/eip-in-action.html] - A blog post with 4 use-cases that demonstrates how to use EIPs in theory and Camel in practice. h3. Tooling / Combination with other Products ... Full Content See alsoSee also Camel User Stories. We have collected a number of links to external resources about Camel. The lists are ordered so the newest links are added to the bottom of each list. Articles on Apache Camel Introduction If you have never used or seen Camel before, then you should start with Apache Camel Tutorial – Introduction to EIP, Routes, Components, Testing, and other Concepts - an article by Kai Wähner, where he puts EIP and Camel into the big picture and gives a run down of the important Camel concepts. Demo source code can be downloaded at github to get started with your first Camel project easily. Some further simple introductory articles to learn the basics: Simple DSL OSGi bundle example by Andrej Koelewijn Realization of EAI Patterns with Apache Camel by Pascal Kolb at the Universität Stuttgart Navigating the Integration Landscape - Claus Ibsen on Apache Camel Claus Ibsen was interviewed at DZone discussing the integration landscape Enterprise 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 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. First step with Apache Camel by Lukasz Budnik. Great first steps where Lukas does a fairly complex route as his first encounter with Camel. Devoxx talk about Apache Camel - Impressions from the talk by Jos Nieuwenhuis LEGO Java: Apache Camel Context and Route Basics shows how to build integration applications using EIPs LEGO style. Building an application to parse HTML pages from web sites. LEGO® Java (II): Apache Camel Error Handling, Java Beans and Web Services part 2 of the LEGO Camel blog series. This time we covers error handling and using beans with Camel. Using Camel These examples show usage of several different components and other concepts such as error handling. A bit more meat: Camel applied : JMS to File by Mike McLean Matteo wrote a blog entry about using Camel with iBatis Using the Camel aggregator correctly by Torsten Mielke, a great blog entry how to use the Camel aggregator. Spring Remoting with JMS Example on Amin Abbaspour's Weblog Camel routes and HL7 by Roger Searjeant on using Camel and its HL7 support in the health care space. Leverage EIP with Apache Camel and Twitter by Bruno Borges Using RSS with Apache Camel by Jeroen Reijn Axis 2 ride with Camel how to use Axis 2 with Camel by Sagara A Camel based XML payload HTTP polling provider by Christopher Hunt to use Camel with AJAX. Interesting read. First steps with Apache Camel on Google App Engine by Martin Krasser posts his findings to get Camel running on the GAE. Camel, CXF and JMS by Example by Silvester van der Bijl. Good blog entry how to use CXF and Camel together. A simple file monitoring console with camel, cometd and jquery by Andrej Koelewijn. Shows how to use Camel to monitor log files and push lines changed using cometd to a webpage. All in a few files using Groovy. Advanced Event Notification Framework with Apache Camel by Hendy showing how to use Camel for a lightweight even notification system. Camel IRC Message Route Example by James Carr. An IRC bot which can parse _javascript_ and Ruby expressions. A composite REST service using Apache Camel by Andrej Koelewijn. A blog entry how to expose a REST service and have Camel aggregate data from multiple sources to be returned. EDA events over system boundaries with Camel by Sculptur team blog. Dynamic FTP Client using Apache Camel and Spring by Mattias Severson, showing how to develop an FTP client that could transmit files to various FTP servers as a part of a delivery system in a Java enterprise application. Using Apache Camel to route SOAP calls through message queues by Glen Mazza Virtual
svn commit: r1361921 - in /camel/branches/camel-2.9.x: ./ components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
Author: davsclaus Date: Mon Jul 16 07:07:51 2012 New Revision: 1361921 URL: http://svn.apache.org/viewvc?rev=1361921&view=rev Log: CAMEL-5444: Log a WARN if shared reply queues are in use as they are slow, to make this stand out to the Camel end users, so they know about this and can reconfigured for a better solution if that is possible for their use-case. Modified: camel/branches/camel-2.9.x/ (props changed) camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java Propchange: camel/branches/camel-2.9.x/ -- Merged /camel/trunk:r1361919 Merged /camel/branches/camel-2.10.x:r1361920 Propchange: camel/branches/camel-2.9.x/ -- Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java?rev=1361921&r1=1361920&r2=1361921&view=diff == --- camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java (original) +++ camel/branches/camel-2.9.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java Mon Jul 16 07:07:51 2012 @@ -145,6 +145,9 @@ public class PersistentQueueReplyManager answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION); log.debug("Using shared queue: " + endpoint.getReplyTo() + " with dynamic message selector as reply listener: " + answer); } +// shared is not as fast as temporary or exclusive, so log this so the end user may be aware of this +log.warn("{} is using a shared reply queue, which is not as fast as alternatives." ++ " See more detail at the section 'Request-reply over JMS' at http://camel.apache.org/jms";, endpoint); } else if (ReplyToType.Exclusive == type) { answer = new ExclusivePersistentQueueMessageListenerContainer(); // must use cache level consumer for exclusive as there is no message selector
svn commit: r1361920 - in /camel/branches/camel-2.10.x: ./ components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
Author: davsclaus Date: Mon Jul 16 07:06:02 2012 New Revision: 1361920 URL: http://svn.apache.org/viewvc?rev=1361920&view=rev Log: CAMEL-5444: Log a WARN if shared reply queues are in use as they are slow, to make this stand out to the Camel end users, so they know about this and can reconfigured for a better solution if that is possible for their use-case. Modified: camel/branches/camel-2.10.x/ (props changed) camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java Propchange: camel/branches/camel-2.10.x/ -- Merged /camel/trunk:r1361919 Propchange: camel/branches/camel-2.10.x/ -- --- svnmerge-integrated (original) +++ svnmerge-integrated Mon Jul 16 07:06:02 2012 @@ -1 +1 @@ -/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477 +/camel/trunk:1-1358964,1359013,1359197,1359226,1359265,1359341,1359383,1360031,1360241,1360339,1360525-1360527,1360581,1360583,1360719,1361116-1361117,1361477,1361919 Modified: camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java?rev=1361920&r1=1361919&r2=1361920&view=diff == --- camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java (original) +++ camel/branches/camel-2.10.x/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java Mon Jul 16 07:06:02 2012 @@ -145,6 +145,9 @@ public class PersistentQueueReplyManager answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION); log.debug("Using shared queue: " + endpoint.getReplyTo() + " with dynamic message selector as reply listener: " + answer); } +// shared is not as fast as temporary or exclusive, so log this so the end user may be aware of this +log.warn("{} is using a shared reply queue, which is not as fast as alternatives." ++ " See more detail at the section 'Request-reply over JMS' at http://camel.apache.org/jms";, endpoint); } else if (ReplyToType.Exclusive == type) { answer = new ExclusivePersistentQueueMessageListenerContainer(); // must use cache level consumer for exclusive as there is no message selector
svn commit: r1361919 - /camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java
Author: davsclaus Date: Mon Jul 16 07:02:03 2012 New Revision: 1361919 URL: http://svn.apache.org/viewvc?rev=1361919&view=rev Log: CAMEL-5444: Log a WARN if shared reply queues are in use as they are slow, to make this stand out to the Camel end users, so they know about this and can reconfigured for a better solution if that is possible for their use-case. Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java?rev=1361919&r1=1361918&r2=1361919&view=diff == --- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java (original) +++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/reply/PersistentQueueReplyManager.java Mon Jul 16 07:02:03 2012 @@ -145,6 +145,9 @@ public class PersistentQueueReplyManager answer.setCacheLevel(DefaultMessageListenerContainer.CACHE_SESSION); log.debug("Using shared queue: " + endpoint.getReplyTo() + " with dynamic message selector as reply listener: " + answer); } +// shared is not as fast as temporary or exclusive, so log this so the end user may be aware of this +log.warn("{} is using a shared reply queue, which is not as fast as alternatives." ++ " See more detail at the section 'Request-reply over JMS' at http://camel.apache.org/jms";, endpoint); } else if (ReplyToType.Exclusive == type) { answer = new ExclusivePersistentQueueMessageListenerContainer(); // must use cache level consumer for exclusive as there is no message selector