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