01: /*
02: * Copyright 2005 by Lars Torunski
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: *
16: */
17: package com.torunski.crawler.parser;
18:
19: import com.torunski.crawler.link.Link;
20:
21: /**
22: * Defines an abstract container for the downloaded page.
23: *
24: * @author Lars Torunski
25: * @version $Revision: 1.5 $
26: */
27: public abstract class PageData {
28:
29: public static final int NOT_LOADED = 0;
30: public static final int OK = 1;
31: public static final int ERROR = 2;
32:
33: /** The link of this data */
34: private Link link;
35:
36: /** The status of the data */
37: private int status;
38:
39: /**
40: * The default constructor.
41: *
42: * @param link the link of the page data.
43: */
44: public PageData(Link link) {
45: this (link, NOT_LOADED);
46: }
47:
48: /**
49: * The default constructor.
50: *
51: * @param link the link of the page data.
52: * @param status the status of the data
53: */
54: public PageData(Link link, int status) {
55: this .link = link;
56: this .status = status;
57: }
58:
59: /**
60: * @return Returns the link.
61: */
62: public Link getLink() {
63: return link;
64: }
65:
66: /**
67: * @return Returns the status.
68: */
69: public int getStatus() {
70: return status;
71: }
72:
73: /**
74: * @param status The status to set.
75: */
76: public void setStatus(int status) {
77: this .status = status;
78: }
79:
80: /**
81: * @return Returns the data of the page.
82: */
83: public abstract Object getData();
84:
85: }
|