Class OsgiClassLoader

  • All Implemented Interfaces:
    Stoppable

    public class OsgiClassLoader
    extends ClassLoader
    implements Stoppable
    Custom OSGI ClassLoader helper which knows all the "interesting" class loaders and bundles. Encapsulates the OSGi related CL capabilities.
    • Constructor Detail

      • OsgiClassLoader

        public OsgiClassLoader()
    • Method Detail

      • 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:
        findResource in class ClassLoader
      • 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:
        findResources in class ClassLoader
      • 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()
        Description copied from interface: Stoppable
        Stop phase notification
        Specified by:
        stop in interface Stoppable