Package org.hibernate.osgi
Class OsgiClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- org.hibernate.osgi.OsgiClassLoader
-
- All Implemented Interfaces:
org.hibernate.service.spi.Stoppable
public class OsgiClassLoader extends ClassLoader implements org.hibernate.service.spi.Stoppable
Custom OSGI ClassLoader helper which knows all the "interesting" class loaders and bundles. Encapsulates the OSGi related CL capabilities.
-
-
Constructor Summary
Constructors Constructor Description OsgiClassLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBundle(org.osgi.framework.Bundle bundle)Adds a Bundle to the wrapped set of BundlesvoidaddClassLoader(ClassLoader classLoader)Adds a ClassLoader to the wrapped set of ClassLoadersprotected Class<?>findClass(String name)Load the class and break on first found match.protected URLfindResource(String name)Load the class and break on first found match.protected Enumeration<URL>findResources(String name)Load the class and break on first found match.voidstop()-
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, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
findClass
protected Class<?> findClass(String name) throws ClassNotFoundException
Load the class and break on first found match. TODO: Should this throw a different exception or warn if multiple classes were found? Naming collisions can and do happen in OSGi...- Overrides:
findClassin classClassLoader- Throws:
ClassNotFoundException
-
findResource
protected URL findResource(String name)
Load the class and break on first found match. TODO: Should this throw a different exception or warn if multiple classes were found? Naming collisions can and do happen in OSGi...- Overrides:
findResourcein classClassLoader
-
findResources
protected Enumeration<URL> findResources(String name)
Load the class and break on first found match. Note: Since they're Enumerations, do not cache these results! TODO: Should this throw a different exception or warn if multiple classes were found? Naming collisions can and do happen in OSGi...- Overrides:
findResourcesin classClassLoader
-
addClassLoader
public void addClassLoader(ClassLoader classLoader)
Adds a ClassLoader to the wrapped set of ClassLoaders- Parameters:
classLoader- The ClassLoader to add
-
addBundle
public void addBundle(org.osgi.framework.Bundle bundle)
Adds a Bundle to the wrapped set of Bundles- Parameters:
bundle- The Bundle to add
-
stop
public void stop()
- Specified by:
stopin interfaceorg.hibernate.service.spi.Stoppable
-
-