Package org.apache.nutch.plugin

## Class URLStreamHandlerFactory

- java.lang.Object
- - org.apache.nutch.plugin.URLStreamHandlerFactory

- All Implemented Interfaces:
    `URLStreamHandlerFactory`

      public class URLStreamHandlerFactory
      extends Object
      implements URLStreamHandlerFactory

  This URLStreamHandlerFactory knows about all the plugins in use and thus can create the correct URLStreamHandler even if it comes from a plugin classpath. As the JVM allows only one instance of URLStreamHandlerFactory to be registered, this class implements a singleton pattern.
  Author:
    Hiran Chaudhuri

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected static org.slf4j.Logger` | `LOG` |
    `static String[]` | `SYSTEM_PROTOCOLS` | Protocols covered by standard JVM URL handlers.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `URLStreamHandler` | `createURLStreamHandler​(String protocol)` |
    `static URLStreamHandlerFactory` | `getInstance()` | Get the singleton instance of this class.
    `void` | `registerPluginRepository​(PluginRepository pr)` | Use this method once a new PluginRepository was created to register it.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### LOG

          protected static final org.slf4j.Logger LOG

    - #### SYSTEM_PROTOCOLS

          public static final String[] SYSTEM_PROTOCOLS

      Protocols covered by standard JVM URL handlers. These protocols must not be handled by Nutch plugins, in order to avoid that basic actions (eg. loading of classes and configuration files) break. Also the "ftp" protocol is included: it's usually supported by the standard JVM URL handler and Nutch does not yet provide a dedicated URL stream handler.

  - ### Method Detail

    - #### getInstance

          public static URLStreamHandlerFactory getInstance()

      Get the singleton instance of this class.
      Returns:
        a `URLStreamHandlerFactory` instance

    - #### registerPluginRepository

          public void registerPluginRepository​(PluginRepository pr)

      Use this method once a new PluginRepository was created to register it.
      Parameters:
        `pr` - The PluginRepository to be registered.

    - #### createURLStreamHandler

          public URLStreamHandler createURLStreamHandler​(String protocol)

      Specified by:
        `createURLStreamHandler` in interface `URLStreamHandlerFactory`