001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: /*
021: *
022: * Copyright 2005 Sun Microsystems, Inc.
023: *
024: * Licensed under the Apache License, Version 2.0 (the "License");
025: * you may not use this file except in compliance with the License.
026: * You may obtain a copy of the License at
027: *
028: * http://www.apache.org/licenses/LICENSE-2.0
029: *
030: * Unless required by applicable law or agreed to in writing, software
031: * distributed under the License is distributed on an "AS IS" BASIS,
032: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
033: * See the License for the specific language governing permissions and
034: * limitations under the License.
035: *
036: */
037: package org.netbeans.modules.jdbcwizard.builder.dbmodel;
038:
039: import java.util.List;
040:
041: /**
042: * Root interface to be implemented by data sources that provide information in a database or
043: * database-like format. Implementing classes must support the Cloneable interface.
044: *
045: * @author
046: */
047: public interface DatabaseModel extends Cloneable {
048:
049: /**
050: * Gets associated DBConnectionDefinition
051: *
052: * @return DBConnectionDefinition
053: */
054: public DBConnectionDefinition getConnectionDefinition();
055:
056: /**
057: * Gets the name of this DBQueryModel.
058: *
059: * @return model name
060: */
061: public String getModelName();
062:
063: /**
064: * Gets the user-defined description string, if any, for this DBQueryModel.
065: *
066: * @return String description, or null if none was defined
067: */
068: public String getModelDescription();
069:
070: /**
071: * Adds new DBTable to the model.
072: *
073: * @param table new DBTable to add
074: * @return true if add succeeded, false otherwise
075: */
076: public boolean addTable(DBTable table);
077:
078: /**
079: * Gets List of DBTables contained in this DBQueryModel
080: *
081: * @return List of DBTable instances
082: */
083: public List getTables();
084:
085: /**
086: * Gets the table, if any, associated with the given tuple (table name, schema name, catalog
087: * name)
088: *
089: * @param fqTableName Fully qualified table name (implementation-specific)
090: * @return The table value
091: */
092: public DBTable getTable(String fqTableName);
093:
094: /**
095: * Gets the table, if any, associated with the given tuple (table name, schema name, catalog
096: * name)
097: *
098: * @param tableName Table name
099: * @param schemaName Schema name; may be null
100: * @param catalogName Catalog name; may be null
101: * @return The table value
102: */
103: public DBTable getTable(String tableName, String schemaName,
104: String catalogName);
105:
106: /**
107: * Constructs a fully qualified name that uniquely identifies the given DBTable instance from
108: * among the available tables in this model The format of this string is implementation-specific
109: * and useful only within the context of retrieving tables from this model.
110: *
111: * @param tbl DBTable whose fully-qualified name is to be generated.
112: * @return fully qualified table name for tbl
113: */
114: public String getFullyQualifiedTableName(DBTable tbl);
115:
116: /**
117: * Constructs a fully qualified name that uniquely identifies a table with the given plain
118: * table, schema and catalog names. The format of this string is implementation-specific and
119: * useful only within the context of retrieving tables from this model.
120: *
121: * @param table plain (unqualified) table name - mandatory
122: * @param schema schema name - may be null
123: * @param catalog catalog name - may be null
124: * @return fully qualified table name based on above parameters
125: */
126: public String getFullyQualifiedTableName(String table,
127: String schema, String catalog);
128:
129: }
|