Class GravitinoClientBase

java.lang.Object
org.apache.gravitino.client.GravitinoClientBase
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
GravitinoAdminClient, GravitinoClient

public abstract class GravitinoClientBase extends Object implements Closeable
Base class for Gravitino Java client;

It uses an underlying RESTClient to send HTTP requests and receive responses from the API.

  • Field Details

    • restClient

      protected final RESTClient restClient
      The REST client to communicate with the REST server
    • API_METALAKES_LIST_PATH

      protected static final String API_METALAKES_LIST_PATH
      The REST API path for listing metalakes
      See Also:
    • API_METALAKES_IDENTIFIER_PATH

      protected static final String API_METALAKES_IDENTIFIER_PATH
      The REST API path prefix for load a specific metalake
      See Also:
  • Constructor Details

    • GravitinoClientBase

      protected GravitinoClientBase(String uri, org.apache.gravitino.client.AuthDataProvider authDataProvider, boolean checkVersion, Map<String,String> headers, Map<String,String> properties)
      Constructs a new GravitinoClient with the given URI, authenticator and AuthDataProvider.
      Parameters:
      uri - The base URI for the Gravitino API.
      authDataProvider - The provider of the data which is used for authentication.
      checkVersion - Whether to check the version of the Gravitino server.
      headers - The base header of the Gravitino API.
      properties - A map of properties (key-value pairs) used to configure the Gravitino client.
  • Method Details

    • checkVersion

      public void checkVersion()
      Check the compatibility of the client with the target server.
      Throws:
      GravitinoRuntimeException - If the client version is greater than the server version.
    • clientVersion

      public GravitinoVersion clientVersion()
      Retrieves the version of the Gravitino client.
      Returns:
      A GravitinoVersion instance representing the version of the Gravitino client.
    • loadMetalake

      public GravitinoMetalake loadMetalake(String metalakeName) throws NoSuchMetalakeException
      Loads a specific Metalake from the Gravitino API.
      Parameters:
      metalakeName - The name of the Metalake to be loaded.
      Returns:
      A GravitinoMetalake instance representing the loaded Metalake.
      Throws:
      NoSuchMetalakeException - If the specified Metalake does not exist.
    • checkMetalakeName

      public void checkMetalakeName(String metalakeName)
      Checks the validity of the Metalake name.
      Parameters:
      metalakeName - the name of the Metalake to be checked.
      Throws:
      IllegalNameIdentifierException - If the Metalake name is invalid.
    • getVersion

      @Deprecated @InlineMe(replacement="this.serverVersion()") public final GravitinoVersion getVersion()
      Deprecated.
      This method is deprecated because it is a duplicate of serverVersion(). Use serverVersion() instead for clarity and consistency.
      Retrieves the version of the Gravitino API.
      Returns:
      A GravitinoVersion instance representing the version of the Gravitino API.
    • serverVersion

      public GravitinoVersion serverVersion()
      Retrieves the server version of the Gravitino server.
      Returns:
      A GravitinoVersion instance representing the server version of the Gravitino API.
    • close

      public void close()
      Closes the GravitinoClient and releases any underlying resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable