ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] dspavlov commented on a change in pull request #6511: IGNITE-11780
Date Tue, 07 May 2019 16:46:27 GMT
dspavlov commented on a change in pull request #6511: IGNITE-11780
URL: https://github.com/apache/ignite/pull/6511#discussion_r281724846
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/internal/commandline/BaselineCommand.java
 ##########
 @@ -0,0 +1,258 @@
+/*
+ * 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.ignite.internal.commandline;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.internal.client.GridClient;
+import org.apache.ignite.internal.client.GridClientConfiguration;
+import org.apache.ignite.internal.commandline.argument.CommandArgUtils;
+import org.apache.ignite.internal.commandline.baseline.AutoAdjustCommandArg;
+import org.apache.ignite.internal.commandline.baseline.BaselineArguments;
+import org.apache.ignite.internal.commandline.baseline.BaselineSubcommands;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.visor.baseline.VisorBaselineAutoAdjustSettings;
+import org.apache.ignite.internal.visor.baseline.VisorBaselineNode;
+import org.apache.ignite.internal.visor.baseline.VisorBaselineTask;
+import org.apache.ignite.internal.visor.baseline.VisorBaselineTaskArg;
+import org.apache.ignite.internal.visor.baseline.VisorBaselineTaskResult;
+
+import static java.lang.Boolean.TRUE;
+import static org.apache.ignite.internal.commandline.CommandHandler.DELIM;
+import static org.apache.ignite.internal.commandline.CommandLogger.optional;
+import static org.apache.ignite.internal.commandline.CommandList.BASELINE;
+import static org.apache.ignite.internal.commandline.CommonArgParser.CMD_AUTO_CONFIRMATION;
+import static org.apache.ignite.internal.commandline.TaskExecutor.executeTask;
+import static org.apache.ignite.internal.commandline.baseline.BaselineSubcommands.of;
+
+/**
+ * Commands assosiated with baseline functionality.
+ */
+public class BaselineCommand implements Command<BaselineArguments> {
+    /** Arguments. */
+    private BaselineArguments baselineArgs;
+
+    /** {@inheritDoc} */
+    @Override public void printUsage(CommandLogger logger) {
+        final String constistIds = "consistentId1[,consistentId2,....,consistentIdN]";
+
+        Command.usage(logger,"Print cluster baseline topology:", BASELINE);
+        Command.usage(logger,"Add nodes into baseline topology:", BASELINE, BaselineSubcommands.ADD.text(),
+            constistIds, optional(CMD_AUTO_CONFIRMATION));
+        Command.usage(logger,"Remove nodes from baseline topology:", BASELINE, BaselineSubcommands.REMOVE.text(),
+            constistIds, optional(CMD_AUTO_CONFIRMATION));
+        Command.usage(logger,"Set baseline topology:", BASELINE, BaselineSubcommands.SET.text(),
constistIds,
+            optional(CMD_AUTO_CONFIRMATION));
+        Command.usage(logger,"Set baseline topology based on version:", BASELINE,
+            BaselineSubcommands.VERSION.text() + " topologyVersion", optional(CMD_AUTO_CONFIRMATION));
+        Command.usage(logger,"Set baseline autoadjustment settings:", BASELINE,
+            BaselineSubcommands.AUTO_ADJUST.text(), "disable|enable timeout <timeoutValue>",
optional(CMD_AUTO_CONFIRMATION));
+    }
+
+    /** {@inheritDoc} */
+    @Override public String confirmationPrompt() {
+        if (BaselineSubcommands.COLLECT != baselineArgs.getCmd())
+            return "Warning: the command will perform changes in baseline.";
+
+        return null;
+    }
+
+    /**
+     * Change baseline.
+     *
+     *
+     * @param clientCfg Client configuration.
+     * @throws Exception If failed to execute baseline action.
+     */
+    @Override public Object execute(GridClientConfiguration clientCfg, CommandLogger logger)
throws Exception {
+        try (GridClient client = Command.startClient(clientCfg)){
 
 Review comment:
   Maybe we need to add a space after  try(), need we?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message