added copy constructor for URLMessages; added some setter/getter methods

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150853 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
cmarschner 2002-10-22 15:38:50 +00:00
parent a01f445199
commit 528544daa3
1 changed files with 44 additions and 3 deletions

View File

@ -61,6 +61,7 @@ import java.util.Date;
import java.util.Set; import java.util.Set;
import de.lanlab.larm.fetcher.URLMessage; import de.lanlab.larm.fetcher.URLMessage;
import de.lanlab.larm.net.HostManager; import de.lanlab.larm.net.HostManager;
import de.lanlab.larm.net.*;
/** /**
* a web document of whatever type. generated by a fetcher task * a web document of whatever type. generated by a fetcher task
@ -74,10 +75,23 @@ public class WebDocument extends URLMessage
protected String title; protected String title;
protected Date lastModified; protected Date lastModified;
HashMap fields; HashMap fields;
boolean isModified;
public WebDocument(URL url, String mimeType, int resultCode, URL referer, int size, String title, Date lastModified, HostManager hm) public WebDocument(URLMessage msg)
{ {
super(url, referer, false, null, hm); super(msg);
this.mimeType = "";
this.resultCode = -1;
this.size = -1;
this.title = "";
this.lastModified = new Date();
clearFields();
this.isModified = true;
}
public WebDocument(URL url, String mimeType, int resultCode, URL referer, int size, String title, Date lastModified, HostResolver hm)
{
super(url, referer, URLMessage.LINKTYPE_ANCHOR, null, hm);
this.url = url; this.url = url;
this.mimeType = mimeType; this.mimeType = mimeType;
//this.document = document; //this.document = document;
@ -85,7 +99,23 @@ public class WebDocument extends URLMessage
this.size = size; this.size = size;
this.title = title; this.title = title;
this.lastModified = lastModified; this.lastModified = lastModified;
this.fields = new HashMap(7); // expect ~4 fields clearFields();
this.isModified = true;
}
public void setModified(boolean modified)
{
this.isModified = modified;
}
public boolean isModified()
{
return isModified;
}
public void clearFields()
{
this.fields = new HashMap(7);
} }
public Set getFieldNames() public Set getFieldNames()
@ -119,6 +149,11 @@ public class WebDocument extends URLMessage
return lastModified; return lastModified;
} }
public void setLastModified(Date lastModified)
{
this.lastModified = lastModified;
}
public String getTitle() public String getTitle()
{ {
return title; return title;
@ -173,6 +208,12 @@ public class WebDocument extends URLMessage
this.mimeType = mimeType; this.mimeType = mimeType;
} }
public void setTitle(String title)
{
this.title = title;
}
public String getMimeType() public String getMimeType()
{ {
return mimeType; return mimeType;