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     */
017    package org.apache.camel.spring;
018    
019    import java.util.ArrayList;
020    import java.util.List;
021    import java.util.Map;
022    import javax.xml.bind.annotation.XmlAccessType;
023    import javax.xml.bind.annotation.XmlAccessorType;
024    import javax.xml.bind.annotation.XmlAttribute;
025    import javax.xml.bind.annotation.XmlElement;
026    import javax.xml.bind.annotation.XmlElements;
027    import javax.xml.bind.annotation.XmlRootElement;
028    import javax.xml.bind.annotation.XmlTransient;
029    
030    import org.apache.camel.CamelContext;
031    import org.apache.camel.RoutesBuilder;
032    import org.apache.camel.ShutdownRoute;
033    import org.apache.camel.ShutdownRunningTask;
034    import org.apache.camel.builder.RouteBuilder;
035    import org.apache.camel.component.properties.PropertiesComponent;
036    import org.apache.camel.core.xml.AbstractCamelContextFactoryBean;
037    import org.apache.camel.core.xml.CamelJMXAgentDefinition;
038    import org.apache.camel.core.xml.CamelPropertyPlaceholderDefinition;
039    import org.apache.camel.core.xml.CamelProxyFactoryDefinition;
040    import org.apache.camel.core.xml.CamelServiceExporterDefinition;
041    import org.apache.camel.core.xml.CamelStreamCachingStrategyDefinition;
042    import org.apache.camel.model.ContextScanDefinition;
043    import org.apache.camel.model.InterceptDefinition;
044    import org.apache.camel.model.InterceptFromDefinition;
045    import org.apache.camel.model.InterceptSendToEndpointDefinition;
046    import org.apache.camel.model.OnCompletionDefinition;
047    import org.apache.camel.model.OnExceptionDefinition;
048    import org.apache.camel.model.PackageScanDefinition;
049    import org.apache.camel.model.RouteBuilderDefinition;
050    import org.apache.camel.model.RouteContextRefDefinition;
051    import org.apache.camel.model.RouteDefinition;
052    import org.apache.camel.model.ThreadPoolProfileDefinition;
053    import org.apache.camel.model.config.PropertiesDefinition;
054    import org.apache.camel.model.dataformat.DataFormatsDefinition;
055    import org.apache.camel.spi.PackageScanFilter;
056    import org.apache.camel.spi.Registry;
057    import org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer;
058    import org.apache.camel.util.CamelContextHelper;
059    import org.slf4j.Logger;
060    import org.slf4j.LoggerFactory;
061    import org.springframework.beans.factory.DisposableBean;
062    import org.springframework.beans.factory.FactoryBean;
063    import org.springframework.beans.factory.InitializingBean;
064    import org.springframework.beans.factory.config.BeanPostProcessor;
065    import org.springframework.context.ApplicationContext;
066    import org.springframework.context.ApplicationContextAware;
067    import org.springframework.context.ApplicationEvent;
068    import org.springframework.context.ApplicationListener;
069    import org.springframework.context.event.ContextRefreshedEvent;
070    
071    import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
072    
073    /**
074     * A Spring {@link FactoryBean} to create and initialize a
075     * {@link SpringCamelContext} and install routes either explicitly configured in
076     * Spring XML or found by searching the classpath for Java classes which extend
077     * {@link RouteBuilder} using the nested {@link #setPackages(String[])}.
078     *
079     * @version 
080     */
081    @XmlRootElement(name = "camelContext")
082    @XmlAccessorType(XmlAccessType.FIELD)
083    public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<SpringCamelContext>
084            implements FactoryBean<SpringCamelContext>, InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener<ApplicationEvent> {
085        private static final Logger LOG = LoggerFactory.getLogger(CamelContextFactoryBean.class);
086    
087        @XmlAttribute(name = "depends-on", required = false)
088        private String dependsOn;
089        @XmlAttribute(required = false)
090        private String trace;
091        @XmlAttribute(required = false)
092        private String messageHistory;
093        @XmlAttribute(required = false)
094        private String streamCache;
095        @XmlAttribute(required = false)
096        private String delayer;
097        @XmlAttribute(required = false)
098        private String handleFault;
099        @XmlAttribute(required = false)
100        private String errorHandlerRef;
101        @XmlAttribute(required = false)
102        private String autoStartup;
103        @XmlAttribute(required = false)
104        private String shutdownEager;
105        @XmlAttribute(required = false)
106        private String useMDCLogging;
107        @XmlAttribute(required = false)
108        private String useBreadcrumb;
109        @XmlAttribute(required = false)
110        private String allowUseOriginalMessage;
111        @XmlAttribute(required = false)
112        private String managementNamePattern;
113        @XmlAttribute(required = false)
114        private String threadNamePattern;
115        @XmlAttribute(required = false)
116        private ShutdownRoute shutdownRoute;
117        @XmlAttribute(required = false)
118        private ShutdownRunningTask shutdownRunningTask;
119        @XmlAttribute(required = false)
120        @Deprecated
121        private Boolean lazyLoadTypeConverters;
122        @XmlAttribute(required = false)
123        private Boolean typeConverterStatisticsEnabled;
124        @XmlElement(name = "properties", required = false)
125        private PropertiesDefinition properties;
126        @XmlElement(name = "propertyPlaceholder", type = CamelPropertyPlaceholderDefinition.class, required = false)
127        private CamelPropertyPlaceholderDefinition camelPropertyPlaceholder;
128        @XmlElement(name = "package", required = false)
129        private String[] packages = {};
130        @XmlElement(name = "packageScan", type = PackageScanDefinition.class, required = false)
131        private PackageScanDefinition packageScan;
132        @XmlElement(name = "contextScan", type = ContextScanDefinition.class, required = false)
133        private ContextScanDefinition contextScan;
134        @XmlElement(name = "streamCaching", type = CamelStreamCachingStrategyDefinition.class, required = false)
135        private CamelStreamCachingStrategyDefinition camelStreamCachingStrategy;
136        @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class, required = false)
137        private CamelJMXAgentDefinition camelJMXAgent;
138        @XmlElements({
139                @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false),
140                @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class, required = false),
141                @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false),
142                @XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false),
143                @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)})
144        private List<?> beans;
145        @XmlElement(name = "routeBuilder", required = false)
146        private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>();
147        @XmlElement(name = "routeContextRef", required = false)
148        private List<RouteContextRefDefinition> routeRefs = new ArrayList<RouteContextRefDefinition>();
149        @XmlElement(name = "threadPoolProfile", required = false)
150        private List<ThreadPoolProfileDefinition> threadPoolProfiles;
151        @XmlElement(name = "threadPool", required = false)
152        private List<CamelThreadPoolFactoryBean> threadPools;
153        @XmlElement(name = "endpoint", required = false)
154        private List<CamelEndpointFactoryBean> endpoints;
155        @XmlElement(name = "dataFormats", required = false)
156        private DataFormatsDefinition dataFormats;
157        @XmlElement(name = "redeliveryPolicyProfile", required = false)
158        private List<CamelRedeliveryPolicyFactoryBean> redeliveryPolicies;
159        @XmlElement(name = "onException", required = false)
160        private List<OnExceptionDefinition> onExceptions = new ArrayList<OnExceptionDefinition>();
161        @XmlElement(name = "onCompletion", required = false)
162        private List<OnCompletionDefinition> onCompletions = new ArrayList<OnCompletionDefinition>();
163        @XmlElement(name = "intercept", required = false)
164        private List<InterceptDefinition> intercepts = new ArrayList<InterceptDefinition>();
165        @XmlElement(name = "interceptFrom", required = false)
166        private List<InterceptFromDefinition> interceptFroms = new ArrayList<InterceptFromDefinition>();
167        @XmlElement(name = "interceptSendToEndpoint", required = false)
168        private List<InterceptSendToEndpointDefinition> interceptSendToEndpoints = new ArrayList<InterceptSendToEndpointDefinition>();
169        @XmlElement(name = "route", required = false)
170        private List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
171        @XmlTransient
172        private SpringCamelContext context;
173        @XmlTransient
174        private ClassLoader contextClassLoaderOnStart;
175        @XmlTransient
176        private ApplicationContext applicationContext;
177        @XmlTransient
178        private BeanPostProcessor beanPostProcessor;
179        @XmlTransient
180        private boolean implicitId;
181        
182    
183        @Override
184        public Class<SpringCamelContext> getObjectType() {
185            return SpringCamelContext.class;
186        }
187        
188        protected <S> S getBeanForType(Class<S> clazz) {
189            S bean = null;
190            String[] names = getApplicationContext().getBeanNamesForType(clazz, true, true);
191            if (names.length == 1) {
192                bean = getApplicationContext().getBean(names[0], clazz);
193            }
194            if (bean == null) {
195                ApplicationContext parentContext = getApplicationContext().getParent();
196                if (parentContext != null) {
197                    names = parentContext.getBeanNamesForType(clazz, true, true);
198                    if (names.length == 1) {
199                        bean = parentContext.getBean(names[0], clazz);
200                    }
201                }
202            }
203            return bean;
204        }
205    
206        @Override
207        protected void findRouteBuildersByPackageScan(String[] packages, PackageScanFilter filter, List<RoutesBuilder> builders) throws Exception {
208            // add filter to class resolver which then will filter
209            getContext().getPackageScanClassResolver().addFilter(filter);
210    
211            PackageScanRouteBuilderFinder finder = new PackageScanRouteBuilderFinder(getContext(), packages, getContextClassLoaderOnStart(),
212                                                                                     getBeanPostProcessor(), getContext().getPackageScanClassResolver());
213            finder.appendBuilders(builders);
214    
215            // and remove the filter
216            getContext().getPackageScanClassResolver().removeFilter(filter);
217        }
218    
219        @Override
220        protected void findRouteBuildersByContextScan(PackageScanFilter filter, List<RoutesBuilder> builders) throws Exception {
221            ContextScanRouteBuilderFinder finder = new ContextScanRouteBuilderFinder(getContext(), filter);
222            finder.appendBuilders(builders);
223        }
224    
225        protected void initBeanPostProcessor(SpringCamelContext context) {
226            if (beanPostProcessor != null) {
227                if (beanPostProcessor instanceof ApplicationContextAware) {
228                    ((ApplicationContextAware) beanPostProcessor).setApplicationContext(applicationContext);
229                }
230                if (beanPostProcessor instanceof CamelBeanPostProcessor) {
231                    ((CamelBeanPostProcessor) beanPostProcessor).setCamelContext(getContext());
232                }
233            }
234        }
235    
236        protected void postProcessBeforeInit(RouteBuilder builder) {
237            if (beanPostProcessor != null) {
238                // Inject the annotated resource
239                beanPostProcessor.postProcessBeforeInitialization(builder, builder.toString());
240            }
241        }
242    
243        @Override
244        public void afterPropertiesSet() throws Exception {
245            super.afterPropertiesSet();
246    
247            Boolean shutdownEager = CamelContextHelper.parseBoolean(getContext(), getShutdownEager());
248            if (shutdownEager != null) {
249                LOG.debug("Using shutdownEager: " + shutdownEager);
250                getContext().setShutdownEager(shutdownEager);
251            }
252        }
253    
254        protected void initCustomRegistry(SpringCamelContext context) {
255            Registry registry = getBeanForType(Registry.class);
256            if (registry != null) {
257                LOG.info("Using custom Registry: " + registry);
258                context.setRegistry(registry);
259            }
260        }
261    
262        @Override
263        protected void initPropertyPlaceholder() throws Exception {
264            super.initPropertyPlaceholder();
265    
266            Map<String, BridgePropertyPlaceholderConfigurer> beans = applicationContext.getBeansOfType(BridgePropertyPlaceholderConfigurer.class);
267            if (beans.size() == 1) {
268                // setup properties component that uses this beans
269                BridgePropertyPlaceholderConfigurer configurer = beans.values().iterator().next();
270                String id = beans.keySet().iterator().next();
271                LOG.info("Bridging Camel and Spring property placeholder configurer with id: " + id);
272    
273                // get properties component
274                PropertiesComponent pc = getContext().getComponent("properties", PropertiesComponent.class);
275                // replace existing resolver with us
276                configurer.setResolver(pc.getPropertiesResolver());
277                configurer.setParser(pc.getPropertiesParser());
278                String ref = "ref:" + id;
279                // use the bridge to handle the resolve and parsing
280                pc.setPropertiesResolver(configurer);
281                pc.setPropertiesParser(configurer);
282                // and update locations to have our as ref first
283                String[] locations = pc.getLocations();
284                String[] updatedLocations;
285                if (locations != null && locations.length > 0) {
286                    updatedLocations = new String[locations.length + 1];
287                    updatedLocations[0] = ref;
288                    System.arraycopy(locations, 0, updatedLocations, 1, locations.length);
289                } else {
290                    updatedLocations = new String[]{ref};
291                }
292                pc.setLocations(updatedLocations);
293            } else if (beans.size() > 1) {
294                LOG.warn("Cannot bridge Camel and Spring property placeholders, as exact only 1 bean of type BridgePropertyPlaceholderConfigurer"
295                        + " must be defined, was {} beans defined.", beans.size());
296            }
297        }
298    
299        public void onApplicationEvent(ApplicationEvent event) {
300            // From Spring 3.0.1, The BeanFactory applicationEventListener 
301            // and Bean's applicationEventListener will be called,
302            // So we just delegate the onApplicationEvent call here.
303    
304            SpringCamelContext context = getContext(false);
305            if (context != null) {
306                // we need to defer setting up routes until Spring has done all its dependency injection
307                // which is only guaranteed to be done when it emits the ContextRefreshedEvent event.
308                if (event instanceof ContextRefreshedEvent) {
309                    try {
310                        setupRoutes();
311                    } catch (Exception e) {
312                        throw wrapRuntimeCamelException(e);
313                    }
314                }
315                // let the spring camel context handle the events
316                context.onApplicationEvent(event);
317            } else {
318                LOG.debug("Publishing spring-event: {}", event);
319    
320                if (event instanceof ContextRefreshedEvent) {
321                    // now lets start the CamelContext so that all its possible
322                    // dependencies are initialized
323                    try {
324                        // we need to defer setting up routes until Spring has done all its dependency injection
325                        // which is only guaranteed to be done when it emits the ContextRefreshedEvent event.
326                        setupRoutes();
327                        LOG.trace("Starting the context now");
328                        getContext().start();
329                    } catch (Exception e) {
330                        throw wrapRuntimeCamelException(e);
331                    }
332                }
333            }
334        }
335    
336        // Properties
337        // -------------------------------------------------------------------------
338    
339        public ApplicationContext getApplicationContext() {
340            if (applicationContext == null) {
341                throw new IllegalArgumentException("No applicationContext has been injected!");
342            }
343            return applicationContext;
344        }
345    
346        public void setApplicationContext(ApplicationContext applicationContext) {
347            this.applicationContext = applicationContext;
348        }
349    
350        public void setBeanPostProcessor(BeanPostProcessor postProcessor) {
351            this.beanPostProcessor = postProcessor;
352        }
353    
354        public BeanPostProcessor getBeanPostProcessor() {
355            return beanPostProcessor;
356        }
357    
358        // Implementation methods
359        // -------------------------------------------------------------------------
360    
361        /**
362         * Create the context
363         */
364        protected SpringCamelContext createContext() {
365            SpringCamelContext ctx = newCamelContext();        
366            ctx.setName(getId());        
367            return ctx;
368        }
369    
370        protected SpringCamelContext newCamelContext() {
371            return new SpringCamelContext(getApplicationContext());
372        }
373    
374        public SpringCamelContext getContext(boolean create) {
375            if (context == null && create) {
376                context = createContext();
377            }
378            return context;
379        }
380    
381        public void setContext(SpringCamelContext context) {
382            this.context = context;
383        }
384    
385        public List<RouteDefinition> getRoutes() {
386            return routes;
387        }
388    
389        public void setRoutes(List<RouteDefinition> routes) {
390            this.routes = routes;
391        }
392    
393        public List<CamelEndpointFactoryBean> getEndpoints() {
394            return endpoints;
395        }
396    
397        public List<CamelRedeliveryPolicyFactoryBean> getRedeliveryPolicies() {
398            return redeliveryPolicies;
399        }
400    
401        public List<InterceptDefinition> getIntercepts() {
402            return intercepts;
403        }
404    
405        public void setIntercepts(List<InterceptDefinition> intercepts) {
406            this.intercepts = intercepts;
407        }
408    
409        public List<InterceptFromDefinition> getInterceptFroms() {
410            return interceptFroms;
411        }
412    
413        public void setInterceptFroms(List<InterceptFromDefinition> interceptFroms) {
414            this.interceptFroms = interceptFroms;
415        }
416    
417        public List<InterceptSendToEndpointDefinition> getInterceptSendToEndpoints() {
418            return interceptSendToEndpoints;
419        }
420    
421        public void setInterceptSendToEndpoints(List<InterceptSendToEndpointDefinition> interceptSendToEndpoints) {
422            this.interceptSendToEndpoints = interceptSendToEndpoints;
423        }
424    
425        public PropertiesDefinition getProperties() {
426            return properties;
427        }
428    
429        public void setProperties(PropertiesDefinition properties) {
430            this.properties = properties;
431        }
432    
433        public String[] getPackages() {
434            return packages;
435        }
436    
437        /**
438         * Sets the package names to be recursively searched for Java classes which
439         * extend {@link org.apache.camel.builder.RouteBuilder} to be auto-wired up to the
440         * {@link CamelContext} as a route. Note that classes are excluded if
441         * they are specifically configured in the spring.xml
442         * <p/>
443         * A more advanced configuration can be done using {@link #setPackageScan(org.apache.camel.model.PackageScanDefinition)}
444         *
445         * @param packages the package names which are recursively searched
446         * @see #setPackageScan(org.apache.camel.model.PackageScanDefinition)
447         */
448        public void setPackages(String[] packages) {
449            this.packages = packages;
450        }
451    
452        public PackageScanDefinition getPackageScan() {
453            return packageScan;
454        }
455    
456        /**
457         * Sets the package scanning information. Package scanning allows for the
458         * automatic discovery of certain camel classes at runtime for inclusion
459         * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations
460         *
461         * @param packageScan the package scan
462         */
463        public void setPackageScan(PackageScanDefinition packageScan) {
464            this.packageScan = packageScan;
465        }
466    
467        public ContextScanDefinition getContextScan() {
468            return contextScan;
469        }
470    
471        /**
472         * Sets the context scanning (eg Spring's ApplicationContext) information.
473         * Context scanning allows for the automatic discovery of Camel routes runtime for inclusion
474         * e.g. {@link org.apache.camel.builder.RouteBuilder} implementations
475         *
476         * @param contextScan the context scan
477         */
478        public void setContextScan(ContextScanDefinition contextScan) {
479            this.contextScan = contextScan;
480        }
481    
482        public CamelPropertyPlaceholderDefinition getCamelPropertyPlaceholder() {
483            return camelPropertyPlaceholder;
484        }
485    
486        public void setCamelPropertyPlaceholder(CamelPropertyPlaceholderDefinition camelPropertyPlaceholder) {
487            this.camelPropertyPlaceholder = camelPropertyPlaceholder;
488        }
489    
490        public CamelStreamCachingStrategyDefinition getCamelStreamCachingStrategy() {
491            return camelStreamCachingStrategy;
492        }
493    
494        public void setCamelStreamCachingStrategy(CamelStreamCachingStrategyDefinition camelStreamCachingStrategy) {
495            this.camelStreamCachingStrategy = camelStreamCachingStrategy;
496        }
497    
498        public void setCamelJMXAgent(CamelJMXAgentDefinition agent) {
499            camelJMXAgent = agent;
500        }
501    
502        public String getTrace() {
503            return trace;
504        }
505    
506        public void setTrace(String trace) {
507            this.trace = trace;
508        }
509    
510        public String getMessageHistory() {
511            return messageHistory;
512        }
513    
514        public void setMessageHistory(String messageHistory) {
515            this.messageHistory = messageHistory;
516        }
517    
518        public String getStreamCache() {
519            return streamCache;
520        }
521    
522        public void setStreamCache(String streamCache) {
523            this.streamCache = streamCache;
524        }
525    
526        public String getDelayer() {
527            return delayer;
528        }
529    
530        public void setDelayer(String delayer) {
531            this.delayer = delayer;
532        }
533    
534        public String getHandleFault() {
535            return handleFault;
536        }
537    
538        public void setHandleFault(String handleFault) {
539            this.handleFault = handleFault;
540        }
541    
542        public String getAutoStartup() {
543            return autoStartup;
544        }
545    
546        public void setAutoStartup(String autoStartup) {
547            this.autoStartup = autoStartup;
548        }
549    
550        public String getShutdownEager() {
551            return shutdownEager;
552        }
553    
554        public void setShutdownEager(String shutdownEager) {
555            this.shutdownEager = shutdownEager;
556        }
557    
558        public String getUseMDCLogging() {
559            return useMDCLogging;
560        }
561    
562        public void setUseMDCLogging(String useMDCLogging) {
563            this.useMDCLogging = useMDCLogging;
564        }
565    
566        public String getUseBreadcrumb() {
567            return useBreadcrumb;
568        }
569    
570        public void setUseBreadcrumb(String useBreadcrumb) {
571            this.useBreadcrumb = useBreadcrumb;
572        }
573    
574        public String getAllowUseOriginalMessage() {
575            return allowUseOriginalMessage;
576        }
577    
578        public void setAllowUseOriginalMessage(String allowUseOriginalMessage) {
579            this.allowUseOriginalMessage = allowUseOriginalMessage;
580        }
581    
582        public String getManagementNamePattern() {
583            return managementNamePattern;
584        }
585    
586        public void setManagementNamePattern(String managementNamePattern) {
587            this.managementNamePattern = managementNamePattern;
588        }
589    
590        public String getThreadNamePattern() {
591            return threadNamePattern;
592        }
593    
594        public void setThreadNamePattern(String threadNamePattern) {
595            this.threadNamePattern = threadNamePattern;
596        }
597    
598        @Deprecated
599        public Boolean getLazyLoadTypeConverters() {
600            return lazyLoadTypeConverters;
601        }
602    
603        @Deprecated
604        public void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters) {
605            this.lazyLoadTypeConverters = lazyLoadTypeConverters;
606        }
607    
608        public Boolean getTypeConverterStatisticsEnabled() {
609            return typeConverterStatisticsEnabled;
610        }
611    
612        public void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled) {
613            this.typeConverterStatisticsEnabled = typeConverterStatisticsEnabled;
614        }
615    
616        public CamelJMXAgentDefinition getCamelJMXAgent() {
617            return camelJMXAgent;
618        }
619    
620        public List<RouteBuilderDefinition> getBuilderRefs() {
621            return builderRefs;
622        }
623    
624        public void setBuilderRefs(List<RouteBuilderDefinition> builderRefs) {
625            this.builderRefs = builderRefs;
626        }
627    
628        public List<RouteContextRefDefinition> getRouteRefs() {
629            return routeRefs;
630        }
631    
632        public void setRouteRefs(List<RouteContextRefDefinition> routeRefs) {
633            this.routeRefs = routeRefs;
634        }
635    
636        public String getErrorHandlerRef() {
637            return errorHandlerRef;
638        }
639    
640        /**
641         * Sets the name of the error handler object used to default the error handling strategy
642         *
643         * @param errorHandlerRef the Spring bean ref of the error handler
644         */
645        public void setErrorHandlerRef(String errorHandlerRef) {
646            this.errorHandlerRef = errorHandlerRef;
647        }
648    
649        public void setDataFormats(DataFormatsDefinition dataFormats) {
650            this.dataFormats = dataFormats;
651        }
652    
653        public DataFormatsDefinition getDataFormats() {
654            return dataFormats;
655        }
656    
657        public void setOnExceptions(List<OnExceptionDefinition> onExceptions) {
658            this.onExceptions = onExceptions;
659        }
660    
661        public List<OnExceptionDefinition> getOnExceptions() {
662            return onExceptions;
663        }
664    
665        public List<OnCompletionDefinition> getOnCompletions() {
666            return onCompletions;
667        }
668    
669        public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
670            this.onCompletions = onCompletions;
671        }
672    
673        public ShutdownRoute getShutdownRoute() {
674            return shutdownRoute;
675        }
676    
677        public void setShutdownRoute(ShutdownRoute shutdownRoute) {
678            this.shutdownRoute = shutdownRoute;
679        }
680    
681        public ShutdownRunningTask getShutdownRunningTask() {
682            return shutdownRunningTask;
683        }
684    
685        public void setShutdownRunningTask(ShutdownRunningTask shutdownRunningTask) {
686            this.shutdownRunningTask = shutdownRunningTask;
687        }
688    
689        public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
690            return threadPoolProfiles;
691        }
692    
693        public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
694            this.threadPoolProfiles = threadPoolProfiles;
695        }
696    
697        public String getDependsOn() {
698            return dependsOn;
699        }
700    
701        public void setDependsOn(String dependsOn) {
702            this.dependsOn = dependsOn;
703        }
704        
705        public boolean isImplicitId() {
706            return implicitId;
707        }
708        
709        public void setImplicitId(boolean flag) {
710            implicitId = flag;
711        }
712    
713    }