com.sun.data.provider
Interface TransactionalDataProvider

All Superinterfaces:
DataProvider
All Known Implementing Classes:
BasicTransactionalDataProvider, BasicTransactionalTableDataProvider, CachedRowSetDataProvider, ObjectListDataProvider

public interface TransactionalDataProvider
extends DataProvider

Behavioral interface that is implemented by DataProvider classes that offer commit/revert support. In such environments, methods that modify the data element values (such as setValue()) must cause the new values to be cached, and the underlying data elements are not actually updated until commitChanges() is called. An application may also call revertChanges() to throw away any cached updates. In spite of this caching, however, valueChanged() events must still be sent to registered DataListeners -- an instance of TransactionalDataListener will also be notified when the actual commitChanges() or revertChanges() occurs.

During the time between when a modification method (such as setValue() is called, and a later call to commitChanges(), any calls to getType() or getValue() will reflect the modified value from the cache, not the original value from the underlying data structure.


Method Summary
 void addTransactionalDataListener(TransactionalDataListener listener)
          Register a new TransactionalDataListener to this TransactionalDataProvider instance.
 void commitChanges()
          Cause any cached changes to values of data elements supported by this DataProvider to be passed through to the underlying data structure.
 TransactionalDataListener[] getTransactionalDataListeners()
           
 void removeTransactionalDataListener(TransactionalDataListener listener)
          Deregister an existing TransactionalDataListener from TransactionalDataProvider instance.
 void revertChanges()
          Cause any cached changes to values of data elements supported by this DataProvider to be thrown away, so that the initial values are again visible.
 
Methods inherited from interface com.sun.data.provider.DataProvider
addDataListener, getDataListeners, getFieldKey, getFieldKeys, getType, getValue, isReadOnly, removeDataListener, setValue
 

Method Detail

commitChanges

void commitChanges()
                   throws DataProviderException

Cause any cached changes to values of data elements supported by this DataProvider to be passed through to the underlying data structure.

Throws:
DataProviderException - Implementations may wish to surface internal exceptions (nested in DataProviderException). Consult the documentation of the specific DataProvider implementation for details on what exceptions might be wrapped by a DPE.

revertChanges

void revertChanges()
                   throws DataProviderException

Cause any cached changes to values of data elements supported by this DataProvider to be thrown away, so that the initial values are again visible.

Throws:
DataProviderException - Implementations may wish to surface internal exceptions (nested in DataProviderException). Consult the documentation of the specific DataProvider implementation for details on what exceptions might be wrapped by a DPE.

addTransactionalDataListener

void addTransactionalDataListener(TransactionalDataListener listener)

Register a new TransactionalDataListener to this TransactionalDataProvider instance.

Parameters:
listener - New TransactionalDataListener to register

removeTransactionalDataListener

void removeTransactionalDataListener(TransactionalDataListener listener)

Deregister an existing TransactionalDataListener from TransactionalDataProvider instance.

Parameters:
listener - Old TransactionalDataListener to remove

getTransactionalDataListeners

TransactionalDataListener[] getTransactionalDataListeners()
Returns:
An array of the TransactionalDataListeners currently registered on this TransactionalDataProvider. If there are no registered listeners, a zero-length array is returned.