org.apache.nutch.protocol
Class ProtocolFactory
- java.lang.Object
- org.apache.nutch.protocol.ProtocolFactory
public class ProtocolFactory extends Object
Creates and caches 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
.
Field Summary
Fields Modifier and Type Field and Description static org.slf4j.Logger
LOG
Constructor Summary
Constructors Constructor and Description ProtocolFactory(org.apache.hadoop.conf.Configuration conf)
Method Summary
Methods Modifier and Type Method and Description Protocol
getProtocol(String urlString)
Returns the appropriate Protocol
implementation for a url.
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail
-
LOG
public static final org.slf4j.Logger LOG
Constructor Detail
-
ProtocolFactory
public ProtocolFactory(org.apache.hadoop.conf.Configuration conf)
Method Detail
-
getProtocol
public Protocol getProtocol(String urlString) throws ProtocolNotFound
Returns the appropriate Protocol
implementation for a url.
- Parameters:
- <code>urlString</code> - Url String
- Returns:
- The appropriate [<code>Protocol</code>](../../../../org/apache/nutch/protocol/Protocol.html) implementation for a given [<code>URL</code>](http://java.sun.com/javase/6/docs/api/java/net/URL.html?is-external=true).
- Throws:
- <code>ProtocolNotFound</code> - when Protocol can not be found for urlString