KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > ForeignKeyTrigger


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: ForeignKeyTrigger.java,v 1.6 2006/10/30 21:14:12 bostic Exp $
7  */

8
9 package com.sleepycat.je;
10
11 import com.sleepycat.je.txn.Locker;
12
13 class ForeignKeyTrigger implements DatabaseTrigger {
14
15     private SecondaryDatabase secDb;
16
17     ForeignKeyTrigger(SecondaryDatabase secDb) {
18
19         this.secDb = secDb;
20     }
21
22     public void triggerAdded(Database db) {
23     }
24
25     public void triggerRemoved(Database db) {
26
27         secDb.clearForeignKeyTrigger();
28     }
29
30     public void databaseUpdated(Database db,
31                                 Locker locker,
32                                 DatabaseEntry priKey,
33                                 DatabaseEntry oldData,
34                                 DatabaseEntry newData)
35         throws DatabaseException {
36
37         if (newData == null) {
38             secDb.onForeignKeyDelete(locker, priKey);
39         }
40     }
41 }
42
Popular Tags