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

Inner Class Summary
private  class DatabaseCorpusImpl.DatabaseCorpusIterator
           
(package private)  class DatabaseCorpusImpl.EventsHandler
          All the events from the features are handled by this inner class.
 
Inner classes inherited from class gate.corpora.CorpusImpl
CorpusImpl.VerboseList
 
Field Summary
private static boolean DEBUG
          Debug flag
protected  List documentData
           
protected  DatabaseCorpusImpl.EventsHandler eventHandler
          The listener for the events coming from the features.
private  boolean featuresChanged
           
private  boolean nameChanged
           
protected  List removedDocuments
           
 
Fields inherited from class gate.corpora.CorpusImpl
corpusListeners, documentsList, serialVersionUID, supportList
 
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.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)
           
private  boolean isValidForAdoption(LanguageResource lr)
           
 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, clearDocList, containsAll, datastoreClosed, datastoreCreated, datastoreOpened, equals, fireDocumentAdded, fireDocumentRemoved, 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
, clone, finalize, getClass, notify, notifyAll, registerNatives, 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
 

Field Detail

DEBUG

private static final boolean DEBUG
Debug flag

featuresChanged

private boolean featuresChanged

nameChanged

private boolean nameChanged

eventHandler

protected DatabaseCorpusImpl.EventsHandler eventHandler
The listener for the events coming from the features.

documentData

protected List documentData

removedDocuments

protected List removedDocuments
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)
Overrides:
add in class CorpusImpl

add

public void add(int index,
                Object element)
Overrides:
add in class CorpusImpl

addAll

public boolean addAll(Collection c)
Overrides:
addAll in class CorpusImpl

addAll

public boolean addAll(int index,
                      Collection c)
Overrides:
addAll in class CorpusImpl

isValidForAdoption

private boolean isValidForAdoption(LanguageResource lr)

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.
Overrides:
isModified in class AbstractLanguageResource

setName

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

setFeatures

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

cleanup

public void cleanup()
Overriden to remove the features listener, when the document is closed.
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.
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.
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
Overrides:
get in class CorpusImpl
Parameters:
index - the index of the document
Returns:
an Object value representing DatabaseDocumentImpl

remove

public Object remove(int index)
Overrides:
remove in class CorpusImpl

remove

public boolean remove(Object obj)
Overrides:
remove in class CorpusImpl

findDocument

public int findDocument(Document doc)

contains

public boolean contains(Object o)
Overrides:
contains in class CorpusImpl

iterator

public Iterator iterator()
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