org.jdesktop.dataset.io.schema
Interface DataSetSchemaReader

All Known Implementing Classes:
JDBCDataSetSchemaReader, XMLDataSetSchemaReader

public interface DataSetSchemaReader

A DataSetSchemaReader instantiates DataSets, DataTables and DataRelations from a schema provider, such as database metadata or XML. The methods for reading schema information DataSetSchemaReaders create empty DataSets, DataTables, and DataRelations. The methods in DataSetSchemaReader do not specify a data source; implementing classes must do so, for example in the constructor. For this reason, some DataSetSchemaReaders may only be usable with one schema source. Typically the data source will be specified in the constructor to a DataSetSchemaReader.

Author:
Patrick Wright

Method Summary
 java.util.List<java.lang.String> addRelations(DataSet dataSet, java.lang.String... tableNames)
          Adds all DataRelation for the named DataTable to the specified DataSet, as read from the schema which this reader is reading from.
 java.util.List<java.lang.String> addTables(DataSet dataSet, java.lang.String... tableNames)
          Appends one or more DataTable to a DataSet from the schema represented by this reader.
 DataSet readDataSet()
          Instantiates a new DataSet from the data source specified in the constructor.
 DataSet readDataSet(java.lang.String... tableNames)
          Instantiates a new DataSet from the data source specified in the implementing class, with the DataSet schema loaded but without data, for the tables and columns given in the tableNames parameter.
 

Method Detail

readDataSet

DataSet readDataSet()
                    throws SchemaReaderException
Instantiates a new DataSet from the data source specified in the constructor. If the schema contains multiple DataTables or DataRelations, all of them are loaded from the schema into the new DataSet.

Returns:
A new DataSet instantiated from the data source specified for the implementing class, including all tables and relations in the schema.
Throws:
ashktheman.dataset.io.SchemaReaderException - If an error occurred while loading the schema.
SchemaReaderException

readDataSet

DataSet readDataSet(java.lang.String... tableNames)
                    throws SchemaReaderException
Instantiates a new DataSet from the data source specified in the implementing class, with the DataSet schema loaded but without data, for the tables and columns given in the tableNames parameter.

Parameters:
tableNames - One or more table names to load from the schema. Each name can be either a table, or a table and column, dot-separated. If no columns are specified, all columns in the table are read from the schema; if columns are listed, only those columns are loaded. DataRelations for those tables and columns loaded from the schema are also instantiated automatically through addRelations(org.jdesktop.dataset.DataSet, String...).
Returns:
A new DataSet instantiated from the data source specified for the implementing class, including all tables and relations in the schema.
Throws:
ashktheman.dataset.io.SchemaReaderException - If an error occurred while loading the schema.
SchemaReaderException

addTables

java.util.List<java.lang.String> addTables(DataSet dataSet,
                                           java.lang.String... tableNames)
                                           throws SchemaReaderException
Appends one or more DataTable to a DataSet from the schema represented by this reader. If the table, by name, is found in the DataSet, the table is skipped; if you want to re-add a table (for example, to pick up changes in table structure), drop the table from the DataSet before calling this method.

Parameters:
dataSet - The DataSet to which to add the tables.
tableNames - One or more table names to load from the schema and add to the DataSet. Each name can be either a table, or a table and column, dot-separated. If no columns are specified, all columns in the table are read from the schema; if columns are listed, only those columns are loaded. DataRelations for those tables and columns are not loaded from the schema; to that end, use addRelations(DataSet, String...).
Returns:
A List of the table names that were actually found. You can check this to verify that all tables requested were loaded.
Throws:
org.jdesktop.dataset.io.SchemaReaderException - If an error occurred while reading the schema.
SchemaReaderException

addRelations

java.util.List<java.lang.String> addRelations(DataSet dataSet,
                                              java.lang.String... tableNames)
                                              throws SchemaReaderException
Adds all DataRelation for the named DataTable to the specified DataSet, as read from the schema which this reader is reading from. All DataRelations for the table are dropped from the DataSet and re-added.

Parameters:
dataSet - The DataSet to which to add the relations.
tableNames - One or more table names for which to read relations from the schema. Only those relations for columns in the DataTable (as currently loaded) are added.
Returns:
A List of the DataRelation names loaded from the schema.#
Throws:
org.jdesktop.dataset.io.SchemaReaderException - If an error occurred while reading the schema.
SchemaReaderException


Copyright © 2005 Sun Microsystems All Rights Reserved.