iiitAccessServer 1.0

de.iiit.access.server.util.db.cachedb
Class IndexTable

java.lang.Object
  |
  +--de.iiit.access.server.util.db.cachedb.IndexTable

public class IndexTable
extends Object

For every expression or group found in the LDAP database there will be exactly on table in the cache database. The cache tables are numbered consecutively when they are created. The index table holds the relation between the name of the expression or group - represented by its MD5 checksum - and the table containig the data.


Constructor Summary
IndexTable(String exprKey, String tableName, long creationTime)
          Creates a new instance of IndexTable
 
Method Summary
static boolean createIndexTable(JdbcConnectionPool pool)
          Creates a new database table todolist.
 void deleteIndex(JdbcConnectionPool pool)
          Deletes the current object from the database.
 long getCreationTime()
          Retrieves the creationtime-field of the current object
 String getExprKey()
          Retrieves the exprkey-field of the current object.
 String getTableName()
          Retrieves the tablename-field of the current object.
 void insertIndex(JdbcConnectionPool pool)
          Inserts the current object into the index table
static boolean searchIndex(JdbcConnectionPool pool, String expressionName)
          Searches the index for a name of an expression or group
static boolean searchIndex2(JdbcConnectionPool pool, String tablename)
          Searches the index for a name of a cache table
static Set selectAllTableNames(JdbcConnectionPool pool)
          Reads all table names from the index table
static IndexTable selectIndex(JdbcConnectionPool pool, String name)
          Reads one record from the index table
 void setCreationTime(long creationTime)
          Sets the creationtime-field of the current object
 void setExprKey(String exprKey)
          Sets the exprkey-field of the current object.
 void setTableName(String tableName)
          Sets the tablename-field of the current object.
 void updateIndex(JdbcConnectionPool pool)
          Writes the content of the current object back to the database
 void writeIndex(JdbcConnectionPool pool)
          Writes the content of the current object back to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexTable

public IndexTable(String exprKey,
                  String tableName,
                  long creationTime)
Creates a new instance of IndexTable

Parameters:
exprKey - the MD5 sum of the name of the expression or group
tableName - the name of the table
creationTime - the creation time of the cache table in milliseconds since January, 1st 1970.
Method Detail

createIndexTable

public static boolean createIndexTable(JdbcConnectionPool pool)
                                throws JdbcException
Creates a new database table todolist. Returns

Parameters:
pool - The database handle to use
Returns:
true if table had to be created, false is table was already there
Throws:
JdbcException - if a JDBC error occurs

searchIndex

public static boolean searchIndex(JdbcConnectionPool pool,
                                  String expressionName)
                           throws JdbcException
Searches the index for a name of an expression or group

Parameters:
pool - The database handle to use
expressionName - The name to search for
Returns:
True if the name was found or false if not.
Throws:
JdbcException - if a JDBC error occurs

searchIndex2

public static boolean searchIndex2(JdbcConnectionPool pool,
                                   String tablename)
                            throws JdbcException
Searches the index for a name of a cache table

Parameters:
pool - The database handle to use
tablename - The name to search for
Returns:
True if the name was found or false if not.
Throws:
JdbcException - if a JDBC error occurs

selectIndex

public static IndexTable selectIndex(JdbcConnectionPool pool,
                                     String name)
                              throws JdbcException
Reads one record from the index table

Parameters:
pool - The database handle to use
name - The name to search for
Returns:
The read record or null if there was no one found.
Throws:
JdbcException - if a JDBC error occurs

selectAllTableNames

public static Set selectAllTableNames(JdbcConnectionPool pool)
                               throws JdbcException
Reads all table names from the index table

Parameters:
pool - The database handle to use
Returns:
All table names contained in the index table
Throws:
JdbcException - if a JDBC error occurs

insertIndex

public void insertIndex(JdbcConnectionPool pool)
                 throws JdbcException
Inserts the current object into the index table

Parameters:
pool - The database handle to use
Throws:
JdbcException - if a JDBC error occurs

updateIndex

public void updateIndex(JdbcConnectionPool pool)
                 throws JdbcException
Writes the content of the current object back to the database

Parameters:
pool - The database handle to use
Throws:
JdbcException - if a JDBC error occurs

deleteIndex

public void deleteIndex(JdbcConnectionPool pool)
                 throws JdbcException
Deletes the current object from the database.

Parameters:
pool - The database handle to use
Throws:
JdbcException - if a JDBC error occurs

writeIndex

public void writeIndex(JdbcConnectionPool pool)
                throws JdbcException
Writes the content of the current object back to the database. If it is new it will be inserted, otherwise the record will be updated.

Parameters:
pool - The database handle to use
Throws:
JdbcException - if a JDBC error occurs

setExprKey

public void setExprKey(String exprKey)
Sets the exprkey-field of the current object.

Parameters:
exprKey - the MD5 sum of the name of the expression or group

setTableName

public void setTableName(String tableName)
Sets the tablename-field of the current object.

Parameters:
tableName - the name of the cache table

setCreationTime

public void setCreationTime(long creationTime)
Sets the creationtime-field of the current object

Parameters:
creationTime - the creation time of the cache table in milliseconds since January, 1st 1970.

getExprKey

public String getExprKey()
Retrieves the exprkey-field of the current object.

Returns:
the MD5 sum of the name of the expression or group

getTableName

public String getTableName()
Retrieves the tablename-field of the current object.

Returns:
the name of the cache table

getCreationTime

public long getCreationTime()
Retrieves the creationtime-field of the current object

Returns:
the creation time of the cache table in milliseconds since January, 1st 1970.

iiitAccessServer 1.0

Copyright © 2002, 2003 ingeneurbuero fuer innovative informationstechnik, Dipl.-Ing. Joerg Beckmann, Dortmund, Germany. All Rights Reserved.
See Copyright statement