org.jdesktop.dataset
Class DataProvider

java.lang.Object
  extended by org.jdesktop.dataset.DataProvider
Direct Known Subclasses:
SQLDataProvider, WebRowSetDataProvider

public abstract class DataProvider
extends java.lang.Object

Provides a basic implementation of DataProvider that handles all of the threading issues normally associated with writing a DataProvider.

Author:
rbair

Constructor Summary
DataProvider()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this class for any changes to bean properties.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this class for specific property changes.
protected abstract  LoadTask createLoadTask(DataTable[] tables)
          Creates a Task that loads data from the data store into one or more DataTables.
protected abstract  SaveTask createSaveTask(DataTable[] tables)
          Creates a task that saves data from an array of DataTables to the data store.
 DataCommand getCommand()
          Returns the DataCommand instance for this DataProvider, assigned with setCommand(DataCommand).
 DataConnection getConnection()
           
 void load(DataTable t)
           
 void load(DataTable[] tables)
           
 void loadAndWait(DataTable t)
           
 void loadAndWait(DataTable[] tables)
           
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Stops notifying a specific listener of changes to a specific property.
protected  void runTask(Task runner)
          Invoked by the load or save methods.
protected  void runTaskAndWait(Task runner)
           
 void save(DataTable t)
           
 void save(DataTable[] tables)
           
 void saveAndWait(DataTable t)
           
 void saveAndWait(DataTable[] tables)
           
 void setCommand(DataCommand cmd)
          Assigns the single DataCommand instance used by this provider to execute load and store operations.
 void setConnection(DataConnection conn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataProvider

public DataProvider()
Method Detail

load

public void load(DataTable[] tables)

loadAndWait

public void loadAndWait(DataTable[] tables)

load

public void load(DataTable t)

loadAndWait

public void loadAndWait(DataTable t)

save

public void save(DataTable t)

saveAndWait

public void saveAndWait(DataTable t)

save

public void save(DataTable[] tables)

saveAndWait

public void saveAndWait(DataTable[] tables)

createSaveTask

protected abstract SaveTask createSaveTask(DataTable[] tables)
Creates a task that saves data from an array of DataTables to the data store. All of these tables will be saved serially on the same background thread.


createLoadTask

protected abstract LoadTask createLoadTask(DataTable[] tables)
Creates a Task that loads data from the data store into one or more DataTables. All of these tables will be loaded serially using the same background thread.


runTask

protected void runTask(Task runner)
Invoked by the load or save methods. This method will be called on the EventDispatch thread, and therefore must not block. This method is provided to allow concrete subclasses to provide a custom thread creation/scheduling implementation.

Parameters:
runner -

runTaskAndWait

protected void runTaskAndWait(Task runner)

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this class for any changes to bean properties.

Parameters:
listener - The PropertyChangeListener to notify of changes to this instance.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this class for specific property changes.

Parameters:
propertyName - The name of the property to listen to changes for.
listener - The PropertyChangeListener to notify of changes to this instance.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Stops notifying a specific listener of changes to a specific property.

Parameters:
propertyName - The name of the property to ignore from now on.
listener - The listener to stop receiving notifications.

setCommand

public void setCommand(DataCommand cmd)
Assigns the single DataCommand instance used by this provider to execute load and store operations. Like DataProvider, the DataCommand is abstract so the specific load/store operations on a DataCommand are described in a DataCommand subclass, and a specific subclass of DataProvider must know how to work with that command instance.

Parameters:
cmd - The DataCommand instance to use for load/store operations.

getCommand

public DataCommand getCommand()
Returns the DataCommand instance for this DataProvider, assigned with setCommand(DataCommand).

Returns:
the DataCommand instance for this DataProvider.

setConnection

public void setConnection(DataConnection conn)

getConnection

public DataConnection getConnection()


Copyright © 2005 Sun Microsystems All Rights Reserved.