01: /*
02:
03: Loader - tool for transfering data from one JDBC source to another and
04: doing transformations during copy.
05:
06: Copyright (C) 2002 Together
07:
08: This library is free software; you can redistribute it and/or
09: modify it under the terms of the GNU Lesser General Public
10: License as published by the Free Software Foundation; either
11: version 2.1 of the License, or (at your option) any later version.
12:
13: This library is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: Lesser General Public License for more details.
17:
18: You should have received a copy of the GNU Lesser General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21:
22: /*
23: * DatabaseOperation.java Aug 30, 2002
24: * Sinisa Milosevic sinisami@eunet.yu
25: *
26: */
27:
28: package org.webdocwf.util.loader.test;
29:
30: import java.sql.Connection;
31: import org.webdocwf.util.loader.Loader;
32:
33: import java.sql.SQLException;
34:
35: /**
36: * Defines the interface contract for operations performed on the database.
37: *
38: * @author sinisa Milosevic
39: * @version $Revision: 1.1 $
40: */
41: public abstract class DatabaseOperation {
42: public static final String NONE = "NONE";
43: public static final String CREATE = "CREATE";
44: public static final String DROP = "DROP";
45: public static final String LOADER = "LOADER";
46: public static DatabaseOperation DO_NOTHING = new DummyAction();
47:
48: /**
49: * Executes this operation on the specified database using the specified
50: * connection to the database.
51: *
52: * @param conn the database connection.
53: */
54: public abstract void execute(Connection conn) throws SQLException;
55:
56: /**
57: * Returns type of database operation
58: *
59: */
60: public abstract String getDatabaseOperationType();
61:
62: private static class DummyAction extends DatabaseOperation {
63: public void execute(Connection conn) {
64: }
65:
66: public String getDatabaseOperationType() {
67: return DatabaseOperation.NONE;
68: }
69: }
70: }
|