01: /*
02: * This software is released under a licence similar to the Apache Software Licence.
03: * See org.logicalcobwebs.proxool.package.html for details.
04: * The latest version is available at http://proxool.sourceforge.net
05: */
06: package org.logicalcobwebs.dbscript;
07:
08: import java.sql.Connection;
09: import java.sql.SQLException;
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 connection, CommandIF command)
31: throws SQLException;
32:
33: /**
34: * Implement this if you want to do something special after each command is run
35: * but before the connection is closed
36: * @param connection the connection being used
37: * @param command the command that was run
38: * @throws SQLException if anything goes wrong. This will terminate the script.
39: */
40: void afterCommand(Connection connection, CommandIF command)
41: throws SQLException;
42:
43: /**
44: * Any SQLException will be passed to this method.
45: * @param e the exception
46: * @return true if execution should continue, false if it should stop (including any remaining executions in the loop)
47: */
48: boolean catchException(CommandIF command, SQLException e);
49:
50: }
51:
52: /*
53: Revision history:
54: $Log: CommandFilterIF.java,v $
55: Revision 1.5 2003/03/03 11:12:03 billhorsman
56: fixed licence
57:
58: Revision 1.4 2003/02/19 15:14:19 billhorsman
59: fixed copyright (copy and paste error,
60: not copyright change)
61:
62: Revision 1.3 2002/11/09 15:58:37 billhorsman
63: fix and added doc
64:
65: Revision 1.2 2002/11/09 14:45:07 billhorsman
66: now threaded and better exception handling
67:
68: Revision 1.1 2002/11/06 21:07:42 billhorsman
69: New interfaces to allow filtering of commands
70:
71: */
|