KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > db > sql > visualeditor > querybuilder > SqlStatementMetaDataCache


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * SqlStatementMetaDataCache.java
21  *
22  * Created on May 2, 2005, 5:49 AM
23  *
24  */

25
26 package org.netbeans.modules.db.sql.visualeditor.querybuilder;
27
28 import java.sql.SQLException JavaDoc;
29 import java.util.List JavaDoc;
30
31 /**
32  * Implements a cache for Query Builder's meta data.
33  *
34  * @author jfbrown
35  */

36 public interface SqlStatementMetaDataCache {
37
38
39     /**
40      * schema names to display on "add table" etc.
41      */

42     public String JavaDoc[] getSchemas() ;
43
44     /**
45      * Returns the list of tables and views that may be exist in the query.
46      * returns a List of Strings.
47      */

48     public List JavaDoc getTables() throws SQLException JavaDoc ;
49
50     /****
51      * Returns the primary key columns for the given table.
52      * returns a List of Strings.
53      */

54     public List JavaDoc getPrimaryKeys(String JavaDoc fullTableName) throws SQLException JavaDoc ;
55
56     /***
57      * returns the foreign keys (exported or imported) for the given table.
58      * if exported=true, use databaseMetaData.getExportedKeys(), else use
59      * databaseMetaData.getImportedKeys()
60      * returns a List of Strings.
61      */

62     public List JavaDoc getForeignKeys(String JavaDoc fullTableName, boolean exported) throws SQLException JavaDoc ;
63
64     /**
65      * Returns the imported key columns for this table -- i.e., the columns
66      * whose value is a foreign key for another table. These columns are
67      * displayed with a special icon in the Query Builder.
68      * returns a List of Strings.
69      */

70     public List JavaDoc getImportedKeyColumns(String JavaDoc fullTableName) throws SQLException JavaDoc ;
71
72     /**
73      * Returns the set of column names in the specified table.
74      * @fullTableName schema.name or name of table. If null, return all columns.
75      * @returns a List of Strings.
76      */

77     public List JavaDoc getColumnNames(String JavaDoc fullTableName) throws SQLException JavaDoc ;
78
79     /****
80      * gets the tables that have cached colmumn names
81      */

82     public String JavaDoc[] getCachedColmnNameTables() throws SQLException JavaDoc ;
83     public java.util.Map JavaDoc getAllColumnNames() throws SQLException JavaDoc ;
84
85     /***
86      * Validates the connection to the database.
87      * returns true if the cache's connection to the database is valid.
88      * If not valid (not connected), throws an SQLException.
89      *
90      * If QueryBuilder gets and SQLException on any other method call,
91      * it calls this method.
92      */

93     public boolean checkDataBaseConnection() throws SQLException JavaDoc ;
94
95 }
96
Popular Tags