01: package org.apache.ojb.broker.util.dbhandling;
02:
03: /* Copyright 2004-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import java.io.IOException;
19: import java.io.InputStream;
20: import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
21: import org.apache.ojb.broker.platforms.PlatformException;
22:
23: /**
24: * Interface for classes providing basic database handling (drop, create, init).
25: *
26: * @author Thomas Dudziak
27: */
28: public interface DBHandling {
29: /**
30: * Sets the working directory.
31: *
32: * @param dir The directory
33: * @throws IOException If the directory does not exist or cannot be written/read
34: */
35: public void setWorkDir(String dir) throws IOException;
36:
37: /**
38: * Sets the jdbc connection to use.
39: *
40: * @param jcd The connection to use
41: * @throws PlatformException If the target database cannot be handled
42: */
43: public void setConnection(JdbcConnectionDescriptor jcd)
44: throws PlatformException;
45:
46: /**
47: * Returns the connection descriptor used by this handling object.
48: *
49: * @return The connection descriptor
50: */
51: public JdbcConnectionDescriptor getConnection();
52:
53: /**
54: * Adds db definition files to use.
55: *
56: * @param srcDir The directory containing the files
57: * @param listOfFilenames The filenames in a comma-separated list
58: */
59: public void addDBDefinitionFiles(String srcDir,
60: String listOfFilenames) throws IOException;
61:
62: /**
63: * Adds an input streams containg part of the db definition to use.
64: *
65: * @param schemataStreams Input streams
66: */
67: public void addDBDefinitionFile(InputStream inputStream)
68: throws IOException;
69:
70: /**
71: * Creates the database.
72: *
73: * @throws PlatformException If some error occurred
74: */
75: public void createDB() throws PlatformException;
76:
77: /**
78: * Creates the tables according to the schema files.
79: *
80: * @throws PlatformException If some error occurred
81: */
82: public void initDB() throws PlatformException;
83: }
|