Package org.apache.camel.spi
Interface RoutesLoader
-
- All Superinterfaces:
CamelContextAware
public interface RoutesLoader extends CamelContextAware
SPI for loadingRoutesBuilderfrom a list ofResource.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Collection<RoutesBuilder>findRoutesBuilders(Collection<Resource> resources)FindRoutesBuilderfrom the give list ofResource.Collection<RoutesBuilder>findRoutesBuilders(Collection<Resource> resources, boolean optional)FindRoutesBuilderfrom the give list ofResource.default Collection<RoutesBuilder>findRoutesBuilders(Resource... resources)FindRoutesBuilderfrom the give list ofResource.RoutesBuilderLoadergetRoutesLoader(String extension)Looks up aRoutesBuilderLoaderin the registry or fallback to a factory finder mechanism if none found.default voidinitRoutesBuilderLoader(RoutesBuilderLoader loader)Initializes the discoveredRoutesBuilderLoaderbefore its started and used for the first time.default voidloadRoutes(Collection<Resource> resources)default voidloadRoutes(Resource... resources)default voidpreParseRoute(Resource resource, boolean optional)Pre-parses theRoutesBuilderfromResource.Set<String>updateRoutes(Collection<Resource> resources)Loads or updates existingRoutesBuilderfrom the give list ofResourceinto the currentCamelContext.default Set<String>updateRoutes(Resource... resources)Loads or updates existingRoutesBuilderfrom the give list ofResourceinto the currentCamelContext.-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
-
-
-
Field Detail
-
FACTORY
static final String FACTORY
Service factory key.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRoutesLoader
RoutesBuilderLoader getRoutesLoader(String extension) throws Exception
Looks up aRoutesBuilderLoaderin the registry or fallback to a factory finder mechanism if none found.- Parameters:
extension- the file extension for which a loader should be found.- Returns:
- a
RoutesBuilderLoader - Throws:
IllegalArgumentException- if noRoutesBuilderLoadercan be found for the given file extensionException
-
loadRoutes
default void loadRoutes(Collection<Resource> resources) throws Exception
- Parameters:
resources- the resources to be loaded.- Throws:
Exception
-
loadRoutes
default void loadRoutes(Resource... resources) throws Exception
- Parameters:
resources- the resources to be loaded.- Throws:
Exception
-
updateRoutes
default Set<String> updateRoutes(Resource... resources) throws Exception
Loads or updates existingRoutesBuilderfrom the give list ofResourceinto the currentCamelContext. If a route is loaded with a route id for an existing route, then the existing route is stopped and remove, so it can be updated.- Parameters:
resources- the resources to be loaded or updated.- Returns:
- route ids for the routes that was loaded or updated.
- Throws:
Exception
-
updateRoutes
Set<String> updateRoutes(Collection<Resource> resources) throws Exception
Loads or updates existingRoutesBuilderfrom the give list ofResourceinto the currentCamelContext. If a route is loaded with a route id for an existing route, then the existing route is stopped and remove, so it can be updated.- Parameters:
resources- the resources to be loaded or updated.- Returns:
- route ids for the routes that was loaded or updated.
- Throws:
Exception
-
findRoutesBuilders
default Collection<RoutesBuilder> findRoutesBuilders(Resource... resources) throws Exception
FindRoutesBuilderfrom the give list ofResource.- Parameters:
resources- the resource to be loaded.- Returns:
- a collection of
RoutesBuilder - Throws:
Exception
-
findRoutesBuilders
Collection<RoutesBuilder> findRoutesBuilders(Collection<Resource> resources) throws Exception
FindRoutesBuilderfrom the give list ofResource.- Parameters:
resources- the resource to be loaded.- Returns:
- a collection
RoutesBuilder - Throws:
Exception
-
findRoutesBuilders
Collection<RoutesBuilder> findRoutesBuilders(Collection<Resource> resources, boolean optional) throws Exception
FindRoutesBuilderfrom the give list ofResource.- Parameters:
resources- the resource to be loaded.optional- whether parsing the resource is optional, such as there is no supported parser for the given resource extension- Returns:
- a collection
RoutesBuilder - Throws:
Exception
-
preParseRoute
default void preParseRoute(Resource resource, boolean optional) throws Exception
Pre-parses theRoutesBuilderfromResource. This is used during bootstrap, to eager detect configurations from route DSL resources which makes it possible to specify configurations that affect the bootstrap, such as by camel-jbang and camel-yaml-dsl.- Parameters:
resource- the resource to be pre parsed.optional- whether parsing the resource is optional, such as there is no supported parser for the given resource extension- Throws:
Exception
-
initRoutesBuilderLoader
default void initRoutesBuilderLoader(RoutesBuilderLoader loader)
Initializes the discoveredRoutesBuilderLoaderbefore its started and used for the first time.
-
-