All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class examples.jdbc.DomainTable

java.lang.Object
   |
   +----examples.jdbc.Table
           |
           +----examples.jdbc.DomainTable

public class DomainTable
extends Table
This class provides a basic service for managing a domain table in a database.
The domain table represents a domain in the agent. Data is kept on all m-beans registered persistent in this domain.

The domain table structure:
Column Name Column Type
className VARCHAR
keyProperties VARCHAR
mbeanData BINARY


Variable Index

 o BINARY_SIZE
The byte array column size.
 o VARCHAR_SIZE
The string column size.

Constructor Index

 o DomainTable(Connection, String)
Creates a DomainTable that manipulates domain tables in the database.

Method Index

 o add(String, String, byte[])
Adds a new row to the domain table.
 o contains(String, String)
Tests if the row exists in the domain table.
 o delete(String, String)
Removes existing rows from the domain table.
 o drop()
Removes the domain table definition and all data.
 o get(String, String)
Retrieves the array of object bytes from an existing row in the domain table.
 o getObjectNameStrings(String, String)
Retrieve all the rows satisfying the query and return a list of string representations of object names.
 o isEmpty()
Tests if there is any existing rows in the domain table.
 o size()
Determines the size of the domain table.
 o update(String, String, byte[])
Changes data in existing rows of the domain table.

Variables

 o VARCHAR_SIZE
 public static int VARCHAR_SIZE
The string column size.

 o BINARY_SIZE
 public static int BINARY_SIZE
The byte array column size.

Constructors

 o DomainTable
 public DomainTable(Connection connection,
                    String domainName) throws SQLException
Creates a DomainTable that manipulates domain tables in the database. If the table doesn't exist in the database, it will be created.

Parameters:
connection - A session with a specific database.
domainName - The name of the domain table.
Throws: SQLException
A database-access error occured.

Methods

 o add
 public void add(String className,
                 String propertyList,
                 byte objectData[]) throws SQLException
Adds a new row to the domain table.

Parameters:
className - The class of object that the object represents.
propertyList - The string representation of the list of key properties.
objectData - The array of object bytes.
Throws: SQLException
A database-access error occured.
 o update
 public void update(String className,
                    String propertyList,
                    byte objectData[]) throws SQLException
Changes data in existing rows of the domain table.

Parameters:
className - The class of object that the object represents.
propertyList - The string representation of the list of key properties.
objectData - The array of object bytes.
Throws: SQLException
A database-access error occured.
 o delete
 public void delete(String className,
                    String propertyList) throws SQLException
Removes existing rows from the domain table.

Parameters:
className - The class of object that the object represents.
propertyList - The string representation of the list of key properties.
Throws: SQLException
A database-access error occured.
 o get
 public byte[] get(String className,
                   String propertyList) throws SQLException
Retrieves the array of object bytes from an existing row in the domain table.

Parameters:
className - The class of object that the object represents.
propertyList - The string representation of the list of key properties.
Returns:
The array of object bytes.
Throws: SQLException
A database-access error occured.
 o contains
 public boolean contains(String className,
                         String propertyList) throws SQLException
Tests if the row exists in the domain table.

Parameters:
className - The class of object that the object represents.
propertyList - The string representation of the list of key properties.
Returns:
True if the row exists in the domain table, else false.
Throws: SQLException
A database-access error occured.
 o getObjectNameStrings
 public Vector getObjectNameStrings(String className,
                                    String propertyList) throws SQLException
Retrieve all the rows satisfying the query and return a list of string representations of object names.

Parameters:
className - The class of object that the object represents.
propertyList - The string representation of the list of key properties.
Returns:
List of object name string representations.
Throws: SQLException
A database-access error occured.
 o size
 public int size() throws SQLException
Determines the size of the domain table.

Returns:
The number of existing rows in the domain table.
Throws: SQLException
A database-access error occured.
 o isEmpty
 public boolean isEmpty() throws SQLException
Tests if there is any existing rows in the domain table.

Returns:
True if there are no existing rows in the domain table, else false.
Throws: SQLException
A database-access error occured.
 o drop
 public void drop() throws SQLException
Removes the domain table definition and all data.

Throws: SQLException
A database-access error occured.

All Packages  Class Hierarchy  This Package  Previous  Next  Index