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