KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > serversystem > dmlvalidation > triggersystem > TriggerSystem


1 package com.daffodilwoods.daffodildb.server.serversystem.dmlvalidation.triggersystem;
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  *
10  * <p>Title: Trigger System</p>
11  * <p>Description: </p>
12  * Trigger System maintains a list of constraint Databases along with their URL,
13  * and retreives the Database when it is required by passing its URL.
14  */

15 public class TriggerSystem implements _TriggerSystem{
16
17    /**
18     * instance of datadictionarysystem used to create a new trigger database.
19     */

20    private _DataDictionarySystem dataDictionarySystem;
21
22    /**
23     * used to maintain a list of trigger databases.
24     */

25    private WeakOrderedKeyList triggerDatabaseList = new WeakOrderedKeyList( new CTusjohDbtfJoTfotjujwfDpnqbsbups());
26
27    /**
28     * used to construct a new instance of trigger system with the given arguments.
29     * @param dataDictionarySystem instance of datadictionary system
30     * @throws DException
31     */

32    public TriggerSystem( _DataDictionarySystem dataDictionarySystem ) throws DException {
33      this.dataDictionarySystem = dataDictionarySystem;
34    }
35
36    /**
37     * retreives an Object of Trigger Database with given name from the database list.
38     * If the database is not present in the list , it creates a new instance of the database
39    * and adds it up in the list.
40     * @param databaseURL name of the database.
41     * @return _Trigger Database instance of interface that has been retreived by the method.
42     * @throws DException
43     */

44
45    public _TriggerDatabase getTriggerDatabase(String JavaDoc databaseURL) throws DException {
46      _TriggerDatabase triggerDatabase = (_TriggerDatabase)triggerDatabaseList.get(databaseURL);
47      if( triggerDatabase != null )
48        return triggerDatabase;
49      triggerDatabaseList.put(databaseURL , triggerDatabase = new TriggerDatabase(dataDictionarySystem.getDataDictionary( databaseURL ).getDDSTriggerOperation()) );
50      return triggerDatabase;
51    }
52
53   public void deleteDatabase(String JavaDoc parm1) throws com.daffodilwoods.database.resource.DException {
54     try {
55         triggerDatabaseList.delete(parm1);
56     }
57     catch (DException ex) {
58     }
59   }
60 }
61
Popular Tags