Package org.apache.camel.spi
Interface PackageScanResourceResolver
-
- All Superinterfaces:
AutoCloseable
,Service
,StaticService
public interface PackageScanResourceResolver extends 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:
PackageScanClassResolver
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addClassLoader(ClassLoader classLoader)
Adds the class loader to the existing loadersdefault Collection<String>
findResourceNames(String location)
Deprecated.Collection<Resource>
findResources(String location)
Finds the resources from the given location.default Collection<InputStream>
findResourceStreams(String location)
Deprecated.Set<ClassLoader>
getClassLoaders()
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 Detail
-
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
void addClassLoader(ClassLoader classLoader)
Adds the class loader to the existing loaders- Parameters:
classLoader
- the loader to add
-
setAcceptableSchemes
void setAcceptableSchemes(String schemes)
To specify a set of accepted schemas to use for loading resources as URL connections (besides http and https schemas)
-
findResources
Collection<Resource> findResources(String location) throws Exception
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 a 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.
-
findResourceNames
@Deprecated default Collection<String> findResourceNames(String location) throws Exception
Deprecated.Finds the resource names 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 a 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 resource names, or an empty collection if no resources found
- Throws:
Exception
- can be thrown during scanning for resources.
-
findResourceStreams
@Deprecated default Collection<InputStream> findResourceStreams(String location) throws Exception
Deprecated.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 a 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. Important: Make sure to close the returned input streams after use.- 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.
-
-