KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: SecondaryTrigger.java,v 1.12 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 SecondaryTrigger implements DatabaseTrigger {
14
15     private SecondaryDatabase secDb;
16
17     SecondaryTrigger(SecondaryDatabase secDb) {
18
19         this.secDb = secDb;
20     }
21
22     final SecondaryDatabase getDb() {
23
24         return secDb;
25     }
26
27     public void triggerAdded(Database db) {
28     }
29
30     public void triggerRemoved(Database db) {
31
32         secDb.clearPrimary();
33     }
34
35     public void databaseUpdated(Database db,
36                                 Locker locker,
37                                 DatabaseEntry priKey,
38                                 DatabaseEntry oldData,
39                                 DatabaseEntry newData)
40         throws DatabaseException {
41
42         secDb.updateSecondary(locker, null, priKey, oldData, newData);
43     }
44 }
45
Popular Tags