com.sibvisions.rad.model.mem
Class MemDataSource

java.lang.Object
  extended by com.sibvisions.rad.model.mem.MemDataSource
All Implemented Interfaces:
IDataSource
Direct Known Subclasses:
RemoteDataSource

public class MemDataSource
extends Object
implements IDataSource

The MemDataSource is a base class for all DataSources. It handle the store operations for all changes made in the IDataBook's. It knows the write back isolation level, which handles when a DataSource has to save implicit during manipulation operations.

See Also:
MemDataBook, MemDataPage

Constructor Summary
MemDataSource()
          Creates a MemDataSource.
 
Method Summary
 void addDataBook(IDataBook pDataBook)
          Register a IDataBook at the IDataSource.
 void close()
          It closes the IDataSource and all its IDataBooks.
protected  void finalize()
          
 IDataBook[] getDataBooks()
          Returns all registered IDataBooks from the IDataSource.
 IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
          Returns the current write back isolation level.
 boolean isOpen()
          Returns if the IDataSource is open.
 void open()
          It opens the IDataSource.
 void reloadAllDataBooks()
          It removes all changes from all IDataBook's till last storeAllDataBooks() call.
 void removeDataBook(IDataBook pDataBook)
          Unregister a IDataBook at the IDataSource.
 void restoreAllDataBooks()
          It removes all changes from all IDataBook's till last storeAllDataBooks() call.
 void saveAllDataBooks()
          It saves all changes from all IDataBook's to the IDataSource.
 void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
          Sets when the IDataSource needs to write back the data to the storage.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemDataSource

public MemDataSource()
Creates a MemDataSource.

Method Detail

open

public void open()
          throws ModelException
It opens the IDataSource.

Specified by:
open in interface IDataSource
Throws:
ModelException - if the open dosn't work out.

isOpen

public boolean isOpen()
Returns if the IDataSource is open. IDataBooks need to check on open if the used IDataSource is open.

Specified by:
isOpen in interface IDataSource
Returns:
true if the IDataSource is open.

close

public void close()
It closes the IDataSource and all its IDataBooks.

Specified by:
close in interface IDataSource

saveAllDataBooks

public void saveAllDataBooks()
                      throws ModelException
It saves all changes from all IDataBook's to the IDataSource.
The recommended way to do this, is to call on every IDataBook storeAllRows().

Events:
It calls before the store on all registered IComponents the saveEditing() method, to set all changes to the DataBook before the store operation.

Specified by:
saveAllDataBooks in interface IDataSource
Throws:
ModelException - if not all changes could be stored in the IDataBook

reloadAllDataBooks

public void reloadAllDataBooks()
                        throws ModelException
It removes all changes from all IDataBook's till last storeAllDataBooks() call. The recommended way to do this, is to call on every IDataBook restoreAllRows().

Events:
It calls before the restore on all registered IComponents the cancelEditing() method, to cancel the editing mode of the GUI control.

Specified by:
reloadAllDataBooks in interface IDataSource
Throws:
ModelException - if not all changes could be restored in the IDataBook

restoreAllDataBooks

public void restoreAllDataBooks()
It removes all changes from all IDataBook's till last storeAllDataBooks() call.

Events:
It calls before the restore on all registered IComponents the cancelEditing() method, to cancel the editing mode of the GUI control.

Specified by:
restoreAllDataBooks in interface IDataSource

addDataBook

public void addDataBook(IDataBook pDataBook)
Register a IDataBook at the IDataSource.

Specified by:
addDataBook in interface IDataSource
Parameters:
pDataBook - the new IDataBook to register

removeDataBook

public void removeDataBook(IDataBook pDataBook)
Unregister a IDataBook at the IDataSource.

Specified by:
removeDataBook in interface IDataSource
Parameters:
pDataBook - the IDataBook to unregister

getDataBooks

public IDataBook[] getDataBooks()
Returns all registered IDataBooks from the IDataSource.

Specified by:
getDataBooks in interface IDataSource
Returns:
all registered IDataBooks from the IDataSource.

setWritebackIsolationLevel

public void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
Sets when the IDataSource needs to write back the data to the storage.
The default write back isolation level is DATA_ROW.

Specified by:
setWritebackIsolationLevel in interface IDataSource
Parameters:
pIsolationLevel - the new write back isolation level.
See Also:
IDataBook.WriteBackIsolationLevel

getWritebackIsolationLevel

public IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
Returns the current write back isolation level.

Specified by:
getWritebackIsolationLevel in interface IDataSource
Returns:
the current write back isolation level.

finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.