gate.corpora
Class DatabaseDocumentImpl

java.lang.Object
  |
  +--gate.util.AbstractFeatureBearer
        |
        +--gate.creole.AbstractResource
              |
              +--gate.creole.AbstractLanguageResource
                    |
                    +--gate.corpora.DocumentImpl
                          |
                          +--gate.corpora.DatabaseDocumentImpl
All Implemented Interfaces:
Comparable, CreoleListener, DatastoreListener, Document, EventAwareDocument, EventAwareLanguageResource, EventListener, FeatureBearer, LanguageResource, NameBearer, Resource, Serializable

public class DatabaseDocumentImpl
extends DocumentImpl
implements DatastoreListener, Document, EventAwareDocument

See Also:
Serialized Form

Fields inherited from interface gate.corpora.EventAwareLanguageResource
DOC_CONTENT, DOC_MAIN, RES_FEATURES, RES_NAME
 
Constructor Summary
DatabaseDocumentImpl(Connection conn)
           
DatabaseDocumentImpl(Connection _conn, String _name, DatabaseDataStore _ds, Long _persistenceID, DocumentContent _content, FeatureMap _features, Boolean _isMarkupAware, URL _sourceURL, Long _urlStartOffset, Long _urlEndOffset, AnnotationSet _default, Map _named)
           
 
Method Summary
 void cleanup()
          Overriden to remove the features listener, when the document is closed.
 Collection getAddedAnnotationSets()
           
 AnnotationSet getAnnotations()
          Get the default set of annotations.
 AnnotationSet getAnnotations(String name)
          Get a named set of annotations.
 DocumentContent getContent()
          The content of the document: a String for text; MPEG for video; etc.
 String getEncoding()
          Get the encoding of the document content source
 Collection getLoadedAnnotationSets()
           
 Map getNamedAnnotationSets()
          Returns a map with the named annotation sets.
 Collection getRemovedAnnotationSets()
           
 boolean isResourceChanged(int changeType)
          Generate and return the next annotation ID
 void removeAnnotationSet(String name)
          Removes one of the named annotation sets.
 void resourceAdopted(DatastoreEvent evt)
          Called by a datastore when a new resource has been adopted
 void resourceDeleted(DatastoreEvent evt)
          Called by a datastore when a resource has been deleted
 void resourceWritten(DatastoreEvent evt)
          Called by a datastore when a resource has been wrote into the datastore
 void setContent(DocumentContent content)
          Set method for the document content
 void setFeatures(FeatureMap features)
          Set the feature set
 void setMarkupAware(Boolean newMarkupAware)
          Make the document markup-aware.
 void setName(String name)
          Sets the name of this resource
 void setSourceUrl(URL sourceUrl)
          Set method for the document's URL
 void setSourceUrlEndOffset(Long sourceUrlEndOffset)
          Documents may be packed within files; in this case an optional pair of offsets refer to the location of the document.
 void setSourceUrlStartOffset(Long sourceUrlStartOffset)
          Documents may be packed within files; in this case an optional pair of offsets refer to the location of the document.
 
Methods inherited from class gate.corpora.DocumentImpl
addDocumentListener, compareTo, datastoreClosed, datastoreCreated, datastoreOpened, edit, equals, getMarkupAware, getNextAnnotationId, getNextNodeId, getSourceUrl, getSourceUrlEndOffset, getSourceUrlOffsets, getSourceUrlStartOffset, getStringContent, hashCode, init, isValidOffset, isValidOffsetRange, removeDocumentListener, resourceLoaded, resourceUnloaded, setEncoding, setLRPersistenceId, setNextAnnotationId, setStringContent, toString, toXml, toXml
 
Methods inherited from class gate.creole.AbstractLanguageResource
getDataStore, getLRPersistenceId, setDataStore, sync
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getName, getParameterValue, getParameterValue, removeResourceListeners, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.Document
addDocumentListener, edit, getMarkupAware, getSourceUrl, getSourceUrlEndOffset, getSourceUrlOffsets, getSourceUrlStartOffset, removeDocumentListener, toXml, toXml
 
Methods inherited from interface gate.LanguageResource
getDataStore, getLRPersistenceId, setDataStore, setLRPersistenceId, sync
 
Methods inherited from interface gate.Resource
getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures
 
Methods inherited from interface gate.util.NameBearer
getName
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

DatabaseDocumentImpl

public DatabaseDocumentImpl(Connection conn)

DatabaseDocumentImpl

public DatabaseDocumentImpl(Connection _conn,
                            String _name,
                            DatabaseDataStore _ds,
                            Long _persistenceID,
                            DocumentContent _content,
                            FeatureMap _features,
                            Boolean _isMarkupAware,
                            URL _sourceURL,
                            Long _urlStartOffset,
                            Long _urlEndOffset,
                            AnnotationSet _default,
                            Map _named)
Method Detail

getContent

public DocumentContent getContent()
The content of the document: a String for text; MPEG for video; etc.
Specified by:
getContent in interface Document
Overrides:
getContent in class DocumentImpl

getEncoding

public String getEncoding()
Get the encoding of the document content source
Overrides:
getEncoding in class DocumentImpl

getNamedAnnotationSets

public Map getNamedAnnotationSets()
Returns a map with the named annotation sets. It returns null if no named annotaton set exists.
Specified by:
getNamedAnnotationSets in interface Document
Overrides:
getNamedAnnotationSets in class DocumentImpl

getAnnotations

public AnnotationSet getAnnotations()
Get the default set of annotations. The set is created if it doesn't exist yet.
Specified by:
getAnnotations in interface Document
Overrides:
getAnnotations in class DocumentImpl

getAnnotations

public AnnotationSet getAnnotations(String name)
Get a named set of annotations. Creates a new set if one with this name doesn't exist yet. If the provided name is null then it returns the default annotation set.
Specified by:
getAnnotations in interface Document
Overrides:
getAnnotations in class DocumentImpl

setContent

public void setContent(DocumentContent content)
Set method for the document content
Specified by:
setContent in interface Document
Overrides:
setContent in class DocumentImpl

setFeatures

public void setFeatures(FeatureMap features)
Set the feature set
Specified by:
setFeatures in interface FeatureBearer
Overrides:
setFeatures in class AbstractFeatureBearer

setName

public void setName(String name)
Sets the name of this resource
Specified by:
setName in interface NameBearer
Overrides:
setName in class AbstractResource

isResourceChanged

public boolean isResourceChanged(int changeType)
Generate and return the next annotation ID
Specified by:
isResourceChanged in interface EventAwareLanguageResource

setSourceUrl

public void setSourceUrl(URL sourceUrl)
Set method for the document's URL
Specified by:
setSourceUrl in interface Document
Overrides:
setSourceUrl in class DocumentImpl

setSourceUrlEndOffset

public void setSourceUrlEndOffset(Long sourceUrlEndOffset)
Documents may be packed within files; in this case an optional pair of offsets refer to the location of the document. This method sets the end offset.
Specified by:
setSourceUrlEndOffset in interface Document
Overrides:
setSourceUrlEndOffset in class DocumentImpl

setSourceUrlStartOffset

public void setSourceUrlStartOffset(Long sourceUrlStartOffset)
Documents may be packed within files; in this case an optional pair of offsets refer to the location of the document. This method sets the start offset.
Specified by:
setSourceUrlStartOffset in interface Document
Overrides:
setSourceUrlStartOffset in class DocumentImpl

setMarkupAware

public void setMarkupAware(Boolean newMarkupAware)
Make the document markup-aware. This will trigger the creation of a DocumentFormat object at Document initialisation time; the DocumentFormat object will unpack the markup in the Document and add it as annotations. Documents are not markup-aware by default.
Specified by:
setMarkupAware in interface Document
Overrides:
setMarkupAware in class DocumentImpl
Parameters:
b - markup awareness status.

cleanup

public void cleanup()
Overriden to remove the features listener, when the document is closed.
Specified by:
cleanup in interface Resource
Overrides:
cleanup in class DocumentImpl

resourceAdopted

public void resourceAdopted(DatastoreEvent evt)
Called by a datastore when a new resource has been adopted
Specified by:
resourceAdopted in interface DatastoreListener

resourceDeleted

public void resourceDeleted(DatastoreEvent evt)
Called by a datastore when a resource has been deleted
Specified by:
resourceDeleted in interface DatastoreListener

resourceWritten

public void resourceWritten(DatastoreEvent evt)
Called by a datastore when a resource has been wrote into the datastore
Specified by:
resourceWritten in interface DatastoreListener

getLoadedAnnotationSets

public Collection getLoadedAnnotationSets()
Specified by:
getLoadedAnnotationSets in interface EventAwareDocument

getRemovedAnnotationSets

public Collection getRemovedAnnotationSets()
Specified by:
getRemovedAnnotationSets in interface EventAwareDocument

getAddedAnnotationSets

public Collection getAddedAnnotationSets()
Specified by:
getAddedAnnotationSets in interface EventAwareDocument

removeAnnotationSet

public void removeAnnotationSet(String name)
Description copied from interface: Document
Removes one of the named annotation sets. Note that the default annotation set cannot be removed.
Specified by:
removeAnnotationSet in interface Document
Overrides:
removeAnnotationSet in class DocumentImpl
Following copied from interface: gate.Document
Parameters:
name - the name of the annotation set to be removed