You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "Abyss-lord (via GitHub)" <gi...@apache.org> on 2025/01/14 08:54:15 UTC
[PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Abyss-lord opened a new pull request, #6227:
URL: https://github.com/apache/gravitino/pull/6227
### What changes were proposed in this pull request?
Clean up GravitinoCommandLine class now it been refactored
### Why are the changes needed?
Fix: #6220
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
local ut test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1914530978
##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -98,14 +91,7 @@ public void handleSimpleLine() {
if (line.hasOption(GravitinoOptions.HELP)) {
displayHelp(options);
}
- /* Display Gravitino client version. */
- else if (line.hasOption(GravitinoOptions.VERSION)) {
- newClientVersion(getUrl(), ignore).handle();
- }
- /* Display Gravitino server version. */
- else if (line.hasOption(GravitinoOptions.SERVER)) {
- newServerVersion(getUrl(), ignore).handle();
- }
+ new SimpleCommandHandler(this, line, ignore).handle();
Review Comment:
@justinmclean thank you Justin, I just fix the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#issuecomment-2589391833
@justinmclean @tengqm could you please review this PR when you have time? I’d really appreciate your feedback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1915008465
##########
clients/cli/src/main/java/org/apache/gravitino/cli/SimpleCommandHandler.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.cli;
+
+import org.apache.commons.cli.CommandLine;
+
+/** Handles the command execution for simple command based on the command line options. */
+public class SimpleCommandHandler extends CommandHandler {
+ private final GravitinoCommandLine gravitinoCommandLine;
+ private final CommandLine line;
+ private final boolean ignore;
+
+ /**
+ * Constructs a {@link SimpleCommandHandler} instance.
+ *
+ * @param gravitinoCommandLine The Gravitino command line instance.
+ * @param line The command line arguments.
+ * @param ignore Ignore server version mismatch.
+ */
+ public SimpleCommandHandler(
Review Comment:
@tengqm I just follow the other code formation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1915641393
##########
clients/cli/src/main/java/org/apache/gravitino/cli/SimpleCommandHandler.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.cli;
+
+import org.apache.commons.cli.CommandLine;
+
+/** Handles the command execution for simple command based on the command line options. */
+public class SimpleCommandHandler extends CommandHandler {
+ private final GravitinoCommandLine gravitinoCommandLine;
+ private final CommandLine line;
+ private final boolean ignore;
+
+ /**
+ * Constructs a {@link SimpleCommandHandler} instance.
+ *
+ * @param gravitinoCommandLine The Gravitino command line instance.
+ * @param line The command line arguments.
+ * @param ignore Ignore server version mismatch.
+ */
+ public SimpleCommandHandler(
Review Comment:
We also need it as the url and auth methods have been moved to the base command class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1914515075
##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -98,14 +91,7 @@ public void handleSimpleLine() {
if (line.hasOption(GravitinoOptions.HELP)) {
displayHelp(options);
}
- /* Display Gravitino client version. */
- else if (line.hasOption(GravitinoOptions.VERSION)) {
- newClientVersion(getUrl(), ignore).handle();
- }
- /* Display Gravitino server version. */
- else if (line.hasOption(GravitinoOptions.SERVER)) {
- newServerVersion(getUrl(), ignore).handle();
- }
+ new SimpleCommandHandler(this, line, ignore).handle();
Review Comment:
While not strictly needed, having an else here makes sense - no need to create something if it's not needed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1914515075
##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -98,14 +91,7 @@ public void handleSimpleLine() {
if (line.hasOption(GravitinoOptions.HELP)) {
displayHelp(options);
}
- /* Display Gravitino client version. */
- else if (line.hasOption(GravitinoOptions.VERSION)) {
- newClientVersion(getUrl(), ignore).handle();
- }
- /* Display Gravitino server version. */
- else if (line.hasOption(GravitinoOptions.SERVER)) {
- newServerVersion(getUrl(), ignore).handle();
- }
+ new SimpleCommandHandler(this, line, ignore).handle();
Review Comment:
While not strictly needed, having an else here makes sense - no need to create something if it's not required and SimpleCommandHandler may have unexpected side effects at some future point.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean merged PR #6227:
URL: https://github.com/apache/gravitino/pull/6227
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "tengqm (via GitHub)" <gi...@apache.org>.
tengqm commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1914962678
##########
clients/cli/src/main/java/org/apache/gravitino/cli/SimpleCommandHandler.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.cli;
+
+import org.apache.commons.cli.CommandLine;
+
+/** Handles the command execution for simple command based on the command line options. */
+public class SimpleCommandHandler extends CommandHandler {
+ private final GravitinoCommandLine gravitinoCommandLine;
+ private final CommandLine line;
+ private final boolean ignore;
+
+ /**
+ * Constructs a {@link SimpleCommandHandler} instance.
+ *
+ * @param gravitinoCommandLine The Gravitino command line instance.
+ * @param line The command line arguments.
+ * @param ignore Ignore server version mismatch.
+ */
+ public SimpleCommandHandler(
Review Comment:
I don't think we need this abstraction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#6220] improve(CLI): Clean up GravitinoCommandLine class now it been refactored [gravitino]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6227:
URL: https://github.com/apache/gravitino/pull/6227#discussion_r1915641393
##########
clients/cli/src/main/java/org/apache/gravitino/cli/SimpleCommandHandler.java:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.gravitino.cli;
+
+import org.apache.commons.cli.CommandLine;
+
+/** Handles the command execution for simple command based on the command line options. */
+public class SimpleCommandHandler extends CommandHandler {
+ private final GravitinoCommandLine gravitinoCommandLine;
+ private final CommandLine line;
+ private final boolean ignore;
+
+ /**
+ * Constructs a {@link SimpleCommandHandler} instance.
+ *
+ * @param gravitinoCommandLine The Gravitino command line instance.
+ * @param line The command line arguments.
+ * @param ignore Ignore server version mismatch.
+ */
+ public SimpleCommandHandler(
Review Comment:
We also need it as the url and auth methods have been moved to the base CommandHandler class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org