KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > webdocwf > util > loader > test > DatabaseOperation


1 /*
2
3      Loader - tool for transfering data from one JDBC source to another and
4      doing transformations during copy.
5
6     Copyright (C) 2002 Together
7
8     This library is free software; you can redistribute it and/or
9     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 JavaDoc;
31 import org.webdocwf.util.loader.Loader;
32
33 import java.sql.SQLException JavaDoc;
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 {
43     public static final String JavaDoc NONE = "NONE";
44     public static final String JavaDoc CREATE = "CREATE";
45     public static final String JavaDoc DROP = "DROP";
46     public static final String JavaDoc LOADER = "LOADER";
47     public static DatabaseOperation DO_NOTHING = new DummyAction();
48
49
50     /**
51      * Executes this operation on the specified database using the specified
52      * connection to the database.
53      *
54      * @param conn the database connection.
55      */

56     public abstract void execute(Connection JavaDoc conn) throws SQLException JavaDoc;
57
58
59 /**
60      * Returns type of database operation
61      *
62      */

63     public abstract String JavaDoc getDatabaseOperationType();
64
65
66     private static class DummyAction extends DatabaseOperation
67     {
68         public void execute(Connection JavaDoc conn)
69         {
70         }
71
72         public String JavaDoc getDatabaseOperationType()
73         {
74             return DatabaseOperation.NONE;
75         }
76     }
77 }
78
79
80
81
82
83
84
Popular Tags