gov.sns.tools.data
Class DataTable.Schema

java.lang.Object
  |
  +--gov.sns.tools.data.DataTable.Schema
All Implemented Interfaces:
DataListener
Enclosing class:
DataTable

public class DataTable.Schema
extends java.lang.Object
implements DataListener

This class represents the schema of the table which specifies the attributes belonging to the table.


Field Summary
protected  java.util.Map attributeTable
           
protected  java.util.Collection primaryKeys
           
 
Constructor Summary
DataTable.Schema()
           
DataTable.Schema(java.util.Collection attributes)
           
 
Method Summary
 void addAttribute(DataAttribute attribute)
          Add a new attribute to the schema
 java.util.Collection attributes()
          Get the collection of all attributes in this schema
 java.lang.String dataLabel()
          dataLabel() provides the name used to identify the class in an external data source.
 boolean isPrimaryKey(java.lang.String key)
          Determine if the specified key is a primary key
 java.util.Set keys()
           
 java.util.Collection primaryKeys()
          Get the collection of primary keys
 void update(DataAdaptor adaptor)
          Update the data based on the information provided by the data provider.
protected  void validatePrimaryKeys()
           
 void write(DataAdaptor adaptor)
          Write data to the data adaptor for storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributeTable

protected java.util.Map attributeTable

primaryKeys

protected java.util.Collection primaryKeys
Constructor Detail

DataTable.Schema

public DataTable.Schema()

DataTable.Schema

public DataTable.Schema(java.util.Collection attributes)
                 throws MissingPrimaryKeyException
Method Detail

keys

public java.util.Set keys()

validatePrimaryKeys

protected void validatePrimaryKeys()
                            throws MissingPrimaryKeyException
MissingPrimaryKeyException

attributes

public java.util.Collection attributes()
Get the collection of all attributes in this schema

Returns:
the collection of all attributes in this schema

addAttribute

public void addAttribute(DataAttribute attribute)
Add a new attribute to the schema

Parameters:
attribute - The attribute to add to the schema

primaryKeys

public java.util.Collection primaryKeys()
Get the collection of primary keys

Returns:
The collection of primary keys

isPrimaryKey

public boolean isPrimaryKey(java.lang.String key)
Determine if the specified key is a primary key

Parameters:
key - The key to test for being a primary key
Returns:
true if the key is a primary key and false if it isn't a primary key

dataLabel

public java.lang.String dataLabel()
Description copied from interface: DataListener
dataLabel() provides the name used to identify the class in an external data source.

Specified by:
dataLabel in interface DataListener
Returns:
a tag that identifies the receiver's type

update

public void update(DataAdaptor adaptor)
            throws MissingPrimaryKeyException
Description copied from interface: DataListener
Update the data based on the information provided by the data provider.

Specified by:
update in interface DataListener
Parameters:
adaptor - The adaptor from which to update the data
MissingPrimaryKeyException

write

public void write(DataAdaptor adaptor)
           throws MissingPrimaryKeyException
Description copied from interface: DataListener
Write data to the data adaptor for storage.

Specified by:
write in interface DataListener
Parameters:
adaptor - The adaptor to which the receiver's data is written
MissingPrimaryKeyException