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 = (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 List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() {
430        return redeliveryPolicies;
431    }
432
433    public List<InterceptDefinition> getIntercepts() {
434        return intercepts;
435    }
436
437    public void setIntercepts(List<InterceptDefinition> intercepts) {
438        this.intercepts = intercepts;
439    }
440
441    public List<InterceptFromDefinition> getInterceptFroms() {
442        return interceptFroms;
443    }
444
445    public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) {
446        this.interceptFroms = interceptFroms;
447    }
448
449    public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() {
450        return interceptSendToEndpoints;
451    }
452
453    public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) {
454        this.interceptSendToEndpoints = interceptSendToEndpoints;
455    }
456
457    public PropertiesDefinition getProperties() {
458        return properties;
459    }
460
461    public void setProperties(PropertiesDefinition properties) {
462        this.properties = properties;
463    }
464
465    public String[] getPackages() {
466        return packages;
467    }
468
469    /**
470     * Sets the package names to be recursively searched for Java classes which
471     * extend {@link org.apache.camel.builder.RouteBuilder} to be auto-wired up to the
472     * {@link CamelContext} as a route. Note that classes are excluded if
473     * they are specifically configured in the spring.xml
474     * <p/>
475     * A more advanced configuration can be done using {@link #setPackageScan(org.apache.camel.model.PackageScanDefinition)}
476     *
477     * @param packages the package names which are recursively searched
478     * @see #setPackageScan(org.apache.camel.model.PackageScanDefinition)
479     */
480    public void setPackages(String[] packages) {
481        this.packages = packages;
482    }
483
484    public PackageScanDefinition getPackageScan() {
485        return packageScan;
486    }
487
488    /**
489     * Sets the package scanning information. Package scanning allows for the
490     * automatic discovery of certain camel classes at runtime for inclusion
491     * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations
492     *
493     * @param packageScan the package scan
494     */
495    public void setPackageScan(PackageScanDefinition packageScan) {
496        this.packageScan = packageScan;
497    }
498
499    public ContextScanDefinition getContextScan() {
500        return contextScan;
501    }
502
503    /**
504     * Sets the context scanning (eg Spring's ApplicationContext) information.
505     * Context scanning allows for the automatic discovery of Camel routes runtime for inclusion
506     * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations
507     *
508     * @param contextScan the context scan
509     */
510    public void setContextScan(ContextScanDefinition contextScan) {
511        this.contextScan = contextScan;
512    }
513
514    public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() {
515        return camelPropertyPlaceholder;
516    }
517
518    public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) {
519        this.camelPropertyPlaceholder = camelPropertyPlaceholder;
520    }
521
522    public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() {
523        return camelStreamCachingStrategy;
524    }
525
526    public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) {
527        this.camelStreamCachingStrategy = camelStreamCachingStrategy;
528    }
529
530    public void setCamelJMXAgent(CamelJMXAgentDefinition agent) {
531        camelJMXAgent = agent;
532    }
533
534    public String getTrace() {
535        return trace;
536    }
537
538    public void setTrace(String trace) {
539        this.trace = trace;
540    }
541
542    public String getMessageHistory() {
543        return messageHistory;
544    }
545
546    public void setMessageHistory(String messageHistory) {
547        this.messageHistory = messageHistory;
548    }
549
550    public String getStreamCache() {
551        return streamCache;
552    }
553
554    public void setStreamCache(String streamCache) {
555        this.streamCache = streamCache;
556    }
557
558    public String getDelayer() {
559        return delayer;
560    }
561
562    public void setDelayer(String delayer) {
563        this.delayer = delayer;
564    }
565
566    public String getHandleFault() {
567        return handleFault;
568    }
569
570    public void setHandleFault(String handleFault) {
571        this.handleFault = handleFault;
572    }
573
574    public String getAutoStartup() {
575        return autoStartup;
576    }
577
578    public void setAutoStartup(String autoStartup) {
579        this.autoStartup = autoStartup;
580    }
581
582    public String getShutdownEager() {
583        return shutdownEager;
584    }
585
586    public void setShutdownEager(String shutdownEager) {
587        this.shutdownEager = shutdownEager;
588    }
589
590    public String getUseMDCLogging() {
591        return useMDCLogging;
592    }
593
594    public void setUseMDCLogging(String useMDCLogging) {
595        this.useMDCLogging = useMDCLogging;
596    }
597
598    public String getUseBreadcrumb() {
599        return useBreadcrumb;
600    }
601
602    public void setUseBreadcrumb(String useBreadcrumb) {
603        this.useBreadcrumb = useBreadcrumb;
604    }
605
606    public String getAllowUseOriginalMessage() {
607        return allowUseOriginalMessage;
608    }
609
610    public void setAllowUseOriginalMessage(String allowUseOriginalMessage) {
611        this.allowUseOriginalMessage = allowUseOriginalMessage;
612    }
613
614    public String getRuntimeEndpointRegistryEnabled() {
615        return runtimeEndpointRegistryEnabled;
616    }
617
618    public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) {
619        this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled;
620    }
621
622    public String getManagementNamePattern() {
623        return managementNamePattern;
624    }
625
626    public void setManagementNamePattern(String managementNamePattern) {
627        this.managementNamePattern = managementNamePattern;
628    }
629
630    public String getThreadNamePattern() {
631        return threadNamePattern;
632    }
633
634    public void setThreadNamePattern(String threadNamePattern) {
635        this.threadNamePattern = threadNamePattern;
636    }
637
638    @Deprecated
639    public Boolean getLazyLoadTypeConverters() {
640        return lazyLoadTypeConverters;
641    }
642
643    @Deprecated
644    public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
645        this.lazyLoadTypeConverters = lazyLoadTypeConverters;
646    }
647
648    public Boolean getTypeConverterStatisticsEnabled() {
649        return typeConverterStatisticsEnabled;
650    }
651
652    public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) {
653        this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled;
654    }
655
656    public CamelJMXAgentDefinition getCamelJMXAgent() {
657        return camelJMXAgent;
658    }
659
660    public List<RouteBuilderDefinition> getBuilderRefs() {
661        return builderRefs;
662    }
663
664    public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) {
665        this.builderRefs = builderRefs;
666    }
667
668    public List<RouteContextRefDefinition> getRouteRefs() {
669        return routeRefs;
670    }
671
672    public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) {
673        this.routeRefs = routeRefs;
674    }
675
676    public List<RestContextRefDefinition> getRestRefs() {
677        return restRefs;
678    }
679
680    public void setRestRefs(List<RestContextRefDefinition> restRefs) {
681        this.restRefs = restRefs;
682    }
683
684    public String getErrorHandlerRef() {
685        return errorHandlerRef;
686    }
687
688    /**
689     * Sets the name of the error handler object used to default the error handling strategy
690     *
691     * @param errorHandlerRef the Spring bean ref of the error handler
692     */
693    public void setErrorHandlerRef(String errorHandlerRef) {
694        this.errorHandlerRef = errorHandlerRef;
695    }
696
697    public void setDataFormats(DataFormatsDefinition dataFormats) {
698        this.dataFormats = dataFormats;
699    }
700
701    public DataFormatsDefinition getDataFormats() {
702        return dataFormats;
703    }
704
705    public void setOnExceptions(List<OnExceptionDefinition> onExceptions) {
706        this.onExceptions = onExceptions;
707    }
708
709    public List<OnExceptionDefinition> getOnExceptions() {
710        return onExceptions;
711    }
712
713    public List<OnCompletionDefinition> getOnCompletions() {
714        return onCompletions;
715    }
716
717    public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
718        this.onCompletions = onCompletions;
719    }
720
721    public ShutdownRoute getShutdownRoute() {
722        return shutdownRoute;
723    }
724
725    public void setShutdownRoute(ShutdownRoute shutdownRoute) {
726        this.shutdownRoute = shutdownRoute;
727    }
728
729    public ShutdownRunningTask getShutdownRunningTask() {
730        return shutdownRunningTask;
731    }
732
733    public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
734        this.shutdownRunningTask = shutdownRunningTask;
735    }
736
737    public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
738        return threadPoolProfiles;
739    }
740
741    public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
742        this.threadPoolProfiles = threadPoolProfiles;
743    }
744
745    public String getDependsOn() {
746        return dependsOn;
747    }
748
749    public void setDependsOn(String dependsOn) {
750        this.dependsOn = dependsOn;
751    }
752    
753    public boolean isImplicitId() {
754        return implicitId;
755    }
756    
757    public void setImplicitId(boolean flag) {
758        implicitId = flag;
759    }
760
761}