gate.corpora
Class DatabaseCorpusImpl

java.lang.Object
  |
  +--gate.util.AbstractFeatureBearer
        |
        +--gate.creole.AbstractResource
              |
              +--gate.creole.AbstractLanguageResource
                    |
                    +--gate.corpora.CorpusImpl
                          |
                          +--gate.corpora.DatabaseCorpusImpl
All Implemented Interfaces:
Collection, Corpus, CreoleListener, DatastoreListener, EventAwareCorpus, EventAwareLanguageResource, EventListener, FeatureBearer, LanguageResource, List, NameBearer, Resource, Serializable

public class DatabaseCorpusImpl
extends CorpusImpl
implements DatastoreListener, EventAwareCorpus

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface gate.corpora.EventAwareLanguageResource
DOC_CONTENT, DOC_MAIN, RES_FEATURES, RES_NAME
 
Fields inherited from interface gate.Corpus
CORPUS_DOCLIST_PARAMETER_NAME, CORPUS_NAME_PARAMETER_NAME
 
Constructor Summary
DatabaseCorpusImpl()
           
DatabaseCorpusImpl(String _name, DatabaseDataStore _ds, Long _persistenceID, FeatureMap _features, Vector _dbDocs)
           
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 boolean addAll(int index, Collection c)
           
 void cleanup()
          Overriden to remove the features listener, when the document is closed.
 boolean contains(Object o)
           
 int findDocument(Document doc)
           
 Object get(int index)
          returns a document in the coprus by index
 String getDocumentName(int index)
          Gets the name of a document in this corpus.
 List getDocumentNames()
          Gets the names of the documents in this corpus.
 Object getInitData__$$__(Object initData)
           
 List getLoadedDocuments()
           
 List getRemovedDocuments()
           
 boolean isModified()
          Returns true of an LR has been modified since the last sync.
 boolean isResourceChanged(int changeType)
           
 Iterator iterator()
           
 Object remove(int index)
           
 boolean remove(Object obj)
           
 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 setFeatures(FeatureMap features)
          Set the feature set
 void setInitData__$$__(Object data)
           
 void setName(String name)
          Sets the name of this resource
 
Methods inherited from class gate.corpora.CorpusImpl
addCorpusListener, clear, containsAll, datastoreClosed, datastoreCreated, datastoreOpened, equals, getDocumentsList, hashCode, indexOf, init, isDocumentLoaded, isEmpty, lastIndexOf, listIterator, listIterator, populate, populate, removeAll, removeCorpusListener, resourceLoaded, resourceRenamed, resourceUnloaded, retainAll, set, setDocumentsList, size, subList, toArray, toArray, unloadDocument
 
Methods inherited from class gate.creole.AbstractLanguageResource
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, 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, toString, wait, wait, wait
 
Methods inherited from interface gate.LanguageResource
getDataStore, getLRPersistenceId, getParent, setDataStore, setLRPersistenceId, setParent, 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

DatabaseCorpusImpl

public DatabaseCorpusImpl()

DatabaseCorpusImpl

public DatabaseCorpusImpl(String _name,
                          DatabaseDataStore _ds,
                          Long _persistenceID,
                          FeatureMap _features,
                          Vector _dbDocs)
Method Detail

add

public boolean add(Object o)
Specified by:
add in interface List
Overrides:
add in class CorpusImpl

add

public void add(int index,
                Object element)
Specified by:
add in interface List
Overrides:
add in class CorpusImpl

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class CorpusImpl

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class CorpusImpl

resourceAdopted

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

Specified by:
resourceAdopted in interface DatastoreListener

resourceDeleted

public void resourceDeleted(DatastoreEvent evt)
Description copied from interface: DatastoreListener
Called by a datastore when a resource has been deleted

Specified by:
resourceDeleted in interface DatastoreListener

resourceWritten

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

Specified by:
resourceWritten in interface DatastoreListener

isResourceChanged

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

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

setName

public void setName(String name)
Sets the name of this resource

Specified by:
setName in interface NameBearer
Overrides:
setName in class AbstractResource

setFeatures

public void setFeatures(FeatureMap features)
Set the feature set

Specified by:
setFeatures in interface FeatureBearer
Overrides:
setFeatures in class AbstractFeatureBearer

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 CorpusImpl

setInitData__$$__

public void setInitData__$$__(Object data)

getInitData__$$__

public Object getInitData__$$__(Object initData)

getDocumentNames

public List getDocumentNames()
Gets the names of the documents in this corpus.

Specified by:
getDocumentNames in interface Corpus
Overrides:
getDocumentNames in class CorpusImpl
Returns:
a List of Strings representing the names of the documents in this corpus.

getDocumentName

public String getDocumentName(int index)
Gets the name of a document in this corpus.

Specified by:
getDocumentName in interface Corpus
Overrides:
getDocumentName in class CorpusImpl
Parameters:
index - the index of the document
Returns:
a String value representing the name of the document at index in this corpus.


get

public Object get(int index)
returns a document in the coprus by index

Specified by:
get in interface List
Overrides:
get in class CorpusImpl
Parameters:
index - the index of the document
Returns:
an Object value representing DatabaseDocumentImpl

remove

public Object remove(int index)
Specified by:
remove in interface List
Overrides:
remove in class CorpusImpl

remove

public boolean remove(Object obj)
Specified by:
remove in interface List
Overrides:
remove in class CorpusImpl

findDocument

public int findDocument(Document doc)

contains

public boolean contains(Object o)
Specified by:
contains in interface List
Overrides:
contains in class CorpusImpl

iterator

public Iterator iterator()
Specified by:
iterator in interface List
Overrides:
iterator in class CorpusImpl

getLoadedDocuments

public List getLoadedDocuments()
Specified by:
getLoadedDocuments in interface EventAwareCorpus

getRemovedDocuments

public List getRemovedDocuments()
Specified by:
getRemovedDocuments in interface EventAwareCorpus