Class OSGiClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class OSGiClassLoader
    extends java.net.URLClassLoader
    OSGiClassLoader Class loader that is aware of a bundle. Similar to WebAppClassLoader from Jetty and the OSGiWebAppClassLoader, but works without webapps.
    • Constructor Summary

      Constructors 
      Constructor Description
      OSGiClassLoader​(java.lang.ClassLoader parent, org.osgi.framework.Bundle bundle)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Class<?> findClass​(java.lang.String name)  
      java.net.URL getResource​(java.lang.String name)
      Get a resource from the classloader Copied from WebAppClassLoader
      java.util.Enumeration<java.net.URL> getResources​(java.lang.String name)  
      java.lang.Class<?> loadClass​(java.lang.String name)  
      protected java.lang.Class<?> loadClass​(java.lang.String name, boolean resolve)  
      • Methods inherited from class java.net.URLClassLoader

        addURL, close, definePackage, findResource, findResources, 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, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OSGiClassLoader

        public OSGiClassLoader​(java.lang.ClassLoader parent,
                               org.osgi.framework.Bundle bundle)
    • Method Detail

      • getResource

        public java.net.URL getResource​(java.lang.String name)
        Get a resource from the classloader Copied from WebAppClassLoader
        Overrides:
        getResource in class java.lang.ClassLoader
      • loadClass

        public java.lang.Class<?> loadClass​(java.lang.String name)
                                     throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • loadClass

        protected java.lang.Class<?> loadClass​(java.lang.String name,
                                               boolean resolve)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        loadClass in class java.lang.ClassLoader
        Throws:
        java.lang.ClassNotFoundException
      • getResources

        public java.util.Enumeration<java.net.URL> getResources​(java.lang.String name)
                                                         throws java.io.IOException
        Overrides:
        getResources in class java.lang.ClassLoader
        Throws:
        java.io.IOException
      • findClass

        protected java.lang.Class<?> findClass​(java.lang.String name)
                                        throws java.lang.ClassNotFoundException
        Overrides:
        findClass in class java.net.URLClassLoader
        Throws:
        java.lang.ClassNotFoundException