Package org.apache.gravitino.client
Class GravitinoClientBase
java.lang.Object
org.apache.gravitino.client.GravitinoClientBase
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
GravitinoAdminClient
,GravitinoClient
Base class for Gravitino Java client;
It uses an underlying RESTClient
to send HTTP requests and receive responses from the
API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for constructing a GravitinoClient. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final String
The REST API path prefix for load a specific metalakeprotected static final String
The REST API path for listing metalakesprotected final RESTClient
The REST client to communicate with the REST server -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
checkMetalakeName
(String metalakeName) Checks the validity of the Metalake name.void
Check the compatibility of the client with the target server.Retrieves the version of the Gravitino client.void
close()
Closes the GravitinoClient and releases any underlying resources.final GravitinoVersion
Deprecated.loadMetalake
(String metalakeName) Loads a specific Metalake from the Gravitino API.Retrieves the server version of the Gravitino server.
-
Field Details
-
restClient
The REST client to communicate with the REST server -
API_METALAKES_LIST_PATH
The REST API path for listing metalakes- See Also:
-
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
Retrieves the version of the Gravitino client.- Returns:
- A GravitinoVersion instance representing the version of the Gravitino client.
-
loadMetalake
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
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 ofserverVersion()
. UseserverVersion()
instead for clarity and consistency.Retrieves the version of the Gravitino API.- Returns:
- A GravitinoVersion instance representing the version of the Gravitino API.
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
serverVersion()
.