Package org.apache.camel.spi
Interface PackageScanResourceResolver
- All Superinterfaces:
AutoCloseable
,Service
,StaticService
A resolver that can find resources based on package scanning.
OSGi is not supported as this is intended for standalone Camel runtimes such as Camel Main, or Camel Quarkus.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassLoader
(ClassLoader classLoader) Adds the class loader to the existing loadersfindResources
(String location) Finds the resources from the given location.Gets the ClassLoader instances that should be used when scanning for resources.void
setAcceptableSchemes
(String schemes) To specify a set of accepted schemas to use for loading resources as URL connections (besides http and https schemas)
-
Method Details
-
getClassLoaders
Set<ClassLoader> getClassLoaders()Gets the ClassLoader instances that should be used when scanning for resources. This implementation will return a new unmodifiable set containing the classloaders. Use theaddClassLoader(ClassLoader)
method if you want to add new classloaders to the class loaders list.- Returns:
- the class loaders to use
-
addClassLoader
Adds the class loader to the existing loaders- Parameters:
classLoader
- the loader to add
-
setAcceptableSchemes
To specify a set of accepted schemas to use for loading resources as URL connections (besides http and https schemas) -
findResources
Finds the resources from the given location. The location can be prefixed with either file: or classpath: to look in either file system or classpath. By default classpath is assumed if no prefix is specified. Wildcards is supported using an ANT pattern style paths, such as classpath:**/*camel*.xml Notice when using wildcards, then there is additional overhead as the classpath is scanned, where as if you specific the exact name for each XML file is faster as no classpath scanning is needed.- Parameters:
location
- the location (support ANT style patterns, eg routes/camel-*.xml)- Returns:
- the found resources, or an empty collection if no resources found
- Throws:
Exception
- can be thrown during scanning for resources.
-