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