001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to you under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package gudusoft.gsqlparser.ext.catalog; 018 019import java.util.List; 020 021/** 022 * Represents a database catalog containing schemas, tables, and columns. 023 * 024 * <p>A catalog is the top-level container in the database metadata hierarchy: 025 * <pre> 026 * Catalog 027 * └── Schema 028 * └── Table 029 * └── Column 030 * </pre> 031 * 032 * <p>Originally derived from Apache Calcite's catalog interfaces. 033 */ 034public interface Catalog { 035 /** 036 * Returns the name of the catalog. 037 * 038 * @return Catalog name 039 */ 040 String getName(); 041 042 /** 043 * Returns all schemas in this catalog. 044 * 045 * @return List of schemas 046 */ 047 List<Schema> getSchemas(); 048 049 /** 050 * Returns a schema by name, or null if not found. 051 * 052 * @param schemaName Schema name (case-sensitive) 053 * @return Schema, or null 054 */ 055 Schema getSchema(String schemaName); 056 057 /** 058 * Returns all schema names in this catalog. 059 * 060 * @return List of schema names 061 */ 062 List<String> getSchemaNames(); 063 064 /** 065 * Returns a table by qualified name (schema.table), or null if not found. 066 * 067 * @param schemaName Schema name 068 * @param tableName Table name 069 * @return Table, or null 070 */ 071 Table getTable(String schemaName, String tableName); 072 073 /** 074 * Returns the default schema name, or null if not set. 075 * 076 * @return Default schema name, or null 077 */ 078 String getDefaultSchemaName(); 079}