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