SMILA (incubation) API documentation

org.eclipse.smila.connectivity.framework.crawler.web.parse
Class ParseStatus

java.lang.Object
  extended by org.eclipse.smila.connectivity.framework.crawler.web.parse.ParseStatus

public class ParseStatus
extends java.lang.Object

Class to handle parse status messages and codes.


Field Summary
static byte FAILED
          General failure.
static short FAILED_EXCEPTION
          Parsing failed.
static short FAILED_INVALID_FORMAT
          Parsing failed.
static short FAILED_MISSING_CONTENT
          Parsing failed.
static short FAILED_MISSING_PARTS
          Parsing failed.
static short FAILED_TRUNCATED
          Parsing failed.
static java.lang.String[] MAJOR_CODES
          The Constant MAJOR_CODES.
static byte NOTPARSED
          Parsing was not performed.
static ParseStatus STATUS_FAILURE
          The Constant STATUS_FAILURE.
static ParseStatus STATUS_NOTPARSED
          The Constant STATUS_NOTPARSED.
static ParseStatus STATUS_SUCCESS
          The Constant STATUS_SUCCESS.
static byte SUCCESS
          Parsing succeeded.
static short SUCCESS_REDIRECT
          Parsed content contains a directive to redirect to another URL.
 
Constructor Summary
ParseStatus()
          Empty constructor.
ParseStatus(int majorCode)
          Simplified constructor for passing just a major code.
ParseStatus(int majorCode, int minorCode)
          Simplified constructor for passing just a major and minor codes.
ParseStatus(int majorCode, int minorCode, java.lang.String message)
          Creates new object with given configuration.
ParseStatus(int majorCode, java.lang.String message)
          Simplified constructor for passing just a major status code and text message.
ParseStatus(java.lang.Throwable throwable)
          Constructor for passing throwable.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 Parse getEmptyParse(Configuration conf)
          A convenience method.
 int getMajorCode()
          Returns a major status code.
 java.lang.String getMessage()
          Return a message.
 int getMinorCode()
          Returns a minor status code.
 int hashCode()
          
 boolean isSuccess()
          A convenience method.
 void setMajorCode(byte majorCode)
          Assigns major status code.
 void setMessage(java.lang.String message)
          Assigns text message.
 void setMinorCode(short minorCode)
          Assigns minor status code.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTPARSED

public static final byte NOTPARSED
Parsing was not performed.

See Also:
Constant Field Values

SUCCESS

public static final byte SUCCESS
Parsing succeeded.

See Also:
Constant Field Values

FAILED

public static final byte FAILED
General failure. There may be a more specific error message in arguments.

See Also:
Constant Field Values

MAJOR_CODES

public static final java.lang.String[] MAJOR_CODES
The Constant MAJOR_CODES.


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:
Constant Field Values

FAILED_EXCEPTION

public static final short FAILED_EXCEPTION
Parsing failed. An Exception occured (which may be retrieved from the arguments).

See Also:
Constant Field Values

FAILED_TRUNCATED

public static final short FAILED_TRUNCATED
Parsing failed. Content was truncated, but the parser cannot handle incomplete content.

See Also:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values

STATUS_NOTPARSED

public static final ParseStatus STATUS_NOTPARSED
The Constant STATUS_NOTPARSED.


STATUS_SUCCESS

public static final ParseStatus STATUS_SUCCESS
The Constant STATUS_SUCCESS.


STATUS_FAILURE

public static final ParseStatus STATUS_FAILURE
The Constant STATUS_FAILURE.

Constructor Detail

ParseStatus

public ParseStatus()
Empty constructor.


ParseStatus

public ParseStatus(int majorCode,
                   int minorCode,
                   java.lang.String message)
Creates new object with given configuration.

Parameters:
majorCode - Major status code (notparsed, success, failed)
minorCode - Minor status code that specifies major code.
message - Text message.

ParseStatus

public ParseStatus(int majorCode)
Simplified constructor for passing just a major code.

Parameters:
majorCode - major status code

ParseStatus

public ParseStatus(int majorCode,
                   java.lang.String message)
Simplified constructor for passing just a major status code and text message.

Parameters:
majorCode - major status code
message - text message

ParseStatus

public ParseStatus(int majorCode,
                   int minorCode)
Simplified constructor for passing just a major and minor codes.

Parameters:
majorCode - major status code
minorCode - minor status code

ParseStatus

public ParseStatus(java.lang.Throwable throwable)
Constructor for passing throwable.

Parameters:
throwable - Throwable
Method Detail

isSuccess

public boolean isSuccess()
A convenience method. Returns true if majorCode is SUCCESS, false otherwise.

Returns:
boolean

getMessage

public java.lang.String getMessage()
Return a message.

Returns:
String

getMajorCode

public int getMajorCode()
Returns a major status code.

Returns:
int

getMinorCode

public int getMinorCode()
Returns a minor status code.

Returns:
int

getEmptyParse

public Parse getEmptyParse(Configuration conf)
A convenience method. Creates an empty Parse instance, which returns this status.

Parameters:
conf - Configuration
Returns:
Parse

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

setMessage

public void setMessage(java.lang.String message)
Assigns text message.

Parameters:
message - text message

setMajorCode

public void setMajorCode(byte majorCode)
Assigns major status code.

Parameters:
majorCode - byte

setMinorCode

public void setMinorCode(short minorCode)
Assigns minor status code.

Parameters:
minorCode - short

equals

public boolean equals(java.lang.Object o)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

SMILA (incubation) API documentation