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