@Internal public class FileCatalogStore extends AbstractCatalogStore
CatalogStore
that stores all catalog configuration to a directory. Configuration of
every catalog will be saved into a single file. The file name will be {catalogName}.yaml by
default.isOpen
Constructor and Description |
---|
FileCatalogStore(String catalogStorePath)
Creates a new
FileCatalogStore instance with the specified directory path. |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(String catalogName)
Returns whether the specified catalog exists in the catalog store.
|
Optional<CatalogDescriptor> |
getCatalog(String catalogName)
Returns the catalog descriptor for the specified catalog, if it exists in the catalog store.
|
Set<String> |
listCatalogs()
Returns a set of all catalog names in the catalog store.
|
void |
open()
Opens the catalog store and initializes the catalog file map.
|
void |
removeCatalog(String catalogName,
boolean ignoreIfNotExists)
Removes the specified catalog from the catalog store.
|
void |
storeCatalog(String catalogName,
CatalogDescriptor catalog)
Stores the specified catalog in the catalog store.
|
checkOpenState, close
public FileCatalogStore(String catalogStorePath)
FileCatalogStore
instance with the specified directory path.catalogStorePath
- the directory path where catalog configurations will be storedpublic void open() throws CatalogException
open
in interface CatalogStore
open
in class AbstractCatalogStore
CatalogException
- if the catalog store directory does not exist, not a directory, or
if there is an error reading the directorypublic void storeCatalog(String catalogName, CatalogDescriptor catalog) throws CatalogException
catalogName
- the name of the catalogcatalog
- the catalog descriptor to storeCatalogException
- if the catalog store is not open or if there is an error storing the
catalogpublic void removeCatalog(String catalogName, boolean ignoreIfNotExists) throws CatalogException
catalogName
- the name of the catalog to removeignoreIfNotExists
- whether to ignore if the catalog does not exist in the catalog storeCatalogException
- if the catalog store is not open or if there is an error removing
the catalogpublic Optional<CatalogDescriptor> getCatalog(String catalogName) throws CatalogException
catalogName
- the name of the catalog to retrieveOptional
containing the catalog descriptor, or an empty Optional
if the catalog does not exist in the catalog storeCatalogException
- if the catalog store is not open or if there is an error retrieving
the catalogpublic Set<String> listCatalogs() throws CatalogException
CatalogException
- if the catalog store is not open or if there is an error retrieving
the list of catalog namespublic boolean contains(String catalogName) throws CatalogException
catalogName
- the name of the catalog to checktrue
if the catalog exists in the catalog store, false
otherwiseCatalogException
- if the catalog store is not open or if there is an error checking
for the catalogCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.