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

pack-priv Class WebsphereLibertyClassLoaderHandler

extends Object
implements ClassLoaderHandler
Class Inheritance
All Implemented Interfaces
nonapi.io.github.classgraph.classloaderhandler.ClassLoaderHandler
Imports
java.io.File, java.net.URL, java.util.Collection, .Collections, .HashSet, .List, nonapi.io.github.classgraph.classpath.ClassLoaderOrder, .ClasspathOrder, nonapi.io.github.classgraph.reflection.ReflectionUtils, nonapi.io.github.classgraph.scanspec.ScanSpec, nonapi.io.github.classgraph.utils.LogNode

WebsphereLibertyClassLoaderHandler.

Used to support WAS Liberty Profile classloading in io.github.classgraph

Author
R. Kempees

Field Summary

Modifier and TypeField and Description
private static final String
IBM_APP_CLASS_LOADER

"com.ibm.ws.classloading.internal.AppClassLoader"

private static final String
IBM_THREAD_CONTEXT_CLASS_LOADER

"com.ibm.ws.classloading.internal.ThreadContextClassLoader"

private static final String
PKG_PREFIX

"com.ibm.ws.classloading.internal."

Constructor Summary

AccessConstructor and Description
private
WebsphereLibertyClassLoaderHandler()

Class cannot be constructed.

Method Summary

Modifier and TypeMethod and Description
private static Collection<Object>
callGetUrls(final Object container, final String methodName, final ReflectionUtils reflectionUtils)

Utility to call a "getURLs" method, flattening "collections of collections" and ignoring "UnsupportedOperationException".

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 Collection<Object>

Returns:

Collection of path objects as a URL or String.
getPaths
(final Object
the containerClassLoader object
containerClassLoader
,
final ReflectionUtils reflectionUtils)

Get the paths from a containerClassLoader object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

IBM_APP_CLASS_LOADERback to summary
private static final String IBM_APP_CLASS_LOADER

"com.ibm.ws.classloading.internal.AppClassLoader"

IBM_THREAD_CONTEXT_CLASS_LOADERback to summary
private static final String IBM_THREAD_CONTEXT_CLASS_LOADER

"com.ibm.ws.classloading.internal.ThreadContextClassLoader"

PKG_PREFIXback to summary
private static final String PKG_PREFIX

"com.ibm.ws.classloading.internal."

Constructor Detail

WebsphereLibertyClassLoaderHandlerback to summary
private WebsphereLibertyClassLoaderHandler()

Class cannot be constructed.

Method Detail

callGetUrlsback to summary
private static Collection<Object> callGetUrls(final Object container, final String methodName, final ReflectionUtils reflectionUtils)

Utility to call a "getURLs" method, flattening "collections of collections" and ignoring "UnsupportedOperationException". All of the "getURLs" methods eventually call "com.ibm.wsspi.adaptable.module.Container#getURLs()". https://www.ibm.com/support/knowledgecenter/SSEQTP_liberty/com.ibm.websphere.javadoc.liberty.doc /com.ibm.websphere.appserver.spi.artifact_1.2-javadoc /com/ibm/wsspi/adaptable/module/Container.html?view=embed#getURLs() "A collection of URLs that represent all of the locations on disk that contribute to this container"

Annotations
@SuppressWarnings:unchecked
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.

getPathsback to summary
private static Collection<Object> getPaths(final Object containerClassLoader, final ReflectionUtils reflectionUtils)

Get the paths from a containerClassLoader object.

The passed in object should be an instance of "com.ibm.ws.classloading.internal.ContainerClassLoader".

Will attempt to use "getContainerURLs" methods to recap the classpath.

Parameters
containerClassLoader:Object

the containerClassLoader object

Returns:Collection<Object>

Collection of path objects as a URL or String.