This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch add_quickstart_into_pinot_admin
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit b8948610acebabb273bca48a512f8379df911747
Author: Xiang Fu <[email protected]>
AuthorDate: Tue Feb 18 22:08:10 2020 -0800

    Adding quickstart into Pinot admin command
---
 .../pinot/tools/admin/PinotAdministrator.java      |  2 +
 .../tools/admin/command/QuickStartCommand.java     | 89 ++++++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git 
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
 
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
index fc712a9..697e4ef 100644
--- 
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
+++ 
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/PinotAdministrator.java
@@ -36,6 +36,7 @@ import 
org.apache.pinot.tools.admin.command.LaunchDataIngestionJobCommand;
 import org.apache.pinot.tools.admin.command.MoveReplicaGroup;
 import 
org.apache.pinot.tools.admin.command.OfflineSegmentIntervalCheckerCommand;
 import org.apache.pinot.tools.admin.command.PostQueryCommand;
+import org.apache.pinot.tools.admin.command.QuickStartCommand;
 import org.apache.pinot.tools.admin.command.RealtimeProvisioningHelperCommand;
 import org.apache.pinot.tools.admin.command.RebalanceTableCommand;
 import org.apache.pinot.tools.admin.command.ShowClusterInfoCommand;
@@ -87,6 +88,7 @@ public class PinotAdministrator {
   //@formatter:off
   @Argument(handler = SubCommandHandler.class, metaVar = "<subCommand>")
   @SubCommands({
+      @SubCommand(name = "QuickStart", impl = QuickStartCommand.class),
       @SubCommand(name = "GenerateData", impl = GenerateDataCommand.class),
       @SubCommand(name = "LaunchDataIngestionJob", impl = 
LaunchDataIngestionJobCommand.class),
       @SubCommand(name = "CreateSegment", impl = CreateSegmentCommand.class),
diff --git 
a/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java
 
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java
new file mode 100644
index 0000000..b6ca663
--- /dev/null
+++ 
b/pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/QuickStartCommand.java
@@ -0,0 +1,89 @@
+/**
+ * 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.pinot.tools.admin.command;
+
+import org.apache.pinot.tools.Command;
+import org.apache.pinot.tools.HybridQuickstart;
+import org.apache.pinot.tools.Quickstart;
+import org.apache.pinot.tools.RealtimeQuickStart;
+import org.kohsuke.args4j.Option;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class QuickStartCommand extends AbstractBaseAdminCommand implements 
Command {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(QuickStartCommand.class.getName());
+
+  @Option(name = "-type", required = false, metaVar = "<String>", usage = 
"Type of quickstart, supported: STREAM/BATCH/HYBRID")
+  private String _type;
+
+  @Option(name = "-help", required = false, help = true, aliases = {"-h", 
"--h", "--help"}, usage = "Print this message.")
+  private boolean _help = false;
+
+  @Override
+  public boolean getHelp() {
+    return _help;
+  }
+
+  @Override
+  public String getName() {
+    return "QuickStart";
+  }
+
+  public QuickStartCommand setType(String type) {
+    _type = type;
+    return this;
+  }
+
+  @Override
+  public String toString() {
+    return ("QuickStart -type " + _type);
+  }
+
+  @Override
+  public void cleanup() {
+
+  }
+
+  @Override
+  public String description() {
+    return "Run Pinot QuickStart.";
+  }
+
+  @Override
+  public boolean execute()
+      throws Exception {
+    switch (_type.toUpperCase()) {
+      case "OFFLINE":
+      case "BATCH":
+        Quickstart.main(new String[]{});
+        break;
+      case "REALTIME":
+      case "STREAM":
+        RealtimeQuickStart.main(new String[]{});
+        break;
+      case "HYBRID":
+        HybridQuickstart.main(new String[]{});
+        break;
+      default:
+        throw new UnsupportedOperationException("Unsupported quickstart type: 
" + _type);
+    }
+    return true;
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to