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