Class EquinoxBundleClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.apache.xbean.osgi.bundle.util.equinox.EquinoxBundleClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,DelegatingBundleReference
,org.osgi.framework.BundleReference
ClassLoader for a
This ClassLoader implementation extends the
Bundle
.
This ClassLoader implementation extends the
URLClassLoader
and converts resource "bundle"
URLs (found in directories or embedded jar files) into regular jar URLs.
This ClassLoader implementation will only work on Equinox framework.- Version:
- $Rev: 1163514 $ $Date: 2011-08-31 09:37:38 +0200 (Wed, 31 Aug 2011) $
-
Constructor Summary
ConstructorsConstructorDescriptionEquinoxBundleClassLoader
(org.osgi.framework.Bundle bundle) EquinoxBundleClassLoader
(org.osgi.framework.Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls) -
Method Summary
Modifier and TypeMethodDescriptionboolean
findResources
(String name) org.osgi.framework.Bundle
Return the bundle associated with this classloader.org.osgi.framework.Bundle
getBundle
(boolean unwrap) Return the bundle associated with this classloader.boolean
getResource
(String name) boolean
int
hashCode()
protected Class
<?> void
setConvertResourceUrls
(boolean convert) void
setSearchWiredBundles
(boolean search) toString()
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
EquinoxBundleClassLoader
public EquinoxBundleClassLoader(org.osgi.framework.Bundle bundle) -
EquinoxBundleClassLoader
public EquinoxBundleClassLoader(org.osgi.framework.Bundle bundle, boolean searchWiredBundles, boolean convertResourceUrls)
-
-
Method Details
-
toString
-
loadClass
- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
getResource
- Overrides:
getResource
in classClassLoader
-
findResources
- Overrides:
findResources
in classURLClassLoader
- Throws:
IOException
-
setSearchWiredBundles
public void setSearchWiredBundles(boolean search) -
getSearchWiredBundles
public boolean getSearchWiredBundles() -
setConvertResourceUrls
public void setConvertResourceUrls(boolean convert) -
getConvertResourceUrls
public boolean getConvertResourceUrls() -
getBundle
public org.osgi.framework.Bundle getBundle(boolean unwrap) Return the bundle associated with this classloader. In most cases the bundle associated with the classloader is a regular framework bundle. However, in some cases the bundle associated with the classloader is aDelegatingBundle
. In such cases, the unwrap parameter controls whether this function returns theDelegatingBundle
instance or the main application bundle backing with theDelegatingBundle
.- Specified by:
getBundle
in interfaceDelegatingBundleReference
- Parameters:
unwrap
- If true and if the bundle associated with this classloader is aDelegatingBundle
, this function will return the main application bundle backing with theDelegatingBundle
. Otherwise, the bundle associated with this classloader is returned as is.- Returns:
- The bundle associated with this classloader.
-
getBundle
public org.osgi.framework.Bundle getBundle()Return the bundle associated with this classloader. This method callsgetBundle(true)
and therefore always returns a regular framework bundle.
Note: Some libraries useBundleReference.getBundle()
to obtain a bundle for the given classloader and expect the returned bundle instance to be work with any OSGi API. Some of these API might not work ifDelegatingBundle
is returned. That is why this function will always return a regular framework bundle. SeegetBundle(boolean)
for more information.- Specified by:
getBundle
in interfaceorg.osgi.framework.BundleReference
- Returns:
- The bundle associated with this classloader.
-
hashCode
public int hashCode() -
equals
-