Class ParseStatus

java.lang.Object
org.apache.nutch.parse.ParseStatus
All Implemented Interfaces:
Writable

public class ParseStatus extends Object implements Writable
Author:
Andrzej Bialecki <ab@getopt.org>
  • Field Details

    • NOTPARSED

      public static final byte NOTPARSED
      Parsing was not performed.
      See Also:
    • SUCCESS

      public static final byte SUCCESS
      Parsing succeeded.
      See Also:
    • FAILED

      public static final byte FAILED
      General failure. There may be a more specific error message in arguments.
      See Also:
    • majorCodes

      public static final String[] majorCodes
    • SUCCESS_REDIRECT

      public static final short SUCCESS_REDIRECT
      Parsed content contains a directive to redirect to another URL. The target URL can be retrieved from the arguments.
      See Also:
    • FAILED_EXCEPTION

      public static final short FAILED_EXCEPTION
      Parsing failed. An Exception occurred (which may be retrieved from the arguments).
      See Also:
    • FAILED_TRUNCATED

      public static final short FAILED_TRUNCATED
      Parsing failed. Content was truncated, but the parser cannot handle incomplete content.
      See Also:
    • FAILED_INVALID_FORMAT

      public static final short FAILED_INVALID_FORMAT
      Parsing failed. Invalid format - the content may be corrupted or of wrong type.
      See Also:
    • FAILED_MISSING_PARTS

      public static final short FAILED_MISSING_PARTS
      Parsing failed. Other related parts of the content are needed to complete parsing. The list of URLs to missing parts may be provided in arguments. The Fetcher may decide to fetch these parts at once, then put them into Content.metadata, and supply them for re-parsing.
      See Also:
    • FAILED_MISSING_CONTENT

      public static final short FAILED_MISSING_CONTENT
      Parsing failed. There was no content to be parsed - probably caused by errors at protocol stage.
      See Also:
    • STATUS_NOTPARSED

      public static final ParseStatus STATUS_NOTPARSED
    • STATUS_SUCCESS

      public static final ParseStatus STATUS_SUCCESS
    • STATUS_FAILURE

      public static final ParseStatus STATUS_FAILURE
  • Constructor Details

    • ParseStatus

      public ParseStatus()
    • ParseStatus

      public ParseStatus(int majorCode, int minorCode, String[] args)
    • ParseStatus

      public ParseStatus(int majorCode)
    • ParseStatus

      public ParseStatus(int majorCode, String[] args)
    • ParseStatus

      public ParseStatus(int majorCode, int minorCode)
    • ParseStatus

      public ParseStatus(int majorCode, int minorCode, String message)
      Simplified constructor for passing just a text message.
      Parameters:
      majorCode - one of NOTPARSED, SUCCESS or FAILED
      minorCode - one of SUCCESS_REDIRECT, FAILED_EXCEPTION, FAILED_TRUNCATED, FAILED_INVALID_FORMAT, FAILED_MISSING_PARTS, or FAILED_MISSING_CONTENT
      message - a message string to accompany the parse codes
    • ParseStatus

      public ParseStatus(int majorCode, String message)
      Simplified constructor for passing just a text message.
      Parameters:
      majorCode - one of NOTPARSED, SUCCESS or FAILED
      message - a message string to accompany the parse codes
    • ParseStatus

      public ParseStatus(Throwable t)
  • Method Details

    • getVersion

      public byte getVersion()
    • read

      public static ParseStatus read(DataInput in) throws IOException
      Throws:
      IOException
    • readFields

      public void readFields(DataInput in) throws IOException
      Specified by:
      readFields in interface Writable
      Throws:
      IOException
    • write

      public void write(DataOutput out) throws IOException
      Specified by:
      write in interface Writable
      Throws:
      IOException
    • isSuccess

      public boolean isSuccess()
      Returns:
      true if majorCode is SUCCESS, false otherwise.
    • isFailed

      public boolean isFailed()
    • getMessage

      public String getMessage()
      Returns:
      a String representation of the first argument, or null.
    • getArgs

      public String[] getArgs()
    • getMajorCode

      public int getMajorCode()
    • getMinorCode

      public int getMinorCode()
    • getEmptyParse

      public Parse getEmptyParse(Configuration conf)
      Creates an empty Parse instance containing the status
      Parameters:
      conf - a Configuration
      Returns:
      the empty Parse object
    • getEmptyParseResult

      public ParseResult getEmptyParseResult(String url, Configuration conf)
      Creates an empty ParseResult for a given URL
      Parameters:
      url - canonical url
      conf - a Configuration
      Returns:
      the empty Parse object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setArgs

      public void setArgs(String[] args)
    • setMessage

      public void setMessage(String msg)
    • setMajorCode

      public void setMajorCode(byte majorCode)
    • setMinorCode

      public void setMinorCode(short minorCode)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object