KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > dbscript > CommandFilterIF


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.dbscript;
7
8 import java.sql.Connection JavaDoc;
9 import java.sql.SQLException JavaDoc;
10
11 /**
12  * Allows you to perform tasks just {@link #beforeCommand before} and just
13  * {@link #afterCommand after} a {@link CommandIF command} is executed.
14  * You can also {@link #catchException catch} exceptions that happen.
15  *
16  * @version $Revision: 1.5 $, $Date: 2003/03/03 11:12:03 $
17  * @author Bill Horsman (bill@logicalcobwebs.co.uk)
18  * @author $Author: billhorsman $ (current maintainer)
19  * @since Proxool 0.5
20  */

21 public interface CommandFilterIF {
22
23     /**
24      * Implement this if you want to do something special before each command is run.
25      * @param connection the connection being used
26      * @param command the command about to be run
27      * @return true if the command should be executed, or false to skip the command
28      * @throws SQLException if anything goes wrong. This will terminate the script.
29      */

30     boolean beforeCommand(Connection JavaDoc connection, CommandIF command) throws SQLException JavaDoc;
31
32     /**
33      * Implement this if you want to do something special after each command is run
34      * but before the connection is closed
35      * @param connection the connection being used
36      * @param command the command that was run
37      * @throws SQLException if anything goes wrong. This will terminate the script.
38      */

39     void afterCommand(Connection JavaDoc connection, CommandIF command) throws SQLException JavaDoc;
40
41     /**
42      * Any SQLException will be passed to this method.
43      * @param e the exception
44      * @return true if execution should continue, false if it should stop (including any remaining executions in the loop)
45      */

46     boolean catchException(CommandIF command, SQLException JavaDoc e);
47
48 }
49
50 /*
51  Revision history:
52  $Log: CommandFilterIF.java,v $
53  Revision 1.5 2003/03/03 11:12:03 billhorsman
54  fixed licence
55
56  Revision 1.4 2003/02/19 15:14:19 billhorsman
57  fixed copyright (copy and paste error,
58  not copyright change)
59
60  Revision 1.3 2002/11/09 15:58:37 billhorsman
61  fix and added doc
62
63  Revision 1.2 2002/11/09 14:45:07 billhorsman
64  now threaded and better exception handling
65
66  Revision 1.1 2002/11/06 21:07:42 billhorsman
67  New interfaces to allow filtering of commands
68
69 */

70
Popular Tags