Package org.apache.gravitino.client
Class GravitinoAdminClient
java.lang.Object
org.apache.gravitino.client.GravitinoClientBase
org.apache.gravitino.client.GravitinoAdminClient
- All Implemented Interfaces:
Closeable,AutoCloseable,SupportsMetalakes
Apache Gravitino Client for the administrator to interact with the Gravitino API, allowing the
client to list, load, create, and alter Metalakes.
Normal users should use GravitinoClient to connect with the Gravitino server.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructing a GravitinoAdminClient.Nested classes/interfaces inherited from class org.apache.gravitino.client.GravitinoClientBase
GravitinoClientBase.Builder<T> -
Field Summary
Fields inherited from class org.apache.gravitino.client.GravitinoClientBase
API_METALAKES_IDENTIFIER_PATH, API_METALAKES_LIST_PATH, restClient -
Method Summary
Modifier and TypeMethodDescriptionalterMetalake(String name, MetalakeChange... changes) Alters a specific Metalake using the Gravitino API.Creates a new builder for constructing a GravitinoClient.Creates a new Metalake using the Gravitino API.voiddisableMetalake(String name) Disable a metalake.booleandropMetalake(String name, boolean force) Drop a metalake with specified name.voidenableMetalake(String name) Enable a metalake.Retrieves a list of Metalakes from the Gravitino API.Methods inherited from class org.apache.gravitino.client.GravitinoClientBase
checkMetalakeName, checkVersion, clientVersion, close, getVersion, loadMetalake, serverVersionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.gravitino.SupportsMetalakes
dropMetalake, loadMetalake, metalakeExists
-
Method Details
-
listMetalakes
Retrieves a list of Metalakes from the Gravitino API.- Specified by:
listMetalakesin interfaceSupportsMetalakes- Returns:
- An array of GravitinoMetalake objects representing the Metalakes.
-
createMetalake
public GravitinoMetalake createMetalake(String name, String comment, Map<String, String> properties) throws MetalakeAlreadyExistsExceptionCreates a new Metalake using the Gravitino API.- Specified by:
createMetalakein interfaceSupportsMetalakes- Parameters:
name- The name of the new Metalake.comment- The comment for the new Metalake.properties- The properties of the new Metalake.- Returns:
- A GravitinoMetalake instance representing the newly created Metalake.
- Throws:
MetalakeAlreadyExistsException- If a Metalake with the specified identifier already exists.
-
alterMetalake
public GravitinoMetalake alterMetalake(String name, MetalakeChange... changes) throws NoSuchMetalakeException, IllegalArgumentException Alters a specific Metalake using the Gravitino API.- Specified by:
alterMetalakein interfaceSupportsMetalakes- Parameters:
name- The name of the Metalake to be altered.changes- The changes to be applied to the Metalake.- Returns:
- A GravitinoMetalake instance representing the updated Metalake.
- Throws:
NoSuchMetalakeException- If the specified Metalake does not exist.IllegalArgumentException- If the provided changes are invalid or not applicable.
-
dropMetalake
public boolean dropMetalake(String name, boolean force) throws NonEmptyEntityException, MetalakeInUseException Drop a metalake with specified name. If the force flag is true, it will:- Cascade drop all sub-entities (tags, catalogs, schemas, tables, etc.) of the metalake in Gravitino store.
- Drop the metalake even if it is in use.
- External resources (e.g. database, table, etc.) associated with sub-entities will not be deleted unless it is managed (such as managed fileset).
SupportsMetalakes.dropMetalake(String).- Specified by:
dropMetalakein interfaceSupportsMetalakes- Parameters:
name- The name of the metalake.force- Whether to force the drop.- Returns:
- True if the metalake was dropped, false if the metalake does not exist.
- Throws:
NonEmptyEntityException- If the metalake is not empty and force is false.MetalakeInUseException- If the metalake is in use and force is false.
-
enableMetalake
Description copied from interface:SupportsMetalakesEnable a metalake. If the metalake is already in use, this method does nothing.- Specified by:
enableMetalakein interfaceSupportsMetalakes- Parameters:
name- The name of the metalake.- Throws:
NoSuchMetalakeException- If the metalake does not exist.
-
disableMetalake
Description copied from interface:SupportsMetalakesDisable a metalake. If the metalake is already disabled, this method does nothing. Once a metalake is disable:- It can only be listed, loaded, dropped, or enable.
- Any other operations on the metalake will throw an
MetalakeNotInUseException. - Any operation on the sub-entities (catalogs, schemas, tables, etc.) will throw an
MetalakeNotInUseException.
- Specified by:
disableMetalakein interfaceSupportsMetalakes- Parameters:
name- The name of the metalake.- Throws:
NoSuchMetalakeException- If the metalake does not exist.
-
builder
Creates a new builder for constructing a GravitinoClient.- Parameters:
uri- The base URI for the Gravitino API.- Returns:
- A new instance of the Builder class for constructing a GravitinoClient.
-