|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.caleigo.core.AbstractDataService
org.caleigo.core.service.MemoryDataService
MemoryDataService provides a simple implementation of the IDataService interface that can be used to store entities in a non-persistent memory cache. By overiding the loadEntitySelection and storeEntitySelection entity pesistance can be added in a simple way. Note that the class is not suitable to store sensitive data. The class does not verify foreign keys and should only be used for temporary storage and/or for test or demonstration purposes. Note also that transaction handlig is currently not supported.
Nested Class Summary | |
protected class |
MemoryDataService.DataTransaction
|
protected class |
MemoryDataService.DefaultSelectionHolder
|
protected static interface |
MemoryDataService.ISelectionHolder
|
Nested classes inherited from class org.caleigo.core.AbstractDataService |
AbstractDataService.AbstractDataTransaction |
Field Summary | |
protected java.util.Map |
mTableSelectionMap
|
Fields inherited from class org.caleigo.core.AbstractDataService |
DEFAULT_TIMEOUT |
Constructor Summary | |
MemoryDataService(IDataSourceDescriptor dataSourceDescriptor)
|
|
MemoryDataService(IDataSourceDescriptor dataSourceDescriptor,
java.lang.Object serviceIdentity)
|
Method Summary | |
boolean |
backupTo(java.io.File backupFile)
Creates a complete backup of the called MemoryDataService to the provided file. |
boolean |
backupTo(java.io.File backupFile,
IEntityDescriptor[] descriptorArray)
Creates a backup of the tables defined by the provided descriptor array in the called MemoryDataService to the provided backup file. |
static boolean |
copyDataSource(IDataService source,
MemoryDataService target)
Help method that makes a complete copy of the source data to the targeted MemoryDataService. |
protected MemoryDataService.ISelectionHolder |
createSelectionHolder(ISelection tableSelection)
Can be overriden to provide a smarter ISelectionHolder class. |
protected void |
executeDelete(IEntity entity)
|
protected void |
executeInsert(IEntity entity)
|
protected void |
executeLoad(IEntity entity,
Qualifier qualifier)
|
protected void |
executeQuery(DataQuery query,
ISelection selection)
|
protected void |
executeUpdate(IEntity entity,
Qualifier qualifier)
|
protected void |
finalize()
|
protected ISelection |
getTableSelection(IEntityDescriptor entityDescriptor)
|
boolean |
isAutGenerateEnabled()
Access method that returns true if autogeneration of identity fields with the autogen field flags set is enabled. |
boolean |
isSyncronized()
|
protected ISelection |
loadTableSelection(IEntityDescriptor entityDescriptor)
This method can be overriden to provide a simple persistent storage for the MemoryDataService. |
protected void |
markTableAsChanged(IEntityDescriptor entityDescriptor)
|
IDataTransaction |
newTransaction()
Returns a new IDataTransaction object that can be used to batch data operations and wrap them in a transaction. |
boolean |
ping()
Should return true if the service is online and reponding to calls. |
boolean |
restoreFrom(java.io.File backupFile)
Restores data from a backup file created by the backupTo method. |
boolean |
restoreFrom(java.io.File backupFile,
IEntityDescriptor[] descriptorArray,
boolean addDeleted)
Restores data from a backup file created by the backupTo method. |
boolean |
restoreFromURL(java.net.URL backupURL)
|
boolean |
restoreFromURL(java.net.URL backupURL,
IEntityDescriptor[] descriptorArray,
boolean addDeleted)
|
void |
setAutGenerateEnabled(boolean enabled)
Mutation method that controls true if autogeneration of identity fields with the autogen field flags should be enabled. |
void |
setSyncronized(boolean syncronize)
|
protected void |
storeTableSelection(ISelection tableSelection)
This method can be overriden to provide a simple persistent storage for the MemoryDataService. |
boolean |
syncronize()
Can be called to syncronize changes against any persistent storage provided by a subclass. |
Methods inherited from class org.caleigo.core.AbstractDataService |
checkEntityAsDeletable, checkEntityAsStorable, delete, finalizeService, getCustomProxyService, getDataSourceDescriptor, getServiceIdentity, getServiceInterface, getServiceInterfaceClass, getServiceType, getTimeout, hasCustomProxyService, initializeService, isValidating, load, loadSelection, loadSelection, refresh, setEntityData, setTimeout, setValidating, store |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.util.Map mTableSelectionMap
Constructor Detail |
public MemoryDataService(IDataSourceDescriptor dataSourceDescriptor)
public MemoryDataService(IDataSourceDescriptor dataSourceDescriptor, java.lang.Object serviceIdentity)
Method Detail |
public static boolean copyDataSource(IDataService source, MemoryDataService target)
protected void finalize()
public IDataTransaction newTransaction()
newTransaction
in interface IDataService
newTransaction
in class AbstractDataService
public boolean ping()
AbstractDataService
ping
in interface IService
ping
in class AbstractDataService
public boolean syncronize()
public boolean backupTo(java.io.File backupFile)
public boolean backupTo(java.io.File backupFile, IEntityDescriptor[] descriptorArray)
public boolean restoreFrom(java.io.File backupFile)
public boolean restoreFrom(java.io.File backupFile, IEntityDescriptor[] descriptorArray, boolean addDeleted)
backupFile
- The file containing backup data to restore from.descriptorArray
- This array specifies what entity type that should
be restored. If set to null all entities will be restored.addDeleted
- The addDeleted flag defines if entities that have been
delted should be re-added or not. Normally this should be set to true.public boolean restoreFromURL(java.net.URL backupURL)
public boolean restoreFromURL(java.net.URL backupURL, IEntityDescriptor[] descriptorArray, boolean addDeleted)
public boolean isSyncronized()
public void setSyncronized(boolean syncronize)
public boolean isAutGenerateEnabled()
public void setAutGenerateEnabled(boolean enabled)
protected void executeLoad(IEntity entity, Qualifier qualifier) throws DataServiceException
DataServiceException
protected void executeQuery(DataQuery query, ISelection selection) throws DataServiceException
DataServiceException
protected void executeInsert(IEntity entity) throws DataServiceException
DataServiceException
protected void executeUpdate(IEntity entity, Qualifier qualifier) throws DataServiceException
DataServiceException
protected void executeDelete(IEntity entity) throws DataServiceException
DataServiceException
protected void markTableAsChanged(IEntityDescriptor entityDescriptor)
protected ISelection getTableSelection(IEntityDescriptor entityDescriptor)
protected ISelection loadTableSelection(IEntityDescriptor entityDescriptor)
protected void storeTableSelection(ISelection tableSelection)
protected MemoryDataService.ISelectionHolder createSelectionHolder(ISelection tableSelection)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |