|
GATE Version 3.1-2270 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgate.util.AbstractFeatureBearer
gate.persist.JDBCDataStore
public abstract class JDBCDataStore
Field Summary | |
---|---|
protected AccessController |
ac
Security factory that contols access to objects in the datastore the security session is from this factory |
protected String |
datastoreComment
|
protected String |
dbSchema
|
protected int |
dbType
|
protected Vector |
dependentResources
resources that should be sync-ed if datastore is close()-d |
protected String |
iconName
|
protected Connection |
jdbcConn
jdbc connection, all access to the database is made through this connection |
protected String |
name
datastore name? |
protected Session |
session
security session identifying all access to the datastore |
Fields inherited from class gate.util.AbstractFeatureBearer |
---|
features |
Fields inherited from interface gate.DataStore |
---|
DATASTORE_FEATURE_NAME, LR_ID_FEATURE_NAME |
Constructor Summary | |
---|---|
protected |
JDBCDataStore()
Do not use this class directly - use one of the subclasses |
Method Summary | |
---|---|
protected LanguageResource |
_adopt(LanguageResource lr,
SecurityInfo secInfo,
boolean openNewTrans)
|
protected void |
_sync(LanguageResource lr,
boolean openNewTrans)
Save: synchonise the in-memory image of the LR with the persistent image. |
protected void |
_syncAddedAnnotations(Document doc,
AnnotationSet as,
Collection changes)
helper for sync() - never call directly |
protected void |
_syncAnnotations(Document doc)
helper for sync() - never call directly |
protected void |
_syncAnnotationSets(Document doc,
Collection removedSets,
Collection addedSets)
helper for sync() - never call directly |
protected void |
_syncChangedAnnotations(Document doc,
AnnotationSet as,
Collection changes)
helper for sync() - never call directly |
protected abstract void |
_syncDocumentContent(Document doc)
helper for sync() - never call directly |
protected abstract void |
_syncDocumentHeader(Document doc)
helper for sync() - never call directly |
protected abstract void |
_syncFeatures(LanguageResource lr)
helper for sync() - never call directly |
protected abstract void |
_syncLR(LanguageResource lr)
helper for sync() NEVER call directly |
protected void |
_syncRemovedAnnotations(Document doc,
AnnotationSet as,
Collection changes)
helper for sync() - never call directly |
protected abstract void |
_syncRemovedDocumentsFromCorpus(List docLRIDs,
Long corpLRID)
helper for sync() - never call directly |
void |
addDatastoreListener(DatastoreListener l)
Registers a new DatastoreListener with this datastore |
protected abstract void |
addDocumentToCorpus(Long docID,
Long corpID)
adds document to corpus in the database if the document is already part of the corpus nothing changes |
LanguageResource |
adopt(LanguageResource lr,
SecurityInfo secInfo)
Adopt a resource for persistence. |
void |
beginTrans()
starts a transaction note that if u're already in transaction context this will not open nested transaction i.e. many consecutive calls to beginTrans() make no difference if no commit/rollback is made meanwhile |
protected boolean |
canAccessLR(Long lrID,
int mode)
Checks if the user (identified by the sessionID) has some access (read/write) to the LR |
boolean |
canReadLR(Object lrID)
Checks if the user (identified by the sessionID) has read access to the LR |
boolean |
canWriteLR(Object lrID)
Checks if the user (identified by the sessionID) has write access to the LR |
void |
close()
Close the data store. |
void |
commitTrans()
commits transaction note that this will commit all the uncommited calls made so far |
void |
create()
Create a new data store. |
protected abstract void |
createAnnotationSet(Long lrID,
AnnotationSet aset)
|
protected Corpus |
createCorpus(Corpus corp,
SecurityInfo secInfo,
boolean newTransPerDocument)
creates a LR of type Corpus |
protected abstract Long |
createDoc(Long _lrID,
URL _docURL,
String _docEncoding,
Long _docStartOffset,
Long _docEndOffset,
Boolean _docIsMarkupAware,
Long _corpusID)
|
protected Document |
createDocument(Document doc,
Long corpusID,
SecurityInfo secInfo)
helper for adopt creates a LR of type Document |
protected Document |
createDocument(Document doc,
SecurityInfo secInfo)
helper for adopt creates a LR of type Document |
protected abstract void |
createFeatures(Long entityID,
int entityType,
FeatureMap features)
|
protected abstract void |
createFeaturesBulk(Long entityID,
int entityType,
FeatureMap features)
|
protected abstract Long |
createLR(String lrType,
String lrName,
SecurityInfo si,
Long lrParentID)
|
void |
datastoreClosed(CreoleEvent e)
Called when a DataStore has been closed |
void |
datastoreCreated(CreoleEvent e)
Called when a DataStore has been created |
void |
datastoreOpened(CreoleEvent e)
Called when a DataStore has been opened |
void |
delete()
Delete the data store. |
void |
delete(String lrClassName,
Object lrId)
Delete a resource from the data store. |
protected abstract void |
deleteCorpus(Long lrId)
helper method for delete() never call it directly beause proper events will not be fired |
protected abstract void |
deleteDocument(Long lrId)
helper method for delete() never call it directly beause proper events will not be fired |
void |
deleteSince(Long timestamp)
not used |
protected int |
findFeatureType(Object value)
--- |
abstract List |
findLrIds(List constraints)
Get a list of LRs that satisfy some set or restrictions |
abstract List |
findLrIds(List constraints,
String lrType)
Get a list of LRs that satisfy some set or restrictions and are of a particular type |
protected void |
fireResourceAdopted(DatastoreEvent e)
|
protected void |
fireResourceDeleted(DatastoreEvent e)
|
protected void |
fireResourceWritten(DatastoreEvent e)
|
String |
getComment()
Save: synchonise the in-memory image of the LR with the persistent image. |
String |
getDatabaseID()
--- |
String |
getIconName()
Returns the name of the icon to be used when this datastore is displayed in the GUI |
protected User |
getLockingUser(LanguageResource lr)
Releases the exlusive lock on a resource from the persistent store. |
protected User |
getLockingUser(Long lrID)
Releases the exlusive lock on a resource from the persistent store. |
LanguageResource |
getLr(String lrClassName,
Object lrPersistenceId)
Get a resource from the persistent store. |
List |
getLrIds(String lrType)
Get a list of the IDs of LRs of a particular type that are present. |
String |
getLrName(Object lrId)
Get the name of an LR from its ID. |
List |
getLrNames(String lrType)
Get a list of the names of LRs of a particular type that are present. |
List |
getLrTypes()
Get a list of the types of LR that are present in the data store. |
String |
getName()
Returns the name of this resource |
SecurityInfo |
getSecurityInfo(LanguageResource lr)
get security information for LR . |
Session |
getSession(Session s)
identify user using this datastore |
String |
getStorageUrl()
Get the URL for the underlying storage mechanism. |
boolean |
isAutoSaving()
Get the autosaving behaviour of the LR. |
void |
open()
Open a connection to the data store. |
protected String |
readDatabaseID()
reads the ID of the database every database should have unique string ID |
protected abstract FeatureMap |
readFeatures(Long entityID,
int entityType)
reads the features of an entity entities are of type LR or Annotation |
void |
removeDatastoreListener(DatastoreListener l)
Removes a a previously registered DatastoreListener
from the list listeners for this datastore |
void |
resourceLoaded(CreoleEvent e)
Called when a new Resource has been loaded into the system |
void |
resourceRenamed(Resource resource,
String oldName,
String newName)
Called when the creole register has renamed a resource.1 |
void |
resourceUnloaded(CreoleEvent e)
Called when a Resource has been removed from the system |
void |
rollbackTrans()
rollsback a transaction |
void |
setAutoSaving(boolean autoSaving)
Set method for the autosaving behaviour of the data store. |
void |
setName(String name)
Sets the name of this resource |
void |
setSession(Session s)
identify user using this datastore |
void |
setStorageUrl(String storageUrl)
Set the URL for the underlying storage mechanism. |
void |
sync(LanguageResource lr)
Save: synchonise the in-memory image of the LR with the persistent image. |
protected void |
syncCorpus(Corpus corp)
helper for sync() - saves a Corpus in the database |
protected void |
syncDocument(Document doc)
helper for sync() - saves a Document in the database |
Long |
timestamp()
not used |
protected void |
unloadLR(Long lrID)
unloads a LR from the GUI |
protected abstract void |
updateDocumentContent(Long docID,
DocumentContent content)
|
Methods inherited from class gate.util.AbstractFeatureBearer |
---|
getFeatures, setFeatures |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface gate.DataStore |
---|
lockLr, setSecurityInfo, unlockLr |
Methods inherited from interface gate.util.FeatureBearer |
---|
getFeatures, setFeatures |
Field Detail |
---|
protected String dbSchema
protected int dbType
protected String datastoreComment
protected String iconName
protected Session session
protected String name
protected transient Connection jdbcConn
protected transient AccessController ac
protected transient Vector dependentResources
Constructor Detail |
---|
protected JDBCDataStore()
Method Detail |
---|
public String getComment()
getComment
in interface DataStore
public String getIconName()
getIconName
in interface DataStore
public String getLrName(Object lrId) throws PersistenceException
getLrName
in interface DataStore
PersistenceException
public void setStorageUrl(String storageUrl) throws PersistenceException
setStorageUrl
in interface DataStore
PersistenceException
public String getStorageUrl()
getStorageUrl
in interface DataStore
public void create() throws PersistenceException, UnsupportedOperationException
create
in interface DataStore
PersistenceException
UnsupportedOperationException
public void open() throws PersistenceException
open
in interface DataStore
PersistenceException
public void close() throws PersistenceException
close
in interface DataStore
PersistenceException
public void delete() throws PersistenceException, UnsupportedOperationException
delete
in interface DataStore
PersistenceException
UnsupportedOperationException
public void delete(String lrClassName, Object lrId) throws PersistenceException, SecurityException
delete
in interface DataStore
lrId
- a data-store specific unique identifier for the resourcelrClassName
- class name of the type of resource
PersistenceException
SecurityException
public void sync(LanguageResource lr) throws PersistenceException, SecurityException
sync
in interface DataStore
PersistenceException
SecurityException
public void setAutoSaving(boolean autoSaving) throws UnsupportedOperationException, PersistenceException
setAutoSaving
in interface DataStore
UnsupportedOperationException
PersistenceException
public boolean isAutoSaving()
isAutoSaving
in interface DataStore
public LanguageResource adopt(LanguageResource lr, SecurityInfo secInfo) throws PersistenceException, SecurityException
adopt
in interface DataStore
PersistenceException
SecurityException
protected LanguageResource _adopt(LanguageResource lr, SecurityInfo secInfo, boolean openNewTrans) throws PersistenceException, SecurityException
PersistenceException
SecurityException
public List getLrTypes() throws PersistenceException
getLrTypes
in interface DataStore
PersistenceException
public List getLrIds(String lrType) throws PersistenceException
getLrIds
in interface DataStore
PersistenceException
public List getLrNames(String lrType) throws PersistenceException
getLrNames
in interface DataStore
PersistenceException
public boolean canReadLR(Object lrID) throws PersistenceException, SecurityException
canReadLR
in interface DataStore
PersistenceException
SecurityException
public boolean canWriteLR(Object lrID) throws PersistenceException, SecurityException
canWriteLR
in interface DataStore
PersistenceException
SecurityException
protected boolean canAccessLR(Long lrID, int mode) throws PersistenceException, SecurityException
PersistenceException
SecurityException
public void beginTrans() throws PersistenceException, UnsupportedOperationException
beginTrans
in interface DatabaseDataStore
PersistenceException
UnsupportedOperationException
public void commitTrans() throws PersistenceException, UnsupportedOperationException
commitTrans
in interface DatabaseDataStore
PersistenceException
UnsupportedOperationException
public void rollbackTrans() throws PersistenceException, UnsupportedOperationException
rollbackTrans
in interface DatabaseDataStore
PersistenceException
UnsupportedOperationException
public Long timestamp() throws PersistenceException
timestamp
in interface DatabaseDataStore
PersistenceException
public void deleteSince(Long timestamp) throws PersistenceException
deleteSince
in interface DatabaseDataStore
PersistenceException
public void setName(String name)
setName
in interface NameBearer
public String getName()
getName
in interface NameBearer
protected int findFeatureType(Object value)
public String getDatabaseID()
getDatabaseID
in interface DatabaseDataStore
protected String readDatabaseID() throws PersistenceException
PersistenceException
public void removeDatastoreListener(DatastoreListener l)
DatastoreListener
from the list listeners for this datastore
removeDatastoreListener
in interface DataStore
public void addDatastoreListener(DatastoreListener l)
DatastoreListener
with this datastore
addDatastoreListener
in interface DataStore
protected void fireResourceAdopted(DatastoreEvent e)
protected void fireResourceDeleted(DatastoreEvent e)
protected void fireResourceWritten(DatastoreEvent e)
public void resourceLoaded(CreoleEvent e)
CreoleListener
Resource
has been loaded into the system
resourceLoaded
in interface CreoleListener
public void resourceRenamed(Resource resource, String oldName, String newName)
CreoleListener
resourceRenamed
in interface CreoleListener
public void resourceUnloaded(CreoleEvent e)
CreoleListener
Resource
has been removed from the system
resourceUnloaded
in interface CreoleListener
public void datastoreOpened(CreoleEvent e)
CreoleListener
DataStore
has been opened
datastoreOpened
in interface CreoleListener
public void datastoreCreated(CreoleEvent e)
CreoleListener
DataStore
has been created
datastoreCreated
in interface CreoleListener
public void datastoreClosed(CreoleEvent e)
CreoleListener
DataStore
has been closed
datastoreClosed
in interface CreoleListener
public void setSession(Session s) throws SecurityException
setSession
in interface DataStore
SecurityException
public Session getSession(Session s) throws SecurityException
getSession
in interface DataStore
SecurityException
public abstract List findLrIds(List constraints) throws PersistenceException
findLrIds
in interface DataStore
PersistenceException
public abstract List findLrIds(List constraints, String lrType) throws PersistenceException
findLrIds
in interface DataStore
PersistenceException
public SecurityInfo getSecurityInfo(LanguageResource lr) throws PersistenceException
getSecurityInfo
in interface DataStore
PersistenceException
protected Corpus createCorpus(Corpus corp, SecurityInfo secInfo, boolean newTransPerDocument) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected Document createDocument(Document doc, SecurityInfo secInfo) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected Document createDocument(Document doc, Long corpusID, SecurityInfo secInfo) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected abstract Long createLR(String lrType, String lrName, SecurityInfo si, Long lrParentID) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected abstract Long createDoc(Long _lrID, URL _docURL, String _docEncoding, Long _docStartOffset, Long _docEndOffset, Boolean _docIsMarkupAware, Long _corpusID) throws PersistenceException
PersistenceException
protected abstract void updateDocumentContent(Long docID, DocumentContent content) throws PersistenceException
PersistenceException
protected abstract void createAnnotationSet(Long lrID, AnnotationSet aset) throws PersistenceException
PersistenceException
protected abstract void createFeaturesBulk(Long entityID, int entityType, FeatureMap features) throws PersistenceException
PersistenceException
protected abstract void createFeatures(Long entityID, int entityType, FeatureMap features) throws PersistenceException
PersistenceException
protected void _sync(LanguageResource lr, boolean openNewTrans) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected User getLockingUser(LanguageResource lr) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected User getLockingUser(Long lrID) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected void syncCorpus(Corpus corp) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected void syncDocument(Document doc) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected abstract void _syncLR(LanguageResource lr) throws PersistenceException, SecurityException
PersistenceException
SecurityException
protected abstract void _syncDocumentHeader(Document doc) throws PersistenceException
PersistenceException
protected abstract void _syncDocumentContent(Document doc) throws PersistenceException
PersistenceException
protected abstract void _syncFeatures(LanguageResource lr) throws PersistenceException
PersistenceException
protected void _syncAnnotationSets(Document doc, Collection removedSets, Collection addedSets) throws PersistenceException
PersistenceException
protected void _syncAnnotations(Document doc) throws PersistenceException
PersistenceException
protected void _syncAddedAnnotations(Document doc, AnnotationSet as, Collection changes) throws PersistenceException
PersistenceException
protected void _syncRemovedAnnotations(Document doc, AnnotationSet as, Collection changes) throws PersistenceException
PersistenceException
protected void _syncChangedAnnotations(Document doc, AnnotationSet as, Collection changes) throws PersistenceException
PersistenceException
public LanguageResource getLr(String lrClassName, Object lrPersistenceId) throws PersistenceException, SecurityException
getLr
in interface DataStore
PersistenceException
SecurityException
protected abstract FeatureMap readFeatures(Long entityID, int entityType) throws PersistenceException
PersistenceException
protected abstract void deleteDocument(Long lrId) throws PersistenceException
PersistenceException
protected abstract void deleteCorpus(Long lrId) throws PersistenceException
PersistenceException
protected void unloadLR(Long lrID) throws GateException
GateException
protected abstract void _syncRemovedDocumentsFromCorpus(List docLRIDs, Long corpLRID) throws PersistenceException
PersistenceException
protected abstract void addDocumentToCorpus(Long docID, Long corpID) throws PersistenceException, SecurityException
PersistenceException
SecurityException
|
GATE Version 3.1-2270 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |