public class ProtocolFactory extends Object
Protocol plugins. Protocol plugins should define
the attribute "protocolName" with the name of the protocol that they
implement. Configuration object is used for caching. Cache key is constructed
from appending protocol name (eg. http) to constant
Protocol.X_POINT_ID.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
defaultProtocolImplMapping |
protected Map<String,String> |
hostProtocolMapping |
| Constructor and Description |
|---|
ProtocolFactory(Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
Protocol |
getProtocol(String urlString)
Returns the appropriate
Protocol implementation for a url. |
Protocol |
getProtocol(URL url)
Returns the appropriate
Protocol implementation for a url. |
Protocol |
getProtocolById(String id) |
public ProtocolFactory(Configuration conf)
public Protocol getProtocol(String urlString) throws ProtocolNotFound
Protocol implementation for a url.urlString - Url StringProtocol implementation for a given
URL.ProtocolNotFound - when Protocol can not be found for urlString or urlString is not
a valid URLpublic Protocol getProtocol(URL url) throws ProtocolNotFound
Protocol implementation for a url.url - URL to be fetched by returned Protocol implementationProtocol implementation for a given
URL.ProtocolNotFound - when Protocol can not be found for urlpublic Protocol getProtocolById(String id) throws PluginRuntimeException
id - protocol plugin ID, e.g.,
org.apache.nutch.protocol.httpPluginRuntimeException - if plugin not found or failed to instantiateCopyright © 2021 The Apache Software Foundation