KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > ddl > DatabaseSpecificationFactory


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.lib.ddl;
21
22 import java.sql.*;
23 import java.util.Set JavaDoc;
24 import org.netbeans.lib.ddl.*;
25
26 /**
27 * The factory interface used for creating instances of DatabaseSpecification class.
28 * DatabaseSpecificationFactory collects information about available database
29 * description files. Then it's able to specify if system can control
30 * the database (specified by product name or live connection). It also
31 * provides a list of supported databases.
32 *
33 * @author Slavek Psenicka
34 */

35 public interface DatabaseSpecificationFactory {
36
37     /** Returns array of database products supported by system. It returns
38     * string array only, not the DatabaseSpecification array.
39     */

40     public Set JavaDoc supportedDatabases();
41
42     /** Returns true if database (specified by databaseProductName) is
43     * supported by system. Does not throw exception if it doesn't.
44     * @param databaseProductName Database product name as given from DatabaseMetaData
45     * @return True if database product is supported.
46     */

47     public boolean isDatabaseSupported(String JavaDoc databaseProductName);
48
49     /** Creates instance of DatabaseSpecification class; a database-specification
50     * class. This object knows about used database and can be used as
51     * factory for db-manipulating commands. It connects to the database
52     * and reads database metadata. Throws DBException if database
53     * (obtained from database metadata) is not supported.
54     * @param connection Database connection used to obtain database product name
55     * directly from the database.
56     * @return Specification object.
57     */

58     public DatabaseSpecification createSpecification(DBConnection connection, Connection c)
59     throws DatabaseProductNotFoundException, DDLException;
60
61     /** Creates instance of DatabaseSpecification class; a database-specification
62     * class. This object knows about used database and can be used as
63     * factory for db-manipulating commands. It connects to database and
64     * reads metadata as createSpecification(DBConnection connection), but always
65     * uses specified databaseProductName. This is not recommended technique.
66     * @param connection Database connection (is NOT used to obtain database product name)
67     * @return Specification object.
68     */

69     public DatabaseSpecification createSpecification(DBConnection connection, String JavaDoc databaseProductName, Connection c) throws DatabaseProductNotFoundException;
70
71     public DatabaseSpecification createSpecification(Connection c)
72     throws DatabaseProductNotFoundException, SQLException;
73
74     /** Returns debug-mode flag
75     */

76     public boolean isDebugMode();
77
78     /** Sets debug-mode flag
79     */

80     public void setDebugMode(boolean mode);
81 }
82
83 /*
84 * <<Log>>
85 */

86
Popular Tags