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.concurrent.ScheduledExecutorService;
026import java.util.concurrent.TimeUnit;
027
028import org.apache.camel.builder.ErrorHandlerBuilder;
029import org.apache.camel.model.DataFormatDefinition;
030import org.apache.camel.model.RouteDefinition;
031import org.apache.camel.model.RoutesDefinition;
032import org.apache.camel.model.rest.RestDefinition;
033import org.apache.camel.spi.AsyncProcessorAwaitManager;
034import org.apache.camel.spi.CamelContextNameStrategy;
035import org.apache.camel.spi.ClassResolver;
036import org.apache.camel.spi.DataFormat;
037import org.apache.camel.spi.DataFormatResolver;
038import org.apache.camel.spi.Debugger;
039import org.apache.camel.spi.EndpointRegistry;
040import org.apache.camel.spi.EndpointStrategy;
041import org.apache.camel.spi.ExecutorServiceManager;
042import org.apache.camel.spi.FactoryFinder;
043import org.apache.camel.spi.FactoryFinderResolver;
044import org.apache.camel.spi.InflightRepository;
045import org.apache.camel.spi.Injector;
046import org.apache.camel.spi.InterceptStrategy;
047import org.apache.camel.spi.Language;
048import org.apache.camel.spi.LifecycleStrategy;
049import org.apache.camel.spi.ManagementMBeanAssembler;
050import org.apache.camel.spi.ManagementNameStrategy;
051import org.apache.camel.spi.ManagementStrategy;
052import org.apache.camel.spi.ModelJAXBContextFactory;
053import org.apache.camel.spi.NodeIdFactory;
054import org.apache.camel.spi.PackageScanClassResolver;
055import org.apache.camel.spi.ProcessorFactory;
056import org.apache.camel.spi.Registry;
057import org.apache.camel.spi.RestConfiguration;
058import org.apache.camel.spi.RestRegistry;
059import org.apache.camel.spi.RoutePolicyFactory;
060import org.apache.camel.spi.RouteStartupOrder;
061import org.apache.camel.spi.RuntimeEndpointRegistry;
062import org.apache.camel.spi.ServicePool;
063import org.apache.camel.spi.ShutdownStrategy;
064import org.apache.camel.spi.StreamCachingStrategy;
065import org.apache.camel.spi.TypeConverterRegistry;
066import org.apache.camel.spi.UnitOfWorkFactory;
067import org.apache.camel.spi.UuidGenerator;
068import org.apache.camel.util.LoadPropertiesException;
069
070/**
071 * Interface used to represent the context used to configure routes and the
072 * policies to use during message exchanges between endpoints.
073 * <p/>
074 * The context offers the following methods to control the lifecycle:
075 * <ul>
076 *   <li>{@link #start()}  - to start (<b>important:</b> the start method is not blocked, see more details
077 *     <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li>
078 *   <li>{@link #stop()} - to shutdown (will stop all routes/components/endpoints etc and clear internal state/cache)</li>
079 *   <li>{@link #suspend()} - to pause routing messages</li>
080 *   <li>{@link #resume()} - to resume after a suspend</li>
081 * </ul>
082 * <p/>
083 * <b>Notice:</b> {@link #stop()} and {@link #suspend()} will gracefully stop/suspend routes ensuring any messages
084 * in progress will be given time to complete. See more details at {@link org.apache.camel.spi.ShutdownStrategy}.
085 * <p/>
086 * If you are doing a hot restart then it's advised to use the suspend/resume methods which ensure a faster
087 * restart but also allows any internal state to be kept as is.
088 * The stop/start approach will do a <i>cold</i> restart of Camel, where all internal state is reset.
089 * <p/>
090 * End users are advised to use suspend/resume. Using stop is for shutting down Camel and it's not guaranteed that
091 * when it's being started again using the start method that Camel will operate consistently.
092 *
093 * @version 
094 */
095public interface CamelContext extends SuspendableService, RuntimeConfiguration {
096
097    /**
098     * Adapts this {@link org.apache.camel.CamelContext} to the specialized type.
099     * <p/>
100     * For example to adapt to {@link org.apache.camel.model.ModelCamelContext},
101     * or <tt>SpringCamelContext</tt>, or <tt>CdiCamelContext</tt>, etc.
102     *
103     * @param type the type to adapt to
104     * @return this {@link org.apache.camel.CamelContext} adapted to the given type
105     */
106    <T extends CamelContext> T adapt(Class<T> type);
107
108    /**
109     * Starts the {@link CamelContext} (<b>important:</b> the start method is not blocked, see more details
110     *     <a href="http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html">here</a>)</li>.
111     * <p/>
112     * See more details at the class-level javadoc of this class.
113     *
114     * @throws Exception is thrown if starting failed
115     */
116    void start() throws Exception;
117
118    /**
119     * Stop and shutdown the {@link CamelContext} (will stop all routes/components/endpoints etc and clear internal state/cache).
120     * <p/>
121     * See more details at the class-level javadoc of this class.
122     *
123     * @throws Exception is thrown if stopping failed
124     */
125    void stop() throws Exception;
126
127    /**
128     * Gets the name (id) of the this context.
129     *
130     * @return the name
131     */
132    String getName();
133
134    /**
135     * Gets the current name strategy
136     *
137     * @return name strategy
138     */
139    CamelContextNameStrategy getNameStrategy();
140
141    /**
142     * Sets a custom name strategy
143     *
144     * @param nameStrategy name strategy
145     */
146    void setNameStrategy(CamelContextNameStrategy nameStrategy);
147
148    /**
149     * Gets the current management name strategy
150     *
151     * @return management name strategy
152     */
153    ManagementNameStrategy getManagementNameStrategy();
154
155    /**
156     * Sets a custom management name strategy
157     *
158     * @param nameStrategy name strategy
159     */
160    void setManagementNameStrategy(ManagementNameStrategy nameStrategy);
161
162    /**
163     * Gets the name this {@link CamelContext} was registered in JMX.
164     * <p/>
165     * The reason that a {@link CamelContext} can have a different name in JMX is the fact to remedy for name clash
166     * in JMX when having multiple {@link CamelContext}s in the same JVM. Camel will automatic reassign and use
167     * a free name to avoid failing to start.
168     *
169     * @return the management name
170     */
171    String getManagementName();
172
173    /**
174     * Gets the version of the this context.
175     *
176     * @return the version
177     */
178    String getVersion();
179
180    /**
181     * Get the status of this context
182     *
183     * @return the status
184     */
185    ServiceStatus getStatus();
186
187    /**
188     * Gets the uptime in a human readable format
189     *
190     * @return the uptime in days/hours/minutes
191     */
192    String getUptime();
193
194    // Service Methods
195    //-----------------------------------------------------------------------
196
197    /**
198     * Adds a service to this context, which allows this context to control the lifecycle, ensuring
199     * the service is stopped when the context stops.
200     * <p/>
201     * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}.
202     * The service will also be enlisted in JMX for management (if JMX is enabled).
203     * The service will be started, if its not already started.
204     *
205     * @param object the service
206     * @throws Exception can be thrown when starting the service
207     */
208    void addService(Object object) throws Exception;
209
210    /**
211     * Adds a service to this context.
212     * <p/>
213     * The service will also have {@link CamelContext} injected if its {@link CamelContextAware}.
214     * The service will also be enlisted in JMX for management (if JMX is enabled).
215     * The service will be started, if its not already started.
216     * <p/>
217     * If the option <tt>closeOnShutdown</tt> is <tt>true</tt> then this context will control the lifecycle, ensuring
218     * the service is stopped when the context stops.
219     * If the option <tt>closeOnShutdown</tt> is <tt>false</tt> then this context will not stop the service when the context stops.
220     *
221     * @param object the service
222     * @param closeOnShutdown whether to close the service when this CamelContext shutdown.
223     * @throws Exception can be thrown when starting the service
224     */
225    void addService(Object object, boolean closeOnShutdown) throws Exception;
226
227    /**
228     * Removes a service from this context.
229     * <p/>
230     * The service is assumed to have been previously added using {@link #addService(Object)} method.
231     * This method will <b>not</b> change the service lifecycle.
232     *
233     * @param object the service
234     * @throws Exception can be thrown if error removing the service
235     * @return <tt>true</tt> if the service was removed, <tt>false</tt> if no service existed
236     */
237    boolean removeService(Object object) throws Exception;
238
239    /**
240     * Has the given service already been added to this context?
241     *
242     * @param object the service
243     * @return <tt>true</tt> if already added, <tt>false</tt> if not.
244     */
245    boolean hasService(Object object);
246
247    /**
248     * Has the given service type already been added to this context?
249     *
250     * @param type the class type
251     * @return the service instance or <tt>null</tt> if not already added.
252     */
253    <T> T hasService(Class<T> type);
254
255    /**
256     * Adds the given listener to be invoked when {@link CamelContext} have just been started.
257     * <p/>
258     * This allows listeners to do any custom work after the routes and other services have been started and are running.
259     * <p/><b>Important:</b> The listener will always be invoked, also if the {@link CamelContext} has already been
260     * started, see the {@link org.apache.camel.StartupListener#onCamelContextStarted(CamelContext, boolean)} method.
261     *
262     * @param listener the listener
263     * @throws Exception can be thrown if {@link CamelContext} is already started and the listener is invoked
264     *                   and cause an exception to be thrown
265     */
266    void addStartupListener(StartupListener listener) throws Exception;
267
268    // Component Management Methods
269    //-----------------------------------------------------------------------
270
271    /**
272     * Adds a component to the context.
273     *
274     * @param componentName the name the component is registered as
275     * @param component     the component
276     */
277    void addComponent(String componentName, Component component);
278
279    /**
280     * Is the given component already registered?
281     *
282     * @param componentName the name of the component
283     * @return the registered Component or <tt>null</tt> if not registered
284     */
285    Component hasComponent(String componentName);
286
287    /**
288     * Gets a component from the context by name.
289     *
290     * @param componentName the name of the component
291     * @return the component
292     */
293    Component getComponent(String componentName);
294
295    /**
296     * Gets a component from the context by name.
297     *
298     * @param name                 the name of the component
299     * @param autoCreateComponents whether or not the component should
300     *                             be lazily created if it does not already exist
301     * @return the component
302     */
303    Component getComponent(String name, boolean autoCreateComponents);
304
305    /**
306     * Gets a component from the context by name and specifying the expected type of component.
307     *
308     * @param name          the name to lookup
309     * @param componentType the expected type
310     * @return the component
311     */
312    <T extends Component> T getComponent(String name, Class<T> componentType);
313
314    /**
315     * Gets a readonly list of names of the components currently registered
316     *
317     * @return a readonly list with the names of the the components
318     */
319    List<String> getComponentNames();
320
321    /**
322     * Removes a previously added component.
323     * <p/>
324     * The component being removed will be stopped first.
325     *
326     * @param componentName the component name to remove
327     * @return the previously added component or null if it had not been previously added.
328     */
329    Component removeComponent(String componentName);
330
331    // Endpoint Management Methods
332    //-----------------------------------------------------------------------
333
334    /**
335     * Gets the {@link org.apache.camel.spi.EndpointRegistry}
336     */
337    EndpointRegistry<String> getEndpointRegistry();
338
339    /**
340     * Resolves the given name to an {@link Endpoint} of the specified type.
341     * If the name has a singleton endpoint registered, then the singleton is returned.
342     * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}.
343     *
344     * @param uri the URI of the endpoint
345     * @return the endpoint
346     */
347    Endpoint getEndpoint(String uri);
348
349    /**
350     * Resolves the given name to an {@link Endpoint} of the specified type.
351     * If the name has a singleton endpoint registered, then the singleton is returned.
352     * Otherwise, a new {@link Endpoint} is created and registered in the {@link org.apache.camel.spi.EndpointRegistry}.
353     *
354     * @param name         the name of the endpoint
355     * @param endpointType the expected type
356     * @return the endpoint
357     */
358    <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType);
359
360    /**
361     * Returns a new {@link Collection} of all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry}
362     *
363     * @return all endpoints
364     */
365    Collection<Endpoint> getEndpoints();
366
367    /**
368     * Returns a new {@link Map} containing all of the endpoints from the {@link org.apache.camel.spi.EndpointRegistry}
369     *
370     * @return map of endpoints
371     */
372    Map<String, Endpoint> getEndpointMap();
373
374    /**
375     * Is the given endpoint already registered in the {@link org.apache.camel.spi.EndpointRegistry}
376     *
377     * @param uri the URI of the endpoint
378     * @return the registered endpoint or <tt>null</tt> if not registered
379     */
380    Endpoint hasEndpoint(String uri);
381
382    /**
383     * Adds the endpoint to the {@link org.apache.camel.spi.EndpointRegistry} using the given URI.
384     *
385     * @param uri      the URI to be used to resolve this endpoint
386     * @param endpoint the endpoint to be added to the registry
387     * @return the old endpoint that was previously registered or <tt>null</tt> if none was registered
388     * @throws Exception if the new endpoint could not be started or the old endpoint could not be stopped
389     */
390    Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception;
391
392    /**
393     * Removes the endpoint from the {@link org.apache.camel.spi.EndpointRegistry}.
394     * <p/>
395     * The endpoint being removed will be stopped first.
396     *
397     * @param endpoint  the endpoint
398     * @throws Exception if the endpoint could not be stopped
399     */
400    void removeEndpoint(Endpoint endpoint) throws Exception;
401
402    /**
403     * Removes all endpoints with the given URI from the {@link org.apache.camel.spi.EndpointRegistry}.
404     * <p/>
405     * The endpoints being removed will be stopped first.
406     *
407     * @param pattern an uri or pattern to match
408     * @return a collection of endpoints removed which could be empty if there are no endpoints found for the given <tt>pattern</tt>
409     * @throws Exception if at least one endpoint could not be stopped
410     * @see org.apache.camel.util.EndpointHelper#matchEndpoint(CamelContext, String, String) for pattern
411     */
412    Collection<Endpoint> removeEndpoints(String pattern) throws Exception;
413
414    /**
415     * Registers a {@link org.apache.camel.spi.EndpointStrategy callback} to allow you to do custom
416     * logic when an {@link Endpoint} is about to be registered to the {@link org.apache.camel.spi.EndpointRegistry}.
417     * <p/>
418     * When a callback is added it will be executed on the already registered endpoints allowing you to catch-up
419     *
420     * @param strategy callback to be invoked
421     */
422    void addRegisterEndpointCallback(EndpointStrategy strategy);
423
424    // Route Management Methods
425    //-----------------------------------------------------------------------
426
427    /**
428     * Method to signal to {@link CamelContext} that the process to initialize setup routes is in progress.
429     *
430     * @param done <tt>false</tt> to start the process, call again with <tt>true</tt> to signal its done.
431     * @see #isSetupRoutes()
432     */
433    void setupRoutes(boolean done);
434
435    /**
436     * Returns a list of the current route definitions
437     *
438     * @return list of the current route definitions
439     */
440    List<RouteDefinition> getRouteDefinitions();
441
442    /**
443     * Gets the route definition with the given id
444     *
445     * @param id id of the route
446     * @return the route definition or <tt>null</tt> if not found
447     */
448    RouteDefinition getRouteDefinition(String id);
449
450    /**
451     * Returns a list of the current REST definitions
452     *
453     * @return list of the current REST definitions
454     */
455    List<RestDefinition> getRestDefinitions();
456
457    /**
458     * Adds a collection of rest definitions to the context
459     *
460     * @param restDefinitions the rest(s) definition to add
461     */
462    void addRestDefinitions(Collection<RestDefinition> restDefinitions) throws Exception;
463
464    /**
465     * Sets a custom {@link org.apache.camel.spi.RestConfiguration}
466     *
467     * @param restConfiguration the REST configuration
468     */
469    void setRestConfiguration(RestConfiguration restConfiguration);
470
471    /**
472     * Gets the current REST configuration
473     *
474     * @return the configuration, or <tt>null</tt> if none has been configured.
475     */
476    RestConfiguration getRestConfiguration();
477
478    /**
479     * Returns the order in which the route inputs was started.
480     * <p/>
481     * The order may not be according to the startupOrder defined on the route.
482     * For example a route could be started manually later, or new routes added at runtime.
483     *
484     * @return a list in the order how routes was started
485     */
486    List<RouteStartupOrder> getRouteStartupOrder();
487
488    /**
489     * Returns the current routes in this context
490     *
491     * @return the current routes
492     */
493    List<Route> getRoutes();
494
495    /**
496     * Gets the route with the given id
497     *
498     * @param id id of the route
499     * @return the route or <tt>null</tt> if not found
500     */
501    Route getRoute(String id);
502
503    /**
504     * Adds a collection of routes to this context using the given builder
505     * to build them.
506     * <p/>
507     * <b>Important:</b> The added routes will <b>only</b> be started, if {@link CamelContext}
508     * is already started. You may want to check the state of {@link CamelContext} before
509     * adding the routes, using the {@link org.apache.camel.CamelContext#getStatus()} method.
510     * <p/>
511     * <b>Important: </b> Each route in the same {@link org.apache.camel.CamelContext} must have an <b>unique</b> route id.
512     * If you use the API from {@link org.apache.camel.CamelContext} or {@link org.apache.camel.model.ModelCamelContext} to add routes, then any
513     * new routes which has a route id that matches an old route, then the old route is replaced by the new route.
514     *
515     * @param builder the builder which will create the routes and add them to this context
516     * @throws Exception if the routes could not be created for whatever reason
517     */
518    void addRoutes(RoutesBuilder builder) throws Exception;
519
520    /**
521     * Loads a collection of route definitions from the given {@link java.io.InputStream}.
522     *
523     * @param is input stream with the route(s) definition to add
524     * @throws Exception if the route definitions could not be loaded for whatever reason
525     * @return the route definitions
526     */
527    RoutesDefinition loadRoutesDefinition(InputStream is) throws Exception;
528
529    /**
530     * Adds a collection of route definitions to the context
531     *
532     * @param routeDefinitions the route(s) definition to add
533     * @throws Exception if the route definitions could not be created for whatever reason
534     */
535    void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception;
536
537    /**
538     * Add a route definition to the context
539     *
540     * @param routeDefinition the route definition to add
541     * @throws Exception if the route definition could not be created for whatever reason
542     */
543    void addRouteDefinition(RouteDefinition routeDefinition) throws Exception;
544
545    /**
546     * Removes a collection of route definitions from the context - stopping any previously running
547     * routes if any of them are actively running
548     *
549     * @param routeDefinitions route(s) definitions to remove
550     * @throws Exception if the route definitions could not be removed for whatever reason
551     */
552    void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception;
553
554    /**
555     * Removes a route definition from the context - stopping any previously running
556     * routes if any of them are actively running
557     *
558     * @param routeDefinition route definition to remove
559     * @throws Exception if the route definition could not be removed for whatever reason
560     */
561    void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception;
562
563    /**
564     * Starts the given route if it has been previously stopped
565     *
566     * @param route the route to start
567     * @throws Exception is thrown if the route could not be started for whatever reason
568     * @deprecated favor using {@link CamelContext#startRoute(String)}
569     */
570    @Deprecated
571    void startRoute(RouteDefinition route) throws Exception;
572
573    /**
574     * Starts all the routes which currently is not started.
575     *
576     * @throws Exception is thrown if a route could not be started for whatever reason
577     */
578    void startAllRoutes() throws Exception;
579
580    /**
581     * Starts the given route if it has been previously stopped
582     *
583     * @param routeId the route id
584     * @throws Exception is thrown if the route could not be started for whatever reason
585     */
586    void startRoute(String routeId) throws Exception;
587
588    /**
589     * Stops the given route.
590     *
591     * @param route the route to stop
592     * @throws Exception is thrown if the route could not be stopped for whatever reason
593     * @deprecated favor using {@link CamelContext#stopRoute(String)}
594     */
595    @Deprecated
596    void stopRoute(RouteDefinition route) throws Exception;
597
598    /**
599     * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
600     *
601     * @param routeId the route id
602     * @throws Exception is thrown if the route could not be stopped for whatever reason
603     * @see #suspendRoute(String)
604     */
605    void stopRoute(String routeId) throws Exception;
606
607    /**
608     * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
609     *
610     * @param routeId the route id
611     * @param timeout  timeout
612     * @param timeUnit the unit to use
613     * @throws Exception is thrown if the route could not be stopped for whatever reason
614     * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit)
615     */
616    void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
617
618    /**
619     * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout 
620     * and optional abortAfterTimeout mode.
621     *
622     * @param routeId the route id
623     * @param timeout  timeout
624     * @param timeUnit the unit to use
625     * @param abortAfterTimeout should abort shutdown after timeout
626     * @return <tt>true</tt> if the route is stopped before the timeout
627     * @throws Exception is thrown if the route could not be stopped for whatever reason
628     * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit)
629     */
630    boolean stopRoute(String routeId, long timeout, TimeUnit timeUnit, boolean abortAfterTimeout) throws Exception;
631    
632    /**
633     * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
634     *
635     * @param routeId the route id
636     * @throws Exception is thrown if the route could not be shutdown for whatever reason
637     * @deprecated use {@link #stopRoute(String)} and {@link #removeRoute(String)}
638     */
639    @Deprecated
640    void shutdownRoute(String routeId) throws Exception;
641
642    /**
643     * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
644     *
645     * @param routeId  the route id
646     * @param timeout  timeout
647     * @param timeUnit the unit to use
648     * @throws Exception is thrown if the route could not be shutdown for whatever reason
649     * @deprecated use {@link #stopRoute(String, long, java.util.concurrent.TimeUnit)} and {@link #removeRoute(String)}
650     */
651    @Deprecated
652    void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
653
654    /**
655     * Removes the given route (the route <b>must</b> be stopped before it can be removed).
656     * <p/>
657     * A route which is removed will be unregistered from JMX, have its services stopped/shutdown and the route
658     * definition etc. will also be removed. All the resources related to the route will be stopped and cleared.
659     * <p/>
660     * <b>Important:</b> When removing a route, the {@link Endpoint}s which are in the static cache of
661     * {@link org.apache.camel.spi.EndpointRegistry} and are <b>only</b> used by the route (not used by other routes)
662     * will also be removed. But {@link Endpoint}s which may have been created as part of routing messages by the route,
663     * and those endpoints are enlisted in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry} are
664     * <b>not</b> removed. To remove those dynamic kind of endpoints, use the {@link #removeEndpoints(String)} method.
665     * If not removing those endpoints, they will be kept in the dynamic cache of {@link org.apache.camel.spi.EndpointRegistry},
666     * but my eventually be removed (evicted) when they have not been in use for a longer period of time; and the
667     * dynamic cache upper limit is hit, and it evicts the least used endpoints.
668     * <p/>
669     * End users can use this method to remove unwanted routes or temporary routes which no longer is in demand.
670     *
671     * @param routeId the route id
672     * @return <tt>true</tt> if the route was removed, <tt>false</tt> if the route could not be removed because its not stopped
673     * @throws Exception is thrown if the route could not be shutdown for whatever reason
674     */
675    boolean removeRoute(String routeId) throws Exception;
676
677    /**
678     * Resumes the given route if it has been previously suspended
679     * <p/>
680     * If the route does <b>not</b> support suspension the route will be started instead
681     *
682     * @param routeId the route id
683     * @throws Exception is thrown if the route could not be resumed for whatever reason
684     */
685    void resumeRoute(String routeId) throws Exception;
686
687    /**
688     * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
689     * <p/>
690     * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support)
691     * otherwise the consumers will be stopped.
692     * <p/>
693     * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.
694     * <p/>
695     * If the route does <b>not</b> support suspension the route will be stopped instead
696     *
697     * @param routeId the route id
698     * @throws Exception is thrown if the route could not be suspended for whatever reason
699     */
700    void suspendRoute(String routeId) throws Exception;
701
702    /**
703     * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
704     * <p/>
705     * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support)
706     * otherwise the consumers will be stopped.
707     * <p/>
708     * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.
709     * <p/>
710     * If the route does <b>not</b> support suspension the route will be stopped instead
711     *
712     * @param routeId  the route id
713     * @param timeout  timeout
714     * @param timeUnit the unit to use
715     * @throws Exception is thrown if the route could not be suspended for whatever reason
716     */
717    void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
718
719    /**
720     * Returns the current status of the given route
721     *
722     * @param routeId the route id
723     * @return the status for the route
724     */
725    ServiceStatus getRouteStatus(String routeId);
726
727    /**
728     * Indicates whether current thread is starting route(s).
729     * <p/>
730     * This can be useful to know by {@link LifecycleStrategy} or the likes, in case
731     * they need to react differently.
732     *
733     * @return <tt>true</tt> if current thread is starting route(s), or <tt>false</tt> if not.
734     */
735    boolean isStartingRoutes();
736
737    /**
738     * Indicates whether current thread is setting up route(s) as part of starting Camel from spring/blueprint.
739     * <p/>
740     * This can be useful to know by {@link LifecycleStrategy} or the likes, in case
741     * they need to react differently.
742     * <p/>
743     * As the startup procedure of {@link CamelContext} is slightly different when using plain Java versus
744     * Spring or Blueprint, then we need to know when Spring/Blueprint is setting up the routes, which
745     * can happen after the {@link CamelContext} itself is in started state, due the asynchronous event nature
746     * of especially Blueprint.
747     *
748     * @return <tt>true</tt> if current thread is setting up route(s), or <tt>false</tt> if not.
749     */
750    boolean isSetupRoutes();
751
752    // Properties
753    //-----------------------------------------------------------------------
754
755    /**
756     * Returns the type converter used to coerce types from one type to another
757     *
758     * @return the converter
759     */
760    TypeConverter getTypeConverter();
761
762    /**
763     * Returns the type converter registry where type converters can be added or looked up
764     *
765     * @return the type converter registry
766     */
767    TypeConverterRegistry getTypeConverterRegistry();
768
769    /**
770     * Returns the registry used to lookup components by name and type such as the Spring ApplicationContext,
771     * JNDI or the OSGi Service Registry
772     *
773     * @return the registry
774     */
775    Registry getRegistry();
776
777    /**
778     * Returns the registry used to lookup components by name and as the given type
779     *
780     * @param type the registry type such as {@link org.apache.camel.impl.JndiRegistry}
781     * @return the registry, or <tt>null</tt> if the given type was not found as a registry implementation
782     */
783    <T> T getRegistry(Class<T> type);
784
785    /**
786     * Returns the injector used to instantiate objects by type
787     *
788     * @return the injector
789     */
790    Injector getInjector();
791
792    /**
793     * Returns the management mbean assembler
794     *
795     * @return the mbean assembler
796     */
797    ManagementMBeanAssembler getManagementMBeanAssembler();
798
799    /**
800     * Returns the lifecycle strategies used to handle lifecycle notifications
801     *
802     * @return the lifecycle strategies
803     */
804    List<LifecycleStrategy> getLifecycleStrategies();
805
806    /**
807     * Adds the given lifecycle strategy to be used.
808     *
809     * @param lifecycleStrategy the strategy
810     */
811    void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy);
812
813    /**
814     * Resolves a language for creating expressions
815     *
816     * @param language name of the language
817     * @return the resolved language
818     */
819    Language resolveLanguage(String language);
820
821    /**
822     * Parses the given text and resolve any property placeholders - using {{key}}.
823     *
824     * @param text the text such as an endpoint uri or the likes
825     * @return the text with resolved property placeholders
826     * @throws Exception is thrown if property placeholders was used and there was an error resolving them
827     */
828    String resolvePropertyPlaceholders(String text) throws Exception;
829    
830    /**
831     * Returns the configured property placeholder prefix token if and only if the context has
832     * property placeholder abilities, otherwise returns {@code null}.
833     * 
834     * @return the prefix token or {@code null}
835     */
836    String getPropertyPrefixToken();
837    
838    /**
839     * Returns the configured property placeholder suffix token if and only if the context has
840     * property placeholder abilities, otherwise returns {@code null}.
841     * 
842     * @return the suffix token or {@code null}
843     */
844    String getPropertySuffixToken();
845
846    /**
847     * Gets a readonly list with the names of the languages currently registered.
848     *
849     * @return a readonly list with the names of the the languages
850     */
851    List<String> getLanguageNames();
852
853    /**
854     * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away.
855     * <p/>
856     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
857     * Why does Camel use too many threads with ProducerTemplate?</a>
858     * <p/>
859     * <b>Important:</b> Make sure to call {@link org.apache.camel.ProducerTemplate#stop()} when you are done using the template,
860     * to clean up any resources.
861     * <p/>
862     * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
863     * If no key was defined then it will fallback to a default size of 1000.
864     * You can also use the {@link org.apache.camel.ProducerTemplate#setMaximumCacheSize(int)} method to use a custom value
865     * before starting the template.
866     *
867     * @return the template
868     * @throws RuntimeCamelException is thrown if error starting the template
869     */
870    ProducerTemplate createProducerTemplate();
871
872    /**
873     * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away.
874     * <p/>
875     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
876     * Why does Camel use too many threads with ProducerTemplate?</a>
877     * <p/>
878     * <b>Important:</b> Make sure to call {@link ProducerTemplate#stop()} when you are done using the template,
879     * to clean up any resources.
880     *
881     * @param maximumCacheSize the maximum cache size
882     * @return the template
883     * @throws RuntimeCamelException is thrown if error starting the template
884     */
885    ProducerTemplate createProducerTemplate(int maximumCacheSize);
886
887    /**
888     * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away.
889     * <p/>
890     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
891     * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate.
892     * <p/>
893     * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template,
894     * to clean up any resources.
895     * <p/>
896     * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
897     * If no key was defined then it will fallback to a default size of 1000.
898     * You can also use the {@link org.apache.camel.ConsumerTemplate#setMaximumCacheSize(int)} method to use a custom value
899     * before starting the template.
900     *
901     * @return the template
902     * @throws RuntimeCamelException is thrown if error starting the template
903     */
904    ConsumerTemplate createConsumerTemplate();
905
906    /**
907     * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away.
908     * <p/>
909     * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
910     * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate.
911     * <p/>
912     * <b>Important:</b> Make sure to call {@link ConsumerTemplate#stop()} when you are done using the template,
913     * to clean up any resources.
914     *
915     * @param maximumCacheSize the maximum cache size
916     * @return the template
917     * @throws RuntimeCamelException is thrown if error starting the template
918     */
919    ConsumerTemplate createConsumerTemplate(int maximumCacheSize);
920
921    /**
922     * Adds the given interceptor strategy
923     *
924     * @param interceptStrategy the strategy
925     */
926    void addInterceptStrategy(InterceptStrategy interceptStrategy);
927
928    /**
929     * Gets the interceptor strategies
930     *
931     * @return the list of current interceptor strategies
932     */
933    List<InterceptStrategy> getInterceptStrategies();
934
935    /**
936     * Gets the default error handler builder which is inherited by the routes
937     *
938     * @return the builder
939     * @deprecated The return type will be switched to {@link ErrorHandlerFactory} in Camel 3.0
940     */
941    @Deprecated
942    ErrorHandlerBuilder getErrorHandlerBuilder();
943
944    /**
945     * Sets the default error handler builder which is inherited by the routes
946     *
947     * @param errorHandlerBuilder the builder
948     */
949    void setErrorHandlerBuilder(ErrorHandlerFactory errorHandlerBuilder);
950
951    /**
952     * Gets the default shared thread pool for error handlers which
953     * leverages this for asynchronous redelivery tasks.
954     */
955    ScheduledExecutorService getErrorHandlerExecutorService();
956
957    /**
958     * Sets the data formats that can be referenced in the routes.
959     *
960     * @param dataFormats the data formats
961     */
962    void setDataFormats(Map<String, DataFormatDefinition> dataFormats);
963
964    /**
965     * Gets the data formats that can be referenced in the routes.
966     *
967     * @return the data formats available
968     */
969    Map<String, DataFormatDefinition> getDataFormats();
970
971    /**
972     * Resolve a data format given its name
973     *
974     * @param name the data format name or a reference to it in the {@link Registry}
975     * @return the resolved data format, or <tt>null</tt> if not found
976     */
977    DataFormat resolveDataFormat(String name);
978
979    /**
980     * Resolve a data format definition given its name
981     *
982     * @param name the data format definition name or a reference to it in the {@link Registry}
983     * @return the resolved data format definition, or <tt>null</tt> if not found
984     */
985    DataFormatDefinition resolveDataFormatDefinition(String name);
986
987    /**
988     * Gets the current data format resolver
989     *
990     * @return the resolver
991     */
992    DataFormatResolver getDataFormatResolver();
993
994    /**
995     * Sets a custom data format resolver
996     *
997     * @param dataFormatResolver the resolver
998     */
999    void setDataFormatResolver(DataFormatResolver dataFormatResolver);
1000
1001    /**
1002     * Sets the properties that can be referenced in the camel context
1003     *
1004     * @param properties properties
1005     */
1006    void setProperties(Map<String, String> properties);
1007
1008    /**
1009     * Gets the properties that can be referenced in the camel context
1010     *
1011     * @return the properties
1012     */
1013    Map<String, String> getProperties();
1014
1015    /**
1016     * Gets the property value that can be referenced in the camel context
1017     *
1018     * @return the string value of property
1019     */
1020    String getProperty(String name);
1021    
1022    /**
1023     * Gets the default FactoryFinder which will be used for the loading the factory class from META-INF
1024     *
1025     * @return the default factory finder
1026     */
1027    FactoryFinder getDefaultFactoryFinder();
1028
1029    /**
1030     * Sets the factory finder resolver to use.
1031     *
1032     * @param resolver the factory finder resolver
1033     */
1034    void setFactoryFinderResolver(FactoryFinderResolver resolver);
1035
1036    /**
1037     * Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path
1038     *
1039     * @param path the META-INF path
1040     * @return the factory finder
1041     * @throws NoFactoryAvailableException is thrown if a factory could not be found
1042     */
1043    FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException;
1044
1045    /**
1046     * Returns the class resolver to be used for loading/lookup of classes.
1047     *
1048     * @return the resolver
1049     */
1050    ClassResolver getClassResolver();
1051
1052    /**
1053     * Returns the package scanning class resolver
1054     *
1055     * @return the resolver
1056     */
1057    PackageScanClassResolver getPackageScanClassResolver();
1058
1059    /**
1060     * Sets the class resolver to be use
1061     *
1062     * @param resolver the resolver
1063     */
1064    void setClassResolver(ClassResolver resolver);
1065
1066    /**
1067     * Sets the package scanning class resolver to use
1068     *
1069     * @param resolver the resolver
1070     */
1071    void setPackageScanClassResolver(PackageScanClassResolver resolver);
1072
1073    /**
1074     * Sets a pluggable service pool to use for {@link Producer} pooling.
1075     *
1076     * @param servicePool the pool
1077     */
1078    void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool);
1079
1080    /**
1081     * Gets the service pool for {@link Producer} pooling.
1082     *
1083     * @return the service pool
1084     */
1085    ServicePool<Endpoint, Producer> getProducerServicePool();
1086    
1087    /**
1088     * Sets a pluggable service pool to use for {@link PollingConsumer} pooling.
1089     *
1090     * @param servicePool the pool
1091     */
1092    void setPollingConsumerServicePool(ServicePool<Endpoint, PollingConsumer> servicePool);
1093
1094    /**
1095     * Gets the service pool for {@link Producer} pooling.
1096     *
1097     * @return the service pool
1098     */
1099    ServicePool<Endpoint, PollingConsumer> getPollingConsumerServicePool();
1100    
1101    /**
1102     * Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions
1103     *
1104     * @param factory custom factory to use
1105     */
1106    void setNodeIdFactory(NodeIdFactory factory);
1107
1108    /**
1109     * Gets the node id factory
1110     *
1111     * @return the node id factory
1112     */
1113    NodeIdFactory getNodeIdFactory();
1114
1115    /**
1116     * Gets the management strategy
1117     *
1118     * @return the management strategy
1119     */
1120    ManagementStrategy getManagementStrategy();
1121
1122    /**
1123     * Sets the management strategy to use
1124     *
1125     * @param strategy the management strategy
1126     */
1127    void setManagementStrategy(ManagementStrategy strategy);
1128
1129    /**
1130     * Gets the default tracer
1131     *
1132     * @return the default tracer
1133     */
1134    InterceptStrategy getDefaultTracer();
1135
1136    /**
1137     * Sets a custom tracer to be used as the default tracer.
1138     * <p/>
1139     * <b>Note:</b> This must be set before any routes are created,
1140     * changing the default tracer for existing routes is not supported.
1141     *
1142     * @param tracer the custom tracer to use as default tracer
1143     */
1144    void setDefaultTracer(InterceptStrategy tracer);
1145
1146    /**
1147     * Gets the default backlog tracer
1148     *
1149     * @return the default backlog tracer
1150     */
1151    InterceptStrategy getDefaultBacklogTracer();
1152
1153    /**
1154     * Sets a custom backlog tracer to be used as the default backlog tracer.
1155     * <p/>
1156     * <b>Note:</b> This must be set before any routes are created,
1157     * changing the default backlog tracer for existing routes is not supported.
1158     *
1159     * @param backlogTracer the custom tracer to use as default backlog tracer
1160     */
1161    void setDefaultBacklogTracer(InterceptStrategy backlogTracer);
1162
1163    /**
1164     * Gets the default backlog debugger
1165     *
1166     * @return the default backlog debugger
1167     */
1168    InterceptStrategy getDefaultBacklogDebugger();
1169
1170    /**
1171     * Sets a custom backlog debugger to be used as the default backlog debugger.
1172     * <p/>
1173     * <b>Note:</b> This must be set before any routes are created,
1174     * changing the default backlog debugger for existing routes is not supported.
1175     *
1176     * @param backlogDebugger the custom debugger to use as default backlog debugger
1177     */
1178    void setDefaultBacklogDebugger(InterceptStrategy backlogDebugger);
1179
1180    /**
1181     * Disables using JMX as {@link org.apache.camel.spi.ManagementStrategy}.
1182     * <p/>
1183     * <b>Important:</b> This method must be called <b>before</b> the {@link CamelContext} is started.
1184     *
1185     * @throws IllegalStateException is thrown if the {@link CamelContext} is not in stopped state.
1186     */
1187    void disableJMX() throws IllegalStateException;
1188
1189    /**
1190     * Gets the inflight repository
1191     *
1192     * @return the repository
1193     */
1194    InflightRepository getInflightRepository();
1195
1196    /**
1197     * Sets a custom inflight repository to use
1198     *
1199     * @param repository the repository
1200     */
1201    void setInflightRepository(InflightRepository repository);
1202
1203    /**
1204     * Gets the {@link org.apache.camel.AsyncProcessor} await manager.
1205     *
1206     * @return the manager
1207     */
1208    AsyncProcessorAwaitManager getAsyncProcessorAwaitManager();
1209
1210    /**
1211     * Sets a custom  {@link org.apache.camel.AsyncProcessor} await manager.
1212     *
1213     * @param manager the manager
1214     */
1215    void setAsyncProcessorAwaitManager(AsyncProcessorAwaitManager manager);
1216
1217    /**
1218     * Gets the the application context class loader which may be helpful for running camel in other containers
1219     *
1220     * @return the application context class loader
1221     */
1222    ClassLoader getApplicationContextClassLoader();
1223
1224    /**
1225     * Sets the application context class loader
1226     *
1227     * @param classLoader the class loader
1228     */
1229    void setApplicationContextClassLoader(ClassLoader classLoader);
1230
1231    /**
1232     * Gets the current shutdown strategy
1233     *
1234     * @return the strategy
1235     */
1236    ShutdownStrategy getShutdownStrategy();
1237
1238    /**
1239     * Sets a custom shutdown strategy
1240     *
1241     * @param shutdownStrategy the custom strategy
1242     */
1243    void setShutdownStrategy(ShutdownStrategy shutdownStrategy);
1244
1245    /**
1246     * Gets the current {@link org.apache.camel.spi.ExecutorServiceManager}
1247     *
1248     * @return the manager
1249     */
1250    ExecutorServiceManager getExecutorServiceManager();
1251
1252    /**
1253     * Gets the current {@link org.apache.camel.spi.ExecutorServiceStrategy}
1254     *
1255     * @return the manager
1256     * @deprecated use {@link #getExecutorServiceManager()}
1257     */
1258    @Deprecated
1259    org.apache.camel.spi.ExecutorServiceStrategy getExecutorServiceStrategy();
1260
1261    /**
1262     * Sets a custom {@link org.apache.camel.spi.ExecutorServiceManager}
1263     *
1264     * @param executorServiceManager the custom manager
1265     */
1266    void setExecutorServiceManager(ExecutorServiceManager executorServiceManager);
1267
1268    /**
1269     * Gets the current {@link org.apache.camel.spi.ProcessorFactory}
1270     *
1271     * @return the factory, can be <tt>null</tt> if no custom factory has been set
1272     */
1273    ProcessorFactory getProcessorFactory();
1274
1275    /**
1276     * Sets a custom {@link org.apache.camel.spi.ProcessorFactory}
1277     *
1278     * @param processorFactory the custom factory
1279     */
1280    void setProcessorFactory(ProcessorFactory processorFactory);
1281
1282    /**
1283     * Gets the current {@link Debugger}
1284     *
1285     * @return the debugger
1286     */
1287    Debugger getDebugger();
1288
1289    /**
1290     * Sets a custom {@link Debugger}
1291     *
1292     * @param debugger the debugger
1293     */
1294    void setDebugger(Debugger debugger);
1295
1296    /**
1297     * Gets the current {@link UuidGenerator}
1298     *
1299     * @return the uuidGenerator
1300     */
1301    UuidGenerator getUuidGenerator();
1302    
1303    /**
1304     * Sets a custom {@link UuidGenerator} (should only be set once) 
1305     *
1306     * @param uuidGenerator the UUID Generator
1307     */
1308    void setUuidGenerator(UuidGenerator uuidGenerator);
1309
1310    /**
1311     * Whether or not type converters should be loaded lazy
1312     *
1313     * @return <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
1314     * @deprecated this option is no longer supported, will be removed in a future Camel release.
1315     */
1316    @Deprecated
1317    Boolean isLazyLoadTypeConverters();
1318
1319    /**
1320     * Sets whether type converters should be loaded lazy
1321     *
1322     * @param lazyLoadTypeConverters <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
1323     * @deprecated this option is no longer supported, will be removed in a future Camel release.
1324     */
1325    @Deprecated
1326    void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters);
1327
1328    /**
1329     * Whether or not type converter statistics is enabled.
1330     * <p/>
1331     * By default the type converter utilization statistics is disabled.
1332     * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load.
1333     *
1334     * @return <tt>true</tt> if enabled, <tt>false</tt> if disabled (default).
1335     */
1336    Boolean isTypeConverterStatisticsEnabled();
1337
1338    /**
1339     * Sets whether or not type converter statistics is enabled.
1340     * <p/>
1341     * By default the type converter utilization statistics is disabled.
1342     * <b>Notice:</b> If enabled then there is a slight performance impact under very heavy load.
1343     * <p/>
1344     * You can enable/disable the statistics at runtime using the
1345     * {@link org.apache.camel.spi.TypeConverterRegistry#getStatistics()#setTypeConverterStatisticsEnabled(Boolean)} method,
1346     * or from JMX on the {@link org.apache.camel.api.management.mbean.ManagedTypeConverterRegistryMBean} mbean.
1347     *
1348     * @param typeConverterStatisticsEnabled <tt>true</tt> to enable, <tt>false</tt> to disable
1349     */
1350    void setTypeConverterStatisticsEnabled(Boolean typeConverterStatisticsEnabled);
1351
1352    /**
1353     * Whether or not <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> logging is being enabled.
1354     *
1355     * @return <tt>true</tt> if MDC logging is enabled
1356     */
1357    Boolean isUseMDCLogging();
1358
1359    /**
1360     * Set whether <a href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a> is enabled.
1361     *
1362     * @param useMDCLogging <tt>true</tt> to enable MDC logging, <tt>false</tt> to disable
1363     */
1364    void setUseMDCLogging(Boolean useMDCLogging);
1365
1366    /**
1367     * Whether or not breadcrumb is enabled.
1368     *
1369     * @return <tt>true</tt> if breadcrumb is enabled
1370     */
1371    Boolean isUseBreadcrumb();
1372
1373    /**
1374     * Set whether breadcrumb is enabled.
1375     *
1376     * @param useBreadcrumb <tt>true</tt> to enable breadcrumb, <tt>false</tt> to disable
1377     */
1378    void setUseBreadcrumb(Boolean useBreadcrumb);
1379
1380    /**
1381     * Resolves a component's default name from its java type.
1382     * <p/>
1383     * A component may be used with a non default name such as <tt>activemq</tt>, <tt>wmq</tt> for the JMS component.
1384     * This method can resolve the default component name by its java type.
1385     *
1386     * @param javaType the FQN name of the java type
1387     * @return the default component name.
1388     */
1389    String resolveComponentDefaultName(String javaType);
1390
1391    /**
1392     * Find information about all the Camel components available in the classpath and {@link org.apache.camel.spi.Registry}.
1393     *
1394     * @return a map with the component name, and value with component details.
1395     * @throws LoadPropertiesException is thrown if error during classpath discovery of the components
1396     * @throws IOException is thrown if error during classpath discovery of the components
1397     */
1398    Map<String, Properties> findComponents() throws LoadPropertiesException, IOException;
1399
1400    /**
1401     * Find information about all the EIPs from camel-core.
1402     *
1403     * @return a map with node id, and value with EIP details.
1404     * @throws LoadPropertiesException is thrown if error during classpath discovery of the EIPs
1405     * @throws IOException is thrown if error during classpath discovery of the EIPs
1406     */
1407    Map<String, Properties> findEips() throws LoadPropertiesException, IOException;
1408
1409    /**
1410     * Returns the HTML documentation for the given Camel component
1411     *
1412     * @return the HTML or <tt>null</tt> if the component is <b>not</b> built with HTML document included.
1413     */
1414    String getComponentDocumentation(String componentName) throws IOException;
1415
1416    /**
1417     * Returns the JSON schema representation of the component and endpoint parameters for the given component name.
1418     *
1419     * @return the json or <tt>null</tt> if the component is <b>not</b> built with JSon schema support
1420     */
1421    String getComponentParameterJsonSchema(String componentName) throws IOException;
1422
1423    /**
1424     * Returns the JSON schema representation of the {@link DataFormat} parameters for the given data format name.
1425     *
1426     * @return the json or <tt>null</tt> if the data format does not exist
1427     */
1428    String getDataFormatParameterJsonSchema(String dataFormatName) throws IOException;
1429
1430    /**
1431     * Returns the JSON schema representation of the {@link Language} parameters for the given language name.
1432     *
1433     * @return the json or <tt>null</tt> if the language does not exist
1434     */
1435    String getLanguageParameterJsonSchema(String languageName) throws IOException;
1436
1437    /**
1438     * Returns the JSON schema representation of the EIP parameters for the given EIP name.
1439     *
1440     * @return the json or <tt>null</tt> if the EIP does not exist
1441     */
1442    String getEipParameterJsonSchema(String eipName) throws IOException;
1443
1444    /**
1445     * Returns a JSON schema representation of the EIP parameters for the given EIP by its id.
1446     *
1447     * @param nameOrId the name of the EIP ({@link NamedNode#getShortName()} or a node id to refer to a specific node from the routes.
1448     * @param includeAllOptions whether to include non configured options also (eg default options)
1449     * @return the json or <tt>null</tt> if the eipName or the id was not found
1450     */
1451    String explainEipJson(String nameOrId, boolean includeAllOptions);
1452
1453    /**
1454     * Returns a JSON schema representation of the component parameters (not endpoint parameters) for the given component by its id.
1455     *
1456     * @param componentName the name of the component.
1457     * @param includeAllOptions whether to include non configured options also (eg default options)
1458     * @return the json or <tt>null</tt> if the component was not found
1459     */
1460    String explainComponentJson(String componentName, boolean includeAllOptions);
1461
1462    /**
1463     * Returns a JSON schema representation of the endpoint parameters for the given endpoint uri.
1464     *
1465     * @param uri the endpoint uri
1466     * @param includeAllOptions whether to include non configured options also (eg default options)
1467     * @return the json or <tt>null</tt> if uri parameters is invalid, or the component is <b>not</b> built with JSon schema support
1468     */
1469    String explainEndpointJson(String uri, boolean includeAllOptions);
1470
1471    /**
1472     * Creates a JSON representation of all the <b>static</b> and <b>dynamic</b> configured endpoints defined in the given route(s).
1473     *
1474     * @param routeId for a particular route, or <tt>null</tt> for all routes
1475     * @return a JSON string
1476     */
1477    String createRouteStaticEndpointJson(String routeId);
1478
1479    /**
1480     * Creates a JSON representation of all the <b>static</b> (and possible <b>dynamic</b>) configured endpoints defined in the given route(s).
1481     *
1482     * @param routeId for a particular route, or <tt>null</tt> for all routes
1483     * @param includeDynamic whether to include dynamic endpoints
1484     * @return a JSON string
1485     */
1486    String createRouteStaticEndpointJson(String routeId, boolean includeDynamic);
1487
1488    /**
1489     * Gets the {@link StreamCachingStrategy} to use.
1490     */
1491    StreamCachingStrategy getStreamCachingStrategy();
1492
1493    /**
1494     * Sets a custom {@link StreamCachingStrategy} to use.
1495     */
1496    void setStreamCachingStrategy(StreamCachingStrategy streamCachingStrategy);
1497
1498    /**
1499     * Gets the {@link UnitOfWorkFactory} to use.
1500     */
1501    UnitOfWorkFactory getUnitOfWorkFactory();
1502
1503    /**
1504     * Sets a custom {@link UnitOfWorkFactory} to use.
1505     */
1506    void setUnitOfWorkFactory(UnitOfWorkFactory unitOfWorkFactory);
1507
1508    /**
1509     * Gets the {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use, or <tt>null</tt> if none is in use.
1510     */
1511    RuntimeEndpointRegistry getRuntimeEndpointRegistry();
1512
1513    /**
1514     * Sets a custom {@link org.apache.camel.spi.RuntimeEndpointRegistry} to use.
1515     */
1516    void setRuntimeEndpointRegistry(RuntimeEndpointRegistry runtimeEndpointRegistry);
1517
1518    /**
1519     * Gets the {@link org.apache.camel.spi.RestRegistry} to use
1520     */
1521    RestRegistry getRestRegistry();
1522
1523    /**
1524     * Sets a custom {@link org.apache.camel.spi.RestRegistry} to use.
1525     */
1526    void setRestRegistry(RestRegistry restRegistry);
1527
1528    /**
1529     * Adds the given route policy factory
1530     *
1531     * @param routePolicyFactory the factory
1532     */
1533    void addRoutePolicyFactory(RoutePolicyFactory routePolicyFactory);
1534
1535    /**
1536     * Gets the route policy factories
1537     *
1538     * @return the list of current route policy factories
1539     */
1540    List<RoutePolicyFactory> getRoutePolicyFactories();
1541
1542    /**
1543     * Returns the JAXB Context factory used to create Models.
1544     *
1545     * @return the JAXB Context factory used to create Models.
1546     */
1547    ModelJAXBContextFactory getModelJAXBContextFactory();
1548
1549    /**
1550     * Sets a custom JAXB Context factory to be used
1551     *
1552     * @param modelJAXBContextFactory a JAXB Context factory
1553     */
1554    void setModelJAXBContextFactory(ModelJAXBContextFactory modelJAXBContextFactory);
1555
1556}