|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.osgi.baseadaptor.loader.ClasspathManager
public class ClasspathManager
A helper class for BaseClassLoader
implementations. This class will keep track of
ClasspathEntry
objects for the host bundle and any attached fragment bundles. This
class takes care of seaching the ClasspathEntry
objects for a base class loader
implementation. Additional behavior may be added to a classpath manager by configuring
ClassLoadingHook
and ClassLoadingStatsHook
.
BaseClassLoader
,
ClassLoadingHook
,
ClassLoadingStatsHook
Constructor Summary | |
---|---|
ClasspathManager(BaseData data,
java.lang.String[] classpath,
BaseClassLoader classloader)
Constructs a classpath manager for the given host base data, classpath and base class loader |
Method Summary | |
---|---|
static boolean |
addClassPathEntry(java.util.ArrayList result,
java.lang.String cp,
ClasspathManager hostloader,
BaseData sourcedata,
java.security.ProtectionDomain sourcedomain)
Adds a ClasspathEntry for the requested classpath to the result. |
void |
attachFragment(BundleData sourcedata,
java.security.ProtectionDomain sourcedomain,
java.lang.String[] sourceclasspath)
Attaches the specified sourcedata, sourcedomain and sourceclasspath to this classpath manager |
void |
close()
Closes all the classpath entry resources for this classpath manager. |
static void |
findClassPathEntry(java.util.ArrayList result,
java.lang.String cp,
ClasspathManager hostloader,
BaseData sourcedata,
java.security.ProtectionDomain sourcedomain)
Finds all the ClasspathEntry objects for the requested classpath. |
java.lang.String |
findLibrary(java.lang.String libname)
|
java.lang.Class |
findLocalClass(java.lang.String classname)
Finds a local class by searching the ClasspathEntry objects of the classpath manager. |
java.util.Enumeration |
findLocalEntries(java.lang.String path)
Finds the local entries by searching the ClasspathEntry objects of the classpath manager. |
BundleEntry |
findLocalEntry(java.lang.String path)
Finds a local entry by searching the ClasspathEntry objects of the classpath manager. |
java.net.URL |
findLocalResource(java.lang.String resource)
Finds a local resource by searching the ClasspathEntry objects of the classpath manager. |
java.util.Enumeration |
findLocalResources(java.lang.String resource)
Finds the local resources by searching the ClasspathEntry objects of the classpath manager. |
BaseClassLoader |
getBaseClassLoader()
Returns the base class loader used by this classpath manager |
BaseData |
getBaseData()
Returns the host base data for this classpath manager |
ClasspathEntry |
getClasspath(java.lang.String cp,
BaseData sourcedata,
java.security.ProtectionDomain sourcedomain)
Creates a new ClasspathEntry object for the requested classpath if the source exists. |
ClasspathEntry |
getExternalClassPath(java.lang.String cp,
BaseData sourcedata,
java.security.ProtectionDomain sourcedomain)
Uses the requested classpath as an absolute path to locate a source for a new ClasspathEntry. |
FragmentClasspath[] |
getFragmentClasspaths()
Returns the fragment classpaths of this classpath manager |
ClasspathEntry[] |
getHostClasspathEntries()
Returns the host classpath entries for this classpath manager |
void |
initialize()
initializes this classpath manager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClasspathManager(BaseData data, java.lang.String[] classpath, BaseClassLoader classloader)
data
- the host base data for this classpath managerclasspath
- the host classpath for this classpath managerclassloader
- the BaseClassLoader for this classpath managerMethod Detail |
---|
public void initialize()
After the classpath manager is initialized all configured class loading hooks
ClassLoadingHook.initializedClassLoader(BaseClassLoader, BaseData)
methods are called.
public void close()
public void attachFragment(BundleData sourcedata, java.security.ProtectionDomain sourcedomain, java.lang.String[] sourceclasspath)
sourcedata
- the source fragment BundleData that should be attached.sourcedomain
- the source fragment domain that should be attached.sourceclasspath
- the source fragment classpath that should be attached.public static void findClassPathEntry(java.util.ArrayList result, java.lang.String cp, ClasspathManager hostloader, BaseData sourcedata, java.security.ProtectionDomain sourcedomain)
ClassLoadingHook.addClassPathEntry(ArrayList, String, ClasspathManager, BaseData, ProtectionDomain)
methods. This allows class loading hooks to add additional ClasspathEntry objects to the result for the
requested classpath. Then the local host classpath entries and attached fragment classpath entries are
searched.
result
- a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to.cp
- the requested classpath.hostloader
- the host classpath manager for the classpathsourcedata
- the source EquionoxData to search for the classpathsourcedomain
- the source domain to used by the new ClasspathEntrypublic static boolean addClassPathEntry(java.util.ArrayList result, java.lang.String cp, ClasspathManager hostloader, BaseData sourcedata, java.security.ProtectionDomain sourcedomain)
result
- a list of ClasspathEntry objects. This list is used to add new ClasspathEntry objects to.cp
- the requested classpath.hostloader
- the host classpath manager for the classpathsourcedata
- the source EquionoxData to search for the classpathsourcedomain
- the source domain to used by the new ClasspathEntry
public ClasspathEntry getClasspath(java.lang.String cp, BaseData sourcedata, java.security.ProtectionDomain sourcedomain)
cp
- the requested classpath.sourcedata
- the source EquionoxData to search for the classpathsourcedomain
- the source domain to used by the new ClasspathEntry
public ClasspathEntry getExternalClassPath(java.lang.String cp, BaseData sourcedata, java.security.ProtectionDomain sourcedomain)
cp
- the requested classpathsourcedata
- the source EquionoxData to search for the classpathsourcedomain
- the source domain to used by the new ClasspathEntry
public java.net.URL findLocalResource(java.lang.String resource)
ClassLoadingStatsHook.preFindLocalResource(String, ClasspathManager)
methods. Then it
will search for the resource. Finally it will call all the configured class loading stats hooks
ClassLoadingStatsHook.postFindLocalResource(String, URL, ClasspathManager)
methods.
resource
- the requested resource name.
public java.util.Enumeration findLocalResources(java.lang.String resource)
resource
- the requested resource name.
public BundleEntry findLocalEntry(java.lang.String path)
path
- the requested entry path.
public java.util.Enumeration findLocalEntries(java.lang.String path)
path
- the requested entry path.
public java.lang.Class findLocalClass(java.lang.String classname) throws java.lang.ClassNotFoundException
ClassLoadingStatsHook.preFindLocalClass(String, ClasspathManager)
methods. Then it
will search for the class. If a class is found then all configured class loading hooks
ClassLoadingHook.processClass(String, byte[], ClasspathEntry, BundleEntry, ClasspathManager)
methods will be called. The class is then defined; if successfully then all configured class loading
stats hooks ClassLoadingStatsHook.recordClassDefine(String, Class, byte[], ClasspathEntry, BundleEntry, ClasspathManager)
methods are called. Finally all the configured class loading stats hooks
ClassLoadingStatsHook.postFindLocalClass(String, Class, ClasspathManager)
methods are called.
classname
- the requested class name.
java.lang.ClassNotFoundException
- if the class does not existpublic BaseData getBaseData()
public FragmentClasspath[] getFragmentClasspaths()
public ClasspathEntry[] getHostClasspathEntries()
public BaseClassLoader getBaseClassLoader()
public java.lang.String findLibrary(java.lang.String libname)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |