gate.persist
Class OracleDataStore

java.lang.Object
  |
  +--gate.util.AbstractFeatureBearer
        |
        +--gate.persist.JDBCDataStore
              |
              +--gate.persist.OracleDataStore
All Implemented Interfaces:
CreoleListener, DatabaseDataStore, DataStore, EventListener, FeatureBearer, NameBearer, Serializable

public class OracleDataStore
extends JDBCDataStore

See Also:
Serialized Form

Field Summary
static String DS_COMMENT
          Name of this resource
static String DS_ICON_NAME
          the icon for this resource
 
Fields inherited from interface gate.DataStore
DATASTORE_FEATURE_NAME, LR_ID_FEATURE_NAME
 
Constructor Summary
OracleDataStore()
          default constructor - just call the super constructor (may change in the future)
 
Method Summary
 LanguageResource adopt(LanguageResource lr, SecurityInfo secInfo)
          Adopt a resource for persistence.
 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 create()
          Create a new data store.
 void delete()
          Delete the data store.
 void delete(String lrClassName, Object lrId)
          Delete a resource from the data store.
 boolean equals(Object obj)
          checks if two databases are identical
 List findLrIds(List constraints)
          Get a list of LRs that satisfy some set or restrictions
 List findLrIds(List constraints, String lrType)
          Get a list of LRs IDs that satisfy some set or restrictions and are of a particular type
 List findLrIds(List constraints, String lrType, List orderByConstraints, int limitcount)
          Get a list of LRs IDs that satisfy some set or restrictions and are of a particular type
 String getComment()
          Save: synchonise the in-memory image of the LR with the persistent image.
 String getIconName()
          Returns the name of the icon to be used when this datastore is displayed in the GUI
 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.
 long getLrsCount(List constraints, String lrType)
          Return count of LRs which matches the constraints.
 List getLrTypes()
          Get a list of the types of LR that are present in the data store.
 SecurityInfo getSecurityInfo(LanguageResource lr)
          get security information for LR .
 String getStorageUrl()
          Get the URL for the underlying storage mechanism.
 boolean isAutoSaving()
          Get the autosaving behaviour of the LR.
 boolean lockLr(LanguageResource lr)
          Try to acquire exlusive lock on a resource from the persistent store.
 void open()
          Open a connection to the data store.
static Object readBLOB(Blob src)
          reads the content of the specified BLOB object and returns the object contained.
static void readCLOB(Clob src, StringBuffer dest)
          reads the content of a CLOB into the specified StringBuffer
 void setAutoSaving(boolean autoSaving)
          Set method for the autosaving behaviour of the data store.
 void setSecurityInfo(LanguageResource lr, SecurityInfo si)
          set security information for LR .
 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.
 Long timestamp()
          Gets a timestamp marker that will be used for all changes made in the database so that subsequent calls to deleteSince() could restore (partly) the database state as it was before the update.
 void unlockLr(LanguageResource lr)
          Releases the exlusive lock on a resource from the persistent store.
static void writeBLOB(Object src, Blob dest)
          writes the specified object into the BLOB NOTE: the object should be serializable
static void writeCLOB(StringBuffer src, Clob dest)
          writes the content of a StringBuffer into the specified CLOB object
static void writeCLOB(String src, Clob dest)
          writes the content of a String into the specified CLOB object
 
Methods inherited from class gate.persist.JDBCDataStore
addDatastoreListener, beginTrans, commitTrans, datastoreClosed, datastoreCreated, datastoreOpened, deleteSince, getDatabaseID, getName, getSession, removeDatastoreListener, resourceLoaded, resourceRenamed, resourceUnloaded, rollbackTrans, setDriver, setName, setSession
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 

Field Detail

DS_COMMENT

public static final String DS_COMMENT
Name of this resource

DS_ICON_NAME

public static final String DS_ICON_NAME
the icon for this resource
Constructor Detail

OracleDataStore

public OracleDataStore()
default constructor - just call the super constructor (may change in the future)
Method Detail

getComment

public String getComment()
Save: synchonise the in-memory image of the LR with the persistent image.
Overrides:
getComment in class JDBCDataStore

getIconName

public String getIconName()
Returns the name of the icon to be used when this datastore is displayed in the GUI
Overrides:
getIconName in class JDBCDataStore

getLrName

public String getLrName(Object lrId)
                 throws PersistenceException
Get the name of an LR from its ID.
Overrides:
getLrName in class JDBCDataStore

setStorageUrl

public void setStorageUrl(String storageUrl)
                   throws PersistenceException
Set the URL for the underlying storage mechanism.
Overrides:
setStorageUrl in class JDBCDataStore

getStorageUrl

public String getStorageUrl()
Get the URL for the underlying storage mechanism.
Overrides:
getStorageUrl in class JDBCDataStore

create

public void create()
            throws PersistenceException,
                   UnsupportedOperationException
Create a new data store. NOTE: for some data stores creation is an system administrator task; in such cases this method will throw an UnsupportedOperationException.
Overrides:
create in class JDBCDataStore

open

public void open()
          throws PersistenceException
Open a connection to the data store.
Overrides:
open in class JDBCDataStore

close

public void close()
           throws PersistenceException
Close the data store.
Overrides:
close in class JDBCDataStore

delete

public void delete()
            throws PersistenceException,
                   UnsupportedOperationException
Delete the data store. NOTE: for some data stores deletion is an system administrator task; in such cases this method will throw an UnsupportedOperationException.
Overrides:
delete in class JDBCDataStore

delete

public void delete(String lrClassName,
                   Object lrId)
            throws PersistenceException,
                   SecurityException
Delete a resource from the data store.
Overrides:
delete in class JDBCDataStore
Parameters:
lrId - a data-store specific unique identifier for the resource
lrClassName - class name of the type of resource

sync

public void sync(LanguageResource lr)
          throws PersistenceException,
                 SecurityException
Save: synchonise the in-memory image of the LR with the persistent image.
Overrides:
sync in class JDBCDataStore

setAutoSaving

public void setAutoSaving(boolean autoSaving)
                   throws UnsupportedOperationException,
                          PersistenceException
Set method for the autosaving behaviour of the data store. NOTE: many types of datastore have no auto-save function, in which case this will throw an UnsupportedOperationException.
Overrides:
setAutoSaving in class JDBCDataStore

isAutoSaving

public boolean isAutoSaving()
Get the autosaving behaviour of the LR.
Overrides:
isAutoSaving in class JDBCDataStore

adopt

public LanguageResource adopt(LanguageResource lr,
                              SecurityInfo secInfo)
                       throws PersistenceException,
                              SecurityException
Adopt a resource for persistence.
Overrides:
adopt in class JDBCDataStore

getLr

public LanguageResource getLr(String lrClassName,
                              Object lrPersistenceId)
                       throws PersistenceException,
                              SecurityException
Get a resource from the persistent store. Don't use this method - use Factory.createResource with DataStore and DataStoreInstanceId parameters set instead.
Overrides:
getLr in class JDBCDataStore

getLrTypes

public List getLrTypes()
                throws PersistenceException
Get a list of the types of LR that are present in the data store.
Overrides:
getLrTypes in class JDBCDataStore

getLrIds

public List getLrIds(String lrType)
              throws PersistenceException
Get a list of the IDs of LRs of a particular type that are present.
Overrides:
getLrIds in class JDBCDataStore

getLrNames

public List getLrNames(String lrType)
                throws PersistenceException
Get a list of the names of LRs of a particular type that are present.
Overrides:
getLrNames in class JDBCDataStore

timestamp

public Long timestamp()
               throws PersistenceException
Gets a timestamp marker that will be used for all changes made in the database so that subsequent calls to deleteSince() could restore (partly) the database state as it was before the update. NOTE: Restoring the previous state may not be possible at all (i.e. if DELETE is performed)
Overrides:
timestamp in class JDBCDataStore

canReadLR

public boolean canReadLR(Object lrID)
                  throws PersistenceException,
                         SecurityException
Checks if the user (identified by the sessionID) has read access to the LR
Overrides:
canReadLR in class JDBCDataStore

canWriteLR

public boolean canWriteLR(Object lrID)
                   throws PersistenceException,
                          SecurityException
Checks if the user (identified by the sessionID) has write access to the LR
Overrides:
canWriteLR in class JDBCDataStore

readCLOB

public static void readCLOB(Clob src,
                            StringBuffer dest)
                     throws SQLException,
                            IOException
reads the content of a CLOB into the specified StringBuffer

writeCLOB

public static void writeCLOB(String src,
                             Clob dest)
                      throws SQLException,
                             IOException
writes the content of a String into the specified CLOB object

writeCLOB

public static void writeCLOB(StringBuffer src,
                             Clob dest)
                      throws SQLException,
                             IOException
writes the content of a StringBuffer into the specified CLOB object

readBLOB

public static Object readBLOB(Blob src)
                       throws SQLException,
                              IOException,
                              ClassNotFoundException
reads the content of the specified BLOB object and returns the object contained. NOTE: the BLOB is expected to contain serializable objects, not just any binary stream

writeBLOB

public static void writeBLOB(Object src,
                             Blob dest)
                      throws SQLException,
                             IOException
writes the specified object into the BLOB NOTE: the object should be serializable

getSecurityInfo

public SecurityInfo getSecurityInfo(LanguageResource lr)
                             throws PersistenceException
get security information for LR .

setSecurityInfo

public void setSecurityInfo(LanguageResource lr,
                            SecurityInfo si)
                     throws PersistenceException,
                            SecurityException
set security information for LR .

equals

public boolean equals(Object obj)
checks if two databases are identical
Overrides:
equals in class Object
See Also:
NOTE: the same database may be represented by different OracleDataStore instances but the IDs will be the same

lockLr

public boolean lockLr(LanguageResource lr)
               throws PersistenceException,
                      SecurityException
Try to acquire exlusive lock on a resource from the persistent store. Always call unlockLR() when the lock is no longer needed

unlockLr

public void unlockLr(LanguageResource lr)
              throws PersistenceException,
                     SecurityException
Releases the exlusive lock on a resource from the persistent store.

findLrIds

public List findLrIds(List constraints)
               throws PersistenceException
Get a list of LRs that satisfy some set or restrictions
Overrides:
findLrIds in class JDBCDataStore
Parameters:
constraints - list of Restriction objects

findLrIds

public List findLrIds(List constraints,
                      String lrType)
               throws PersistenceException
Get a list of LRs IDs that satisfy some set or restrictions and are of a particular type
Overrides:
findLrIds in class JDBCDataStore
Parameters:
constraints - list of Restriction objects
lrType - type of Lrs. DBHelper.DOCUMENT_CLASS or DBHelper.CORPUS_CLASS

findLrIds

public List findLrIds(List constraints,
                      String lrType,
                      List orderByConstraints,
                      int limitcount)
               throws PersistenceException
Get a list of LRs IDs that satisfy some set or restrictions and are of a particular type
Parameters:
constraints - list of Restriction objects
lrType - type of Lrs. DBHelper.DOCUMENT_CLASS or DBHelper.CORPUS_CLASS
orderByConstraints - liat of OrderByRestriction objects
limitcount - limit returning objects -1 for unlimited

getLrsCount

public long getLrsCount(List constraints,
                        String lrType)
                 throws PersistenceException
Return count of LRs which matches the constraints.
Parameters:
constraints - list of Restriction objects
lrType - type of Lrs. DBHelper.DOCUMENT_CLASS or DBHelper.CORPUS_CLASS