incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [2/2] git commit: Adding the blur shell project, and now everything compiles and units pass.
Date Tue, 26 Mar 2013 00:08:12 GMT
Adding the blur shell project, and now everything compiles and units pass.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/e8c05c93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/e8c05c93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/e8c05c93

Branch: refs/heads/0.1.5
Commit: e8c05c930169832f1d7f914ee8429c8eac48a180
Parents: b641d99
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon Mar 25 20:07:31 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon Mar 25 20:07:31 2013 -0400

----------------------------------------------------------------------
 src/blur-shell/README.textile                      |   16 +
 src/blur-shell/pom.xml                             |  116 +++++++
 src/blur-shell/src/assemble/bin.xml                |    8 +
 .../main/java/org/apache/blur/shell/Command.java   |   38 +++
 .../org/apache/blur/shell/CreateTableCommand.java  |   62 ++++
 .../apache/blur/shell/DescribeTableCommand.java    |   43 +++
 .../blur/shell/EnableDisableTableCommand.java      |   49 +++
 .../java/org/apache/blur/shell/GetRowCommand.java  |   54 ++++
 .../apache/blur/shell/IndexAccessLogCommand.java   |  119 +++++++
 .../org/apache/blur/shell/ListTablesCommand.java   |   38 +++
 .../src/main/java/org/apache/blur/shell/Main.java  |  240 +++++++++++++++
 .../org/apache/blur/shell/MutateRowCommand.java    |   77 +++++
 .../java/org/apache/blur/shell/QueryCommand.java   |   70 +++++
 .../org/apache/blur/shell/RemoveTableCommand.java  |   43 +++
 .../org/apache/blur/shell/SchemaTableCommand.java  |   43 +++
 .../apache/blur/shell/ShardClusterListCommand.java |   42 +++
 .../blur/shell/ShardServerLayoutCommand.java       |   43 +++
 .../org/apache/blur/shell/TableStatsCommand.java   |   43 +++
 .../java/org/apache/blur/shell/package-info.java   |   22 ++
 src/pom.xml                                        |    2 +-
 20 files changed, 1167 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/README.textile
----------------------------------------------------------------------
diff --git a/src/blur-shell/README.textile b/src/blur-shell/README.textile
new file mode 100644
index 0000000..d7264cb
--- /dev/null
+++ b/src/blur-shell/README.textile
@@ -0,0 +1,16 @@
+h1. Blur shell
+
+A jline based shell which can attach to a Blur server.
+
+h2. Usage
+
+Currently the easiest way to run is 
+
+mvn exec:java -Dexec.mainClass="org.apache.blur.shell.Main" -Dexec.args="host:port"
+
+# create a table that spans three shards
+createtable hdfs://blurhost:9000/blur/tables/table1 table1 3
+
+# index an accesslog
+indexaccesslog /tmp/access_log 100 table1 \\[(.*)\\]\\s+(\\d+)\\s+([\\d\\.]+)\\s+([^\\s]+)\\s+([\\d\\.]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s* date bytes1 sourceip status bytes2 operation url type
+

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/pom.xml
----------------------------------------------------------------------
diff --git a/src/blur-shell/pom.xml b/src/blur-shell/pom.xml
new file mode 100644
index 0000000..8f65787
--- /dev/null
+++ b/src/blur-shell/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.blur</groupId>
+		<artifactId>blur</artifactId>
+		<version>0.1.5</version>
+        <relativePath>../pom.xml</relativePath>
+	</parent>
+	<groupId>org.apache.blur</groupId>
+	<artifactId>blur-shell</artifactId>
+	<packaging>jar</packaging>
+	<name>Blur Shell</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.blur</groupId>
+            <artifactId>blur-thrift</artifactId>
+            <version>${project.version}</version>
+
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.mail</groupId>
+                    <artifactId>mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.jms</groupId>
+                    <artifactId>jms</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jdmk</groupId>
+                    <artifactId>jmxtools</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jmx</groupId>
+                    <artifactId>jmxri</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>jline</groupId>
+            <artifactId>jline</artifactId>
+            <version>${jline.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.7</version>
+            <scope>${junit.version}</scope>
+        </dependency>
+        <dependency>
+        	<groupId>com.google.guava</groupId>
+        	<artifactId>guava</artifactId>
+        	<version>${guava.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>blur-shell</finalName>
+
+        <plugins>
+		  <plugin>
+			<groupId>org.apache.maven.plugins</groupId>
+			<artifactId>maven-compiler-plugin</artifactId>
+			<configuration>
+			  <source>1.6</source>
+			  <target>1.6</target>
+			</configuration>
+		  </plugin>
+
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>2.3</version>
+            <configuration>
+              <descriptorRefs>
+                <descriptorRef>jar-with-dependencies</descriptorRef>
+              </descriptorRefs>
+              <archive>
+                <manifest>
+                  <mainClass>org.apache.blur.shell.Main</mainClass>
+                </manifest>
+              </archive>
+            </configuration>
+            <executions>
+              <execution>
+                <id>make-assembly</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/assemble/bin.xml
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/assemble/bin.xml b/src/blur-shell/src/assemble/bin.xml
new file mode 100644
index 0000000..463fdbc
--- /dev/null
+++ b/src/blur-shell/src/assemble/bin.xml
@@ -0,0 +1,8 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+  <id>bin</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/Command.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/Command.java b/src/blur-shell/src/main/java/org/apache/blur/shell/Command.java
new file mode 100644
index 0000000..0e11f8c
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/Command.java
@@ -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.
+ */
+
+package org.apache.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.thrift.TException;
+
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.Blur.Client;
+
+public abstract class Command {
+  @SuppressWarnings("serial")
+  public static class CommandException extends Exception {
+    public CommandException(String msg) {
+      super(msg);
+    }
+  }
+  abstract public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException;
+  abstract public String help();
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/CreateTableCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/CreateTableCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/CreateTableCommand.java
new file mode 100644
index 0000000..b52b4ad
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/CreateTableCommand.java
@@ -0,0 +1,62 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.AnalyzerDefinition;
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.TableDescriptor;
+import org.apache.thrift.TException;
+
+public class CreateTableCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 4) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tableuri = args[1];
+    String tablename = args[2];
+    int shardCount = Integer.parseInt(args[3]);
+
+    AnalyzerDefinition ad = new AnalyzerDefinition();
+
+    TableDescriptor td = new TableDescriptor(); 
+    td.setTableUri(tableuri);
+    td.setCluster("default");
+    td.setAnalyzerDefinition(ad);
+    td.setName(tablename);
+
+    td.setShardCount(shardCount);
+
+    if (Main.debug) {
+      out.println(td.toString());
+      out.flush();
+    }
+
+    client.createTable(td);
+  }
+
+  @Override
+  public String help() {
+    return "create the named table, args; tableuri tablename shardcount";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/DescribeTableCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/DescribeTableCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/DescribeTableCommand.java
new file mode 100644
index 0000000..ecf86c2
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/DescribeTableCommand.java
@@ -0,0 +1,43 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class DescribeTableCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+
+    out.println(client.describe(tablename));
+  }
+
+  @Override
+  public String help() {
+    return "describe the named table, args; tablename";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/EnableDisableTableCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/EnableDisableTableCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/EnableDisableTableCommand.java
new file mode 100644
index 0000000..4b26a7d
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/EnableDisableTableCommand.java
@@ -0,0 +1,49 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class EnableDisableTableCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+
+    if (args[0].equalsIgnoreCase("enabletable")) {
+      client.enableTable(tablename);
+    } else if (args[0].equalsIgnoreCase("disabletable")) {
+      client.disableTable(tablename);
+    } else {
+      throw new CommandException("unknown command" + args[0]);
+    }
+  }
+
+  @Override
+  public String help() {
+    return "change status of the named table, args; tablename";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/GetRowCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/GetRowCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/GetRowCommand.java
new file mode 100644
index 0000000..9ba1f7e
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/GetRowCommand.java
@@ -0,0 +1,54 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.FetchResult;
+import org.apache.blur.thrift.generated.FetchRowResult;
+import org.apache.blur.thrift.generated.Row;
+import org.apache.blur.thrift.generated.Selector;
+import org.apache.thrift.TException;
+
+public class GetRowCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 3) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+    String rowId = args[2];
+
+    Selector selector = new Selector();
+    selector.setRowId(rowId);
+    FetchResult fetchRow = client.fetchRow(tablename, selector);
+    FetchRowResult rowResult = fetchRow.getRowResult();
+    Row row = rowResult.getRow();
+
+    out.println(row);
+  }
+
+  @Override
+  public String help() {
+    return "display the specified row, args; tablename query";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/IndexAccessLogCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/IndexAccessLogCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/IndexAccessLogCommand.java
new file mode 100644
index 0000000..6351e9a
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/IndexAccessLogCommand.java
@@ -0,0 +1,119 @@
+/**
+ * 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.blur.shell;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.Column;
+import org.apache.blur.thrift.generated.Record;
+import org.apache.blur.thrift.generated.RecordMutation;
+import org.apache.blur.thrift.generated.RecordMutationType;
+import org.apache.blur.thrift.generated.RowMutation;
+import org.apache.blur.thrift.generated.RowMutationType;
+import org.apache.thrift.TException;
+
+import com.google.common.collect.Lists;
+
+public class IndexAccessLogCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length < 6) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    File logfile = new File(args[1]);
+    int batchSize = Integer.parseInt(args[2]);
+    String tablename = args[3];
+    String regex = args[4];
+
+    if (Main.debug) {
+      out.println(regex);
+    }
+
+    Pattern p = Pattern.compile(regex);
+    
+    try {
+      LineNumberReader reader = new LineNumberReader(new FileReader(logfile));
+      try {
+        String line;
+        List<RowMutation> mutations = Lists.newArrayList();
+        while((line = reader.readLine()) != null) {
+          Matcher m = p.matcher(line);
+          if (!m.matches()) {
+            continue;
+          }
+
+          List<Column> columns = new ArrayList<Column>();
+          for (int i = 5; i < args.length; i++) {
+            columns.add(new Column(args[i], m.group(i - 4)));
+          }
+
+          Record record = new Record();
+          record.setRecordId(UUID.randomUUID().toString());
+          record.setFamily("cf1");
+          record.setColumns(columns);
+
+          RecordMutation recordMutation = new RecordMutation();
+          recordMutation.setRecord(record);
+          recordMutation.setRecordMutationType(RecordMutationType.REPLACE_ENTIRE_RECORD);
+
+          List<RecordMutation> recordMutations = new ArrayList<RecordMutation>();
+          recordMutations.add(recordMutation);
+
+          RowMutation mutation = new RowMutation();
+          mutation.setTable(tablename);
+          mutation.setRowId(UUID.randomUUID().toString());
+          mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
+          mutation.setRecordMutations(recordMutations);
+
+          mutations.add(mutation);
+
+          if (mutations.size() == batchSize) {
+            client.mutateBatch(mutations);
+            mutations.clear();
+          }
+        }
+        if (mutations.size() > 0) {
+          client.mutateBatch(mutations);
+          mutations.clear();
+        }
+      } finally {
+        reader.close();
+      }
+    } catch (IOException e) {
+      throw new CommandException(e.getMessage());
+    }
+  }
+
+  @Override
+  public String help() {
+    return "index an access log, args; file batchsize tablename regex colnames+";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/ListTablesCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/ListTablesCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/ListTablesCommand.java
new file mode 100644
index 0000000..d2a1e66
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/ListTablesCommand.java
@@ -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.
+ */
+
+package org.apache.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class ListTablesCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    out.println("tables: " + client.tableList());
+  }
+
+  @Override
+  public String help() {
+    return "list tables";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/Main.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/Main.java b/src/blur-shell/src/main/java/org/apache/blur/shell/Main.java
new file mode 100644
index 0000000..86809ce
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/Main.java
@@ -0,0 +1,240 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.TimeUnit;
+
+import jline.console.ConsoleReader;
+import jline.console.completer.Completer;
+import jline.console.completer.FileNameCompleter;
+import jline.console.completer.StringsCompleter;
+
+import org.apache.blur.shell.Command.CommandException;
+import org.apache.blur.shell.Main.QuitCommand.QuitCommandException;
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+
+import com.google.common.collect.ImmutableMap;
+
+public class Main {
+  /** is debugging enabled - off by default */
+  static boolean debug = false;
+  /** is timing enabled - off by default */
+  static boolean timed = false;
+
+  private static Map<String, Command> commands;
+  
+  public static void usage() {
+    System.out.println("Usage: java " + Main.class.getName()
+        + " controller:port");
+  }
+
+  private static class DebugCommand extends Command {
+
+    @Override
+    public void doit(PrintWriter out, Client client, String[] args)
+        throws CommandException, TException, BlurException {
+      if (debug == true) {
+        debug = false;
+      } else {
+        debug = true;
+      }
+      out.println("debugging is now " + (debug ? "on" : "off"));
+    }
+
+    @Override
+    public String help() {
+      return "toggle debugging on/off";
+    }
+    
+  }
+
+  private static class TimedCommand extends Command {
+
+    @Override
+    public void doit(PrintWriter out, Client client, String[] args)
+        throws CommandException, TException, BlurException {
+      if (timed == true) {
+        timed = false;
+      } else {
+        timed = true;
+      }
+      out.println("timing of commands is now " + (timed ? "on" : "off"));
+    }
+
+    @Override
+    public String help() {
+      return "toggle timing of commands on/off";
+    }
+    
+  }
+
+  private static class HelpCommand extends Command {
+    @Override
+    public void doit(PrintWriter out, Client client, String[] args)
+        throws CommandException, TException, BlurException {
+      out.println("Available commands:");
+      for (Entry<String, Command> e: commands.entrySet()) {
+        out.println("  " + e.getKey() + " - " + e.getValue().help());
+      }
+    }
+
+    @Override
+    public String help() {
+      return "display help";
+    }
+  }
+
+  public static class QuitCommand extends Command {
+    @SuppressWarnings("serial")
+    public static class QuitCommandException extends CommandException {
+      public QuitCommandException() {
+        super("quit");
+      }
+    }
+
+    @Override
+    public void doit(PrintWriter out, Client client, String[] args)
+        throws CommandException, TException, BlurException {
+      throw new QuitCommandException();
+    }
+
+    @Override
+    public String help() {
+      return "exit the shell";
+    }
+  }
+
+  public static void main(String[] args) throws Throwable {
+    commands = new ImmutableMap.Builder<String,Command>()
+        .put("help", new HelpCommand())
+        .put("debug", new DebugCommand())
+        .put("timed", new TimedCommand())
+        .put("quit", new QuitCommand())
+        .put("listtables", new ListTablesCommand())
+        .put("createtable", new CreateTableCommand())
+        .put("enabletable", new EnableDisableTableCommand())
+        .put("disabletable", new EnableDisableTableCommand())
+        .put("removetable", new RemoveTableCommand())
+        .put("describetable", new DescribeTableCommand())
+        .put("tablestats", new TableStatsCommand())
+        .put("schema", new SchemaTableCommand())
+        .put("query", new QueryCommand())
+        .put("getrow", new GetRowCommand())
+        .put("mutaterow", new MutateRowCommand())
+        .put("indexaccesslog", new IndexAccessLogCommand())
+        .put("shardclusterlist", new ShardClusterListCommand())
+        .put("shardserverlayout", new ShardServerLayoutCommand())
+        .build();
+
+    try {
+      ConsoleReader reader = new ConsoleReader();
+
+      reader.setPrompt("blur> ");
+
+      if ((args == null) || (args.length != 1)) {
+        usage();
+        return;
+      }
+
+      String[] hostport = args[0].split(":"); 
+
+      if (hostport.length != 2) {
+        usage();
+        return;
+      }
+
+      List<Completer> completors = new LinkedList<Completer>();
+
+      completors.add(new StringsCompleter(commands.keySet()));
+      completors.add(new FileNameCompleter());
+
+      for (Completer c : completors) {
+        reader.addCompleter(c);
+      }
+
+      TTransport trans = new TSocket(hostport[0], Integer.parseInt(hostport[1]));
+      TProtocol proto = new TBinaryProtocol(new TFramedTransport(trans));
+      Client client = new Client(proto);
+      try {
+          trans.open();
+
+          String line;
+          PrintWriter out = new PrintWriter(reader.getOutput());
+          try {
+            while ((line = reader.readLine()) != null) {
+              line = line.trim();
+              // ignore empty lines and comments
+              if (line.length() == 0 || line.startsWith("#")) {
+                continue;
+              }
+              String[] commandArgs = line.split("\\s");
+              Command command = commands.get(commandArgs[0]);
+              if (command == null) {
+                out.println("unknown command \"" + commandArgs[0] + "\"");
+              } else {
+                long start = System.nanoTime();
+                try {
+                  command.doit(out, client, commandArgs);
+                } catch (QuitCommandException e) {
+                  // exit gracefully
+                  System.exit(0);
+                } catch (CommandException e) {
+                  out.println(e.getMessage());
+                  if (debug) {
+                    e.printStackTrace(out);
+                  }
+                } catch (BlurException e) {
+                  out.println(e.getMessage());
+                  if (debug) {
+                    e.printStackTrace(out);
+                  }
+                } finally {
+                  if (timed) {
+                    out.println("Last command took "
+                        + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)
+                        + "ms");
+                  }
+                }
+              }
+            }
+          } finally {
+            out.close();
+          }
+      } finally {
+          trans.close();
+      }
+    } catch (Throwable t) {
+      t.printStackTrace();
+      throw t;
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/MutateRowCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/MutateRowCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/MutateRowCommand.java
new file mode 100644
index 0000000..dc4164f
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/MutateRowCommand.java
@@ -0,0 +1,77 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.Column;
+import org.apache.blur.thrift.generated.Record;
+import org.apache.blur.thrift.generated.RecordMutation;
+import org.apache.blur.thrift.generated.RecordMutationType;
+import org.apache.blur.thrift.generated.RowMutation;
+import org.apache.blur.thrift.generated.RowMutationType;
+import org.apache.thrift.TException;
+
+public class MutateRowCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 7) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+    String rowid = args[2];
+    String recordid = args[3];
+    String columnfamily = args[4];
+    String columnname = args[5];
+    String value = args[6];
+
+    List<Column> columns = new ArrayList<Column>();
+    columns.add(new Column(columnname, value));
+
+    Record record = new Record();
+    record.setRecordId(recordid);
+    record.setFamily(columnfamily);
+    record.setColumns(columns);
+
+    RecordMutation recordMutation = new RecordMutation();
+    recordMutation.setRecord(record);
+    recordMutation.setRecordMutationType(RecordMutationType.REPLACE_ENTIRE_RECORD);
+
+    List<RecordMutation> recordMutations = new ArrayList<RecordMutation>();
+    recordMutations.add(recordMutation);
+
+    RowMutation mutation = new RowMutation();
+    mutation.setTable(tablename);
+    mutation.setRowId(rowid);
+    mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
+    mutation.setRecordMutations(recordMutations);
+
+    client.mutate(mutation);
+  }
+
+  @Override
+  public String help() {
+    return "mutate the specified row, args; tablename rowid recordid columnfamily columnname value";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
new file mode 100644
index 0000000..9791741
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/QueryCommand.java
@@ -0,0 +1,70 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.BlurQuery;
+import org.apache.blur.thrift.generated.BlurResult;
+import org.apache.blur.thrift.generated.BlurResults;
+import org.apache.blur.thrift.generated.Selector;
+import org.apache.blur.thrift.generated.SimpleQuery;
+import org.apache.thrift.TException;
+
+public class QueryCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length < 3) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+    String query = "";
+    for (int i = 2; i < args.length; i++) {
+      query += args[i] + " ";
+    }
+
+    BlurQuery blurQuery = new BlurQuery();
+    SimpleQuery simpleQuery = new SimpleQuery();
+    simpleQuery.setQueryStr(query);
+    blurQuery.setSimpleQuery(simpleQuery);
+    blurQuery.setSelector(new Selector());
+
+    if (Main.debug) {
+      out.println(blurQuery);
+    }
+
+    BlurResults blurResults = client.query(tablename, blurQuery);
+
+    if (Main.debug) {
+      out.println("shardinfo: " + blurResults.getShardInfo());
+    }
+
+    for (BlurResult result : blurResults.getResults()) {
+      out.println(result);
+    }
+  }
+
+  @Override
+  public String help() {
+    return "query the named table, args; tablename query";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/RemoveTableCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/RemoveTableCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/RemoveTableCommand.java
new file mode 100644
index 0000000..0d160b8
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/RemoveTableCommand.java
@@ -0,0 +1,43 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class RemoveTableCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+
+    client.removeTable(tablename, true);
+  }
+
+  @Override
+  public String help() {
+    return "remove the named table, args; tablename";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
new file mode 100644
index 0000000..5e42835
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/SchemaTableCommand.java
@@ -0,0 +1,43 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class SchemaTableCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+
+    out.println(client.schema(tablename));
+  }
+
+  @Override
+  public String help() {
+    return "schema of the named table, args; tablename";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/ShardClusterListCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/ShardClusterListCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/ShardClusterListCommand.java
new file mode 100644
index 0000000..b8781ec
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/ShardClusterListCommand.java
@@ -0,0 +1,42 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class ShardClusterListCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 1) {
+      throw new CommandException("Invalid args: " + help());
+    }
+
+    out.println(client.shardClusterList());
+  }
+
+  @Override
+  public String help() {
+    return "list the clusters";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/ShardServerLayoutCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/ShardServerLayoutCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/ShardServerLayoutCommand.java
new file mode 100644
index 0000000..3107539
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/ShardServerLayoutCommand.java
@@ -0,0 +1,43 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class ShardServerLayoutCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+
+    out.println(client.shardServerLayout(tablename));
+  }
+
+  @Override
+  public String help() {
+    return "list the server layout for a table, args: tablename";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/TableStatsCommand.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/TableStatsCommand.java b/src/blur-shell/src/main/java/org/apache/blur/shell/TableStatsCommand.java
new file mode 100644
index 0000000..317f453
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/TableStatsCommand.java
@@ -0,0 +1,43 @@
+/**
+ * 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.blur.shell;
+
+import java.io.PrintWriter;
+
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.thrift.TException;
+
+public class TableStatsCommand extends Command {
+  @Override
+  public void doit(PrintWriter out, Client client, String[] args)
+      throws CommandException, TException, BlurException {
+    if (args.length != 2) {
+      throw new CommandException("Invalid args: " + help());
+    }
+    String tablename = args[1];
+
+    out.println(client.tableStats(tablename));
+  }
+
+  @Override
+  public String help() {
+    return "print stats for the named table";
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/blur-shell/src/main/java/org/apache/blur/shell/package-info.java
----------------------------------------------------------------------
diff --git a/src/blur-shell/src/main/java/org/apache/blur/shell/package-info.java b/src/blur-shell/src/main/java/org/apache/blur/shell/package-info.java
new file mode 100644
index 0000000..93727e0
--- /dev/null
+++ b/src/blur-shell/src/main/java/org/apache/blur/shell/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * 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.blur.shell;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e8c05c93/src/pom.xml
----------------------------------------------------------------------
diff --git a/src/pom.xml b/src/pom.xml
index 919f699..8bff127 100644
--- a/src/pom.xml
+++ b/src/pom.xml
@@ -62,7 +62,7 @@ under the License.
 		<module>blur-util</module>
 		<module>blur-gui</module>
 		<module>blur-testsuite</module>
-		<!--module>blur-shell</module-->
+		<module>blur-shell</module>
 		<module>distribution</module>
 	</modules>
 


Mime
View raw message