KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: DatabaseTrigger.java,v 1.8 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 /**
14  * Implemented to receive database update notifications.
15  *
16  * <p>The databaseUpdated() method may perform additional database operations
17  * using the transaction passed to it, or by starting a new transaction.
18  * The transaction passed may not be explicitly committed or aborted.</p>
19  */

20 interface DatabaseTrigger {
21
22     /**
23      * Notifies the trigger that it has been added and will start receiving
24      * update notifications.
25      *
26      * @param db the database to which the trigger was added.
27      */

28     void triggerAdded(Database db);
29
30     /**
31      * Notifies the trigger that it has been removed and will stop receiving
32      * update notifications.
33      *
34      * @param db the database from which the trigger was removed.
35      */

36     void triggerRemoved(Database db);
37
38     /**
39      * Notifies the trigger that a put or delete operation has been performed
40      * on the database.
41      *
42      * <p>When a new entry is inserted, oldData will be null and newData will
43      * be non-null.</p>
44      *
45      * <p>When an existing entry is updated, oldData and newData will be
46      * non-null.</p>
47      *
48      * <p>When an existing entry is deleted, oldData will be non-null and
49      * newData will be null.</p>
50      *
51      * @param db the database that was modified.
52      *
53      * @param locker the internal locker.
54      *
55      * @param priKey the primary key, which is never null.
56      *
57      * @param oldData the primary data before the change, or null if the record
58      * did not previously exist.
59      *
60      * @param newData the primary data after the change, or null if the record
61      * has been deleted.
62      */

63     void databaseUpdated(Database db,
64                          Locker locker,
65                          DatabaseEntry priKey,
66                          DatabaseEntry oldData,
67                          DatabaseEntry newData)
68         throws DatabaseException;
69 }
70
71
Popular Tags