asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: Add Helper Client To Interface With Cluster HTTP APIs
Date Wed, 31 Aug 2016 18:21:56 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master d148581c8 -> 6214f6fca


Add Helper Client To Interface With Cluster HTTP APIs

- updated start / stop sample cluster scripts
- align args4j versions with latest released
- removed sample scripts from asterix-server jar
- extendable

Change-Id: Ib44cc3617c4ff6e995f26c1853bc9d78a1faacd7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1126
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/6214f6fc
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/6214f6fc
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/6214f6fc

Branch: refs/heads/master
Commit: 6214f6fca0e764a74a76a35f5f93281238d2eb81
Parents: d148581
Author: Michael Blow <mblow@apache.org>
Authored: Wed Aug 31 03:03:00 2016 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Wed Aug 31 11:21:11 2016 -0700

----------------------------------------------------------------------
 asterixdb/asterix-client-helper/pom.xml         |  88 +++++++++++++++
 .../src/main/assembly/assembly.xml              |  38 +++++++
 .../org/apache/asterix/clienthelper/Args.java   |  83 +++++++++++++++
 .../asterix/clienthelper/AsterixHelper.java     |  32 ++++++
 .../clienthelper/AsterixHelperExecution.java    | 106 +++++++++++++++++++
 .../clienthelper/commands/ClientCommand.java    |  75 +++++++++++++
 .../commands/GetClusterStateCommand.java        |  55 ++++++++++
 .../clienthelper/commands/RemoteCommand.java    |  61 +++++++++++
 .../clienthelper/commands/ShutdownCommand.java  |  57 ++++++++++
 .../commands/WaitForClusterCommand.java         |  60 +++++++++++
 asterixdb/asterix-events/pom.xml                |   3 -
 .../event/service/AsterixEventServiceUtil.java  |  34 +++---
 asterixdb/asterix-installer/pom.xml             |   3 -
 asterixdb/asterix-server/pom.xml                |  13 ++-
 .../src/main/assembly/binary-assembly.xml       |  27 +++--
 .../src/main/assembly/filter.properties         |   2 +-
 .../samples/local/bin/start-sample-cluster.sh   |  69 ------------
 .../samples/local/bin/stop-sample-cluster.sh    |  43 --------
 .../main/resources/samples/local/conf/blue.conf |   2 -
 .../main/resources/samples/local/conf/cc.conf   |  21 ----
 .../samples/local/bin/start-sample-cluster.sh   |  69 ++++++++++++
 .../samples/local/bin/stop-sample-cluster.sh    |  63 +++++++++++
 .../src/main/samples/local/conf/blue.conf       |   2 +
 .../src/main/samples/local/conf/cc.conf         |  21 ++++
 asterixdb/pom.xml                               |   6 ++
 hyracks-fullstack/hyracks/pom.xml               |   4 -
 26 files changed, 866 insertions(+), 171 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml
new file mode 100644
index 0000000..7068cf6
--- /dev/null
+++ b/asterixdb/asterix-client-helper/pom.xml
@@ -0,0 +1,88 @@
+<!--
+ ! 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.
+ !-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>asterix-client-helper</artifactId>
+  <parent>
+    <groupId>org.apache.asterix</groupId>
+    <artifactId>apache-asterixdb</artifactId>
+    <version>0.8.9-SNAPSHOT</version>
+  </parent>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>appassembler-maven-plugin</artifactId>
+        <version>1.3</version>
+        <configuration>
+          <assembleDirectory>
+            ${project.build.directory}/appassembler
+          </assembleDirectory>
+          <repositoryLayout>flat</repositoryLayout>
+          <repositoryName>lib</repositoryName>
+          <useWildcardClassPath>false</useWildcardClassPath>
+          <programs>
+            <program>
+              <platforms>
+                <platform>unix</platform>
+              </platforms>
+              <name>asterixhelper</name>
+              <mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
+            </program>
+          </programs>
+          <daemons/>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>assemble</goal>
+              <goal>generate-daemons</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.6</version>
+        <executions>
+          <execution>
+            <configuration>
+              <attach>true</attach>
+              <descriptor>src/main/assembly/assembly.xml</descriptor>
+            </configuration>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>args4j</groupId>
+      <artifactId>args4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>javax.servlet-api</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml b/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..2e4e133
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml
@@ -0,0 +1,38 @@
+<!--
+ ! 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.
+ !-->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
+  <id>assembly</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <fileSets>
+    <fileSet>
+      <directory>target/appassembler/lib</directory>
+      <outputDirectory>lib</outputDirectory>
+    </fileSet>
+    <fileSet>
+      <directory>target/appassembler/bin</directory>
+      <outputDirectory>bin</outputDirectory>
+      <fileMode>0755</fileMode>
+    </fileSet>
+  </fileSets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java
new file mode 100644
index 0000000..e767f28
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java
@@ -0,0 +1,83 @@
+/*
+ * 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.clienthelper;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.Option;
+
+@SuppressWarnings("FieldCanBeLocal")
+public class Args {
+
+    @Option(name = "-clusteraddress", metaVar = "<address>",
+            usage = "Hostname or IP Address of the cluster")
+    protected String clusterAddress = InetAddress.getLoopbackAddress().getHostAddress();
+
+    @Option(name = "-clusterport", metaVar = "<port>", usage = "Port of the cluster to connect to")
+    protected int clusterPort = 19002;
+
+    @Option(name = "-clusterstatepath", metaVar = "<path>",
+            usage = "Path on host:port to check for cluster readiness")
+    protected String clusterStatePath = "admin/cluster";
+
+    @Option(name = "-shutdownpath", metaVar = "<path>",
+            usage = "Path on host:port to invoke to initiate shutdown")
+    protected String shutdownPath = "admin/shutdown";
+
+
+    @Option(name = "-timeout", metaVar = "<secs>", usage = "Timeout for wait commands in seconds")
+    protected int timeoutSecs = -1;
+
+    @Option(name = "-quiet", aliases = "-q", usage = "Suppress all normal output")
+    protected boolean quiet;
+
+    @Argument
+    protected List<String> arguments = new ArrayList<>();
+
+    public String getClusterAddress() {
+        return clusterAddress;
+    }
+
+    public int getClusterPort() {
+        return clusterPort;
+    }
+
+    public int getTimeoutSecs() {
+        return timeoutSecs;
+    }
+
+    public boolean isQuiet() {
+        return quiet;
+    }
+
+    public String getClusterStatePath() {
+        return clusterStatePath;
+    }
+
+    public List<String> getArguments() {
+        return arguments;
+    }
+
+    public String getShutdownPath() {
+        return shutdownPath;
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java
new file mode 100644
index 0000000..7dfede9
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java
@@ -0,0 +1,32 @@
+/*
+ * 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.clienthelper;
+
+import java.io.IOException;
+
+public class AsterixHelper {
+
+    private AsterixHelper() {
+    }
+
+    public static void main(String [] args) throws IOException {
+        AsterixHelperExecution execution = new AsterixHelperExecution();
+        System.exit(execution.execute(args));
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
new file mode 100644
index 0000000..82e8386
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
@@ -0,0 +1,106 @@
+/*
+ * 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.clienthelper;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.asterix.clienthelper.commands.ClientCommand;
+import org.apache.asterix.clienthelper.commands.ClientCommand.Command;
+import org.apache.asterix.clienthelper.commands.GetClusterStateCommand;
+import org.apache.asterix.clienthelper.commands.ShutdownCommand;
+import org.apache.asterix.clienthelper.commands.WaitForClusterCommand;
+import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.ParserProperties;
+
+public class AsterixHelperExecution {
+
+    public static final String ASTERIX_HELPER = "asterixhelper";
+
+    protected AsterixHelperExecution() {
+    }
+
+    @SuppressWarnings({
+            "squid:S106", // use of System.err
+            "squid:S1166" // rethrow or log exception
+    })
+    protected int execute(String [] argArray) throws IOException {
+        Args args = createArgs();
+        CmdLineParser parser = createParser(args);
+        try {
+            parser.parseArgument(argArray);
+            if (args.getArguments().isEmpty()) {
+                throw new CmdLineException(parser, "No command specified.", null);
+            }
+            ClientCommand command = getCommand(args);
+            if (command == null) {
+                throw new CmdLineException(parser, "Unknown command specified: " + args.getArguments().get(0), null);
+            } else {
+                return command.execute();
+            }
+        } catch (CmdLineException e) {
+            System.err.println("ERROR: " + e.getMessage() + "\n\n"
+                    + "Usage: " + getHelperCommandName() + " [options] <command>\n\n"
+                    + "Commands:");
+            printCommandUsage(System.err);
+            System.err.println("Options:");
+            parser.printUsage(System.err);
+            System.err.flush();
+            return 99;
+        }
+    }
+
+    protected String getHelperCommandName() {
+        return ASTERIX_HELPER;
+    }
+
+    protected void printCommandUsage(PrintStream out) {
+        for (Command command : Command.values()) {
+            out.println("  " + command.name().toLowerCase() + " " + command.usage());
+        }
+    }
+
+    protected CmdLineParser createParser(Args args) {
+        return new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(120));
+    }
+
+    protected Args createArgs() {
+        return new Args();
+    }
+
+    @SuppressWarnings("squid:S1166") // rethrow or log IllegalArgumentException
+    protected ClientCommand getCommand(Args args) {
+
+        Command command = Command.valueOfSafe(args.getArguments().get(0));
+        if (command == null) {
+            return null;
+        }
+        switch (command) {
+            case GET_CLUSTER_STATE:
+                return new GetClusterStateCommand(args);
+            case WAIT_FOR_CLUSTER:
+                return new WaitForClusterCommand(args);
+            case SHUTDOWN_CLUSTER:
+                return new ShutdownCommand(args);
+            default:
+                throw new IllegalStateException("NYI: " + command);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
new file mode 100644
index 0000000..734d87b
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ClientCommand.java
@@ -0,0 +1,75 @@
+/*
+ * 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.clienthelper.commands;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.apache.asterix.clienthelper.Args;
+
+public abstract class ClientCommand {
+
+    public enum Command {
+        GET_CLUSTER_STATE("- Get state of cluster (errorcode 0 = UP, non-zero = DOWN)"),
+        WAIT_FOR_CLUSTER(" - Wait for cluster to be ready (errorcode 0 = UP, non-zero = UNKNOWN)\")"),
+        SHUTDOWN_CLUSTER(" - Instructs the cluster to shut down"),;
+
+        private final String usage;
+        private static final Map<String, Command> nameMap = new HashMap<>();
+
+        static {
+            for (Command command : values()) {
+                nameMap.put(command.name(), command);
+            }
+        }
+
+        Command(String usage) {
+            this.usage = usage;
+        }
+
+        public String usage() {
+            return usage;
+        }
+
+        public static Command valueOfSafe(String name) {
+            return nameMap.get(name.toUpperCase());
+        }
+    }
+
+    protected final Args args;
+
+    public ClientCommand(Args args) {
+        this.args = args;
+    }
+
+    @SuppressWarnings("squid:S106")
+    protected void log(Level severity, String message) {
+        if (!args.isQuiet()) {
+            System.out.println(severity + ": " + message);
+        }
+    }
+
+    protected void log(String message) {
+        log(Level.INFO, message);
+    }
+
+    public abstract int execute() throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
new file mode 100644
index 0000000..275583e
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/GetClusterStateCommand.java
@@ -0,0 +1,55 @@
+/*
+ * 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.clienthelper.commands;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.asterix.clienthelper.Args;
+
+public class GetClusterStateCommand extends RemoteCommand {
+
+    public GetClusterStateCommand(Args args) {
+        super(args);
+    }
+
+    private void logState(String state) {
+        final String hostPort = args.getClusterAddress() + ":" + args.getClusterPort();
+        log("Cluster " + hostPort + " is " + state + ".");
+    }
+
+    @Override
+    public int execute() throws IOException {
+        log("Attempting to determine state of cluster " + hostPort + "...");
+        int statusCode = tryGet(args.getClusterStatePath());
+        // TODO (mblow): interrogate result to determine cluster readiness, not rely on HTTP 200
+        switch (statusCode) {
+            case HttpServletResponse.SC_OK:
+                logState("UP");
+                return 0;
+            case -1:
+                logState("DOWN");
+                return 1;
+            default:
+                logState("UNKNOWN");
+                return 2;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
new file mode 100644
index 0000000..1440b70
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java
@@ -0,0 +1,61 @@
+/*
+ * 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.clienthelper.commands;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.asterix.clienthelper.Args;
+
+public abstract class RemoteCommand extends ClientCommand {
+    enum Method {
+        GET,
+        POST
+    }
+
+    protected final String hostPort;
+
+    public RemoteCommand(Args args) {
+        super(args);
+        hostPort = args.getClusterAddress() + ":" + args.getClusterPort();
+    }
+
+    @SuppressWarnings("squid:S1166") // log or rethrow exception
+    protected int tryConnect(String path, Method method) throws MalformedURLException {
+        URL url = new URL("http://" + hostPort + "/" + path);
+        try {
+            HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+            conn.setRequestMethod(method.name());
+            return conn.getResponseCode();
+
+        } catch (IOException e) {
+            return -1;
+        }
+    }
+
+    protected int tryGet(String path) throws MalformedURLException {
+        return tryConnect(path, Method.GET);
+    }
+
+    protected int tryPost(String path) throws MalformedURLException {
+        return tryConnect(path, Method.POST);
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java
new file mode 100644
index 0000000..ee6e1a7
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/ShutdownCommand.java
@@ -0,0 +1,57 @@
+/*
+ * 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.clienthelper.commands;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.asterix.clienthelper.Args;
+
+public class ShutdownCommand extends RemoteCommand {
+    private final String shutdownPath;
+
+    public ShutdownCommand(Args args) {
+        super(args);
+        shutdownPath = args.getShutdownPath();
+    }
+
+    private void clusterLog(String suffix) {
+        log("Cluster " + hostPort + " " + suffix);
+    }
+
+    @Override
+    public int execute() throws IOException {
+        log("Attempting to shutdown cluster " + hostPort + "...");
+        int statusCode = tryPost(shutdownPath);
+        // TODO (mblow): interrogate result to determine acceptance, not rely on HTTP 200
+        switch (statusCode) {
+            case HttpServletResponse.SC_ACCEPTED:
+                clusterLog("accepted shutdown request.");
+                return 0;
+            case -1:
+                clusterLog("not reachable.");
+                return 1;
+            default:
+                clusterLog("shutdown request failed, with response code:" + statusCode);
+        }
+        return 1;
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
new file mode 100644
index 0000000..fda22ee
--- /dev/null
+++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/WaitForClusterCommand.java
@@ -0,0 +1,60 @@
+/*
+ * 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.clienthelper.commands;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.asterix.clienthelper.Args;
+
+public class WaitForClusterCommand extends RemoteCommand {
+
+    public WaitForClusterCommand(Args args) {
+        super(args);
+    }
+
+    @Override
+    @SuppressWarnings("squid:S2142") // interrupted exception
+    public int execute() throws IOException {
+        log("Waiting "
+                + (args.getTimeoutSecs() > 0 ? "up to " + args.getTimeoutSecs() + " seconds " : "")
+                + "for cluster " + hostPort + " to be available.");
+
+        long startTime = System.currentTimeMillis();
+        while (true) {
+            if (tryGet(args.getClusterStatePath()) == HttpServletResponse.SC_OK) {
+                log("Cluster started.");
+                return 0;
+            }
+            if (args.getTimeoutSecs() >= 0
+                    && (startTime + (args.getTimeoutSecs() * 1000) < System.currentTimeMillis())) {
+                break;
+            }
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException e) {
+                return 22;
+            }
+        }
+        log("Cluster " + hostPort + " was not available before timeout of " + args.getTimeoutSecs()
+                + " seconds was exhausted.");
+        return 1;
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-events/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-events/pom.xml b/asterixdb/asterix-events/pom.xml
index 97bf78f..4bd66df 100644
--- a/asterixdb/asterix-events/pom.xml
+++ b/asterixdb/asterix-events/pom.xml
@@ -146,9 +146,6 @@
     <dependency>
       <groupId>args4j</groupId>
       <artifactId>args4j</artifactId>
-      <version>2.0.12</version>
-      <type>jar</type>
-      <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>org.jvnet.jaxb2_commons</groupId>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-events/src/main/java/org/apache/asterix/event/service/AsterixEventServiceUtil.java
----------------------------------------------------------------------
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 08d89cb..02c06dc 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
@@ -32,8 +32,10 @@ import java.io.StringWriter;
 import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Enumeration;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
+import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarOutputStream;
@@ -79,6 +81,8 @@ public class AsterixEventServiceUtil {
     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 {
         Node metadataNode = getMetadataNode(asterixInstanceName, cluster);
@@ -316,25 +320,25 @@ public class AsterixEventServiceUtil {
     }
 
     public static void unzip(String sourceFile, String destDir) throws IOException {
-        BufferedOutputStream dest = null;
-        FileInputStream fis = new FileInputStream(sourceFile);
-        ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
-        ZipEntry entry = null;
+        final FileInputStream fis = new FileInputStream(sourceFile);
+        final ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
+        final File destDirFile = new File(destDir);
+        final byte [] data = new byte[BUFFER_SIZE];
 
-        int BUFFER_SIZE = 4096;
+        ZipEntry entry;
+        Set<String> visitedDirs = new HashSet<>();
         createDir(destDir);
         while ((entry = zis.getNextEntry()) != null) {
-            String dst = destDir + File.separator + entry.getName();
+            createDir(destDirFile, entry, visitedDirs);
             if (entry.isDirectory()) {
-                createDir(destDir, entry);
                 continue;
             }
             int count;
-            byte data[] = new byte[BUFFER_SIZE];
 
             // write the file to the disk
+            File dst = new File(destDir, entry.getName());
             FileOutputStream fos = new FileOutputStream(dst);
-            dest = new BufferedOutputStream(fos, BUFFER_SIZE);
+            BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE);
             while ((count = zis.read(data, 0, BUFFER_SIZE)) != -1) {
                 dest.write(data, 0, count);
             }
@@ -424,12 +428,16 @@ public class AsterixEventServiceUtil {
         writer.close();
     }
 
-    private static void createDir(String destDirectory, ZipEntry entry) {
+    private static void createDir(File destDirectory, ZipEntry entry, Set<String> visitedDirs) {
         String name = entry.getName();
         int index = name.lastIndexOf(File.separator);
-        String dirSequence = name.substring(0, index);
-        File newDirs = new File(destDirectory + File.separator + dirSequence);
-        newDirs.mkdirs();
+        if (index != -1) {
+            String dirSequence = name.substring(0, index);
+            if (visitedDirs.add(dirSequence)) {
+                File newDirs = new File(destDirectory, dirSequence);
+                newDirs.mkdirs();
+            }
+        }
     }
 
     private static void createDir(String destDirectory) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-installer/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-installer/pom.xml b/asterixdb/asterix-installer/pom.xml
index c1de4a4..2b849c2 100644
--- a/asterixdb/asterix-installer/pom.xml
+++ b/asterixdb/asterix-installer/pom.xml
@@ -240,9 +240,6 @@
     <dependency>
       <groupId>args4j</groupId>
       <artifactId>args4j</artifactId>
-      <version>2.0.12</version>
-      <type>jar</type>
-      <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.zookeeper</groupId>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index 78e990f..269c219 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -119,7 +119,6 @@
             <goals>
               <goal>assemble</goal>
               <goal>generate-daemons</goal>
-              <goal>create-repository</goal>
             </goals>
           </execution>
         </executions>
@@ -144,10 +143,11 @@
       </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
-        <version>2.2-beta-5</version>
+        <version>2.6</version>
         <executions>
           <execution>
             <configuration>
+              <attach>true</attach>
               <filters>
                 <filter>${project.basedir}/src/main/assembly/filter.properties</filter>
               </filters>
@@ -157,7 +157,7 @@
             </configuration>
             <phase>package</phase>
             <goals>
-              <goal>attached</goal>
+              <goal>single</goal>
             </goals>
           </execution>
         </executions>
@@ -237,5 +237,12 @@
       <artifactId>appassembler-booter</artifactId>
       <version>1.3.1</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.asterix</groupId>
+      <artifactId>asterix-client-helper</artifactId>
+      <version>${project.version}</version>
+      <type>zip</type>
+      <classifier>assembly</classifier>
+    </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
index 4afde5f..0c82f41 100644
--- a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
+++ b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
@@ -16,7 +16,9 @@
  ! specific language governing permissions and limitations
  ! under the License.
  !-->
-<assembly>
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
   <id>binary-assembly</id>
   <formats>
     <format>zip</format>
@@ -40,21 +42,18 @@
       </includes>
     </fileSet>
     <fileSet>
-      <directory>src/main/resources</directory>
-      <outputDirectory>.</outputDirectory>
-      <includes>
-        <include>samples/**</include>
-      </includes>
+      <directory>src/main/samples</directory>
+      <outputDirectory>samples</outputDirectory>
       <excludes>
         <exclude>**/*.sh</exclude>
       </excludes>
       <filtered>true</filtered>
     </fileSet>
     <fileSet>
-      <directory>src/main/resources</directory>
-      <outputDirectory>.</outputDirectory>
+      <directory>src/main/samples</directory>
+      <outputDirectory>samples</outputDirectory>
       <includes>
-        <include>samples/**/*.sh</include>
+        <include>**/*.sh</include>
       </includes>
       <filtered>true</filtered>
       <fileMode>0755</fileMode>
@@ -83,4 +82,14 @@
       <fileMode>0755</fileMode>
     </fileSet>
   </fileSets>
+  <dependencySets>
+    <dependencySet>
+      <useStrictFiltering>true</useStrictFiltering>
+      <unpack>true</unpack>
+      <outputDirectory>.</outputDirectory>
+      <includes>
+        <include>org.apache.asterix:asterix-client-helper:zip:assembly:*</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/assembly/filter.properties
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/assembly/filter.properties b/asterixdb/asterix-server/src/main/assembly/filter.properties
index 301aeaf..f7a53b3 100644
--- a/asterixdb/asterix-server/src/main/assembly/filter.properties
+++ b/asterixdb/asterix-server/src/main/assembly/filter.properties
@@ -1,5 +1,5 @@
 NC_SERVICE_COMMAND=asterixncservice
 CC_COMMAND=asterixcc
 NC_COMMAND=asterixnc
+HELPER_COMMAND=asterixhelper
 LISTEN_PORT=19002
-SHUTDOWN_SERVLET_PATH=admin/shutdown

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh b/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh
deleted file mode 100755
index 932231f..0000000
--- a/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-# ----------------------------------------------------------------------------
-#  Copyright 2001-2006 The Apache Software Foundation.
-#
-#  Licensed 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.
-# ----------------------------------------------------------------------------
-#
-#   Copyright (c) 2001-2006 The Apache Software Foundation.  All rights
-#   reserved.
-
-if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]; then
-  JAVA_HOME=$(/usr/libexec/java_home)
-  export JAVA_HOME
-fi
-
-[ -z "$JAVA_HOME" ] && {
-  echo "JAVA_HOME not set"
-  exit 1
-}
-"$JAVA_HOME/bin/java" -version || {
-  echo "JAVA_HOME not valid"
-  exit 2
-}
-
-DIRNAME=$(dirname $0)
-[ $(echo $DIRNAME | wc -l) -ne 1 ] && {
-  echo "Paths with spaces are not supported"
-  exit 3
-}
-
-CLUSTERDIR=$(cd $DIRNAME/..; echo $PWD)
-INSTALLDIR=$(cd $CLUSTERDIR/../..; echo $PWD)
-LOGSDIR=$CLUSTERDIR/logs
-
-echo "CLUSTERDIR=$CLUSTERDIR"
-echo "INSTALLDIR=$INSTALLDIR"
-
-cd $CLUSTERDIR
-mkdir -p $LOGSDIR
-
-(
-  echo "--------------------------"
-  date
-  echo "--------------------------"
-) | tee -a $LOGSDIR/blue-service.log | tee -a $LOGSDIR/red-service.log >> $LOGSDIR/cc.log
-
-$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - -config-file $CLUSTERDIR/conf/blue.conf >> $LOGSDIR/blue-service.log 2>&1 &
-$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - >> $LOGSDIR/red-service.log 2>&1 &
-$INSTALLDIR/bin/${CC_COMMAND} -config-file $CLUSTERDIR/conf/cc.conf >> $LOGSDIR/cc.log 2>&1 &
-
-echo -n "Waiting for cluster to start."
-while [ 1 ]; do
-  curl -s -o /dev/null http://localhost:${LISTEN_PORT} && break
-  echo -n "."
-  sleep 1s
-done
-echo ".done"
-echo
-echo "See output in $LOGSDIR/"

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh b/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh
deleted file mode 100755
index 9836cb3..0000000
--- a/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-# ----------------------------------------------------------------------------
-#  Copyright 2001-2006 The Apache Software Foundation.
-#
-#  Licensed 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.
-# ----------------------------------------------------------------------------
-#
-#   Copyright (c) 2001-2006 The Apache Software Foundation.  All rights
-#   reserved.
-
-if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]; then
-  JAVA_HOME=$(/usr/libexec/java_home)
-  export JAVA_HOME
-fi
-
-[ -z "$JAVA_HOME" ] && {
-  echo "JAVA_HOME not set"
-  exit 1
-}
-"$JAVA_HOME/bin/java" -version || {
-  echo "JAVA_HOME not valid"
-  exit 2
-}
-
-curl -X POST http://localhost:${LISTEN_PORT}/${SHUTDOWN_SERVLET_PATH}
-$JAVA_HOME/bin/jps | awk '/NCService/ { print $1 }' | xargs kill
-echo
-echo -n "Waiting for CCDriver to terminate."
-while [ -n "$($JAVA_HOME/bin/jps | awk '/CCDriver/')" ]; do
-  sleep 2s
-  echo -n .
-done
-echo ".done."

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/resources/samples/local/conf/blue.conf
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/conf/blue.conf b/asterixdb/asterix-server/src/main/resources/samples/local/conf/blue.conf
deleted file mode 100644
index 1dcedc8..0000000
--- a/asterixdb/asterix-server/src/main/resources/samples/local/conf/blue.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[ncservice]
-port=9091

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf b/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf
deleted file mode 100644
index 5ef1cbf..0000000
--- a/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-[nc/red]
-txnlogdir=data/red/txnlog
-coredumpdir=data/red/coredump
-iodevices=data/red
-
-[nc/blue]
-port=9091
-txnlogdir=data/blue/txnlog
-coredumpdir=data/blue/coredump
-iodevices=data/blue
-
-[nc]
-storagedir=storage
-address=127.0.0.1
-command=${NC_COMMAND}
-
-[cc]
-cluster.address = 127.0.0.1
-
-[asterix]
-log.level=INFO

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.sh
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.sh b/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.sh
new file mode 100755
index 0000000..e97f900
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/samples/local/bin/start-sample-cluster.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]; then
+  JAVA_HOME=$(/usr/libexec/java_home)
+  export JAVA_HOME
+fi
+
+[ -z "$JAVA_HOME" ] && {
+  echo "JAVA_HOME not set"
+  exit 1
+}
+"$JAVA_HOME/bin/java" -version 2>&1 | grep -q '1\.[89]' || {
+  echo "JAVA_HOME must be at version 1.8 or later:"
+  "$JAVA_HOME/bin/java" -version
+  exit 2
+}
+DIRNAME=$(dirname $0)
+[ $(echo $DIRNAME | wc -l) -ne 1 ] && {
+  echo "Paths with spaces are not supported"
+  exit 3
+}
+
+CLUSTERDIR=$(cd $DIRNAME/..; echo $PWD)
+INSTALLDIR=$(cd $CLUSTERDIR/../..; echo $PWD)
+LOGSDIR=$CLUSTERDIR/logs
+
+echo "CLUSTERDIR=$CLUSTERDIR"
+echo "INSTALLDIR=$INSTALLDIR"
+echo
+cd $CLUSTERDIR
+mkdir -p $LOGSDIR
+$INSTALLDIR/bin/${HELPER_COMMAND} get_cluster_state -quiet \
+    && echo "ERROR: sample cluster address (localhost:${LISTEN_PORT}) already in use" && exit 1
+
+(
+  echo "--------------------------"
+  date
+  echo "--------------------------"
+) | tee -a $LOGSDIR/blue-service.log | tee -a $LOGSDIR/red-service.log >> $LOGSDIR/cc.log
+echo "Starting sample cluster..."
+$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - -config-file $CLUSTERDIR/conf/blue.conf >> $LOGSDIR/blue-service.log 2>&1 &
+$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - >> $LOGSDIR/red-service.log 2>&1 &
+$INSTALLDIR/bin/${CC_COMMAND} -config-file $CLUSTERDIR/conf/cc.conf >> $LOGSDIR/cc.log 2>&1 &
+echo "Waiting for sample cluster (localhost:${LISTEN_PORT}) to be ready..."
+if $INSTALLDIR/bin/${HELPER_COMMAND} wait_for_cluster -quiet -timeout 30;
+then
+  echo "Sample cluster (localhost:${LISTEN_PORT}) is ready..."
+else
+  echo "ERROR: cluster did not start successfully"
+fi
+echo "See output in $LOGSDIR/"

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.sh
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.sh b/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.sh
new file mode 100755
index 0000000..7451e4e
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/samples/local/bin/stop-sample-cluster.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+# ------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------
+
+if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]; then
+  JAVA_HOME=$(/usr/libexec/java_home)
+  export JAVA_HOME
+fi
+
+[ -z "$JAVA_HOME" ] && {
+  echo "JAVA_HOME not set"
+  exit 1
+}
+"$JAVA_HOME/bin/java" -version 2>&1 | grep -q '1\.[89]' || {
+  echo "JAVA_HOME must be at version 1.8 or later:"
+  "$JAVA_HOME/bin/java" -version
+  exit 2
+}
+DIRNAME=$(dirname $0)
+[ $(echo $DIRNAME | wc -l) -ne 1 ] && {
+  echo "Paths with spaces are not supported"
+  exit 3
+}
+
+CLUSTERDIR=$(cd $DIRNAME/..; echo $PWD)
+INSTALLDIR=$(cd $CLUSTERDIR/../..; echo $PWD)
+
+if $INSTALLDIR/bin/${HELPER_COMMAND} get_cluster_state -quiet;
+then
+  $INSTALLDIR/bin/${HELPER_COMMAND} shutdown_cluster
+else
+  echo "WARNING: sample cluster does not appear to be running, will attempt to kill any running NCServices and"
+  echo "         wait for CCDriver to terminate if running."
+fi
+
+$JAVA_HOME/bin/jps | awk '/NCService/ { print $1 }' | xargs kill 2>/dev/null
+first=1
+while [ -n "$($JAVA_HOME/bin/jps | awk '/CCDriver/')" ]; do
+  if [ $first ]; then
+    echo
+    echo -n "Waiting for CCDriver to terminate."
+    unset first
+  fi
+  sleep 2s
+  echo -n .
+done
+[ ! $first ] && echo ".done."

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/samples/local/conf/blue.conf
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/samples/local/conf/blue.conf b/asterixdb/asterix-server/src/main/samples/local/conf/blue.conf
new file mode 100644
index 0000000..1dcedc8
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/samples/local/conf/blue.conf
@@ -0,0 +1,2 @@
+[ncservice]
+port=9091

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/asterix-server/src/main/samples/local/conf/cc.conf
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/samples/local/conf/cc.conf b/asterixdb/asterix-server/src/main/samples/local/conf/cc.conf
new file mode 100644
index 0000000..5ef1cbf
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/samples/local/conf/cc.conf
@@ -0,0 +1,21 @@
+[nc/red]
+txnlogdir=data/red/txnlog
+coredumpdir=data/red/coredump
+iodevices=data/red
+
+[nc/blue]
+port=9091
+txnlogdir=data/blue/txnlog
+coredumpdir=data/blue/coredump
+iodevices=data/blue
+
+[nc]
+storagedir=storage
+address=127.0.0.1
+command=${NC_COMMAND}
+
+[cc]
+cluster.address = 127.0.0.1
+
+[asterix]
+log.level=INFO

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/asterixdb/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index 7285a5a..6cbe20a 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -594,6 +594,7 @@
     <module>asterix-experiments</module>
     <module>asterix-coverage</module>
     <module>asterix-active</module>
+    <module>asterix-client-helper</module>
   </modules>
 
   <repositories>
@@ -788,6 +789,11 @@
         <artifactId>xercesImpl</artifactId>
         <version>2.11.0</version>
       </dependency>
+      <dependency>
+        <groupId>args4j</groupId>
+        <artifactId>args4j</artifactId>
+        <version>2.33</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 </project>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/6214f6fc/hyracks-fullstack/hyracks/pom.xml
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/pom.xml b/hyracks-fullstack/hyracks/pom.xml
index 70dfa38..cb2d661 100644
--- a/hyracks-fullstack/hyracks/pom.xml
+++ b/hyracks-fullstack/hyracks/pom.xml
@@ -90,10 +90,6 @@
       <id>hyracks-public</id>
       <url>http://obelix.ics.uci.edu/nexus/content/groups/hyracks-public/</url>
     </repository>
-    <repository>
-      <id>jboss-public</id>
-      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
-    </repository>
   </repositories>
 
   <pluginRepositories>


Mime
View raw message