gate
Interface DataStore

All Superinterfaces:
FeatureBearer
All Known Implementing Classes:
SerialDataStore

public interface DataStore
extends FeatureBearer

Models all sorts of data storage.


Method Summary
 void addDatastoreListener(DatastoreListener l)
          Registers a new DatastoreListener with this datastore
 LanguageResource adopt(LanguageResource lr)
          Adopt a resource for persistence.
 void close()
          Close the data store.
 void create()
          Create a new data store.
 void delete()
          Delete the data store.
 void delete(String lrClassName, String lrId)
          Delete a resource from the data store.
 LanguageResource getLr(String lrClassName, String dataStoreInstanceId)
          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(String 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.
 URL 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.
 void removeDatastoreListener(DatastoreListener l)
          Removes a a previously registered DatastoreListener from the list listeners for this datastore
 void setAutoSaving(boolean autoSaving)
          Set method for the autosaving behaviour of the data store.
 void setStorageUrl(URL 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.
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, getName, setFeatures, setName
 

Method Detail

setStorageUrl

public void setStorageUrl(URL storageUrl)
                   throws PersistenceException
Set the URL for the underlying storage mechanism.

getStorageUrl

public URL getStorageUrl()
Get the URL for the underlying storage mechanism.

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.

open

public void open()
          throws PersistenceException
Open a connection to the data store.

close

public void close()
           throws PersistenceException
Close the data store.

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.

delete

public void delete(String lrClassName,
                   String lrId)
            throws PersistenceException
Delete a resource from the data store.
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
Save: synchonise the in-memory image of the LR with the persistent image.

setAutoSaving

public void setAutoSaving(boolean autoSaving)
                   throws UnsupportedOperationException
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.

isAutoSaving

public boolean isAutoSaving()
Get the autosaving behaviour of the LR.

adopt

public LanguageResource adopt(LanguageResource lr)
                       throws PersistenceException
Adopt a resource for persistence.

getLr

public LanguageResource getLr(String lrClassName,
                              String dataStoreInstanceId)
                       throws PersistenceException
Get a resource from the persistent store. Don't use this method - use Factory.createResource with DataStore and DataStoreInstanceId parameters set instead.

getLrTypes

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

getLrIds

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

getLrNames

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

getLrName

public String getLrName(String lrId)
                 throws PersistenceException
Get the name of an LR from its ID.

addDatastoreListener

public void addDatastoreListener(DatastoreListener l)
Registers a new DatastoreListener with this datastore

removeDatastoreListener

public void removeDatastoreListener(DatastoreListener l)
Removes a a previously registered DatastoreListener from the list listeners for this datastore