Package org.apache.nutch.plugin
Class URLStreamHandlerFactory
java.lang.Object
org.apache.nutch.plugin.URLStreamHandlerFactory
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprotected static final org.slf4j.Loggerstatic final String[]Protocols covered by standard JVM URL handlers. -
Method Summary
Modifier and TypeMethodDescriptioncreateURLStreamHandler(String protocol) static URLStreamHandlerFactoryGet the singleton instance of this class.voidUse this method once a new PluginRepository was created to register it.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
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 Details
-
getInstance
Get the singleton instance of this class.- Returns:
- a
URLStreamHandlerFactoryinstance
-
registerPluginRepository
Use this method once a new PluginRepository was created to register it.- Parameters:
pr- The PluginRepository to be registered.
-
createURLStreamHandler
- Specified by:
createURLStreamHandlerin interfaceURLStreamHandlerFactory
-