| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DBHandling |
|
| 1.0;1 |
| 1 | package org.apache.ojb.broker.util.dbhandling; | |
| 2 | ||
| 3 | /* Copyright 2004-2005 The Apache Software Foundation | |
| 4 | * | |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * 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 | /** | |
| 31 | * Sets the working directory. | |
| 32 | * | |
| 33 | * @param dir The directory | |
| 34 | * @throws IOException If the directory does not exist or cannot be written/read | |
| 35 | */ | |
| 36 | public void setWorkDir(String dir) throws IOException; | |
| 37 | ||
| 38 | /** | |
| 39 | * Sets the jdbc connection to use. | |
| 40 | * | |
| 41 | * @param jcd The connection to use | |
| 42 | * @throws PlatformException If the target database cannot be handled | |
| 43 | */ | |
| 44 | public void setConnection(JdbcConnectionDescriptor jcd) 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, String listOfFilenames) throws IOException; | |
| 60 | ||
| 61 | /** | |
| 62 | * Adds an input streams containg part of the db definition to use. | |
| 63 | * | |
| 64 | * @param schemataStreams Input streams | |
| 65 | */ | |
| 66 | public void addDBDefinitionFile(InputStream inputStream) throws IOException; | |
| 67 | ||
| 68 | /** | |
| 69 | * Creates the database. | |
| 70 | * | |
| 71 | * @throws PlatformException If some error occurred | |
| 72 | */ | |
| 73 | public void createDB() throws PlatformException; | |
| 74 | ||
| 75 | /** | |
| 76 | * Creates the tables according to the schema files. | |
| 77 | * | |
| 78 | * @throws PlatformException If some error occurred | |
| 79 | */ | |
| 80 | public void initDB() throws PlatformException; | |
| 81 | } |