001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel;
018
019 import java.util.Collection;
020 import java.util.List;
021 import java.util.Map;
022 import java.util.concurrent.TimeUnit;
023
024 import org.apache.camel.builder.ErrorHandlerBuilder;
025 import org.apache.camel.model.DataFormatDefinition;
026 import org.apache.camel.model.RouteDefinition;
027 import org.apache.camel.spi.CamelContextNameStrategy;
028 import org.apache.camel.spi.ClassResolver;
029 import org.apache.camel.spi.DataFormat;
030 import org.apache.camel.spi.DataFormatResolver;
031 import org.apache.camel.spi.Debugger;
032 import org.apache.camel.spi.EndpointStrategy;
033 import org.apache.camel.spi.ExecutorServiceStrategy;
034 import org.apache.camel.spi.FactoryFinder;
035 import org.apache.camel.spi.FactoryFinderResolver;
036 import org.apache.camel.spi.InflightRepository;
037 import org.apache.camel.spi.Injector;
038 import org.apache.camel.spi.InterceptStrategy;
039 import org.apache.camel.spi.Language;
040 import org.apache.camel.spi.LifecycleStrategy;
041 import org.apache.camel.spi.ManagementStrategy;
042 import org.apache.camel.spi.NodeIdFactory;
043 import org.apache.camel.spi.PackageScanClassResolver;
044 import org.apache.camel.spi.ProcessorFactory;
045 import org.apache.camel.spi.Registry;
046 import org.apache.camel.spi.ServicePool;
047 import org.apache.camel.spi.ShutdownStrategy;
048 import org.apache.camel.spi.TypeConverterRegistry;
049 import org.apache.camel.spi.UuidGenerator;
050
051 /**
052 * Interface used to represent the context used to configure routes and the
053 * policies to use during message exchanges between endpoints.
054 * <p/>
055 * The context offers the following methods to control the lifecycle:
056 * <ul>
057 * <li>{@link #start()} - to start</li>
058 * <li>{@link #stop()} - to shutdown (will stop all routes/components/endpoints etc and clear internal state/cache)</li>
059 * <li>{@link #suspend()} - to pause routing messages</li>
060 * <li>{@link #resume()} - to resume after a suspend</li>
061 * </ul>
062 * <p/>
063 * <b>Notice:</b> that {@link #stop()} and {@link #suspend()} will graceful stop/suspend routs ensuring any in progress
064 * messages is given time to complete. See more details at {@link org.apache.camel.spi.ShutdownStrategy}.
065 * <p/>
066 * If you are doing a hot restart then its adviced to use the suspend/resume methods which ensures a faster
067 * restart but also allows any internal state to be kept as is.
068 * The stop/start approach will do a <i>cold</i> restart of Camel, where all internal state is reset.
069 * <p/>
070 * End users is adviced to use suspend/resume. Using stop is for shutting down Camel and its not guaranteed that
071 * when its being started again using the start method that everything works out of the box.
072 *
073 * @version $Revision: 22047 $
074 */
075 public interface CamelContext extends SuspendableService, RuntimeConfiguration {
076
077 /**
078 * Gets the name of the this context.
079 *
080 * @return the name
081 */
082 String getName();
083
084 /**
085 * Gets the current name strategy
086 *
087 * @return name strategy
088 */
089 CamelContextNameStrategy getNameStrategy();
090
091 /**
092 * Sets a custom name strategy
093 *
094 * @param nameStrategy name strategy
095 */
096 void setNameStrategy(CamelContextNameStrategy nameStrategy);
097
098 /**
099 * Gets the name this {@link CamelContext} was registered in JMX.
100 * <p/>
101 * The reason that a {@link CamelContext} can have a different name in JMX is the fact to remedy for name clash
102 * in JMX when having multiple {@link CamelContext}s in the same JVM. Camel will automatic reassign and use
103 * a free name to avoid failing to start.
104 *
105 * @return the management name
106 */
107 String getManagementName();
108
109 /**
110 * Sets the name this {@link CamelContext} was registered in JMX.
111 *
112 * @param name the actual name used when registering this {@link CamelContext} in JMX
113 */
114 void setManagementName(String name);
115
116 /**
117 * Gets the version of the this context.
118 *
119 * @return the version
120 */
121 String getVersion();
122
123 /**
124 * Get the status of this context
125 *
126 * @return the status
127 */
128 ServiceStatus getStatus();
129
130 /**
131 * Gets the uptime in a human readable format
132 *
133 * @return the uptime in days/hours/minutes
134 */
135 String getUptime();
136
137 // Service Methods
138 //-----------------------------------------------------------------------
139
140 /**
141 * Adds a service, starting it so that it will be stopped with this context
142 * <p/>
143 * The added service will also be enlisted in JMX for management (if JMX is enabled)
144 *
145 * @param object the service
146 * @throws Exception can be thrown when starting the service
147 */
148 void addService(Object object) throws Exception;
149
150 /**
151 * Has the given service already been added?
152 *
153 * @param object the service
154 * @return <tt>true</tt> if already added, <tt>false</tt> if not.
155 */
156 boolean hasService(Object object);
157
158 /**
159 * Adds the given listener to be invoked when {@link CamelContext} have just been started.
160 * <p/>
161 * This allows listeners to do any custom work after the routes and other services have been started and are running.
162 * <p/><b>Important:</b> The listener will always be invoked, also if the {@link CamelContext} has already been
163 * started, see the {@link org.apache.camel.StartupListener#onCamelContextStarted(CamelContext, boolean)} method.
164 *
165 * @param listener the listener
166 * @throws Exception can be thrown if {@link CamelContext} is already started and the listener is invoked
167 * and cause an exception to be thrown
168 */
169 void addStartupListener(StartupListener listener) throws Exception;
170
171 // Component Management Methods
172 //-----------------------------------------------------------------------
173
174 /**
175 * Adds a component to the context.
176 *
177 * @param componentName the name the component is registered as
178 * @param component the component
179 */
180 void addComponent(String componentName, Component component);
181
182 /**
183 * Is the given component already registered?
184 *
185 * @param componentName the name of the component
186 * @return the registered Component or <tt>null</tt> if not registered
187 */
188 Component hasComponent(String componentName);
189
190 /**
191 * Gets a component from the context by name.
192 *
193 * @param componentName the name of the component
194 * @return the component
195 */
196 Component getComponent(String componentName);
197
198 /**
199 * Gets a component from the context by name and specifying the expected type of component.
200 *
201 * @param name the name to lookup
202 * @param componentType the expected type
203 * @return the component
204 */
205 <T extends Component> T getComponent(String name, Class<T> componentType);
206
207 /**
208 * Gets a readonly list of names of the components currently registered
209 *
210 * @return a readonly list with the names of the the components
211 */
212 List<String> getComponentNames();
213
214 /**
215 * Removes a previously added component.
216 *
217 * @param componentName the component name to remove
218 * @return the previously added component or null if it had not been previously added.
219 */
220 Component removeComponent(String componentName);
221
222 // Endpoint Management Methods
223 //-----------------------------------------------------------------------
224
225 /**
226 * Resolves the given name to an {@link Endpoint} of the specified type.
227 * If the name has a singleton endpoint registered, then the singleton is returned.
228 * Otherwise, a new {@link Endpoint} is created and registered.
229 *
230 * @param uri the URI of the endpoint
231 * @return the endpoint
232 */
233 Endpoint getEndpoint(String uri);
234
235 /**
236 * Resolves the given name to an {@link Endpoint} of the specified type.
237 * If the name has a singleton endpoint registered, then the singleton is returned.
238 * Otherwise, a new {@link Endpoint} is created and registered.
239 *
240 * @param name the name of the endpoint
241 * @param endpointType the expected type
242 * @return the endpoint
243 */
244 <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType);
245
246 /**
247 * Returns the collection of all registered endpoints.
248 *
249 * @return all endpoints
250 */
251 Collection<Endpoint> getEndpoints();
252
253 /**
254 * Returns a new Map containing all of the active endpoints with the key of the map being their
255 * unique key.
256 *
257 * @return map of active endpoints
258 */
259 Map<String, Endpoint> getEndpointMap();
260
261 /**
262 * Is the given endpoint already registered?
263 *
264 * @param uri the URI of the endpoint
265 * @return the registered endpoint or <tt>null</tt> if not registered
266 */
267 Endpoint hasEndpoint(String uri);
268
269 /**
270 * Adds the endpoint to the context using the given URI.
271 *
272 * @param uri the URI to be used to resolve this endpoint
273 * @param endpoint the endpoint to be added to the context
274 * @return the old endpoint that was previously registered or <tt>null</tt> if none was registered
275 * @throws Exception if the new endpoint could not be started or the old endpoint could not be stopped
276 */
277 Endpoint addEndpoint(String uri, Endpoint endpoint) throws Exception;
278
279 /**
280 * Removes all endpoints with the given URI.
281 *
282 * @param pattern an uri or pattern to match
283 * @return a collection of endpoints removed or null if there are no endpoints for this URI
284 * @throws Exception if at least one endpoint could not be stopped
285 * @see org.apache.camel.util.EndpointHelper#matchEndpoint(String, String) for pattern
286 */
287 Collection<Endpoint> removeEndpoints(String pattern) throws Exception;
288
289 /**
290 * Registers a {@link org.apache.camel.spi.EndpointStrategy callback} to allow you to do custom
291 * logic when an {@link Endpoint} is about to be registered to the {@link CamelContext} endpoint registry.
292 * <p/>
293 * When a callback is added it will be executed on the already registered endpoints allowing you to catch-up
294 *
295 * @param strategy callback to be invoked
296 */
297 void addRegisterEndpointCallback(EndpointStrategy strategy);
298
299 // Route Management Methods
300 //-----------------------------------------------------------------------
301
302 /**
303 * Returns a list of the current route definitions
304 *
305 * @return list of the current route definitions
306 */
307 List<RouteDefinition> getRouteDefinitions();
308
309 /**
310 * Gets the route definition with the given id
311 *
312 * @param id id of the route
313 * @return the route definition or <tt>null</tt> if not found
314 */
315 RouteDefinition getRouteDefinition(String id);
316
317 /**
318 * Returns the current routes in this context
319 *
320 * @return the current routes
321 */
322 List<Route> getRoutes();
323
324 /**
325 * Gets the route with the given id
326 *
327 * @param id id of the route
328 * @return the route or <tt>null</tt> if not found
329 */
330 Route getRoute(String id);
331
332 /**
333 * Adds a collection of routes to this context using the given builder
334 * to build them
335 *
336 * @param builder the builder which will create the routes and add them to this context
337 * @throws Exception if the routes could not be created for whatever reason
338 */
339 void addRoutes(RoutesBuilder builder) throws Exception;
340
341 /**
342 * Adds a collection of route definitions to the context
343 *
344 * @param routeDefinitions the route(s) definition to add
345 * @throws Exception if the route definitions could not be created for whatever reason
346 */
347 void addRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception;
348
349 /**
350 * Add a route definition to the context
351 *
352 * @param routeDefinition the route definition to add
353 * @throws Exception if the route definition could not be created for whatever reason
354 */
355 void addRouteDefinition(RouteDefinition routeDefinition) throws Exception;
356
357 /**
358 * Removes a collection of route definitions from the context - stopping any previously running
359 * routes if any of them are actively running
360 *
361 * @param routeDefinitions route(s) definitions to remove
362 * @throws Exception if the route definitions could not be removed for whatever reason
363 */
364 void removeRouteDefinitions(Collection<RouteDefinition> routeDefinitions) throws Exception;
365
366 /**
367 * Removes a route definition from the context - stopping any previously running
368 * routes if any of them are actively running
369 *
370 * @param routeDefinition route definition to remove
371 * @throws Exception if the route definition could not be removed for whatever reason
372 */
373 void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception;
374
375 /**
376 * Starts the given route if it has been previously stopped
377 *
378 * @param route the route to start
379 * @throws Exception is thrown if the route could not be started for whatever reason
380 */
381 void startRoute(RouteDefinition route) throws Exception;
382
383 /**
384 * Starts the given route if it has been previously stopped
385 *
386 * @param routeId the route id
387 * @throws Exception is thrown if the route could not be started for whatever reason
388 */
389 void startRoute(String routeId) throws Exception;
390
391 /**
392 * Stops the given route.
393 *
394 * @param route the route to stop
395 * @throws Exception is thrown if the route could not be stopped for whatever reason
396 */
397 void stopRoute(RouteDefinition route) throws Exception;
398
399 /**
400 * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
401 *
402 * @param routeId the route id
403 * @throws Exception is thrown if the route could not be stopped for whatever reason
404 * @see #suspendRoute(String)
405 */
406 void stopRoute(String routeId) throws Exception;
407
408 /**
409 * Stops the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
410 *
411 * @param routeId the route id
412 * @param timeout timeout
413 * @param timeUnit the unit to use
414 * @throws Exception is thrown if the route could not be stopped for whatever reason
415 * @see #suspendRoute(String, long, java.util.concurrent.TimeUnit)
416 */
417 void stopRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
418
419 /**
420 * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
421 *
422 * @param routeId the route id
423 * @throws Exception is thrown if the route could not be shutdown for whatever reason
424 * @deprecated use {@link #stopRoute(String)} and {@link #removeRoute(String)}
425 */
426 @Deprecated
427 void shutdownRoute(String routeId) throws Exception;
428
429 /**
430 * Shutdown and <b>removes</b> the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
431 *
432 * @param routeId the route id
433 * @param timeout timeout
434 * @param timeUnit the unit to use
435 * @throws Exception is thrown if the route could not be shutdown for whatever reason
436 * @deprecated use {@link #stopRoute(String, long, java.util.concurrent.TimeUnit)} and {@link #removeRoute(String)}
437 */
438 @Deprecated
439 void shutdownRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
440
441 /**
442 * Removes the given route (the route <b>must</b> be stopped before it can be removed).
443 * <p/>
444 * <br/>A route which is removed will be unregistered from JMX, have its services stopped/shutdown and the route
445 * definition etc. will also be removed. All the resources related to the route will be stopped and cleared.
446 * <p/>
447 * <br/>End users can use this method to remove unwanted routes or temporary routes which no longer is in demand.
448 *
449 * @param routeId the route id
450 * @return <tt>true</tt> if the route was removed, <tt>false</tt> if the route could not be removed because its not stopped
451 * @throws Exception is thrown if the route could not be shutdown for whatever reason
452 */
453 boolean removeRoute(String routeId) throws Exception;
454
455 /**
456 * Resumes the given route if it has been previously suspended
457 * <p/>
458 * If the route does <b>not</b> support suspension the route will be started instead
459 *
460 * @param routeId the route id
461 * @throws Exception is thrown if the route could not be resumed for whatever reason
462 */
463 void resumeRoute(String routeId) throws Exception;
464
465 /**
466 * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy}.
467 * <p/>
468 * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support)
469 * otherwise the consumers will be stopped.
470 * <p/>
471 * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.
472 * <p/>
473 * If the route does <b>not</b> support suspension the route will be stopped instead
474 *
475 * @param routeId the route id
476 * @throws Exception is thrown if the route could not be suspended for whatever reason
477 */
478 void suspendRoute(String routeId) throws Exception;
479
480 /**
481 * Suspends the given route using {@link org.apache.camel.spi.ShutdownStrategy} with a specified timeout.
482 * <p/>
483 * Suspending a route is more gently than stopping, as the route consumers will be suspended (if they support)
484 * otherwise the consumers will be stopped.
485 * <p/>
486 * By suspending the route services will be kept running (if possible) and therefore its faster to resume the route.
487 * <p/>
488 * If the route does <b>not</b> support suspension the route will be stopped instead
489 *
490 * @param routeId the route id
491 * @param timeout timeout
492 * @param timeUnit the unit to use
493 * @throws Exception is thrown if the route could not be suspended for whatever reason
494 */
495 void suspendRoute(String routeId, long timeout, TimeUnit timeUnit) throws Exception;
496
497 /**
498 * Returns the current status of the given route
499 *
500 * @param routeId the route id
501 * @return the status for the route
502 */
503 ServiceStatus getRouteStatus(String routeId);
504
505 // Properties
506 //-----------------------------------------------------------------------
507
508 /**
509 * Returns the type converter used to coerce types from one type to another
510 *
511 * @return the converter
512 */
513 TypeConverter getTypeConverter();
514
515 /**
516 * Returns the type converter registry where type converters can be added or looked up
517 *
518 * @return the type converter registry
519 */
520 TypeConverterRegistry getTypeConverterRegistry();
521
522 /**
523 * Returns the registry used to lookup components by name and type such as the Spring ApplicationContext,
524 * JNDI or the OSGi Service Registry
525 *
526 * @return the registry
527 */
528 Registry getRegistry();
529
530 /**
531 * Returns the injector used to instantiate objects by type
532 *
533 * @return the injector
534 */
535 Injector getInjector();
536
537 /**
538 * Returns the lifecycle strategies used to handle lifecycle notifications
539 *
540 * @return the lifecycle strategies
541 */
542 List<LifecycleStrategy> getLifecycleStrategies();
543
544 /**
545 * Adds the given lifecycle strategy to be used.
546 *
547 * @param lifecycleStrategy the strategy
548 */
549 void addLifecycleStrategy(LifecycleStrategy lifecycleStrategy);
550
551 /**
552 * Resolves a language for creating expressions
553 *
554 * @param language name of the language
555 * @return the resolved language
556 */
557 Language resolveLanguage(String language);
558
559 /**
560 * Parses the given text and resolve any property placeholders - using {{key}}.
561 *
562 * @param text the text such as an endpoint uri or the likes
563 * @return the text with resolved property placeholders
564 * @throws Exception is thrown if property placeholders was used and there was an error resolving them
565 */
566 String resolvePropertyPlaceholders(String text) throws Exception;
567
568 /**
569 * Gets a readonly list with the names of the languages currently registered.
570 *
571 * @return a readonly list with the names of the the languages
572 */
573 List<String> getLanguageNames();
574
575 /**
576 * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away.
577 * <p/>
578 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
579 * Why does Camel use too many threads with ProducerTemplate?</a>
580 * <p/>
581 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
582 * If no key was defined then it will fallback to a default size of 1000.
583 * You can also use the {@link org.apache.camel.ProducerTemplate#setMaximumCacheSize(int)} method to use a custom value
584 * before starting the template.
585 *
586 * @return the template
587 * @throws RuntimeCamelException is thrown if error starting the template
588 */
589 ProducerTemplate createProducerTemplate();
590
591 /**
592 * Creates a new {@link ProducerTemplate} which is <b>started</b> and therefore ready to use right away.
593 * <p/>
594 * You <b>must</b> start the template before its being used.
595 * <p/>
596 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
597 * Why does Camel use too many threads with ProducerTemplate?</a>
598 *
599 * @param maximumCacheSize the maximum cache size
600 * @return the template
601 * @throws RuntimeCamelException is thrown if error starting the template
602 */
603 ProducerTemplate createProducerTemplate(int maximumCacheSize);
604
605 /**
606 * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away.
607 * <p/>
608 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
609 * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate.
610 * <p/>
611 * Will use cache size defined in Camel property with key {@link Exchange#MAXIMUM_CACHE_POOL_SIZE}.
612 * If no key was defined then it will fallback to a default size of 1000.
613 * You can also use the {@link org.apache.camel.ConsumerTemplate#setMaximumCacheSize(int)} method to use a custom value
614 * before starting the template.
615 *
616 * @return the template
617 * @throws RuntimeCamelException is thrown if error starting the template
618 */
619 ConsumerTemplate createConsumerTemplate();
620
621 /**
622 * Creates a new {@link ConsumerTemplate} which is <b>started</b> and therefore ready to use right away.
623 * <p/>
624 * See this FAQ before use: <a href="http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html">
625 * Why does Camel use too many threads with ProducerTemplate?</a> as it also applies for ConsumerTemplate.
626 *
627 * @param maximumCacheSize the maximum cache size
628 * @return the template
629 * @throws RuntimeCamelException is thrown if error starting the template
630 */
631 ConsumerTemplate createConsumerTemplate(int maximumCacheSize);
632
633 /**
634 * Adds the given interceptor strategy
635 *
636 * @param interceptStrategy the strategy
637 */
638 void addInterceptStrategy(InterceptStrategy interceptStrategy);
639
640 /**
641 * Gets the interceptor strategies
642 *
643 * @return the list of current interceptor strategies
644 */
645 List<InterceptStrategy> getInterceptStrategies();
646
647 /**
648 * Gets the default error handler builder which is inherited by the routes
649 *
650 * @return the builder
651 */
652 ErrorHandlerBuilder getErrorHandlerBuilder();
653
654 /**
655 * Sets the default error handler builder which is inherited by the routes
656 *
657 * @param errorHandlerBuilder the builder
658 */
659 void setErrorHandlerBuilder(ErrorHandlerBuilder errorHandlerBuilder);
660
661 /**
662 * Sets the data formats that can be referenced in the routes.
663 *
664 * @param dataFormats the data formats
665 */
666 void setDataFormats(Map<String, DataFormatDefinition> dataFormats);
667
668 /**
669 * Gets the data formats that can be referenced in the routes.
670 *
671 * @return the data formats available
672 */
673 Map<String, DataFormatDefinition> getDataFormats();
674
675 /**
676 * Resolve a data format given its name
677 *
678 * @param name the data format name or a reference to it in the {@link Registry}
679 * @return the resolved data format, or <tt>null</tt> if not found
680 */
681 DataFormat resolveDataFormat(String name);
682
683 /**
684 * Resolve a data format definition given its name
685 *
686 * @param name the data format definition name or a reference to it in the {@link Registry}
687 * @return the resolved data format definition, or <tt>null</tt> if not found
688 */
689 DataFormatDefinition resolveDataFormatDefinition(String name);
690
691 /**
692 * Gets the current data format resolver
693 *
694 * @return the resolver
695 */
696 DataFormatResolver getDataFormatResolver();
697
698 /**
699 * Sets a custom data format resolver
700 *
701 * @param dataFormatResolver the resolver
702 */
703 void setDataFormatResolver(DataFormatResolver dataFormatResolver);
704
705 /**
706 * Sets the properties that can be referenced in the camel context
707 *
708 * @param properties properties
709 */
710 void setProperties(Map<String, String> properties);
711
712 /**
713 * Gets the properties that can be referenced in the camel context
714 *
715 * @return the properties
716 */
717 Map<String, String> getProperties();
718
719 /**
720 * Gets the default FactoryFinder which will be used for the loading the factory class from META-INF
721 *
722 * @return the default factory finder
723 */
724 FactoryFinder getDefaultFactoryFinder();
725
726 /**
727 * Sets the factory finder resolver to use.
728 *
729 * @param resolver the factory finder resolver
730 */
731 void setFactoryFinderResolver(FactoryFinderResolver resolver);
732
733 /**
734 * Gets the FactoryFinder which will be used for the loading the factory class from META-INF in the given path
735 *
736 * @param path the META-INF path
737 * @return the factory finder
738 * @throws NoFactoryAvailableException is thrown if a factory could not be found
739 */
740 FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException;
741
742 /**
743 * Returns the class resolver to be used for loading/lookup of classes.
744 *
745 * @return the resolver
746 */
747 ClassResolver getClassResolver();
748
749 /**
750 * Returns the package scanning class resolver
751 *
752 * @return the resolver
753 */
754 PackageScanClassResolver getPackageScanClassResolver();
755
756 /**
757 * Sets the class resolver to be use
758 *
759 * @param resolver the resolver
760 */
761 void setClassResolver(ClassResolver resolver);
762
763 /**
764 * Sets the package scanning class resolver to use
765 *
766 * @param resolver the resolver
767 */
768 void setPackageScanClassResolver(PackageScanClassResolver resolver);
769
770 /**
771 * Sets a pluggable service pool to use for {@link Producer} pooling.
772 *
773 * @param servicePool the pool
774 */
775 void setProducerServicePool(ServicePool<Endpoint, Producer> servicePool);
776
777 /**
778 * Gets the service pool for {@link Producer} pooling.
779 *
780 * @return the service pool
781 */
782 ServicePool<Endpoint, Producer> getProducerServicePool();
783
784 /**
785 * Uses a custom node id factory when generating auto assigned ids to the nodes in the route definitions
786 *
787 * @param factory custom factory to use
788 */
789 void setNodeIdFactory(NodeIdFactory factory);
790
791 /**
792 * Gets the node id factory
793 *
794 * @return the node id factory
795 */
796 NodeIdFactory getNodeIdFactory();
797
798 /**
799 * Gets the management strategy
800 *
801 * @return the management strategy
802 */
803 ManagementStrategy getManagementStrategy();
804
805 /**
806 * Sets the management strategy to use
807 *
808 * @param strategy the management strategy
809 */
810 void setManagementStrategy(ManagementStrategy strategy);
811
812 /**
813 * Gets the default tracer
814 *
815 * @return the default tracer
816 */
817 InterceptStrategy getDefaultTracer();
818
819 /**
820 * Sets a custom tracer to be used as the default tracer.
821 * <p/>
822 * <b>Note:</b> This must be set before any routes are created,
823 * changing the defaultTracer for existing routes is not supported.
824 *
825 * @param tracer the custom tracer to use as default tracer
826 */
827 void setDefaultTracer(InterceptStrategy tracer);
828
829 /**
830 * Disables using JMX as {@link org.apache.camel.spi.ManagementStrategy}.
831 */
832 void disableJMX();
833
834 /**
835 * Gets the inflight repository
836 *
837 * @return the repository
838 */
839 InflightRepository getInflightRepository();
840
841 /**
842 * Sets a custom inflight repository to use
843 *
844 * @param repository the repository
845 */
846 void setInflightRepository(InflightRepository repository);
847
848 /**
849 * Gets the the application context class loader which may be helpful for running camel in other containers
850 *
851 * @return the application context class loader
852 */
853 ClassLoader getApplicationContextClassLoader();
854
855 /**
856 * Sets the application context class loader
857 *
858 * @param classLoader the class loader
859 */
860 void setApplicationContextClassLoader(ClassLoader classLoader);
861
862 /**
863 * Gets the current shutdown strategy
864 *
865 * @return the strategy
866 */
867 ShutdownStrategy getShutdownStrategy();
868
869 /**
870 * Sets a custom shutdown strategy
871 *
872 * @param shutdownStrategy the custom strategy
873 */
874 void setShutdownStrategy(ShutdownStrategy shutdownStrategy);
875
876 /**
877 * Gets the current {@link org.apache.camel.spi.ExecutorServiceStrategy}
878 *
879 * @return the strategy
880 */
881 ExecutorServiceStrategy getExecutorServiceStrategy();
882
883 /**
884 * Sets a custom {@link org.apache.camel.spi.ExecutorServiceStrategy}
885 *
886 * @param executorServiceStrategy the custom strategy
887 */
888 void setExecutorServiceStrategy(ExecutorServiceStrategy executorServiceStrategy);
889
890 /**
891 * Gets the current {@link org.apache.camel.spi.ProcessorFactory}
892 *
893 * @return the factory, can be <tt>null</tt> if no custom factory has been set
894 */
895 ProcessorFactory getProcessorFactory();
896
897 /**
898 * Sets a custom {@link org.apache.camel.spi.ProcessorFactory}
899 *
900 * @param processorFactory the custom factory
901 */
902 void setProcessorFactory(ProcessorFactory processorFactory);
903
904 /**
905 * Gets the current {@link Debugger}
906 *
907 * @return the debugger
908 */
909 Debugger getDebugger();
910
911 /**
912 * Sets a custom {@link Debugger}
913 *
914 * @param debugger the debugger
915 */
916 void setDebugger(Debugger debugger);
917
918 /**
919 * Gets the current {@link UuidGenerator}
920 *
921 * @return the uuidGenerator
922 */
923 UuidGenerator getUuidGenerator();
924
925 /**
926 * Sets a custom {@link UuidGenerator} (should only be set once)
927 *
928 * @param uuidGenerator the UUID Generator
929 */
930 void setUuidGenerator(UuidGenerator uuidGenerator);
931
932 /**
933 * Whether or not type converters should be loaded lazy
934 *
935 * @return <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
936 */
937 Boolean isLazyLoadTypeConverters();
938
939 /**
940 * Sets whether type converters should be loaded lazy
941 *
942 * @param lazyLoadTypeConverters <tt>true</tt> to load lazy, <tt>false</tt> to load on startup
943 */
944 void setLazyLoadTypeConverters(Boolean lazyLoadTypeConverters);
945
946 }