Class JetSet

java.lang.Object
anderix.datajets.JetSet

public class JetSet extends Object
The class for initializing DataJet objects and methods. JetSet describes the connection, table, field list, and (optionally) driver used for a DataJet.
See Also:
  • Constructor Details

    • JetSet

      public JetSet(String connectionString, String table, String[] fieldList)
      Constructor.
      Parameters:
      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(String driver, String connectionString, String table, 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, String table, 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(String driver, 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 Details

    • indexOf

      public int indexOf(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 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:
    • setConnection

      public void setConnection(String driverValue, 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 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(Connection con)
      Closes the connection object.
      Parameters:
      con - Connection to close.
    • getConnectionString

      public 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 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:
    • setTable

      public void setTable(String tableName, 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(String newvalue)
      Sets the table name for the DataJet.
      Parameters:
      newvalue - string name of the table
    • getTable

      public String getTable()
      Returns the table name for the DataJet.
      Returns:
      string table name
    • setFieldList

      public void setFieldList(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 String[] getFieldList()
      Returns the field names for the DataJet.
      Returns:
      array of strings representing field names
    • 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
      See Also: