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 EventAwareDocument

See Also:
Serialized Form

Fields inherited from interface gate.corpora.EventAwareLanguageResource
DOC_CONTENT, DOC_MAIN, RES_FEATURES, RES_NAME
 
Fields inherited from interface gate.Document
DOCUMENT_ENCODING_PARAMETER_NAME, DOCUMENT_END_OFFSET_PARAMETER_NAME, DOCUMENT_MARKUP_AWARE_PARAMETER_NAME, DOCUMENT_PRESERVE_CONTENT_PARAMETER_NAME, DOCUMENT_REPOSITIONING_PARAMETER_NAME, DOCUMENT_START_OFFSET_PARAMETER_NAME, DOCUMENT_STRING_CONTENT_PARAMETER_NAME, DOCUMENT_URL_PARAMETER_NAME
 
Constructor Summary
DatabaseDocumentImpl()
           
DatabaseDocumentImpl(Connection conn)
           
 
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
 Object getInitData__$$__(Object initData)
           
 Collection getLoadedAnnotationSets()
           
 Map getNamedAnnotationSets()
          Returns a map with the named annotation sets.
 LanguageResource getParent()
          Returns the parent LR of this LR.
 Collection getRemovedAnnotationSets()
           
 boolean isModified()
          Returns true of an LR has been modified since the last sync.
 boolean isResourceChanged(int changeType)
           
 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 setInitData__$$__(Object data)
           
 void setMarkupAware(Boolean newMarkupAware)
          Make the document markup-aware.
 void setName(String name)
          Sets the name of this resource
 void setNextNodeId(int nextID)
          Generate and return the next annotation ID
 void setParent(LanguageResource parentLR)
          Sets the parent LR of this LR.
 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, getCollectRepositioningInfo, getMarkupAware, getNextAnnotationId, getNextNodeId, getPreserveOriginalContent, getSourceUrl, getSourceUrlEndOffset, getSourceUrlOffsets, getSourceUrlStartOffset, getStringContent, hashCode, init, isValidOffset, isValidOffsetRange, isXmlChar, removeDocumentListener, resourceLoaded, resourceRenamed, resourceUnloaded, setCollectRepositioningInfo, setDataStore, setEncoding, setLRPersistenceId, setNextAnnotationId, setPreserveOriginalContent, setStringContent, toString, toXml, toXml, toXml
 
Methods inherited from class gate.creole.AbstractLanguageResource
getDataStore, getLRPersistenceId, 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.LanguageResource
getDataStore, getLRPersistenceId, sync
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures
 
Methods inherited from interface gate.util.NameBearer
getName
 

Constructor Detail

DatabaseDocumentImpl

public DatabaseDocumentImpl()

DatabaseDocumentImpl

public DatabaseDocumentImpl(Connection conn)
Method Detail

getContent

public DocumentContent getContent()
The content of the document: a String for text; MPEG for video; etc.
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.
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.
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.
Overrides:
getAnnotations in class DocumentImpl

setContent

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

setFeatures

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

setName

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

setNextNodeId

public void setNextNodeId(int nextID)
Generate and return the next annotation ID

isResourceChanged

public boolean isResourceChanged(int changeType)
Specified by:
isResourceChanged in interface EventAwareLanguageResource

setSourceUrl

public void setSourceUrl(URL sourceUrl)
Set method for the document's URL
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.
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.
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.
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.
Overrides:
cleanup in class DocumentImpl

resourceAdopted

public void resourceAdopted(DatastoreEvent evt)
Called by a datastore when a new resource has been adopted
Overrides:
resourceAdopted in class DocumentImpl

resourceDeleted

public void resourceDeleted(DatastoreEvent evt)
Called by a datastore when a resource has been deleted
Overrides:
resourceDeleted in class DocumentImpl

resourceWritten

public void resourceWritten(DatastoreEvent evt)
Called by a datastore when a resource has been wrote into the datastore
Overrides:
resourceWritten in class DocumentImpl

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 class: DocumentImpl
Removes one of the named annotation sets. Note that the default annotation set cannot be removed.
Overrides:
removeAnnotationSet in class DocumentImpl
Following copied from class: gate.corpora.DocumentImpl
Parameters:
name - the name of the annotation set to be removed

isModified

public boolean isModified()
Returns true of an LR has been modified since the last sync. Always returns false for transient LRs.
Overrides:
isModified in class AbstractLanguageResource

getParent

public LanguageResource getParent()
                           throws PersistenceException,
                                  SecurityException
Returns the parent LR of this LR. Only relevant for LRs that support shadowing. Most do not by default.
Overrides:
getParent in class AbstractLanguageResource

setParent

public void setParent(LanguageResource parentLR)
               throws PersistenceException,
                      SecurityException
Sets the parent LR of this LR. Only relevant for LRs that support shadowing. Most do not by default.
Overrides:
setParent in class AbstractLanguageResource

setInitData__$$__

public void setInitData__$$__(Object data)

getInitData__$$__

public Object getInitData__$$__(Object initData)