KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > database > DatabaseProcedure


1 /**
2  * com.mckoi.database.DatabaseProcedure 10 Aug 2000
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.database;
26
27 /**
28  * This interface represents a database procedure that is executed on the
29  * server side. It is used to perform database specific functions that can
30  * only be performed on the server.
31  * <p>
32  * A procedure must manage its own table locking.
33  *
34  * @author Tobias Downer
35  */

36
37 public interface DatabaseProcedure {
38
39   /**
40    * Executes the procudure and returns the resultant table. Note, the
41    * args have to be serializable. There may be only 0 to 16 arguments.
42    * The method may throw a 'DatabaseException' if the procedure failed.
43    */

44   Table execute(User user, Object JavaDoc[] args) throws DatabaseException;
45
46   /**
47    * This returns a DataTable[] array that lists the DataTables that are read
48    * during this procedure.
49    */

50   DataTable[] getReadTables(DatabaseConnection db) throws DatabaseException;
51
52   /**
53    * Returns a DataTable[] array that lists the DataTables that are written
54    * to during this procedure.
55    */

56   DataTable[] getWriteTables(DatabaseConnection db) throws DatabaseException;
57
58   /**
59    * Returns the locking mode in which the database operates. This is either
60    * LockingMechanism.SHARED_MODE or LockingMechanism.EXCLUSIVE_MODE. In most
61    * cases this will be SHARED_MODE.
62    */

63   int getLockingMode();
64
65   /**
66    * Sets the LockHandle object for this procedure. This should be called
67    * after the tables that this procedure uses have been locked.
68    */

69   void setLockHandle(LockHandle lock_handle);
70
71 }
72
Popular Tags