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