1 /* 2 Copyright (c) 2016 James Ahlborn 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package com.healthmarketscience.jackcess; 18 19 import java.io.IOException; 20 21 /** 22 * Basic metadata about a single database Table. This is the top-level 23 * information stored in a (local) database which can be retrieved without 24 * attempting to load the Table itself. 25 * 26 * @author James Ahlborn 27 * @usage _intermediate_class_ 28 */ 29 public interface TableMetaData 30 { 31 public enum Type { 32 LOCAL, LINKED, LINKED_ODBC; 33 } 34 35 /** 36 * The type of table 37 */ 38 public Type getType(); 39 40 /** 41 * The name of the table (as it is stored in the database) 42 */ 43 public String getName(); 44 45 /** 46 * {@code true} if this is a linked table, {@code false} otherwise. 47 */ 48 public boolean isLinked(); 49 50 /** 51 * {@code true} if this is a system table, {@code false} otherwise. 52 */ 53 public boolean isSystem(); 54 55 /** 56 * The name of this linked table in the linked database if this is a linked 57 * table, {@code null} otherwise. 58 */ 59 public String getLinkedTableName(); 60 61 /** 62 * The name of this the linked database if this is a linked table, {@code 63 * null} otherwise. 64 */ 65 public String getLinkedDbName(); 66 67 /** 68 * The connection of this the linked database if this is a linked ODBC 69 * table, {@code null} otherwise. 70 */ 71 public String getConnectionName(); 72 73 /** 74 * Opens this table from the given Database instance. 75 */ 76 public Table open(Database db) throws IOException; 77 78 /** 79 * Gets the local table definition from the given Database instance if 80 * available. Only useful for linked ODBC tables. 81 */ 82 public TableDefinition getTableDefinition(Database db) throws IOException; 83 }