fx19880617 commented on a change in pull request #5266:
URL: https://github.com/apache/incubator-pinot/pull/5266#discussion_r429111007



##########
File path: 
pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java
##########
@@ -0,0 +1,213 @@
+/**
+ * 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 java.io.File;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.apache.pinot.controller.ControllerConf;
+import org.apache.pinot.spi.services.ServiceRole;
+import org.apache.pinot.tools.Command;
+import org.apache.pinot.tools.service.PinotServiceManager;
+import org.apache.pinot.tools.utils.PinotConfigUtils;
+import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.spi.StringArrayOptionHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static 
org.apache.pinot.common.utils.CommonConstants.Helix.PINOT_SERVICE_ROLE;
+
+
+/**
+ * Class to implement StartPinotService command.
+ *
+ */
+public class StartServiceManagerCommand extends AbstractBaseAdminCommand 
implements Command {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StartServiceManagerCommand.class);
+  private final List<Configuration> _bootstrapConfigurations = new 
ArrayList<>();
+  private final String[] BOOTSTRAP_SERVICES = new String[]{"CONTROLLER", 
"BROKER", "SERVER"};
+
+  @Option(name = "-help", required = false, help = true, aliases = {"-h", 
"--h", "--help"}, usage = "Print this message.")
+  private boolean _help;
+  @Option(name = "-zkAddress", required = true, metaVar = "<http>", usage = 
"Http address of Zookeeper.")
+  private String _zkAddress = DEFAULT_ZK_ADDRESS;
+  @Option(name = "-clusterName", required = true, metaVar = "<String>", usage 
= "Pinot cluster name.")
+  private String _clusterName = DEFAULT_CLUSTER_NAME;
+  @Option(name = "-port", required = true, metaVar = "<int>", usage = "Pinot 
service manager admin port, -1 means disable, 0 means a random available port.")

Review comment:
       it's in `PinotServiceManager`

##########
File path: 
pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/EnumArrayOptionHandler.java
##########
@@ -0,0 +1,67 @@
+/**
+ * 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.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.OptionDef;
+import org.kohsuke.args4j.spi.OptionHandler;
+import org.kohsuke.args4j.spi.Parameters;
+import org.kohsuke.args4j.spi.Setter;
+
+
+public class EnumArrayOptionHandler<T extends Enum<T>> extends 
OptionHandler<T> {

Review comment:
       this is not used. will delete 

##########
File path: 
pinot-tools/src/main/java/org/apache/pinot/tools/service/PinotServiceManagerAdminApiApplication.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.service;
+
+import com.google.common.base.Preconditions;
+import io.swagger.jaxrs.config.BeanConfig;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import org.glassfish.grizzly.http.server.CLStaticHttpHandler;
+import org.glassfish.grizzly.http.server.HttpHandler;
+import org.glassfish.grizzly.http.server.HttpServer;
+import org.glassfish.hk2.utilities.binding.AbstractBinder;
+import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.server.ResourceConfig;
+
+

Review comment:
       added

##########
File path: 
pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/StartServiceManagerCommand.java
##########
@@ -0,0 +1,213 @@
+/**
+ * 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 java.io.File;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.pinot.common.utils.CommonConstants;
+import org.apache.pinot.controller.ControllerConf;
+import org.apache.pinot.spi.services.ServiceRole;
+import org.apache.pinot.tools.Command;
+import org.apache.pinot.tools.service.PinotServiceManager;
+import org.apache.pinot.tools.utils.PinotConfigUtils;
+import org.kohsuke.args4j.Option;
+import org.kohsuke.args4j.spi.StringArrayOptionHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static 
org.apache.pinot.common.utils.CommonConstants.Helix.PINOT_SERVICE_ROLE;
+
+
+/**
+ * Class to implement StartPinotService command.
+ *
+ */
+public class StartServiceManagerCommand extends AbstractBaseAdminCommand 
implements Command {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StartServiceManagerCommand.class);
+  private final List<Configuration> _bootstrapConfigurations = new 
ArrayList<>();
+  private final String[] BOOTSTRAP_SERVICES = new String[]{"CONTROLLER", 
"BROKER", "SERVER"};
+
+  @Option(name = "-help", required = false, help = true, aliases = {"-h", 
"--h", "--help"}, usage = "Print this message.")
+  private boolean _help;
+  @Option(name = "-zkAddress", required = true, metaVar = "<http>", usage = 
"Http address of Zookeeper.")
+  private String _zkAddress = DEFAULT_ZK_ADDRESS;
+  @Option(name = "-clusterName", required = true, metaVar = "<String>", usage 
= "Pinot cluster name.")
+  private String _clusterName = DEFAULT_CLUSTER_NAME;
+  @Option(name = "-port", required = true, metaVar = "<int>", usage = "Pinot 
service manager admin port, -1 means disable, 0 means a random available port.")
+  private int _port;
+  @Option(name = "-bootstrapConfigPaths", handler = 
StringArrayOptionHandler.class, required = false, usage = "A list of Pinot 
service config file paths. Each config file requires an extra config: 
'pinot.service.role' to indicate which service to start.", forbids = 
{"-bootstrapServices"})
+  private String[] _bootstrapConfigPaths;
+  @Option(name = "-bootstrapServices", handler = 
StringArrayOptionHandler.class, required = false, usage = "A list of Pinot 
service roles to start with default config. E.g. CONTROLLER/BROKER/SERVER", 
forbids = {"-bootstrapConfigPaths"})
+  private String[] _bootstrapServices = BOOTSTRAP_SERVICES;
+
+  private PinotServiceManager _pinotServiceManager;
+
+  public String getZkAddress() {
+    return _zkAddress;
+  }
+
+  public StartServiceManagerCommand setZkAddress(String zkAddress) {
+    _zkAddress = zkAddress;
+    return this;
+  }
+
+  public String getClusterName() {
+    return _clusterName;
+  }
+
+  public StartServiceManagerCommand setClusterName(String clusterName) {
+    _clusterName = clusterName;
+    return this;
+  }
+
+  public int getPort() {
+    return _port;
+  }
+
+  public StartServiceManagerCommand setPort(int port) {
+    _port = port;
+    return this;
+  }
+
+  public String[] getBootstrapConfigPaths() {
+    return _bootstrapConfigPaths;
+  }
+
+  public StartServiceManagerCommand setBootstrapConfigPaths(String[] 
bootstrapConfigPaths) {
+    _bootstrapConfigPaths = bootstrapConfigPaths;
+    return this;
+  }
+
+  public String[] getBootstrapServices() {
+    return _bootstrapServices;
+  }
+
+  public StartServiceManagerCommand setBootstrapServices(String[] 
bootstrapServices) {
+    _bootstrapServices = bootstrapServices;
+    return this;
+  }
+
+  @Override
+  public boolean getHelp() {
+    return _help;
+  }
+
+  public void setHelp(boolean help) {
+    _help = help;
+  }
+
+  @Override
+  public String getName() {
+    return "StartPinotService";
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder()
+        .append("StartServiceManager -clusterName " + _clusterName + " 
-zkAddress " + _zkAddress + " -port " + _port);
+    if (_bootstrapConfigPaths != null) {
+      sb.append(" -bootstrapConfigPaths " + 
Arrays.toString(_bootstrapConfigPaths));
+    } else if (_bootstrapServices != null) {
+      sb.append(" -bootstrapServices " + Arrays.toString(_bootstrapServices));
+    }
+
+    return sb.toString();
+  }
+
+  @Override
+  public void cleanup() {
+  }
+
+  @Override
+  public String description() {
+    return "Start the Pinot Service Process at the specified port.";

Review comment:
       added




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to