public class DefaultPackageScanClassResolver extends ServiceSupport implements PackageScanClassResolver, StaticService
PackageScanClassResolver| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
DefaultPackageScanClassResolver() |
| Modifier and Type | Method and Description |
|---|---|
void |
addClassLoader(ClassLoader classLoader)
Adds the class loader to the existing loaders
|
void |
addFilter(PackageScanFilter filter)
Add a filter that will be applied to all scan operations
|
protected void |
addIfMatching(PackageScanFilter test,
String fqn,
Set<Class<?>> classes)
Add the class designated by the fully qualified class name provided to
the set of resolved classes if and only if it is approved by the Test
supplied.
|
protected URL |
customResourceLocator(URL url) |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
protected void |
find(PackageScanFilter test,
String packageName,
ClassLoader loader,
Set<Class<?>> classes) |
protected void |
find(PackageScanFilter test,
String packageName,
Set<Class<?>> classes) |
Set<Class<?>> |
findAnnotated(Class<? extends Annotation> annotation,
String... packageNames)
Attempts to discover classes that are annotated with to the annotation.
|
Set<Class<?>> |
findAnnotated(Set<Class<? extends Annotation>> annotations,
String... packageNames)
Attempts to discover classes that are annotated with to the annotation.
|
Set<Class<?>> |
findByFilter(PackageScanFilter filter,
String... packageNames)
Attempts to discover classes filter by the provided filter
|
Set<Class<?>> |
findImplementations(Class<?> parent,
String... packageNames)
Attempts to discover classes that are assignable to the type provided.
|
Set<ClassLoader> |
getClassLoaders()
Gets the ClassLoader instances that should be used when scanning for classes.
|
protected Enumeration<URL> |
getResources(ClassLoader loader,
String packageName)
Strategy to get the resources by the given classloader.
|
boolean |
isAcceptableScheme(String urlPath) |
void |
removeFilter(PackageScanFilter filter)
Removes the filter
|
void |
setAcceptableSchemes(String schemes) |
void |
setClassLoaders(Set<ClassLoader> classLoaders)
Sets the ClassLoader instances that should be used when scanning for
classes.
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, resume, shutdown, start, stop, suspendprotected final org.slf4j.Logger log
public DefaultPackageScanClassResolver()
public void addClassLoader(ClassLoader classLoader)
PackageScanClassResolveraddClassLoader in interface PackageScanClassResolverclassLoader - the loader to addpublic void addFilter(PackageScanFilter filter)
PackageScanClassResolveraddFilter in interface PackageScanClassResolverfilter - filter to filter desired classes in all scan operationspublic void removeFilter(PackageScanFilter filter)
PackageScanClassResolverremoveFilter in interface PackageScanClassResolverfilter - filter to filter desired classes in all scan operationspublic void setAcceptableSchemes(String schemes)
public boolean isAcceptableScheme(String urlPath)
public Set<ClassLoader> getClassLoaders()
PackageScanClassResolverPackageScanClassResolver.addClassLoader(ClassLoader) method if you want to add new classloaders
to the class loaders list.getClassLoaders in interface PackageScanClassResolverpublic void setClassLoaders(Set<ClassLoader> classLoaders)
PackageScanClassResolversetClassLoaders in interface PackageScanClassResolverclassLoaders - loaders to use when scanning for classespublic Set<Class<?>> findAnnotated(Class<? extends Annotation> annotation, String... packageNames)
PackageScanClassResolverfindAnnotated in interface PackageScanClassResolverannotation - the annotation that should be present on matching classespackageNames - one or more package names to scan (including subpackages) for classespublic Set<Class<?>> findAnnotated(Set<Class<? extends Annotation>> annotations, String... packageNames)
PackageScanClassResolverfindAnnotated in interface PackageScanClassResolverannotations - the annotations that should be present (any of them) on matching classespackageNames - one or more package names to scan (including subpackages) for classespublic Set<Class<?>> findImplementations(Class<?> parent, String... packageNames)
PackageScanClassResolverfindImplementations in interface PackageScanClassResolverparent - the class of interface to find subclasses or implementations ofpackageNames - one or more package names to scan (including subpackages) for classespublic Set<Class<?>> findByFilter(PackageScanFilter filter, String... packageNames)
PackageScanClassResolverfindByFilter in interface PackageScanClassResolverfilter - filter to filter desired classes.packageNames - one or more package names to scan (including subpackages) for classesprotected void find(PackageScanFilter test, String packageName, Set<Class<?>> classes)
protected void find(PackageScanFilter test, String packageName, ClassLoader loader, Set<Class<?>> classes)
protected URL customResourceLocator(URL url) throws IOException
IOExceptionprotected Enumeration<URL> getResources(ClassLoader loader, String packageName) throws IOException
WebSpherePackageScanClassResolver
to take care of WebSphere's oddity of resource loading.loader - the classloaderpackageName - the packagename for the package to loadIOException - is thrown by the classloaderprotected void addIfMatching(PackageScanFilter test, String fqn, Set<Class<?>> classes)
test - the test used to determine if the class matchesfqn - the fully qualified name of a classprotected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()Apache Camel