Package org.apache.nutch.tools
Class AbstractCommonCrawlFormat
java.lang.Object
org.apache.nutch.tools.AbstractCommonCrawlFormat
- All Implemented Interfaces:
Closeable,AutoCloseable,CommonCrawlFormat
- Direct Known Subclasses:
CommonCrawlFormatJackson,CommonCrawlFormatJettinson,CommonCrawlFormatSimple,CommonCrawlFormatWARC
Abstract class that implements { @see org.apache.nutch.tools.CommonCrawlFormat } interface.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCommonCrawlFormat(String url, Content content, Metadata metadata, Configuration nutchConf, CommonCrawlConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Optional method that could be implemented if the actual format needs some close procedure.protected abstract voidcloseArray(String key, boolean nested, boolean newline) protected abstract voidcloseObject(String key) protected abstract Stringprotected Stringgets set of inlinksGet a string representation of the JSON structure of the URL content.getJsonData(String url, Content content, Metadata metadata) Returns a string representation of the JSON structure of the URL content.getJsonData(String url, Content content, Metadata metadata, ParseData parseData) Returns a string representation of the JSON structure of the URL content.protected StringgetKey()protected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected StringgetUrl()voidsetInLinks(List<String> inLinks) sets inlinks of this documentprotected abstract voidstartArray(String key, boolean nested, boolean newline) protected abstract voidstartObject(String key) protected abstract voidwriteArrayValue(String value) protected abstract voidwriteKeyNull(String key) protected abstract voidwriteKeyValue(String key, String value)
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
url
-
-
metadata
-
conf
-
keyPrefix
-
simpleDateFormat
protected boolean simpleDateFormat -
jsonArray
protected boolean jsonArray -
reverseKey
protected boolean reverseKey -
reverseKeyValue
-
inLinks
-
-
Constructor Details
-
AbstractCommonCrawlFormat
public AbstractCommonCrawlFormat(String url, Content content, Metadata metadata, Configuration nutchConf, CommonCrawlConfig config) throws IOException - Throws:
IOException
-
-
Method Details
-
getJsonData
Description copied from interface:CommonCrawlFormatReturns a string representation of the JSON structure of the URL content. Takes into consideration both theContentandMetadata- Specified by:
getJsonDatain interfaceCommonCrawlFormat- Parameters:
url- the canonical urlcontent- urlContentmetadata- urlMetadata- Returns:
- the JSON URL content string
- Throws:
IOException- if there is a fatal I/O error obtaining JSON data
-
getJsonData
public String getJsonData(String url, Content content, Metadata metadata, ParseData parseData) throws IOException Description copied from interface:CommonCrawlFormatReturns a string representation of the JSON structure of the URL content. Takes into consideration theContent,MetadataandParseData.- Specified by:
getJsonDatain interfaceCommonCrawlFormat- Parameters:
url- the canonical urlcontent- urlContentmetadata- urlMetadataparseData- urlParseData- Returns:
- the JSON URL content string
- Throws:
IOException- if there is a fatal I/O error obtaining JSON data
-
getJsonData
Description copied from interface:CommonCrawlFormatGet a string representation of the JSON structure of the URL content.- Specified by:
getJsonDatain interfaceCommonCrawlFormat- Returns:
- the JSON URL content string
- Throws:
IOException- if there is a fatal I/O error obtaining JSON data
-
writeKeyValue
- Throws:
IOException
-
writeKeyNull
- Throws:
IOException
-
startArray
- Throws:
IOException
-
closeArray
- Throws:
IOException
-
writeArrayValue
- Throws:
IOException
-
startObject
- Throws:
IOException
-
closeObject
- Throws:
IOException
-
generateJson
- Throws:
IOException
-
getUrl
-
getTimestamp
-
getMethod
-
getRequestHostName
-
getRequestHostAddress
-
getRequestSoftware
-
getRequestRobots
-
getRequestContactName
-
getRequestContactEmail
-
getRequestAccept
-
getRequestAcceptEncoding
-
getRequestAcceptLanguage
-
getRequestUserAgent
-
getResponseStatus
-
getResponseHostName
-
getResponseAddress
-
getResponseContentEncoding
-
getResponseContentType
-
getInLinks
Description copied from interface:CommonCrawlFormatgets set of inlinks- Specified by:
getInLinksin interfaceCommonCrawlFormat- Returns:
- gets inlinks of this document
-
setInLinks
Description copied from interface:CommonCrawlFormatsets inlinks of this document- Specified by:
setInLinksin interfaceCommonCrawlFormat- Parameters:
inLinks- list of inlinks
-
getResponseDate
-
getResponseServer
-
getResponseContent
-
getKey
-
getImported
-
close
public void close()Description copied from interface:CommonCrawlFormatOptional method that could be implemented if the actual format needs some close procedure.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCommonCrawlFormat
-