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;
022
023import javax.xml.bind.annotation.XmlAccessType;
024import javax.xml.bind.annotation.XmlAccessorType;
025import javax.xml.bind.annotation.XmlAttribute;
026import javax.xml.bind.annotation.XmlElement;
027import javax.xml.bind.annotation.XmlElements;
028import javax.xml.bind.annotation.XmlRootElement;
029import javax.xml.bind.annotation.XmlTransient;
030
031import org.apache.camel.CamelContext;
032import org.apache.camel.LoggingLevel;
033import org.apache.camel.RoutesBuilder;
034import org.apache.camel.RuntimeCamelException;
035import org.apache.camel.ShutdownRoute;
036import org.apache.camel.ShutdownRunningTask;
037import org.apache.camel.TypeConverterExists;
038import org.apache.camel.builder.RouteBuilder;
039import org.apache.camel.component.properties.PropertiesComponent;
040import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
041import org.apache.camel.core.xml.AbstractCamelFactoryBean;
042import org.apache.camel.core.xml.CamelJMXAgentDefinition;
043import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
044import org.apache.camel.core.xml.CamelProxyFactoryDefinition;
045import org.apache.camel.core.xml.CamelRouteControllerDefinition;
046import org.apache.camel.core.xml.CamelServiceExporterDefinition;
047import org.apache.camel.core.xml.CamelStreamCachingStrategyDefinition;
048import org.apache.camel.model.ContextScanDefinition;
049import org.apache.camel.model.FaultToleranceConfigurationDefinition;
050import org.apache.camel.model.GlobalOptionsDefinition;
051import org.apache.camel.model.HystrixConfigurationDefinition;
052import org.apache.camel.model.InterceptDefinition;
053import org.apache.camel.model.InterceptFromDefinition;
054import org.apache.camel.model.InterceptSendToEndpointDefinition;
055import org.apache.camel.model.OnCompletionDefinition;
056import org.apache.camel.model.OnExceptionDefinition;
057import org.apache.camel.model.PackageScanDefinition;
058import org.apache.camel.model.Resilience4jConfigurationDefinition;
059import org.apache.camel.model.RestContextRefDefinition;
060import org.apache.camel.model.RouteBuilderDefinition;
061import org.apache.camel.model.RouteContextRefDefinition;
062import org.apache.camel.model.RouteDefinition;
063import org.apache.camel.model.RouteTemplateContextRefDefinition;
064import org.apache.camel.model.RouteTemplateDefinition;
065import org.apache.camel.model.ThreadPoolProfileDefinition;
066import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
067import org.apache.camel.model.dataformat.DataFormatsDefinition;
068import org.apache.camel.model.rest.RestConfigurationDefinition;
069import org.apache.camel.model.rest.RestDefinition;
070import org.apache.camel.model.transformer.TransformersDefinition;
071import org.apache.camel.model.validator.ValidatorsDefinition;
072import org.apache.camel.spi.Metadata;
073import org.apache.camel.spi.PackageScanFilter;
074import org.apache.camel.spi.Registry;
075import org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer;
076import org.apache.camel.spring.spi.XmlCamelContextConfigurer;
077import org.apache.camel.support.CamelContextHelper;
078import org.apache.camel.util.StopWatch;
079import org.slf4j.Logger;
080import org.slf4j.LoggerFactory;
081import org.springframework.beans.factory.DisposableBean;
082import org.springframework.beans.factory.FactoryBean;
083import org.springframework.beans.factory.InitializingBean;
084import org.springframework.beans.factory.config.BeanPostProcessor;
085import org.springframework.context.ApplicationContext;
086import org.springframework.context.ApplicationContextAware;
087import org.springframework.context.ApplicationListener;
088import org.springframework.context.Lifecycle;
089import org.springframework.context.Phased;
090import org.springframework.context.event.ContextRefreshedEvent;
091import org.springframework.core.Ordered;
092
093import static org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException;
094
095/**
096 * CamelContext using XML configuration.
097 */
098@Metadata(label = "spring,configuration")
099@XmlRootElement(name = "camelContext")
100@XmlAccessorType(XmlAccessType.FIELD)
101public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<SpringCamelContext>
102        implements FactoryBean<SpringCamelContext>, InitializingBean, DisposableBean, ApplicationContextAware, Lifecycle,
103        Phased, ApplicationListener<ContextRefreshedEvent>, Ordered {
104
105    private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class);
106
107    @XmlAttribute(name = "depends-on")
108    @Metadata(displayName = "Depends On")
109    private String dependsOn;
110    @XmlAttribute
111    private String trace;
112    @XmlAttribute
113    private String backlogTrace;
114    @XmlAttribute
115    private String tracePattern;
116    @XmlAttribute
117    private String debug;
118    @XmlAttribute
119    @Metadata(defaultValue = "false")
120    private String messageHistory;
121    @XmlAttribute
122    @Metadata(defaultValue = "false")
123    private String logMask;
124    @XmlAttribute
125    private String logExhaustedMessageBody;
126    @XmlAttribute
127    private String streamCache;
128    @XmlAttribute
129    private String delayer;
130    @XmlAttribute
131    private String errorHandlerRef;
132    @XmlAttribute
133    @Metadata(defaultValue = "true")
134    private String autoStartup;
135    @XmlAttribute
136    @Metadata(defaultValue = "true")
137    private String shutdownEager;
138    @XmlAttribute
139    @Metadata(displayName = "Use MDC Logging")
140    private String useMDCLogging;
141    @XmlAttribute
142    @Metadata(displayName = "MDC Logging Keys Pattern")
143    private String mdcLoggingKeysPattern;
144    @XmlAttribute
145    private String useDataType;
146    @XmlAttribute
147    private String useBreadcrumb;
148    @XmlAttribute
149    @Metadata(defaultValue = "true")
150    private String beanPostProcessorEnabled;
151    @XmlAttribute
152    private String allowUseOriginalMessage;
153    @XmlAttribute
154    private String caseInsensitiveHeaders;
155    @XmlAttribute
156    private String runtimeEndpointRegistryEnabled;
157    @XmlAttribute
158    @Metadata(defaultValue = "#name#")
159    private String managementNamePattern;
160    @XmlAttribute
161    @Metadata(defaultValue = "Camel (#camelId#) thread ##counter# - #name#")
162    private String threadNamePattern;
163    @XmlAttribute
164    @Metadata(defaultValue = "Default")
165    private ShutdownRoute shutdownRoute;
166    @XmlAttribute
167    @Metadata(defaultValue = "CompleteCurrentTaskOnly")
168    private ShutdownRunningTask shutdownRunningTask;
169    @XmlAttribute
170    @Metadata(defaultValue = "true")
171    private String loadTypeConverters;
172    @XmlAttribute
173    private String typeConverterStatisticsEnabled;
174    @XmlAttribute
175    private String inflightRepositoryBrowseEnabled;
176    @XmlAttribute
177    @Metadata(defaultValue = "Override")
178    private TypeConverterExists typeConverterExists;
179    @XmlAttribute
180    @Metadata(defaultValue = "WARN")
181    private LoggingLevel typeConverterExistsLoggingLevel;
182    @XmlElement(name = "globalOptions")
183    private GlobalOptionsDefinition globalOptions;
184    @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class)
185    private CamelPropertyPlaceholderDefinition camelPropertyPlaceholder;
186    @XmlElement(name = "package")
187    private String[] packages = {};
188    @XmlElement(name = "packageScan", type = PackageScanDefinition.class)
189    private PackageScanDefinition packageScan;
190    @XmlElement(name = "contextScan", type = ContextScanDefinition.class)
191    private ContextScanDefinition contextScan;
192    @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class)
193    private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy;
194    @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class)
195    @Metadata(displayName = "JMX Agent")
196    private CamelJMXAgentDefinition camelJMXAgent;
197    @XmlElement(name = "routeController", type = CamelRouteControllerDefinition.class)
198    private CamelRouteControllerDefinition camelRouteController;
199    @XmlElements({
200            @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class),
201            @XmlElement(name = "fluentTemplate", type = CamelFluentProducerTemplateFactoryBean.class),
202            @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class) })
203    private List<AbstractCamelFactoryBean<?>> beansFactory;
204    @XmlElements({
205            @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class),
206            @XmlElement(name = "export", type = CamelServiceExporterDefinition.class),
207            @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class) })
208    private List<?> beans;
209    @XmlElement(name = "defaultServiceCallConfiguration")
210    private ServiceCallConfigurationDefinition defaultServiceCallConfiguration;
211    @XmlElement(name = "serviceCallConfiguration", type = ServiceCallConfigurationDefinition.class)
212    private List<ServiceCallConfigurationDefinition> serviceCallConfigurations;
213    @XmlElement(name = "defaultHystrixConfiguration")
214    private HystrixConfigurationDefinition defaultHystrixConfiguration;
215    @XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class)
216    private List<HystrixConfigurationDefinition> hystrixConfigurations;
217    @XmlElement(name = "defaultResilience4jConfiguration")
218    private Resilience4jConfigurationDefinition defaultResilience4jConfiguration;
219    @XmlElement(name = "resilience4jConfiguration", type = Resilience4jConfigurationDefinition.class)
220    private List<Resilience4jConfigurationDefinition> resilience4jConfigurations;
221    @XmlElement(name = "defaultFaultToleranceConfiguration")
222    private FaultToleranceConfigurationDefinition defaultFaultToleranceConfiguration;
223    @XmlElement(name = "faultToleranceConfiguration", type = Resilience4jConfigurationDefinition.class)
224    private List<FaultToleranceConfigurationDefinition> faultToleranceConfigurations;
225    @XmlElement(name = "routeTemplateContextRef")
226    private List<RouteTemplateContextRefDefinition> routeTemplateRefs = new ArrayList<>();
227    @XmlElement(name = "routeBuilder")
228    private List<RouteBuilderDefinition> builderRefs = new ArrayList<>();
229    @XmlElement(name = "routeContextRef")
230    private List<RouteContextRefDefinition> routeRefs = new ArrayList<>();
231    @XmlElement(name = "restContextRef")
232    private List<RestContextRefDefinition> restRefs = new ArrayList<>();
233    @XmlElement(name = "threadPoolProfile")
234    private List<ThreadPoolProfileDefinition> threadPoolProfiles;
235    @XmlElement(name = "threadPool")
236    private List<CamelThreadPoolFactoryBean> threadPools;
237    @XmlElement(name = "endpoint")
238    private List<CamelEndpointFactoryBean> endpoints;
239    @XmlElement(name = "dataFormats")
240    private DataFormatsDefinition dataFormats;
241    @XmlElement(name = "transformers")
242    private TransformersDefinition transformers;
243    @XmlElement(name = "validators")
244    private ValidatorsDefinition validators;
245    @XmlElement(name = "redeliveryPolicyProfile")
246    private List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies;
247    @XmlElement(name = "onException")
248    private List<OnExceptionDefinition> onExceptions = new ArrayList<>();
249    @XmlElement(name = "onCompletion")
250    private List<OnCompletionDefinition> onCompletions = new ArrayList<>();
251    @XmlElement(name = "intercept")
252    private List<InterceptDefinition> intercepts = new ArrayList<>();
253    @XmlElement(name = "interceptFrom")
254    private List<InterceptFromDefinition> interceptFroms = new ArrayList<>();
255    @XmlElement(name = "interceptSendToEndpoint")
256    private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<>();
257    @XmlElement(name = "restConfiguration")
258    private RestConfigurationDefinition restConfiguration;
259    @XmlElement(name = "rest")
260    private List<RestDefinition> rests = new ArrayList<>();
261    @XmlElement(name = "routeTemplate")
262    private List<RouteTemplateDefinition> routeTemplates = new ArrayList<>();
263    @XmlElement(name = "route")
264    private List<RouteDefinition> routes = new ArrayList<>();
265    @XmlTransient
266    private SpringCamelContext context;
267    @XmlTransient
268    private ClassLoader contextClassLoaderOnStart;
269    @XmlTransient
270    private ApplicationContext applicationContext;
271    @XmlTransient
272    private BeanPostProcessor beanPostProcessor;
273    @XmlTransient
274    private boolean implicitId;
275
276    @Override
277    public Class<SpringCamelContext> getObjectType() {
278        return SpringCamelContext.class;
279    }
280
281    @Override
282    protected <S> S getBeanForType(Class<S> clazz) {
283        S bean = null;
284        String[] names = getApplicationContext().getBeanNamesForType(clazz, true, true);
285        if (names.length == 1) {
286            bean = getApplicationContext().getBean(names[0], clazz);
287        }
288        if (bean == null) {
289            ApplicationContext parentContext = getApplicationContext().getParent();
290            if (parentContext != null) {
291                names = parentContext.getBeanNamesForType(clazz, true, true);
292                if (names.length == 1) {
293                    bean = parentContext.getBean(names[0], clazz);
294                }
295            }
296        }
297        return bean;
298    }
299
300    @Override
301    protected void findRouteBuildersByPackageScan(String[] packages, PackageScanFilter filter, List<RoutesBuilder> builders)
302            throws Exception {
303        // add filter to class resolver which then will filter
304        getContext().getPackageScanClassResolver().addFilter(filter);
305
306        PackageScanRouteBuilderFinder finder = new PackageScanRouteBuilderFinder(
307                getContext(), packages, getContextClassLoaderOnStart(),
308                getBeanPostProcessor(), getContext().getPackageScanClassResolver());
309        finder.appendBuilders(builders);
310
311        // and remove the filter
312        getContext().getPackageScanClassResolver().removeFilter(filter);
313    }
314
315    @Override
316    protected void findRouteBuildersByContextScan(
317            PackageScanFilter filter, boolean includeNonSingletons, List<RoutesBuilder> builders)
318            throws Exception {
319        ContextScanRouteBuilderFinder finder = new ContextScanRouteBuilderFinder(getContext(), filter, includeNonSingletons);
320        finder.appendBuilders(builders);
321    }
322
323    @Override
324    protected void initBeanPostProcessor(SpringCamelContext context) {
325        if (beanPostProcessor != null) {
326            if (beanPostProcessor instanceof ApplicationContextAware) {
327                ((ApplicationContextAware) beanPostProcessor).setApplicationContext(applicationContext);
328            }
329            if (beanPostProcessor instanceof CamelBeanPostProcessor) {
330                ((CamelBeanPostProcessor) beanPostProcessor).setCamelContext(getContext());
331            }
332            // register the bean post processor on camel context
333            if (beanPostProcessor instanceof org.apache.camel.spi.CamelBeanPostProcessor) {
334                context.setBeanPostProcessor((org.apache.camel.spi.CamelBeanPostProcessor) beanPostProcessor);
335            }
336        }
337    }
338
339    @Override
340    protected void postProcessBeforeInit(RouteBuilder builder) {
341        if (beanPostProcessor != null) {
342            // Inject the annotated resource
343            beanPostProcessor.postProcessBeforeInitialization(builder, builder.toString());
344        }
345    }
346
347    @Override
348    public void afterPropertiesSet() throws Exception {
349        StopWatch watch = new StopWatch();
350
351        super.afterPropertiesSet();
352
353        Boolean shutdownEager = CamelContextHelper.parseBoolean(getContext(), getShutdownEager());
354        if (shutdownEager != null) {
355            LOG.debug("Using shutdownEager: {}", shutdownEager);
356            getContext().setShutdownEager(shutdownEager);
357        }
358
359        LOG.debug("afterPropertiesSet() took {} millis", watch.taken());
360    }
361
362    @Override
363    protected void initCustomRegistry(SpringCamelContext context) {
364        Registry registry = getBeanForType(Registry.class);
365        if (registry != null) {
366            LOG.info("Using custom Registry: {}", registry);
367            context.setRegistry(registry);
368        }
369    }
370
371    @Override
372    protected void initPropertyPlaceholder() throws Exception {
373        super.initPropertyPlaceholder();
374
375        Map<String, BridgePropertyPlaceholderConfigurer> beans
376                = applicationContext.getBeansOfType(BridgePropertyPlaceholderConfigurer.class);
377        if (beans.size() == 1) {
378            // setup properties component that uses this beans
379            BridgePropertyPlaceholderConfigurer configurer = beans.values().iterator().next();
380            String id = beans.keySet().iterator().next();
381            LOG.info("Bridging Camel and Spring property placeholder configurer with id: {}", id);
382
383            // get properties component
384            PropertiesComponent pc = (PropertiesComponent) getContext().getPropertiesComponent();
385            // use the spring system properties mode which has a different value than Camel may have
386            pc.setSystemPropertiesMode(configurer.getSystemPropertiesMode());
387
388            // replace existing resolver with us
389            configurer.setParser(pc.getPropertiesParser());
390            // use the bridge to handle the resolve and parsing
391            pc.setPropertiesParser(configurer);
392            // use the bridge as property source
393            pc.addPropertiesSource(configurer);
394
395        } else if (beans.size() > 1) {
396            LOG.warn(
397                    "Cannot bridge Camel and Spring property placeholders, as exact only 1 bean of type BridgePropertyPlaceholderConfigurer"
398                     + " must be defined, was {} beans defined.",
399                    beans.size());
400        }
401    }
402
403    @Override
404    public void start() {
405        try {
406            setupRoutes();
407        } catch (Exception e) {
408            throw wrapRuntimeCamelException(e);
409        }
410
411        // when the routes are setup we need to start the Camel context
412        context.start();
413    }
414
415    @Override
416    public void stop() {
417        if (context != null) {
418            context.stop();
419        }
420    }
421
422    @Override
423    public boolean isRunning() {
424        return context != null && context.isRunning();
425    }
426
427    @Override
428    public int getPhase() {
429        // the factory starts the context from
430        // onApplicationEvent(ContextRefreshedEvent) so the phase we're
431        // in only influences when the context is to be stopped, and
432        // we want the CamelContext to be first in line to get stopped
433        // if we wanted the phase to be considered while starting, we
434        // would need to implement SmartLifecycle (see
435        // DefaultLifecycleProcessor::startBeans)
436        // we use LOWEST_PRECEDENCE here as this is taken into account
437        // only when stopping and then in reversed order
438        return LOWEST_PRECEDENCE - 1;
439    }
440
441    @Override
442    public int getOrder() {
443        // CamelContextFactoryBean implements Ordered so that it's the 
444        // second to last in ApplicationListener to receive events,
445        // SpringCamelContext should be the last one, this is important
446        // for startup as we want all resources to be ready and all
447        // routes added to the context (see setupRoutes() and
448        // org.apache.camel.spring.boot.RoutesCollector)
449        return LOWEST_PRECEDENCE - 1;
450    }
451
452    @Override
453    public void onApplicationEvent(final ContextRefreshedEvent event) {
454        // start the CamelContext when the Spring ApplicationContext is
455        // done initializing, as the last step in ApplicationContext
456        // being started/refreshed, there could be a race condition with
457        // other ApplicationListeners that react to
458        // ContextRefreshedEvent but this is the best that we can do
459        start();
460    }
461
462    // Properties
463    // -------------------------------------------------------------------------
464
465    public ApplicationContext getApplicationContext() {
466        if (applicationContext == null) {
467            throw new IllegalArgumentException("No applicationContext has been injected!");
468        }
469        return applicationContext;
470    }
471
472    @Override
473    public void setApplicationContext(ApplicationContext applicationContext) {
474        this.applicationContext = applicationContext;
475    }
476
477    public void setBeanPostProcessor(BeanPostProcessor postProcessor) {
478        this.beanPostProcessor = postProcessor;
479    }
480
481    public BeanPostProcessor getBeanPostProcessor() {
482        return beanPostProcessor;
483    }
484
485    // Implementation methods
486    // -------------------------------------------------------------------------
487
488    /**
489     * Create the context
490     */
491    protected SpringCamelContext createContext() {
492        SpringCamelContext ctx = newCamelContext();
493        ctx.setName(getId());
494
495        return ctx;
496    }
497
498    /**
499     * Apply additional configuration to the context
500     */
501    protected void configure(SpringCamelContext ctx) {
502        try {
503            // allow any custom configuration, such as when running in camel-spring-boot
504            if (applicationContext.containsBean("xmlCamelContextConfigurer")) {
505                XmlCamelContextConfigurer configurer
506                        = applicationContext.getBean("xmlCamelContextConfigurer", XmlCamelContextConfigurer.class);
507                if (configurer != null) {
508                    configurer.configure(applicationContext, ctx);
509                }
510            }
511        } catch (Exception e) {
512            // error during configuration
513            throw RuntimeCamelException.wrapRuntimeCamelException(e);
514        }
515    }
516
517    protected SpringCamelContext newCamelContext() {
518        return new SpringCamelContext(getApplicationContext());
519    }
520
521    @Override
522    public SpringCamelContext getContext(boolean create) {
523        if (context == null && create) {
524            context = createContext();
525            configure(context);
526            context.build();
527        }
528        return context;
529    }
530
531    public void setContext(SpringCamelContext context) {
532        this.context = context;
533    }
534
535    @Override
536    public List<RouteDefinition> getRoutes() {
537        return routes;
538    }
539
540    /**
541     * Contains the Camel routes
542     */
543    @Override
544    public void setRoutes(List<RouteDefinition> routes) {
545        this.routes = routes;
546    }
547
548    public List<RouteTemplateDefinition> getRouteTemplates() {
549        return routeTemplates;
550    }
551
552    /**
553     * Contains the Camel route templates
554     */
555    public void setRouteTemplates(List<RouteTemplateDefinition> routeTemplates) {
556        this.routeTemplates = routeTemplates;
557    }
558
559    @Override
560    public List<RestDefinition> getRests() {
561        return rests;
562    }
563
564    /**
565     * Contains the rest services defined using the rest-dsl
566     */
567    @Override
568    public void setRests(List<RestDefinition> rests) {
569        this.rests = rests;
570    }
571
572    @Override
573    public RestConfigurationDefinition getRestConfiguration() {
574        return restConfiguration;
575    }
576
577    /**
578     * Configuration for rest-dsl
579     */
580    public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
581        this.restConfiguration = restConfiguration;
582    }
583
584    @Override
585    public List<CamelEndpointFactoryBean> getEndpoints() {
586        return endpoints;
587    }
588
589    /**
590     * Configuration of endpoints
591     */
592    public void setEndpoints(List<CamelEndpointFactoryBean> endpoints) {
593        this.endpoints = endpoints;
594    }
595
596    @Override
597    public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() {
598        return redeliveryPolicies;
599    }
600
601    @Override
602    public List<InterceptDefinition> getIntercepts() {
603        return intercepts;
604    }
605
606    /**
607     * Configuration of interceptors.
608     */
609    public void setIntercepts(List<InterceptDefinition> intercepts) {
610        this.intercepts = intercepts;
611    }
612
613    @Override
614    public List<InterceptFromDefinition> getInterceptFroms() {
615        return interceptFroms;
616    }
617
618    /**
619     * Configuration of interceptors that triggers from the beginning of routes.
620     */
621    public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) {
622        this.interceptFroms = interceptFroms;
623    }
624
625    @Override
626    public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() {
627        return interceptSendToEndpoints;
628    }
629
630    /**
631     * Configuration of interceptors that triggers sending messages to endpoints.
632     */
633    public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) {
634        this.interceptSendToEndpoints = interceptSendToEndpoints;
635    }
636
637    @Override
638    public GlobalOptionsDefinition getGlobalOptions() {
639        return globalOptions;
640    }
641
642    /**
643     * Configuration of CamelContext properties such as limit of debug logging and other general options.
644     */
645    public void setGlobalOptions(GlobalOptionsDefinition globalOptions) {
646        this.globalOptions = globalOptions;
647    }
648
649    @Override
650    public String[] getPackages() {
651        return packages;
652    }
653
654    /**
655     * Sets the package names to be recursively searched for Java classes which extend
656     * {@link org.apache.camel.builder.RouteBuilder} to be auto-wired up to the {@link CamelContext} as a route. Note
657     * that classes are excluded if they are specifically configured in the spring.xml
658     * <p/>
659     * A more advanced configuration can be done using
660     * {@link #setPackageScan(org.apache.camel.model.PackageScanDefinition)}
661     *
662     * @param packages the package names which are recursively searched
663     * @see            #setPackageScan(org.apache.camel.model.PackageScanDefinition)
664     */
665    public void setPackages(String[] packages) {
666        this.packages = packages;
667    }
668
669    @Override
670    public PackageScanDefinition getPackageScan() {
671        return packageScan;
672    }
673
674    /**
675     * Sets the package scanning information. Package scanning allows for the automatic discovery of certain camel
676     * classes at runtime for inclusion e.g. {@link org.apache.camel.builder.RouteBuilder} implementations
677     *
678     * @param packageScan the package scan
679     */
680    @Override
681    public void setPackageScan(PackageScanDefinition packageScan) {
682        this.packageScan = packageScan;
683    }
684
685    @Override
686    public ContextScanDefinition getContextScan() {
687        return contextScan;
688    }
689
690    /**
691     * Sets the context scanning (eg Spring's ApplicationContext) information. Context scanning allows for the automatic
692     * discovery of Camel routes runtime for inclusion e.g. {@link org.apache.camel.builder.RouteBuilder}
693     * implementations
694     *
695     * @param contextScan the context scan
696     */
697    @Override
698    public void setContextScan(ContextScanDefinition contextScan) {
699        this.contextScan = contextScan;
700    }
701
702    @Override
703    public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() {
704        return camelPropertyPlaceholder;
705    }
706
707    /**
708     * Configuration of property placeholder
709     */
710    public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) {
711        this.camelPropertyPlaceholder = camelPropertyPlaceholder;
712    }
713
714    @Override
715    public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() {
716        return camelStreamCachingStrategy;
717    }
718
719    /**
720     * Configuration of stream caching.
721     */
722    public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) {
723        this.camelStreamCachingStrategy = camelStreamCachingStrategy;
724    }
725
726    @Override
727    public CamelRouteControllerDefinition getCamelRouteController() {
728        return camelRouteController;
729    }
730
731    /**
732     * Configuration of route controller.
733     */
734    public void setCamelRouteController(CamelRouteControllerDefinition camelRouteController) {
735        this.camelRouteController = camelRouteController;
736    }
737
738    /**
739     * Configuration of JMX Agent.
740     */
741    public void setCamelJMXAgent(CamelJMXAgentDefinition agent) {
742        camelJMXAgent = agent;
743    }
744
745    @Override
746    public String getTrace() {
747        return trace;
748    }
749
750    /**
751     * Sets whether tracing is enabled or not.
752     *
753     * To use tracing then this must be enabled on startup to be installed in the CamelContext.
754     */
755    public void setTrace(String trace) {
756        this.trace = trace;
757    }
758
759    @Override
760    public String getBacklogTrace() {
761        return backlogTrace;
762    }
763
764    /**
765     * Sets whether backlog tracing is enabled or not.
766     *
767     * To use backlog tracing then this must be enabled on startup to be installed in the CamelContext.
768     */
769    public void setBacklogTrace(String backlogTrace) {
770        this.backlogTrace = backlogTrace;
771    }
772
773    @Override
774    public String getDebug() {
775        return debug;
776    }
777
778    /**
779     * Sets whether debugging is enabled or not.
780     *
781     * To use debugging then this must be enabled on startup to be installed in the CamelContext.
782     */
783    public void setDebug(String debug) {
784        this.debug = debug;
785    }
786
787    @Override
788    public String getTracePattern() {
789        return tracePattern;
790    }
791
792    /**
793     * Tracing pattern to match which node EIPs to trace. For example to match all To EIP nodes, use to*. The pattern
794     * matches by node and route id's Multiple patterns can be separated by comma.
795     */
796    public void setTracePattern(String tracePattern) {
797        this.tracePattern = tracePattern;
798    }
799
800    @Override
801    public String getMessageHistory() {
802        return messageHistory;
803    }
804
805    /**
806     * Sets whether message history is enabled or not.
807     */
808    public void setMessageHistory(String messageHistory) {
809        this.messageHistory = messageHistory;
810    }
811
812    @Override
813    public String getLogMask() {
814        return logMask;
815    }
816
817    /**
818     * Sets whether security mask for Logging is enabled or not.
819     */
820    public void setLogMask(String logMask) {
821        this.logMask = logMask;
822    }
823
824    @Override
825    public String getLogExhaustedMessageBody() {
826        return logExhaustedMessageBody;
827    }
828
829    /**
830     * Sets whether to log exhausted message body with message history.
831     */
832    public void setLogExhaustedMessageBody(String logExhaustedMessageBody) {
833        this.logExhaustedMessageBody = logExhaustedMessageBody;
834    }
835
836    @Override
837    public String getStreamCache() {
838        return streamCache;
839    }
840
841    /**
842     * Sets whether stream caching is enabled or not.
843     */
844    public void setStreamCache(String streamCache) {
845        this.streamCache = streamCache;
846    }
847
848    @Override
849    public String getDelayer() {
850        return delayer;
851    }
852
853    /**
854     * Sets a delay value in millis that a message is delayed at every step it takes in the route path, slowing the
855     * process down to better observe what is occurring
856     */
857    public void setDelayer(String delayer) {
858        this.delayer = delayer;
859    }
860
861    @Override
862    public String getAutoStartup() {
863        return autoStartup;
864    }
865
866    /**
867     * Sets whether the object should automatically start when Camel starts.
868     * <p/>
869     * <b>Important:</b> Currently only routes can be disabled, as {@link CamelContext}s are always started. <br/>
870     * <b>Note:</b> When setting auto startup <tt>false</tt> on {@link CamelContext} then that takes precedence and
871     * <i>no</i> routes is started. You would need to start {@link CamelContext} explicit using the
872     * {@link org.apache.camel.CamelContext#start()} method, to start the context, and then you would need to start the
873     * routes manually using {@link org.apache.camel.spi.RouteController#startRoute(String)}.
874     */
875    public void setAutoStartup(String autoStartup) {
876        this.autoStartup = autoStartup;
877    }
878
879    public String getShutdownEager() {
880        return shutdownEager;
881    }
882
883    /**
884     * Whether to shutdown CamelContext eager when Spring is shutting down. This ensure a cleaner shutdown of Camel, as
885     * dependent bean's are not shutdown at this moment. The bean's will then be shutdown after camelContext.
886     */
887    public void setShutdownEager(String shutdownEager) {
888        this.shutdownEager = shutdownEager;
889    }
890
891    @Override
892    public String getUseMDCLogging() {
893        return useMDCLogging;
894    }
895
896    /**
897     * Set whether <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> is enabled.
898     */
899    public void setUseMDCLogging(String useMDCLogging) {
900        this.useMDCLogging = useMDCLogging;
901    }
902
903    public String getMDCLoggingKeysPattern() {
904        return mdcLoggingKeysPattern;
905    }
906
907    /**
908     * Sets the pattern used for determine which custom MDC keys to propagate during message routing when the routing
909     * engine continues routing asynchronously for the given message. Setting this pattern to * will propagate all
910     * custom keys. Or setting the pattern to foo*,bar* will propagate any keys starting with either foo or bar. Notice
911     * that a set of standard Camel MDC keys are always propagated which starts with camel. as key name.
912     *
913     * The match rules are applied in this order (case insensitive):
914     *
915     * 1. exact match, returns true 2. wildcard match (pattern ends with a * and the name starts with the pattern),
916     * returns true 3. regular expression match, returns true 4. otherwise returns false
917     */
918    public void setMDCLoggingKeysPattern(String mdcLoggingKeysPattern) {
919        this.mdcLoggingKeysPattern = mdcLoggingKeysPattern;
920    }
921
922    @Override
923    public String getUseDataType() {
924        return useDataType;
925    }
926
927    /**
928     * Whether to enable using data type on Camel messages.
929     * <p/>
930     * Data type are automatic turned on if:
931     * <ul>
932     * <li>one ore more routes has been explicit configured with input and output types</li>
933     * <li>when using rest-dsl with binding turned on</li>
934     * </ul>
935     * Otherwise data type is default off.
936     */
937    public void setUseDataType(String useDataType) {
938        this.useDataType = useDataType;
939    }
940
941    @Override
942    public String getUseBreadcrumb() {
943        return useBreadcrumb;
944    }
945
946    /**
947     * Set whether breadcrumb is enabled.
948     */
949    public void setUseBreadcrumb(String useBreadcrumb) {
950        this.useBreadcrumb = useBreadcrumb;
951    }
952
953    @Override
954    public String getBeanPostProcessorEnabled() {
955        return beanPostProcessorEnabled;
956    }
957
958    /**
959     * Can be used to turn off bean post processing.
960     *
961     * Be careful to turn this off, as this means that beans that use Camel annotations such as
962     * {@link org.apache.camel.EndpointInject}, {@link org.apache.camel.ProducerTemplate},
963     * {@link org.apache.camel.Produce}, {@link org.apache.camel.Consume} etc will not be injected and in use.
964     *
965     * Turning this off should only be done if you are sure you do not use any of these Camel features.
966     *
967     * Not all runtimes allow turning this off (such as camel-blueprint or camel-cdi with XML).
968     *
969     * The default value is true (enabled).
970     */
971    public void setBeanPostProcessorEnabled(String beanPostProcessorEnabled) {
972        this.beanPostProcessorEnabled = beanPostProcessorEnabled;
973    }
974
975    @Override
976    public String getAllowUseOriginalMessage() {
977        return allowUseOriginalMessage;
978    }
979
980    /**
981     * Sets whether to allow access to the original message from Camel's error handler, or from
982     * {@link org.apache.camel.spi.UnitOfWork#getOriginalInMessage()}.
983     * <p/>
984     * Turning this off can optimize performance, as defensive copy of the original message is not needed.
985     */
986    public void setAllowUseOriginalMessage(String allowUseOriginalMessage) {
987        this.allowUseOriginalMessage = allowUseOriginalMessage;
988    }
989
990    @Override
991    public String getCaseInsensitiveHeaders() {
992        return caseInsensitiveHeaders;
993    }
994
995    /**
996     * Whether to use case sensitive or insensitive headers.
997     *
998     * Important: When using case sensitive (this is set to false). Then the map is case sensitive which means headers
999     * such as content-type and Content-Type are two different keys which can be a problem for some protocols such as
1000     * HTTP based, which rely on case insensitive headers. However case sensitive implementations can yield faster
1001     * performance. Therefore use case sensitive implementation with care.
1002     *
1003     * Default is true.
1004     */
1005    public void setCaseInsensitiveHeaders(String caseInsensitiveHeaders) {
1006        this.caseInsensitiveHeaders = caseInsensitiveHeaders;
1007    }
1008
1009    @Override
1010    public String getRuntimeEndpointRegistryEnabled() {
1011        return runtimeEndpointRegistryEnabled;
1012    }
1013
1014    /**
1015     * Sets whether {@link org.apache.camel.spi.RuntimeEndpointRegistry} is enabled.
1016     */
1017    public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) {
1018        this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled;
1019    }
1020
1021    @Override
1022    public String getInflightRepositoryBrowseEnabled() {
1023        return inflightRepositoryBrowseEnabled;
1024    }
1025
1026    /**
1027     * Sets whether the inflight repository should allow browsing each inflight exchange.
1028     *
1029     * This is by default disabled as there is a very slight performance overhead when enabled.
1030     */
1031    public void setInflightRepositoryBrowseEnabled(String inflightRepositoryBrowseEnabled) {
1032        this.inflightRepositoryBrowseEnabled = inflightRepositoryBrowseEnabled;
1033    }
1034
1035    @Override
1036    public String getManagementNamePattern() {
1037        return managementNamePattern;
1038    }
1039
1040    /**
1041     * The naming pattern for creating the CamelContext management name.
1042     */
1043    public void setManagementNamePattern(String managementNamePattern) {
1044        this.managementNamePattern = managementNamePattern;
1045    }
1046
1047    @Override
1048    public String getThreadNamePattern() {
1049        return threadNamePattern;
1050    }
1051
1052    /**
1053     * Sets the thread name pattern used for creating the full thread name.
1054     * <p/>
1055     * The default pattern is: <tt>Camel (#camelId#) thread ##counter# - #name#</tt>
1056     * <p/>
1057     * Where <tt>#camelId#</tt> is the name of the {@link org.apache.camel.CamelContext} <br/>
1058     * and <tt>#counter#</tt> is a unique incrementing counter. <br/>
1059     * and <tt>#name#</tt> is the regular thread name. <br/>
1060     * You can also use <tt>#longName#</tt> is the long thread name which can includes endpoint parameters etc.
1061     */
1062    public void setThreadNamePattern(String threadNamePattern) {
1063        this.threadNamePattern = threadNamePattern;
1064    }
1065
1066    @Override
1067    public String getLoadTypeConverters() {
1068        return loadTypeConverters;
1069    }
1070
1071    /**
1072     * Sets whether to load custom type converters by scanning classpath. This can be turned off if you are only using
1073     * Camel components that does not provide type converters which is needed at runtime. In such situations setting
1074     * this option to false, can speedup starting Camel.
1075     *
1076     * @param loadTypeConverters whether to load custom type converters.
1077     */
1078    public void setLoadTypeConverters(String loadTypeConverters) {
1079        this.loadTypeConverters = loadTypeConverters;
1080    }
1081
1082    @Override
1083    public String getTypeConverterStatisticsEnabled() {
1084        return typeConverterStatisticsEnabled;
1085    }
1086
1087    /**
1088     * Sets whether or not type converter statistics is enabled.
1089     * <p/>
1090     * By default the type converter utilization statistics is disabled. <b>Notice:</b> If enabled then there is a
1091     * slight performance impact under very heavy load.
1092     * <p/>
1093     * You can enable/disable the statistics at runtime using the
1094     * {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)}
1095     * method, or from JMX on the {@link org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean} mbean.
1096     */
1097    public void setTypeConverterStatisticsEnabled(String typeConverterStatisticsEnabled) {
1098        this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled;
1099    }
1100
1101    @Override
1102    public TypeConverterExists getTypeConverterExists() {
1103        return typeConverterExists;
1104    }
1105
1106    /**
1107     * What should happen when attempting to add a duplicate type converter.
1108     * <p/>
1109     * The default behavior is to override the existing.
1110     */
1111    public void setTypeConverterExists(TypeConverterExists typeConverterExists) {
1112        this.typeConverterExists = typeConverterExists;
1113    }
1114
1115    @Override
1116    public LoggingLevel getTypeConverterExistsLoggingLevel() {
1117        return typeConverterExistsLoggingLevel;
1118    }
1119
1120    /**
1121     * The logging level to use when logging that a type converter already exists when attempting to add a duplicate
1122     * type converter.
1123     * <p/>
1124     * The default logging level is <tt>WARN</tt>
1125     */
1126    public void setTypeConverterExistsLoggingLevel(LoggingLevel typeConverterExistsLoggingLevel) {
1127        this.typeConverterExistsLoggingLevel = typeConverterExistsLoggingLevel;
1128    }
1129
1130    @Override
1131    public CamelJMXAgentDefinition getCamelJMXAgent() {
1132        return camelJMXAgent;
1133    }
1134
1135    @Override
1136    public List<RouteTemplateContextRefDefinition> getRouteTemplateRefs() {
1137        return routeTemplateRefs;
1138    }
1139
1140    /**
1141     * Refers to XML route templates to include as route templates in this CamelContext.
1142     */
1143    public void setRouteTemplateRefs(List<RouteTemplateContextRefDefinition> routeTemplateRefs) {
1144        this.routeTemplateRefs = routeTemplateRefs;
1145    }
1146
1147    @Override
1148    public List<RouteBuilderDefinition> getBuilderRefs() {
1149        return builderRefs;
1150    }
1151
1152    /**
1153     * Refers to Java {@link RouteBuilder} instances to include as routes in this CamelContext.
1154     */
1155    public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) {
1156        this.builderRefs = builderRefs;
1157    }
1158
1159    @Override
1160    public List<RouteContextRefDefinition> getRouteRefs() {
1161        return routeRefs;
1162    }
1163
1164    /**
1165     * Refers to XML routes to include as routes in this CamelContext.
1166     */
1167    public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) {
1168        this.routeRefs = routeRefs;
1169    }
1170
1171    @Override
1172    public List<RestContextRefDefinition> getRestRefs() {
1173        return restRefs;
1174    }
1175
1176    /**
1177     * Refers to XML rest-dsl to include as REST services in this CamelContext.
1178     */
1179    public void setRestRefs(List<RestContextRefDefinition> restRefs) {
1180        this.restRefs = restRefs;
1181    }
1182
1183    @Override
1184    public String getErrorHandlerRef() {
1185        return errorHandlerRef;
1186    }
1187
1188    /**
1189     * Sets the name of the error handler object used to default the error handling strategy
1190     */
1191    public void setErrorHandlerRef(String errorHandlerRef) {
1192        this.errorHandlerRef = errorHandlerRef;
1193    }
1194
1195    /**
1196     * Configuration of data formats.
1197     */
1198    public void setDataFormats(DataFormatsDefinition dataFormats) {
1199        this.dataFormats = dataFormats;
1200    }
1201
1202    @Override
1203    public DataFormatsDefinition getDataFormats() {
1204        return dataFormats;
1205    }
1206
1207    /**
1208     * Configuration of transformers.
1209     */
1210    public void setTransformers(TransformersDefinition transformers) {
1211        this.transformers = transformers;
1212    }
1213
1214    @Override
1215    public TransformersDefinition getTransformers() {
1216        return transformers;
1217    }
1218
1219    /**
1220     * Configuration of validators.
1221     */
1222    public void setValidators(ValidatorsDefinition validators) {
1223        this.validators = validators;
1224    }
1225
1226    @Override
1227    public ValidatorsDefinition getValidators() {
1228        return validators;
1229    }
1230
1231    /**
1232     * Configuration of redelivery settings.
1233     */
1234    public void setRedeliveryPolicies(List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies) {
1235        this.redeliveryPolicies = redeliveryPolicies;
1236    }
1237
1238    @Override
1239    public List<AbstractCamelFactoryBean<?>> getBeansFactory() {
1240        return beansFactory;
1241    }
1242
1243    /**
1244     * Miscellaneous configurations
1245     */
1246    public void setBeansFactory(List<AbstractCamelFactoryBean<?>> beansFactory) {
1247        this.beansFactory = beansFactory;
1248    }
1249
1250    @Override
1251    public List<?> getBeans() {
1252        return beans;
1253    }
1254
1255    /**
1256     * Miscellaneous configurations
1257     */
1258    public void setBeans(List<?> beans) {
1259        this.beans = beans;
1260    }
1261
1262    @Override
1263    public ServiceCallConfigurationDefinition getDefaultServiceCallConfiguration() {
1264        return defaultServiceCallConfiguration;
1265    }
1266
1267    /**
1268     * ServiceCall EIP default configuration
1269     */
1270    public void setDefaultServiceCallConfiguration(ServiceCallConfigurationDefinition defaultServiceCallConfiguration) {
1271        this.defaultServiceCallConfiguration = defaultServiceCallConfiguration;
1272    }
1273
1274    @Override
1275    public List<ServiceCallConfigurationDefinition> getServiceCallConfigurations() {
1276        return serviceCallConfigurations;
1277    }
1278
1279    /**
1280     * ServiceCall EIP configurations
1281     */
1282    public void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> serviceCallConfigurations) {
1283        this.serviceCallConfigurations = serviceCallConfigurations;
1284    }
1285
1286    @Override
1287    public List<HystrixConfigurationDefinition> getHystrixConfigurations() {
1288        return hystrixConfigurations;
1289    }
1290
1291    @Override
1292    public HystrixConfigurationDefinition getDefaultHystrixConfiguration() {
1293        return defaultHystrixConfiguration;
1294    }
1295
1296    /**
1297     * Hystrix EIP default configuration
1298     */
1299    public void setDefaultHystrixConfiguration(HystrixConfigurationDefinition defaultHystrixConfiguration) {
1300        this.defaultHystrixConfiguration = defaultHystrixConfiguration;
1301    }
1302
1303    /**
1304     * Hystrix Circuit Breaker EIP configurations
1305     */
1306    public void setHystrixConfigurations(List<HystrixConfigurationDefinition> hystrixConfigurations) {
1307        this.hystrixConfigurations = hystrixConfigurations;
1308    }
1309
1310    @Override
1311    public Resilience4jConfigurationDefinition getDefaultResilience4jConfiguration() {
1312        return defaultResilience4jConfiguration;
1313    }
1314
1315    /**
1316     * Resilience4j EIP default configuration
1317     */
1318    public void setDefaultResilience4jConfiguration(Resilience4jConfigurationDefinition defaultResilience4jConfiguration) {
1319        this.defaultResilience4jConfiguration = defaultResilience4jConfiguration;
1320    }
1321
1322    @Override
1323    public List<Resilience4jConfigurationDefinition> getResilience4jConfigurations() {
1324        return resilience4jConfigurations;
1325    }
1326
1327    /**
1328     * Resilience4j Circuit Breaker EIP configurations
1329     */
1330    public void setResilience4jConfigurations(List<Resilience4jConfigurationDefinition> resilience4jConfigurations) {
1331        this.resilience4jConfigurations = resilience4jConfigurations;
1332    }
1333
1334    @Override
1335    public FaultToleranceConfigurationDefinition getDefaultFaultToleranceConfiguration() {
1336        return defaultFaultToleranceConfiguration;
1337    }
1338
1339    /**
1340     * MicroProfile Fault Tolerance EIP default configuration
1341     */
1342    public void setDefaultFaultToleranceConfiguration(
1343            FaultToleranceConfigurationDefinition defaultFaultToleranceConfiguration) {
1344        this.defaultFaultToleranceConfiguration = defaultFaultToleranceConfiguration;
1345    }
1346
1347    @Override
1348    public List<FaultToleranceConfigurationDefinition> getFaultToleranceConfigurations() {
1349        return faultToleranceConfigurations;
1350    }
1351
1352    /**
1353     * MicroProfile Circuit Breaker EIP configurations
1354     */
1355    public void setFaultToleranceConfigurations(List<FaultToleranceConfigurationDefinition> faultToleranceConfigurations) {
1356        this.faultToleranceConfigurations = faultToleranceConfigurations;
1357    }
1358
1359    /**
1360     * Configuration of error handlers that triggers on exceptions thrown.
1361     */
1362    public void setOnExceptions(List<OnExceptionDefinition> onExceptions) {
1363        this.onExceptions = onExceptions;
1364    }
1365
1366    @Override
1367    public List<OnExceptionDefinition> getOnExceptions() {
1368        return onExceptions;
1369    }
1370
1371    @Override
1372    public List<OnCompletionDefinition> getOnCompletions() {
1373        return onCompletions;
1374    }
1375
1376    /**
1377     * Configuration of sub routes to run at the completion of routing.
1378     */
1379    public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
1380        this.onCompletions = onCompletions;
1381    }
1382
1383    @Override
1384    public ShutdownRoute getShutdownRoute() {
1385        return shutdownRoute;
1386    }
1387
1388    /**
1389     * Sets the ShutdownRoute option for routes.
1390     */
1391    public void setShutdownRoute(ShutdownRoute shutdownRoute) {
1392        this.shutdownRoute = shutdownRoute;
1393    }
1394
1395    @Override
1396    public ShutdownRunningTask getShutdownRunningTask() {
1397        return shutdownRunningTask;
1398    }
1399
1400    /**
1401     * Sets the ShutdownRunningTask option to use when shutting down a route.
1402     */
1403    public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
1404        this.shutdownRunningTask = shutdownRunningTask;
1405    }
1406
1407    @Override
1408    public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
1409        return threadPoolProfiles;
1410    }
1411
1412    /**
1413     * Configuration of thread pool profiles.
1414     */
1415    public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
1416        this.threadPoolProfiles = threadPoolProfiles;
1417    }
1418
1419    public List<CamelThreadPoolFactoryBean> getThreadPools() {
1420        return threadPools;
1421    }
1422
1423    /**
1424     * Configuration of thread pool
1425     */
1426    public void setThreadPools(List<CamelThreadPoolFactoryBean> threadPools) {
1427        this.threadPools = threadPools;
1428    }
1429
1430    @Override
1431    public String getDependsOn() {
1432        return dependsOn;
1433    }
1434
1435    /**
1436     * List of other bean id's this CamelContext depends up. Multiple bean id's can be separated by comma.
1437     */
1438    public void setDependsOn(String dependsOn) {
1439        this.dependsOn = dependsOn;
1440    }
1441
1442    public boolean isImplicitId() {
1443        return implicitId;
1444    }
1445
1446    public void setImplicitId(boolean flag) {
1447        implicitId = flag;
1448    }
1449}