gov.sandia.cognition.text.document
Class DefaultDocument

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.util.AbstractNamed
          extended by gov.sandia.cognition.text.document.AbstractDocument
              extended by gov.sandia.cognition.text.document.DefaultDocument
All Implemented Interfaces:
Document, CloneableSerializable, Named, Serializable, Cloneable

public class DefaultDocument
extends AbstractDocument

A default implementation of the Document interface.

Since:
3.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.sandia.cognition.text.document.AbstractDocument
ACCESSED_DATE_FIELD_NAME, AUTHOR_FIELD_NAME, BODY_FIELD_NAME, fieldMap, LAST_MODIFIED_DATE_FIELD_NAME, reference, TITLE_FIELD_NAME
 
Fields inherited from class gov.sandia.cognition.util.AbstractNamed
name
 
Constructor Summary
DefaultDocument()
          Creates a new DefaultDocument.
 
Method Summary
 void addField(Field field)
          Adds a field to the document.
 void readMetaData(URLConnection connection)
          Reads the file name and title from the given URL.
 void removeField(String fieldName)
          Removes a field of the given name from the document.
 void setAccessedDate(Date date)
          Sets the last accessed date of the document.
 void setAccessedDate(long time)
          Sets the last accessed date of the document.
 void setAuthor(String author)
          Sets the author field of the document to the given string.
 void setBody(String body)
          Sets the body field of the document to the given string.
 void setLastModifiedDate(Date date)
          Sets the last modified date of the document.
 void setLastModifiedDate(long time)
          Sets the last modified date of the document.
 void setTitle(String title)
          Sets the title field of the document to the given string.
 
Methods inherited from class gov.sandia.cognition.text.document.AbstractDocument
getAccessedDateField, getAuthorField, getBodyField, getField, getFieldMap, getFields, getLastModifiedDateField, getReference, getReferenceURI, getTitleField, hasField, setFieldMap, setReference
 
Methods inherited from class gov.sandia.cognition.util.AbstractNamed
clone, getName, setName, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.Named
getName
 

Constructor Detail

DefaultDocument

public DefaultDocument()
Creates a new DefaultDocument.

Method Detail

addField

public void addField(Field field)
Description copied from class: AbstractDocument
Adds a field to the document. If there is already a field with the same name, that field is replaced.

Overrides:
addField in class AbstractDocument
Parameters:
field - The field to add.

removeField

public void removeField(String fieldName)
Description copied from class: AbstractDocument
Removes a field of the given name from the document.

Overrides:
removeField in class AbstractDocument
Parameters:
fieldName - The name of the field to remove.

setTitle

public void setTitle(String title)
Sets the title field of the document to the given string.

Parameters:
title - The title of the document.

setLastModifiedDate

public void setLastModifiedDate(long time)
Sets the last modified date of the document.

Parameters:
time - The last modified date in milliseconds.

setLastModifiedDate

public void setLastModifiedDate(Date date)
Sets the last modified date of the document.

Parameters:
date - The last modified date.

setAccessedDate

public void setAccessedDate(long time)
Sets the last accessed date of the document.

Parameters:
time - The last accessed date in milliseconds.

setAccessedDate

public void setAccessedDate(Date date)
Sets the last accessed date of the document.

Parameters:
date - The last accessed date.

setAuthor

public void setAuthor(String author)
Sets the author field of the document to the given string.

Parameters:
author - The author of the document.

setBody

public void setBody(String body)
Sets the body field of the document to the given string.

Parameters:
body - The body text of the document.

readMetaData

public void readMetaData(URLConnection connection)
Reads the file name and title from the given URL. It uses the full file name and then the local file name without the file extension is used as the title.

Parameters:
connection - The connection to read the metadata from.