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;
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.LoggingLevel;
032import org.apache.camel.RoutesBuilder;
033import org.apache.camel.ShutdownRoute;
034import org.apache.camel.ShutdownRunningTask;
035import org.apache.camel.TypeConverterExists;
036import org.apache.camel.builder.RouteBuilder;
037import org.apache.camel.component.properties.PropertiesComponent;
038import org.apache.camel.core.osgi.OsgiCamelContextPublisher;
039import org.apache.camel.core.osgi.OsgiEventAdminNotifier;
040import org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader;
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.CamelServiceExporterDefinition;
046import org.apache.camel.core.xml.CamelStreamCachingStrategyDefinition;
047import org.apache.camel.model.ContextScanDefinition;
048import org.apache.camel.model.GlobalOptionsDefinition;
049import org.apache.camel.model.HystrixConfigurationDefinition;
050import org.apache.camel.model.InterceptDefinition;
051import org.apache.camel.model.InterceptFromDefinition;
052import org.apache.camel.model.InterceptSendToEndpointDefinition;
053import org.apache.camel.model.OnCompletionDefinition;
054import org.apache.camel.model.OnExceptionDefinition;
055import org.apache.camel.model.PackageScanDefinition;
056import org.apache.camel.model.PropertiesDefinition;
057import org.apache.camel.model.RestContextRefDefinition;
058import org.apache.camel.model.RouteBuilderDefinition;
059import org.apache.camel.model.RouteContextRefDefinition;
060import org.apache.camel.model.RouteDefinition;
061import org.apache.camel.model.ThreadPoolProfileDefinition;
062import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
063import org.apache.camel.model.dataformat.DataFormatsDefinition;
064import org.apache.camel.model.rest.RestConfigurationDefinition;
065import org.apache.camel.model.rest.RestDefinition;
066import org.apache.camel.model.transformer.TransformersDefinition;
067import org.apache.camel.model.validator.ValidatorsDefinition;
068import org.apache.camel.spi.PackageScanFilter;
069import org.apache.camel.spi.Registry;
070import org.osgi.framework.BundleContext;
071import org.osgi.framework.ServiceReference;
072import org.osgi.service.blueprint.container.BlueprintContainer;
073import org.slf4j.Logger;
074import org.slf4j.LoggerFactory;
075
076/**
077 * A bean to create and initialize a {@link BlueprintCamelContext}
078 * and install routes either explicitly configured in
079 * Blueprint XML or found by searching the classpath for Java classes which extend
080 * {@link RouteBuilder} using the nested {@link #setPackages(String[])}.
081 *
082 * @version 
083 */
084@XmlRootElement(name = "camelContext")
085@XmlAccessorType(XmlAccessType.FIELD)
086public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<BlueprintCamelContext> {
087    private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class);
088
089    @XmlAttribute(name = "depends-on")
090    private String dependsOn;
091    @XmlAttribute
092    private String trace;
093    @XmlAttribute
094    private String messageHistory;
095    @XmlAttribute
096    private String logMask;
097    @XmlAttribute
098    private String logExhaustedMessageBody;
099    @XmlAttribute
100    private String streamCache = "false";
101    @XmlAttribute
102    private String delayer;
103    @XmlAttribute
104    private String handleFault;
105    @XmlAttribute
106    private String errorHandlerRef;
107    @XmlAttribute
108    private String autoStartup = "true";
109    @XmlAttribute
110    private String useMDCLogging;
111    @XmlAttribute
112    private String useDataType;
113    @XmlAttribute
114    private String useBreadcrumb;
115    @XmlAttribute
116    private String allowUseOriginalMessage;
117    @XmlAttribute
118    private String runtimeEndpointRegistryEnabled;
119    @XmlAttribute
120    private String managementNamePattern;
121    @XmlAttribute
122    private String threadNamePattern;
123    @XmlAttribute
124    private Boolean useBlueprintPropertyResolver;
125    @XmlAttribute
126    private ShutdownRoute shutdownRoute;
127    @XmlAttribute
128    private ShutdownRunningTask shutdownRunningTask;
129    @XmlAttribute
130    @Deprecated
131    private Boolean lazyLoadTypeConverters;
132    @XmlAttribute
133    private Boolean loadTypeConverters;
134    @XmlAttribute
135    private Boolean typeConverterStatisticsEnabled;
136    @XmlAttribute
137    private TypeConverterExists typeConverterExists;
138    @XmlAttribute
139    private LoggingLevel typeConverterExistsLoggingLevel;
140    @Deprecated
141    @XmlElement(name = "properties")
142    private PropertiesDefinition properties;
143    @XmlElement(name = "globalOptions")
144    private GlobalOptionsDefinition globalOptions;
145    @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class)
146    private CamelPropertyPlaceholderDefinition camelPropertyPlaceholder;
147    @XmlElement(name = "package")
148    private String[] packages = {};
149    @XmlElement(name = "packageScan", type = PackageScanDefinition.class)
150    private PackageScanDefinition packageScan;
151    @XmlElement(name = "contextScan", type = ContextScanDefinition.class)
152    private ContextScanDefinition contextScan;
153    @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class)
154    private CamelJMXAgentDefinition camelJMXAgent;
155    @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class)
156    private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy;
157    @XmlElements({
158        @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class),
159        @XmlElement(name = "fluentTemplate", type = CamelFluentProducerTemplateFactoryBean.class),
160        @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class),
161        @XmlElement(name = "proxy", type = CamelProxyFactoryBean.class),
162        @XmlElement(name = "errorHandler", type = CamelErrorHandlerFactoryBean.class)})
163    private List<AbstractCamelFactoryBean<?>> beansFactory;
164    @XmlElements({
165        @XmlElement(name = "export", type = CamelServiceExporterDefinition.class) })
166    private List<?> beans;
167    @XmlElement(name = "defaultServiceCallConfiguration")
168    private ServiceCallConfigurationDefinition defaultServiceCallConfiguration;
169    @XmlElement(name = "serviceCallConfiguration", type = ServiceCallConfigurationDefinition.class)
170    private List<ServiceCallConfigurationDefinition> serviceCallConfigurations;
171    @XmlElement(name = "defaultHystrixConfiguration")
172    private HystrixConfigurationDefinition defaultHystrixConfiguration;
173    @XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class)
174    private List<HystrixConfigurationDefinition> hystrixConfigurations;
175    @XmlElement(name = "routeBuilder")
176    private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
177    @XmlElement(name = "routeContextRef")
178    private List<RouteContextRefDefinition> routeRefs = new ArrayList<RouteContextRefDefinition>();
179    @XmlElement(name = "restContextRef")
180    private List<RestContextRefDefinition> restRefs = new ArrayList<RestContextRefDefinition>();
181    @XmlElement(name = "threadPoolProfile")
182    private List<ThreadPoolProfileDefinition> threadPoolProfiles;
183    @XmlElement(name = "threadPool")
184    private List<CamelThreadPoolFactoryBean> threadPools;
185    @XmlElement(name = "endpoint")
186    private List<CamelEndpointFactoryBean> endpoints;
187    @XmlElement(name = "dataFormats")
188    private DataFormatsDefinition dataFormats;
189    @XmlElement(name = "transformers")
190    private TransformersDefinition transformers;
191    @XmlElement(name = "validators")
192    private ValidatorsDefinition validators;
193    @XmlElement(name = "redeliveryPolicyProfile")
194    private List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies;
195    @XmlElement(name = "onException")
196    private List<OnExceptionDefinition> onExceptions = new ArrayList<OnExceptionDefinition>();
197    @XmlElement(name = "onCompletion")
198    private List<OnCompletionDefinition> onCompletions = new ArrayList<OnCompletionDefinition>();
199    @XmlElement(name = "intercept")
200    private List<InterceptDefinition> intercepts = new ArrayList<InterceptDefinition>();
201    @XmlElement(name = "interceptFrom")
202    private List<InterceptFromDefinition> interceptFroms = new ArrayList<InterceptFromDefinition>();
203    @XmlElement(name = "interceptSendToEndpoint")
204    private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<InterceptSendToEndpointDefinition>();
205    @XmlElement(name = "restConfiguration")
206    private RestConfigurationDefinition restConfiguration;
207    @XmlElement(name = "rest")
208    private List<RestDefinition> rests = new ArrayList<RestDefinition>();
209    @XmlElement(name = "route")
210    private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
211    @XmlTransient
212    private BlueprintCamelContext context;
213    @XmlTransient
214    private BlueprintContainer blueprintContainer;
215    @XmlTransient
216    private BundleContext bundleContext;
217    @XmlTransient
218    private boolean implicitId;
219    @XmlTransient
220    private OsgiCamelContextPublisher osgiCamelContextPublisher;
221
222    public Class<BlueprintCamelContext> getObjectType() {
223        return BlueprintCamelContext.class;
224    }
225
226    @Override
227    public BlueprintCamelContext getContext(boolean create) {
228        if (context == null && create) {
229            context = createContext();
230            if (!isImplicitId()) {
231                context.setName(getId());
232            }
233        }
234        return context;
235    }
236
237    public void setBlueprintContainer(BlueprintContainer blueprintContainer) {
238        this.blueprintContainer = blueprintContainer;
239    }
240
241    public void setBundleContext(BundleContext bundleContext) {
242        this.bundleContext = bundleContext;
243    }
244
245    protected BlueprintCamelContext createContext() {
246        return new BlueprintCamelContext(bundleContext, blueprintContainer);
247    }
248
249    @Override
250    protected void initCustomRegistry(BlueprintCamelContext context) {
251        Registry registry = getBeanForType(Registry.class);
252        if (registry != null) {
253            LOG.info("Using custom Registry: " + registry);
254            context.setRegistry(registry);
255        }
256    }
257
258    @Override
259    protected <S> S getBeanForType(Class<S> clazz) {
260        Collection<S> objects = BlueprintContainerRegistry.lookupByType(blueprintContainer, clazz).values();
261        if (objects.size() == 1) {
262            return objects.iterator().next();
263        }
264        return null;
265    }
266
267    @Override
268    protected void initPropertyPlaceholder() throws Exception {
269        super.initPropertyPlaceholder();
270
271        // if blueprint property resolver is enabled on CamelContext then bridge PropertiesComponent to blueprint
272        if (isUseBlueprintPropertyResolver()) {
273            // lookup existing configured properties component
274            PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
275
276            BlueprintPropertiesParser parser = new BlueprintPropertiesParser(pc, blueprintContainer, pc.getPropertiesParser());
277            BlueprintPropertiesResolver resolver = new BlueprintPropertiesResolver(pc.getPropertiesResolver(), parser);
278
279            // any extra properties
280            ServiceReference<?> ref = bundleContext.getServiceReference(PropertiesComponent.OVERRIDE_PROPERTIES);
281            if (ref != null) {
282                Properties extra = (Properties) bundleContext.getService(ref);
283                if (extra != null) {
284                    pc.setOverrideProperties(extra);
285                }
286            }
287
288            // no locations has been set, so its a default component
289            if (pc.getLocations() == null) {
290                String[] ids = parser.lookupPropertyPlaceholderIds();
291                for (int i = 0; i < ids.length; i++) {
292                    if (!ids[i].startsWith("blueprint:")) {
293                        ids[i] = "blueprint:" + ids[i];
294                    }
295                }
296                if (ids.length > 0) {
297                    // location supports multiple separated by comma
298                    pc.setLocations(ids);
299                }
300            }
301
302            if (pc.getLocations() != null) {
303                // bridge camel properties with blueprint
304                pc.setPropertiesParser(parser);
305                pc.setPropertiesResolver(resolver);
306            }
307        }
308    }
309
310    @Override
311    protected void initBeanPostProcessor(BlueprintCamelContext context) {
312    }
313
314    @Override
315    protected void postProcessBeforeInit(RouteBuilder builder) {
316    }
317
318    @Override
319    protected void findRouteBuildersByPackageScan(String[] packages, PackageScanFilter filter, List<RoutesBuilder> builders) throws Exception {
320        // add filter to class resolver which then will filter
321        getContext().getPackageScanClassResolver().addFilter(filter);
322        ClassLoader classLoader = new BundleDelegatingClassLoader(bundleContext.getBundle());
323        PackageScanRouteBuilderFinder finder = new PackageScanRouteBuilderFinder(getContext(), packages, classLoader,
324                                                                                 getContext().getPackageScanClassResolver());
325        finder.appendBuilders(builders);
326
327        // and remove the filter
328        getContext().getPackageScanClassResolver().removeFilter(filter);
329    }
330
331    @Override
332    protected void findRouteBuildersByContextScan(PackageScanFilter filter, boolean includeNonSingletons, List<RoutesBuilder> builders) throws Exception {
333        ContextScanRouteBuilderFinder finder = new ContextScanRouteBuilderFinder(getContext(), filter, includeNonSingletons);
334        finder.appendBuilders(builders);
335    }
336
337    @Override
338    public void afterPropertiesSet() throws Exception {
339        super.afterPropertiesSet();
340        // setup the application context classloader with the bundle delegating classloader
341        ClassLoader cl = new BundleDelegatingClassLoader(bundleContext.getBundle());
342        LOG.debug("Set the application context classloader to: {}", cl);
343        getContext().setApplicationContextClassLoader(cl);
344        osgiCamelContextPublisher = new OsgiCamelContextPublisher(bundleContext);
345        osgiCamelContextPublisher.start();
346        getContext().getManagementStrategy().addEventNotifier(osgiCamelContextPublisher);
347        try {
348            getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
349            getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
350        } catch (Throwable t) {
351            // Ignore, if the EventAdmin package is not available, just don't use it
352            LOG.debug("EventAdmin package is not available, just don't use it");
353        }
354        // ensure routes is setup
355        setupRoutes();
356    }
357
358    @Override
359    public void destroy() throws Exception {
360        super.destroy();
361        if (osgiCamelContextPublisher != null) {
362            osgiCamelContextPublisher.shutdown();
363        }
364    }
365
366    public String getDependsOn() {
367        return dependsOn;
368    }
369
370    public void setDependsOn(String dependsOn) {
371        this.dependsOn = dependsOn;
372    }
373
374    public String getAutoStartup() {
375        return autoStartup;
376    }
377
378    public void setAutoStartup(String autoStartup) {
379        this.autoStartup = autoStartup;
380    }
381
382    public String getUseMDCLogging() {
383        return useMDCLogging;
384    }
385
386    public void setUseMDCLogging(String useMDCLogging) {
387        this.useMDCLogging = useMDCLogging;
388    }
389
390    public String getUseDataType() {
391        return useDataType;
392    }
393
394    public void setUseDataType(String useDataType) {
395        this.useDataType = useDataType;
396    }
397
398    public String getUseBreadcrumb() {
399        return useBreadcrumb;
400    }
401
402    public void setUseBreadcrumb(String useBreadcrumb) {
403        this.useBreadcrumb = useBreadcrumb;
404    }
405
406    public String getAllowUseOriginalMessage() {
407        return allowUseOriginalMessage;
408    }
409
410    public void setAllowUseOriginalMessage(String allowUseOriginalMessage) {
411        this.allowUseOriginalMessage = allowUseOriginalMessage;
412    }
413
414    public String getRuntimeEndpointRegistryEnabled() {
415        return runtimeEndpointRegistryEnabled;
416    }
417
418    public void setRuntimeEndpointRegistryEnabled(String runtimeEndpointRegistryEnabled) {
419        this.runtimeEndpointRegistryEnabled = runtimeEndpointRegistryEnabled;
420    }
421
422    public String getManagementNamePattern() {
423        return managementNamePattern;
424    }
425
426    public void setManagementNamePattern(String managementNamePattern) {
427        this.managementNamePattern = managementNamePattern;
428    }
429
430    public String getThreadNamePattern() {
431        return threadNamePattern;
432    }
433
434    public void setThreadNamePattern(String threadNamePattern) {
435        this.threadNamePattern = threadNamePattern;
436    }
437
438    @Deprecated
439    public Boolean getLazyLoadTypeConverters() {
440        // use false by default
441        return lazyLoadTypeConverters != null ? lazyLoadTypeConverters : Boolean.FALSE;
442    }
443
444    @Deprecated
445    public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
446        this.lazyLoadTypeConverters = lazyLoadTypeConverters;
447    }
448
449    @Override
450    public Boolean getLoadTypeConverters() {
451        return loadTypeConverters;
452    }
453
454    public void setLoadTypeConverters(Boolean loadTypeConverters) {
455        this.loadTypeConverters = loadTypeConverters;
456    }
457
458    public Boolean getTypeConverterStatisticsEnabled() {
459        return typeConverterStatisticsEnabled;
460    }
461
462    public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) {
463        this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled;
464    }
465
466    public TypeConverterExists getTypeConverterExists() {
467        return typeConverterExists;
468    }
469
470    public void setTypeConverterExists(TypeConverterExists typeConverterExists) {
471        this.typeConverterExists = typeConverterExists;
472    }
473
474    public LoggingLevel getTypeConverterExistsLoggingLevel() {
475        return typeConverterExistsLoggingLevel;
476    }
477
478    public void setTypeConverterExistsLoggingLevel(LoggingLevel typeConverterExistsLoggingLevel) {
479        this.typeConverterExistsLoggingLevel = typeConverterExistsLoggingLevel;
480    }
481
482    public ShutdownRoute getShutdownRoute() {
483        return shutdownRoute;
484    }
485
486    public void setShutdownRoute(ShutdownRoute shutdownRoute) {
487        this.shutdownRoute = shutdownRoute;
488    }
489
490    public ShutdownRunningTask getShutdownRunningTask() {
491        return shutdownRunningTask;
492    }
493
494    public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
495        this.shutdownRunningTask = shutdownRunningTask;
496    }
497
498    public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() {
499        return camelPropertyPlaceholder;
500    }
501
502    public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) {
503        this.camelPropertyPlaceholder = camelPropertyPlaceholder;
504    }
505
506    public List<RouteContextRefDefinition> getRouteRefs() {
507        return routeRefs;
508    }
509
510    public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) {
511        this.routeRefs = routeRefs;
512    }
513
514    public List<RestContextRefDefinition> getRestRefs() {
515        return restRefs;
516    }
517
518    public void setRestRefs(List<RestContextRefDefinition> restRefs) {
519        this.restRefs = restRefs;
520    }
521
522    public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() {
523        return redeliveryPolicies;
524    }
525
526    public void setRedeliveryPolicies(List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies) {
527        this.redeliveryPolicies = redeliveryPolicies;
528    }
529
530    public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
531        return threadPoolProfiles;
532    }
533
534    public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
535        this.threadPoolProfiles = threadPoolProfiles;
536    }
537
538    public List<CamelThreadPoolFactoryBean> getThreadPools() {
539        return threadPools;
540    }
541
542    public void setThreadPools(List<CamelThreadPoolFactoryBean> threadPools) {
543        this.threadPools = threadPools;
544    }
545
546    public String getTrace() {
547        return trace;
548    }
549
550    public void setTrace(String trace) {
551        this.trace = trace;
552    }
553
554    public String getMessageHistory() {
555        return messageHistory;
556    }
557
558    public void setMessageHistory(String messageHistory) {
559        this.messageHistory = messageHistory;
560    }
561
562    public String getLogMask() {
563        return logMask;
564    }
565
566    public void setLogMask(String logMask) {
567        this.logMask = logMask;
568    }
569
570    public String getLogExhaustedMessageBody() {
571        return logExhaustedMessageBody;
572    }
573
574    public void setLogExhaustedMessageBody(String logExhaustedMessageBody) {
575        this.logExhaustedMessageBody = logExhaustedMessageBody;
576    }
577
578    public String getStreamCache() {
579        return streamCache;
580    }
581
582    public void setStreamCache(String streamCache) {
583        this.streamCache = streamCache;
584    }
585
586    public String getDelayer() {
587        return delayer;
588    }
589
590    public void setDelayer(String delayer) {
591        this.delayer = delayer;
592    }
593
594    public String getHandleFault() {
595        return handleFault;
596    }
597
598    public void setHandleFault(String handleFault) {
599        this.handleFault = handleFault;
600    }
601
602    public String getErrorHandlerRef() {
603        return errorHandlerRef;
604    }
605
606    public void setErrorHandlerRef(String errorHandlerRef) {
607        this.errorHandlerRef = errorHandlerRef;
608    }
609
610    @Deprecated
611    public PropertiesDefinition getProperties() {
612        return properties;
613    }
614
615    @Override
616    public GlobalOptionsDefinition getGlobalOptions() {
617        return globalOptions;
618    }
619
620    @Deprecated
621    public void setProperties(PropertiesDefinition properties) {
622        this.properties = properties;
623    }
624
625    public void setGlobalOptions(GlobalOptionsDefinition globalOptions) {
626        this.globalOptions = globalOptions;
627    }
628
629    public String[] getPackages() {
630        return packages;
631    }
632
633    public void setPackages(String[] packages) {
634        this.packages = packages;
635    }
636
637    public PackageScanDefinition getPackageScan() {
638        return packageScan;
639    }
640
641    public void setPackageScan(PackageScanDefinition packageScan) {
642        this.packageScan = packageScan;
643    }
644
645    public ContextScanDefinition getContextScan() {
646        return contextScan;
647    }
648
649    public void setContextScan(ContextScanDefinition contextScan) {
650        this.contextScan = contextScan;
651    }
652
653    public CamelJMXAgentDefinition getCamelJMXAgent() {
654        return camelJMXAgent;
655    }
656
657    public void setCamelJMXAgent(CamelJMXAgentDefinition camelJMXAgent) {
658        this.camelJMXAgent = camelJMXAgent;
659    }
660
661    public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() {
662        return camelStreamCachingStrategy;
663    }
664
665    public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) {
666        this.camelStreamCachingStrategy = camelStreamCachingStrategy;
667    }
668
669    @Override
670    public List<AbstractCamelFactoryBean<?>> getBeansFactory() {
671        return beansFactory;
672    }
673
674    public void setBeansFactory(List<AbstractCamelFactoryBean<?>> beansFactory) {
675        this.beansFactory = beansFactory;
676    }
677
678    @Override
679    public List<?> getBeans() {
680        return beans;
681    }
682
683    public void setBeans(List<?> beans) {
684        this.beans = beans;
685    }
686
687    @Override
688    public ServiceCallConfigurationDefinition getDefaultServiceCallConfiguration() {
689        return defaultServiceCallConfiguration;
690    }
691
692    public void setDefaultServiceCallConfiguration(ServiceCallConfigurationDefinition defaultServiceCallConfiguration) {
693        this.defaultServiceCallConfiguration = defaultServiceCallConfiguration;
694    }
695
696    @Override
697    public List<ServiceCallConfigurationDefinition> getServiceCallConfigurations() {
698        return serviceCallConfigurations;
699    }
700
701    public void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> serviceCallConfigurations) {
702        this.serviceCallConfigurations = serviceCallConfigurations;
703    }
704
705    @Override
706    public HystrixConfigurationDefinition getDefaultHystrixConfiguration() {
707        return defaultHystrixConfiguration;
708    }
709
710    public void setDefaultHystrixConfiguration(HystrixConfigurationDefinition defaultHystrixConfiguration) {
711        this.defaultHystrixConfiguration = defaultHystrixConfiguration;
712    }
713
714    @Override
715    public List<HystrixConfigurationDefinition> getHystrixConfigurations() {
716        return hystrixConfigurations;
717    }
718
719    public void setHystrixConfigurations(List<HystrixConfigurationDefinition> hystrixConfigurations) {
720        this.hystrixConfigurations = hystrixConfigurations;
721    }
722
723    public List<RouteBuilderDefinition> getBuilderRefs() {
724        return builderRefs;
725    }
726
727    public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) {
728        this.builderRefs = builderRefs;
729    }
730
731    public List<CamelEndpointFactoryBean> getEndpoints() {
732        return endpoints;
733    }
734
735    public void setEndpoints(List<CamelEndpointFactoryBean> endpoints) {
736        this.endpoints = endpoints;
737    }
738
739    public DataFormatsDefinition getDataFormats() {
740        return dataFormats;
741    }
742
743    public void setDataFormats(DataFormatsDefinition dataFormats) {
744        this.dataFormats = dataFormats;
745    }
746
747    public void setTransformers(TransformersDefinition transformers) {
748        this.transformers = transformers;
749    }
750
751    public TransformersDefinition getTransformers() {
752        return transformers;
753    }
754
755    public void setValidators(ValidatorsDefinition validators) {
756        this.validators = validators;
757    }
758
759    public ValidatorsDefinition getValidators() {
760        return validators;
761    }
762
763    public List<OnExceptionDefinition> getOnExceptions() {
764        return onExceptions;
765    }
766
767    public void setOnExceptions(List<OnExceptionDefinition> onExceptions) {
768        this.onExceptions = onExceptions;
769    }
770
771    public List<OnCompletionDefinition> getOnCompletions() {
772        return onCompletions;
773    }
774
775    public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
776        this.onCompletions = onCompletions;
777    }
778
779    public List<InterceptDefinition> getIntercepts() {
780        return intercepts;
781    }
782
783    public void setIntercepts(List<InterceptDefinition> intercepts) {
784        this.intercepts = intercepts;
785    }
786
787    public List<InterceptFromDefinition> getInterceptFroms() {
788        return interceptFroms;
789    }
790
791    public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) {
792        this.interceptFroms = interceptFroms;
793    }
794
795    public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() {
796        return interceptSendToEndpoints;
797    }
798
799    public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) {
800        this.interceptSendToEndpoints = interceptSendToEndpoints;
801    }
802
803    public List<RouteDefinition> getRoutes() {
804        return routes;
805    }
806
807    public void setRoutes(List<RouteDefinition> routes) {
808        this.routes = routes;
809    }
810
811    public List<RestDefinition> getRests() {
812        return rests;
813    }
814
815    public void setRests(List<RestDefinition> rests) {
816        this.rests = rests;
817    }
818
819    public RestConfigurationDefinition getRestConfiguration() {
820        return restConfiguration;
821    }
822
823    public void setRestConfiguration(RestConfigurationDefinition restConfiguration) {
824        this.restConfiguration = restConfiguration;
825    }
826
827    public boolean isImplicitId() {
828        return implicitId;
829    }
830    
831    public void setImplicitId(boolean flag) {
832        implicitId = flag;
833    }
834
835    public Boolean getUseBlueprintPropertyResolver() {
836        return useBlueprintPropertyResolver;
837    }
838
839    public void setUseBlueprintPropertyResolver(Boolean useBlueprintPropertyResolver) {
840        this.useBlueprintPropertyResolver = useBlueprintPropertyResolver;
841    }
842
843    public boolean isUseBlueprintPropertyResolver() {
844        // enable by default
845        return useBlueprintPropertyResolver == null || useBlueprintPropertyResolver.booleanValue();
846    }
847
848}