KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > persist > db > ModifiableDatabaseSchema


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: ModifiableDatabaseSchema.java,v 1.1 2007/01/10 05:09:38 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.persist.db;
23
24 import java.sql.Connection JavaDoc;
25 import java.sql.SQLException JavaDoc;
26 import java.util.Map JavaDoc;
27
28 import org.opensubsystems.core.error.OSSException;
29
30 /**
31  * Interface representing database schema, which is set of related database
32  * objects such as tables, constraints and indexes. One database instance
33  * will usually consists of multiple schemas coresponding to components used
34  * in the application. Each component or subsystem will provide one or multiple
35  * database schemas, which will be responsible for creation of all database
36  * structures for this components, for the upgrade of existing database
37  * structures to the latest version and also will encapsulate all specific
38  * database dependent information (such as database dependent queries).
39  *
40  * @version $Id: ModifiableDatabaseSchema.java,v 1.1 2007/01/10 05:09:38 bastafidli Exp $
41  * @author Miro Halas
42  * @code.reviewer Miro Halas
43  * @code.reviewed 1.6 2006/07/21 22:47:38 jlegeny
44  */

45 public interface ModifiableDatabaseSchema extends DatabaseSchema
46 {
47    // Accessors ////////////////////////////////////////////////////////////////
48

49    /**
50     * Get the names of all tables that can be modified by the operations
51     * provided by this database schema (e.g. schema allows insert, update or
52     * delete on this table).
53     *
54     * @return Map - map of table names for particular schema.
55     * key = object data type
56     * value = table name
57     * null if the schema doesn't allow to modify any of the tables
58     */

59    Map JavaDoc getModifiableTableNames(
60    );
61
62    // Logic ////////////////////////////////////////////////////////////////////
63

64    /**
65     * Method deletes related child data when main data object is being deleted.
66     * This method has to be overriden for databases that don't support cascade
67     * delete (eg. Sybase ASE).
68     *
69     * @param cntDBConnection - valid connection to database
70     * @param iDataType - data type identifying what to delete
71     * @param iId - ID of the record that has to be deleted
72     * @throws OSSException - problem deleting related data
73     * @throws SQLException - problem deleting related data
74     * @return int - number of deleted records
75     */

76    int deleteRelatedData(
77       Connection JavaDoc cntDBConnection,
78       int iDataType,
79       int iId
80    ) throws OSSException,
81             SQLException JavaDoc;
82 }
83
Popular Tags