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