Class DirContextURLStreamHandlerService

  • All Implemented Interfaces:
    org.osgi.framework.BundleActivator, org.osgi.service.url.URLStreamHandlerService

    public class DirContextURLStreamHandlerService
    extends org.osgi.service.url.AbstractURLStreamHandlerService
    implements org.osgi.framework.BundleActivator
    This class is responsible for adding DirContextURLStreamHandler to OSGi service registry. As much as we would have liked it to be both an activator as well as a Startup service, we can't. In embedded mode, this Startup service would fail to load, so we have separated the startup servuce part to WebNamingStartup class. That Startup service ensures that this bundle gets activated during server startup and the activator ensures that we register a jndi protocol handler.
    Author:
    [email protected]
    • Constructor Detail

      • DirContextURLStreamHandlerService

        public DirContextURLStreamHandlerService()
    • Method Detail

      • openConnection

        public URLConnection openConnection​(URL u)
                                     throws IOException
        Specified by:
        openConnection in interface org.osgi.service.url.URLStreamHandlerService
        Specified by:
        openConnection in class org.osgi.service.url.AbstractURLStreamHandlerService
        Throws:
        IOException
      • toExternalForm

        public String toExternalForm​(URL u)
        Specified by:
        toExternalForm in interface org.osgi.service.url.URLStreamHandlerService
        Overrides:
        toExternalForm in class org.osgi.service.url.AbstractURLStreamHandlerService
      • start

        public void start​(org.osgi.framework.BundleContext context)
                   throws Exception
        Specified by:
        start in interface org.osgi.framework.BundleActivator
        Throws:
        Exception
      • stop

        public void stop​(org.osgi.framework.BundleContext context)
                  throws Exception
        Specified by:
        stop in interface org.osgi.framework.BundleActivator
        Throws:
        Exception