Permalink
Browse files

[maven-release-plugin] copy for tag camel-2.5.0

git-svn-id: https://svn.apache.org/repos/asf/camel/tags/camel-2.5.0@1027218 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
2 parents 5a919af + d542b59 commit ce48fd142285b39dd77842a933f01e4620623efb @hzbarcea hzbarcea committed Oct 25, 2010
Showing with 434 additions and 17,292 deletions.
  1. +15 −0 camel-core/src/main/java/org/apache/camel/CamelContext.java
  2. +1 −1 camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
  3. +51 −2 camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
  4. +7 −0 camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
  5. +4 −2 camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
  6. +17 −1 camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
  7. +4 −0 camel-core/src/main/java/org/apache/camel/impl/DefaultConsumerTemplate.java
  8. 0 {trunk → }/camel-core/src/main/java/org/apache/camel/impl/converter/BaseTypeConverterRegistry.java
  9. +6 −464 camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
  10. 0 {trunk → }/camel-core/src/main/java/org/apache/camel/impl/converter/LazyLoadingTypeConverter.java
  11. +1 −1 camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
  12. +4 −3 camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
  13. +4 −2 camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java
  14. +1 −1 camel-core/src/main/java/org/apache/camel/processor/LoggingErrorHandler.java
  15. +4 −2 camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
  16. +1 −1 camel-core/src/main/java/org/apache/camel/spi/TypeConverterAware.java
  17. +35 −12 camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
  18. +1 −6 camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentTest.java
  19. +0 −1 camel-core/src/test/java/org/apache/camel/converter/JaxpTest.java
  20. 0 ...camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextLazyLoadTypeConvertersTest.java
  21. +1 −1 camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelTest.java
  22. +3 −1 camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
  23. +9 −4 camel-core/src/test/java/org/apache/camel/processor/SamplingThrottlerTest.java
  24. +2 −1 camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
  25. +17 −7 camel-core/src/test/java/org/apache/camel/processor/ShutdownCompleteAllTasksTest.java
  26. 0 ...-core/src/test/java/org/apache/camel/processor/onexception/DefaultErrorHandlerRetryWhileTest.java
  27. +1 −1 camel-core/src/test/resources/log4j.properties
  28. +10 −0 components/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
  29. +2 −0 components/camel-blueprint/src/main/java/org/apache/camel/blueprint/ErrorHandlerDefinition.java
  30. +2 −2 components/camel-blueprint/src/test/resources/test.xml
  31. +7 −1 ...nents/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
  32. +2 −12 components/camel-dozer/pom.xml
  33. +46 −9 components/camel-dozer/src/main/java/org/apache/camel/converter/dozer/DozerTypeConverterLoader.java
  34. +11 −0 components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/DozerTestArtifactsFactory.java
  35. 0 ...ponents/camel-dozer/src/test/java/org/apache/camel/converter/dozer/DozerTypeConverterDTOTest.java
  36. 0 {trunk → }/components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/dto/AddressDTO.java
  37. 0 ...nk → }/components/camel-dozer/src/test/java/org/apache/camel/converter/dozer/dto/CustomerDTO.java
  38. +1 −8 components/camel-exec/pom.xml
  39. +11 −3 components/camel-exec/src/main/java/org/apache/camel/component/exec/impl/DefaultExecBinding.java
  40. +0 −2 components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java
  41. +34 −2 components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecJavaProcessTest.java
  42. +1 −0 ...ts/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
  43. +1 −1 components/camel-gae/pom.xml
  44. +0 −6 components/camel-guice/src/main/java/org/apache/camel/guice/GuiceCamelContext.java
  45. 0 .../components/camel-hawtdb/src/test/java/org/apache/camel/component/hawtdb/HawtDBGrowIssueTest.java
  46. 0 ...camel-jetty/src/test/java/org/apache/camel/component/jetty/TwoCamelContextWithJettyRouteTest.java
  47. +5 −0 .../test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendResumeTest.java
  48. +5 −0 ...ty/src/test/java/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendTest.java
  49. +2 −2 ...a/org/apache/camel/component/jetty/jettyproducer/JettyHttpProducerSuspendWhileInProgressTest.java
  50. +13 −4 components/camel-jms/src/test/java/org/apache/camel/component/jms/bind/JmsMessageBindTest.java
  51. +1 −4 components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyTCPSyncTest.java
  52. +4 −8 .../camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/CronScheduledRoutePolicyTest.java
  53. +5 −9 ...amel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SimpleScheduledRoutePolicyTest.java
  54. +5 −4 ...amel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SpringScheduledRoutePolicyTest.java
  55. +4 −0 components/camel-sip/src/main/java/org/apache/camel/component/sip/SipSubscriber.java
  56. +4 −2 ...ents/camel-sip/src/main/java/org/apache/camel/component/sip/listener/SipSubscriptionListener.java
  57. +4 −0 components/camel-spring/src/main/java/org/apache/camel/osgi/Activator.java
  58. +11 −2 components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
  59. +2 −0 components/camel-spring/src/main/java/org/apache/camel/spring/ErrorHandlerDefinition.java
  60. +1 −2 components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
  61. +0 −1 components/camel-spring/src/main/java/org/apache/camel/spring/SpringRouteBuilder.java
  62. +1 −1 components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
  63. +4 −3 ...ents/camel-spring/src/main/java/org/apache/camel/spring/handler/ErrorHandlerDefinitionParser.java
  64. +0 −1 components/camel-spring/src/main/java/org/apache/camel/spring/spi/ApplicationContextRegistry.java
  65. +4 −3 components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionErrorHandler.java
  66. +1 −1 ...onents/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionErrorHandlerBuilder.java
  67. +1 −1 components/camel-spring/src/main/java/org/apache/camel/spring/util/MainRunner.java
  68. 0 ...ts/camel-spring/src/test/java/org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.java
  69. +1 −2 components/camel-spring/src/test/java/org/apache/camel/spring/DefaultJMXAgentTest.java
  70. +0 −1 ...ts/camel-spring/src/test/java/org/apache/camel/spring/management/DualCamelContextManagedTest.java
  71. 0 ...ring/src/test/java/org/apache/camel/spring/processor/SpringDefaultErrorHandlerRetryWhileTest.java
  72. +1 −1 components/camel-spring/src/test/resources/log4j.properties
  73. 0 ...amel-spring/src/test/resources/org/apache/camel/spring/CamelContextLazyLoadTypeConvertersTest.xml
  74. 0 ...spring/src/test/resources/org/apache/camel/spring/processor/DefaultErrorHandlerRetryWhileTest.xml
  75. +5 −6 ...amel-spring/src/test/resources/org/apache/camel/spring/processor/ShutdownCompleteAllTasksTest.xml
  76. 0 {trunk → }/examples/camel-example-cxf-tomcat/README.txt
  77. 0 {trunk → }/examples/camel-example-cxf-tomcat/pom.xml
  78. 0 ... → }/examples/camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/CamelRoute.java
  79. 0 ...camel-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/incident/IncidentService.java
  80. 0 ...l-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/incident/InputReportIncident.java
  81. 0 ...l-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/incident/InputStatusIncident.java
  82. 0 ...-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/incident/OutputReportIncident.java
  83. 0 ...-example-cxf-tomcat/src/main/java/org/apache/camel/example/cxf/incident/OutputStatusIncident.java
  84. 0 ...en/maven-html-to-pdf → examples/camel-example-cxf-tomcat}/src/main/resources/META-INF/LICENSE.txt
  85. 0 ...en/guice-maven-plugin → examples/camel-example-cxf-tomcat}/src/main/resources/META-INF/NOTICE.txt
  86. 0 {trunk → }/examples/camel-example-cxf-tomcat/src/main/resources/camel-config.xml
  87. 0 {trunk → }/examples/camel-example-cxf-tomcat/src/main/resources/log4j.properties
  88. 0 {trunk → }/examples/camel-example-cxf-tomcat/src/main/webapp/WEB-INF/web.xml
  89. +1 −0 examples/pom.xml
  90. +10 −3 parent/pom.xml
  91. +7 −7 platforms/karaf/features/pom.xml
  92. +7 −0 platforms/karaf/features/src/main/resources/features-spring2.xml
  93. +7 −0 platforms/karaf/features/src/main/resources/features.xml
  94. +1 −1 pom.xml
  95. 0 {trunk → }/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelExecTest.java
  96. 0 {trunk → }/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/exec/ExecTest.java
  97. +0 −6 trunk/.gitignore
  98. +0 −128 trunk/KEYS
  99. +0 −203 trunk/LICENSE.txt
  100. +0 −11 trunk/NOTICE.txt
  101. +0 −95 trunk/README.txt
  102. +0 −631 trunk/apache-camel/pom.xml
  103. +0 −180 trunk/apache-camel/src/main/descriptors/common-bin.xml
  104. +0 −77 trunk/apache-camel/src/main/descriptors/unix-bin.xml
  105. +0 −97 trunk/apache-camel/src/main/descriptors/unix-src.xml
  106. +0 −77 trunk/apache-camel/src/main/descriptors/windows-bin.xml
  107. +0 −98 trunk/apache-camel/src/main/descriptors/windows-src.xml
  108. +0 −202 trunk/apache-camel/src/main/release/LICENSE.txt
  109. +0 −36 trunk/apache-camel/src/main/release/NOTICE.txt
  110. +0 −102 trunk/apache-camel/src/main/release/README.txt
  111. +0 −203 trunk/apache-camel/src/main/resources/META-INF/LICENSE.txt
  112. +0 −12 trunk/apache-camel/src/main/resources/META-INF/NOTICE.txt
  113. +0 −202 trunk/buildingtools/META-INF/LICENSE
  114. +0 −70 trunk/buildingtools/META-INF/NOTICE
  115. +0 −36 trunk/buildingtools/camel-checkstyle-suppressions.xml
  116. +0 −308 trunk/buildingtools/camel-checkstyle.xml
  117. +0 −27 trunk/buildingtools/camel-eclipse-checkstyle
  118. +0 −23 trunk/buildingtools/camel-eclipse-pmd
  119. +0 −206 trunk/buildingtools/camel-pmd-ruleset.xml
  120. +0 −40 trunk/buildingtools/pom.xml
  121. +0 −202 trunk/buildingtools/src/main/resources/META-INF/LICENSE
  122. +0 −70 trunk/buildingtools/src/main/resources/META-INF/NOTICE
  123. +0 −36 trunk/buildingtools/src/main/resources/camel-checkstyle-suppressions.xml
  124. +0 −308 trunk/buildingtools/src/main/resources/camel-checkstyle.xml
  125. +0 −27 trunk/buildingtools/src/main/resources/camel-eclipse-checkstyle
  126. +0 −23 trunk/buildingtools/src/main/resources/camel-eclipse-pmd
  127. +0 −206 trunk/buildingtools/src/main/resources/camel-pmd-ruleset.xml
  128. +0 −197 trunk/buildingtools/src/main/resources/notice-supplements.xml
  129. +0 −339 trunk/camel-core/pom.xml
  130. +0 −18 trunk/camel-core/src/main/data/bar.xml
  131. +0 −18 trunk/camel-core/src/main/data/foo.xml
  132. +0 −30 trunk/camel-core/src/main/java/org/apache/camel/AlreadyStoppedException.java
  133. +0 −43 trunk/camel-core/src/main/java/org/apache/camel/AsyncCallback.java
  134. +0 −50 trunk/camel-core/src/main/java/org/apache/camel/AsyncProcessor.java
  135. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/AsyncProducerCallback.java
  136. +0 −34 trunk/camel-core/src/main/java/org/apache/camel/Attachments.java
  137. +0 −63 trunk/camel-core/src/main/java/org/apache/camel/BatchConsumer.java
  138. +0 −72 trunk/camel-core/src/main/java/org/apache/camel/BinaryPredicate.java
  139. +0 −34 trunk/camel-core/src/main/java/org/apache/camel/Body.java
  140. +0 −37 trunk/camel-core/src/main/java/org/apache/camel/CamelAuthorizationException.java
  141. +0 −928 trunk/camel-core/src/main/java/org/apache/camel/CamelContext.java
  142. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/CamelContextAware.java
  143. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/CamelException.java
  144. +0 −48 trunk/camel-core/src/main/java/org/apache/camel/CamelExchangeException.java
  145. +0 −37 trunk/camel-core/src/main/java/org/apache/camel/CamelExecutionException.java
  146. +0 −129 trunk/camel-core/src/main/java/org/apache/camel/Channel.java
  147. +0 −38 trunk/camel-core/src/main/java/org/apache/camel/Component.java
  148. +0 −43 trunk/camel-core/src/main/java/org/apache/camel/Consume.java
  149. +0 −32 trunk/camel-core/src/main/java/org/apache/camel/Consumer.java
  150. +0 −238 trunk/camel-core/src/main/java/org/apache/camel/ConsumerTemplate.java
  151. +0 −37 trunk/camel-core/src/main/java/org/apache/camel/Converter.java
  152. +0 −50 trunk/camel-core/src/main/java/org/apache/camel/DynamicRouter.java
  153. +0 −154 trunk/camel-core/src/main/java/org/apache/camel/Endpoint.java
  154. +0 −44 trunk/camel-core/src/main/java/org/apache/camel/EndpointInject.java
  155. +0 −469 trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
  156. +0 −32 trunk/camel-core/src/main/java/org/apache/camel/ExchangeException.java
  157. +0 −126 trunk/camel-core/src/main/java/org/apache/camel/ExchangePattern.java
  158. +0 −40 trunk/camel-core/src/main/java/org/apache/camel/ExchangeTimedOutException.java
  159. +0 −56 trunk/camel-core/src/main/java/org/apache/camel/ExecutorServiceAware.java
  160. +0 −43 trunk/camel-core/src/main/java/org/apache/camel/ExpectedBodyTypeException.java
  161. +0 −39 trunk/camel-core/src/main/java/org/apache/camel/Expression.java
  162. +0 −44 trunk/camel-core/src/main/java/org/apache/camel/ExpressionEvaluationException.java
  163. +0 −42 trunk/camel-core/src/main/java/org/apache/camel/ExpressionIllegalSyntaxException.java
  164. +0 −42 trunk/camel-core/src/main/java/org/apache/camel/FailedToCreateConsumerException.java
  165. +0 −37 trunk/camel-core/src/main/java/org/apache/camel/FailedToCreateProducerException.java
  166. +0 −51 trunk/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
  167. +0 −36 trunk/camel-core/src/main/java/org/apache/camel/FailedToStartRouteException.java
  168. +0 −50 trunk/camel-core/src/main/java/org/apache/camel/FallbackConverter.java
  169. +0 −35 trunk/camel-core/src/main/java/org/apache/camel/Handler.java
  170. +0 −36 trunk/camel-core/src/main/java/org/apache/camel/Header.java
  171. +0 −35 trunk/camel-core/src/main/java/org/apache/camel/Headers.java
  172. +0 −50 trunk/camel-core/src/main/java/org/apache/camel/InOnly.java
  173. +0 −49 trunk/camel-core/src/main/java/org/apache/camel/InOut.java
  174. +0 −51 trunk/camel-core/src/main/java/org/apache/camel/InvalidPayloadException.java
  175. +0 −55 trunk/camel-core/src/main/java/org/apache/camel/InvalidPayloadRuntimeException.java
  176. +0 −35 trunk/camel-core/src/main/java/org/apache/camel/IsSingleton.java
  177. +0 −29 trunk/camel-core/src/main/java/org/apache/camel/LoggingLevel.java
  178. +0 −31 trunk/camel-core/src/main/java/org/apache/camel/ManagementStatisticsLevel.java
  179. +0 −286 trunk/camel-core/src/main/java/org/apache/camel/Message.java
  180. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/MultipleConsumersSupport.java
  181. +0 −43 trunk/camel-core/src/main/java/org/apache/camel/Navigate.java
  182. +0 −44 trunk/camel-core/src/main/java/org/apache/camel/NoFactoryAvailableException.java
  183. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java
  184. +0 −45 trunk/camel-core/src/main/java/org/apache/camel/NoSuchEndpointException.java
  185. +0 −58 trunk/camel-core/src/main/java/org/apache/camel/NoSuchHeaderException.java
  186. +0 −39 trunk/camel-core/src/main/java/org/apache/camel/NoSuchLanguageException.java
  187. +0 −58 trunk/camel-core/src/main/java/org/apache/camel/NoSuchPropertyException.java
  188. +0 −74 trunk/camel-core/src/main/java/org/apache/camel/NoTypeConversionAvailableException.java
  189. +0 −35 trunk/camel-core/src/main/java/org/apache/camel/OutHeaders.java
  190. +0 −58 trunk/camel-core/src/main/java/org/apache/camel/Pattern.java
  191. +0 −58 trunk/camel-core/src/main/java/org/apache/camel/PollingConsumer.java
  192. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/Predicate.java
  193. +0 −36 trunk/camel-core/src/main/java/org/apache/camel/Processor.java
  194. +0 −45 trunk/camel-core/src/main/java/org/apache/camel/Produce.java
  195. +0 −57 trunk/camel-core/src/main/java/org/apache/camel/Producer.java
  196. +0 −39 trunk/camel-core/src/main/java/org/apache/camel/ProducerCallback.java
  197. +0 −1,127 trunk/camel-core/src/main/java/org/apache/camel/ProducerTemplate.java
  198. +0 −35 trunk/camel-core/src/main/java/org/apache/camel/Properties.java
  199. +0 −36 trunk/camel-core/src/main/java/org/apache/camel/Property.java
  200. +0 −55 trunk/camel-core/src/main/java/org/apache/camel/RecipientList.java
  201. +0 −47 trunk/camel-core/src/main/java/org/apache/camel/ResolveEndpointFailedException.java
  202. +0 −42 trunk/camel-core/src/main/java/org/apache/camel/RollbackExchangeException.java
  203. +0 −98 trunk/camel-core/src/main/java/org/apache/camel/Route.java
  204. +0 −59 trunk/camel-core/src/main/java/org/apache/camel/RouteNode.java
  205. +0 −35 trunk/camel-core/src/main/java/org/apache/camel/RoutesBuilder.java
  206. +0 −50 trunk/camel-core/src/main/java/org/apache/camel/RoutingSlip.java
  207. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/RuntimeCamelException.java
  208. +0 −142 trunk/camel-core/src/main/java/org/apache/camel/RuntimeConfiguration.java
  209. +0 −55 trunk/camel-core/src/main/java/org/apache/camel/RuntimeExchangeException.java
  210. +0 −39 trunk/camel-core/src/main/java/org/apache/camel/RuntimeExpressionException.java
  211. +0 −39 trunk/camel-core/src/main/java/org/apache/camel/RuntimeTransformException.java
  212. +0 −39 trunk/camel-core/src/main/java/org/apache/camel/Service.java
  213. +0 −25 trunk/camel-core/src/main/java/org/apache/camel/ServicePoolAware.java
  214. +0 −53 trunk/camel-core/src/main/java/org/apache/camel/ServiceStatus.java
  215. +0 −42 trunk/camel-core/src/main/java/org/apache/camel/ShutdownRoute.java
  216. +0 −44 trunk/camel-core/src/main/java/org/apache/camel/ShutdownRunningTask.java
  217. +0 −38 trunk/camel-core/src/main/java/org/apache/camel/ShutdownableService.java
  218. +0 −44 trunk/camel-core/src/main/java/org/apache/camel/StartupListener.java
  219. +0 −46 trunk/camel-core/src/main/java/org/apache/camel/StreamCache.java
  220. +0 −52 trunk/camel-core/src/main/java/org/apache/camel/SuspendableService.java
  221. +0 −54 trunk/camel-core/src/main/java/org/apache/camel/ThreadPoolRejectedPolicy.java
  222. +0 −76 trunk/camel-core/src/main/java/org/apache/camel/TypeConverter.java
  223. +0 −37 trunk/camel-core/src/main/java/org/apache/camel/ValidationException.java
  224. +0 −41 trunk/camel-core/src/main/java/org/apache/camel/VetoCamelContextStartException.java
  225. +0 −36 trunk/camel-core/src/main/java/org/apache/camel/WaitForTaskToComplete.java
  226. +0 −84 trunk/camel-core/src/main/java/org/apache/camel/builder/BinaryPredicateSupport.java
  227. +0 −219 trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java
  228. +0 −399 trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
  229. +0 −364 trunk/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
  230. +0 −108 trunk/camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
  231. +0 −478 trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
  232. +0 −87 trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilder.java
  233. +0 −170 trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderRef.java
  234. +0 −77 trunk/camel-core/src/main/java/org/apache/camel/builder/ErrorHandlerBuilderSupport.java
  235. +0 −1,460 trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
  236. +0 −561 trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClause.java
  237. +0 −614 trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java
  238. +0 −86 trunk/camel-core/src/main/java/org/apache/camel/builder/LoggingErrorHandlerBuilder.java
  239. +0 −40 trunk/camel-core/src/main/java/org/apache/camel/builder/NoErrorHandlerBuilder.java
Sorry, we could not display the entire diff because too many files (8,982) changed.
View
15 camel-core/src/main/java/org/apache/camel/CamelContext.java
@@ -910,4 +910,19 @@
* @param uuidGenerator the UUID Generator
*/
void setUuidGenerator(UuidGenerator uuidGenerator);
+
+ /**
+ * Whether or not type converters should be loaded lazy
+ *
+ * @return <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
+ */
+ Boolean isLazyLoadTypeConverters();
+
+ /**
+ * Sets whether type converters should be loaded lazy
+ *
+ * @param lazyLoadTypeConverters <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
+ */
+ void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters);
+
}
View
2 camel-core/src/main/java/org/apache/camel/builder/DeadLetterChannelBuilder.java
@@ -56,7 +56,7 @@ public Processor createErrorHandler(RouteContext routeContext, Processor process
DeadLetterChannel answer = new DeadLetterChannel(routeContext.getCamelContext(), processor, getLogger(),
getOnRedelivery(), getRedeliveryPolicy(), getHandledPolicy(), getExceptionPolicyStrategy(),
- getFailureProcessor(), getDeadLetterUri(), isUseOriginalMessage());
+ getFailureProcessor(), getDeadLetterUri(), isUseOriginalMessage(), getRetryWhilePolicy(routeContext.getCamelContext()));
// configure error handler before we can use it
configure(answer);
return answer;
View
53 camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
@@ -16,17 +16,21 @@
*/
package org.apache.camel.builder;
+import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Expression;
import org.apache.camel.LoggingLevel;
import org.apache.camel.Predicate;
import org.apache.camel.Processor;
+import org.apache.camel.language.bean.BeanExpression;
import org.apache.camel.processor.DefaultErrorHandler;
import org.apache.camel.processor.ErrorHandlerSupport;
import org.apache.camel.processor.Logger;
import org.apache.camel.processor.RedeliveryPolicy;
import org.apache.camel.processor.exceptionpolicy.ExceptionPolicyStrategy;
+import org.apache.camel.spi.Language;
import org.apache.camel.spi.RouteContext;
+import org.apache.camel.util.CamelContextHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import static org.apache.camel.builder.PredicateBuilder.toPredicate;
@@ -43,6 +47,8 @@
protected RedeliveryPolicy redeliveryPolicy;
protected Processor onRedelivery;
protected Predicate handledPolicy;
+ protected Predicate retryWhile;
+ protected String retryWhileRef;
protected Processor failureProcessor;
protected Endpoint deadLetter;
protected String deadLetterUri;
@@ -54,7 +60,8 @@ public DefaultErrorHandlerBuilder() {
public Processor createErrorHandler(RouteContext routeContext, Processor processor) throws Exception {
DefaultErrorHandler answer = new DefaultErrorHandler(routeContext.getCamelContext(), processor, getLogger(),
- getOnRedelivery(), getRedeliveryPolicy(), getHandledPolicy(), getExceptionPolicyStrategy());
+ getOnRedelivery(), getRedeliveryPolicy(), getHandledPolicy(), getExceptionPolicyStrategy(),
+ getRetryWhilePolicy(routeContext.getCamelContext()));
// configure error handler before we can use it
configure(answer);
return answer;
@@ -259,10 +266,11 @@ public DefaultErrorHandlerBuilder exceptionPolicyStrategy(ExceptionPolicyStrateg
}
/**
- * Sets a processor that should be processed <b>before</b> a redelivey attempt.
+ * Sets a processor that should be processed <b>before</b> a redelivery attempt.
* <p/>
* Can be used to change the {@link org.apache.camel.Exchange} <b>before</b> its being redelivered.
*
+ * @param processor the processor
* @return the builder
*/
public DefaultErrorHandlerBuilder onRedelivery(Processor processor) {
@@ -271,6 +279,19 @@ public DefaultErrorHandlerBuilder onRedelivery(Processor processor) {
}
/**
+ * Sets the retry while expression.
+ * <p/>
+ * Will continue retrying until expression evaluates to <tt>false</tt>.
+ *
+ * @param retryWhile expression that determines when to stop retrying
+ * @return the builder
+ */
+ public DefaultErrorHandlerBuilder retryWhile(Expression retryWhile) {
+ setRetryWhile(toPredicate(retryWhile));
+ return this;
+ }
+
+ /**
* Will use the original input {@link org.apache.camel.Message} when an {@link org.apache.camel.Exchange}
* is moved to the dead letter queue.
* <p/>
@@ -350,6 +371,34 @@ public void setOnRedelivery(Processor onRedelivery) {
this.onRedelivery = onRedelivery;
}
+ public Predicate getRetryWhilePolicy(CamelContext context) {
+ Predicate answer = getRetryWhile();
+
+ if (getRetryWhileRef() != null) {
+ // its a bean expression
+ Language bean = context.resolveLanguage("bean");
+ answer = bean.createPredicate(getRetryWhileRef());
+ }
+
+ return answer;
+ }
+
+ public Predicate getRetryWhile() {
+ return retryWhile;
+ }
+
+ public void setRetryWhile(Predicate retryWhile) {
+ this.retryWhile = retryWhile;
+ }
+
+ public String getRetryWhileRef() {
+ return retryWhileRef;
+ }
+
+ public void setRetryWhileRef(String retryWhileRef) {
+ this.retryWhileRef = retryWhileRef;
+ }
+
@Deprecated
public Predicate getHandledPolicy() {
if (handledPolicy == null) {
View
7 camel-core/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -42,6 +42,13 @@
private PropertiesParser propertiesParser = new DefaultPropertiesParser();
private String[] locations;
private boolean cache = true;
+
+ public PropertiesComponent() {
+ }
+
+ public PropertiesComponent(String... locations) {
+ this.locations = locations;
+ }
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
View
6 camel-core/src/main/java/org/apache/camel/component/timer/TimerConsumer.java
@@ -34,7 +34,7 @@
public class TimerConsumer extends DefaultConsumer {
private static final transient Log LOG = LogFactory.getLog(TimerConsumer.class);
private final TimerEndpoint endpoint;
- private TimerTask task;
+ private volatile TimerTask task;
public TimerConsumer(TimerEndpoint endpoint, Processor processor) {
super(endpoint, processor);
@@ -56,7 +56,9 @@ public void run() {
@Override
protected void doStop() throws Exception {
- task.cancel();
+ if (task != null) {
+ task.cancel();
+ }
task = null;
}
View
18 camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -61,7 +61,9 @@
import org.apache.camel.VetoCamelContextStartException;
import org.apache.camel.builder.ErrorHandlerBuilder;
import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.impl.converter.BaseTypeConverterRegistry;
import org.apache.camel.impl.converter.DefaultTypeConverter;
+import org.apache.camel.impl.converter.LazyLoadingTypeConverter;
import org.apache.camel.management.DefaultManagementAgent;
import org.apache.camel.management.DefaultManagementLifecycleStrategy;
import org.apache.camel.management.DefaultManagementStrategy;
@@ -153,6 +155,7 @@
private Boolean streamCache = Boolean.FALSE;
private Boolean handleFault = Boolean.FALSE;
private Boolean disableJMX = Boolean.FALSE;
+ private Boolean lazyLoadTypeConverters = Boolean.FALSE;
private Long delay;
private ErrorHandlerBuilder errorHandlerBuilder;
private Map<String, DataFormatDefinition> dataFormats = new HashMap<String, DataFormatDefinition>();
@@ -1814,7 +1817,12 @@ protected void forceStopLazyInitialization() {
* Lazily create a default implementation
*/
protected TypeConverter createTypeConverter() {
- DefaultTypeConverter answer = new DefaultTypeConverter(packageScanClassResolver, getInjector(), getDefaultFactoryFinder());
+ BaseTypeConverterRegistry answer;
+ if (isLazyLoadTypeConverters()) {
+ answer = new LazyLoadingTypeConverter(packageScanClassResolver, getInjector(), getDefaultFactoryFinder());
+ } else {
+ answer = new DefaultTypeConverter(packageScanClassResolver, getInjector(), getDefaultFactoryFinder());
+ }
setTypeConverterRegistry(answer);
return answer;
}
@@ -2018,6 +2026,14 @@ public void setAutoStartup(Boolean autoStartup) {
public Boolean isAutoStartup() {
return autoStartup != null && autoStartup;
}
+
+ public Boolean isLazyLoadTypeConverters() {
+ return lazyLoadTypeConverters != null && lazyLoadTypeConverters;
+ }
+
+ public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
+ this.lazyLoadTypeConverters = lazyLoadTypeConverters;
+ }
public ClassLoader getApplicationContextClassLoader() {
return applicationContextClassLoader;
View
4 camel-core/src/main/java/org/apache/camel/impl/DefaultConsumerTemplate.java
@@ -226,6 +226,10 @@ protected Object extractResultBody(Exchange result) {
private static void doneUoW(Exchange exchange) {
try {
+ // The receiveBody method will get a null exchange
+ if (exchange == null) {
+ return;
+ }
if (exchange.getUnitOfWork() == null) {
// handover completions and done them manually to ensure they are being executed
List<Synchronization> synchronizations = exchange.handoverCompletions();
View
0 .../converter/BaseTypeConverterRegistry.java → .../converter/BaseTypeConverterRegistry.java
File renamed without changes.
View
470 camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
@@ -16,487 +16,29 @@
*/
package org.apache.camel.impl.converter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutionException;
-
-import org.apache.camel.CamelExecutionException;
-import org.apache.camel.Exchange;
-import org.apache.camel.NoFactoryAvailableException;
-import org.apache.camel.NoTypeConversionAvailableException;
-import org.apache.camel.TypeConverter;
-import org.apache.camel.impl.ServiceSupport;
import org.apache.camel.spi.FactoryFinder;
import org.apache.camel.spi.Injector;
import org.apache.camel.spi.PackageScanClassResolver;
-import org.apache.camel.spi.TypeConverterAware;
-import org.apache.camel.spi.TypeConverterRegistry;
-import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ServiceHelper;
-import org.apache.camel.util.StopWatch;
-import org.apache.camel.util.TimeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* Default implementation of a type converter registry used for
* <a href="http://camel.apache.org/type-converter.html">type converters</a> in Camel.
+ * <p/>
+ * This implementation will load type converters up-front on startup.
*
* @version $Revision$
*/
-public class DefaultTypeConverter extends ServiceSupport implements TypeConverter, TypeConverterRegistry {
- private static final transient Log LOG = LogFactory.getLog(DefaultTypeConverter.class);
- private final Map<TypeMapping, TypeConverter> typeMappings = new ConcurrentHashMap<TypeMapping, TypeConverter>();
- private final Map<TypeMapping, TypeMapping> misses = new ConcurrentHashMap<TypeMapping, TypeMapping>();
- private final List<TypeConverterLoader> typeConverterLoaders = new ArrayList<TypeConverterLoader>();
- private final List<FallbackTypeConverter> fallbackConverters = new ArrayList<FallbackTypeConverter>();
- private Injector injector;
- private final FactoryFinder factoryFinder;
- private final PropertyEditorTypeConverter propertyEditorTypeConverter = new PropertyEditorTypeConverter();
+public class DefaultTypeConverter extends BaseTypeConverterRegistry {
public DefaultTypeConverter(PackageScanClassResolver resolver, Injector injector, FactoryFinder factoryFinder) {
- this.injector = injector;
- this.factoryFinder = factoryFinder;
- this.typeConverterLoaders.add(new AnnotationTypeConverterLoader(resolver));
-
- // add to string first as it will then be last in the last as to string can nearly
- // always convert something to a string so we want it only as the last resort
- // ToStringTypeConverter should NOT allow to be promoted
- addFallbackTypeConverter(new ToStringTypeConverter(), false);
- // do not assume property editor as it has a String converter
- addFallbackTypeConverter(propertyEditorTypeConverter, false);
- // enum is okay to be promoted
- addFallbackTypeConverter(new EnumTypeConverter(), true);
- // arrays is okay to be promoted
- addFallbackTypeConverter(new ArrayTypeConverter(), true);
- // and future should also not allowed to be promoted
- addFallbackTypeConverter(new FutureTypeConverter(this), false);
- // add sync processor to async processor converter is to be promoted
- addFallbackTypeConverter(new AsyncProcessorTypeConverter(), true);
- }
-
- public List<TypeConverterLoader> getTypeConverterLoaders() {
- return typeConverterLoaders;
- }
-
- public <T> T convertTo(Class<T> type, Object value) {
- return convertTo(type, null, value);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T convertTo(Class<T> type, Exchange exchange, Object value) {
- if (!isRunAllowed()) {
- throw new IllegalStateException(this + " is not started");
- }
-
- Object answer;
- try {
- answer = doConvertTo(type, exchange, value);
- } catch (Exception e) {
- // if its a ExecutionException then we have rethrow it as its not due to failed conversion
- boolean execution = ObjectHelper.getException(ExecutionException.class, e) != null
- || ObjectHelper.getException(CamelExecutionException.class, e) != null;
- if (execution) {
- throw ObjectHelper.wrapCamelExecutionException(exchange, e);
- }
-
- // we cannot convert so return null
- if (LOG.isDebugEnabled()) {
- LOG.debug(NoTypeConversionAvailableException.createMessage(value, type)
- + " Caused by: " + e.getMessage() + ". Will ignore this and continue.");
- }
- return null;
- }
- if (answer == Void.TYPE) {
- // Could not find suitable conversion
- return null;
- } else {
- return (T) answer;
- }
- }
-
- public <T> T mandatoryConvertTo(Class<T> type, Object value) throws NoTypeConversionAvailableException {
- return mandatoryConvertTo(type, null, value);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T mandatoryConvertTo(Class<T> type, Exchange exchange, Object value) throws NoTypeConversionAvailableException {
- if (!isRunAllowed()) {
- throw new IllegalStateException(this + " is not started");
- }
-
- Object answer;
- try {
- answer = doConvertTo(type, exchange, value);
- } catch (Exception e) {
- throw new NoTypeConversionAvailableException(value, type, e);
- }
- if (answer == Void.TYPE || value == null) {
- // Could not find suitable conversion
- throw new NoTypeConversionAvailableException(value, type);
- } else {
- return (T) answer;
- }
- }
-
- @SuppressWarnings("unchecked")
- public Object doConvertTo(final Class type, final Exchange exchange, final Object value) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Converting " + (value == null ? "null" : value.getClass().getCanonicalName())
- + " -> " + type.getCanonicalName() + " with value: " + value);
- }
-
- if (value == null) {
- // lets avoid NullPointerException when converting to boolean for null values
- if (boolean.class.isAssignableFrom(type)) {
- return Boolean.FALSE;
- }
- return null;
- }
-
- // same instance type
- if (type.isInstance(value)) {
- return type.cast(value);
- }
-
- // check if we have tried it before and if its a miss
- TypeMapping key = new TypeMapping(type, value.getClass());
- if (misses.containsKey(key)) {
- // we have tried before but we cannot convert this one
- return Void.TYPE;
- }
-
- // try to find a suitable type converter
- TypeConverter converter = getOrFindTypeConverter(type, value);
- if (converter != null) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Using converter: " + converter + " to convert " + key);
- }
- Object rc = converter.convertTo(type, exchange, value);
- if (rc != null) {
- return rc;
- }
- }
-
- // fallback converters
- for (FallbackTypeConverter fallback : fallbackConverters) {
- Object rc = fallback.getFallbackTypeConverter().convertTo(type, exchange, value);
-
- if (Void.TYPE.equals(rc)) {
- // it cannot be converted so give up
- return Void.TYPE;
- }
-
- if (rc != null) {
- // if fallback can promote then let it be promoted to a first class type converter
- if (fallback.isCanPromote()) {
- // add it as a known type converter since we found a fallback that could do it
- if (LOG.isDebugEnabled()) {
- LOG.debug("Promoting fallback type converter as a known type converter to convert from: "
- + type.getCanonicalName() + " to: " + value.getClass().getCanonicalName()
- + " for the fallback converter: " + fallback.getFallbackTypeConverter());
- }
- addTypeConverter(type, value.getClass(), fallback.getFallbackTypeConverter());
- }
-
- if (LOG.isTraceEnabled()) {
- LOG.trace("Fallback type converter " + fallback.getFallbackTypeConverter() + " converted type from: "
- + type.getCanonicalName() + " to: " + value.getClass().getCanonicalName());
- }
-
- // return converted value
- return rc;
- }
- }
-
- // not found with that type then if it was a primitive type then try again with the wrapper type
- if (type.isPrimitive()) {
- Class primitiveType = ObjectHelper.convertPrimitiveTypeToWrapperType(type);
- if (primitiveType != type) {
- return convertTo(primitiveType, exchange, value);
- }
- }
-
- // Could not find suitable conversion, so remember it
- synchronized (misses) {
- misses.put(key, key);
- }
-
- // Could not find suitable conversion, so return Void to indicate not found
- return Void.TYPE;
- }
-
- public void addTypeConverter(Class<?> toType, Class<?> fromType, TypeConverter typeConverter) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Adding type converter: " + typeConverter);
- }
- TypeMapping key = new TypeMapping(toType, fromType);
- synchronized (typeMappings) {
- TypeConverter converter = typeMappings.get(key);
- // only override it if its different
- // as race conditions can lead to many threads trying to promote the same fallback converter
- if (typeConverter != converter) {
- if (converter != null) {
- LOG.warn("Overriding type converter from: " + converter + " to: " + typeConverter);
- }
- typeMappings.put(key, typeConverter);
- }
- }
- }
-
- public void addFallbackTypeConverter(TypeConverter typeConverter, boolean canPromote) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Adding fallback type converter: " + typeConverter + " which can promote: " + canPromote);
- }
-
- // add in top of fallback as the toString() fallback will nearly always be able to convert
- fallbackConverters.add(0, new FallbackTypeConverter(typeConverter, canPromote));
- if (typeConverter instanceof TypeConverterAware) {
- TypeConverterAware typeConverterAware = (TypeConverterAware) typeConverter;
- typeConverterAware.setTypeConverter(this);
- }
- }
-
- public TypeConverter getTypeConverter(Class<?> toType, Class<?> fromType) {
- TypeMapping key = new TypeMapping(toType, fromType);
- return typeMappings.get(key);
- }
-
- public Injector getInjector() {
- return injector;
- }
-
- public void setInjector(Injector injector) {
- this.injector = injector;
- }
-
- public Set<Class<?>> getFromClassMappings() {
- Set<Class<?>> answer = new HashSet<Class<?>>();
- synchronized (typeMappings) {
- for (TypeMapping mapping : typeMappings.keySet()) {
- answer.add(mapping.getFromType());
- }
- }
- return answer;
- }
-
- public Map<Class<?>, TypeConverter> getToClassMappings(Class<?> fromClass) {
- Map<Class<?>, TypeConverter> answer = new HashMap<Class<?>, TypeConverter>();
- synchronized (typeMappings) {
- for (Map.Entry<TypeMapping, TypeConverter> entry : typeMappings.entrySet()) {
- TypeMapping mapping = entry.getKey();
- if (mapping.isApplicable(fromClass)) {
- answer.put(mapping.getToType(), entry.getValue());
- }
- }
- }
- return answer;
- }
-
- public Map<TypeMapping, TypeConverter> getTypeMappings() {
- return typeMappings;
- }
-
- protected <T> TypeConverter getOrFindTypeConverter(Class<?> toType, Object value) {
- Class<?> fromType = null;
- if (value != null) {
- fromType = value.getClass();
- }
- TypeMapping key = new TypeMapping(toType, fromType);
- TypeConverter converter;
- synchronized (typeMappings) {
- converter = typeMappings.get(key);
- if (converter == null) {
- converter = lookup(toType, fromType);
- if (converter != null) {
- typeMappings.put(key, converter);
- }
- }
- }
- return converter;
- }
-
- public TypeConverter lookup(Class<?> toType, Class<?> fromType) {
- return doLookup(toType, fromType, false);
- }
-
- private TypeConverter doLookup(Class<?> toType, Class<?> fromType, boolean isSuper) {
-
- if (fromType != null) {
- // lets try if there is a direct match
- TypeConverter converter = getTypeConverter(toType, fromType);
- if (converter != null) {
- return converter;
- }
-
- // try the interfaces
- for (Class<?> type : fromType.getInterfaces()) {
- converter = getTypeConverter(toType, type);
- if (converter != null) {
- return converter;
- }
- }
-
- // try super then
- Class<?> fromSuperClass = fromType.getSuperclass();
- if (fromSuperClass != null && !fromSuperClass.equals(Object.class)) {
- converter = doLookup(toType, fromSuperClass, true);
- if (converter != null) {
- return converter;
- }
- }
- }
-
- // only do these tests as fallback and only on the target type (eg not on its super)
- if (!isSuper) {
- if (fromType != null && !fromType.equals(Object.class)) {
-
- // lets try classes derived from this toType
- Set<Map.Entry<TypeMapping, TypeConverter>> entries = typeMappings.entrySet();
- for (Map.Entry<TypeMapping, TypeConverter> entry : entries) {
- TypeMapping key = entry.getKey();
- Class<?> aToType = key.getToType();
- if (toType.isAssignableFrom(aToType)) {
- Class<?> aFromType = key.getFromType();
- // skip Object based we do them last
- if (!aFromType.equals(Object.class) && aFromType.isAssignableFrom(fromType)) {
- return entry.getValue();
- }
- }
- }
-
- // lets test for Object based converters as last resort
- TypeConverter converter = getTypeConverter(toType, Object.class);
- if (converter != null) {
- return converter;
- }
- }
- }
-
- // none found
- return null;
- }
-
- /**
- * Checks if the registry is loaded and if not lazily load it
- */
- protected void loadTypeConverters() throws Exception {
- StopWatch watch = new StopWatch();
-
- LOG.debug("Loading type converters ...");
- for (TypeConverterLoader typeConverterLoader : getTypeConverterLoaders()) {
- typeConverterLoader.load(this);
- }
-
- // lets try load any other fallback converters
- try {
- loadFallbackTypeConverters();
- } catch (NoFactoryAvailableException e) {
- // ignore its fine to have none
- }
- LOG.debug("Loading type converters done");
-
- // report how long time it took to load
- if (LOG.isInfoEnabled()) {
- LOG.info("Loaded " + typeMappings.size() + " type converters in " + TimeUtils.printDuration(watch.stop()));
- }
- }
-
- protected void loadFallbackTypeConverters() throws IOException, ClassNotFoundException {
- List<TypeConverter> converters = factoryFinder.newInstances("FallbackTypeConverter", getInjector(), TypeConverter.class);
- for (TypeConverter converter : converters) {
- addFallbackTypeConverter(converter, false);
- }
+ super(resolver, injector, factoryFinder);
}
@Override
protected void doStart() throws Exception {
- ServiceHelper.startService(propertyEditorTypeConverter);
+ super.doStart();
+ // load type converters up front
loadTypeConverters();
}
- @Override
- protected void doStop() throws Exception {
- typeMappings.clear();
- misses.clear();
- // let property editor type converter stop and cleanup resources
- ServiceHelper.stopService(propertyEditorTypeConverter);
- }
-
- /**
- * Represents a mapping from one type (which can be null) to another
- */
- protected static class TypeMapping {
- Class<?> toType;
- Class<?> fromType;
-
- public TypeMapping(Class<?> toType, Class<?> fromType) {
- this.toType = toType;
- this.fromType = fromType;
- }
-
- public Class<?> getFromType() {
- return fromType;
- }
-
- public Class<?> getToType() {
- return toType;
- }
-
- @Override
- public boolean equals(Object object) {
- if (object instanceof TypeMapping) {
- TypeMapping that = (TypeMapping) object;
- return ObjectHelper.equal(this.fromType, that.fromType)
- && ObjectHelper.equal(this.toType, that.toType);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int answer = toType.hashCode();
- if (fromType != null) {
- answer *= 37 + fromType.hashCode();
- }
- return answer;
- }
-
- @Override
- public String toString() {
- return "[" + fromType + "=>" + toType + "]";
- }
-
- public boolean isApplicable(Class<?> fromClass) {
- return fromType.isAssignableFrom(fromClass);
- }
- }
-
- /**
- * Represents a fallback type converter
- */
- protected static class FallbackTypeConverter {
- private boolean canPromote;
- private TypeConverter fallbackTypeConverter;
-
- FallbackTypeConverter(TypeConverter fallbackTypeConverter, boolean canPromote) {
- this.canPromote = canPromote;
- this.fallbackTypeConverter = fallbackTypeConverter;
- }
-
- public boolean isCanPromote() {
- return canPromote;
- }
-
- public TypeConverter getFallbackTypeConverter() {
- return fallbackTypeConverter;
- }
- }
-
}
View
0 ...l/converter/LazyLoadingTypeConverter.java → ...l/converter/LazyLoadingTypeConverter.java
File renamed without changes.
View
2 camel-core/src/main/java/org/apache/camel/model/ThreadsDefinition.java
@@ -61,7 +61,7 @@
private TimeUnit timeUnit;
@XmlAttribute
private Integer maxQueueSize;
- @XmlTransient()
+ @XmlAttribute
private String threadName;
@XmlAttribute
private ThreadPoolRejectedPolicy rejectedPolicy;
View
7 camel-core/src/main/java/org/apache/camel/processor/DeadLetterChannel.java
@@ -45,11 +45,12 @@
* @param deadLetter the failure processor to send failed exchanges to
* @param deadLetterUri an optional uri for logging purpose
* @param useOriginalBodyPolicy should the original IN body be moved to the dead letter queue or the current exchange IN body?
+ * @param retryWhile retry while
*/
public DeadLetterChannel(CamelContext camelContext, Processor output, Logger logger, Processor redeliveryProcessor, RedeliveryPolicy redeliveryPolicy,
- Predicate handledPolicy, ExceptionPolicyStrategy exceptionPolicyStrategy,
- Processor deadLetter, String deadLetterUri, boolean useOriginalBodyPolicy) {
- super(camelContext, output, logger, redeliveryProcessor, redeliveryPolicy, handledPolicy, deadLetter, deadLetterUri, useOriginalBodyPolicy);
+ Predicate handledPolicy, ExceptionPolicyStrategy exceptionPolicyStrategy, Processor deadLetter,
+ String deadLetterUri, boolean useOriginalBodyPolicy, Predicate retryWhile) {
+ super(camelContext, output, logger, redeliveryProcessor, redeliveryPolicy, handledPolicy, deadLetter, deadLetterUri, useOriginalBodyPolicy, retryWhile);
setExceptionPolicy(exceptionPolicyStrategy);
}
View
6 camel-core/src/main/java/org/apache/camel/processor/DefaultErrorHandler.java
@@ -39,10 +39,12 @@
* @param redeliveryPolicy policy for redelivery
* @param handledPolicy policy for handling failed exception that are moved to the dead letter queue
* @param exceptionPolicyStrategy strategy for onException handling
+ * @param retryWhile retry while
*/
public DefaultErrorHandler(CamelContext camelContext, Processor output, Logger logger, Processor redeliveryProcessor,
- RedeliveryPolicy redeliveryPolicy, Predicate handledPolicy, ExceptionPolicyStrategy exceptionPolicyStrategy) {
- super(camelContext, output, logger, redeliveryProcessor, redeliveryPolicy, handledPolicy, null, null, false);
+ RedeliveryPolicy redeliveryPolicy, Predicate handledPolicy,
+ ExceptionPolicyStrategy exceptionPolicyStrategy, Predicate retryWhile) {
+ super(camelContext, output, logger, redeliveryProcessor, redeliveryPolicy, handledPolicy, null, null, false, retryWhile);
setExceptionPolicy(exceptionPolicyStrategy);
}
View
2 camel-core/src/main/java/org/apache/camel/processor/LoggingErrorHandler.java
@@ -36,7 +36,7 @@
* @param exceptionPolicyStrategy strategy for onException handling
*/
public LoggingErrorHandler(CamelContext camelContext, Processor output, Logger logger, ExceptionPolicyStrategy exceptionPolicyStrategy) {
- super(camelContext, output, logger, null, new RedeliveryPolicy(), null, exceptionPolicyStrategy);
+ super(camelContext, output, logger, null, new RedeliveryPolicy(), null, exceptionPolicyStrategy, null);
}
@Override
View
6 camel-core/src/main/java/org/apache/camel/processor/RedeliveryErrorHandler.java
@@ -58,6 +58,7 @@
protected final Processor redeliveryProcessor;
protected final RedeliveryPolicy redeliveryPolicy;
protected final Predicate handledPolicy;
+ protected final Predicate retryWhilePolicy;
protected final Logger logger;
protected final boolean useOriginalMessagePolicy;
@@ -68,7 +69,7 @@
boolean sync = true;
int redeliveryCounter;
long redeliveryDelay;
- Predicate retryWhilePredicate;
+ Predicate retryWhilePredicate = retryWhilePolicy;
boolean redeliverFromSync;
// default behavior which can be overloaded on a per exception basis
@@ -174,7 +175,7 @@ public void done(boolean doneSync) {
public RedeliveryErrorHandler(CamelContext camelContext, Processor output, Logger logger, Processor redeliveryProcessor,
RedeliveryPolicy redeliveryPolicy, Predicate handledPolicy, Processor deadLetter,
- String deadLetterUri, boolean useOriginalMessagePolicy) {
+ String deadLetterUri, boolean useOriginalMessagePolicy, Predicate retryWhile) {
ObjectHelper.notNull(camelContext, "CamelContext", this);
ObjectHelper.notNull(redeliveryPolicy, "RedeliveryPolicy", this);
@@ -188,6 +189,7 @@ public RedeliveryErrorHandler(CamelContext camelContext, Processor output, Logge
this.deadLetterUri = deadLetterUri;
this.handledPolicy = handledPolicy;
this.useOriginalMessagePolicy = useOriginalMessagePolicy;
+ this.retryWhilePolicy = retryWhile;
}
public boolean supportTransacted() {
View
2 camel-core/src/main/java/org/apache/camel/spi/TypeConverterAware.java
@@ -22,7 +22,7 @@
* An interface for an object which is interested in being injected with the root {@link TypeConverter}
* such as for implementing a fallback type converter
*
- * @see org.apache.camel.impl.converter.DefaultTypeConverter#addFallbackTypeConverter(org.apache.camel.TypeConverter, boolean)
+ * @see TypeConverterRegistry
* @version $Revision$
*/
public interface TypeConverterAware {
View
47 camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
@@ -92,7 +92,9 @@ public void testSimpleRoute() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").filter(header("foo").isEqualTo("bar")).to("seda:b");
+ from("seda:a")
+ .filter(header("foo").isEqualTo("bar"))
+ .to("seda:b");
}
};
// END SNIPPET: e2
@@ -124,8 +126,14 @@ public void testSimpleRouteWithHeaderPredicate() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").choice().when(header("foo").isEqualTo("bar")).to("seda:b")
- .when(header("foo").isEqualTo("cheese")).to("seda:c").otherwise().to("seda:d");
+ from("seda:a")
+ .choice()
+ .when(header("foo").isEqualTo("bar"))
+ .to("seda:b")
+ .when(header("foo").isEqualTo("cheese"))
+ .to("seda:c")
+ .otherwise()
+ .to("seda:d");
}
};
// END SNIPPET: e3
@@ -171,7 +179,8 @@ public void process(Exchange exchange) {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").process(myProcessor);
+ from("seda:a")
+ .process(myProcessor);
}
};
// END SNIPPET: e4
@@ -198,7 +207,9 @@ public void testCustomProcessor() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").filter(header("foo").isEqualTo("bar")).process(myProcessor);
+ from("seda:a")
+ .filter(header("foo").isEqualTo("bar"))
+ .process(myProcessor);
}
};
// END SNIPPET: e5
@@ -229,7 +240,8 @@ public void testCustomProcessorWithFilter() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").multicast().to("seda:tap", "seda:b");
+ from("seda:a")
+ .multicast().to("seda:tap", "seda:b");
}
};
// END SNIPPET: e6
@@ -268,7 +280,10 @@ public void testWireTap() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").process(interceptor1).process(interceptor2).to("seda:d");
+ from("seda:a")
+ .process(interceptor1)
+ .process(interceptor2)
+ .to("seda:d");
}
};
return getRouteList(builder);
@@ -303,7 +318,9 @@ public void testComplexExpressions() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").filter(header("foo").isEqualTo(123)).to("seda:b");
+ from("seda:a")
+ .filter(header("foo").isEqualTo(123))
+ .to("seda:b");
}
};
// END SNIPPET: e7
@@ -324,7 +341,8 @@ public void configure() {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").multicast().to("seda:b", "seda:c", "seda:d");
+ from("seda:a")
+ .multicast().to("seda:b", "seda:c", "seda:d");
}
};
// END SNIPPET: multicast
@@ -337,7 +355,8 @@ public void configure() {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").recipientList(header("foo"));
+ from("seda:a")
+ .recipientList(header("foo"));
}
};
// END SNIPPET: e9
@@ -368,7 +387,9 @@ public void testRouteDynamicReceipentList() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").split(body(String.class).tokenize("\n")).to("seda:b");
+ from("seda:a")
+ .split(body(String.class).tokenize("\n"))
+ .to("seda:b");
}
};
// END SNIPPET: splitter
@@ -398,7 +419,9 @@ public void testSplitter() throws Exception {
public void configure() {
errorHandler(deadLetterChannel("mock:error"));
- from("seda:a").idempotentConsumer(header("myMessageId"), MemoryIdempotentRepository.memoryIdempotentRepository(200))
+ from("seda:a")
+ .idempotentConsumer(header("myMessageId"),
+ MemoryIdempotentRepository.memoryIdempotentRepository(200))
.to("seda:b");
}
};
View
7 camel-core/src/test/java/org/apache/camel/component/properties/PropertiesComponentTest.java
@@ -209,12 +209,7 @@ public void configure() throws Exception {
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext context = super.createCamelContext();
-
- PropertiesComponent pc = new PropertiesComponent();
- pc.setCamelContext(context);
- pc.setLocations(new String[]{"classpath:org/apache/camel/component/properties/myproperties.properties"});
- context.addComponent("properties", pc);
-
+ context.addComponent("properties", new PropertiesComponent("classpath:org/apache/camel/component/properties/myproperties.properties"));
return context;
}
View
1 camel-core/src/test/java/org/apache/camel/converter/JaxpTest.java
@@ -36,7 +36,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
/**
* @version $Revision$
*/
View
0 ...melContextLazyLoadTypeConvertersTest.java → ...melContextLazyLoadTypeConvertersTest.java
File renamed without changes.
View
2 camel-core/src/test/java/org/apache/camel/processor/RecipientListParallelTest.java
@@ -27,7 +27,7 @@
public void testRecipientListParallel() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
- mock.expectedBodiesReceived("c", "b", "a");
+ mock.expectedBodiesReceivedInAnyOrder("c", "b", "a");
template.sendBodyAndHeader("direct:start", "Hello World", "foo", "direct:a,direct:b,direct:c");
View
4 camel-core/src/test/java/org/apache/camel/processor/ResequencerTest.java
@@ -59,7 +59,9 @@ protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
// START SNIPPET: example
- from("direct:start").resequence(body()).to("mock:result");
+ from("direct:start")
+ .resequence(body())
+ .to("mock:result");
// END SNIPPET: example
}
};
View
13 camel-core/src/test/java/org/apache/camel/processor/SamplingThrottlerTest.java
@@ -115,16 +115,21 @@ private void validateDroppedExchanges(List<Exchange> sentExchanges, int expected
assertEquals(expectedNotDroppedCount, notDropped);
}
-
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
// START SNIPPET: e1
- from("direct:sample").sample().to("mock:result");
+ from("direct:sample")
+ .sample()
+ .to("mock:result");
- from("direct:sample-configured").sample(1, TimeUnit.SECONDS).to("mock:result");
+ from("direct:sample-configured")
+ .sample(1, TimeUnit.SECONDS)
+ .to("mock:result");
- from("direct:sample-configured-via-dsl").sample().samplePeriod(1).timeUnits(TimeUnit.SECONDS).to("mock:result");
+ from("direct:sample-configured-via-dsl")
+ .sample().samplePeriod(1).timeUnits(TimeUnit.SECONDS)
+ .to("mock:result");
// END SNIPPET: e1
}
};
View
3 camel-core/src/test/java/org/apache/camel/processor/SetExchangePatternTest.java
@@ -102,7 +102,8 @@ public void configure() {
from("direct:testToWithRobustInOnlyParam").to(ExchangePattern.RobustInOnly, "mock:result");
// Set the exchange pattern to InOut, then send it on
- from("direct:testSetExchangePatternInOnly").setExchangePattern(ExchangePattern.InOnly).to("mock:result");
+ from("direct:testSetExchangePatternInOnly")
+ .setExchangePattern(ExchangePattern.InOnly).to("mock:result");
// END SNIPPET: example
}
};
View
24 camel-core/src/test/java/org/apache/camel/processor/ShutdownCompleteAllTasksTest.java
@@ -17,9 +17,11 @@
package org.apache.camel.processor;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
import org.apache.camel.ShutdownRunningTask;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -30,11 +32,12 @@
public class ShutdownCompleteAllTasksTest extends ContextTestSupport {
private static String url = "file:target/pending";
+ private static AtomicInteger counter = new AtomicInteger();
@Override
protected void setUp() throws Exception {
- super.setUp();
deleteDirectory("target/pending");
+ super.setUp();
template.sendBodyAndHeader(url, "A", Exchange.FILE_NAME, "a.txt");
template.sendBodyAndHeader(url, "B", Exchange.FILE_NAME, "b.txt");
@@ -53,16 +56,16 @@ public void testShutdownCompleteAllTasks() throws Exception {
MockEndpoint bar = getMockEndpoint("mock:bar");
bar.expectedMinimumMessageCount(1);
- // wait 20 seconds to give more time for slowe servers
+ // wait 20 seconds to give more time for slow servers
bar.await(20, TimeUnit.SECONDS);
int batch = bar.getReceivedExchanges().get(0).getProperty(Exchange.BATCH_SIZE, int.class);
// shutdown during processing
context.stop();
- // should route all 5
- assertEquals("Should complete all messages", batch, bar.getReceivedCounter());
+ // should route all
+ assertEquals("Should complete all messages", batch, counter.get());
}
@Override
@@ -74,12 +77,19 @@ public void configure() throws Exception {
from(url).routeId("foo").noAutoStartup()
// let it complete all tasks during shutdown
.shutdownRunningTask(ShutdownRunningTask.CompleteAllTasks)
- .delay(1000).to("seda:foo");
-
- from("seda:foo").to("mock:bar");
+ .delay(1000)
+ .process(new MyProcessor())
+ .to("mock:bar");
}
// END SNIPPET: e1
};
}
+ public static class MyProcessor implements Processor {
+
+ public void process(Exchange exchange) throws Exception {
+ counter.incrementAndGet();
+ }
+ }
+
}
View
0 ...on/DefaultErrorHandlerRetryWhileTest.java → ...on/DefaultErrorHandlerRetryWhileTest.java
File renamed without changes.
View
2 camel-core/src/test/resources/log4j.properties
@@ -20,7 +20,7 @@
#
log4j.rootLogger=INFO, file
-log4j.logger.org.apache.camel.impl.converter=WARN
+#log4j.logger.org.apache.camel.impl.converter=WARN
log4j.logger.org.apache.camel.management=WARN
log4j.logger.org.apache.camel.impl.DefaultPackageScanClassResolver=WARN
#log4j.logger.org.apache.camel.impl.converter.DefaultTypeConverter=TRACE
View
10 ...nts/camel-blueprint/src/main/java/org/apache/camel/blueprint/CamelContextFactoryBean.java
@@ -83,6 +83,8 @@
private ShutdownRoute shutdownRoute;
@XmlAttribute(required = false)
private ShutdownRunningTask shutdownRunningTask;
+ @XmlAttribute(required = false)
+ private Boolean lazyLoadTypeConverters = Boolean.FALSE;
@XmlElement(name = "properties", required = false)
private PropertiesDefinition properties;
@XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class, required = false)
@@ -212,6 +214,14 @@ public void setAutoStartup(String autoStartup) {
this.autoStartup = autoStartup;
}
+ public Boolean getLazyLoadTypeConverters() {
+ return lazyLoadTypeConverters;
+ }
+
+ public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
+ this.lazyLoadTypeConverters = lazyLoadTypeConverters;
+ }
+
public ShutdownRoute getShutdownRoute() {
return shutdownRoute;
}
View
2 ...ents/camel-blueprint/src/main/java/org/apache/camel/blueprint/ErrorHandlerDefinition.java
@@ -49,6 +49,8 @@
private String transactionManagerRef;
@XmlAttribute
private String onRedeliveryRef;
+ @XmlAttribute
+ private String retryWhileRef;
@XmlElement
private RedeliveryPolicyDefinition redeliveryPolicy;
View
4 components/camel-blueprint/src/test/resources/test.xml
@@ -21,8 +21,8 @@
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
- <from uri="timer:test" />
- <to uri="log:test" />
+ <from uri="timer:test"/>
+ <to uri="log:test"/>
</route>
</camelContext>
View
8 ...mel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java
@@ -131,7 +131,11 @@ public void afterPropertiesSet() throws Exception {
getContext().setProperties(getProperties().asMap());
}
- // set the resolvers first
+ // set the type converter mode first
+ if (getLazyLoadTypeConverters() != null) {
+ getContext().setLazyLoadTypeConverters(getLazyLoadTypeConverters());
+ }
+
PackageScanClassResolver packageResolver = getBeanForType(PackageScanClassResolver.class);
if (packageResolver != null) {
LOG.info("Using custom PackageScanClassResolver: " + packageResolver);
@@ -564,6 +568,8 @@ public T getContext() {
public abstract String getAutoStartup();
+ public abstract Boolean getLazyLoadTypeConverters();
+
public abstract CamelJMXAgentDefinition getCamelJMXAgent();
public abstract List<RouteBuilderDefinition> getBuilderRefs();
View
14 components/camel-dozer/pom.xml
@@ -42,20 +42,9 @@
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.dozer</groupId>
- <artifactId>dozer-osgi</artifactId>
- <version>5.2.2</version>
+ <version>${dozer-version}</version>
</dependency>
- <!-- xmlbeans is marked as optional in dozer by we need it for testing -->
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>2.4.0</version>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
@@ -76,6 +65,7 @@
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
+
</dependencies>
</project>
View
55 .../camel-dozer/src/main/java/org/apache/camel/converter/dozer/DozerTypeConverterLoader.java
@@ -18,6 +18,7 @@
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -32,6 +33,7 @@
import org.dozer.Mapper;
import org.dozer.classmap.ClassMap;
import org.dozer.classmap.MappingFileData;
+import org.dozer.loader.api.BeanMappingBuilder;
import org.dozer.loader.xml.MappingFileReader;
import org.dozer.loader.xml.XMLParserFactory;
@@ -50,6 +52,7 @@
private final Log log = LogFactory.getLog(getClass());
private CamelContext camelContext;
+ private DozerBeanMapper mapper;
/**
* Creates a <code>DozerTypeConverter</code> performing no
@@ -94,6 +97,8 @@ public DozerTypeConverterLoader(CamelContext camelContext, DozerBeanMapper mappe
*/
public void init(CamelContext camelContext, DozerBeanMapper mapper) {
this.camelContext = camelContext;
+ this.mapper = mapper;
+
Map<String, DozerBeanMapper> mappers = new HashMap<String, DozerBeanMapper>(camelContext.getRegistry().lookupByType(DozerBeanMapper.class));
if (mapper != null) {
mappers.put("parameter", mapper);
@@ -102,20 +107,25 @@ public void init(CamelContext camelContext, DozerBeanMapper mapper) {
log.warn("Loaded " + mappers.size() + " Dozer mappers from Camel registry."
+ " Dozer is most efficient when there is a single mapper instance. Consider amalgamating instances.");
} else if (mappers.size() == 0) {
- log.warn("No Dozer mappers found in Camel registry. You should add Dozer mappers as beans to the registry of the type: " + DozerBeanMapper.class.getName());
+ log.warn("No Dozer mappers found in Camel registry. You should add Dozer mappers as beans to the registry of the type: "
+ + DozerBeanMapper.class.getName());
}
TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
for (DozerBeanMapper dozer : mappers.values()) {
List<ClassMap> all = loadMappings(camelContext, dozer);
- DozerTypeConverter converter = new DozerTypeConverter(dozer);
- for (ClassMap map : all) {
- if (log.isInfoEnabled()) {
- log.info("Added " + map.getSrcClassName() + " -> " + map.getDestClassName() + " as type converter to: " + registry);
- }
- registry.addTypeConverter(map.getSrcClassToMap(), map.getDestClassToMap(), converter);
- registry.addTypeConverter(map.getDestClassToMap(), map.getSrcClassToMap(), converter);
+ registerClassMaps(registry, dozer, all);
+ }
+ }
+
+ private void registerClassMaps(TypeConverterRegistry registry, DozerBeanMapper dozer, List<ClassMap> all) {
+ DozerTypeConverter converter = new DozerTypeConverter(dozer);
+ for (ClassMap map : all) {
+ if (log.isInfoEnabled()) {
+ log.info("Added " + map.getSrcClassName() + " -> " + map.getDestClassName() + " as type converter to: " + registry);
}
+ registry.addTypeConverter(map.getSrcClassToMap(), map.getDestClassToMap(), converter);
+ registry.addTypeConverter(map.getDestClassToMap(), map.getSrcClassToMap(), converter);
}
}
@@ -124,7 +134,12 @@ public void init(CamelContext camelContext, DozerBeanMapper mapper) {
// load the class map using the class resolver so we can load from classpath in OSGi
MappingFileReader reader = new MappingFileReader(XMLParserFactory.getInstance());
- for (String name : mapper.getMappingFiles()) {
+ List<String> mappingFiles = mapper.getMappingFiles();
+ if (mappingFiles == null) {
+ return Collections.emptyList();
+ }
+
+ for (String name : mappingFiles) {
URL url = camelContext.getClassResolver().loadResourceAsURL(name);
MappingFileData data = reader.read(url);
answer.addAll(data.getClassMaps());
@@ -133,6 +148,28 @@ public void init(CamelContext camelContext, DozerBeanMapper mapper) {
return answer;
}
+ /**
+ * Registers Dozer <code>BeanMappingBuilder</code> in current mapper instance.
+ * This method should be called instead of direct <code>mapper.addMapping()</code> invocation for Camel
+ * being able to register given type conversion.
+ *
+ * @param beanMappingBuilder api-based mapping builder
+ */
+ public void addMapping(BeanMappingBuilder beanMappingBuilder) {
+ if (mapper == null) {
+ log.warn("No mapper instance provided to " + this.getClass().getSimpleName()
+ + ". Mapping has not been registered!");
+ return;
+ }
+
+ mapper.addMapping(beanMappingBuilder);
+ MappingFileData mappingFileData = beanMappingBuilder.build();
+ TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
+ ArrayList<ClassMap> classMaps = new ArrayList<ClassMap>();
+ classMaps.addAll(mappingFileData.getClassMaps());
+ registerClassMaps(registry, mapper, classMaps);
+ }
+
public CamelContext getCamelContext() {
return camelContext;
}
View
11 ...camel-dozer/src/test/java/org/apache/camel/converter/dozer/DozerTestArtifactsFactory.java
@@ -18,6 +18,8 @@
import java.util.Arrays;
+import org.apache.camel.converter.dozer.dto.AddressDTO;
+import org.apache.camel.converter.dozer.dto.CustomerDTO;
import org.apache.camel.converter.dozer.model.Address;
import org.apache.camel.converter.dozer.service.Customer;
import org.dozer.DozerBeanMapper;
@@ -35,8 +37,17 @@ public static Customer createServiceCustomer() {
return new org.apache.camel.converter.dozer.model.Customer("Bob", "Roberts", new Address("12345", "1 main st"));
}
+ public static CustomerDTO createDtoCustomer() {
+ return new CustomerDTO("Bob", "Roberts", new AddressDTO("12345", "1 main st"));
+ }
+
public static DozerBeanMapper createMapper() {
return new DozerBeanMapper(Arrays.asList(new String[]{"mapping.xml"}));
}
+ public static DozerBeanMapper createCleanMapper() {
+ return new DozerBeanMapper();
+ }
+
+
}
View
0 ...rter/dozer/DozerTypeConverterDTOTest.java → ...rter/dozer/DozerTypeConverterDTOTest.java
File renamed without changes.
View
0 ...camel/converter/dozer/dto/AddressDTO.java → ...camel/converter/dozer/dto/AddressDTO.java
File renamed without changes.
View
0 ...amel/converter/dozer/dto/CustomerDTO.java → ...amel/converter/dozer/dto/CustomerDTO.java
File renamed without changes.
View
9 components/camel-exec/pom.xml
@@ -28,13 +28,6 @@
<description>Camel support for system command execution</description>
<properties>
- <!--
- TODO: move the versions to section dependencyManagement of the parent pom,
- and then remove the versions underneath
- -->
- <commons-exec-version>1.0.1</commons-exec-version>
- <commons-io-version>1.4</commons-io-version>
- <commons-lang-version>2.5</commons-lang-version>
<camel.osgi.export.pkg>org.apache.camel.component.exec.*</camel.osgi.export.pkg>
</properties>
@@ -51,7 +44,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>${commons-io-version}</version>
+ <version>1.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
View
14 ...nts/camel-exec/src/main/java/org/apache/camel/component/exec/impl/DefaultExecBinding.java
@@ -42,17 +42,25 @@ public ExecCommand readInput(Exchange exchange, ExecEndpoint endpoint) {
ObjectHelper.notNull(exchange, "exchange");
ObjectHelper.notNull(endpoint, "endpoint");
+ // do not convert args as we do that manually later
+ Object args = exchange.getIn().removeHeader(EXEC_COMMAND_ARGS);
String cmd = getAndRemoveHeader(exchange.getIn(), EXEC_COMMAND_EXECUTABLE, endpoint.getExecutable(), String.class);
- List<String> argsList = getAndRemoveHeader(exchange.getIn(), EXEC_COMMAND_ARGS, null, List.class);
String dir = getAndRemoveHeader(exchange.getIn(), EXEC_COMMAND_WORKING_DIR, endpoint.getWorkingDir(), String.class);
long timeout = getAndRemoveHeader(exchange.getIn(), EXEC_COMMAND_TIMEOUT, endpoint.getTimeout(), Long.class);
String outFilePath = getAndRemoveHeader(exchange.getIn(), EXEC_COMMAND_OUT_FILE, endpoint.getOutFile(), String.class);
boolean useStderrOnEmptyStdout = getAndRemoveHeader(exchange.getIn(), EXEC_USE_STDERR_ON_EMPTY_STDOUT, endpoint.isUseStderrOnEmptyStdout(), Boolean.class);
InputStream input = exchange.getIn().getBody(InputStream.class);
+ // try to convert args to list at fist
+ List<String> argsList = exchange.getContext().getTypeConverter().convertTo(List.class, exchange, args);
if (argsList == null) {
- // do the URI parsing, only if the arguments are not set
- argsList = splitToWhiteSpaceSeparatedTokens(endpoint.getArgs());
+ // no we could not do that, then parse it as a string to a list
+ String s = endpoint.getArgs();
+ if (args != null) {
+ // use args from header instead from endpoint
+ s = exchange.getContext().getTypeConverter().convertTo(String.class, exchange, args);
+ }
+ argsList = splitToWhiteSpaceSeparatedTokens(s);
}
File outFile = outFilePath == null ? null : new File(outFilePath);
View
2 components/camel-exec/src/test/java/org/apache/camel/component/exec/ExecEndpointTest.java
@@ -151,7 +151,6 @@ public void testCreateEndpointEscapedWorkingDir() throws Exception {
assertNotNull(endpoint.getCommandExecutor());
assertEquals(dir, endpoint.getWorkingDir());
-
}
@Test