Class FileCatalogStore

  • All Implemented Interfaces:
    CatalogStore

    @Internal
    public class FileCatalogStore
    extends AbstractCatalogStore
    A 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.
    • Constructor Detail

      • FileCatalogStore

        public FileCatalogStore​(String catalogStorePath)
        Creates a new FileCatalogStore instance with the specified directory path.
        Parameters:
        catalogStorePath - the directory path where catalog configurations will be stored
    • Method Detail

      • storeCatalog

        public void storeCatalog​(String catalogName,
                                 CatalogDescriptor catalog)
                          throws CatalogException
        Stores the specified catalog in the catalog store.
        Parameters:
        catalogName - the name of the catalog
        catalog - the catalog descriptor to store
        Throws:
        CatalogException - if the catalog store is not open or if there is an error storing the catalog
      • removeCatalog

        public void removeCatalog​(String catalogName,
                                  boolean ignoreIfNotExists)
                           throws CatalogException
        Removes the specified catalog from the catalog store.
        Parameters:
        catalogName - the name of the catalog to remove
        ignoreIfNotExists - whether to ignore if the catalog does not exist in the catalog store
        Throws:
        CatalogException - if the catalog store is not open or if there is an error removing the catalog
      • getCatalog

        public Optional<CatalogDescriptor> getCatalog​(String catalogName)
                                               throws CatalogException
        Returns the catalog descriptor for the specified catalog, if it exists in the catalog store.
        Parameters:
        catalogName - the name of the catalog to retrieve
        Returns:
        an Optional containing the catalog descriptor, or an empty Optional if the catalog does not exist in the catalog store
        Throws:
        CatalogException - if the catalog store is not open or if there is an error retrieving the catalog
      • listCatalogs

        public Set<String> listCatalogs()
                                 throws CatalogException
        Returns a set of all catalog names in the catalog store.
        Returns:
        a set of all catalog names in the catalog store
        Throws:
        CatalogException - if the catalog store is not open or if there is an error retrieving the list of catalog names
      • contains

        public boolean contains​(String catalogName)
                         throws CatalogException
        Returns whether the specified catalog exists in the catalog store.
        Parameters:
        catalogName - the name of the catalog to check
        Returns:
        true if the catalog exists in the catalog store, false otherwise
        Throws:
        CatalogException - if the catalog store is not open or if there is an error checking for the catalog