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