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;
018
019import java.io.IOException;
020import java.io.InputStream;
021import java.util.Collection;
022import java.util.List;
023import java.util.Map;
024import java.util.Properties;
025import java.util.Set;
026import java.util.concurrent.ScheduledExecutorService;
027import java.util.concurrent.TimeUnit;
028
029import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
030import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
031import org.apache.camel.api.management.mbean.ManagedRouteMBean;
032import org.apache.camel.builder.ErrorHandlerBuilder;
033import org.apache.camel.health.HealthCheckRegistry;
034import org.apache.camel.model.DataFormatDefinition;
035import org.apache.camel.model.HystrixConfigurationDefinition;
036import org.apache.camel.model.ProcessorDefinition;
037import org.apache.camel.model.RouteDefinition;
038import org.apache.camel.model.RoutesDefinition;
039import org.apache.camel.model.cloud.ServiceCallConfigurationDefinition;
040import org.apache.camel.model.rest.RestDefinition;
041import org.apache.camel.model.rest.RestsDefinition;
042import org.apache.camel.model.transformer.TransformerDefinition;
043import org.apache.camel.model.validator.ValidatorDefinition;
044import org.apache.camel.runtimecatalog.RuntimeCamelCatalog;
045import org.apache.camel.spi.AsyncProcessorAwaitManager;
046import org.apache.camel.spi.CamelContextNameStrategy;
047import org.apache.camel.spi.ClassResolver;
048import org.apache.camel.spi.DataFormat;
049import org.apache.camel.spi.DataFormatResolver;
050import org.apache.camel.spi.DataType;
051import org.apache.camel.spi.Debugger;
052import org.apache.camel.spi.EndpointRegistry;
053import org.apache.camel.spi.EndpointStrategy;
054import org.apache.camel.spi.ExecutorServiceManager;
055import org.apache.camel.spi.FactoryFinder;
056import org.apache.camel.spi.FactoryFinderResolver;
057import org.apache.camel.spi.HeadersMapFactory;
058import org.apache.camel.spi.InflightRepository;
059import org.apache.camel.spi.Injector;
060import org.apache.camel.spi.InterceptStrategy;
061import org.apache.camel.spi.Language;
062import org.apache.camel.spi.LifecycleStrategy;
063import org.apache.camel.spi.LogListener;
064import org.apache.camel.spi.ManagementMBeanAssembler;
065import org.apache.camel.spi.ManagementNameStrategy;
066import org.apache.camel.spi.ManagementStrategy;
067import org.apache.camel.spi.MessageHistoryFactory;
068import org.apache.camel.spi.ModelJAXBContextFactory;
069import org.apache.camel.spi.NodeIdFactory;
070import org.apache.camel.spi.PackageScanClassResolver;
071import org.apache.camel.spi.ProcessorFactory;
072import org.apache.camel.spi.Registry;
073import org.apache.camel.spi.ReloadStrategy;
074import org.apache.camel.spi.RestConfiguration;
075import org.apache.camel.spi.RestRegistry;
076import org.apache.camel.spi.RouteController;
077import org.apache.camel.spi.RoutePolicyFactory;
078import org.apache.camel.spi.RouteStartupOrder;
079import org.apache.camel.spi.RuntimeEndpointRegistry;
080import org.apache.camel.spi.ServicePool;
081import org.apache.camel.spi.ShutdownStrategy;
082import org.apache.camel.spi.StreamCachingStrategy;
083import org.apache.camel.spi.Transformer;
084import org.apache.camel.spi.TransformerRegistry;
085import org.apache.camel.spi.TypeConverterRegistry;
086import org.apache.camel.spi.UnitOfWorkFactory;
087import org.apache.camel.spi.UuidGenerator;
088import org.apache.camel.spi.Validator;
089import org.apache.camel.spi.ValidatorRegistry;
090import org.apache.camel.util.LoadPropertiesException;
091import org.apache.camel.util.ValueHolder;
092import org.apache.camel.util.jsse.SSLContextParameters;
093
094/**
095 * Interface used to represent the CamelContext used to configure routes and the
096 * policies to use during message exchanges between endpoints.
097 * <p/>
098 * The CamelContext offers the following methods to control the lifecycle:
099 * <ul>
100 *   <li>{@link #start()}  - to start (<b>important:</b> the start method is not blocked, see more details
101 *     <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li>
102 *   <li>{@link #stop()} - to shutdown (will stop all routes/components/endpoints etc and clear internal state/cache)</li>
103 *   <li>{@link #suspend()} - to pause routing messages</li>
104 *   <li>{@link #resume()} - to resume after a suspend</li>
105 * </ul>
106 * <p/>
107 * <b>Notice:</b> {@link #stop()} and {@link #suspend()} will gracefully stop/suspend routes ensuring any messages
108 * in progress will be given time to complete. See more details at {@link org.apache.camel.spi.ShutdownStrategy}.
109 * <p/>
110 * If you are doing a hot restart then it's advised to use the suspend/resume methods which ensure a faster
111 * restart but also allows any internal state to be kept as is.
112 * The stop/start approach will do a <i>cold</i> restart of Camel, where all internal state is reset.
113 * <p/>
114 * End users are advised to use suspend/resume. Using stop is for shutting down Camel and it's not guaranteed that
115 * when it's being started again using the start method that Camel will operate consistently.
116 *
117 * @version 
118 */
119public interface CamelContext extends SuspendableService, RuntimeConfiguration {
120
121    /**
122     * Adapts this {@link org.apache.camel.CamelContext} to the specialized type.
123     * <p/>
124     * For example to adapt to {@link org.apache.camel.model.ModelCamelContext},
125     * or <tt>SpringCamelContext</tt>, or <tt>CdiCamelContext</tt>, etc.
126     *
127     * @param type the type to adapt to
128     * @return this {@link org.apache.camel.CamelContext} adapted to the given type
129     */
130    <T extends CamelContext> T adapt(Class<T> type);
131
132    /**
133     * If CamelContext during the start procedure was vetoed, and therefore causing Camel to not start.
134     */
135    boolean isVetoStarted();
136
137    /**
138     * Starts the {@link CamelContext} (<b>important:</b> the start method is not blocked, see more details
139     *     <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li>.
140     * <p/>
141     * See more details at the class-level javadoc of this class.
142     *
143     * @throws Exception is thrown if starting failed
144     */
145    void start() throws Exception;
146
147    /**
148     * Stop and shutdown the {@link CamelContext} (will stop all routes/components/endpoints etc and clear internal state/cache).
149     * <p/>
150     * See more details at the class-level javadoc of this class.
151     *
152     * @throws Exception is thrown if stopping failed
153     */
154    void stop() throws Exception;
155
156    /**
157     * Gets the name (id) of the this CamelContext.
158     *
159     * @return the name
160     */
161    String getName();
162
163    /**
164     * Gets the current name strategy
165     *
166     * @return name strategy
167     */
168    CamelContextNameStrategy getNameStrategy();
169
170    /**
171     * Sets a custom name strategy
172     *
173     * @param nameStrategy name strategy
174     */
175    void setNameStrategy(CamelContextNameStrategy nameStrategy);
176
177    /**
178     * Gets the current management name strategy
179     *
180     * @return management name strategy
181     */
182    ManagementNameStrategy getManagementNameStrategy();
183
184    /**
185     * Sets a custom management name strategy
186     *
187     * @param nameStrategy name strategy
188     */
189    void setManagementNameStrategy(ManagementNameStrategy nameStrategy);
190
191    /**
192     * Gets the name this {@link CamelContext} was registered in JMX.
193     * <p/>
194     * The reason that a {@link CamelContext} can have a different name in JMX is the fact to remedy for name clash
195     * in JMX when having multiple {@link CamelContext}s in the same JVM. Camel will automatic reassign and use
196     * a free name to avoid failing to start.
197     *
198     * @return the management name
199     */
200    String getManagementName();
201
202    /**
203     * Gets the version of the this CamelContext.
204     *
205     * @return the version
206     */
207    String getVersion();
208
209    /**
210     * Get the status of this CamelContext
211     *
212     * @return the status
213     */
214    ServiceStatus getStatus();
215
216    /**
217     * Gets the uptime in a human readable format
218     *
219     * @return the uptime in days/hours/minutes
220     */
221    String getUptime();
222
223    /**
224     * Gets the uptime in milli seconds
225     *
226     * @return the uptime in millis seconds
227     */
228    long getUptimeMillis();
229
230    // Service Methods
231    //-----------------------------------------------------------------------
232
233    /**
234     * Adds a service to this CamelContext, which allows this CamelContext to control the lifecycle, ensuring
235     * the service is stopped when the CamelContext stops.
236     * <p/>
237     * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}.
238     * The service will also be enlisted in JMX for management (if JMX is enabled).
239     * The service will be started, if its not already started.
240     *
241     * @param object the service
242     * @throws Exception can be thrown when starting the service
243     */
244    void addService(Object object) throws Exception;
245
246    /**
247     * Adds a service to this CamelContext.
248     * <p/>
249     * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}.
250     * The service will also be enlisted in JMX for management (if JMX is enabled).
251     * The service will be started, if its not already started.
252     * <p/>
253     * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this CamelContext will control the lifecycle, ensuring
254     * the service is stopped when the CamelContext stops.
255     * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this CamelContext will not stop the service when the CamelContext stops.
256     *
257     * @param object the service
258     * @param stopOnShutdown whether to stop the service when this CamelContext shutdown.
259     * @throws Exception can be thrown when starting the service
260     */
261    void addService(Object object, boolean stopOnShutdown) throws Exception;
262
263    /**
264     * Adds a service to this CamelContext.
265     * <p/>
266     * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}.
267     * The service will also be enlisted in JMX for management (if JMX is enabled).
268     * The service will be started, if its not already started.
269     * <p/>
270     * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this CamelContext will control the lifecycle, ensuring
271     * the service is stopped when the CamelContext stops.
272     * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this CamelContext will not stop the service when the CamelContext stops.
273     *
274     * @param object the service
275     * @param stopOnShutdown whether to stop the service when this CamelContext shutdown.
276     * @param forceStart whether to force starting the service right now, as otherwise the service may be deferred being started
277     *                   to later using {@link #deferStartService(Object, boolean)}
278     * @throws Exception can be thrown when starting the service
279     */
280    void addService(Object object, boolean stopOnShutdown, boolean forceStart) throws Exception;
281
282    /**
283     * Removes a service from this CamelContext.
284     * <p/>
285     * The service is assumed to have been previously added using {@link #addService(Object)} method.
286     * This method will <b>not</b> change the service lifecycle.
287     *
288     * @param object the service
289     * @throws Exception can be thrown if error removing the service
290     * @return <tt>true</tt> if the service was removed, <tt>false</tt> if no service existed
291     */
292    boolean removeService(Object object) throws Exception;
293
294    /**
295     * Has the given service already been added to this CamelContext?
296     *
297     * @param object the service
298     * @return <tt>true</tt> if already added, <tt>false</tt> if not.
299     */
300    boolean hasService(Object object);
301
302    /**
303     * Has the given service type already been added to this CamelContext?
304     *
305     * @param type the class type
306     * @return the service instance or <tt>null</tt> if not already added.
307     */
308    <T> T hasService(Class<T> type);
309
310    /**
311     * Has the given service type already been added to this CamelContext?
312     *
313     * @param type the class type
314     * @return the services instance or empty set.
315     */
316    <T> Set<T> hasServices(Class<T> type);
317
318    /**
319     * Defers starting the service until {@link CamelContext} is (almost started) or started and has initialized all its prior services and routes.
320     * <p/>
321     * If {@link CamelContext} is already started then the service is started immediately.
322     *
323     * @param object the service
324     * @param stopOnShutdown whether to stop the service when this CamelContext shutdown. Setting this to <tt>true</tt> will keep a reference to the service in
325     *                       this {@link CamelContext} until the CamelContext is stopped. So do not use it for short lived services.
326     * @throws Exception can be thrown when starting the service, which is only attempted if {@link CamelContext} has already been started when calling this method.
327     */
328    void deferStartService(Object object, boolean stopOnShutdown) throws Exception;
329
330    /**
331     * Adds the given listener to be invoked when {@link CamelContext} have just been started.
332     * <p/>
333     * This allows listeners to do any custom work after the routes and other services have been started and are running.
334     * <p/><b>Important:</b> The listener will always be invoked, also if the {@link CamelContext} has already been
335     * started, see the {@link org.apache.camel.StartupListener#onCamelContextStarted(CamelContext, boolean)} method.
336     *
337     * @param listener the listener
338     * @throws Exception can be thrown if {@link CamelContext} is already started and the listener is invoked
339     *                   and cause an exception to be thrown
340     */
341    void addStartupListener(StartupListener listener) throws Exception;
342
343    // Component Management Methods
344    //-----------------------------------------------------------------------
345
346    /**
347     * Adds a component to the context.
348     *
349     * @param componentName the name the component is registered as
350     * @param component     the component
351     */
352    void addComponent(String componentName, Component component);
353
354    /**
355     * Is the given component already registered?
356     *
357     * @param componentName the name of the component
358     * @return the registered Component or <tt>null</tt> if not registered
359     */
360    Component hasComponent(String componentName);
361
362    /**
363     * Gets a component from the CamelContext by name.
364     * <p/>
365     * Notice the returned component will be auto-started. If you do not intend to do that
366     * then use {@link #getComponent(String, boolean, boolean)}.
367     *
368     * @param componentName the name of the component
369     * @return the component
370     */
371    Component getComponent(String componentName);
372
373    /**
374     * Gets a component from the CamelContext by name.
375     * <p/>
376     * Notice the returned component will be auto-started. If you do not intend to do that
377     * then use {@link #getComponent(String, boolean, boolean)}.
378     *
379     * @param name                 the name of the component
380     * @param autoCreateComponents whether or not the component should
381     *                             be lazily created if it does not already exist
382     * @return the component
383     */
384    Component getComponent(String name, boolean autoCreateComponents);
385
386    /**
387     * Gets a component from the CamelContext by name.
388     *
389     * @param name                 the name of the component
390     * @param autoCreateComponents whether or not the component should
391     *                             be lazily created if it does not already exist
392     * @param autoStart            whether to auto start the component if {@link CamelContext} is already started.
393     * @return the component
394     */
395    Component getComponent(String name, boolean autoCreateComponents, boolean autoStart);
396
397    /**
398     * Gets a component from the CamelContext by name and specifying the expected type of component.
399     *
400     * @param name          the name to lookup
401     * @param componentType the expected type
402     * @return the component
403     */
404    <T extends Component> T getComponent(String name, Class<T> componentType);
405
406    /**
407     * Gets a readonly list of names of the components currently registered
408     *
409     * @return a readonly list with the names of the components
410     */
411    List<String> getComponentNames();
412
413    /**
414     * Removes a previously added component.
415     * <p/>
416     * The component being removed will be stopped first.
417     *
418     * @param componentName the component name to remove
419     * @return the previously added component or null if it had not been previously added.
420     */
421    Component removeComponent(String componentName);
422
423    // Endpoint Management Methods
424    //-----------------------------------------------------------------------
425
426    /**
427     * Gets the {@link org.apache.camel.spi.EndpointRegistry}
428     */
429    EndpointRegistry<? extends ValueHolder<String>> getEndpointRegistry();
430
431    /**
432     * Resolves the given name to an {@link Endpoint} of the specified type.
433     * If the name has a singleton endpoint registered, then the singleton is returned.
434     * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}.
435     *
436     * @param uri the URI of the endpoint
437     * @return the endpoint
438     */
439    Endpoint getEndpoint(String uri);
440
441    /**
442     * Resolves the given name to an {@link Endpoint} of the specified type.
443     * If the name has a singleton endpoint registered, then the singleton is returned.
444     * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}.
445     *
446     * @param name         the name of the endpoint
447     * @param endpointType the expected type
448     * @return the endpoint
449     */
450    <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType);
451
452    /**
453     * Returns a new {@link Collection} of all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry}
454     *
455     * @return all endpoints
456     */
457    Collection<Endpoint> getEndpoints();
458
459    /**
460     * Returns a new {@link Map} containing all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry}
461     *
462     * @return map of endpoints
463     */
464    Map<String, Endpoint> getEndpointMap();
465
466    /**
467     * Is the given endpoint already registered in the {@link org.apache.camel.spi.EndpointRegistry}
468     *
469     * @param uri the URI of the endpoint
470     * @return the registered endpoint or <tt>null</tt> if not registered
471     */
472    Endpoint hasEndpoint(String uri);
473
474    /**
475     * Adds the endpoint to the {@link org.apache.camel.spi.EndpointRegistry} using the given URI.
476     *
477     * @param uri      the URI to be used to resolve this endpoint
478     * @param endpoint the endpoint to be added to the registry
479     * @return the old endpoint that was previously registered or <tt>null</tt> if none was registered
480     * @throws Exception if the new endpoint could not be started or the old endpoint could not be stopped
481     */
482    Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception;
483
484    /**
485     * Removes the endpoint from the {@link org.apache.camel.spi.EndpointRegistry}.
486     * <p/>
487     * The endpoint being removed will be stopped first.
488     *
489     * @param endpoint  the endpoint
490     * @throws Exception if the endpoint could not be stopped
491     */
492    void removeEndpoint(Endpoint endpoint) throws Exception;
493
494    /**
495     * Removes all endpoints with the given URI from the {@link org.apache.camel.spi.EndpointRegistry}.
496     * <p/>
497     * The endpoints being removed will be stopped first.
498     *
499     * @param pattern an uri or pattern to match
500     * @return a collection of endpoints removed which could be empty if there are no endpoints found for the given <tt>pattern</tt>
501     * @throws Exception if at least one endpoint could not be stopped
502     * @see org.apache.camel.util.EndpointHelper#matchEndpoint(CamelContext, String, String) for pattern
503     */
504    Collection<Endpoint> removeEndpoints(String pattern) throws Exception;
505
506    /**
507     * Registers a {@link org.apache.camel.spi.EndpointStrategy callback} to allow you to do custom
508     * logic when an {@link Endpoint} is about to be registered to the {@link org.apache.camel.spi.EndpointRegistry}.
509     * <p/>
510     * When a callback is added it will be executed on the already registered endpoints allowing you to catch-up
511     *
512     * @param strategy callback to be invoked
513     */
514    void addRegisterEndpointCallback(EndpointStrategy strategy);
515
516    // Route Management Methods
517    //-----------------------------------------------------------------------
518
519    /**
520     * NOTE: experimental api
521     *
522     * @param routeController the route controller
523     */
524    void setRouteController(RouteController routeController);
525
526    /**
527     * NOTE: experimental api
528     *
529     * @return the route controller or null if not set.
530     */
531    RouteController getRouteController();
532
533    /**
534     * Method to signal to {@link CamelContext} that the process to initialize setup routes is in progress.
535     *
536     * @param done <tt>false</tt> to start the process, call again with <tt>true</tt> to signal its done.
537     * @see #isSetupRoutes()
538     */
539    void setupRoutes(boolean done);
540
541    /**
542     * Returns a list of the current route definitions
543     *
544     * @return list of the current route definitions
545     */
546    List<RouteDefinition> getRouteDefinitions();
547
548    /**
549     * Gets the route definition with the given id
550     *
551     * @param id id of the route
552     * @return the route definition or <tt>null</tt> if not found
553     */
554    RouteDefinition getRouteDefinition(String id);
555
556    /**
557     * Returns a list of the current REST definitions
558     *
559     * @return list of the current REST definitions
560     */
561    List<RestDefinition> getRestDefinitions();
562
563    /**
564     * Adds a collection of rest definitions to the context
565     *
566     * @param restDefinitions the rest(s) definition to add
567     */
568    void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception;
569
570    /**
571     * Sets a custom {@link org.apache.camel.spi.RestConfiguration}
572     *
573     * @param restConfiguration the REST configuration
574     */
575    void setRestConfiguration(RestConfiguration restConfiguration);
576
577    /**
578     * Gets the default REST configuration
579     *
580     * @return the configuration, or <tt>null</tt> if none has been configured.
581     */
582    RestConfiguration getRestConfiguration();
583    
584    /**
585     * Sets a custom {@link org.apache.camel.spi.RestConfiguration}
586     *
587     * @param restConfiguration the REST configuration
588     */
589    void addRestConfiguration(RestConfiguration restConfiguration);
590
591    /**
592     * Gets the REST configuration for the given component
593     *
594     * @param component the component name to get the configuration
595     * @param defaultIfNotFound determine if the default configuration is returned if there isn't a 
596     *        specific configuration for the given component  
597     * @return the configuration, or <tt>null</tt> if none has been configured.
598     */
599    RestConfiguration getRestConfiguration(String component, boolean defaultIfNotFound);
600    
601    /**
602     * Gets all the RestConfiguration's
603     */
604    Collection<RestConfiguration> getRestConfigurations();
605
606    /**
607     * Gets the service call configuration by the given name. If no name is given
608     * the default configuration is returned, see <tt>setServiceCallConfiguration</tt>
609     *
610     * @param serviceName name of service, or <tt>null</tt> to return the default configuration
611     * @return the configuration, or <tt>null</tt> if no configuration has been registered
612     */
613    ServiceCallConfigurationDefinition getServiceCallConfiguration(String serviceName);
614
615    /**
616     * Sets the default service call configuration
617     *
618     * @param configuration the configuration
619     */
620    void setServiceCallConfiguration(ServiceCallConfigurationDefinition configuration);
621
622    /**
623     * Sets the service call configurations
624     *
625     * @param configurations the configuration list
626     */
627    void setServiceCallConfigurations(List<ServiceCallConfigurationDefinition> configurations);
628
629    /**
630     * Adds the service call configuration
631     *
632     * @param serviceName name of the service
633     * @param configuration the configuration
634     */
635    void addServiceCallConfiguration(String serviceName, ServiceCallConfigurationDefinition configuration);
636
637    /**
638     * Gets the Hystrix configuration by the given name. If no name is given
639     * the default configuration is returned, see <tt>setHystrixConfiguration</tt>
640     *
641     * @param id id of the configuration, or <tt>null</tt> to return the default configuration
642     * @return the configuration, or <tt>null</tt> if no configuration has been registered
643     */
644    HystrixConfigurationDefinition getHystrixConfiguration(String id);
645
646    /**
647     * Sets the default Hystrix configuration
648     *
649     * @param configuration the configuration
650     */
651    void setHystrixConfiguration(HystrixConfigurationDefinition configuration);
652
653    /**
654     * Sets the Hystrix configurations
655     *
656     * @param configurations the configuration list
657     */
658    void setHystrixConfigurations(List<HystrixConfigurationDefinition> configurations);
659
660    /**
661     * Adds the Hystrix configuration
662     *
663     * @param id name of the configuration
664     * @param configuration the configuration
665     */
666    void addHystrixConfiguration(String id, HystrixConfigurationDefinition configuration);
667
668    /**
669     * Returns the order in which the route inputs was started.
670     * <p/>
671     * The order may not be according to the startupOrder defined on the route.
672     * For example a route could be started manually later, or new routes added at runtime.
673     *
674     * @return a list in the order how routes was started
675     */
676    List<RouteStartupOrder> getRouteStartupOrder();
677
678    /**
679     * Returns the current routes in this CamelContext
680     *
681     * @return the current routes
682     */
683    List<Route> getRoutes();
684
685    /**
686     * Gets the route with the given id
687     *
688     * @param id id of the route
689     * @return the route or <tt>null</tt> if not found
690     */
691    Route getRoute(String id);
692
693    /**
694     * Gets the processor from any of the routes which with the given id
695     *
696     * @param id id of the processor
697     * @return the processor or <tt>null</tt> if not found
698     */
699    Processor getProcessor(String id);
700
701    /**
702     * Gets the processor from any of the routes which with the given id
703     *
704     * @param id id of the processor
705     * @param type the processor type
706     * @return the processor or <tt>null</tt> if not found
707     * @throws java.lang.ClassCastException is thrown if the type is not correct type
708     */
709    <T extends Processor> T getProcessor(String id, Class<T> type);
710
711    /**
712     * Gets the managed processor client api from any of the routes which with the given id
713     *
714     * @param id id of the processor
715     * @param type the managed processor type from the {@link org.apache.camel.api.management.mbean} package.
716     * @return the processor or <tt>null</tt> if not found
717     * @throws IllegalArgumentException if the type is not compliant
718     */
719    <T extends ManagedProcessorMBean> T getManagedProcessor(String id, Class<T> type);
720
721    /**
722     * Gets the managed route client api with the given route id
723     *
724     * @param routeId id of the route
725     * @param type the managed route type from the {@link org.apache.camel.api.management.mbean} package.
726     * @return the route or <tt>null</tt> if not found
727     * @throws IllegalArgumentException if the type is not compliant
728     */
729    <T extends ManagedRouteMBean> T getManagedRoute(String routeId, Class<T> type);
730
731    /**
732     * Gets the managed Camel CamelContext client api
733     */
734    ManagedCamelContextMBean getManagedCamelContext();
735
736    /**
737     * Gets the processor definition from any of the routes which with the given id
738     *
739     * @param id id of the processor definition
740     * @return the processor definition or <tt>null</tt> if not found
741     */
742    ProcessorDefinition getProcessorDefinition(String id);
743
744    /**
745     * Gets the processor definition from any of the routes which with the given id
746     *
747     * @param id id of the processor definition
748     * @param type the processor definition type
749     * @return the processor definition or <tt>null</tt> if not found
750     * @throws java.lang.ClassCastException is thrown if the type is not correct type
751     */
752    <T extends ProcessorDefinition> T getProcessorDefinition(String id, Class<T> type);
753
754    /**
755     * Adds a collection of routes to this CamelContext using the given builder
756     * to build them.
757     * <p/>
758     * <b>Important:</b> The added routes will <b>only</b> be started, if {@link CamelContext}
759     * is already started. You may want to check the state of {@link CamelContext} before
760     * adding the routes, using the {@link org.apache.camel.CamelContext#getStatus()} method.
761     * <p/>
762     * <b>Important: </b> Each route in the same {@link org.apache.camel.CamelContext} must have an <b>unique</b> route id.
763     * If you use the API from {@link org.apache.camel.CamelContext} or {@link org.apache.camel.model.ModelCamelContext} to add routes, then any
764     * new routes which has a route id that matches an old route, then the old route is replaced by the new route.
765     *
766     * @param builder the builder which will create the routes and add them to this CamelContext
767     * @throws Exception if the routes could not be created for whatever reason
768     */
769    void addRoutes(RoutesBuilder builder) throws Exception;
770
771    /**
772     * Loads a collection of route definitions from the given {@link java.io.InputStream}.
773     *
774     * @param is input stream with the route(s) definition to add
775     * @throws Exception if the route definitions could not be loaded for whatever reason
776     * @return the route definitions
777     */
778    RoutesDefinition loadRoutesDefinition(InputStream is) throws Exception;
779
780    /**
781     * Loads a collection of rest definitions from the given {@link java.io.InputStream}.
782     *
783     * @param is input stream with the rest(s) definition to add
784     * @throws Exception if the rest definitions could not be loaded for whatever reason
785     * @return the rest definitions
786     */
787    RestsDefinition loadRestsDefinition(InputStream is) throws Exception;
788    
789    /**
790     * Adds a collection of route definitions to the context
791     *
792     * @param routeDefinitions the route(s) definition to add
793     * @throws Exception if the route definitions could not be created for whatever reason
794     */
795    void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception;
796
797    /**
798     * Add a route definition to the context
799     *
800     * @param routeDefinition the route definition to add
801     * @throws Exception if the route definition could not be created for whatever reason
802     */
803    void addRouteDefinition(RouteDefinition routeDefinition) throws Exception;
804
805    /**
806     * Removes a collection of route definitions from the CamelContext - stopping any previously running
807     * routes if any of them are actively running
808     *
809     * @param routeDefinitions route(s) definitions to remove
810     * @throws Exception if the route definitions could not be removed for whatever reason
811     */
812    void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception;
813
814    /**
815     * Removes a route definition from the CamelContext - stopping any previously running
816     * routes if any of them are actively running
817     *
818     * @param routeDefinition route definition to remove
819     * @throws Exception if the route definition could not be removed for whatever reason
820     */
821    void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception;
822
823    /**
824     * Starts the given route if it has been previously stopped
825     *
826     * @param route the route to start
827     * @throws Exception is thrown if the route could not be started for whatever reason
828     * @deprecated favor using {@link CamelContext#startRoute(String)}
829     */
830    @Deprecated
831    void startRoute(RouteDefinition route) throws Exception;
832
833    /**
834     * Starts all the routes which currently is not started.
835     *
836     * @throws Exception is thrown if a route could not be started for whatever reason
837     */
838    void startAllRoutes() throws Exception;
839
840    /**
841     * Starts the given route if it has been previously stopped
842     *
843     * @param routeId the route id
844     * @throws Exception is thrown if the route could not be started for whatever reason
845     */
846    void startRoute(String routeId) throws Exception;
847
848    /**
849     * Stops the given route.
850     *
851     * @param route the route to stop
852     * @throws Exception is thrown if the route could not be stopped for whatever reason
853     * @deprecated favor using {@link CamelContext#stopRoute(String)}
854     */
855    @Deprecated
856    void stopRoute(RouteDefinition route) throws Exception;
857
858    /**
859     * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
860     *
861     * @param routeId the route id
862     * @throws Exception is thrown if the route could not be stopped for whatever reason
863     * @see #suspendRoute(String)
864     */
865    void stopRoute(String routeId) throws Exception;
866
867    /**
868     * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
869     *
870     * @param routeId the route id
871     * @param timeout  timeout
872     * @param timeUnit the unit to use
873     * @throws Exception is thrown if the route could not be stopped for whatever reason
874     * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit)
875     */
876    void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
877
878    /**
879     * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout 
880     * and optional abortAfterTimeout mode.
881     *
882     * @param routeId the route id
883     * @param timeout  timeout
884     * @param timeUnit the unit to use
885     * @param abortAfterTimeout should abort shutdown after timeout
886     * @return <tt>true</tt> if the route is stopped before the timeout
887     * @throws Exception is thrown if the route could not be stopped for whatever reason
888     * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit)
889     */
890    boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception;
891    
892    /**
893     * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
894     *
895     * @param routeId the route id
896     * @throws Exception is thrown if the route could not be shutdown for whatever reason
897     * @deprecated use {@link #stopRoute(String)} and {@link #removeRoute(String)}
898     */
899    @Deprecated
900    void shutdownRoute(String routeId) throws Exception;
901
902    /**
903     * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
904     *
905     * @param routeId  the route id
906     * @param timeout  timeout
907     * @param timeUnit the unit to use
908     * @throws Exception is thrown if the route could not be shutdown for whatever reason
909     * @deprecated use {@link #stopRoute(String, long, java.util.concurrent.TimeUnit)} and {@link #removeRoute(String)}
910     */
911    @Deprecated
912    void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
913
914    /**
915     * Removes the given route (the route <b>must</b> be stopped before it can be removed).
916     * <p/>
917     * A route which is removed will be unregistered from JMX, have its services stopped/shutdown and the route
918     * definition etc. will also be removed. All the resources related to the route will be stopped and cleared.
919     * <p/>
920     * <b>Important:</b> When removing a route, the {@link Endpoint}s which are in the static cache of
921     * {@link org.apache.camel.spi.EndpointRegistry} and are <b>only</b> used by the route (not used by other routes)
922     * will also be removed. But {@link Endpoint}s which may have been created as part of routing messages by the route,
923     * and those endpoints are enlisted in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry} are
924     * <b>not</b> removed. To remove those dynamic kind of endpoints, use the {@link #removeEndpoints(String)} method.
925     * If not removing those endpoints, they will be kept in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry},
926     * but my eventually be removed (evicted) when they have not been in use for a longer period of time; and the
927     * dynamic cache upper limit is hit, and it evicts the least used endpoints.
928     * <p/>
929     * End users can use this method to remove unwanted routes or temporary routes which no longer is in demand.
930     *
931     * @param routeId the route id
932     * @return <tt>true</tt> if the route was removed, <tt>false</tt> if the route could not be removed because its not stopped
933     * @throws Exception is thrown if the route could not be shutdown for whatever reason
934     */
935    boolean removeRoute(String routeId) throws Exception;
936
937    /**
938     * Resumes the given route if it has been previously suspended
939     * <p/>
940     * If the route does <b>not</b> support suspension the route will be started instead
941     *
942     * @param routeId the route id
943     * @throws Exception is thrown if the route could not be resumed for whatever reason
944     */
945    void resumeRoute(String routeId) throws Exception;
946
947    /**
948     * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
949     * <p/>
950     * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support)
951     * otherwise the consumers will be stopped.
952     * <p/>
953     * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.
954     * <p/>
955     * If the route does <b>not</b> support suspension the route will be stopped instead
956     *
957     * @param routeId the route id
958     * @throws Exception is thrown if the route could not be suspended for whatever reason
959     */
960    void suspendRoute(String routeId) throws Exception;
961
962    /**
963     * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
964     * <p/>
965     * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support)
966     * otherwise the consumers will be stopped.
967     * <p/>
968     * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.
969     * <p/>
970     * If the route does <b>not</b> support suspension the route will be stopped instead
971     *
972     * @param routeId  the route id
973     * @param timeout  timeout
974     * @param timeUnit the unit to use
975     * @throws Exception is thrown if the route could not be suspended for whatever reason
976     */
977    void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
978
979    /**
980     * Returns the current status of the given route
981     *
982     * @param routeId the route id
983     * @return the status for the route
984     */
985    ServiceStatus getRouteStatus(String routeId);
986
987    /**
988     * Indicates whether current thread is starting route(s).
989     * <p/>
990     * This can be useful to know by {@link LifecycleStrategy} or the likes, in case
991     * they need to react differently.
992     *
993     * @return <tt>true</tt> if current thread is starting route(s), or <tt>false</tt> if not.
994     */
995    boolean isStartingRoutes();
996
997    /**
998     * Indicates whether current thread is setting up route(s) as part of starting Camel from spring/blueprint.
999     * <p/>
1000     * This can be useful to know by {@link LifecycleStrategy} or the likes, in case
1001     * they need to react differently.
1002     * <p/>
1003     * As the startup procedure of {@link CamelContext} is slightly different when using plain Java versus
1004     * Spring or Blueprint, then we need to know when Spring/Blueprint is setting up the routes, which
1005     * can happen after the {@link CamelContext} itself is in started state, due the asynchronous event nature
1006     * of especially Blueprint.
1007     *
1008     * @return <tt>true</tt> if current thread is setting up route(s), or <tt>false</tt> if not.
1009     */
1010    boolean isSetupRoutes();
1011
1012    // Properties
1013    //-----------------------------------------------------------------------
1014
1015    /**
1016     * Returns the type converter used to coerce types from one type to another
1017     *
1018     * @return the converter
1019     */
1020    TypeConverter getTypeConverter();
1021
1022    /**
1023     * Returns the type converter registry where type converters can be added or looked up
1024     *
1025     * @return the type converter registry
1026     */
1027    TypeConverterRegistry getTypeConverterRegistry();
1028
1029    /**
1030     * Returns the registry used to lookup components by name and type such as the Spring ApplicationContext,
1031     * JNDI or the OSGi Service Registry
1032     *
1033     * @return the registry
1034     */
1035    Registry getRegistry();
1036
1037    /**
1038     * Returns the registry used to lookup components by name and as the given type
1039     *
1040     * @param type the registry type such as {@link org.apache.camel.impl.JndiRegistry}
1041     * @return the registry, or <tt>null</tt> if the given type was not found as a registry implementation
1042     */
1043    <T> T getRegistry(Class<T> type);
1044
1045    /**
1046     * Returns the injector used to instantiate objects by type
1047     *
1048     * @return the injector
1049     */
1050    Injector getInjector();
1051
1052    /**
1053     * Returns the management mbean assembler
1054     *
1055     * @return the mbean assembler
1056     */
1057    ManagementMBeanAssembler getManagementMBeanAssembler();
1058
1059    /**
1060     * Returns the lifecycle strategies used to handle lifecycle notifications
1061     *
1062     * @return the lifecycle strategies
1063     */
1064    List<LifecycleStrategy> getLifecycleStrategies();
1065
1066    /**
1067     * Adds the given lifecycle strategy to be used.
1068     *
1069     * @param lifecycleStrategy the strategy
1070     */
1071    void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy);
1072
1073    /**
1074     * Resolves a language for creating expressions
1075     *
1076     * @param language name of the language
1077     * @return the resolved language
1078     */
1079    Language resolveLanguage(String language);
1080
1081    /**
1082     * Parses the given text and resolve any property placeholders - using {{key}}.
1083     *
1084     * @param text the text such as an endpoint uri or the likes
1085     * @return the text with resolved property placeholders
1086     * @throws Exception is thrown if property placeholders was used and there was an error resolving them
1087     */
1088    String resolvePropertyPlaceholders(String text) throws Exception;
1089    
1090    /**
1091     * Returns the configured property placeholder prefix token if and only if the CamelContext has
1092     * property placeholder abilities, otherwise returns {@code null}.
1093     * 
1094     * @return the prefix token or {@code null}
1095     */
1096    String getPropertyPrefixToken();
1097    
1098    /**
1099     * Returns the configured property placeholder suffix token if and only if the CamelContext has
1100     * property placeholder abilities, otherwise returns {@code null}.
1101     * 
1102     * @return the suffix token or {@code null}
1103     */
1104    String getPropertySuffixToken();
1105
1106    /**
1107     * Gets a readonly list with the names of the languages currently registered.
1108     *
1109     * @return a readonly list with the names of the languages
1110     */
1111    List<String> getLanguageNames();
1112
1113    /**
1114     * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away.
1115     * <p/>
1116     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
1117     * Why does Camel use too many threads with ProducerTemplate?</a>
1118     * <p/>
1119     * <b>Important:</b> Make sure to call {@link org.apache.camel.ProducerTemplate#stop()} when you are done using the template,
1120     * to clean up any resources.
1121     * <p/>
1122     * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
1123     * If no key was defined then it will fallback to a default size of 1000.
1124     * You can also use the {@link org.apache.camel.ProducerTemplate#setMaximumCacheSize(int)} method to use a custom value
1125     * before starting the template.
1126     *
1127     * @return the template
1128     * @throws RuntimeCamelException is thrown if error starting the template
1129     */
1130    ProducerTemplate createProducerTemplate();
1131
1132    /**
1133     * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away.
1134     * <p/>
1135     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
1136     * Why does Camel use too many threads with ProducerTemplate?</a>
1137     * <p/>
1138     * <b>Important:</b> Make sure to call {@link ProducerTemplate#stop()} when you are done using the template,
1139     * to clean up any resources.
1140     *
1141     * @param maximumCacheSize the maximum cache size
1142     * @return the template
1143     * @throws RuntimeCamelException is thrown if error starting the template
1144     */
1145    ProducerTemplate createProducerTemplate(int maximumCacheSize);
1146
1147    /**
1148     * Creates a new {@link FluentProducerTemplate} which is <b>started</b> and therefore ready to use right away.
1149     * <p/>
1150     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
1151     * Why does Camel use too many threads with ProducerTemplate?</a>
1152     * <p/>
1153     * <b>Important:</b> Make sure to call {@link org.apache.camel.FluentProducerTemplate#stop()} when you are done using the template,
1154     * to clean up any resources.
1155     * <p/>
1156     * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
1157     * If no key was defined then it will fallback to a default size of 1000.
1158     * You can also use the {@link org.apache.camel.FluentProducerTemplate#setMaximumCacheSize(int)} method to use a custom value
1159     * before starting the template.
1160     *
1161     * @return the template
1162     * @throws RuntimeCamelException is thrown if error starting the template
1163     */
1164    FluentProducerTemplate createFluentProducerTemplate();
1165
1166    /**
1167     * Creates a new {@link FluentProducerTemplate} which is <b>started</b> and therefore ready to use right away.
1168     * <p/>
1169     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
1170     * Why does Camel use too many threads with ProducerTemplate?</a>
1171     * <p/>
1172     * <b>Important:</b> Make sure to call {@link FluentProducerTemplate#stop()} when you are done using the template,
1173     * to clean up any resources.
1174     *
1175     * @param maximumCacheSize the maximum cache size
1176     * @return the template
1177     * @throws RuntimeCamelException is thrown if error starting the template
1178     */
1179    FluentProducerTemplate createFluentProducerTemplate(int maximumCacheSize);
1180
1181    /**
1182     * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away.
1183     * <p/>
1184     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
1185     * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate.
1186     * <p/>
1187     * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template,
1188     * to clean up any resources.
1189     * <p/>
1190     * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
1191     * If no key was defined then it will fallback to a default size of 1000.
1192     * You can also use the {@link org.apache.camel.ConsumerTemplate#setMaximumCacheSize(int)} method to use a custom value
1193     * before starting the template.
1194     *
1195     * @return the template
1196     * @throws RuntimeCamelException is thrown if error starting the template
1197     */
1198    ConsumerTemplate createConsumerTemplate();
1199
1200    /**
1201     * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away.
1202     * <p/>
1203     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
1204     * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate.
1205     * <p/>
1206     * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template,
1207     * to clean up any resources.
1208     *
1209     * @param maximumCacheSize the maximum cache size
1210     * @return the template
1211     * @throws RuntimeCamelException is thrown if error starting the template
1212     */
1213    ConsumerTemplate createConsumerTemplate(int maximumCacheSize);
1214
1215    /**
1216     * Adds the given interceptor strategy
1217     *
1218     * @param interceptStrategy the strategy
1219     */
1220    void addInterceptStrategy(InterceptStrategy interceptStrategy);
1221
1222    /**
1223     * Gets the interceptor strategies
1224     *
1225     * @return the list of current interceptor strategies
1226     */
1227    List<InterceptStrategy> getInterceptStrategies();
1228
1229    /**
1230     * Gets the default error handler builder which is inherited by the routes
1231     *
1232     * @return the builder
1233     * @deprecated The return type will be switched to {@link ErrorHandlerFactory} in Camel 3.0
1234     */
1235    @Deprecated
1236    ErrorHandlerBuilder getErrorHandlerBuilder();
1237
1238    /**
1239     * Sets the default error handler builder which is inherited by the routes
1240     *
1241     * @param errorHandlerBuilder the builder
1242     */
1243    void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder);
1244
1245    /**
1246     * Gets the default shared thread pool for error handlers which
1247     * leverages this for asynchronous redelivery tasks.
1248     */
1249    ScheduledExecutorService getErrorHandlerExecutorService();
1250
1251    /**
1252     * Sets the data formats that can be referenced in the routes.
1253     *
1254     * @param dataFormats the data formats
1255     */
1256    void setDataFormats(Map<String, DataFormatDefinition> dataFormats);
1257
1258    /**
1259     * Gets the data formats that can be referenced in the routes.
1260     *
1261     * @return the data formats available
1262     */
1263    Map<String, DataFormatDefinition> getDataFormats();
1264
1265    /**
1266     * Resolve a data format given its name
1267     *
1268     * @param name the data format name or a reference to it in the {@link Registry}
1269     * @return the resolved data format, or <tt>null</tt> if not found
1270     */
1271    DataFormat resolveDataFormat(String name);
1272
1273    /**
1274     * Creates the given data format given its name.
1275     *
1276     * @param name the data format name or a reference to a data format factory in the {@link Registry}
1277     * @return the resolved data format, or <tt>null</tt> if not found
1278     */
1279    DataFormat createDataFormat(String name);
1280
1281    /**
1282     * Resolve a data format definition given its name
1283     *
1284     * @param name the data format definition name or a reference to it in the {@link Registry}
1285     * @return the resolved data format definition, or <tt>null</tt> if not found
1286     */
1287    DataFormatDefinition resolveDataFormatDefinition(String name);
1288
1289    /**
1290     * Gets the current data format resolver
1291     *
1292     * @return the resolver
1293     */
1294    DataFormatResolver getDataFormatResolver();
1295
1296    /**
1297     * Sets a custom data format resolver
1298     *
1299     * @param dataFormatResolver the resolver
1300     */
1301    void setDataFormatResolver(DataFormatResolver dataFormatResolver);
1302
1303    /**
1304     * Sets the transformers that can be referenced in the routes.
1305     *
1306     * @param transformers the transformers
1307     */
1308    void setTransformers(List<TransformerDefinition> transformers);
1309
1310    /**
1311     * Gets the transformers that can be referenced in the routes.
1312     *
1313     * @return the transformers available
1314     */
1315    List<TransformerDefinition> getTransformers();
1316
1317    /**
1318     * Resolve a transformer given a scheme
1319     *
1320     * @param model data model name.
1321     * @return the resolved transformer, or <tt>null</tt> if not found
1322     */
1323    Transformer resolveTransformer(String model);
1324
1325    /**
1326     * Resolve a transformer given from/to data type.
1327     *
1328     * @param from from data type
1329     * @param to to data type
1330     * @return the resolved transformer, or <tt>null</tt> if not found
1331     */
1332    Transformer resolveTransformer(DataType from, DataType to);
1333
1334    /**
1335     * Gets the {@link org.apache.camel.spi.TransformerRegistry}
1336     * @return the TransformerRegistry
1337     */
1338    TransformerRegistry<? extends ValueHolder<String>> getTransformerRegistry();
1339
1340    /**
1341     * Sets the validators that can be referenced in the routes.
1342     *
1343     * @param validators the validators
1344     */
1345    void setValidators(List<ValidatorDefinition> validators);
1346
1347    /**
1348     * Gets the validators that can be referenced in the routes.
1349     *
1350     * @return the validators available
1351     */
1352    List<ValidatorDefinition> getValidators();
1353
1354    /**
1355     * Resolve a validator given from/to data type.
1356     *
1357     * @param type the data type
1358     * @return the resolved validator, or <tt>null</tt> if not found
1359     */
1360    Validator resolveValidator(DataType type);
1361
1362    /**
1363     * Gets the {@link org.apache.camel.spi.ValidatorRegistry}
1364     * @return the ValidatorRegistry
1365     */
1366    ValidatorRegistry<? extends ValueHolder<String>> getValidatorRegistry();
1367
1368    /**
1369     * @deprecated use {@link #setGlobalOptions(Map) setGlobalOptions(Map<String,String>) instead}.
1370     */
1371    @Deprecated
1372    void setProperties(Map<String, String> properties);
1373
1374    /**
1375     * Sets global options that can be referenced in the camel context
1376     * <p/>
1377     * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs
1378     * which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
1379     * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details
1380     * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation.
1381     *
1382     * @param globalOptions global options that can be referenced in the camel context
1383     */
1384    void setGlobalOptions(Map<String, String> globalOptions);
1385
1386    /**
1387     * @deprecated use {@link #getGlobalOptions()} instead.
1388     */
1389    @Deprecated
1390    Map<String, String> getProperties();
1391
1392    /**
1393     * Gets global options that can be referenced in the camel context.
1394     * <p/>
1395     * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs
1396     * which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
1397     * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details
1398     * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation.
1399     *
1400     * @return global options for this context
1401     */
1402    Map<String, String> getGlobalOptions();
1403
1404    /**
1405     * @deprecated use {@link #getGlobalOption(String)} instead.
1406     */
1407    @Deprecated
1408    String getProperty(String key);
1409
1410    /**
1411     * Gets the global option value that can be referenced in the camel context
1412     * <p/>
1413     * <b>Important:</b> This has nothing to do with property placeholders, and is just a plain set of key/value pairs
1414     * which are used to configure global options on CamelContext, such as a maximum debug logging length etc.
1415     * For property placeholders use {@link #resolvePropertyPlaceholders(String)} method and see more details
1416     * at the <a href="http://camel.apache.org/using-propertyplaceholder.html">property placeholder</a> documentation.
1417     *
1418     * @return the string value of the global option
1419     */
1420    String getGlobalOption(String key);
1421
1422    /**
1423     * Gets the default FactoryFinder which will be used for the loading the factory class from META-INF
1424     *
1425     * @return the default factory finder
1426     */
1427    FactoryFinder getDefaultFactoryFinder();
1428
1429    /**
1430     * Sets the factory finder resolver to use.
1431     *
1432     * @param resolver the factory finder resolver
1433     */
1434    void setFactoryFinderResolver(FactoryFinderResolver resolver);
1435
1436    /**
1437     * Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path
1438     *
1439     * @param path the META-INF path
1440     * @return the factory finder
1441     * @throws NoFactoryAvailableException is thrown if a factory could not be found
1442     */
1443    FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException;
1444
1445    /**
1446     * Returns the class resolver to be used for loading/lookup of classes.
1447     *
1448     * @return the resolver
1449     */
1450    ClassResolver getClassResolver();
1451
1452    /**
1453     * Returns the package scanning class resolver
1454     *
1455     * @return the resolver
1456     */
1457    PackageScanClassResolver getPackageScanClassResolver();
1458
1459    /**
1460     * Sets the class resolver to be use
1461     *
1462     * @param resolver the resolver
1463     */
1464    void setClassResolver(ClassResolver resolver);
1465
1466    /**
1467     * Sets the package scanning class resolver to use
1468     *
1469     * @param resolver the resolver
1470     */
1471    void setPackageScanClassResolver(PackageScanClassResolver resolver);
1472
1473    /**
1474     * Sets a pluggable service pool to use for {@link Producer} pooling.
1475     *
1476     * @param servicePool the pool
1477     */
1478    void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool);
1479
1480    /**
1481     * Gets the service pool for {@link Producer} pooling.
1482     *
1483     * @return the service pool
1484     */
1485    ServicePool<Endpoint, Producer> getProducerServicePool();
1486    
1487    /**
1488     * Sets a pluggable service pool to use for {@link PollingConsumer} pooling.
1489     *
1490     * @param servicePool the pool
1491     */
1492    void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool);
1493
1494    /**
1495     * Gets the service pool for {@link Producer} pooling.
1496     *
1497     * @return the service pool
1498     */
1499    ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool();
1500    
1501    /**
1502     * Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions
1503     *
1504     * @param factory custom factory to use
1505     */
1506    void setNodeIdFactory(NodeIdFactory factory);
1507
1508    /**
1509     * Gets the node id factory
1510     *
1511     * @return the node id factory
1512     */
1513    NodeIdFactory getNodeIdFactory();
1514
1515    /**
1516     * Gets the management strategy
1517     *
1518     * @return the management strategy
1519     */
1520    ManagementStrategy getManagementStrategy();
1521
1522    /**
1523     * Sets the management strategy to use
1524     *
1525     * @param strategy the management strategy
1526     */
1527    void setManagementStrategy(ManagementStrategy strategy);
1528
1529    /**
1530     * Gets the default tracer
1531     *
1532     * @return the default tracer
1533     */
1534    InterceptStrategy getDefaultTracer();
1535
1536    /**
1537     * Sets a custom tracer to be used as the default tracer.
1538     * <p/>
1539     * <b>Note:</b> This must be set before any routes are created,
1540     * changing the default tracer for existing routes is not supported.
1541     *
1542     * @param tracer the custom tracer to use as default tracer
1543     */
1544    void setDefaultTracer(InterceptStrategy tracer);
1545
1546    /**
1547     * Gets the default backlog tracer
1548     *
1549     * @return the default backlog tracer
1550     */
1551    InterceptStrategy getDefaultBacklogTracer();
1552
1553    /**
1554     * Sets a custom backlog tracer to be used as the default backlog tracer.
1555     * <p/>
1556     * <b>Note:</b> This must be set before any routes are created,
1557     * changing the default backlog tracer for existing routes is not supported.
1558     *
1559     * @param backlogTracer the custom tracer to use as default backlog tracer
1560     */
1561    void setDefaultBacklogTracer(InterceptStrategy backlogTracer);
1562
1563    /**
1564     * Gets the default backlog debugger
1565     *
1566     * @return the default backlog debugger
1567     */
1568    InterceptStrategy getDefaultBacklogDebugger();
1569
1570    /**
1571     * Sets a custom backlog debugger to be used as the default backlog debugger.
1572     * <p/>
1573     * <b>Note:</b> This must be set before any routes are created,
1574     * changing the default backlog debugger for existing routes is not supported.
1575     *
1576     * @param backlogDebugger the custom debugger to use as default backlog debugger
1577     */
1578    void setDefaultBacklogDebugger(InterceptStrategy backlogDebugger);
1579
1580    /**
1581     * Disables using JMX as {@link org.apache.camel.spi.ManagementStrategy}.
1582     * <p/>
1583     * <b>Important:</b> This method must be called <b>before</b> the {@link CamelContext} is started.
1584     *
1585     * @throws IllegalStateException is thrown if the {@link CamelContext} is not in stopped state.
1586     */
1587    void disableJMX() throws IllegalStateException;
1588
1589    /**
1590     * Gets the inflight repository
1591     *
1592     * @return the repository
1593     */
1594    InflightRepository getInflightRepository();
1595
1596    /**
1597     * Sets a custom inflight repository to use
1598     *
1599     * @param repository the repository
1600     */
1601    void setInflightRepository(InflightRepository repository);
1602
1603    /**
1604     * Gets the {@link org.apache.camel.AsyncProcessor} await manager.
1605     *
1606     * @return the manager
1607     */
1608    AsyncProcessorAwaitManager getAsyncProcessorAwaitManager();
1609
1610    /**
1611     * Sets a custom  {@link org.apache.camel.AsyncProcessor} await manager.
1612     *
1613     * @param manager the manager
1614     */
1615    void setAsyncProcessorAwaitManager(AsyncProcessorAwaitManager manager);
1616
1617    /**
1618     * Gets the application CamelContext class loader which may be helpful for running camel in other containers
1619     *
1620     * @return the application CamelContext class loader
1621     */
1622    ClassLoader getApplicationContextClassLoader();
1623
1624    /**
1625     * Sets the application CamelContext class loader
1626     *
1627     * @param classLoader the class loader
1628     */
1629    void setApplicationContextClassLoader(ClassLoader classLoader);
1630
1631    /**
1632     * Gets the current shutdown strategy
1633     *
1634     * @return the strategy
1635     */
1636    ShutdownStrategy getShutdownStrategy();
1637
1638    /**
1639     * Sets a custom shutdown strategy
1640     *
1641     * @param shutdownStrategy the custom strategy
1642     */
1643    void setShutdownStrategy(ShutdownStrategy shutdownStrategy);
1644
1645    /**
1646     * Gets the current {@link org.apache.camel.spi.ExecutorServiceManager}
1647     *
1648     * @return the manager
1649     */
1650    ExecutorServiceManager getExecutorServiceManager();
1651
1652    /**
1653     * Gets the current {@link org.apache.camel.spi.ExecutorServiceStrategy}
1654     *
1655     * @return the manager
1656     * @deprecated use {@link #getExecutorServiceManager()}
1657     */
1658    @Deprecated
1659    org.apache.camel.spi.ExecutorServiceStrategy getExecutorServiceStrategy();
1660
1661    /**
1662     * Sets a custom {@link org.apache.camel.spi.ExecutorServiceManager}
1663     *
1664     * @param executorServiceManager the custom manager
1665     */
1666    void setExecutorServiceManager(ExecutorServiceManager executorServiceManager);
1667
1668    /**
1669     * Gets the current {@link org.apache.camel.spi.ProcessorFactory}
1670     *
1671     * @return the factory, can be <tt>null</tt> if no custom factory has been set
1672     */
1673    ProcessorFactory getProcessorFactory();
1674
1675    /**
1676     * Sets a custom {@link org.apache.camel.spi.ProcessorFactory}
1677     *
1678     * @param processorFactory the custom factory
1679     */
1680    void setProcessorFactory(ProcessorFactory processorFactory);
1681
1682    /**
1683     * Gets the current {@link org.apache.camel.spi.MessageHistoryFactory}
1684     *
1685     * @return the factory
1686     */
1687    MessageHistoryFactory getMessageHistoryFactory();
1688
1689    /**
1690     * Sets a custom {@link org.apache.camel.spi.MessageHistoryFactory}
1691     *
1692     * @param messageHistoryFactory the custom factory
1693     */
1694    void setMessageHistoryFactory(MessageHistoryFactory messageHistoryFactory);
1695
1696    /**
1697     * Gets the current {@link Debugger}
1698     *
1699     * @return the debugger
1700     */
1701    Debugger getDebugger();
1702
1703    /**
1704     * Sets a custom {@link Debugger}
1705     *
1706     * @param debugger the debugger
1707     */
1708    void setDebugger(Debugger debugger);
1709
1710    /**
1711     * Gets the current {@link UuidGenerator}
1712     *
1713     * @return the uuidGenerator
1714     */
1715    UuidGenerator getUuidGenerator();
1716    
1717    /**
1718     * Sets a custom {@link UuidGenerator} (should only be set once) 
1719     *
1720     * @param uuidGenerator the UUID Generator
1721     */
1722    void setUuidGenerator(UuidGenerator uuidGenerator);
1723
1724    /**
1725     * Whether or not type converters should be loaded lazy
1726     *
1727     * @return <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
1728     * @deprecated this option is no longer supported, will be removed in a future Camel release.
1729     */
1730    @Deprecated
1731    Boolean isLazyLoadTypeConverters();
1732
1733    /**
1734     * Sets whether type converters should be loaded lazy
1735     *
1736     * @param lazyLoadTypeConverters <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
1737     * @deprecated this option is no longer supported, will be removed in a future Camel release.
1738     */
1739    @Deprecated
1740    void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters);
1741
1742    /**
1743     * Sets whether to load custom type converters by scanning classpath.
1744     * This can be turned off if you are only using Camel components
1745     * that does not provide type converters which is needed at runtime.
1746     * In such situations setting this option to false, can speedup starting
1747     * Camel.
1748     */
1749    Boolean isLoadTypeConverters();
1750
1751    /**
1752     * Sets whether to load custom type converters by scanning classpath.
1753     * This can be turned off if you are only using Camel components
1754     * that does not provide type converters which is needed at runtime.
1755     * In such situations setting this option to false, can speedup starting
1756     * Camel.
1757     *
1758     * @param loadTypeConverters whether to load custom type converters.
1759     */
1760    void setLoadTypeConverters(Boolean loadTypeConverters);
1761
1762    /**
1763     * Whether or not type converter statistics is enabled.
1764     * <p/>
1765     * By default the type converter utilization statistics is disabled.
1766     * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load.
1767     *
1768     * @return <tt>true</tt> if enabled, <tt>false</tt> if disabled (default).
1769     */
1770    Boolean isTypeConverterStatisticsEnabled();
1771
1772    /**
1773     * Sets whether or not type converter statistics is enabled.
1774     * <p/>
1775     * By default the type converter utilization statistics is disabled.
1776     * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load.
1777     * <p/>
1778     * You can enable/disable the statistics at runtime using the
1779     * {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)} method,
1780     * or from JMX on the {@link org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean} mbean.
1781     *
1782     * @param typeConverterStatisticsEnabled <tt>true</tt> to enable, <tt>false</tt> to disable
1783     */
1784    void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled);
1785
1786    /**
1787     * Whether or not <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> logging is being enabled.
1788     *
1789     * @return <tt>true</tt> if MDC logging is enabled
1790     */
1791    Boolean isUseMDCLogging();
1792
1793    /**
1794     * Set whether <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> is enabled.
1795     *
1796     * @param useMDCLogging <tt>true</tt> to enable MDC logging, <tt>false</tt> to disable
1797     */
1798    void setUseMDCLogging(Boolean useMDCLogging);
1799
1800    /**
1801     * Whether to enable using data type on Camel messages.
1802     * <p/>
1803     * Data type are automatic turned on if one ore more routes has been explicit configured with input and output types.
1804     * Otherwise data type is default off.
1805     *
1806     * @return <tt>true</tt> if data type is enabled
1807     */
1808    Boolean isUseDataType();
1809
1810    /**
1811     * Whether to enable using data type on Camel messages.
1812     * <p/>
1813     * Data type are automatic turned on if one ore more routes has been explicit configured with input and output types.
1814     * Otherwise data type is default off.
1815     *
1816     * @param  useDataType <tt>true</tt> to enable data type on Camel messages.
1817     */
1818    void setUseDataType(Boolean useDataType);
1819
1820    /**
1821     * Whether or not breadcrumb is enabled.
1822     *
1823     * @return <tt>true</tt> if breadcrumb is enabled
1824     */
1825    Boolean isUseBreadcrumb();
1826
1827    /**
1828     * Set whether breadcrumb is enabled.
1829     *
1830     * @param useBreadcrumb <tt>true</tt> to enable breadcrumb, <tt>false</tt> to disable
1831     */
1832    void setUseBreadcrumb(Boolean useBreadcrumb);
1833
1834    /**
1835     * Resolves a component's default name from its java type.
1836     * <p/>
1837     * A component may be used with a non default name such as <tt>activemq</tt>, <tt>wmq</tt> for the JMS component.
1838     * This method can resolve the default component name by its java type.
1839     *
1840     * @param javaType the FQN name of the java type
1841     * @return the default component name.
1842     */
1843    String resolveComponentDefaultName(String javaType);
1844
1845    /**
1846     * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}.
1847     *
1848     * @return a map with the component name, and value with component details.
1849     * @throws LoadPropertiesException is thrown if error during classpath discovery of the components
1850     * @throws IOException is thrown if error during classpath discovery of the components
1851     */
1852    Map<String, Properties> findComponents() throws LoadPropertiesException, IOException;
1853
1854    /**
1855     * Find information about all the EIPs from camel-core.
1856     *
1857     * @return a map with node id, and value with EIP details.
1858     * @throws LoadPropertiesException is thrown if error during classpath discovery of the EIPs
1859     * @throws IOException is thrown if error during classpath discovery of the EIPs
1860     */
1861    Map<String, Properties> findEips() throws LoadPropertiesException, IOException;
1862
1863    /**
1864     * Returns the HTML documentation for the given Camel component
1865     *
1866     * @return the HTML or <tt>null</tt> if the component is <b>not</b> built with HTML document included.
1867     * @deprecated use camel-catalog instead
1868     */
1869    @Deprecated
1870    String getComponentDocumentation(String componentName) throws IOException;
1871
1872    /**
1873     * Returns the JSON schema representation of the component and endpoint parameters for the given component name.
1874     *
1875     * @return the json or <tt>null</tt> if the component is <b>not</b> built with JSon schema support
1876     */
1877    String getComponentParameterJsonSchema(String componentName) throws IOException;
1878
1879    /**
1880     * Returns the JSON schema representation of the {@link DataFormat} parameters for the given data format name.
1881     *
1882     * @return the json or <tt>null</tt> if the data format does not exist
1883     */
1884    String getDataFormatParameterJsonSchema(String dataFormatName) throws IOException;
1885
1886    /**
1887     * Returns the JSON schema representation of the {@link Language} parameters for the given language name.
1888     *
1889     * @return the json or <tt>null</tt> if the language does not exist
1890     */
1891    String getLanguageParameterJsonSchema(String languageName) throws IOException;
1892
1893    /**
1894     * Returns the JSON schema representation of the EIP parameters for the given EIP name.
1895     *
1896     * @return the json or <tt>null</tt> if the EIP does not exist
1897     */
1898    String getEipParameterJsonSchema(String eipName) throws IOException;
1899
1900    /**
1901     * Returns a JSON schema representation of the EIP parameters for the given EIP by its id.
1902     *
1903     * @param nameOrId the name of the EIP ({@link NamedNode#getShortName()} or a node id to refer to a specific node from the routes.
1904     * @param includeAllOptions whether to include non configured options also (eg default options)
1905     * @return the json or <tt>null</tt> if the eipName or the id was not found
1906     */
1907    String explainEipJson(String nameOrId, boolean includeAllOptions);
1908
1909    /**
1910     * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id.
1911     *
1912     * @param componentName the name of the component.
1913     * @param includeAllOptions whether to include non configured options also (eg default options)
1914     * @return the json or <tt>null</tt> if the component was not found
1915     */
1916    String explainComponentJson(String componentName, boolean includeAllOptions);
1917
1918    /**
1919     * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id.
1920     *
1921     * @param dataFormat the data format instance.
1922     * @param includeAllOptions whether to include non configured options also (eg default options)
1923     * @return the json
1924     */
1925    String explainDataFormatJson(String dataFormatName, DataFormat dataFormat, boolean includeAllOptions);
1926
1927    /**
1928     * Returns a JSON schema representation of the endpoint parameters for the given endpoint uri.
1929     *
1930     * @param uri the endpoint uri
1931     * @param includeAllOptions whether to include non configured options also (eg default options)
1932     * @return the json or <tt>null</tt> if uri parameters is invalid, or the component is <b>not</b> built with JSon schema support
1933     */
1934    String explainEndpointJson(String uri, boolean includeAllOptions);
1935
1936    /**
1937     * Creates a JSON representation of all the <b>static</b> and <b>dynamic</b> configured endpoints defined in the given route(s).
1938     *
1939     * @param routeId for a particular route, or <tt>null</tt> for all routes
1940     * @return a JSON string
1941     */
1942    String createRouteStaticEndpointJson(String routeId);
1943
1944    /**
1945     * Creates a JSON representation of all the <b>static</b> (and possible <b>dynamic</b>) configured endpoints defined in the given route(s).
1946     *
1947     * @param routeId for a particular route, or <tt>null</tt> for all routes
1948     * @param includeDynamic whether to include dynamic endpoints
1949     * @return a JSON string
1950     */
1951    String createRouteStaticEndpointJson(String routeId, boolean includeDynamic);
1952
1953    /**
1954     * Gets the {@link StreamCachingStrategy} to use.
1955     */
1956    StreamCachingStrategy getStreamCachingStrategy();
1957
1958    /**
1959     * Sets a custom {@link StreamCachingStrategy} to use.
1960     */
1961    void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy);
1962
1963    /**
1964     * Gets the {@link UnitOfWorkFactory} to use.
1965     */
1966    UnitOfWorkFactory getUnitOfWorkFactory();
1967
1968    /**
1969     * Sets a custom {@link UnitOfWorkFactory} to use.
1970     */
1971    void setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory);
1972
1973    /**
1974     * Gets the {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use, or <tt>null</tt> if none is in use.
1975     */
1976    RuntimeEndpointRegistry getRuntimeEndpointRegistry();
1977
1978    /**
1979     * Sets a custom {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use.
1980     */
1981    void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry);
1982
1983    /**
1984     * Gets the {@link org.apache.camel.spi.RestRegistry} to use
1985     */
1986    RestRegistry getRestRegistry();
1987
1988    /**
1989     * Sets a custom {@link org.apache.camel.spi.RestRegistry} to use.
1990     */
1991    void setRestRegistry(RestRegistry restRegistry);
1992
1993    /**
1994     * Adds the given route policy factory
1995     *
1996     * @param routePolicyFactory the factory
1997     */
1998    void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory);
1999
2000    /**
2001     * Gets the route policy factories
2002     *
2003     * @return the list of current route policy factories
2004     */
2005    List<RoutePolicyFactory> getRoutePolicyFactories();
2006
2007    /**
2008     * Returns the JAXB Context factory used to create Models.
2009     *
2010     * @return the JAXB Context factory used to create Models.
2011     */
2012    ModelJAXBContextFactory getModelJAXBContextFactory();
2013
2014    /**
2015     * Sets a custom JAXB Context factory to be used
2016     *
2017     * @param modelJAXBContextFactory a JAXB Context factory
2018     */
2019    void setModelJAXBContextFactory(ModelJAXBContextFactory modelJAXBContextFactory);
2020
2021    /**
2022     * Returns the {@link ReloadStrategy} if in use.
2023     *
2024     * @return the strategy, or <tt>null</tt> if none has been configured.
2025     */
2026    ReloadStrategy getReloadStrategy();
2027
2028    /**
2029     * Sets a custom {@link ReloadStrategy} to be used
2030     */
2031    void setReloadStrategy(ReloadStrategy reloadStrategy);
2032
2033    /**
2034     * Gets the associated {@link RuntimeCamelCatalog} for this CamelContext.
2035     */
2036    RuntimeCamelCatalog getRuntimeCamelCatalog();
2037
2038    /**
2039     * Gets a list of {@link LogListener}.
2040     */
2041    Set<LogListener> getLogListeners();
2042
2043    /**
2044     * Adds a {@link LogListener}.
2045     */
2046    void addLogListener(LogListener listener);
2047
2048    /**
2049     * Sets the global SSL context parameters.
2050     */
2051    void setSSLContextParameters(SSLContextParameters sslContextParameters);
2052
2053    /**
2054     * Gets the global SSL context parameters if configured.
2055     */
2056    SSLContextParameters getSSLContextParameters();
2057
2058    /**
2059     * Gets the {@link HeadersMapFactory} to use.
2060     */
2061    HeadersMapFactory getHeadersMapFactory();
2062
2063    /**
2064     * Sets a custom {@link HeadersMapFactory} to be used.
2065     */
2066    void setHeadersMapFactory(HeadersMapFactory factory);
2067
2068    /**
2069     * Returns an optional {@link HealthCheckRegistry}, by default no registry is
2070     * present and it must be explicit activated. Components can register/unregister
2071     * health checks in response to life-cycle events (i.e. start/stop).
2072     *
2073     * This registry is not used by the camel context but it is up to the impl to
2074     * properly use it, i.e.
2075     *
2076     * - a RouteController could use the registry to decide to restart a route
2077     *   with failing health checks
2078     * - spring boot could integrate such checks within its health endpoint or
2079     *   make it available only as separate endpoint.
2080     */
2081    HealthCheckRegistry getHealthCheckRegistry();
2082
2083    /**
2084     * Sets a {@link HealthCheckRegistry}.
2085     */
2086    void setHealthCheckRegistry(HealthCheckRegistry healthCheckRegistry);
2087}