Top Description Constructors Methods
nonapi.io.github.classgraph.classloaderhandler

pack-priv Class JBossClassLoaderHandler

extends Object
implements ClassLoaderHandler
Class Inheritance
All Implemented Interfaces
nonapi.io.github.classgraph.classloaderhandler.ClassLoaderHandler
Imports
java.io.File, java.lang.reflect.Array, java.nio.file.Files, .Path, .Paths, java.util.Collections, .HashSet, .List, .Map, .Map.Entry, .Set, nonapi.io.github.classgraph.classpath.ClassLoaderOrder, .ClasspathOrder, nonapi.io.github.classgraph.scanspec.ScanSpec, nonapi.io.github.classgraph.utils.FileUtils, .LogNode

Extract classpath entries from the JBoss ClassLoader. See:

https://github.com/jboss-modules/jboss-modules/blob/master/src/main/java/org/jboss/modules/ModuleClassLoader.java

Constructor Summary

AccessConstructor and Description
private
JBossClassLoaderHandler()

Class cannot be constructed.

Method Summary

Modifier and TypeMethod and Description
public static boolean

Returns:

true if this ClassLoaderHandler can handle the ClassLoader.
canHandle
(final Class<?>
the ClassLoader class or one of its superclasses.
classLoaderClass
,
final LogNode
the log
log
)

Check whether this ClassLoaderHandler can handle a given ClassLoader.

public static void
findClassLoaderOrder(final ClassLoader
the ClassLoader to find the order for.
classLoader
,
final ClassLoaderOrder
a ClassLoaderOrder object to update.
classLoaderOrder
,
final LogNode
the log
log
)

Find the ClassLoader delegation order for a ClassLoader.

public static void
findClasspathOrder(final ClassLoader
the ClassLoader to find the classpath entries order for.
classLoader
,
final ClasspathOrder
a ClasspathOrder object to update.
classpathOrder
,
final ScanSpec scanSpec, final LogNode
the log.
log
)

Find the classpath entries for the associated ClassLoader.

private static Class<?>

Returns:

The Class object representing the JBoss VFS class, or null if it couldn't be found.
getJBossVFSAccess
(final Object
The root VirtualFile of JBoss VFS. Used to load the VFS via the classloader of the root. Can not be null.
root
)

Get the access to the JBoss VFS class.

private static void
handleRealModule(final Object
the module
module
,
final Set<Object>
visited modules
visitedModules
,
final ClassLoader
the classloader
classLoader
,
final ClasspathOrder
the classpath order
classpathOrderOut
,
final ScanSpec
the scan spec
scanSpec
,
final LogNode
the log
log
)

Handle a module.

private static void
handleResourceLoader(final Object
the resource loader
resourceLoader
,
final ClassLoader
the classloader
classLoader
,
final ClasspathOrder
the classpath order
classpathOrderOut
,
final ScanSpec
the scan spec
scanSpec
,
final LogNode
the log
log
)

Handle a resource loader.

private static boolean

Returns:

true if the path exists and is a regular file, false otherwise
isPathExisting
(final String
the path to check
path
)

Checks if the given path exists and is a regular file.

private static String

Returns:

The absolute path of the JAR file, or null if the path couldn't be found.
loadJarPathFromClassicVFS
(final Object
The root object to get the JAR path from.
root
,
final ClasspathOrder
The ClasspathOrder object for updating the classpath order.
classpathOrderOut
)

Returns the absolute path of a JAR file from a given root object using the 'classic' VFS read mechanism.

private static String

Returns:

The absolute path of the JAR file, or null if the path couldn't be found.
loadJarPathFromNewVFS
(final Object
The root object to get the JAR path from.
root
,
final ClasspathOrder
The ClasspathOrder object for updating the classpath order.
classpathOrderOut
)

Returns the absolute path of a JAR file from a given root object using the JBoss VFS mechanism.

private static Class<?>
loadJBossVFS(final ClassLoader classLoader)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JBossClassLoaderHandlerback to summary
private JBossClassLoaderHandler()

Class cannot be constructed.

Method Detail

canHandleback to summary
public static boolean canHandle(final Class<?> classLoaderClass, final LogNode log)

Check whether this ClassLoaderHandler can handle a given ClassLoader.

Parameters
classLoaderClass:Class<?>

the ClassLoader class or one of its superclasses.

log:LogNode

the log

Returns:boolean

true if this ClassLoaderHandler can handle the ClassLoader.

findClassLoaderOrderback to summary
public static void findClassLoaderOrder(final ClassLoader classLoader, final ClassLoaderOrder classLoaderOrder, final LogNode log)

Find the ClassLoader delegation order for a ClassLoader.

Parameters
classLoader:ClassLoader

the ClassLoader to find the order for.

classLoaderOrder:ClassLoaderOrder

a ClassLoaderOrder object to update.

log:LogNode

the log

findClasspathOrderback to summary
public static void findClasspathOrder(final ClassLoader classLoader, final ClasspathOrder classpathOrder, final ScanSpec scanSpec, final LogNode log)

Find the classpath entries for the associated ClassLoader.

Parameters
classLoader:ClassLoader

the ClassLoader to find the classpath entries order for.

classpathOrder:ClasspathOrder

a ClasspathOrder object to update.

scanSpec:ScanSpec

the ScanSpec.

log:LogNode

the log.

getJBossVFSAccessback to summary
private static Class<?> getJBossVFSAccess(final Object root)

Get the access to the JBoss VFS class. Tries to load VFS first from the classloader of the provided root object if it's an object from org.jboss.vfs. If the root object is not from org.jboss.vfs, VFS will be tried to be loaded from the current thread class loader. It might be unnecessary to load VFS from the current thread context, because this means that the root object is not from org.jboss.vfs and VFS will not help here... but as a defensive approach we really try to get VFS access here.

Parameters
root:Object

The root VirtualFile of JBoss VFS. Used to load the VFS via the classloader of the root. Can not be null.

Returns:Class<?>

The Class object representing the JBoss VFS class, or null if it couldn't be found.

handleRealModuleback to summary
private static void handleRealModule(final Object module, final Set<Object> visitedModules, final ClassLoader classLoader, final ClasspathOrder classpathOrderOut, final ScanSpec scanSpec, final LogNode log)

Handle a module.

Parameters
module:Object

the module

visitedModules:Set<Object>

visited modules

classLoader:ClassLoader

the classloader

classpathOrderOut:ClasspathOrder

the classpath order

scanSpec:ScanSpec

the scan spec

log:LogNode

the log

handleResourceLoaderback to summary
private static void handleResourceLoader(final Object resourceLoader, final ClassLoader classLoader, final ClasspathOrder classpathOrderOut, final ScanSpec scanSpec, final LogNode log)

Handle a resource loader.

Parameters
resourceLoader:Object

the resource loader

classLoader:ClassLoader

the classloader

classpathOrderOut:ClasspathOrder

the classpath order

scanSpec:ScanSpec

the scan spec

log:LogNode

the log

isPathExistingback to summary
private static boolean isPathExisting(final String path)

Checks if the given path exists and is a regular file.

Parameters
path:String

the path to check

Returns:boolean

true if the path exists and is a regular file, false otherwise

loadJarPathFromClassicVFSback to summary
private static String loadJarPathFromClassicVFS(final Object root, final ClasspathOrder classpathOrderOut)

Returns the absolute path of a JAR file from a given root object using the 'classic' VFS read mechanism. This works for Versions of JBoss/Wildfly prior to this change: WFLY-18544 JBEAP-25879 JBEAP-25677

Parameters
root:Object

The root object to get the JAR path from.

classpathOrderOut:ClasspathOrder

The ClasspathOrder object for updating the classpath order.

Returns:String

The absolute path of the JAR file, or null if the path couldn't be found.

loadJarPathFromNewVFSback to summary
private static String loadJarPathFromNewVFS(final Object root, final ClasspathOrder classpathOrderOut)

Returns the absolute path of a JAR file from a given root object using the JBoss VFS mechanism. This works for Versions of JBoss/Wildfly that contain the following change: WFLY-18544 JBEAP-25879 JBEAP-25677

Parameters
root:Object

The root object to get the JAR path from.

classpathOrderOut:ClasspathOrder

The ClasspathOrder object for updating the classpath order.

Returns:String

The absolute path of the JAR file, or null if the path couldn't be found.

loadJBossVFSback to summary
private static Class<?> loadJBossVFS(final ClassLoader classLoader) throws ClassNotFoundException