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