From 079e3f259e8c4db088f4eccf9f2ec7c36c3a536b Mon Sep 17 00:00:00 2001 From: TungYuChiang Date: Mon, 13 Jan 2025 20:26:11 +0800 Subject: [PATCH] Remove handlefilesetcommand() --- .../gravitino/cli/GravitinoCommandLine.java | 103 +----------------- 1 file changed, 1 insertion(+), 102 deletions(-) diff --git a/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java b/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java index de0dabd94ec..1cc982d6787 100644 --- a/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java +++ b/clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java @@ -356,108 +356,7 @@ private void handleHelpCommand() { Main.exit(-1); } } - - /** - * Handles the command execution for filesets based on command type and the command line options. - */ - private void handleFilesetCommand() { - String url = getUrl(); - String auth = getAuth(); - String userName = line.getOptionValue(GravitinoOptions.LOGIN); - FullName name = new FullName(line); - String metalake = name.getMetalakeName(); - String catalog = name.getCatalogName(); - String schema = name.getSchemaName(); - - Command.setAuthenticationMode(auth, userName); - - List missingEntities = Lists.newArrayList(); - if (catalog == null) missingEntities.add(CommandEntities.CATALOG); - if (schema == null) missingEntities.add(CommandEntities.SCHEMA); - - // Handle CommandActions.LIST action separately as it doesn't require the `fileset` - if (CommandActions.LIST.equals(command)) { - checkEntities(missingEntities); - newListFilesets(url, ignore, metalake, catalog, schema).validate().handle(); - return; - } - - String fileset = name.getFilesetName(); - if (fileset == null) missingEntities.add(CommandEntities.FILESET); - checkEntities(missingEntities); - - switch (command) { - case CommandActions.DETAILS: - newFilesetDetails(url, ignore, metalake, catalog, schema, fileset).validate().handle(); - break; - - case CommandActions.CREATE: - { - String comment = line.getOptionValue(GravitinoOptions.COMMENT); - String[] properties = line.getOptionValues(CommandActions.PROPERTIES); - Map propertyMap = new Properties().parse(properties); - newCreateFileset(url, ignore, metalake, catalog, schema, fileset, comment, propertyMap) - .validate() - .handle(); - break; - } - - case CommandActions.DELETE: - { - boolean force = line.hasOption(GravitinoOptions.FORCE); - newDeleteFileset(url, ignore, force, metalake, catalog, schema, fileset) - .validate() - .handle(); - break; - } - - case CommandActions.SET: - { - String property = line.getOptionValue(GravitinoOptions.PROPERTY); - String value = line.getOptionValue(GravitinoOptions.VALUE); - newSetFilesetProperty(url, ignore, metalake, catalog, schema, fileset, property, value) - .validate() - .handle(); - break; - } - - case CommandActions.REMOVE: - { - String property = line.getOptionValue(GravitinoOptions.PROPERTY); - newRemoveFilesetProperty(url, ignore, metalake, catalog, schema, fileset, property) - .validate() - .handle(); - break; - } - - case CommandActions.PROPERTIES: - newListFilesetProperties(url, ignore, metalake, catalog, schema, fileset) - .validate() - .handle(); - break; - - case CommandActions.UPDATE: - { - if (line.hasOption(GravitinoOptions.COMMENT)) { - String comment = line.getOptionValue(GravitinoOptions.COMMENT); - newUpdateFilesetComment(url, ignore, metalake, catalog, schema, fileset, comment) - .validate() - .handle(); - } - if (line.hasOption(GravitinoOptions.RENAME)) { - String newName = line.getOptionValue(GravitinoOptions.RENAME); - newUpdateFilesetName(url, ignore, metalake, catalog, schema, fileset, newName) - .validate() - .handle(); - } - break; - } - - default: - System.err.println(ErrorMessages.UNSUPPORTED_ACTION); - break; - } - } + /** * Retrieves the Gravitinno URL from the command line options or the GRAVITINO_URL environment