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 java.lang.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)
          Adds the given IDataBook.
 void close()
          Closes this IDataSource.
 DataSourceHandler eventDataBookAdded()
          Gets the DataSourceHandler for databook added event.
 DataSourceHandler eventDataBookRemoved()
          Gets the DataSourceHandler for databook removed event.
protected  void finalize()
          
 IDataBook getDataBook(java.lang.String pName)
          Gets the (first) IDataBook with the given name.
 IDataBook[] getDataBooks()
          Gets all the IDataBooks which have been added to this IDataSource.
 IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
          Gets the default IDataBook.WriteBackIsolationLevel for all added IDataBooks.
 boolean isOpen()
          Gets if this IDataSource is open.
 void open()
          Opens this IDataSource so that it can be used.
 void reloadAllDataBooks()
          Reloads all added IDataBooks by invoking IDataBook.reload().
 void removeDataBook(IDataBook pDataBook)
          Removes the given IDataBook.
 void restoreAllDataBooks()
          Restores all added IDataBooks by invoking IDataBook.restoreAllRows().
 void saveAllDataBooks()
          Saves all changes in the added IDataBooks by invoking IDataBook.saveAllRows().
 void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
          Sets the default IDataBook.WriteBackIsolationLevel for all added IDataBooks.
 java.lang.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
Opens this IDataSource so that it can be used. Only an open IDataSource can be used.

Implementing classes should perform their set up work here.

Specified by:
open in interface IDataSource
Throws:
ModelException - if there was an error during opening.
See Also:
IDataSource.close(), IDataSource.isOpen()

isOpen

public boolean isOpen()
Gets if this IDataSource is open.

Only an open IDataSource is a usable IDataSource.

Specified by:
isOpen in interface IDataSource
Returns:
true if this IDataSource is open.
See Also:
IDataSource.open()

close

public void close()
Closes this IDataSource. A closed IDataSource can no longer be used, however it can always be reopened.

Implementing classes should perform their clean up work here. It closes the IDataSource and all its IDataBooks.

Specified by:
close in interface IDataSource
See Also:
IDataSource.isOpen(), IDataSource.open()

saveAllDataBooks

public void saveAllDataBooks()
                      throws ModelException
Saves all changes in the added IDataBooks by invoking IDataBook.saveAllRows().

Specified by:
saveAllDataBooks in interface IDataSource
Throws:
ModelException - if the changes could not be saved.
See Also:
IDataSource.reloadAllDataBooks(), IDataSource.restoreAllDataBooks(), IDataBook.saveAllRows()

reloadAllDataBooks

public void reloadAllDataBooks()
                        throws ModelException
Reloads all added IDataBooks by invoking IDataBook.reload().

Specified by:
reloadAllDataBooks in interface IDataSource
Throws:
ModelException - if the IDataBooks could not be reloaded.
See Also:
IDataSource.restoreAllDataBooks(), IDataSource.saveAllDataBooks(), IDataBook.reload()

restoreAllDataBooks

public void restoreAllDataBooks()
Restores all added IDataBooks by invoking IDataBook.restoreAllRows().

Specified by:
restoreAllDataBooks in interface IDataSource
See Also:
IDataSource.reloadAllDataBooks(), IDataSource.saveAllDataBooks(), IDataBook.restoreAllRows()

addDataBook

public void addDataBook(IDataBook pDataBook)
Adds the given IDataBook.

Specified by:
addDataBook in interface IDataSource
Parameters:
pDataBook - the IDataBook to add.

removeDataBook

public void removeDataBook(IDataBook pDataBook)
Removes the given IDataBook.

Specified by:
removeDataBook in interface IDataSource
Parameters:
pDataBook - the given IDataBook to remove.

getDataBooks

public IDataBook[] getDataBooks()
Gets all the IDataBooks which have been added to this IDataSource.

Specified by:
getDataBooks in interface IDataSource
Returns:
all the IDataBooks which have been added to this IDataSource.

getDataBook

public IDataBook getDataBook(java.lang.String pName)
Gets the (first) IDataBook with the given name.

Specified by:
getDataBook in interface IDataSource
Parameters:
pName - the name of the IDataBook to get.
Returns:
the (first) IDataBook with the given name, null if none was found.

setWritebackIsolationLevel

public void setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel pIsolationLevel)
Sets the default IDataBook.WriteBackIsolationLevel for all added IDataBooks.

The default IDataBook.WriteBackIsolationLevel is IDataBook.WriteBackIsolationLevel.DATA_ROW.

Specified by:
setWritebackIsolationLevel in interface IDataSource
Parameters:
pIsolationLevel - the default IDataBook.WriteBackIsolationLevel for all added IDataBooks.
See Also:
IDataSource.getWritebackIsolationLevel()

getWritebackIsolationLevel

public IDataBook.WriteBackIsolationLevel getWritebackIsolationLevel()
Gets the default IDataBook.WriteBackIsolationLevel for all added IDataBooks.

The default IDataBook.WriteBackIsolationLevel is IDataBook.WriteBackIsolationLevel.DATA_ROW.

Specified by:
getWritebackIsolationLevel in interface IDataSource
Returns:
the default IDataBook.WriteBackIsolationLevel for all added IDataBooks.
See Also:
IDataSource.setWritebackIsolationLevel(IDataBook.WriteBackIsolationLevel)

eventDataBookAdded

public DataSourceHandler eventDataBookAdded()
Gets the DataSourceHandler for databook added event.

This event is fired if an IDataBook has been added.

Specified by:
eventDataBookAdded in interface IDataSource
Returns:
the DataSourceHandler for databook added event.

eventDataBookRemoved

public DataSourceHandler eventDataBookRemoved()
Gets the DataSourceHandler for databook removed event.

This event is fired if an IDataBook has been removed.

Specified by:
eventDataBookRemoved in interface IDataSource
Returns:
the DataSourceHandler for databook removed event.

finalize

protected void finalize()
                 throws java.lang.Throwable

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.