@NoInstantiate public class FilteringArtifactClassLoader extends ClassLoader implements ArtifactClassLoader
ClassLoader
that filter which classes and resources can be resolved based on a ClassLoaderFilter
Resources used to provide SPI are not managed as standard resources, ie, not filtered through the ClassLoaderFilter
,
but filtered using ExportedService
definitions. Only the service providers defined as exported in the modules will be
available from this class loader.Constructor and Description |
---|
FilteringArtifactClassLoader(ArtifactClassLoader artifactClassLoader,
ClassLoaderFilter filter,
List<ExportedService> exportedServices)
Creates a new filtering classLoader
|
Modifier and Type | Method and Description |
---|---|
void |
addShutdownListener(ShutdownListener listener)
Adds a shutdown listener to the class loader.
|
void |
dispose()
Gets rid of the class loader resources.
|
Class<?> |
findLocalClass(String name)
Loads the class with the specified binary name if defined on this class loader.
|
URL |
findLocalResource(String resourceName)
This method finds a resource in the local environment for this artifact, if the resource is not found and the artifact has a
parent artifact then the operation is resolved by that parent, if there is no parent, the resources is searched in the global
environment.
|
URL |
findResource(String name) |
Enumeration<URL> |
findResources(String name)
Returns an enumeration of
URL objects representing all the resources with the given name which
are local to the classloader |
<T extends ArtifactDescriptor> |
getArtifactDescriptor() |
String |
getArtifactId() |
ClassLoader |
getClassLoader()
ClassLoader is an abstract class.
|
ClassLoaderLookupPolicy |
getClassLoaderLookupPolicy() |
URL |
getResource(String name) |
protected URL |
getResourceFromDelegate(ArtifactClassLoader artifactClassLoader,
String name) |
Enumeration<URL> |
getResources(String name) |
protected Enumeration<URL> |
getResourcesFromDelegate(ArtifactClassLoader artifactClassLoader,
String name) |
Class<?> |
loadClass(String name) |
String |
toString() |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public FilteringArtifactClassLoader(ArtifactClassLoader artifactClassLoader, ClassLoaderFilter filter, List<ExportedService> exportedServices)
artifactClassLoader
- artifact classLoader to filter. Non nullfilter
- filters access to classes and resources from the artifact classLoader. Non nullexportedServices
- service providers that will be available from the filtered class loader. Non null.public Class<?> loadClass(String name) throws ClassNotFoundException
loadClass
in class ClassLoader
ClassNotFoundException
public URL getResource(String name)
getResource
in class ClassLoader
protected URL getResourceFromDelegate(ArtifactClassLoader artifactClassLoader, String name)
public Enumeration<URL> getResources(String name) throws IOException
getResources
in class ClassLoader
IOException
protected Enumeration<URL> getResourcesFromDelegate(ArtifactClassLoader artifactClassLoader, String name) throws IOException
IOException
public URL findResource(String name)
findResource
in interface ArtifactClassLoader
findResource
in class ClassLoader
name
- name of the resource to find.public Enumeration<URL> findResources(String name) throws IOException
ArtifactClassLoader
URL
objects representing all the resources with the given name which
are local to the classloaderfindResources
in interface ArtifactClassLoader
findResources
in class ClassLoader
name
- The resource nameURL
objects for the resourcesIOException
- If I/O errors occurpublic Class<?> findLocalClass(String name) throws ClassNotFoundException
ArtifactClassLoader
findLocalClass
in interface ArtifactClassLoader
name
- The binary name of the classClassNotFoundException
- If the class was not foundpublic String getArtifactId()
getArtifactId
in interface ArtifactClassLoader
public <T extends ArtifactDescriptor> T getArtifactDescriptor()
getArtifactDescriptor
in interface ArtifactClassLoader
T
- the generic type of the artifact descriptor.public ClassLoader getClassLoader()
ArtifactClassLoader
getClassLoader
in interface ArtifactClassLoader
public void addShutdownListener(ShutdownListener listener)
ArtifactClassLoader
addShutdownListener
in interface ArtifactClassLoader
public ClassLoaderLookupPolicy getClassLoaderLookupPolicy()
getClassLoaderLookupPolicy
in interface ClassLoaderLookupPolicyProvider
public void dispose()
DisposableClassLoader
dispose
in interface DisposableClassLoader
public URL findLocalResource(String resourceName)
LocalResourceLocator
findLocalResource
in interface LocalResourceLocator
resourceName
- name of the resource to find.Copyright © 2018. All rights reserved.