Till Westmann has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1300

Change subject: dead code elimination in asterix-events
......................................................................

dead code elimination in asterix-events

Change-Id: I8873652ca6b3add003e7454d09c175b2218ed685
---
D 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
D 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
D 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
D 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
M 
asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
M 
asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
20 files changed, 47 insertions(+), 297 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/00/1300/1

diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
deleted file mode 100644
index d996e0e..0000000
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/ClusterInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.asterix.event.api;
-
-import java.util.List;
-
-public class ClusterInfo {
-
-    List<NodeInfo> nodes;
-
-    public ClusterInfo(List<NodeInfo> nodes) {
-        this.nodes = nodes;
-    }
-}
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
deleted file mode 100644
index d2dab4c..0000000
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/api/NodeInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.asterix.event.api;
-
-public class NodeInfo {
-
-    private final String id;
-    private final String ip;
-
-    public NodeInfo(String id, String ip) {
-        this.id = id;
-        this.ip = ip;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public String getIp() {
-        return ip;
-    }
-}
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
index c92262c..83e9ae7 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/driver/EventDriver.java
@@ -41,19 +41,15 @@
 public class EventDriver {
 
     public static final String CLIENT_NODE_ID = "client_node";
-    public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, 
"127.0.0.1", null, null, null, null, null, null);
+    public static final String CLUSTER_IP = "127.0.0.1";
+    public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, 
CLUSTER_IP, null, null, null, null, null, null);
 
     private static String eventsDir;
-    private static Events events;
     private static Map<String, String> env = new HashMap<String, String>();
     private static String scriptDirSuffix;
 
     public static String getEventsDir() {
         return eventsDir;
-    }
-
-    public static Events getEvents() {
-        return events;
     }
 
     public static Map<String, String> getEnvironment() {
@@ -76,17 +72,6 @@
         return cluster;
     }
 
-    public static Patterns initializePatterns(String path) throws 
JAXBException, IOException {
-        File file = new File(path);
-        JAXBContext ctx = JAXBContext.newInstance(Patterns.class);
-        Unmarshaller unmarshaller = ctx.createUnmarshaller();
-        return (Patterns) unmarshaller.unmarshal(file);
-    }
-
-    private static void initialize(EventConfig eventConfig) throws 
IOException, JAXBException {
-
-    }
-
     public static void main(String[] args) throws Exception {
         String eventsHome = System.getenv("EVENT_HOME");
         if (eventsHome == null) {
@@ -104,14 +89,10 @@
                 Randomizer.getInstance(eventConfig.seed);
             }
             Cluster cluster = initializeCluster(eventConfig.clusterPath);
-            initialize(eventConfig);
 
             if (!eventConfig.dryRun) {
                 prepare(cluster);
             }
-            //AsterixEventServiceClient client = new 
AsterixEventServiceClient(eventsDir, cluster, eventConfig.dryRun,
-            //      new DefaultOutputHandler());
-            // client.submit(patterns);
             if (!eventConfig.dryRun) {
                 cleanup(cluster);
             }
@@ -123,12 +104,12 @@
 
     private static void prepare(Cluster cluster) throws IOException, 
InterruptedException {
 
-        scriptDirSuffix = "" + System.nanoTime();
+        scriptDirSuffix = Long.toString(System.nanoTime());
         List<String> args = new ArrayList<String>();
         args.add(scriptDirSuffix);
         Node clientNode = new Node();
         clientNode.setId("client");
-        clientNode.setClusterIp("127.0.0.1");
+        clientNode.setClusterIp(CLUSTER_IP);
         for (Node node : cluster.getNode()) {
             args.add(node.getClusterIp());
         }
@@ -140,7 +121,7 @@
         args.add(scriptDirSuffix);
         Node clientNode = new Node();
         clientNode.setId("client");
-        clientNode.setClusterIp("127.0.0.1");
+        clientNode.setClusterIp(CLUSTER_IP);
         for (Node node : cluster.getNode()) {
             args.add(node.getClusterIp());
         }
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
index 68e87c6..9bcb05e 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/OutputHandler.java
@@ -57,14 +57,9 @@
                 if (trimmedOutput.length() > 0) {
                     if (trimmedOutput.contains("AccessControlException")) {
                         errorMessage.append("Insufficient permissions on back 
up directory");
-                        ignore = false;
                     }
-                    if (output.contains("does not exist") || 
output.contains("File exist")
-                            || (output.contains("No such file or directory"))) 
{
-                        ignore = true;
-                    } else {
-                        ignore = false;
-                    }
+                    ignore = output.contains("does not exist") || 
output.contains("File exist")
+                            || (output.contains("No such file or directory"));
                 }
                 break;
 
@@ -87,10 +82,6 @@
             default:
                 break;
         }
-        if (ignore) {
-            return new OutputAnalysis(true, null);
-        } else {
-            return new OutputAnalysis(false, errorMessage.toString());
-        }
+        return ignore ? new OutputAnalysis(true, null) : new 
OutputAnalysis(false, errorMessage.toString());
     }
 }
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
index 71efa44..4f70fcd 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/error/VerificationUtil.java
@@ -51,7 +51,6 @@
         boolean ccRunning = true;
         List<String> failedNCs = new ArrayList<String>();
         String[] infoFields;
-        ProcessInfo pInfo;
         List<ProcessInfo> processes = new ArrayList<ProcessInfo>();
 
         for (String line : output.split("\n")) {
@@ -64,8 +63,7 @@
                 } else {
                     nodeid = instance.getCluster().getMasterNode().getId();
                 }
-                pInfo = new ProcessInfo(infoFields[0], infoFields[1], nodeid, 
pid);
-                processes.add(pInfo);
+                processes.add(new ProcessInfo(infoFields[0], infoFields[1], 
nodeid, pid));
             } catch (Exception e) {
                 if (infoFields[0].equalsIgnoreCase("CC")) {
                     ccRunning = false;
@@ -82,8 +80,8 @@
         StringBuffer summary = new StringBuffer();
         if (expectedRunning) {
             if (!state.isCcRunning()) {
-                summary.append("Cluster Controller not running at " + 
instance.getCluster().getMasterNode().getId()
-                        + "\n");
+                summary.append(
+                        "Cluster Controller not running at " + 
instance.getCluster().getMasterNode().getId() + "\n");
                 instance.setState(State.UNUSABLE);
             }
             if (state.getFailedNCs() != null && 
!state.getFailedNCs().isEmpty()) {
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
index af33f2e..34c1837 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/AsterixEventServiceClient.java
@@ -196,8 +196,7 @@
 
             }
         }
-        Patterns patterns = new Patterns(patternList);
-        return patterns;
+        return new Patterns(patternList);
     }
 
     private Pattern getDirectoryTransferPattern(String username, String src, 
Nodeid srcNode, String destNodeIp,
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
deleted file mode 100644
index 907a494..0000000
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/DefaultOutputHandler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.asterix.event.management;
-
-import org.apache.asterix.event.schema.pattern.Event;
-
-public class DefaultOutputHandler implements IOutputHandler {
-
-    @Override
-    public OutputAnalysis reportEventOutput(Event event, String output) {
-        return new OutputAnalysis(true, null);
-    }
-
-}
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
deleted file mode 100644
index fb2d1b7..0000000
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/ErrorHandler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.asterix.event.management;
-
-public class ErrorHandler {
-
-}
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
index 4587756..3b521c3 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventExecutor.java
@@ -59,41 +59,11 @@
                     envBuffer.append(p.getKey() + "=" + val + " ");
                 } else if (p.getKey().equals(EventUtil.NC_JAVA_OPTS)) {
                     if (!isMasterNode) {
-                        StringBuilder builder = new StringBuilder();
-                        builder.append("\"");
-                        String javaOpts = p.getValue();
-                        if (javaOpts != null) {
-                            builder.append(javaOpts);
-                        }
-                        if (node.getDebugPort() != null) {
-                            int debugPort = node.getDebugPort().intValue();
-                            if (!javaOpts.contains("-Xdebug")) {
-                                builder.append(
-                                        (" " + "-Xdebug 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="
-                                                + debugPort));
-                            }
-                        }
-                        builder.append("\"");
-                        envBuffer.append("JAVA_OPTS" + "=" + builder + " ");
+                        appendJavaOpts(node, envBuffer, p);
                     }
                 } else if (p.getKey().equals(EventUtil.CC_JAVA_OPTS)) {
                     if (isMasterNode) {
-                        StringBuilder builder = new StringBuilder();
-                        builder.append("\"");
-                        String javaOpts = p.getValue();
-                        if (javaOpts != null) {
-                            builder.append(javaOpts);
-                        }
-                        if (node.getDebugPort() != null) {
-                            int debugPort = node.getDebugPort().intValue();
-                            if (!javaOpts.contains("-Xdebug")) {
-                                builder.append(
-                                        (" " + "-Xdebug 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="
-                                                + debugPort));
-                            }
-                        }
-                        builder.append("\"");
-                        envBuffer.append("JAVA_OPTS" + "=" + builder + " ");
+                        appendJavaOpts(node, envBuffer, p);
                     }
                 } else if (p.getKey().equals("LOG_DIR")) {
                     String val = node.getLogDir() == null ? p.getValue() : 
node.getLogDir();
@@ -132,4 +102,23 @@
             }
         }
     }
+
+    protected void appendJavaOpts(Node node, StringBuffer envBuffer, Property 
p) {
+        StringBuilder builder = new StringBuilder();
+        builder.append("\"");
+        String javaOpts = p.getValue();
+        if (javaOpts != null) {
+            builder.append(javaOpts);
+        }
+        if (node.getDebugPort() != null) {
+            int debugPort = node.getDebugPort().intValue();
+            if (javaOpts == null || !javaOpts.contains("-Xdebug")) {
+                builder.append(
+                        (" " + "-Xdebug 
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address="
+                                + debugPort));
+            }
+        }
+        builder.append("\"");
+        envBuffer.append("JAVA_OPTS" + "=" + builder + " ");
+    }
 }
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
index e0e5bc4..29b855d 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventTask.java
@@ -143,10 +143,6 @@
         return interval;
     }
 
-    public long getInitialDelay() {
-        return initialDelay;
-    }
-
     public Pattern getPattern() {
         return pattern;
     }
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
index 57648b8..8b63079 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/management/EventUtil.java
@@ -41,8 +41,6 @@
 public class EventUtil {
 
     public static final String EVENTS_DIR = "events";
-    public static final String CLUSTER_CONF = "config/cluster.xml";
-    public static final String PATTERN_CONF = "config/pattern.xml";
     public static final DateFormat dateFormat = new 
SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
     public static final String NC_JAVA_OPTS = "nc.java.opts";
     public static final String CC_JAVA_OPTS = "cc.java.opts";
@@ -201,7 +199,7 @@
                 return node;
             }
         }
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append(EventDriver.CLIENT_NODE.getId() + ",");
         buffer.append(cluster.getMasterNode().getId() + ",");
         for (Node v : cluster.getNode()) {
@@ -209,27 +207,6 @@
         }
         buffer.deleteCharAt(buffer.length() - 1);
         throw new IllegalArgumentException("Unknown node id :" + nodeid + " 
valid ids:" + buffer);
-    }
-
-    public static void executeEventScript(Node node, String script, 
List<String> args, Cluster cluster)
-            throws IOException, InterruptedException {
-        List<String> pargs = new ArrayList<String>();
-        pargs.add("/bin/bash");
-        pargs.add(EventDriver.getEventsDir() + "/" + EXECUTE_SCRIPT);
-        StringBuffer argBuffer = new StringBuffer();
-        String env = EventDriver.getStringifiedEnv(cluster) + " " + 
IP_LOCATION + "=" + node.getClusterIp();
-        if (args != null) {
-            for (String arg : args) {
-                argBuffer.append(arg + " ");
-            }
-        }
-        ProcessBuilder pb = new ProcessBuilder(pargs);
-        pb.environment().putAll(EventDriver.getEnvironment());
-        pb.environment().put(IP_LOCATION, node.getClusterIp());
-        pb.environment().put(CLUSTER_ENV, env);
-        pb.environment().put(SCRIPT, script);
-        pb.environment().put(ARGS, argBuffer.toString());
-        pb.start();
     }
 
     public static void executeLocalScript(Node node, String script, 
List<String> args) throws IOException,
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
index e6c6986..ceb44c9 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/AsterixInstance.java
@@ -66,10 +66,6 @@
         this.backupInfo = new ArrayList<BackupInfo>();
     }
 
-    public Date getModifiedTimestamp() {
-        return stateChangeTimestamp;
-    }
-
     public State getState() {
         return state;
     }
@@ -85,14 +81,6 @@
 
     public String getName() {
         return name;
-    }
-
-    public Date getCreatedTimestamp() {
-        return createdTimestamp;
-    }
-
-    public Date getStateChangeTimestamp() {
-        return stateChangeTimestamp;
     }
 
     public void setStateChangeTimestamp(Date stateChangeTimestamp) {
@@ -112,7 +100,7 @@
     }
 
     public String getDescription(boolean detailed) {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append("Name:" + name + "\n");
         buffer.append("Created:" + createdTimestamp + "\n");
 
@@ -150,15 +138,11 @@
         return "http://"; + cluster.getMasterNode().getClientIp() + ":" + 
webPort;
     }
 
-    public AsterixRuntimeState getAsterixRuntimeState() {
-        return runtimeState;
-    }
-
     public void setAsterixRuntimeStates(AsterixRuntimeState runtimeState) {
         this.runtimeState = runtimeState;
     }
 
-    private void addDetailedInformation(StringBuffer buffer) {
+    private void addDetailedInformation(StringBuilder buffer) {
         buffer.append("Master node:" + cluster.getMasterNode().getId() + ":" + 
cluster.getMasterNode().getClusterIp()
                 + "\n");
         for (Node node : cluster.getNode()) {
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
index 38bb7a9..ae10cd7 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/BackupInfo.java
@@ -58,7 +58,6 @@
     public String toString() {
         return id + " " + date + " " + "(" + getBackupType() + ")" + " " + "[ 
" + this.getBackupConf().getBackupDir()
                 + " ]";
-
     }
 
     public BackupType getBackupType() {
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
index f266b84..9702ceb 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/model/ProcessInfo.java
@@ -35,16 +35,8 @@
         this.processId = processId;
     }
 
-    public String getProcessName() {
-        return processName;
-    }
-
     public String getHost() {
         return host;
-    }
-
-    public int getProcessId() {
-        return processId;
     }
 
     public String getNodeId() {
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
index 55a9200..f95b934 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventService.java
@@ -21,13 +21,12 @@
 import java.io.File;
 import java.io.FileFilter;
 
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
 import org.apache.asterix.event.error.OutputHandler;
 import org.apache.asterix.event.management.AsterixEventServiceClient;
 import org.apache.asterix.event.schema.cluster.Cluster;
 import org.apache.asterix.installer.schema.conf.Configuration;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 
 public class AsterixEventService {
 
@@ -46,15 +45,12 @@
 
     public static AsterixEventServiceClient 
getAsterixEventServiceClient(Cluster cluster, boolean transferArtifacts,
             boolean dryRun) throws Exception {
-        AsterixEventServiceClient client = new 
AsterixEventServiceClient(configuration, eventHome, cluster,
-                transferArtifacts, dryRun, OutputHandler.INSTANCE);
-        return client;
+        return new AsterixEventServiceClient(configuration, eventHome, 
cluster, transferArtifacts, dryRun,
+                OutputHandler.INSTANCE);
     }
 
     public static AsterixEventServiceClient 
getAsterixEventServiceClient(Cluster cluster) throws Exception {
-        AsterixEventServiceClient client = new 
AsterixEventServiceClient(configuration, eventHome, cluster, false,
-                false, OutputHandler.INSTANCE);
-        return client;
+        return new AsterixEventServiceClient(configuration, eventHome, 
cluster, false, false, OutputHandler.INSTANCE);
     }
 
     private static String initBinary(final String fileNamePattern) {
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
index 02c06dc..9b22396 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
@@ -65,33 +65,25 @@
 public class AsterixEventServiceUtil {
 
     public static final String TXN_LOG_DIR = "txnLogs";
-    public static final String TXN_LOG_DIR_KEY_SUFFIX = "txnLogDir";
     public static final String ASTERIX_CONFIGURATION_FILE = 
"asterix-configuration.xml";
-    public static final String TXN_LOG_CONFIGURATION_FILE = "log.properties";
     public static final String CLUSTER_CONFIGURATION_FILE = "cluster.xml";
-    public static final String ASTERIX_DIR = "asterix";
     public static final String EVENT_DIR = "events";
-    public static final String DEFAULT_ASTERIX_CONFIGURATION_PATH = "conf" + 
File.separator + File.separator
-            + "asterix-configuration.xml";
     public static final int CLUSTER_NET_PORT_DEFAULT = 1098;
     public static final int CLIENT_NET_PORT_DEFAULT = 1099;
     public static final int HTTP_PORT_DEFAULT = 8888;
-    public static final int WEB_INTERFACE_PORT_DEFAULT = 19001;
 
-    public static final String MANAGIX_INTERNAL_DIR = ".installer";
     public static final String MANAGIX_CONF_XML = "conf" + File.separator + 
"managix-conf.xml";
 
     private static final int BUFFER_SIZE = 4096;
 
     public static AsterixInstance createAsterixInstance(String 
asterixInstanceName, Cluster cluster,
-            AsterixConfiguration asterixConfiguration) throws 
FileNotFoundException, IOException {
+            AsterixConfiguration asterixConfiguration) throws IOException {
         Node metadataNode = getMetadataNode(asterixInstanceName, cluster);
         String asterixZipName = asterixZipName();
         String asterixVersion = 
asterixZipName.substring("asterix-server-".length(),
                 asterixZipName.indexOf("-binary-assembly"));
-        AsterixInstance instance = new AsterixInstance(asterixInstanceName, 
cluster, asterixConfiguration,
+        return new AsterixInstance(asterixInstanceName, cluster, 
asterixConfiguration,
                 metadataNode.getId(), asterixVersion);
-        return instance;
     }
 
     public static void createAsterixZip(AsterixInstance asterixInstance)
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
index 7606a25..ab421fd 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ServiceProvider.java
@@ -24,7 +24,6 @@
     private static ILookupService lookupService = new ZooKeeperService();
 
     private ServiceProvider() {
-
     }
 
     public ILookupService getLookupService() {
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
index a10b5ea..869f66c 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/ZooKeeperService.java
@@ -137,7 +137,7 @@
             LOGGER.debug("Stopping ZooKeeper running at " + 
zkConnectionString);
         }
         String stopScript = ZOOKEEPER_HOME + File.separator + "bin" + 
File.separator + "stop_zk";
-        StringBuffer cmdBuffer = new StringBuffer();
+        StringBuilder cmdBuffer = new StringBuilder();
         cmdBuffer.append(stopScript + " ");
         cmdBuffer.append(conf.getZookeeper().getHomeDir() + " ");
         List<String> zkServers = conf.getZookeeper().getServers().getServer();
@@ -282,7 +282,7 @@
     public static void writeConfiguration(String zooKeeperConfigPath, 
Configuration conf, int leaderConnPort,
             int leaderElecPort) throws IOException {
 
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append("tickTime=1000" + "\n");
         buffer.append("dataDir=" + conf.getZookeeper().getHomeDir() + 
File.separator + "data" + "\n");
         buffer.append("clientPort=" + 
conf.getZookeeper().getClientPort().intValue() + "\n");
diff --git 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
index 1780a51..9c6725b 100644
--- 
a/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
+++ 
b/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/util/PatternCreator.java
@@ -54,8 +54,6 @@
     private PatternCreator() {
     }
 
-    private ILookupService lookupService = 
ServiceProvider.INSTANCE.getLookupService();
-
     private void addInitialDelay(Pattern p, int delay, String unit) {
         Delay d = new Delay(new Value(null, Integer.toString(delay)), unit);
         p.setDelay(d);
@@ -97,26 +95,6 @@
                     asterixInstanceName + "_" + node.getId(), iodevices, 
createCommand);
             addInitialDelay(createNC, 5, "sec");
             ps.add(createNC);
-        }
-
-        return new Patterns(ps);
-    }
-
-    public Patterns getStopCommandPattern(String asterixInstanceName) throws 
Exception {
-        List<Pattern> ps = new ArrayList<>();
-        AsterixInstance asterixInstance = 
lookupService.getAsterixInstance(asterixInstanceName);
-        Cluster cluster = asterixInstance.getCluster();
-
-        String ccLocation = cluster.getMasterNode().getId();
-        Pattern createCC = createCCStopPattern(ccLocation);
-        addInitialDelay(createCC, 5, "sec");
-        ps.add(createCC);
-
-        int nodeControllerIndex = 1;
-        for (Node node : cluster.getNode()) {
-            Pattern createNC = createNCStopPattern(node.getId(), 
asterixInstanceName + "_" + nodeControllerIndex);
-            ps.add(createNC);
-            nodeControllerIndex++;
         }
 
         return new Patterns(ps);
@@ -600,7 +578,7 @@
         return new Patterns(ps);
     }
 
-    public Patterns getGenerateLogPattern(String asterixInstanceName, Cluster 
cluster, String outputDir) {
+    public Patterns getGenerateLogPattern(Cluster cluster, String outputDir) {
         List<Pattern> patternList = new ArrayList<>();
         Map<String, String> nodeLogs = new HashMap<>();
 
diff --git 
a/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
 
b/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
index b4ea96b..1e00d70 100644
--- 
a/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
+++ 
b/asterixdb/asterix-installer/src/main/java/org/apache/asterix/installer/command/LogCommand.java
@@ -58,7 +58,7 @@
                 throw new InstallerException("Unable to create output 
directory:" + outputDirPath);
             }
         }
-        Patterns transferLogPattern = 
pc.getGenerateLogPattern(asterixInstanceName, instance.getCluster(),
+        Patterns transferLogPattern = 
pc.getGenerateLogPattern(instance.getCluster(),
                 outputDirPath);
         eventrixClient.submit(transferLogPattern);
         File outputDirFile = new File(outputDirPath);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1300
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8873652ca6b3add003e7454d09c175b2218ed685
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>

Reply via email to