smiklosovic commented on code in PR #3902: URL: https://github.com/apache/cassandra/pull/3902#discussion_r1967473752
########## src/java/org/apache/cassandra/tools/nodetool/AbstractCommand.java: ########## @@ -0,0 +1,87 @@ +/* + * 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.cassandra.tools.nodetool; + +import javax.inject.Inject; + +import org.apache.cassandra.tools.NodeProbe; +import org.apache.cassandra.tools.Output; +import picocli.CommandLine.ExecutionException; + +/** + * Abstract class for all nodetool commands, which provides common methods and fields. + * <p> + * The command is executed by calling {@link #execute(NodeProbe)}, in all other cases + * it should not contain any fields or methods that are specific to a particular API + * being executed, or common methods that are shared across multiple commands. + * <p> + * Commands must be API-agnostic and work only with the {@link NodeProbe} API, or a + * wrapper around MBean classes (as a primary entry point), which do not need to be + * initialized or used with JMX. + */ +public abstract class AbstractCommand implements Runnable +{ + @Inject + protected Output logger; + + protected NodeProbe probe; + + public void probe(NodeProbe probe) Review Comment: I am not sure why we have these setters when `logger` and `probe` are `protected`. Implementations of `AbstractCommand` can just deal with the properties directly ... -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org