Github user cestella commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/316#discussion_r91817019
--- Diff:
metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/StormCLIWrapper.java
---
@@ -0,0 +1,144 @@
+/**
+ * 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.metron.rest.service;
+
+import org.apache.metron.rest.config.KafkaConfig;
+import org.apache.metron.rest.config.ZookeeperConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static java.util.stream.Collectors.toList;
+import static
org.apache.metron.rest.service.StormService.ENRICHMENT_TOPOLOGY_NAME;
+import static
org.apache.metron.rest.service.StormService.INDEXING_TOPOLOGY_NAME;
+
+public class StormCLIWrapper {
+
+ public static final String PARSER_SCRIPT_PATH_SPRING_PROPERTY =
"storm.parser.script.path";
+ public static final String ENRICHMENT_SCRIPT_PATH_SPRING_PROPERTY =
"storm.enrichment.script.path";
+ public static final String INDEXING_SCRIPT_PATH_SPRING_PROPERTY =
"storm.indexing.script.path";
+
+ @Autowired
+ private Environment environment;
+
+ public int startParserTopology(String name) throws IOException,
InterruptedException {
+ return runCommand(getParserStartCommand(name));
+ }
+
+ public int stopParserTopology(String name, boolean stopNow) throws
IOException, InterruptedException {
+ return runCommand(getStopCommand(name, stopNow));
+ }
+
+ public int startEnrichmentTopology() throws IOException,
InterruptedException {
+ return runCommand(getEnrichmentStartCommand());
+ }
+
+ public int stopEnrichmentTopology(boolean stopNow) throws IOException,
InterruptedException {
+ return runCommand(getStopCommand(ENRICHMENT_TOPOLOGY_NAME, stopNow));
+ }
+
+ public int startIndexingTopology() throws IOException,
InterruptedException {
+ return runCommand(getIndexingStartCommand());
+ }
+
+ public int stopIndexingTopology(boolean stopNow) throws IOException,
InterruptedException {
+ return runCommand(getStopCommand(INDEXING_TOPOLOGY_NAME, stopNow));
+ }
+
+ protected int runCommand(String[] command) throws IOException,
InterruptedException {
+ ProcessBuilder pb = getProcessBuilder(command);
+ pb.inheritIO();
+ Process process = pb.start();
+ process.waitFor();
+ return process.exitValue();
+ }
+
+ protected String[] getParserStartCommand(String name) {
+ String[] command = new String[7];
+ command[0] =
environment.getProperty(PARSER_SCRIPT_PATH_SPRING_PROPERTY);
--- End diff --
Do these services have to be running on a node with the metron scripts? It
appears so from this, but I wanted to make sure. If it is, can we make sure we
have that spelled out specifically in the `README.md`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---