public class ClassLoaderUtils
extends java.lang.Object
Constructor and Description |
---|
ClassLoaderUtils(java.lang.Class<?> callingClass) |
ClassLoaderUtils(java.lang.Class<?> callingClass,
Entity entity) |
ClassLoaderUtils(java.lang.Class<?> callingClass,
ManagementContext mgmt) |
ClassLoaderUtils(java.lang.ClassLoader cl) |
ClassLoaderUtils(java.lang.ClassLoader cl,
ManagementContext mgmt) |
ClassLoaderUtils(java.lang.Object callingObj,
Entity entity) |
ClassLoaderUtils(java.lang.Object callingObj,
ManagementContext mgmt) |
Modifier and Type | Method and Description |
---|---|
java.net.URL |
getResource(java.lang.String name)
Finds the resource with the given name.
|
java.lang.Iterable<java.net.URL> |
getResources(java.lang.String name)
Finds all the resources with the given name.
|
boolean |
isBundleWhiteListed(org.osgi.framework.Bundle bundle) |
java.lang.Class<?> |
loadClass(java.lang.String name)
Loads the given class, handle OSGi bundles.
|
java.lang.Class<?> |
loadClass(java.lang.String symbolicName,
java.lang.String version,
java.lang.String className) |
java.lang.String |
toString() |
public ClassLoaderUtils(java.lang.Object callingObj, Entity entity)
public ClassLoaderUtils(java.lang.Object callingObj, @Nullable ManagementContext mgmt)
public ClassLoaderUtils(java.lang.Class<?> callingClass)
public ClassLoaderUtils(@Nullable java.lang.ClassLoader cl)
public ClassLoaderUtils(@Nullable java.lang.ClassLoader cl, @Nullable ManagementContext mgmt)
public ClassLoaderUtils(java.lang.Class<?> callingClass, Entity entity)
public ClassLoaderUtils(java.lang.Class<?> callingClass, @Nullable ManagementContext mgmt)
public java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
<classname>
, such as com.google.common.net.HostAndPort
<bunde-symbolicName>:<classname>
, such as com.google.guava:com.google.common.net.HostAndPort
<bunde-symbolicName>:<bundle-version>:<classname>
, such as
com.google.guava:16.0.1:com.google.common.net.HostAndPort
libraries
supplied in the catalog metadata, and can thus handle updating
catalog versions. It also means we can try our best to handle a catalog that
uses a different bundle version from something that ships with Brooklyn.
callingClass.getClassLoader()
), so won't work. But it's up
to the caller if they pass in something more useful.
ManagementContext.getCatalogClassLoader()
. Again, this is normally not helpful.
We instead would prefer the specific catalog item's classloader (which we tried earlier).
WHITE_LIST_KEY
, defaulting to all org.apache.brooklyn.*
bundles.java.lang.ClassNotFoundException
public java.lang.Class<?> loadClass(java.lang.String symbolicName, @Nullable java.lang.String version, java.lang.String className) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public java.net.URL getResource(java.lang.String name)
#loadClass(String)} for loading order
public java.lang.Iterable<java.net.URL> getResources(java.lang.String name)
Iterable
when no resources find#loadClass(String)} for loading order
public boolean isBundleWhiteListed(org.osgi.framework.Bundle bundle)
public java.lang.String toString()
toString
in class java.lang.Object