KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > serversystem > dmlvalidation > statementtriggersystem > StatementTriggerDatabase


1 package com.daffodilwoods.daffodildb.server.serversystem.dmlvalidation.statementtriggersystem;
2
3 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*;
4 import com.daffodilwoods.daffodildb.utils.comparator.*;
5 import com.daffodilwoods.database.general.*;
6 import com.daffodilwoods.database.resource.*;
7 /**
8  *
9  * <p>Title: Statement Trigger Database</p>
10  * <p>Description: </p>
11  * statement trigger Database maintains a list of all the statement trigger tables in the database.
12 * It retreives the table from the list when a call is made to get the table and
13  * removes the table from the list when the method remove table is called.
14  */

15 public class StatementTriggerDatabase implements _StatementTriggerDatabase{
16
17    /**
18     * instance of _DDSTriggerOperations that is used to create a new statement trigger table.
19     */

20   private _DDSTriggerOperations ddsTriggerOperations;
21
22   /**
23    * Used to maintain a list of all the tables in the statement trigger database.
24    */

25   private WeakOrderedKeyList statementTriggerTableList = new WeakOrderedKeyList( new CTusjohDbtfJoTfotjujwfDpnqbsbups() );
26
27   /**
28    * used to construct a new instance of statement trigger database with the help of given arguments.
29    * @param ddsTriggerOperations instance of _DDSTriggerOperations
30    * @throws DException
31    */

32   public StatementTriggerDatabase(_DDSTriggerOperations ddsTriggerOperations) throws DException {
33     this.ddsTriggerOperations = ddsTriggerOperations;
34   }
35
36   /**
37    * retreives an instance of statement trigger table for the given tableName.
38    * If the table is not present in the list , it create a new table and adds it up in the list
39    * @param tableName name of the table.
40    * @return _StatementTriggerTable instance of statement trigger table that has been retreived by the getTable method.
41    * @throws DException
42    */

43
44   public synchronized _StatementTriggerTable getStatementTriggerTable(QualifiedIdentifier tableName) throws DException {
45         _StatementTriggerTable statementTriggerTable = (_StatementTriggerTable )statementTriggerTableList.get(tableName.getIdentifier());
46     if( statementTriggerTable != null )
47        return statementTriggerTable;
48     _TriggerCharacteristics triggerCharacteristics = ddsTriggerOperations.getTriggerCharacteristics(tableName,false);
49     statementTriggerTable = new StatementTriggerTable(triggerCharacteristics , tableName);
50     statementTriggerTableList.put(tableName.getIdentifier() , statementTriggerTable);
51     return statementTriggerTable;
52   }
53
54
55   /**
56    * removes the table with the given name from the StatementTriggerTable list
57    * @param tableName name of the table
58    * @throws DException
59    */

60
61   public void removeTable(QualifiedIdentifier tableName ) throws DException {
62     statementTriggerTableList.remove(tableName.getIdentifier());
63   }
64 }
65
Popular Tags