GATE
Version 3.1-2270

gate.corpora
Class DatabaseDocumentImpl

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

public class DatabaseDocumentImpl
extends DocumentImpl
implements EventAwareDocument

See Also:
Serialized Form

Field Summary
protected  int dbType
           
protected  gate.corpora.DatabaseDocumentImpl.EventsHandler eventHandler
          The listener for the events coming from the features.
 
Fields inherited from class gate.corpora.DocumentImpl
content, defaultAnnots, encoding, markupAware, namedAnnotSets, nextAnnotationId, nextNodeId, sourceUrl, sourceUrlEndOffset, sourceUrlStartOffset
 
Fields inherited from class gate.creole.AbstractLanguageResource
dataStore, lrPersistentId
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
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
 
Fields inherited from interface gate.SimpleDocument
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()
           
 Resource init()
          Initialise this resource, and return it.
 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)
           
 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, fireAnnotationSetAdded, fireAnnotationSetRemoved, fireContentEdited, getAnnotationSetNames, getCollectRepositioningInfo, getFeatures, getMarkupAware, getNextAnnotationId, getNextNodeId, getOrderingString, getPreserveOriginalContent, getSourceUrl, getSourceUrlEndOffset, getSourceUrlOffsets, getSourceUrlStartOffset, getStringContent, isValidOffset, isValidOffsetRange, isXmlChar, removeDocumentListener, resourceLoaded, resourceRenamed, resourceUnloaded, setCollectRepositioningInfo, setDataStore, setDefaultAnnotations, 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, getBeanInfo, getName, getParameterValue, getParameterValue, removeResourceListeners, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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.NameBearer
getName
 

Field Detail

dbType

protected int dbType

eventHandler

protected gate.corpora.DatabaseDocumentImpl.EventsHandler eventHandler
The listener for the events coming from the features.

Constructor Detail

DatabaseDocumentImpl

public DatabaseDocumentImpl()

DatabaseDocumentImpl

public DatabaseDocumentImpl(Connection conn)
                     throws PersistenceException
Throws:
PersistenceException
Method Detail

getContent

public DocumentContent getContent()
The content of the document: a String for text; MPEG for video; etc.

Specified by:
getContent in interface SimpleDocument
Overrides:
getContent in class DocumentImpl

getEncoding

public String getEncoding()
Get the encoding of the document content source

Specified by:
getEncoding in interface TextualDocument
Overrides:
getEncoding in class DocumentImpl
Returns:
a String value.

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 SimpleDocument
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 SimpleDocument
Overrides:
getAnnotations in class DocumentImpl

setContent

public void setContent(DocumentContent content)
Set method for the document content

Specified by:
setContent in interface SimpleDocument
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

setNextNodeId

public void setNextNodeId(int nextID)

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

Specified by:
setSourceUrl in interface SimpleDocument
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:
newMarkupAware - 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
Overrides:
resourceAdopted in class DocumentImpl

resourceDeleted

public void resourceDeleted(DatastoreEvent evt)
Called by a datastore when a resource has been deleted

Specified by:
resourceDeleted in interface DatastoreListener
Overrides:
resourceDeleted in class DocumentImpl

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
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.

Specified by:
removeAnnotationSet in interface SimpleDocument
Overrides:
removeAnnotationSet in class 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.

Specified by:
isModified in interface LanguageResource
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.

Specified by:
getParent in interface LanguageResource
Overrides:
getParent in class AbstractLanguageResource
Throws:
PersistenceException
SecurityException

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.

Specified by:
setParent in interface LanguageResource
Overrides:
setParent in class AbstractLanguageResource
Throws:
PersistenceException
SecurityException

setInitData__$$__

public void setInitData__$$__(Object data)
                       throws PersistenceException,
                              InvalidOffsetException
Throws:
PersistenceException
InvalidOffsetException

getInitData__$$__

public Object getInitData__$$__(Object initData)

init

public Resource init()
              throws ResourceInstantiationException
Initialise this resource, and return it.

Specified by:
init in interface Resource
Overrides:
init in class DocumentImpl
Throws:
ResourceInstantiationException

GATE
Version 3.1-2270