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.blueprint;
018
019import java.util.ArrayList;
020import java.util.Collection;
021import java.util.List;
022import java.util.Properties;
023
024import javax.xml.bind.annotation.XmlAccessType;
025import javax.xml.bind.annotation.XmlAccessorType;
026import javax.xml.bind.annotation.XmlAttribute;
027import javax.xml.bind.annotation.XmlElement;
028import javax.xml.bind.annotation.XmlElements;
029import javax.xml.bind.annotation.XmlRootElement;
030import javax.xml.bind.annotation.XmlTransient;
031
032import org.apache.aries.blueprint.ExtendedBeanMetadata;
033import org.apache.aries.blueprint.ext.PropertyPlaceholderExt;
034import org.apache.camel.LoggingLevel;
035import org.apache.camel.RoutesBuilder;
036import org.apache.camel.ShutdownRoute;
037import org.apache.camel.ShutdownRunningTask;
038import org.apache.camel.StartupSummaryLevel;
039import org.apache.camel.TypeConverterExists;
040import org.apache.camel.builder.RouteBuilder;
041import org.apache.camel.component.properties.PropertiesComponent;
042import org.apache.camel.core.osgi.OsgiCamelContextPublisher;
043import org.apache.camel.core.osgi.OsgiEventAdminNotifier;
044import org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader;
045import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
046import org.apache.camel.core.xml.AbstractCamelFactoryBean;
047import org.apache.camel.core.xml.CamelJMXAgentDefinition;
048import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
049import org.apache.camel.core.xml.CamelRouteControllerDefinition;
050import org.apache.camel.core.xml.CamelStreamCachingStrategyDefinition;
051import org.apache.camel.model.ContextScanDefinition;
052import org.apache.camel.model.FaultToleranceConfigurationDefinition;
053import org.apache.camel.model.GlobalOptionsDefinition;
054import org.apache.camel.model.InterceptDefinition;
055import org.apache.camel.model.InterceptFromDefinition;
056import org.apache.camel.model.InterceptSendToEndpointDefinition;
057import org.apache.camel.model.OnCompletionDefinition;
058import org.apache.camel.model.OnExceptionDefinition;
059import org.apache.camel.model.PackageScanDefinition;
060import org.apache.camel.model.Resilience4jConfigurationDefinition;
061import org.apache.camel.model.RestContextRefDefinition;
062import org.apache.camel.model.RouteBuilderDefinition;
063import org.apache.camel.model.RouteConfigurationContextRefDefinition;
064import org.apache.camel.model.RouteConfigurationDefinition;
065import org.apache.camel.model.RouteContextRefDefinition;
066import org.apache.camel.model.RouteDefinition;
067import org.apache.camel.model.RouteTemplateContextRefDefinition;
068import org.apache.camel.model.RouteTemplateDefinition;
069import org.apache.camel.model.TemplatedRouteDefinition;
070import org.apache.camel.model.ThreadPoolProfileDefinition;
071import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
072import org.apache.camel.model.dataformat.DataFormatsDefinition;
073import org.apache.camel.model.rest.RestConfigurationDefinition;
074import org.apache.camel.model.rest.RestDefinition;
075import org.apache.camel.model.transformer.TransformersDefinition;
076import org.apache.camel.model.validator.ValidatorsDefinition;
077import org.apache.camel.spi.Metadata;
078import org.apache.camel.spi.PackageScanFilter;
079import org.apache.camel.spi.Registry;
080import org.apache.camel.util.StringHelper;
081import org.osgi.framework.BundleContext;
082import org.osgi.framework.ServiceReference;
083import org.osgi.service.blueprint.container.BlueprintContainer;
084import org.osgi.service.blueprint.reflect.ComponentMetadata;
085import org.slf4j.Logger;
086import org.slf4j.LoggerFactory;
087
088/**
089 * A bean to create and initialize a {@link BlueprintCamelContext} and install
090 * routes either explicitly configured in Blueprint XML or found by searching
091 * the classpath for Java classes which extend {@link RouteBuilder} using the
092 * nested {@link #setPackages(String[])}.
093 */
094@XmlRootElement(name = "camelContext")
095@XmlAccessorType(XmlAccessType.FIELD)
096public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<BlueprintCamelContext> {
097    private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class);
098
099    @XmlAttribute(name = "depends-on")
100    private String dependsOn;
101    @XmlAttribute
102    @Metadata(defaultValue = "Default")
103    private StartupSummaryLevel startupSummaryLevel;
104    @XmlAttribute
105    private String trace;
106    @XmlAttribute
107    private String backlogTrace;
108    @XmlAttribute
109    private String tracePattern;
110    @XmlAttribute
111    private String traceLoggingFormat;
112    @XmlAttribute
113    private String debug;
114    @XmlAttribute
115    private String messageHistory;
116    @XmlAttribute
117    private String sourceLocationEnabled;
118    @XmlAttribute
119    private String logMask;
120    @XmlAttribute
121    private String logExhaustedMessageBody;
122    @XmlAttribute
123    @Metadata(defaultValue = "false")
124    private String streamCache = "false";
125    @XmlAttribute
126    private String delayer;
127    @XmlAttribute
128    private String errorHandlerRef;
129    @XmlAttribute
130    @Metadata(defaultValue = "true")
131    private String autoStartup = "true";
132    @XmlAttribute
133    private String dumpRoutes;
134    @XmlAttribute
135    private String useMDCLogging;
136    @XmlAttribute
137    private String mdcLoggingKeysPattern;
138    @XmlAttribute
139    private String useDataType;
140    @XmlAttribute
141    private String useBreadcrumb;
142    @XmlAttribute @Metadata(defaultValue = "true")
143    private String beanPostProcessorEnabled;
144    @XmlAttribute
145    private String allowUseOriginalMessage;
146    @XmlAttribute
147    private String caseInsensitiveHeaders;
148    @XmlAttribute
149    private String autowiredEnabled;
150    @XmlAttribute
151    private String runtimeEndpointRegistryEnabled;
152    @XmlAttribute
153    private String managementNamePattern;
154    @XmlAttribute
155    private String threadNamePattern;
156    @XmlAttribute
157    @Metadata(defaultValue = "true")
158    private Boolean useBlueprintPropertyResolver;
159    @XmlAttribute
160    private ShutdownRoute shutdownRoute;
161    @XmlAttribute
162    private ShutdownRunningTask shutdownRunningTask;
163    @XmlAttribute
164    private String loadTypeConverters;
165    @XmlAttribute
166    private String typeConverterStatisticsEnabled;
167    @XmlAttribute
168    private String loadHealthChecks;
169    @XmlAttribute
170    private String inflightRepositoryBrowseEnabled;
171    @XmlAttribute
172    private TypeConverterExists typeConverterExists;
173    @XmlAttribute
174    private LoggingLevel typeConverterExistsLoggingLevel;
175    @XmlElement(name = "globalOptions")
176    private GlobalOptionsDefinition globalOptions;
177    @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class)
178    private CamelPropertyPlaceholderDefinition camelPropertyPlaceholder;
179    @XmlElement(name = "package")
180    private String[] packages = {};
181    @XmlElement(name = "packageScan", type = PackageScanDefinition.class)
182    private PackageScanDefinition packageScan;
183    @XmlElement(name = "contextScan", type = ContextScanDefinition.class)
184    private ContextScanDefinition contextScan;
185    @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class)
186    private CamelJMXAgentDefinition camelJMXAgent;
187    @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class)
188    private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy;
189    @XmlElement(name = "routeController", type = CamelRouteControllerDefinition.class)
190    private CamelRouteControllerDefinition camelRouteController;
191    @XmlElements({@XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class),
192                  @XmlElement(name = "fluentTemplate", type = CamelFluentProducerTemplateFactoryBean.class),
193                  @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class), @XmlElement(name = "proxy", type = CamelProxyFactoryBean.class),
194                  @XmlElement(name = "errorHandler", type = CamelErrorHandlerFactoryBean.class)})
195    private List<AbstractCamelFactoryBean<?>> beansFactory;
196    @XmlElement(name = "defaultServiceCallConfiguration")
197    private ServiceCallConfigurationDefinition defaultServiceCallConfiguration;
198    @XmlElement(name = "serviceCallConfiguration", type = ServiceCallConfigurationDefinition.class)
199    private List<ServiceCallConfigurationDefinition> serviceCallConfigurations;
200    @XmlElement(name = "defaultResilience4jConfiguration")
201    private Resilience4jConfigurationDefinition defaultResilience4jConfiguration;
202    @XmlElement(name = "resilience4jConfiguration", type = Resilience4jConfigurationDefinition.class)
203    private List<Resilience4jConfigurationDefinition> resilience4jConfigurations;
204    @XmlElement(name = "defaultFaultToleranceConfiguration")
205    private FaultToleranceConfigurationDefinition defaultFaultToleranceConfiguration;
206    @XmlElement(name = "faultToleranceConfiguration", type = FaultToleranceConfigurationDefinition.class)
207    private List<FaultToleranceConfigurationDefinition> faultToleranceConfigurations;
208    @XmlElement(name = "routeConfigurationContextRef")
209    private List<RouteConfigurationContextRefDefinition> routeConfigurationRefs = new ArrayList<>();
210    @XmlElement(name = "routeTemplateContextRef")
211    private List<RouteTemplateContextRefDefinition> routeTemplateRefs = new ArrayList<>();
212    @XmlElement(name = "routeBuilder")
213    private List<RouteBuilderDefinition> builderRefs = new ArrayList<>();
214    @XmlElement(name = "routeContextRef")
215    private List<RouteContextRefDefinition> routeRefs = new ArrayList<>();
216    @XmlElement(name = "restContextRef")
217    private List<RestContextRefDefinition> restRefs = new ArrayList<>();
218    @XmlElement(name = "threadPoolProfile")
219    private List<ThreadPoolProfileDefinition> threadPoolProfiles;
220    @XmlElement(name = "threadPool")
221    private List<CamelThreadPoolFactoryBean> threadPools;
222    @XmlElement(name = "endpoint")
223    private List<CamelEndpointFactoryBean> endpoints;
224    @XmlElement(name = "dataFormats")
225    private DataFormatsDefinition dataFormats;
226    @XmlElement(name = "transformers")
227    private TransformersDefinition transformers;
228    @XmlElement(name = "validators")
229    private ValidatorsDefinition validators;
230    @XmlElement(name = "redeliveryPolicyProfile")
231    private List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies;
232    @XmlElement(name = "onException")
233    private List<OnExceptionDefinition> onExceptions = new ArrayList<>();
234    @XmlElement(name = "onCompletion")
235    private List<OnCompletionDefinition> onCompletions = new ArrayList<>();
236    @XmlElement(name = "intercept")
237    private List<InterceptDefinition> intercepts = new ArrayList<>();
238    @XmlElement(name = "interceptFrom")
239    private List<InterceptFromDefinition> interceptFroms = new ArrayList<>();
240    @XmlElement(name = "interceptSendToEndpoint")
241    private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<>();
242    @XmlElement(name = "restConfiguration")
243    private RestConfigurationDefinition restConfiguration;
244    @XmlElement(name = "rest")
245    private List<RestDefinition> rests = new ArrayList<>();
246    @XmlElement(name = "routeConfiguration")
247    private List<RouteConfigurationDefinition> routeConfigurations = new ArrayList<>();
248    @XmlElement(name = "routeTemplate")
249    private List<RouteTemplateDefinition> routeTemplates = new ArrayList<>();
250    @XmlElement(name = "templatedRoute")
251    private List<TemplatedRouteDefinition> templatedRoutes = new ArrayList<>();
252    @XmlElement(name = "route")
253    private List<RouteDefinition> routes = new ArrayList<>();
254    @XmlTransient
255    private BlueprintCamelContext context;
256    @XmlTransient
257    private BlueprintContainer blueprintContainer;
258    @XmlTransient
259    private BundleContext bundleContext;
260    @XmlTransient
261    private boolean implicitId;
262    @XmlTransient
263    private OsgiCamelContextPublisher osgiCamelContextPublisher;
264
265    @Override
266    public Class<BlueprintCamelContext> getObjectType() {
267        return BlueprintCamelContext.class;
268    }
269
270    @Override
271    public BlueprintCamelContext getContext(boolean create) {
272        if (context == null && create) {
273            context = createContext();
274            if (!isImplicitId()) {
275                context.setName(getId());
276            }
277        }
278        return context;
279    }
280
281    public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
282        this.blueprintContainer = blueprintContainer;
283    }
284
285    public void setBundleContext(BundleContext bundleContext) {
286        this.bundleContext = bundleContext;
287    }
288
289    protected BlueprintCamelContext createContext() {
290        return new BlueprintCamelContext(bundleContext, blueprintContainer);
291    }
292
293    @Override
294    protected void initCustomRegistry(BlueprintCamelContext context) {
295        Registry registry = getBeanForType(Registry.class);
296        if (registry != null) {
297            LOG.info("Using custom Registry: {}", registry);
298            context.setRegistry(registry);
299        }
300    }
301
302    @Override
303    protected <S> S getBeanForType(Class<S> clazz) {
304        Collection<S> objects = BlueprintContainerBeanRepository.lookupByType(blueprintContainer, clazz).values();
305        if (objects.size() == 1) {
306            return objects.iterator().next();
307        }
308        return null;
309    }
310
311    @Override
312    protected void initPropertyPlaceholder() throws Exception {
313        super.initPropertyPlaceholder();
314
315        // if blueprint property resolver is enabled on CamelContext then bridge
316        // PropertiesComponent to blueprint
317        if (isUseBlueprintPropertyResolver()) {
318            // lookup existing configured properties component
319            PropertiesComponent pc = (PropertiesComponent)getContext().getPropertiesComponent();
320
321            // any extra properties
322            ServiceReference<?> ref = bundleContext.getServiceReference(PropertiesComponent.OVERRIDE_PROPERTIES);
323            if (ref != null) {
324                Properties extra = (Properties)bundleContext.getService(ref);
325                if (extra != null) {
326                    pc.setOverrideProperties(extra);
327                }
328            }
329
330            List<String> ids = new ArrayList<>();
331            for (String bp : pc.getLocations()) {
332                String resolver = StringHelper.before(bp, ":");
333                String path = StringHelper.after(bp, ":");
334                if ("blueprint".equals(resolver)) {
335                    ids.add(path);
336                }
337            }
338            if (ids.isEmpty()) {
339                // no blueprint locations has been set, so auto-detect the
340                // blueprint property placeholders to use (convention over
341                // configuration)
342                ids = lookupPropertyPlaceholderIds();
343            }
344            pc.addPropertiesSource(new BlueprintPropertiesSource(blueprintContainer, ids));
345        }
346    }
347
348    /**
349     * Lookup the ids of the Blueprint property placeholder services in the
350     * Blueprint container.
351     *
352     * @return the ids, will be an empty if none found.
353     */
354    private List<String> lookupPropertyPlaceholderIds() {
355        List<String> ids = new ArrayList<>();
356
357        for (Object componentId : blueprintContainer.getComponentIds()) {
358            String id = (String)componentId;
359            ComponentMetadata meta = blueprintContainer.getComponentMetadata(id);
360            if (meta instanceof ExtendedBeanMetadata) {
361                Class<?> clazz = ((ExtendedBeanMetadata)meta).getRuntimeClass();
362                if (clazz != null && PropertyPlaceholderExt.class.isAssignableFrom(clazz)) {
363                    ids.add(id);
364                }
365            }
366        }
367
368        return ids;
369    }
370
371    @Override
372    protected void initBeanPostProcessor(BlueprintCamelContext context) {
373    }
374
375    @Override
376    protected void postProcessBeforeInit(RouteBuilder builder) {
377    }
378
379    @Override
380    protected void findRouteBuildersByPackageScan(String[] packages, PackageScanFilter filter, List<RoutesBuilder> builders) throws Exception {
381        // add filter to class resolver which then will filter
382        getContext().getPackageScanClassResolver().addFilter(filter);
383        ClassLoader classLoader = new BundleDelegatingClassLoader(bundleContext.getBundle());
384        PackageScanRouteBuilderFinder finder = new PackageScanRouteBuilderFinder(getContext(), packages, classLoader, getContext().getPackageScanClassResolver());
385        finder.appendBuilders(builders);
386
387        // and remove the filter
388        getContext().getPackageScanClassResolver().removeFilter(filter);
389    }
390
391    @Override
392    protected void findRouteBuildersByContextScan(PackageScanFilter filter, boolean includeNonSingletons, List<RoutesBuilder> builders) throws Exception {
393        ContextScanRouteBuilderFinder finder = new ContextScanRouteBuilderFinder(getContext(), filter, includeNonSingletons);
394        finder.appendBuilders(builders);
395    }
396
397    @Override
398    public void afterPropertiesSet() throws Exception {
399        super.afterPropertiesSet();
400        // setup the application context classloader with the bundle delegating
401        // classloader
402        ClassLoader cl = new BundleDelegatingClassLoader(bundleContext.getBundle());
403        LOG.debug("Set the application context classloader to: {}", cl);
404        getContext().setApplicationContextClassLoader(cl);
405        osgiCamelContextPublisher = new OsgiCamelContextPublisher(bundleContext);
406        osgiCamelContextPublisher.start();
407        getContext().getManagementStrategy().addEventNotifier(osgiCamelContextPublisher);
408        try {
409            getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
410            getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
411        } catch (Throwable t) {
412            // Ignore, if the EventAdmin package is not available, just don't
413            // use it
414            LOG.debug("EventAdmin package is not available, just don't use it");
415        }
416        // ensure routes is setup
417        setupRoutes();
418    }
419
420    @Override
421    public void destroy() throws Exception {
422        super.destroy();
423        if (osgiCamelContextPublisher != null) {
424            osgiCamelContextPublisher.shutdown();
425        }
426    }
427
428    @Override
429    public String getDependsOn() {
430        return dependsOn;
431    }
432
433    public void setDependsOn(String dependsOn) {
434        this.dependsOn = dependsOn;
435    }
436
437    @Override
438    public String getAutoStartup() {
439        return autoStartup;
440    }
441
442    public void setAutoStartup(String autoStartup) {
443        this.autoStartup = autoStartup;
444    }
445
446    @Override
447    public String getDumpRoutes() {
448        return dumpRoutes;
449    }
450
451    public void setDumpRoutes(String dumpRoutes) {
452        this.dumpRoutes = dumpRoutes;
453    }
454
455    @Override
456    public String getUseMDCLogging() {
457        return useMDCLogging;
458    }
459
460    public void setUseMDCLogging(String useMDCLogging) {
461        this.useMDCLogging = useMDCLogging;
462    }
463
464    @Override
465    public String getMDCLoggingKeysPattern() {
466        return mdcLoggingKeysPattern;
467    }
468
469    public void setMDCLoggingKeysPattern(String mdcLoggingKeysPattern) {
470        this.mdcLoggingKeysPattern = mdcLoggingKeysPattern;
471    }
472
473    @Override
474    public String getUseDataType() {
475        return useDataType;
476    }
477
478    public void setUseDataType(String useDataType) {
479        this.useDataType = useDataType;
480    }
481
482    @Override
483    public String getUseBreadcrumb() {
484        return useBreadcrumb;
485    }
486
487    public void setUseBreadcrumb(String useBreadcrumb) {
488        this.useBreadcrumb = useBreadcrumb;
489    }
490
491    public String getBeanPostProcessorEnabled() {
492        return beanPostProcessorEnabled;
493    }
494
495    public void setBeanPostProcessorEnabled(String beanPostProcessorEnabled) {
496        this.beanPostProcessorEnabled = beanPostProcessorEnabled;
497    }
498
499    @Override
500    public String getAllowUseOriginalMessage() {
501        return allowUseOriginalMessage;
502    }
503
504    public void setAllowUseOriginalMessage(String allowUseOriginalMessage) {
505        this.allowUseOriginalMessage = allowUseOriginalMessage;
506    }
507
508    @Override
509    public String getCaseInsensitiveHeaders() {
510        return caseInsensitiveHeaders;
511    }
512
513    public void setCaseInsensitiveHeaders(String caseInsensitiveHeaders) {
514        this.caseInsensitiveHeaders = caseInsensitiveHeaders;
515    }
516
517    @Override
518    public String getAutowiredEnabled() {
519        return autowiredEnabled;
520    }
521
522    public void setAutowiredEnabled(String autowiredEnabled) {
523        this.autowiredEnabled = autowiredEnabled;
524    }
525
526    @Override
527    public String getRuntimeEndpointRegistryEnabled() {
528        return runtimeEndpointRegistryEnabled;
529    }
530
531    public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) {
532        this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled;
533    }
534
535    @Override
536    public String getManagementNamePattern() {
537        return managementNamePattern;
538    }
539
540    public void setManagementNamePattern(String managementNamePattern) {
541        this.managementNamePattern = managementNamePattern;
542    }
543
544    @Override
545    public String getThreadNamePattern() {
546        return threadNamePattern;
547    }
548
549    public void setThreadNamePattern(String threadNamePattern) {
550        this.threadNamePattern = threadNamePattern;
551    }
552
553    @Override
554    public String getLoadHealthChecks() {
555        return loadHealthChecks;
556    }
557
558    public void setLoadHealthChecks(String loadHealthChecks) {
559        this.loadHealthChecks = loadHealthChecks;
560    }
561
562    @Override
563    public String getLoadTypeConverters() {
564        return loadTypeConverters;
565    }
566
567    public void setLoadTypeConverters(String loadTypeConverters) {
568        this.loadTypeConverters = loadTypeConverters;
569    }
570
571    @Override
572    public String getTypeConverterStatisticsEnabled() {
573        return typeConverterStatisticsEnabled;
574    }
575
576    public void setTypeConverterStatisticsEnabled(String typeConverterStatisticsEnabled) {
577        this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled;
578    }
579
580    @Override
581    public TypeConverterExists getTypeConverterExists() {
582        return typeConverterExists;
583    }
584
585    public void setTypeConverterExists(TypeConverterExists typeConverterExists) {
586        this.typeConverterExists = typeConverterExists;
587    }
588
589    @Override
590    public LoggingLevel getTypeConverterExistsLoggingLevel() {
591        return typeConverterExistsLoggingLevel;
592    }
593
594    public void setTypeConverterExistsLoggingLevel(LoggingLevel typeConverterExistsLoggingLevel) {
595        this.typeConverterExistsLoggingLevel = typeConverterExistsLoggingLevel;
596    }
597
598    @Override
599    public ShutdownRoute getShutdownRoute() {
600        return shutdownRoute;
601    }
602
603    public void setShutdownRoute(ShutdownRoute shutdownRoute) {
604        this.shutdownRoute = shutdownRoute;
605    }
606
607    @Override
608    public ShutdownRunningTask getShutdownRunningTask() {
609        return shutdownRunningTask;
610    }
611
612    public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
613        this.shutdownRunningTask = shutdownRunningTask;
614    }
615
616    @Override
617    public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() {
618        return camelPropertyPlaceholder;
619    }
620
621    public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) {
622        this.camelPropertyPlaceholder = camelPropertyPlaceholder;
623    }
624
625    @Override
626    public List<RouteConfigurationContextRefDefinition> getRouteConfigurationRefs() {
627        return routeConfigurationRefs;
628    }
629
630    public void setRouteConfigurationRefs(List<RouteConfigurationContextRefDefinition> routeConfigurationRefs) {
631        this.routeConfigurationRefs = routeConfigurationRefs;
632    }
633
634    @Override
635    public List<RouteTemplateContextRefDefinition> getRouteTemplateRefs() {
636        return routeTemplateRefs;
637    }
638
639    public void setRouteTemplateRefs(List<RouteTemplateContextRefDefinition> routeTemplateRefs) {
640        this.routeTemplateRefs = routeTemplateRefs;
641    }
642
643    @Override
644    public List<RouteContextRefDefinition> getRouteRefs() {
645        return routeRefs;
646    }
647
648    public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) {
649        this.routeRefs = routeRefs;
650    }
651
652    @Override
653    public List<RestContextRefDefinition> getRestRefs() {
654        return restRefs;
655    }
656
657    public void setRestRefs(List<RestContextRefDefinition> restRefs) {
658        this.restRefs = restRefs;
659    }
660
661    @Override
662    public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() {
663        return redeliveryPolicies;
664    }
665
666    public void setRedeliveryPolicies(List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies) {
667        this.redeliveryPolicies = redeliveryPolicies;
668    }
669
670    @Override
671    public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
672        return threadPoolProfiles;
673    }
674
675    public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
676        this.threadPoolProfiles = threadPoolProfiles;
677    }
678
679    public List<CamelThreadPoolFactoryBean> getThreadPools() {
680        return threadPools;
681    }
682
683    public void setThreadPools(List<CamelThreadPoolFactoryBean> threadPools) {
684        this.threadPools = threadPools;
685    }
686
687    @Override
688    public StartupSummaryLevel getStartupSummaryLevel() {
689        return startupSummaryLevel;
690    }
691
692    public void setStartupSummaryLevel(StartupSummaryLevel startupSummaryLevel) {
693        this.startupSummaryLevel = startupSummaryLevel;
694    }
695
696    @Override
697    public String getTrace() {
698        return trace;
699    }
700
701    public void setTrace(String trace) {
702        this.trace = trace;
703    }
704
705    @Override
706    public String getBacklogTrace() {
707        return backlogTrace;
708    }
709
710    /**
711     * Sets whether backlog tracing is enabled or not.
712     */
713    public void setBacklogTrace(String backlogTrace) {
714        this.backlogTrace = backlogTrace;
715    }
716
717    @Override
718    public String getTracePattern() {
719        return tracePattern;
720    }
721
722    public void setTracePattern(String tracePattern) {
723        this.tracePattern = tracePattern;
724    }
725
726    @Override
727    public String getTraceLoggingFormat() {
728        return traceLoggingFormat;
729    }
730
731    public void setTraceLoggingFormat(String traceLoggingFormat) {
732        this.traceLoggingFormat = traceLoggingFormat;
733    }
734
735    @Override
736    public String getDebug() {
737        return debug;
738    }
739
740    /**
741     * Sets whether debugging is enabled or not.
742     */
743    public void setDebug(String debug) {
744        this.debug = debug;
745    }
746
747    @Override
748    public String getMessageHistory() {
749        return messageHistory;
750    }
751
752    public void setMessageHistory(String messageHistory) {
753        this.messageHistory = messageHistory;
754    }
755
756    @Override
757    public String getSourceLocationEnabled() {
758        return sourceLocationEnabled;
759    }
760
761    public void setSourceLocationEnabled(String sourceLocationEnabled) {
762        this.sourceLocationEnabled = sourceLocationEnabled;
763    }
764
765    @Override
766    public String getLogMask() {
767        return logMask;
768    }
769
770    public void setLogMask(String logMask) {
771        this.logMask = logMask;
772    }
773
774    @Override
775    public String getLogExhaustedMessageBody() {
776        return logExhaustedMessageBody;
777    }
778
779    public void setLogExhaustedMessageBody(String logExhaustedMessageBody) {
780        this.logExhaustedMessageBody = logExhaustedMessageBody;
781    }
782
783    @Override
784    public String getStreamCache() {
785        return streamCache;
786    }
787
788    public void setStreamCache(String streamCache) {
789        this.streamCache = streamCache;
790    }
791
792    @Override
793    public String getDelayer() {
794        return delayer;
795    }
796
797    public void setDelayer(String delayer) {
798        this.delayer = delayer;
799    }
800
801    @Override
802    public String getErrorHandlerRef() {
803        return errorHandlerRef;
804    }
805
806    public void setErrorHandlerRef(String errorHandlerRef) {
807        this.errorHandlerRef = errorHandlerRef;
808    }
809
810    @Override
811    public GlobalOptionsDefinition getGlobalOptions() {
812        return globalOptions;
813    }
814
815    public void setGlobalOptions(GlobalOptionsDefinition globalOptions) {
816        this.globalOptions = globalOptions;
817    }
818
819    @Override
820    public String[] getPackages() {
821        return packages;
822    }
823
824    public void setPackages(String[] packages) {
825        this.packages = packages;
826    }
827
828    @Override
829    public PackageScanDefinition getPackageScan() {
830        return packageScan;
831    }
832
833    @Override
834    public void setPackageScan(PackageScanDefinition packageScan) {
835        this.packageScan = packageScan;
836    }
837
838    @Override
839    public ContextScanDefinition getContextScan() {
840        return contextScan;
841    }
842
843    @Override
844    public void setContextScan(ContextScanDefinition contextScan) {
845        this.contextScan = contextScan;
846    }
847
848    @Override
849    public CamelJMXAgentDefinition getCamelJMXAgent() {
850        return camelJMXAgent;
851    }
852
853    public void setCamelJMXAgent(CamelJMXAgentDefinition camelJMXAgent) {
854        this.camelJMXAgent = camelJMXAgent;
855    }
856
857    @Override
858    public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() {
859        return camelStreamCachingStrategy;
860    }
861
862    public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) {
863        this.camelStreamCachingStrategy = camelStreamCachingStrategy;
864    }
865
866    @Override
867    public CamelRouteControllerDefinition getCamelRouteController() {
868        return camelRouteController;
869    }
870
871    public void setCamelRouteController(CamelRouteControllerDefinition camelRouteController) {
872        this.camelRouteController = camelRouteController;
873    }
874
875    @Override
876    public List<AbstractCamelFactoryBean<?>> getBeansFactory() {
877        return beansFactory;
878    }
879
880    public void setBeansFactory(List<AbstractCamelFactoryBean<?>> beansFactory) {
881        this.beansFactory = beansFactory;
882    }
883
884    public List<?> getBeans() {
885        return null; // not in use
886    }
887
888    @Override
889    public ServiceCallConfigurationDefinition getDefaultServiceCallConfiguration() {
890        return defaultServiceCallConfiguration;
891    }
892
893    public void setDefaultServiceCallConfiguration(ServiceCallConfigurationDefinition defaultServiceCallConfiguration) {
894        this.defaultServiceCallConfiguration = defaultServiceCallConfiguration;
895    }
896
897    @Override
898    public List<ServiceCallConfigurationDefinition> getServiceCallConfigurations() {
899        return serviceCallConfigurations;
900    }
901
902    public void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> serviceCallConfigurations) {
903        this.serviceCallConfigurations = serviceCallConfigurations;
904    }
905
906    @Override
907    public Resilience4jConfigurationDefinition getDefaultResilience4jConfiguration() {
908        return defaultResilience4jConfiguration;
909    }
910
911    public void setDefaultResilience4jConfiguration(Resilience4jConfigurationDefinition defaultResilience4jConfiguration) {
912        this.defaultResilience4jConfiguration = defaultResilience4jConfiguration;
913    }
914
915    @Override
916    public List<Resilience4jConfigurationDefinition> getResilience4jConfigurations() {
917        return resilience4jConfigurations;
918    }
919
920    public void setResilience4jConfigurations(List<Resilience4jConfigurationDefinition> resilience4jConfigurations) {
921        this.resilience4jConfigurations = resilience4jConfigurations;
922    }
923
924    @Override
925    public FaultToleranceConfigurationDefinition getDefaultFaultToleranceConfiguration() {
926        return defaultFaultToleranceConfiguration;
927    }
928
929    public void setDefaultFaultToleranceConfiguration(FaultToleranceConfigurationDefinition defaultFaultToleranceConfiguration) {
930        this.defaultFaultToleranceConfiguration = defaultFaultToleranceConfiguration;
931    }
932
933    @Override
934    public List<FaultToleranceConfigurationDefinition> getFaultToleranceConfigurations() {
935        return faultToleranceConfigurations;
936    }
937
938    public void setFaultToleranceConfigurations(List<FaultToleranceConfigurationDefinition> faultToleranceConfigurations) {
939        this.faultToleranceConfigurations = faultToleranceConfigurations;
940    }
941
942    @Override
943    public List<RouteBuilderDefinition> getBuilderRefs() {
944        return builderRefs;
945    }
946
947    public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) {
948        this.builderRefs = builderRefs;
949    }
950
951    @Override
952    public List<CamelEndpointFactoryBean> getEndpoints() {
953        return endpoints;
954    }
955
956    public void setEndpoints(List<CamelEndpointFactoryBean> endpoints) {
957        this.endpoints = endpoints;
958    }
959
960    @Override
961    public DataFormatsDefinition getDataFormats() {
962        return dataFormats;
963    }
964
965    public void setDataFormats(DataFormatsDefinition dataFormats) {
966        this.dataFormats = dataFormats;
967    }
968
969    public void setTransformers(TransformersDefinition transformers) {
970        this.transformers = transformers;
971    }
972
973    @Override
974    public TransformersDefinition getTransformers() {
975        return transformers;
976    }
977
978    public void setValidators(ValidatorsDefinition validators) {
979        this.validators = validators;
980    }
981
982    @Override
983    public ValidatorsDefinition getValidators() {
984        return validators;
985    }
986
987    @Override
988    public List<OnExceptionDefinition> getOnExceptions() {
989        return onExceptions;
990    }
991
992    public void setOnExceptions(List<OnExceptionDefinition> onExceptions) {
993        this.onExceptions = onExceptions;
994    }
995
996    @Override
997    public List<OnCompletionDefinition> getOnCompletions() {
998        return onCompletions;
999    }
1000
1001    public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
1002        this.onCompletions = onCompletions;
1003    }
1004
1005    @Override
1006    public List<InterceptDefinition> getIntercepts() {
1007        return intercepts;
1008    }
1009
1010    public void setIntercepts(List<InterceptDefinition> intercepts) {
1011        this.intercepts = intercepts;
1012    }
1013
1014    @Override
1015    public List<InterceptFromDefinition> getInterceptFroms() {
1016        return interceptFroms;
1017    }
1018
1019    public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) {
1020        this.interceptFroms = interceptFroms;
1021    }
1022
1023    @Override
1024    public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() {
1025        return interceptSendToEndpoints;
1026    }
1027
1028    public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) {
1029        this.interceptSendToEndpoints = interceptSendToEndpoints;
1030    }
1031
1032    @Override
1033    public List<RouteConfigurationDefinition> getRouteConfigurations() {
1034        return routeConfigurations;
1035    }
1036
1037    @Override
1038    public void setRouteConfigurations(List<RouteConfigurationDefinition> routeConfigurations) {
1039        this.routeConfigurations = routeConfigurations;
1040    }
1041
1042    @Override
1043    public List<RouteTemplateDefinition> getRouteTemplates() {
1044        return routeTemplates;
1045    }
1046
1047    @Override
1048    public void setRouteTemplates(List<RouteTemplateDefinition> routeTemplates) {
1049        this.routeTemplates = routeTemplates;
1050    }
1051
1052    @Override
1053    public List<TemplatedRouteDefinition> getTemplatedRoutes() {
1054        return templatedRoutes;
1055    }
1056
1057    @Override
1058    public void setTemplatedRoutes(List<TemplatedRouteDefinition> templatedRoutes) {
1059        this.templatedRoutes = templatedRoutes;
1060    }
1061
1062    @Override
1063    public List<RouteDefinition> getRoutes() {
1064        return routes;
1065    }
1066
1067    @Override
1068    public void setRoutes(List<RouteDefinition> routes) {
1069        this.routes = routes;
1070    }
1071
1072    @Override
1073    public List<RestDefinition> getRests() {
1074        return rests;
1075    }
1076
1077    @Override
1078    public void setRests(List<RestDefinition> rests) {
1079        this.rests = rests;
1080    }
1081
1082    @Override
1083    public RestConfigurationDefinition getRestConfiguration() {
1084        return restConfiguration;
1085    }
1086
1087    public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
1088        this.restConfiguration = restConfiguration;
1089    }
1090
1091    public boolean isImplicitId() {
1092        return implicitId;
1093    }
1094
1095    public void setImplicitId(boolean flag) {
1096        implicitId = flag;
1097    }
1098
1099    public Boolean getUseBlueprintPropertyResolver() {
1100        return useBlueprintPropertyResolver;
1101    }
1102
1103    /**
1104     * Whether to automatic detect OSGi Blueprint property placeholder service in use,
1105     * and bridge with Camel property placeholder.
1106     * When enabled this allows you to only setup OSGi Blueprint property placeholder
1107     * and Camel can use the properties in the camelContext.
1108     */
1109    public void setUseBlueprintPropertyResolver(Boolean useBlueprintPropertyResolver) {
1110        this.useBlueprintPropertyResolver = useBlueprintPropertyResolver;
1111    }
1112
1113    public boolean isUseBlueprintPropertyResolver() {
1114        // enable by default
1115        return useBlueprintPropertyResolver == null || useBlueprintPropertyResolver.booleanValue();
1116    }
1117
1118    @Override
1119    public String getInflightRepositoryBrowseEnabled() {
1120        return inflightRepositoryBrowseEnabled;
1121    }
1122
1123    public void setInflightRepositoryBrowseEnabled(String inflightRepositoryBrowseEnabled) {
1124        this.inflightRepositoryBrowseEnabled = inflightRepositoryBrowseEnabled;
1125    }
1126}