Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.watch
Class DBArchive

    java.lang.Object
      org.jini.rio.watch.QueuedArchive
          org.jini.rio.watch.DBArchive

All Implemented Interfaces:
  Archivable

    public class DBArchive

extends QueuedArchive

Implements a WatchDataSource Archiver for a database. The default table is defined with a string column for the Calculable id and a Double column for the calculable value.

Field Summary
`static long` | `DEFAULT_COUNT_INTERVAL`
`static long` | `DEFAULT_TIME_INTERVAL`

Constructor Summary
`DBArchive(Connection conn, PreparedStatement stmt)` Creates new DBArchive
`DBArchive(Connection conn, String tableName)` Creates new DBArchive using the default table format

Method Summary
`protected void` | `addParameters(Calculable calculable, PreparedStatement stmt)` Adds parameters from a calculable to a PreparedStatment Subclasses can override this method to realize behavior beyond the default insert of the Calculable id and value.
`void` | `archiveToResource(Calculable calculable)` Performs the actual write to the underlying resource
`void` | `closeResource()` Closes the underlying Resource
`long` | `getCommitCountInterval()` Getter for property commitCountInterval.
`long` | `getCommitTimeInterval()` Getter for property commitTimeInterval.
`String` | `getDatabase()` Getter for property database.
`String` | `getDriver()` Getter for property driver.
`String` | `getTableName()` Getter for property tableName.
`void` | `initialize()`
`static void` | `main(String[] args)`
`void` | `setCommitCountInterval(long commitCountInterval)` Setter for property commitCountInterval.
`void` | `setCommitTimeInterval(long commitTimeInterval)` Setter for property commitTimeInterval.
`void` | `setDatabase(String database)` Setter for property database.
`void` | `setDriver(String driver)` Setter for property driver.
`void` | `setTableName(String tableName)` Setter for property tableName.

Methods inherited from class org.jini.rio.watch.QueuedArchive
`archive, close`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_TIME_INTERVAL

    public static final long DEFAULT_TIME_INTERVAL

See Also:
  Constant Field Values

### DEFAULT_COUNT_INTERVAL

    public static final long DEFAULT_COUNT_INTERVAL

See Also:
  Constant Field Values

Constructor Detail

### DBArchive

    public DBArchive(Connection conn,
                     String tableName)
              throws SQLException

  Creates new DBArchive using the default table format

  Parameters:
    `conn` - the Database Connection
    `tableName` - the name of the default table
  Throws:
    `SQLException` - If there are errors processing the SQL

### DBArchive

    public DBArchive(Connection conn,
                     PreparedStatement stmt)

  Creates new DBArchive

  Parameters:
    `conn` - the Database Connection
    `stmt` - the Prepared Statment for the insert

Method Detail

### addParameters

    protected void addParameters(Calculable calculable,
                                 PreparedStatement stmt)
                          throws SQLException,
                                 IOException

  Adds parameters from a calculable to a PreparedStatment Subclasses can override this method to realize behavior beyond the default insert of the Calculable id and value.

  Parameters:
    `calculable` - the calculable
    `stmt` - the prepared Statement
  Throws:
    `SQLException` - If there are errors processing the SQL
    `IOException` - If the PreparedStatement is null

### archiveToResource

    public void archiveToResource(Calculable calculable)
                           throws IOException

  Performs the actual write to the underlying resource

  Specified by:
    `archiveToResource` in class `QueuedArchive`
  Parameters:
    `calculable` - the Calculable record to archive
  Throws:
    `IOException` - if the write encounters errors

### closeResource

    public void closeResource()

  Closes the underlying Resource

  Specified by:
    `closeResource` in class `QueuedArchive`

### getCommitTimeInterval

    public long getCommitTimeInterval()

  Getter for property commitTimeInterval.

  Returns:
    Value of property commitTimeInterval.

### setCommitTimeInterval

    public void setCommitTimeInterval(long commitTimeInterval)

  Setter for property commitTimeInterval.

  Parameters:
    `commitTimeInterval` - New value of property commitTimeInterval.

### getCommitCountInterval

    public long getCommitCountInterval()

  Getter for property commitCountInterval.

  Returns:
    Value of property commitCountInterval.

### setCommitCountInterval

    public void setCommitCountInterval(long commitCountInterval)

  Setter for property commitCountInterval.

  Parameters:
    `commitCountInterval` - New value of property commitCountInterval.

### initialize

    public void initialize()
                    throws IOException

  Throws:
    `IOException`

### main

    public static void main(String[] args)

### getDriver

    public String getDriver()

  Getter for property driver.

  Returns:
    Value of property driver.

### setDriver

    public void setDriver(String driver)

  Setter for property driver.

  Parameters:
    `driver` - New value of property driver.

### getDatabase

    public String getDatabase()

  Getter for property database.

  Returns:
    Value of property database.

### setDatabase

    public void setDatabase(String database)

  Setter for property database.

  Parameters:
    `database` - New value of property database.

### getTableName

    public String getTableName()

  Getter for property tableName.

  Returns:
    Value of property tableName.

### setTableName

    public void setTableName(String tableName)

  Setter for property tableName.

  Parameters:
    `tableName` - New value of property tableName.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.