A nested container representing parse status data captured from invocation of parsers on fetch of a WebPage
| 23 | |
| 24 | /** A nested container representing parse status data captured from invocation of parsers on fetch of a WebPage */ |
| 25 | public class ParseStatus extends org.apache.gora.persistency.impl.PersistentBase implements org.apache.avro.specific.SpecificRecord, org.apache.gora.persistency.Persistent { |
| 26 | public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ParseStatus\",\"namespace\":\"org.apache.nutch.storage\",\"doc\":\"A nested container representing parse status data captured from invocation of parsers on fetch of a WebPage\",\"fields\":[{\"name\":\"majorCode\",\"type\":\"int\",\"doc\":\"Major parsing status' including NOTPARSED (Parsing was not performed), SUCCESS (Parsing succeeded), FAILED (General failure. There may be a more specific error message in arguments.)\",\"default\":0},{\"name\":\"minorCode\",\"type\":\"int\",\"doc\":\"Minor parsing status' including SUCCESS_OK - Successful parse devoid of anomalies or issues, SUCCESS_REDIRECT - Parsed content contains a directive to redirect to another URL. The target URL can be retrieved from the arguments., FAILED_EXCEPTION - Parsing failed. An Exception occured which may be retrieved from the arguments., FAILED_TRUNCATED - Parsing failed. Content was truncated, but the parser cannot handle incomplete content., FAILED_INVALID_FORMAT - Parsing failed. Invalid format e.g. the content may be corrupted or of wrong type., 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., FAILED_MISING_CONTENT - Parsing failed. There was no content to be parsed - probably caused by errors at protocol stage.\",\"default\":0},{\"name\":\"args\",\"type\":{\"type\":\"array\",\"items\":\"string\"},\"doc\":\"Optional arguments supplied to compliment and/or justify the parse status code.\",\"default\":[]}]}"); |
| 27 | private static final long serialVersionUID = 4706512534530572126L; |
| 28 | /** Enum containing all data bean's fields. */ |
| 29 | public static enum Field { |
| 30 | MAJOR_CODE(0, "majorCode"), |
| 31 | MINOR_CODE(1, "minorCode"), |
| 32 | ARGS(2, "args"), |
| 33 | ; |
| 34 | /** |
| 35 | * Field's index. |
| 36 | */ |
| 37 | private int index; |
| 38 | |
| 39 | /** |
| 40 | * Field's name. |
| 41 | */ |
| 42 | private String name; |
| 43 | |
| 44 | /** |
| 45 | * Field's constructor |
| 46 | * @param index field's index. |
| 47 | * @param name field's name. |
| 48 | */ |
| 49 | Field(int index, String name) {this.index=index;this.name=name;} |
| 50 | |
| 51 | /** |
| 52 | * Gets field's index. |
| 53 | * @return int field's index. |
| 54 | */ |
| 55 | public int getIndex() {return index;} |
| 56 | |
| 57 | /** |
| 58 | * Gets field's name. |
| 59 | * @return String field's name. |
| 60 | */ |
| 61 | public String getName() {return name;} |
| 62 | |
| 63 | /** |
| 64 | * Gets field's attributes to string. |
| 65 | * @return String field's attributes to string. |
| 66 | */ |
| 67 | public String toString() {return name;} |
| 68 | }; |
| 69 | |
| 70 | public static final String[] _ALL_FIELDS = { |
| 71 | "majorCode", |
| 72 | "minorCode", |
| 73 | "args", |
| 74 | }; |
| 75 | |
| 76 | /** |
| 77 | * Gets the total field count. |
| 78 | * @return int field count |
| 79 | */ |
| 80 | public int getFieldsCount() { |
| 81 | return ParseStatus._ALL_FIELDS.length; |
| 82 | } |