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