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