public class WeavingHookConfigurator extends Object implements HookConfigurator, ClassLoadingHook, ClassLoadingStatsHook
Constructor and Description |
---|
WeavingHookConfigurator() |
Modifier and Type | Method and Description |
---|---|
boolean |
addClassPathEntry(ArrayList<ClasspathEntry> cpEntries,
String cp,
ClasspathManager hostmanager,
BaseData sourcedata,
ProtectionDomain sourcedomain)
Gets called by a classpath manager when looking for ClasspathEntry objects.
|
void |
addHooks(HookRegistry hookRegistry)
Adds hooks to the specified hook registry.
|
BaseClassLoader |
createClassLoader(ClassLoader parent,
ClassLoaderDelegate delegate,
BundleProtectionDomain domain,
BaseData data,
String[] bundleclasspath)
Gets called by a base data during
BundleData.createClassLoader(ClassLoaderDelegate, BundleProtectionDomain, String[]) . |
String |
findLibrary(BaseData data,
String libName)
Gets called by a base data during
BundleData.findLibrary(String) . |
ClassLoader |
getBundleClassLoaderParent()
Gets called by the adaptor during
FrameworkAdaptor.getBundleClassLoaderParent() . |
void |
initializedClassLoader(BaseClassLoader baseClassLoader,
BaseData data)
Gets called by a classpath manager at the end of
ClasspathManager.initialize() . |
void |
postFindLocalClass(String name,
Class<?> clazz,
ClasspathManager manager)
Gets called by a classpath manager during
ClasspathManager.findLocalClass(String) after
searching the local classloader for a class. |
void |
postFindLocalResource(String name,
URL resource,
ClasspathManager manager)
Gets called by a classpath manager during
ClasspathManager.findLocalResource(String) after
searching the local classloader for a resource. |
void |
preFindLocalClass(String name,
ClasspathManager manager)
Gets called by a classpath manager during
ClasspathManager.findLocalClass(String) before
searching the local classloader for a class. |
void |
preFindLocalResource(String name,
ClasspathManager manager)
Gets called by a classpath manager during
ClasspathManager.findLocalResource(String) before
searching the local classloader for a resource. |
byte[] |
processClass(String name,
byte[] classbytes,
ClasspathEntry classpathEntry,
BundleEntry entry,
ClasspathManager manager)
Gets called by a classpath manager before defining a class.
|
void |
recordClassDefine(String name,
Class<?> clazz,
byte[] classbytes,
ClasspathEntry classpathEntry,
BundleEntry entry,
ClasspathManager manager)
Gets called by a classpath manager after an attempt is made to define a class.
|
public void addHooks(HookRegistry hookRegistry)
HookConfigurator
addHooks
in interface HookConfigurator
hookRegistry
- the hook registry used to add hookspublic byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager)
ClassLoadingHook
processClass
in interface ClassLoadingHook
name
- the name of the class being definedclassbytes
- the bytes of the class being definedclasspathEntry
- the ClasspathEntry where the class bytes have been read from.entry
- the BundleEntry source of the class bytesmanager
- the class path manager used to define the requested classpublic boolean addClassPathEntry(ArrayList<ClasspathEntry> cpEntries, String cp, ClasspathManager hostmanager, BaseData sourcedata, ProtectionDomain sourcedomain)
ClassLoadingHook
addClassPathEntry
in interface ClassLoadingHook
cpEntries
- the list of ClasspathEntry objects currently available for the requested classpathcp
- the name of the requested classpathhostmanager
- the classpath manager the requested ClasspathEntry is forsourcedata
- the source bundle data of the requested ClasspathEntrysourcedomain
- the source domain of the requested ClasspathEntrypublic String findLibrary(BaseData data, String libName)
ClassLoadingHook
BundleData.findLibrary(String)
.
A base data will call this method for each configured class loading hook until one
class loading hook returns a non-null value. If no class loading hook returns
a non-null value then the base data will return null.findLibrary
in interface ClassLoadingHook
data
- the base data to find a native library for.libName
- the name of the native library.public ClassLoader getBundleClassLoaderParent()
ClassLoadingHook
FrameworkAdaptor.getBundleClassLoaderParent()
.
The adaptor will call this method for each configured class loading hook until one
class loading hook returns a non-null value. If no class loading hook returns
a non-null value then the adaptor will perform the default behavior.getBundleClassLoaderParent
in interface ClassLoadingHook
public BaseClassLoader createClassLoader(ClassLoader parent, ClassLoaderDelegate delegate, BundleProtectionDomain domain, BaseData data, String[] bundleclasspath)
ClassLoadingHook
BundleData.createClassLoader(ClassLoaderDelegate, BundleProtectionDomain, String[])
.
The BaseData will call this method for each configured class loading hook until one data
hook returns a non-null value. If no class loading hook returns a non-null value then a
default implemenation of BundleClassLoader will be created.createClassLoader
in interface ClassLoadingHook
parent
- the parent classloader for the BundleClassLoaderdelegate
- the delegate for the bundle classloaderdomain
- the domian for the bundle classloaderdata
- the BundleData for the BundleClassLoaderbundleclasspath
- the classpath for the bundle classloaderpublic void initializedClassLoader(BaseClassLoader baseClassLoader, BaseData data)
ClassLoadingHook
ClasspathManager.initialize()
.
The classpath manager will call this method for each configured class loading hook after it
has been initialized.initializedClassLoader
in interface ClassLoadingHook
baseClassLoader
- the newly created bundle classloaderdata
- the BundleData associated with the bundle classloaderpublic void preFindLocalClass(String name, ClasspathManager manager)
ClassLoadingStatsHook
ClasspathManager.findLocalClass(String)
before
searching the local classloader for a class. A classpath manager will call this method for
each configured class loading stat hook.preFindLocalClass
in interface ClassLoadingStatsHook
name
- the name of the requested classmanager
- the classpath manager used to find and load the requested classpublic void postFindLocalClass(String name, Class<?> clazz, ClasspathManager manager)
ClassLoadingStatsHook
ClasspathManager.findLocalClass(String)
after
searching the local classloader for a class. A classpath manager will call this method for
each configured class loading stat hook.postFindLocalClass
in interface ClassLoadingStatsHook
name
- the name of the requested classclazz
- the loaded class or null if not foundmanager
- the classpath manager used to find and load the requested classpublic void preFindLocalResource(String name, ClasspathManager manager)
ClassLoadingStatsHook
ClasspathManager.findLocalResource(String)
before
searching the local classloader for a resource. A classpath manager will call this method for
each configured class loading stat hook.preFindLocalResource
in interface ClassLoadingStatsHook
name
- the name of the requested resourcemanager
- the classpath manager used to find the requested resourcepublic void postFindLocalResource(String name, URL resource, ClasspathManager manager)
ClassLoadingStatsHook
ClasspathManager.findLocalResource(String)
after
searching the local classloader for a resource. A classpath manager will call this method for
each configured class loading stat hook.postFindLocalResource
in interface ClassLoadingStatsHook
name
- the name of the requested resourceresource
- the URL to the requested resource or null if not foundmanager
- the classpath manager used to find the requested resourcepublic void recordClassDefine(String name, Class<?> clazz, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager)
ClassLoadingStatsHook
recordClassDefine
in interface ClassLoadingStatsHook
name
- the name of the class that got definedclazz
- the class object that got defined or null if an error occurred while defining a classclassbytes
- the class bytes used to define the classclasspathEntry
- the ClasspathEntry where the class bytes got read fromentry
- the BundleEntyr source of the class bytesmanager
- the classpath manager used to define the classCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.