001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.spring; 018 019import java.util.ArrayList; 020import java.util.List; 021import java.util.Map; 022import javax.xml.bind.annotation.XmlAccessType; 023import javax.xml.bind.annotation.XmlAccessorType; 024import javax.xml.bind.annotation.XmlAttribute; 025import javax.xml.bind.annotation.XmlElement; 026import javax.xml.bind.annotation.XmlElements; 027import javax.xml.bind.annotation.XmlRootElement; 028import javax.xml.bind.annotation.XmlTransient; 029 030import org.apache.camel.CamelContext; 031import org.apache.camel.RoutesBuilder; 032import org.apache.camel.ShutdownRoute; 033import org.apache.camel.ShutdownRunningTask; 034import org.apache.camel.builder.RouteBuilder; 035import org.apache.camel.component.properties.PropertiesComponent; 036import org.apache.camel.core.xml.AbstractCamelContextFactoryBean; 037import org.apache.camel.core.xml.CamelJMXAgentDefinition; 038import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition; 039import org.apache.camel.core.xml.CamelProxyFactoryDefinition; 040import org.apache.camel.core.xml.CamelServiceExporterDefinition; 041import org.apache.camel.core.xml.CamelStreamCachingStrategyDefinition; 042import org.apache.camel.model.ContextScanDefinition; 043import org.apache.camel.model.InterceptDefinition; 044import org.apache.camel.model.InterceptFromDefinition; 045import org.apache.camel.model.InterceptSendToEndpointDefinition; 046import org.apache.camel.model.OnCompletionDefinition; 047import org.apache.camel.model.OnExceptionDefinition; 048import org.apache.camel.model.PackageScanDefinition; 049import org.apache.camel.model.RouteBuilderDefinition; 050import org.apache.camel.model.RouteContextRefDefinition; 051import org.apache.camel.model.RouteDefinition; 052import org.apache.camel.model.ThreadPoolProfileDefinition; 053import org.apache.camel.model.config.PropertiesDefinition; 054import org.apache.camel.model.dataformat.DataFormatsDefinition; 055import org.apache.camel.spi.PackageScanFilter; 056import org.apache.camel.spi.Registry; 057import org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer; 058import org.apache.camel.util.CamelContextHelper; 059import org.slf4j.Logger; 060import org.slf4j.LoggerFactory; 061import org.springframework.beans.factory.DisposableBean; 062import org.springframework.beans.factory.FactoryBean; 063import org.springframework.beans.factory.InitializingBean; 064import org.springframework.beans.factory.config.BeanPostProcessor; 065import org.springframework.context.ApplicationContext; 066import org.springframework.context.ApplicationContextAware; 067import org.springframework.context.ApplicationEvent; 068import org.springframework.context.ApplicationListener; 069import org.springframework.context.event.ContextRefreshedEvent; 070 071import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException; 072 073/** 074 * A Spring {@link FactoryBean} to create and initialize a 075 * {@link SpringCamelContext} and install routes either explicitly configured in 076 * Spring XML or found by searching the classpath for Java classes which extend 077 * {@link RouteBuilder} using the nested {@link #setPackages(String[])}. 078 * 079 * @version 080 */ 081@XmlRootElement(name = "camelContext") 082@XmlAccessorType(XmlAccessType.FIELD) 083public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<SpringCamelContext> 084 implements FactoryBean<SpringCamelContext>, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ApplicationEvent> { 085 private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class); 086 087 @XmlAttribute(name = "depends-on", required = false) 088 private String dependsOn; 089 @XmlAttribute(required = false) 090 private String trace; 091 @XmlAttribute(required = false) 092 private String messageHistory; 093 @XmlAttribute(required = false) 094 private String streamCache; 095 @XmlAttribute(required = false) 096 private String delayer; 097 @XmlAttribute(required = false) 098 private String handleFault; 099 @XmlAttribute(required = false) 100 private String errorHandlerRef; 101 @XmlAttribute(required = false) 102 private String autoStartup; 103 @XmlAttribute(required = false) 104 private String shutdownEager; 105 @XmlAttribute(required = false) 106 private String useMDCLogging; 107 @XmlAttribute(required = false) 108 private String useBreadcrumb; 109 @XmlAttribute(required = false) 110 private String allowUseOriginalMessage; 111 @XmlAttribute(required = false) 112 private String runtimeEndpointRegistryEnabled; 113 @XmlAttribute(required = false) 114 private String managementNamePattern; 115 @XmlAttribute(required = false) 116 private String threadNamePattern; 117 @XmlAttribute(required = false) 118 private ShutdownRoute shutdownRoute; 119 @XmlAttribute(required = false) 120 private ShutdownRunningTask shutdownRunningTask; 121 @XmlAttribute(required = false) 122 @Deprecated 123 private Boolean lazyLoadTypeConverters; 124 @XmlAttribute(required = false) 125 private Boolean typeConverterStatisticsEnabled; 126 @XmlElement(name = "properties", required = false) 127 private PropertiesDefinition properties; 128 @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class, required = false) 129 private CamelPropertyPlaceholderDefinition camelPropertyPlaceholder; 130 @XmlElement(name = "package", required = false) 131 private String[] packages = {}; 132 @XmlElement(name = "packageScan", type = PackageScanDefinition.class, required = false) 133 private PackageScanDefinition packageScan; 134 @XmlElement(name = "contextScan", type = ContextScanDefinition.class, required = false) 135 private ContextScanDefinition contextScan; 136 @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class, required = false) 137 private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy; 138 @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class, required = false) 139 private CamelJMXAgentDefinition camelJMXAgent; 140 @XmlElements({ 141 @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false), 142 @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class, required = false), 143 @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false), 144 @XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false), 145 @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)}) 146 private List<?> beans; 147 @XmlElement(name = "routeBuilder", required = false) 148 private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>(); 149 @XmlElement(name = "routeContextRef", required = false) 150 private List<RouteContextRefDefinition> routeRefs = new ArrayList<RouteContextRefDefinition>(); 151 @XmlElement(name = "threadPoolProfile", required = false) 152 private List<ThreadPoolProfileDefinition> threadPoolProfiles; 153 @XmlElement(name = "threadPool", required = false) 154 private List<CamelThreadPoolFactoryBean> threadPools; 155 @XmlElement(name = "endpoint", required = false) 156 private List<CamelEndpointFactoryBean> endpoints; 157 @XmlElement(name = "dataFormats", required = false) 158 private DataFormatsDefinition dataFormats; 159 @XmlElement(name = "redeliveryPolicyProfile", required = false) 160 private List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies; 161 @XmlElement(name = "onException", required = false) 162 private List<OnExceptionDefinition> onExceptions = new ArrayList<OnExceptionDefinition>(); 163 @XmlElement(name = "onCompletion", required = false) 164 private List<OnCompletionDefinition> onCompletions = new ArrayList<OnCompletionDefinition>(); 165 @XmlElement(name = "intercept", required = false) 166 private List<InterceptDefinition> intercepts = new ArrayList<InterceptDefinition>(); 167 @XmlElement(name = "interceptFrom", required = false) 168 private List<InterceptFromDefinition> interceptFroms = new ArrayList<InterceptFromDefinition>(); 169 @XmlElement(name = "interceptSendToEndpoint", required = false) 170 private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<InterceptSendToEndpointDefinition>(); 171 @XmlElement(name = "route", required = false) 172 private List<RouteDefinition> routes = new ArrayList<RouteDefinition>(); 173 @XmlTransient 174 private SpringCamelContext context; 175 @XmlTransient 176 private ClassLoader contextClassLoaderOnStart; 177 @XmlTransient 178 private ApplicationContext applicationContext; 179 @XmlTransient 180 private BeanPostProcessor beanPostProcessor; 181 @XmlTransient 182 private boolean implicitId; 183 184 185 @Override 186 public Class<SpringCamelContext> getObjectType() { 187 return SpringCamelContext.class; 188 } 189 190 protected <S> S getBeanForType(Class<S> clazz) { 191 S bean = null; 192 String[] names = getApplicationContext().getBeanNamesForType(clazz, true, true); 193 if (names.length == 1) { 194 bean = getApplicationContext().getBean(names[0], clazz); 195 } 196 if (bean == null) { 197 ApplicationContext parentContext = getApplicationContext().getParent(); 198 if (parentContext != null) { 199 names = parentContext.getBeanNamesForType(clazz, true, true); 200 if (names.length == 1) { 201 bean = parentContext.getBean(names[0], clazz); 202 } 203 } 204 } 205 return bean; 206 } 207 208 @Override 209 protected void findRouteBuildersByPackageScan(String[] packages, PackageScanFilter filter, List<RoutesBuilder> builders) throws Exception { 210 // add filter to class resolver which then will filter 211 getContext().getPackageScanClassResolver().addFilter(filter); 212 213 PackageScanRouteBuilderFinder finder = new PackageScanRouteBuilderFinder(getContext(), packages, getContextClassLoaderOnStart(), 214 getBeanPostProcessor(), getContext().getPackageScanClassResolver()); 215 finder.appendBuilders(builders); 216 217 // and remove the filter 218 getContext().getPackageScanClassResolver().removeFilter(filter); 219 } 220 221 @Override 222 protected void findRouteBuildersByContextScan(PackageScanFilter filter, List<RoutesBuilder> builders) throws Exception { 223 ContextScanRouteBuilderFinder finder = new ContextScanRouteBuilderFinder(getContext(), filter); 224 finder.appendBuilders(builders); 225 } 226 227 protected void initBeanPostProcessor(SpringCamelContext context) { 228 if (beanPostProcessor != null) { 229 if (beanPostProcessor instanceof ApplicationContextAware) { 230 ((ApplicationContextAware) beanPostProcessor).setApplicationContext(applicationContext); 231 } 232 if (beanPostProcessor instanceof CamelBeanPostProcessor) { 233 ((CamelBeanPostProcessor) beanPostProcessor).setCamelContext(getContext()); 234 } 235 } 236 } 237 238 protected void postProcessBeforeInit(RouteBuilder builder) { 239 if (beanPostProcessor != null) { 240 // Inject the annotated resource 241 beanPostProcessor.postProcessBeforeInitialization(builder, builder.toString()); 242 } 243 } 244 245 @Override 246 public void afterPropertiesSet() throws Exception { 247 super.afterPropertiesSet(); 248 249 Boolean shutdownEager = CamelContextHelper.parseBoolean(getContext(), getShutdownEager()); 250 if (shutdownEager != null) { 251 LOG.debug("Using shutdownEager: " + shutdownEager); 252 getContext().setShutdownEager(shutdownEager); 253 } 254 } 255 256 protected void initCustomRegistry(SpringCamelContext context) { 257 Registry registry = getBeanForType(Registry.class); 258 if (registry != null) { 259 LOG.info("Using custom Registry: " + registry); 260 context.setRegistry(registry); 261 } 262 } 263 264 @Override 265 protected void initPropertyPlaceholder() throws Exception { 266 super.initPropertyPlaceholder(); 267 268 Map<String, BridgePropertyPlaceholderConfigurer> beans = applicationContext.getBeansOfType(BridgePropertyPlaceholderConfigurer.class); 269 if (beans.size() == 1) { 270 // setup properties component that uses this beans 271 BridgePropertyPlaceholderConfigurer configurer = beans.values().iterator().next(); 272 String id = beans.keySet().iterator().next(); 273 LOG.info("Bridging Camel and Spring property placeholder configurer with id: " + id); 274 275 // get properties component 276 PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class); 277 // replace existing resolver with us 278 configurer.setResolver(pc.getPropertiesResolver()); 279 configurer.setParser(pc.getPropertiesParser()); 280 String ref = "ref:" + id; 281 // use the bridge to handle the resolve and parsing 282 pc.setPropertiesResolver(configurer); 283 pc.setPropertiesParser(configurer); 284 // and update locations to have our as ref first 285 String[] locations = pc.getLocations(); 286 String[] updatedLocations; 287 if (locations != null && locations.length > 0) { 288 updatedLocations = new String[locations.length + 1]; 289 updatedLocations[0] = ref; 290 System.arraycopy(locations, 0, updatedLocations, 1, locations.length); 291 } else { 292 updatedLocations = new String[]{ref}; 293 } 294 pc.setLocations(updatedLocations); 295 } else if (beans.size() > 1) { 296 LOG.warn("Cannot bridge Camel and Spring property placeholders, as exact only 1 bean of type BridgePropertyPlaceholderConfigurer" 297 + " must be defined, was {} beans defined.", beans.size()); 298 } 299 } 300 301 public void onApplicationEvent(ApplicationEvent event) { 302 // From Spring 3.0.1, The BeanFactory applicationEventListener 303 // and Bean's applicationEventListener will be called, 304 // So we just delegate the onApplicationEvent call here. 305 306 SpringCamelContext context = getContext(false); 307 if (context != null) { 308 // we need to defer setting up routes until Spring has done all its dependency injection 309 // which is only guaranteed to be done when it emits the ContextRefreshedEvent event. 310 if (event instanceof ContextRefreshedEvent) { 311 try { 312 setupRoutes(); 313 } catch (Exception e) { 314 throw wrapRuntimeCamelException(e); 315 } 316 } 317 // let the spring camel context handle the events 318 context.onApplicationEvent(event); 319 } else { 320 LOG.debug("Publishing spring-event: {}", event); 321 322 if (event instanceof ContextRefreshedEvent) { 323 // now lets start the CamelContext so that all its possible 324 // dependencies are initialized 325 try { 326 // we need to defer setting up routes until Spring has done all its dependency injection 327 // which is only guaranteed to be done when it emits the ContextRefreshedEvent event. 328 setupRoutes(); 329 LOG.trace("Starting the context now"); 330 getContext().start(); 331 } catch (Exception e) { 332 throw wrapRuntimeCamelException(e); 333 } 334 } 335 } 336 } 337 338 // Properties 339 // ------------------------------------------------------------------------- 340 341 public ApplicationContext getApplicationContext() { 342 if (applicationContext == null) { 343 throw new IllegalArgumentException("No applicationContext has been injected!"); 344 } 345 return applicationContext; 346 } 347 348 public void setApplicationContext(ApplicationContext applicationContext) { 349 this.applicationContext = applicationContext; 350 } 351 352 public void setBeanPostProcessor(BeanPostProcessor postProcessor) { 353 this.beanPostProcessor = postProcessor; 354 } 355 356 public BeanPostProcessor getBeanPostProcessor() { 357 return beanPostProcessor; 358 } 359 360 // Implementation methods 361 // ------------------------------------------------------------------------- 362 363 /** 364 * Create the context 365 */ 366 protected SpringCamelContext createContext() { 367 SpringCamelContext ctx = newCamelContext(); 368 ctx.setName(getId()); 369 return ctx; 370 } 371 372 protected SpringCamelContext newCamelContext() { 373 return new SpringCamelContext(getApplicationContext()); 374 } 375 376 public SpringCamelContext getContext(boolean create) { 377 if (context == null && create) { 378 context = createContext(); 379 } 380 return context; 381 } 382 383 public void setContext(SpringCamelContext context) { 384 this.context = context; 385 } 386 387 public List<RouteDefinition> getRoutes() { 388 return routes; 389 } 390 391 public void setRoutes(List<RouteDefinition> routes) { 392 this.routes = routes; 393 } 394 395 public List<CamelEndpointFactoryBean> getEndpoints() { 396 return endpoints; 397 } 398 399 public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() { 400 return redeliveryPolicies; 401 } 402 403 public List<InterceptDefinition> getIntercepts() { 404 return intercepts; 405 } 406 407 public void setIntercepts(List<InterceptDefinition> intercepts) { 408 this.intercepts = intercepts; 409 } 410 411 public List<InterceptFromDefinition> getInterceptFroms() { 412 return interceptFroms; 413 } 414 415 public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) { 416 this.interceptFroms = interceptFroms; 417 } 418 419 public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() { 420 return interceptSendToEndpoints; 421 } 422 423 public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) { 424 this.interceptSendToEndpoints = interceptSendToEndpoints; 425 } 426 427 public PropertiesDefinition getProperties() { 428 return properties; 429 } 430 431 public void setProperties(PropertiesDefinition properties) { 432 this.properties = properties; 433 } 434 435 public String[] getPackages() { 436 return packages; 437 } 438 439 /** 440 * Sets the package names to be recursively searched for Java classes which 441 * extend {@link org.apache.camel.builder.RouteBuilder} to be auto-wired up to the 442 * {@link CamelContext} as a route. Note that classes are excluded if 443 * they are specifically configured in the spring.xml 444 * <p/> 445 * A more advanced configuration can be done using {@link #setPackageScan(org.apache.camel.model.PackageScanDefinition)} 446 * 447 * @param packages the package names which are recursively searched 448 * @see #setPackageScan(org.apache.camel.model.PackageScanDefinition) 449 */ 450 public void setPackages(String[] packages) { 451 this.packages = packages; 452 } 453 454 public PackageScanDefinition getPackageScan() { 455 return packageScan; 456 } 457 458 /** 459 * Sets the package scanning information. Package scanning allows for the 460 * automatic discovery of certain camel classes at runtime for inclusion 461 * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations 462 * 463 * @param packageScan the package scan 464 */ 465 public void setPackageScan(PackageScanDefinition packageScan) { 466 this.packageScan = packageScan; 467 } 468 469 public ContextScanDefinition getContextScan() { 470 return contextScan; 471 } 472 473 /** 474 * Sets the context scanning (eg Spring's ApplicationContext) information. 475 * Context scanning allows for the automatic discovery of Camel routes runtime for inclusion 476 * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations 477 * 478 * @param contextScan the context scan 479 */ 480 public void setContextScan(ContextScanDefinition contextScan) { 481 this.contextScan = contextScan; 482 } 483 484 public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() { 485 return camelPropertyPlaceholder; 486 } 487 488 public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) { 489 this.camelPropertyPlaceholder = camelPropertyPlaceholder; 490 } 491 492 public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() { 493 return camelStreamCachingStrategy; 494 } 495 496 public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) { 497 this.camelStreamCachingStrategy = camelStreamCachingStrategy; 498 } 499 500 public void setCamelJMXAgent(CamelJMXAgentDefinition agent) { 501 camelJMXAgent = agent; 502 } 503 504 public String getTrace() { 505 return trace; 506 } 507 508 public void setTrace(String trace) { 509 this.trace = trace; 510 } 511 512 public String getMessageHistory() { 513 return messageHistory; 514 } 515 516 public void setMessageHistory(String messageHistory) { 517 this.messageHistory = messageHistory; 518 } 519 520 public String getStreamCache() { 521 return streamCache; 522 } 523 524 public void setStreamCache(String streamCache) { 525 this.streamCache = streamCache; 526 } 527 528 public String getDelayer() { 529 return delayer; 530 } 531 532 public void setDelayer(String delayer) { 533 this.delayer = delayer; 534 } 535 536 public String getHandleFault() { 537 return handleFault; 538 } 539 540 public void setHandleFault(String handleFault) { 541 this.handleFault = handleFault; 542 } 543 544 public String getAutoStartup() { 545 return autoStartup; 546 } 547 548 public void setAutoStartup(String autoStartup) { 549 this.autoStartup = autoStartup; 550 } 551 552 public String getShutdownEager() { 553 return shutdownEager; 554 } 555 556 public void setShutdownEager(String shutdownEager) { 557 this.shutdownEager = shutdownEager; 558 } 559 560 public String getUseMDCLogging() { 561 return useMDCLogging; 562 } 563 564 public void setUseMDCLogging(String useMDCLogging) { 565 this.useMDCLogging = useMDCLogging; 566 } 567 568 public String getUseBreadcrumb() { 569 return useBreadcrumb; 570 } 571 572 public void setUseBreadcrumb(String useBreadcrumb) { 573 this.useBreadcrumb = useBreadcrumb; 574 } 575 576 public String getAllowUseOriginalMessage() { 577 return allowUseOriginalMessage; 578 } 579 580 public void setAllowUseOriginalMessage(String allowUseOriginalMessage) { 581 this.allowUseOriginalMessage = allowUseOriginalMessage; 582 } 583 584 public String getRuntimeEndpointRegistryEnabled() { 585 return runtimeEndpointRegistryEnabled; 586 } 587 588 public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) { 589 this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled; 590 } 591 592 public String getManagementNamePattern() { 593 return managementNamePattern; 594 } 595 596 public void setManagementNamePattern(String managementNamePattern) { 597 this.managementNamePattern = managementNamePattern; 598 } 599 600 public String getThreadNamePattern() { 601 return threadNamePattern; 602 } 603 604 public void setThreadNamePattern(String threadNamePattern) { 605 this.threadNamePattern = threadNamePattern; 606 } 607 608 @Deprecated 609 public Boolean getLazyLoadTypeConverters() { 610 return lazyLoadTypeConverters; 611 } 612 613 @Deprecated 614 public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) { 615 this.lazyLoadTypeConverters = lazyLoadTypeConverters; 616 } 617 618 public Boolean getTypeConverterStatisticsEnabled() { 619 return typeConverterStatisticsEnabled; 620 } 621 622 public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) { 623 this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled; 624 } 625 626 public CamelJMXAgentDefinition getCamelJMXAgent() { 627 return camelJMXAgent; 628 } 629 630 public List<RouteBuilderDefinition> getBuilderRefs() { 631 return builderRefs; 632 } 633 634 public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) { 635 this.builderRefs = builderRefs; 636 } 637 638 public List<RouteContextRefDefinition> getRouteRefs() { 639 return routeRefs; 640 } 641 642 public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) { 643 this.routeRefs = routeRefs; 644 } 645 646 public String getErrorHandlerRef() { 647 return errorHandlerRef; 648 } 649 650 /** 651 * Sets the name of the error handler object used to default the error handling strategy 652 * 653 * @param errorHandlerRef the Spring bean ref of the error handler 654 */ 655 public void setErrorHandlerRef(String errorHandlerRef) { 656 this.errorHandlerRef = errorHandlerRef; 657 } 658 659 public void setDataFormats(DataFormatsDefinition dataFormats) { 660 this.dataFormats = dataFormats; 661 } 662 663 public DataFormatsDefinition getDataFormats() { 664 return dataFormats; 665 } 666 667 public void setOnExceptions(List<OnExceptionDefinition> onExceptions) { 668 this.onExceptions = onExceptions; 669 } 670 671 public List<OnExceptionDefinition> getOnExceptions() { 672 return onExceptions; 673 } 674 675 public List<OnCompletionDefinition> getOnCompletions() { 676 return onCompletions; 677 } 678 679 public void setOnCompletions(List<OnCompletionDefinition> onCompletions) { 680 this.onCompletions = onCompletions; 681 } 682 683 public ShutdownRoute getShutdownRoute() { 684 return shutdownRoute; 685 } 686 687 public void setShutdownRoute(ShutdownRoute shutdownRoute) { 688 this.shutdownRoute = shutdownRoute; 689 } 690 691 public ShutdownRunningTask getShutdownRunningTask() { 692 return shutdownRunningTask; 693 } 694 695 public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) { 696 this.shutdownRunningTask = shutdownRunningTask; 697 } 698 699 public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() { 700 return threadPoolProfiles; 701 } 702 703 public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) { 704 this.threadPoolProfiles = threadPoolProfiles; 705 } 706 707 public String getDependsOn() { 708 return dependsOn; 709 } 710 711 public void setDependsOn(String dependsOn) { 712 this.dependsOn = dependsOn; 713 } 714 715 public boolean isImplicitId() { 716 return implicitId; 717 } 718 719 public void setImplicitId(boolean flag) { 720 implicitId = flag; 721 } 722 723}