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 = (PropertiesComponent) getContext().getComponent("properties", false); 277 if (pc == null) { 278 // do not auto create the component as spring autowrire by constructor causes a side effect when using bridge 279 pc = new PropertiesComponent(); 280 getContext().addComponent("properties", pc); 281 } 282 // replace existing resolver with us 283 configurer.setResolver(pc.getPropertiesResolver()); 284 configurer.setParser(pc.getPropertiesParser()); 285 String ref = "ref:" + id; 286 // use the bridge to handle the resolve and parsing 287 pc.setPropertiesResolver(configurer); 288 pc.setPropertiesParser(configurer); 289 // and update locations to have our as ref first 290 String[] locations = pc.getLocations(); 291 String[] updatedLocations; 292 if (locations != null && locations.length > 0) { 293 updatedLocations = new String[locations.length + 1]; 294 updatedLocations[0] = ref; 295 System.arraycopy(locations, 0, updatedLocations, 1, locations.length); 296 } else { 297 updatedLocations = new String[]{ref}; 298 } 299 pc.setLocations(updatedLocations); 300 } else if (beans.size() > 1) { 301 LOG.warn("Cannot bridge Camel and Spring property placeholders, as exact only 1 bean of type BridgePropertyPlaceholderConfigurer" 302 + " must be defined, was {} beans defined.", beans.size()); 303 } 304 } 305 306 public void onApplicationEvent(ApplicationEvent event) { 307 // From Spring 3.0.1, The BeanFactory applicationEventListener 308 // and Bean's applicationEventListener will be called, 309 // So we just delegate the onApplicationEvent call here. 310 311 SpringCamelContext context = getContext(false); 312 if (context != null) { 313 // we need to defer setting up routes until Spring has done all its dependency injection 314 // which is only guaranteed to be done when it emits the ContextRefreshedEvent event. 315 if (event instanceof ContextRefreshedEvent) { 316 try { 317 setupRoutes(); 318 } catch (Exception e) { 319 throw wrapRuntimeCamelException(e); 320 } 321 } 322 // let the spring camel context handle the events 323 context.onApplicationEvent(event); 324 } else { 325 LOG.debug("Publishing spring-event: {}", event); 326 327 if (event instanceof ContextRefreshedEvent) { 328 // now lets start the CamelContext so that all its possible 329 // dependencies are initialized 330 try { 331 // we need to defer setting up routes until Spring has done all its dependency injection 332 // which is only guaranteed to be done when it emits the ContextRefreshedEvent event. 333 setupRoutes(); 334 LOG.trace("Starting the context now"); 335 getContext().start(); 336 } catch (Exception e) { 337 throw wrapRuntimeCamelException(e); 338 } 339 } 340 } 341 } 342 343 // Properties 344 // ------------------------------------------------------------------------- 345 346 public ApplicationContext getApplicationContext() { 347 if (applicationContext == null) { 348 throw new IllegalArgumentException("No applicationContext has been injected!"); 349 } 350 return applicationContext; 351 } 352 353 public void setApplicationContext(ApplicationContext applicationContext) { 354 this.applicationContext = applicationContext; 355 } 356 357 public void setBeanPostProcessor(BeanPostProcessor postProcessor) { 358 this.beanPostProcessor = postProcessor; 359 } 360 361 public BeanPostProcessor getBeanPostProcessor() { 362 return beanPostProcessor; 363 } 364 365 // Implementation methods 366 // ------------------------------------------------------------------------- 367 368 /** 369 * Create the context 370 */ 371 protected SpringCamelContext createContext() { 372 SpringCamelContext ctx = newCamelContext(); 373 ctx.setName(getId()); 374 return ctx; 375 } 376 377 protected SpringCamelContext newCamelContext() { 378 return new SpringCamelContext(getApplicationContext()); 379 } 380 381 public SpringCamelContext getContext(boolean create) { 382 if (context == null && create) { 383 context = createContext(); 384 } 385 return context; 386 } 387 388 public void setContext(SpringCamelContext context) { 389 this.context = context; 390 } 391 392 public List<RouteDefinition> getRoutes() { 393 return routes; 394 } 395 396 public void setRoutes(List<RouteDefinition> routes) { 397 this.routes = routes; 398 } 399 400 public List<CamelEndpointFactoryBean> getEndpoints() { 401 return endpoints; 402 } 403 404 public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() { 405 return redeliveryPolicies; 406 } 407 408 public List<InterceptDefinition> getIntercepts() { 409 return intercepts; 410 } 411 412 public void setIntercepts(List<InterceptDefinition> intercepts) { 413 this.intercepts = intercepts; 414 } 415 416 public List<InterceptFromDefinition> getInterceptFroms() { 417 return interceptFroms; 418 } 419 420 public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) { 421 this.interceptFroms = interceptFroms; 422 } 423 424 public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() { 425 return interceptSendToEndpoints; 426 } 427 428 public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) { 429 this.interceptSendToEndpoints = interceptSendToEndpoints; 430 } 431 432 public PropertiesDefinition getProperties() { 433 return properties; 434 } 435 436 public void setProperties(PropertiesDefinition properties) { 437 this.properties = properties; 438 } 439 440 public String[] getPackages() { 441 return packages; 442 } 443 444 /** 445 * Sets the package names to be recursively searched for Java classes which 446 * extend {@link org.apache.camel.builder.RouteBuilder} to be auto-wired up to the 447 * {@link CamelContext} as a route. Note that classes are excluded if 448 * they are specifically configured in the spring.xml 449 * <p/> 450 * A more advanced configuration can be done using {@link #setPackageScan(org.apache.camel.model.PackageScanDefinition)} 451 * 452 * @param packages the package names which are recursively searched 453 * @see #setPackageScan(org.apache.camel.model.PackageScanDefinition) 454 */ 455 public void setPackages(String[] packages) { 456 this.packages = packages; 457 } 458 459 public PackageScanDefinition getPackageScan() { 460 return packageScan; 461 } 462 463 /** 464 * Sets the package scanning information. Package scanning allows for the 465 * automatic discovery of certain camel classes at runtime for inclusion 466 * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations 467 * 468 * @param packageScan the package scan 469 */ 470 public void setPackageScan(PackageScanDefinition packageScan) { 471 this.packageScan = packageScan; 472 } 473 474 public ContextScanDefinition getContextScan() { 475 return contextScan; 476 } 477 478 /** 479 * Sets the context scanning (eg Spring's ApplicationContext) information. 480 * Context scanning allows for the automatic discovery of Camel routes runtime for inclusion 481 * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations 482 * 483 * @param contextScan the context scan 484 */ 485 public void setContextScan(ContextScanDefinition contextScan) { 486 this.contextScan = contextScan; 487 } 488 489 public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() { 490 return camelPropertyPlaceholder; 491 } 492 493 public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) { 494 this.camelPropertyPlaceholder = camelPropertyPlaceholder; 495 } 496 497 public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() { 498 return camelStreamCachingStrategy; 499 } 500 501 public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) { 502 this.camelStreamCachingStrategy = camelStreamCachingStrategy; 503 } 504 505 public void setCamelJMXAgent(CamelJMXAgentDefinition agent) { 506 camelJMXAgent = agent; 507 } 508 509 public String getTrace() { 510 return trace; 511 } 512 513 public void setTrace(String trace) { 514 this.trace = trace; 515 } 516 517 public String getMessageHistory() { 518 return messageHistory; 519 } 520 521 public void setMessageHistory(String messageHistory) { 522 this.messageHistory = messageHistory; 523 } 524 525 public String getStreamCache() { 526 return streamCache; 527 } 528 529 public void setStreamCache(String streamCache) { 530 this.streamCache = streamCache; 531 } 532 533 public String getDelayer() { 534 return delayer; 535 } 536 537 public void setDelayer(String delayer) { 538 this.delayer = delayer; 539 } 540 541 public String getHandleFault() { 542 return handleFault; 543 } 544 545 public void setHandleFault(String handleFault) { 546 this.handleFault = handleFault; 547 } 548 549 public String getAutoStartup() { 550 return autoStartup; 551 } 552 553 public void setAutoStartup(String autoStartup) { 554 this.autoStartup = autoStartup; 555 } 556 557 public String getShutdownEager() { 558 return shutdownEager; 559 } 560 561 public void setShutdownEager(String shutdownEager) { 562 this.shutdownEager = shutdownEager; 563 } 564 565 public String getUseMDCLogging() { 566 return useMDCLogging; 567 } 568 569 public void setUseMDCLogging(String useMDCLogging) { 570 this.useMDCLogging = useMDCLogging; 571 } 572 573 public String getUseBreadcrumb() { 574 return useBreadcrumb; 575 } 576 577 public void setUseBreadcrumb(String useBreadcrumb) { 578 this.useBreadcrumb = useBreadcrumb; 579 } 580 581 public String getAllowUseOriginalMessage() { 582 return allowUseOriginalMessage; 583 } 584 585 public void setAllowUseOriginalMessage(String allowUseOriginalMessage) { 586 this.allowUseOriginalMessage = allowUseOriginalMessage; 587 } 588 589 public String getRuntimeEndpointRegistryEnabled() { 590 return runtimeEndpointRegistryEnabled; 591 } 592 593 public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) { 594 this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled; 595 } 596 597 public String getManagementNamePattern() { 598 return managementNamePattern; 599 } 600 601 public void setManagementNamePattern(String managementNamePattern) { 602 this.managementNamePattern = managementNamePattern; 603 } 604 605 public String getThreadNamePattern() { 606 return threadNamePattern; 607 } 608 609 public void setThreadNamePattern(String threadNamePattern) { 610 this.threadNamePattern = threadNamePattern; 611 } 612 613 @Deprecated 614 public Boolean getLazyLoadTypeConverters() { 615 return lazyLoadTypeConverters; 616 } 617 618 @Deprecated 619 public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) { 620 this.lazyLoadTypeConverters = lazyLoadTypeConverters; 621 } 622 623 public Boolean getTypeConverterStatisticsEnabled() { 624 return typeConverterStatisticsEnabled; 625 } 626 627 public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) { 628 this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled; 629 } 630 631 public CamelJMXAgentDefinition getCamelJMXAgent() { 632 return camelJMXAgent; 633 } 634 635 public List<RouteBuilderDefinition> getBuilderRefs() { 636 return builderRefs; 637 } 638 639 public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) { 640 this.builderRefs = builderRefs; 641 } 642 643 public List<RouteContextRefDefinition> getRouteRefs() { 644 return routeRefs; 645 } 646 647 public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) { 648 this.routeRefs = routeRefs; 649 } 650 651 public String getErrorHandlerRef() { 652 return errorHandlerRef; 653 } 654 655 /** 656 * Sets the name of the error handler object used to default the error handling strategy 657 * 658 * @param errorHandlerRef the Spring bean ref of the error handler 659 */ 660 public void setErrorHandlerRef(String errorHandlerRef) { 661 this.errorHandlerRef = errorHandlerRef; 662 } 663 664 public void setDataFormats(DataFormatsDefinition dataFormats) { 665 this.dataFormats = dataFormats; 666 } 667 668 public DataFormatsDefinition getDataFormats() { 669 return dataFormats; 670 } 671 672 public void setOnExceptions(List<OnExceptionDefinition> onExceptions) { 673 this.onExceptions = onExceptions; 674 } 675 676 public List<OnExceptionDefinition> getOnExceptions() { 677 return onExceptions; 678 } 679 680 public List<OnCompletionDefinition> getOnCompletions() { 681 return onCompletions; 682 } 683 684 public void setOnCompletions(List<OnCompletionDefinition> onCompletions) { 685 this.onCompletions = onCompletions; 686 } 687 688 public ShutdownRoute getShutdownRoute() { 689 return shutdownRoute; 690 } 691 692 public void setShutdownRoute(ShutdownRoute shutdownRoute) { 693 this.shutdownRoute = shutdownRoute; 694 } 695 696 public ShutdownRunningTask getShutdownRunningTask() { 697 return shutdownRunningTask; 698 } 699 700 public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) { 701 this.shutdownRunningTask = shutdownRunningTask; 702 } 703 704 public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() { 705 return threadPoolProfiles; 706 } 707 708 public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) { 709 this.threadPoolProfiles = threadPoolProfiles; 710 } 711 712 public String getDependsOn() { 713 return dependsOn; 714 } 715 716 public void setDependsOn(String dependsOn) { 717 this.dependsOn = dependsOn; 718 } 719 720 public boolean isImplicitId() { 721 return implicitId; 722 } 723 724 public void setImplicitId(boolean flag) { 725 implicitId = flag; 726 } 727 728}