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.calcite.catalog; 018 019import org.checkerframework.checker.nullness.qual.Nullable; 020 021import java.util.List; 022 023/** 024 * Represents a database catalog containing schemas, tables, and columns. 025 * 026 * <p>A catalog is the top-level container in the database metadata hierarchy: 027 * <pre> 028 * Catalog 029 * └── Schema 030 * └── Table 031 * └── Column 032 * </pre> 033 * 034 * <p>This is a standalone version that can be used independently of Apache Calcite. 035 */ 036public interface Catalog { 037 /** 038 * Returns the name of the catalog. 039 * 040 * @return Catalog name 041 */ 042 String getName(); 043 044 /** 045 * Returns all schemas in this catalog. 046 * 047 * @return List of schemas 048 */ 049 List<Schema> getSchemas(); 050 051 /** 052 * Returns a schema by name, or null if not found. 053 * 054 * @param schemaName Schema name (case-sensitive) 055 * @return Schema, or null 056 */ 057 @Nullable Schema getSchema(String schemaName); 058 059 /** 060 * Returns all schema names in this catalog. 061 * 062 * @return List of schema names 063 */ 064 List<String> getSchemaNames(); 065 066 /** 067 * Returns a table by qualified name (schema.table), or null if not found. 068 * 069 * @param schemaName Schema name 070 * @param tableName Table name 071 * @return Table, or null 072 */ 073 @Nullable Table getTable(String schemaName, String tableName); 074 075 /** 076 * Returns the default schema name, or null if not set. 077 * 078 * @return Default schema name, or null 079 */ 080 @Nullable String getDefaultSchemaName(); 081}