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