anderix.datajets
Class JetSet

java.lang.Object
  extended by anderix.datajets.JetSet

public class JetSet
extends java.lang.Object

The class for initializing DataJet objects and methods. JetSet describes the driver, connection, table, and field list used for a DataJet.

See Also:
DataJet, GenericDataJet

Constructor Summary
JetSet(ConnectionGenerator generator, java.lang.String table, java.lang.String[] fieldList)
          Constructor.
JetSet(ConnectionGenerator generator, TableDefinition definition)
          Constructor.
JetSet(java.lang.String driver, java.lang.String connectionString, java.lang.String table, java.lang.String[] fieldList)
          Constructor.
JetSet(java.lang.String driver, java.lang.String connectionString, TableDefinition definition)
          Constructor.
 
Method Summary
 void closeConnection(java.sql.Connection con)
          Closes the connection object.
 java.sql.Connection createConnection()
          Creates a new java.sql.Connection object based on the connection information supplied to the DataJet.
 SqlBuilder createSqlBuilder()
          Creates a SqlBuilder based on the table and fields specified by DataJet.
 ConnectionGenerator getConnectionGenerator()
          Returns the ConnectionGenerator that was supplied to the DataJet.
 java.lang.String getConnectionString()
          Returns the connection string that was supplied to the DataJet.
 java.lang.String getDriver()
          Returns the driver name that was supplied to the DataJet.
 java.lang.String[] getFieldList()
          Returns the field names for the DataJet.
 java.lang.String getFieldName(int fieldIndex)
          Returns the name of the field indentified by fieldIndex.
 java.lang.String getTable()
          Returns the table name for the DataJet.
 int indexOf(java.lang.String fieldName)
          Finds the index of a field that matches fieldName.
 void setConnection(ConnectionGenerator newvalue)
          Sets the connection information for the DataJet.
 void setConnection(java.lang.String driverValue, java.lang.String connectionStringValue)
          Sets the connection information for the DataJet.
 void setFieldList(java.lang.String[] newvalues)
          Sets the field names for the DataJet.
 void setTable(java.lang.String newvalue)
          Sets the table name for the DataJet.
 void setTable(java.lang.String tableName, java.lang.String[] fieldNames)
          Sets the table name and the field names for the DataJet.
 void setTable(TableDefinition tableDef)
          Sets the table name and the field names for the DataJet using a TableDefinition object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JetSet

public JetSet(java.lang.String driver,
              java.lang.String connectionString,
              java.lang.String table,
              java.lang.String[] fieldList)
Constructor.

Parameters:
driver - string representing the database driver to use to create a connection
connectionString - string representing the connection to the database
table - string name of the DataJet's table
fieldList - array of strings containing the field names, with the identity field in the zeroth ordinal position

JetSet

public JetSet(ConnectionGenerator generator,
              java.lang.String table,
              java.lang.String[] fieldList)
Constructor.

Parameters:
generator - ConnectionGenerator that defines connection for the DataJet
table - string name of the DataJet's table
fieldList - array of strings containing the field names, with the identity field in the zeroth ordinal position

JetSet

public JetSet(java.lang.String driver,
              java.lang.String connectionString,
              TableDefinition definition)
Constructor.

Parameters:
driver - string representing the database driver to use to create a connection
connectionString - string representing the connection to the database
definition - TableDefinition object that describes the physical database table.

JetSet

public JetSet(ConnectionGenerator generator,
              TableDefinition definition)
Constructor.

Parameters:
generator - ConnectionGenerator that defines connection for the DataJet
definition - TableDefinition object that describes the physical database table.
Method Detail

indexOf

public int indexOf(java.lang.String fieldName)
Finds the index of a field that matches fieldName. Returns zero (0) if no match is found.

Parameters:
fieldName - name of the field to find
Returns:
int value representing index of matching field

getFieldName

public java.lang.String getFieldName(int fieldIndex)
Returns the name of the field indentified by fieldIndex.

Parameters:
fieldIndex - the index of the field to return
Returns:
string name of the field

setConnection

public void setConnection(ConnectionGenerator newvalue)
Sets the connection information for the DataJet.

Parameters:
newvalue - ConnectionGenerator containing connection information for the DataJet
See Also:
ConnectionGenerator

setConnection

public void setConnection(java.lang.String driverValue,
                          java.lang.String connectionStringValue)
Sets the connection information for the DataJet.

Parameters:
driverValue - string containing driver information for the DataJet
connectionStringValue - string containing connection url for the DataJet

createConnection

public java.sql.Connection createConnection()
                                     throws DataJetException
Creates a new java.sql.Connection object based on the connection information supplied to the DataJet.

Returns:
Connection object for the DataJet
Throws:
DataJetException - if the connection information has not been supplied or is invalid

closeConnection

public void closeConnection(java.sql.Connection con)
Closes the connection object.

Parameters:
con - Connection to close.

getConnectionString

public java.lang.String getConnectionString()
Returns the connection string that was supplied to the DataJet. If no connection string has been specified, or if a ConnectionGenerator was specified, returns null.

Returns:
connection string

getDriver

public java.lang.String getDriver()
Returns the driver name that was supplied to the DataJet. If no driver name has been specified, or if a ConnectionGenerator was specified, returns null.

Returns:
string representing driver name

getConnectionGenerator

public ConnectionGenerator getConnectionGenerator()
Returns the ConnectionGenerator that was supplied to the DataJet. If no ConnectionGenerator was supplied, returns null.

Returns:
the DataJet's ConnectionGenerator
See Also:
ConnectionGenerator

setTable

public void setTable(java.lang.String tableName,
                     java.lang.String[] fieldNames)
Sets the table name and the field names for the DataJet.

Parameters:
tableName - string name of the table
fieldNames - array of strings containing the field names, with the identity field in the zeroth ordinal position

setTable

public void setTable(TableDefinition tableDef)
Sets the table name and the field names for the DataJet using a TableDefinition object.

Parameters:
tableDef - TableDefinition object to set table and field names

setTable

public void setTable(java.lang.String newvalue)
Sets the table name for the DataJet.

Parameters:
newvalue - string name of the table

getTable

public java.lang.String getTable()
Returns the table name for the DataJet.

Returns:
string table name
Throws:
DataJetException - if the table has not been specified.

setFieldList

public void setFieldList(java.lang.String[] newvalues)
Sets the field names for the DataJet.

Parameters:
newvalues - array of strings containing field names, with the identity field in the zeroth ordinal position

getFieldList

public java.lang.String[] getFieldList()
Returns the field names for the DataJet.

Returns:
array of strings representing field names
Throws:
DataJetException - if the table has not been specified

createSqlBuilder

public SqlBuilder createSqlBuilder()
Creates a SqlBuilder based on the table and fields specified by DataJet.

Returns:
SqlBuilder object based on table and fields specified by DataJet
Throws:
DataJetException - if the table or field list have not been specified
See Also:
SqlBuilder