incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [01/45] git commit: Changing commands from interfaces to abstract classes to allow for easier command use.
Date Sun, 26 Oct 2014 17:54:59 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/blur-384-random-port-cleanup c2476cc23 -> 1ff3e3c1c


Changing commands from interfaces to abstract classes to allow for easier command use.


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

Branch: refs/heads/blur-384-random-port-cleanup
Commit: ac9b75fa4395bb97f5353c006d10b94497842e8a
Parents: 4668e18
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Fri Sep 26 09:41:54 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Fri Sep 26 09:41:54 2014 -0400

----------------------------------------------------------------------
 .../org/apache/blur/command/DocumentCount.java  |   3 +-
 .../blur/command/DocumentCountCombiner.java     |  12 +-
 .../DocumentCountDefaultClusterCombine.java     |   3 +-
 .../blur/command/DocumentCountNoCombine.java    |   3 +-
 .../org/apache/blur/command/TermsCommand.java   |   7 +-
 .../blur/command/TestBlurObjectCommand.java     |   4 +-
 ...UsingDocumentCountDefaultClusterCombine.java |   7 +-
 .../blur/command/example/UsingTermCommand.java  |  44 ++++
 .../services/org.apache.blur.command.Commands   |   3 +-
 .../blur/command/CoreTestClusterContext.java    |  12 +-
 .../blur/command/DocumentCountCombinerTest.java |  23 +-
 .../apache/blur/command/BaseCommandManager.java |  40 ++--
 .../org/apache/blur/command/ClusterCommand.java |  27 ---
 .../org/apache/blur/command/ClusterContext.java |  12 +-
 .../blur/command/ClusterExecuteCommand.java     |  50 +++++
 .../ClusterExecuteReadCombiningCommand.java     |  56 +++++
 .../command/ClusterReadCombiningCommand.java    |  34 ++-
 .../apache/blur/command/ClusterReadCommand.java |  51 +++++
 .../java/org/apache/blur/command/Command.java   | 106 +---------
 .../org/apache/blur/command/CommandRunner.java  | 211 +++++++++++++++++++
 .../blur/command/ControllerClusterContext.java  |  25 ++-
 .../blur/command/ControllerCommandManager.java  |  40 ++--
 .../java/org/apache/blur/command/IndexRead.java |  23 ++
 .../apache/blur/command/IndexReadCombining.java |  27 +++
 .../blur/command/IndexReadCombiningCommand.java |  32 ++-
 .../apache/blur/command/IndexReadCommand.java   |  30 ++-
 .../blur/command/ShardCommandManager.java       |  24 +--
 .../org/apache/blur/command/ThrowException.java |   5 +-
 .../org/apache/blur/command/WaitForSeconds.java |   3 +-
 .../apache/blur/command/test1/TestCommand.java  |   2 +-
 .../org/apache/blur/command/test1/test1.jar     | Bin 1630 -> 1607 bytes
 .../apache/blur/command/test2/TestCommand.java  |   2 +-
 .../org/apache/blur/command/test2/test2.jar     | Bin 1630 -> 1607 bytes
 33 files changed, 669 insertions(+), 252 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/DocumentCount.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/DocumentCount.java b/blur-command/src/main/java/org/apache/blur/command/DocumentCount.java
index bc104e7..3dba4d3 100644
--- a/blur-command/src/main/java/org/apache/blur/command/DocumentCount.java
+++ b/blur-command/src/main/java/org/apache/blur/command/DocumentCount.java
@@ -20,9 +20,8 @@ import java.io.IOException;
 
 import org.apache.blur.command.annotation.Description;
 
-@SuppressWarnings("serial")
 @Description("Gets the number of visible documents in the index.")
-public class DocumentCount extends Command implements IndexReadCommand<Integer> {
+public class DocumentCount extends IndexReadCommand<Integer> {
 
   private static final String DOC_COUNT = "docCount";
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/DocumentCountCombiner.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/DocumentCountCombiner.java b/blur-command/src/main/java/org/apache/blur/command/DocumentCountCombiner.java
index 4ade746..060b7bf 100644
--- a/blur-command/src/main/java/org/apache/blur/command/DocumentCountCombiner.java
+++ b/blur-command/src/main/java/org/apache/blur/command/DocumentCountCombiner.java
@@ -22,10 +22,8 @@ import java.util.Map.Entry;
 
 import org.apache.blur.command.annotation.Description;
 
-@SuppressWarnings("serial")
 @Description("Gets the number of visible documents in the index.")
-public class DocumentCountCombiner extends Command implements ClusterCommand<Long>,
-    IndexReadCombiningCommand<Integer, Long> {
+public class DocumentCountCombiner extends ClusterExecuteReadCombiningCommand<Long> {
 
   private static final String DOC_COUNT_AGGREGATE = "docCountAggregate";
 
@@ -35,14 +33,14 @@ public class DocumentCountCombiner extends Command implements ClusterCommand<Lon
   }
 
   @Override
-  public Integer execute(IndexContext context) throws IOException {
-    return context.getIndexReader().numDocs();
+  public Long execute(IndexContext context) throws IOException {
+    return (long) context.getIndexReader().numDocs();
   }
 
   @Override
-  public Long combine(CombiningContext context, Map<? extends Location<?>, Integer> results) throws IOException {
+  public Long combine(CombiningContext context, Map<? extends Location<?>, Long> results) throws IOException {
     long total = 0;
-    for (Integer i : results.values()) {
+    for (Long i : results.values()) {
       total += i;
     }
     return total;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/DocumentCountDefaultClusterCombine.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/DocumentCountDefaultClusterCombine.java b/blur-command/src/main/java/org/apache/blur/command/DocumentCountDefaultClusterCombine.java
index 98116c2..e8383f5 100644
--- a/blur-command/src/main/java/org/apache/blur/command/DocumentCountDefaultClusterCombine.java
+++ b/blur-command/src/main/java/org/apache/blur/command/DocumentCountDefaultClusterCombine.java
@@ -21,9 +21,8 @@ import java.util.Map;
 
 import org.apache.blur.command.annotation.Description;
 
-@SuppressWarnings("serial")
 @Description("Gets the number of visible documents in the index.")
-public class DocumentCountDefaultClusterCombine extends Command implements ClusterReadCombiningCommand<Long> {
+public class DocumentCountDefaultClusterCombine extends ClusterReadCombiningCommand<Long> {
 
   private static final String DOC_COUNT_CLUSTER_COMBINE = "docCountClusterCombine";
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/DocumentCountNoCombine.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/DocumentCountNoCombine.java b/blur-command/src/main/java/org/apache/blur/command/DocumentCountNoCombine.java
index 3103ff2..cfd4d25 100644
--- a/blur-command/src/main/java/org/apache/blur/command/DocumentCountNoCombine.java
+++ b/blur-command/src/main/java/org/apache/blur/command/DocumentCountNoCombine.java
@@ -22,9 +22,8 @@ import java.util.Map.Entry;
 
 import org.apache.blur.command.annotation.Description;
 
-@SuppressWarnings("serial")
 @Description("Gets the number of visible documents in the index.")
-public class DocumentCountNoCombine extends Command implements IndexReadCommand<Integer>, ClusterCommand<Long> {
+public class DocumentCountNoCombine extends ClusterReadCommand<Integer,Long> {
 
   private static final String DOC_COUNT_NO_COMBINE = "docCountNoCombine";
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/TermsCommand.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/TermsCommand.java b/blur-command/src/main/java/org/apache/blur/command/TermsCommand.java
index 2cb80ab..968dc96 100644
--- a/blur-command/src/main/java/org/apache/blur/command/TermsCommand.java
+++ b/blur-command/src/main/java/org/apache/blur/command/TermsCommand.java
@@ -5,7 +5,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.SortedSet;
-import java.util.TreeSet;
 
 import org.apache.blur.utils.BlurUtil;
 import org.apache.lucene.index.AtomicReader;
@@ -35,9 +34,7 @@ import com.google.common.collect.Sets;
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-@SuppressWarnings("serial")
-public class TermsCommand extends Command implements ClusterReadCombiningCommand<BlurArray>,
-    IndexReadCombiningCommand<BlurArray, BlurArray> {
+public class TermsCommand extends ClusterReadCombiningCommand<BlurArray> {
   private static final String NAME = "terms";
   private static final String PARAMS = "params";
   private static final String P_SIZE = "size";
@@ -56,11 +53,11 @@ public class TermsCommand extends Command implements ClusterReadCombiningCommand
     return new BlurArray(terms(context.getIndexReader(), fieldName, startWith, size));
   }
 
+  @SuppressWarnings("unchecked")
   @Override
   public BlurArray combine(CombiningContext context, Map<? extends Location<?>, BlurArray> results) throws IOException,
       InterruptedException {
     SortedSet<String> terms = Sets.newTreeSet();
-    
 
     for (BlurArray t : results.values()) {
       terms.addAll((List<String>) t.asList());

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommand.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommand.java b/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommand.java
index 421e030..cbc1718 100644
--- a/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommand.java
+++ b/blur-command/src/main/java/org/apache/blur/command/TestBlurObjectCommand.java
@@ -20,9 +20,7 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.Map.Entry;
 
-@SuppressWarnings("serial")
-public class TestBlurObjectCommand extends Command implements IndexReadCombiningCommand<BlurObject, BlurObject>,
-    ClusterCommand<BlurObject> {
+public class TestBlurObjectCommand extends ClusterExecuteReadCombiningCommand<BlurObject> {
 
   @Override
   public BlurObject execute(IndexContext context) throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/example/UsingDocumentCountDefaultClusterCombine.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/example/UsingDocumentCountDefaultClusterCombine.java b/blur-command/src/main/java/org/apache/blur/command/example/UsingDocumentCountDefaultClusterCombine.java
index ab4ad6f..b1329c5 100644
--- a/blur-command/src/main/java/org/apache/blur/command/example/UsingDocumentCountDefaultClusterCombine.java
+++ b/blur-command/src/main/java/org/apache/blur/command/example/UsingDocumentCountDefaultClusterCombine.java
@@ -19,25 +19,20 @@ package org.apache.blur.command.example;
 import java.io.IOException;
 
 import org.apache.blur.command.Args;
-import org.apache.blur.command.Command;
 import org.apache.blur.command.DocumentCountDefaultClusterCombine;
 import org.apache.blur.thirdparty.thrift_0_9_0.TException;
-import org.apache.blur.thrift.BlurClient;
-import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.BlurException;
 
 public class UsingDocumentCountDefaultClusterCombine {
 
   public static void main(String[] args) throws BlurException, TException, IOException {
 
-    Iface client = BlurClient.getClient("localhost:40020");
-
     DocumentCountDefaultClusterCombine command = new DocumentCountDefaultClusterCombine();
 
     Args arguments = new Args();
     arguments.set("table", "test");
 
-    Long count = Command.run(command, arguments, client);
+    Long count = command.run(arguments, "localhost:40020");
 
     System.out.println(count);
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/java/org/apache/blur/command/example/UsingTermCommand.java
----------------------------------------------------------------------
diff --git a/blur-command/src/main/java/org/apache/blur/command/example/UsingTermCommand.java b/blur-command/src/main/java/org/apache/blur/command/example/UsingTermCommand.java
new file mode 100644
index 0000000..c22acab
--- /dev/null
+++ b/blur-command/src/main/java/org/apache/blur/command/example/UsingTermCommand.java
@@ -0,0 +1,44 @@
+package org.apache.blur.command.example;
+
+/**
+ * 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.
+ */
+import java.io.IOException;
+
+import org.apache.blur.command.Args;
+import org.apache.blur.command.BlurArray;
+import org.apache.blur.command.BlurObject;
+import org.apache.blur.command.TermsCommand;
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
+
+public class UsingTermCommand {
+
+  public static void main(String[] args) throws BlurException, TException, IOException {
+
+    TermsCommand command = new TermsCommand();
+
+    Args arguments = new Args();
+    arguments.set("table", "test");
+    BlurObject params = new BlurObject();
+    params.put("fieldName", "fam0.col0");
+    arguments.set("params", params);
+
+    BlurArray blurArray = command.run(arguments, "localhost:40020");
+
+    System.out.println(blurArray);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/main/resources/META-INF/services/org.apache.blur.command.Commands
----------------------------------------------------------------------
diff --git a/blur-command/src/main/resources/META-INF/services/org.apache.blur.command.Commands b/blur-command/src/main/resources/META-INF/services/org.apache.blur.command.Commands
index 7ffe0d2..00fd53e 100644
--- a/blur-command/src/main/resources/META-INF/services/org.apache.blur.command.Commands
+++ b/blur-command/src/main/resources/META-INF/services/org.apache.blur.command.Commands
@@ -14,4 +14,5 @@
 #  limitations under the License.
 
 org.apache.blur.command.DocumentCount
-org.apache.blur.command.DocumentCountDefaultClusterCombine
\ No newline at end of file
+org.apache.blur.command.DocumentCountDefaultClusterCombine
+org.apache.blur.command.TermsCommand
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/test/java/org/apache/blur/command/CoreTestClusterContext.java
----------------------------------------------------------------------
diff --git a/blur-command/src/test/java/org/apache/blur/command/CoreTestClusterContext.java b/blur-command/src/test/java/org/apache/blur/command/CoreTestClusterContext.java
index e1efa9f..8480cc0 100644
--- a/blur-command/src/test/java/org/apache/blur/command/CoreTestClusterContext.java
+++ b/blur-command/src/test/java/org/apache/blur/command/CoreTestClusterContext.java
@@ -44,39 +44,39 @@ public class CoreTestClusterContext extends ClusterContext {
   }
 
   @Override
-  public <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException {
+  public <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexRead<T>> clazz) throws IOException {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public <T> Map<Shard, Future<T>> readIndexesAsync(Args args, Class<? extends IndexReadCommand<T>> clazz)
+  public <T> Map<Shard, Future<T>> readIndexesAsync(Args args, Class<? extends IndexRead<T>> clazz)
       throws IOException {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public <T> T readIndex(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException {
+  public <T> T readIndex(Args args, Class<? extends IndexRead<T>> clazz) throws IOException {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public <T> Future<T> readIndexAsync(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException {
+  public <T> Future<T> readIndexAsync(Args args, Class<? extends IndexRead<T>> clazz) throws IOException {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public <T> Map<Server, T> readServers(Args args, Class<? extends IndexReadCombiningCommand<?, T>> clazz)
+  public <T> Map<Server, T> readServers(Args args, Class<? extends IndexReadCombining<?, T>> clazz)
       throws IOException {
     // TODO Auto-generated method stub
     return null;
   }
 
   @Override
-  public <T> Map<Server, Future<T>> readServersAsync(Args args, Class<? extends IndexReadCombiningCommand<?, T>> clazz)
+  public <T> Map<Server, Future<T>> readServersAsync(Args args, Class<? extends IndexReadCombining<?, T>> clazz)
       throws IOException {
     // TODO Auto-generated method stub
     return null;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-command/src/test/java/org/apache/blur/command/DocumentCountCombinerTest.java
----------------------------------------------------------------------
diff --git a/blur-command/src/test/java/org/apache/blur/command/DocumentCountCombinerTest.java b/blur-command/src/test/java/org/apache/blur/command/DocumentCountCombinerTest.java
index adfc9ba..9f0fae9 100644
--- a/blur-command/src/test/java/org/apache/blur/command/DocumentCountCombinerTest.java
+++ b/blur-command/src/test/java/org/apache/blur/command/DocumentCountCombinerTest.java
@@ -28,9 +28,9 @@ import org.junit.Test;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Maps;
 
-public class DocumentCountCombinerTest  {
+public class DocumentCountCombinerTest {
   private static IndexContext ctx;
-  
+
   @BeforeClass
   public static void init() {
     ctx = CoreTestContext.newSimpleAlpaNumContext();
@@ -39,21 +39,20 @@ public class DocumentCountCombinerTest  {
   @Test
   public void documentCountShouldBeAccurate() throws IOException {
     DocumentCountCombiner dc = new DocumentCountCombiner();
-    
-    int docCount = dc.execute(ctx);
-   
+
+    long docCount = dc.execute(ctx);
+
     assertEquals(26, docCount);
   }
-  
-  @Test 
+
+  @Test
   public void combineShouldProperlySum() throws IOException {
     DocumentCountCombiner dc = new DocumentCountCombiner();
-    Map<Shard, Integer>  shardTotals = Maps
-        .newHashMap(ImmutableMap
-            .of(new Shard("t1","s1"), 10, new Shard("t1","s2"), 20, new Shard("t1","s3"), 30));
+    Map<Shard, Long> shardTotals = Maps.newHashMap(ImmutableMap.of(new Shard("t1", "s1"), 10L, new Shard("t1", "s2"),
+        20L, new Shard("t1", "s3"), 30L));
     long total = dc.combine(new TestCombiningContext(), shardTotals);
-    
+
     assertEquals(60l, total);
   }
-  
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
index 1042afd..436f641 100644
--- a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
@@ -74,8 +74,8 @@ public class BaseCommandManager implements Closeable {
   private final ExecutorService _executorServiceDriver;
 
   protected final Map<String, BigInteger> _commandLoadTime = new ConcurrentHashMap<String, BigInteger>();
-  protected final Map<String, Command> _command = new ConcurrentHashMap<String, Command>();
-  protected final Map<Class<? extends Command>, String> _commandNameLookup = new ConcurrentHashMap<Class<? extends Command>, String>();
+  protected final Map<String, Command<?>> _command = new ConcurrentHashMap<String, Command<?>>();
+  protected final Map<Class<? extends Command<?>>, String> _commandNameLookup = new ConcurrentHashMap<Class<? extends Command<?>>, String>();
   protected final ConcurrentMap<ExecutionId, Future<Response>> _runningMap;
   protected final long _connectionTimeout;
   protected final String _tmpPath;
@@ -118,23 +118,24 @@ public class BaseCommandManager implements Closeable {
     return getArguments(commandName, true);
   }
 
+  @SuppressWarnings("unchecked")
   protected Map<String, String> getArguments(String commandName, boolean optional) {
-    Command command = _command.get(commandName);
+    Command<?> command = _command.get(commandName);
     if (command == null) {
       return null;
     }
-    Class<? extends Command> clazz = command.getClass();
+    Class<? extends Command<?>> clazz = (Class<? extends Command<?>>) command.getClass();
     Map<String, String> arguments = new TreeMap<String, String>();
     Argument[] args = getArgumentArray(clazz, optional);
     addArguments(arguments, args);
     if (optional) {
       if (!(command instanceof ShardRoute)) {
-        Argument[] argumentArray = getArgumentArray(Command.class, optional);
+        Argument[] argumentArray = getArgumentArray((Class<? extends Command<?>>) Command.class, optional);
         addArguments(arguments, argumentArray);
       }
     } else {
       if (!(command instanceof TableRoute)) {
-        Argument[] argumentArray = getArgumentArray(Command.class, optional);
+        Argument[] argumentArray = getArgumentArray((Class<? extends Command<?>>) Command.class, optional);
         addArguments(arguments, argumentArray);
       }
     }
@@ -150,7 +151,7 @@ public class BaseCommandManager implements Closeable {
     }
   }
 
-  protected Argument[] getArgumentArray(Class<? extends Command> clazz, boolean optional) {
+  protected Argument[] getArgumentArray(Class<? extends Command<?>> clazz, boolean optional) {
     if (optional) {
       OptionalArguments arguments = clazz.getAnnotation(OptionalArguments.class);
       if (arguments == null) {
@@ -296,7 +297,7 @@ public class BaseCommandManager implements Closeable {
       String classNameToRegister = o.toString();
       LOG.info("Loading class [{0}]", classNameToRegister);
       try {
-        register((Class<? extends Command>) loader.loadClass(classNameToRegister), version);
+        register((Class<? extends Command<?>>) loader.loadClass(classNameToRegister), version);
       } catch (ClassNotFoundException e) {
         throw new IOException(e);
       }
@@ -364,9 +365,9 @@ public class BaseCommandManager implements Closeable {
     }
   }
 
-  public void register(Class<? extends Command> commandClass, BigInteger version) throws IOException {
+  public void register(Class<? extends Command<?>> commandClass, BigInteger version) throws IOException {
     try {
-      Command command = commandClass.newInstance();
+      Command<?> command = commandClass.newInstance();
       _command.put(command.getName(), command);
       _commandLoadTime.put(command.getName(), version);
       _commandNameLookup.put(commandClass, command.getName());
@@ -378,15 +379,15 @@ public class BaseCommandManager implements Closeable {
     }
   }
 
-  protected Command getCommandObject(String commandName) {
+  protected Command<?> getCommandObject(String commandName) {
     return _command.get(commandName);
   }
 
-  protected String getCommandName(Class<? extends Command> clazz) {
+  protected String getCommandName(Class<? extends Command<?>> clazz) {
     return _commandNameLookup.get(clazz);
   }
 
-  protected Map<String, Set<Shard>> getShards(TableContextFactory tableContextFactory, Command command,
+  protected Map<String, Set<Shard>> getShards(TableContextFactory tableContextFactory, Command<?> command,
       final Args args, Set<String> tables) throws IOException {
     Map<String, Set<Shard>> shardMap = new TreeMap<String, Set<Shard>>();
     if (command instanceof ShardRoute) {
@@ -417,7 +418,7 @@ public class BaseCommandManager implements Closeable {
     return shardMap;
   }
 
-  protected Set<String> getTables(Command command, final Args args) throws IOException {
+  protected Set<String> getTables(Command<?> command, final Args args) throws IOException {
     Set<String> tables = new TreeSet<String>();
     if (command instanceof TableRoute) {
       TableRoute tableRoute = (TableRoute) command;
@@ -442,12 +443,13 @@ public class BaseCommandManager implements Closeable {
     return tables;
   }
 
+  @SuppressWarnings("unchecked")
   public String getDescription(String commandName) {
-    Command command = _command.get(commandName);
+    Command<?> command = _command.get(commandName);
     if (command == null) {
       return null;
     }
-    Class<? extends Command> clazz = command.getClass();
+    Class<? extends Command<?>> clazz = (Class<? extends Command<?>>) command.getClass();
     Description description = clazz.getAnnotation(Description.class);
     if (description == null) {
       return null;
@@ -456,7 +458,7 @@ public class BaseCommandManager implements Closeable {
   }
 
   public String getReturnType(String commandName) {
-    Command command = _command.get(commandName);
+    Command<?> command = _command.get(commandName);
     if (command == null) {
       return null;
     }
@@ -477,8 +479,8 @@ public class BaseCommandManager implements Closeable {
       } else {
         shardServerReturn = null;
       }
-      if (command instanceof ClusterCommand) {
-        ClusterCommand<?> clusterCommand = (ClusterCommand<?>) command;
+      if (command instanceof ClusterExecuteReadCombiningCommand) {
+        ClusterExecuteReadCombiningCommand<?> clusterCommand = (ClusterExecuteReadCombiningCommand<?>) command;
         Method method = clusterCommand.getClass().getMethod("clusterExecute", new Class[] { Map.class });
         Class<?> returnType = method.getReturnType();
         String clusterReturn = "cluster->(" + returnType.getSimpleName() + ")";

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ClusterCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterCommand.java b/blur-core/src/main/java/org/apache/blur/command/ClusterCommand.java
deleted file mode 100644
index 38beed0..0000000
--- a/blur-core/src/main/java/org/apache/blur/command/ClusterCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.apache.blur.command;
-
-import java.io.IOException;
-import java.io.Serializable;
-
-/**
- * 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.
- */
-
-public interface ClusterCommand<T> extends Serializable, Cloneable {
-
-  T clusterExecute(ClusterContext context) throws IOException, InterruptedException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java b/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
index c140c7f..20ed372 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ClusterContext.java
@@ -32,21 +32,21 @@ public abstract class ClusterContext {
 
   public abstract BlurConfiguration getBlurConfiguration(String table) throws IOException;
 
-  public abstract <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexReadCommand<T>> clazz)
+  public abstract <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexRead<T>> clazz)
       throws IOException;
 
-  public abstract <T> Map<Shard, Future<T>> readIndexesAsync(Args args, Class<? extends IndexReadCommand<T>> clazz)
+  public abstract <T> Map<Shard, Future<T>> readIndexesAsync(Args args, Class<? extends IndexRead<T>> clazz)
       throws IOException;
 
-  public abstract <T> T readIndex(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException;
+  public abstract <T> T readIndex(Args args, Class<? extends IndexRead<T>> clazz) throws IOException;
 
-  public abstract <T> Future<T> readIndexAsync(Args args, Class<? extends IndexReadCommand<T>> clazz)
+  public abstract <T> Future<T> readIndexAsync(Args args, Class<? extends IndexRead<T>> clazz)
       throws IOException;
 
-  public abstract <T> Map<Server, T> readServers(Args args, Class<? extends IndexReadCombiningCommand<?, T>> clazz)
+  public abstract <T> Map<Server, T> readServers(Args args, Class<? extends IndexReadCombining<?, T>> clazz)
       throws IOException;
 
   public abstract <T> Map<Server, Future<T>> readServersAsync(Args args,
-      Class<? extends IndexReadCombiningCommand<?, T>> clazz) throws IOException;
+      Class<? extends IndexReadCombining<?, T>> clazz) throws IOException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteCommand.java b/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteCommand.java
new file mode 100644
index 0000000..39b954f
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteCommand.java
@@ -0,0 +1,50 @@
+package org.apache.blur.command;
+
+import java.io.IOException;
+
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
+
+/**
+ * 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.
+ */
+
+public abstract class ClusterExecuteCommand<T> extends Command<T> {
+
+  public abstract T clusterExecute(ClusterContext context) throws IOException, InterruptedException;
+
+  @Override
+  public T run(Args arguments) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public T run(Args arguments, String connectionStr) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments, connectionStr);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteReadCombiningCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteReadCombiningCommand.java b/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteReadCombiningCommand.java
new file mode 100644
index 0000000..fad26c9
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteReadCombiningCommand.java
@@ -0,0 +1,56 @@
+/**
+ * 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.command;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
+
+public abstract class ClusterExecuteReadCombiningCommand<T> extends Command<T> implements IndexReadCombining<T, T> {
+
+  public abstract T execute(IndexContext context) throws IOException, InterruptedException;
+
+  public abstract T combine(CombiningContext context, Map<? extends Location<?>, T> results) throws IOException,
+      InterruptedException;
+
+  public abstract T clusterExecute(ClusterContext context) throws IOException, InterruptedException;
+
+  @Override
+  public T run(Args arguments) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public T run(Args arguments, String connectionStr) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments, connectionStr);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ClusterReadCombiningCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterReadCombiningCommand.java b/blur-core/src/main/java/org/apache/blur/command/ClusterReadCombiningCommand.java
index a87fffc..2861b83 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ClusterReadCombiningCommand.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ClusterReadCombiningCommand.java
@@ -16,6 +16,38 @@
  */
 package org.apache.blur.command;
 
-public interface ClusterReadCombiningCommand<T> extends IndexReadCombiningCommand<T, T> {
+import java.io.IOException;
+import java.util.Map;
 
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
+
+public abstract class ClusterReadCombiningCommand<T> extends Command<T> implements IndexReadCombining<T, T> {
+
+  public abstract T execute(IndexContext context) throws IOException, InterruptedException;
+
+  public abstract T combine(CombiningContext context, Map<? extends Location<?>, T> results) throws IOException,
+      InterruptedException;
+
+  @Override
+  public T run(Args arguments) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public T run(Args arguments, String connectionStr) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments, connectionStr);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ClusterReadCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ClusterReadCommand.java b/blur-core/src/main/java/org/apache/blur/command/ClusterReadCommand.java
new file mode 100644
index 0000000..478f173
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/command/ClusterReadCommand.java
@@ -0,0 +1,51 @@
+/**
+ * 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.command;
+
+import java.io.IOException;
+
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
+
+public abstract class ClusterReadCommand<T1, T2> extends Command<T2> implements IndexRead<T1> {
+
+  public abstract T1 execute(IndexContext context) throws IOException, InterruptedException;
+
+  public abstract T2 clusterExecute(ClusterContext context) throws IOException, InterruptedException;
+
+  @Override
+  public T2 run(Args arguments) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public T2 run(Args arguments, String connectionStr) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments, connectionStr);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/Command.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/Command.java b/blur-core/src/main/java/org/apache/blur/command/Command.java
index e2ed191..780d7f0 100644
--- a/blur-core/src/main/java/org/apache/blur/command/Command.java
+++ b/blur-core/src/main/java/org/apache/blur/command/Command.java
@@ -17,124 +17,28 @@
 package org.apache.blur.command;
 
 import java.io.IOException;
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
 
 import org.apache.blur.command.annotation.Argument;
 import org.apache.blur.command.annotation.OptionalArguments;
 import org.apache.blur.command.annotation.RequiredArguments;
-import org.apache.blur.thirdparty.thrift_0_9_0.TException;
-import org.apache.blur.thirdparty.thrift_0_9_0.transport.TTransportException;
-import org.apache.blur.thrift.BlurClient.BlurClientInvocationHandler;
-import org.apache.blur.thrift.BlurClientManager;
-import org.apache.blur.thrift.ClientPool;
-import org.apache.blur.thrift.Connection;
-import org.apache.blur.thrift.generated.Blur;
-import org.apache.blur.thrift.generated.Blur.Client;
-import org.apache.blur.thrift.generated.Blur.Iface;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.ErrorType;
-import org.apache.blur.thrift.generated.Response;
-import org.apache.blur.thrift.generated.TimeoutException;
 
-@SuppressWarnings("serial")
 @RequiredArguments({ @Argument(name = "table", value = "The name of the table to execute the document count command.", type = String.class) })
 @OptionalArguments({ @Argument(name = "shard", value = "The shard id to execute the document count command.", type = String.class) })
-public abstract class Command implements Serializable, Cloneable {
-
-  private static Connection[] getConnection(Iface client) {
-    if (client instanceof Proxy) {
-      InvocationHandler invocationHandler = Proxy.getInvocationHandler(client);
-      if (invocationHandler instanceof BlurClientInvocationHandler) {
-        BlurClientInvocationHandler handler = (BlurClientInvocationHandler) invocationHandler;
-        return handler.getConnections().toArray(new Connection[] {});
-      }
-    }
-    if (client == null) {
-      throw new RuntimeException("Client cannot be null.");
-    }
-    throw new RuntimeException("Unknown client class [" + client.getClass() + "]");
-  }
+public abstract class Command<R> implements Cloneable {
 
   public abstract String getName();
 
-  public static <T> Map<Shard, T> run(IndexReadCommand<T> command, Args arguments, Blur.Iface client)
-      throws IOException, BlurException, TException {
-    return run(command, arguments, getConnection(client));
-  }
-
-  @SuppressWarnings("unchecked")
-  public static <T> Map<Shard, T> run(IndexReadCommand<T> command, Args arguments, Connection... connection)
-      throws IOException, BlurException, TException {
-    return (Map<Shard, T>) runInternal((Command) command, arguments, connection);
-  }
-
-  public static <T> Map<Server, T> run(IndexReadCombiningCommand<?, T> command, Args arguments, Blur.Iface client)
-      throws IOException, BlurException, TException {
-    return run(command, arguments, getConnection(client));
-  }
-
-  @SuppressWarnings("unchecked")
-  public static <T> Map<Server, T> run(IndexReadCombiningCommand<?, T> command, Args arguments,
-      Connection... connection) throws IOException, BlurException, TException {
-    return (Map<Server, T>) runInternal((Command) command, arguments, connection);
-  }
-
-  public static <T> T run(ClusterReadCombiningCommand<T> command, Args arguments, Blur.Iface client)
-      throws IOException, BlurException, TException {
-    return run(command, arguments, getConnection(client));
-  }
-
-  @SuppressWarnings("unchecked")
-  public static <T> T run(ClusterReadCombiningCommand<T> command, Args arguments, Connection... connection)
-      throws IOException, BlurException, TException {
-    return (T) runInternal((Command) command, arguments, connection);
-  }
+  public abstract R run(Args arguments) throws IOException;
 
-  public static <T> T run(ClusterCommand<T> command, Args arguments, Blur.Iface client) throws IOException,
-      BlurException, TException {
-    return run(command, arguments, getConnection(client));
-  }
-
-  @SuppressWarnings("unchecked")
-  public static <T> T run(ClusterCommand<T> command, Args arguments, Connection... connection) throws IOException,
-      BlurException, TException {
-    return (T) runInternal((Command) command, arguments, connection);
-  }
-
-  private static Object runInternal(Command command, Args arguments, Connection... connectionsArray)
-      throws TTransportException, IOException, BlurException, TimeoutException, TException {
-    List<Connection> connections = new ArrayList<Connection>(Arrays.asList(connectionsArray));
-    Collections.shuffle(connections);
-    for (Connection connection : connections) {
-      if (BlurClientManager.isBadConnection(connection)) {
-        continue;
-      }
-      ClientPool clientPool = BlurClientManager.getClientPool();
-      Client client = clientPool.getClient(connection);
-      try {
-        Response response = client.execute(command.getName(), CommandUtil.toArguments(arguments));
-        return CommandUtil.fromThriftResponseToObject(response);
-      } finally {
-        clientPool.returnClient(connection, client);
-      }
-    }
-    throw new BlurException("All connections bad. [" + connections + "]", null, ErrorType.UNKNOWN);
-  }
+  public abstract R run(Args arguments, String connectionStr) throws IOException;
 
+  @SuppressWarnings({ "unchecked", "rawtypes" })
   @Override
-  public Command clone() {
+  public Command<R> clone() {
     try {
       return (Command) super.clone();
     } catch (CloneNotSupportedException e) {
       throw new RuntimeException(e);
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/CommandRunner.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/CommandRunner.java b/blur-core/src/main/java/org/apache/blur/command/CommandRunner.java
new file mode 100644
index 0000000..e572c0b
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/command/CommandRunner.java
@@ -0,0 +1,211 @@
+/**
+ * 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.command;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thirdparty.thrift_0_9_0.transport.TTransportException;
+import org.apache.blur.thrift.BlurClient;
+import org.apache.blur.thrift.BlurClient.BlurClientInvocationHandler;
+import org.apache.blur.thrift.BlurClientManager;
+import org.apache.blur.thrift.ClientPool;
+import org.apache.blur.thrift.Connection;
+import org.apache.blur.thrift.generated.Blur;
+import org.apache.blur.thrift.generated.Blur.Client;
+import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.thrift.generated.BlurException;
+import org.apache.blur.thrift.generated.ErrorType;
+import org.apache.blur.thrift.generated.Response;
+import org.apache.blur.thrift.generated.TimeoutException;
+
+public class CommandRunner {
+  private static Connection[] getConnection(Iface client) {
+    if (client instanceof Proxy) {
+      InvocationHandler invocationHandler = Proxy.getInvocationHandler(client);
+      if (invocationHandler instanceof BlurClientInvocationHandler) {
+        BlurClientInvocationHandler handler = (BlurClientInvocationHandler) invocationHandler;
+        return handler.getConnections().toArray(new Connection[] {});
+      }
+    }
+    if (client == null) {
+      throw new RuntimeException("Client cannot be null.");
+    }
+    throw new RuntimeException("Unknown client class [" + client.getClass() + "]");
+  }
+
+  public static <T> Map<Shard, T> run(IndexReadCommand<T> command, Args arguments) throws IOException, BlurException,
+      TException {
+    Iface client = BlurClient.getClient();
+    return run(command, arguments, getConnection(client));
+  }
+
+  public static <T> Map<Shard, T> run(IndexReadCommand<T> command, Args arguments, String connectionStr)
+      throws IOException, BlurException, TException {
+    Iface client = BlurClient.getClient(connectionStr);
+    return run(command, arguments, getConnection(client));
+  }
+
+  public static <T> Map<Shard, T> run(IndexReadCommand<T> command, Args arguments, Blur.Iface client)
+      throws IOException, BlurException, TException {
+    return run(command, arguments, getConnection(client));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> Map<Shard, T> run(IndexReadCommand<T> command, Args arguments, Connection... connection)
+      throws IOException, BlurException, TException {
+    return (Map<Shard, T>) runInternal((Command<?>) command, arguments, connection);
+  }
+
+  public static <T> Map<Server, T> run(IndexReadCombiningCommand<?, T> command, Args arguments) throws IOException,
+      BlurException, TException {
+    Iface client = BlurClient.getClient();
+    return run(command, arguments, getConnection(client));
+  }
+
+  public static <T> Map<Server, T> run(IndexReadCombiningCommand<?, T> command, Args arguments, String connectionStr)
+      throws IOException, BlurException, TException {
+    Iface client = BlurClient.getClient(connectionStr);
+    return run(command, arguments, getConnection(client));
+  }
+
+  public static <T> Map<Server, T> run(IndexReadCombiningCommand<?, T> command, Args arguments, Blur.Iface client)
+      throws IOException, BlurException, TException {
+    return run(command, arguments, getConnection(client));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> Map<Server, T> run(IndexReadCombiningCommand<?, T> command, Args arguments,
+      Connection... connection) throws IOException, BlurException, TException {
+    return (Map<Server, T>) runInternal((Command<?>) command, arguments, connection);
+  }
+
+  public static <T1, T2> T2 run(ClusterReadCommand<T1, T2> command, Args arguments) throws IOException, BlurException,
+      TException {
+    return run(command, arguments, getConnection(BlurClient.getClient()));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T1, T2> T2 run(ClusterReadCommand<T1, T2> command, Args arguments, String connectioStr)
+      throws IOException, BlurException, TException {
+    return (T2) runInternal((Command<?>) command, arguments, getConnection(BlurClient.getClient(connectioStr)));
+  }
+
+  public static <T1, T2> T2 run(ClusterReadCommand<T1, T2> command, Args arguments, Blur.Iface client)
+      throws IOException, BlurException, TException {
+    return run(command, arguments, getConnection(client));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T1, T2> T2 run(ClusterReadCommand<T1, T2> command, Args arguments, Connection... connection)
+      throws IOException, BlurException, TException {
+    return (T2) runInternal((Command<?>) command, arguments, connection);
+  }
+
+  public static <T> T run(ClusterReadCombiningCommand<T> command, Args arguments) throws IOException, BlurException,
+      TException {
+    return run(command, arguments, getConnection(BlurClient.getClient()));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> T run(ClusterReadCombiningCommand<T> command, Args arguments, String connectioStr)
+      throws IOException, BlurException, TException {
+    return (T) runInternal((Command<?>) command, arguments, getConnection(BlurClient.getClient(connectioStr)));
+  }
+
+  public static <T> T run(ClusterReadCombiningCommand<T> command, Args arguments, Blur.Iface client)
+      throws IOException, BlurException, TException {
+    return run(command, arguments, getConnection(client));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> T run(ClusterReadCombiningCommand<T> command, Args arguments, Connection... connection)
+      throws IOException, BlurException, TException {
+    return (T) runInternal((Command<?>) command, arguments, connection);
+  }
+
+  public static <T> T run(ClusterExecuteCommand<T> command, Args arguments) throws IOException, BlurException,
+      TException {
+    return run(command, arguments, getConnection(BlurClient.getClient()));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> T run(ClusterExecuteCommand<T> command, Args arguments, String connectioStr) throws IOException,
+      BlurException, TException {
+    return (T) runInternal((Command<?>) command, arguments, getConnection(BlurClient.getClient(connectioStr)));
+  }
+
+  public static <T> T run(ClusterExecuteCommand<T> command, Args arguments, Blur.Iface client) throws IOException,
+      BlurException, TException {
+    return run(command, arguments, getConnection(client));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> T run(ClusterExecuteCommand<T> command, Args arguments, Connection... connection)
+      throws IOException, BlurException, TException {
+    return (T) runInternal((Command<?>) command, arguments, connection);
+  }
+
+  public static <T> T run(ClusterExecuteReadCombiningCommand<T> command, Args arguments) throws IOException,
+      BlurException, TException {
+    return run(command, arguments, getConnection(BlurClient.getClient()));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> T run(ClusterExecuteReadCombiningCommand<T> command, Args arguments, String connectioStr)
+      throws IOException, BlurException, TException {
+    return (T) runInternal((Command<?>) command, arguments, getConnection(BlurClient.getClient(connectioStr)));
+  }
+
+  public static <T> T run(ClusterExecuteReadCombiningCommand<T> command, Args arguments, Blur.Iface client)
+      throws IOException, BlurException, TException {
+    return run(command, arguments, getConnection(client));
+  }
+
+  @SuppressWarnings("unchecked")
+  public static <T> T run(ClusterExecuteReadCombiningCommand<T> command, Args arguments, Connection... connection)
+      throws IOException, BlurException, TException {
+    return (T) runInternal((Command<?>) command, arguments, connection);
+  }
+
+  private static Object runInternal(Command<?> command, Args arguments, Connection... connectionsArray)
+      throws TTransportException, IOException, BlurException, TimeoutException, TException {
+    List<Connection> connections = new ArrayList<Connection>(Arrays.asList(connectionsArray));
+    Collections.shuffle(connections);
+    for (Connection connection : connections) {
+      if (BlurClientManager.isBadConnection(connection)) {
+        continue;
+      }
+      ClientPool clientPool = BlurClientManager.getClientPool();
+      Client client = clientPool.getClient(connection);
+      try {
+        Response response = client.execute(command.getName(), CommandUtil.toArguments(arguments));
+        return CommandUtil.fromThriftResponseToObject(response);
+      } finally {
+        clientPool.returnClient(connection, client);
+      }
+    }
+    throw new BlurException("All connections bad. [" + connections + "]", null, ErrorType.UNKNOWN);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java b/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
index 007126e..7ac3566 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
@@ -89,15 +89,14 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
   }
 
   @Override
-  public <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException {
+  public <T> Map<Shard, T> readIndexes(Args args, Class<? extends IndexRead<T>> clazz) throws IOException {
     Map<Shard, Future<T>> futures = readIndexesAsync(args, clazz);
     Map<Shard, T> result = new HashMap<Shard, T>();
     return processFutures(clazz, futures, result);
   }
 
   @Override
-  public <T> Map<Server, T> readServers(Args args, Class<? extends IndexReadCombiningCommand<?, T>> clazz)
-      throws IOException {
+  public <T> Map<Server, T> readServers(Args args, Class<? extends IndexReadCombining<?, T>> clazz) throws IOException {
     Map<Server, Future<T>> futures = readServersAsync(args, clazz);
     Map<Server, T> result = new HashMap<Server, T>();
     return processFutures(clazz, futures, result);
@@ -113,10 +112,10 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
 
   @SuppressWarnings("unchecked")
   @Override
-  public <T> Map<Shard, Future<T>> readIndexesAsync(final Args args, Class<? extends IndexReadCommand<T>> clazz)
+  public <T> Map<Shard, Future<T>> readIndexesAsync(final Args args, Class<? extends IndexRead<T>> clazz)
       throws IOException {
-    final String commandName = _manager.getCommandName((Class<? extends Command>) clazz);
-    Command command = _manager.getCommandObject(commandName);
+    final String commandName = _manager.getCommandName((Class<? extends Command<?>>) clazz);
+    Command<?> command = _manager.getCommandObject(commandName);
     Map<Shard, Future<T>> futureMap = new HashMap<Shard, Future<T>>();
     Set<String> tables = _manager.getTables(command, args);
     Map<String, Set<Shard>> shards = _manager.getShards(_tableContextFactory, command, args, tables);
@@ -141,7 +140,7 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
     return futureMap;
   }
 
-  private Map<Server, Client> getClientMap(Command command, Args args, Set<String> tables,
+  private Map<Server, Client> getClientMap(Command<?> command, Args args, Set<String> tables,
       Map<String, Set<Shard>> shards) throws IOException {
     Map<Server, Client> result = new HashMap<Server, Client>();
 
@@ -203,10 +202,10 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
 
   @SuppressWarnings("unchecked")
   @Override
-  public <T> Map<Server, Future<T>> readServersAsync(final Args args,
-      Class<? extends IndexReadCombiningCommand<?, T>> clazz) throws IOException {
-    final String commandName = _manager.getCommandName((Class<? extends Command>) clazz);
-    Command command = _manager.getCommandObject(commandName);
+  public <T> Map<Server, Future<T>> readServersAsync(final Args args, Class<? extends IndexReadCombining<?, T>> clazz)
+      throws IOException {
+    final String commandName = _manager.getCommandName((Class<? extends Command<?>>) clazz);
+    Command<?> command = _manager.getCommandObject(commandName);
     Map<Server, Future<T>> futureMap = new HashMap<Server, Future<T>>();
     Set<String> tables = _manager.getTables(command, args);
     Map<String, Set<Shard>> shards = _manager.getShards(_tableContextFactory, command, args, tables);
@@ -260,7 +259,7 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
   }
 
   @Override
-  public <T> T readIndex(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException {
+  public <T> T readIndex(Args args, Class<? extends IndexRead<T>> clazz) throws IOException {
     Future<T> future = readIndexAsync(args, clazz);
     try {
       return future.get();
@@ -272,7 +271,7 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl
   }
 
   @Override
-  public <T> Future<T> readIndexAsync(Args args, Class<? extends IndexReadCommand<T>> clazz) throws IOException {
+  public <T> Future<T> readIndexAsync(Args args, Class<? extends IndexRead<T>> clazz) throws IOException {
     throw new RuntimeException("Not Implemented.");
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
index eb8d904..1d166d4 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ControllerCommandManager.java
@@ -37,7 +37,7 @@ public class ControllerCommandManager extends BaseCommandManager {
   public Response execute(final TableContextFactory tableContextFactory, LayoutFactory layoutFactory,
       String commandName, final Args args) throws IOException, TimeoutException, ExceptionCollector {
     final ClusterContext context = createCommandContext(tableContextFactory, layoutFactory, args);
-    final Command command = getCommandObject(commandName);
+    final Command<?> command = getCommandObject(commandName);
     if (command == null) {
       throw new IOException("Command with name [" + commandName + "] not found.");
     }
@@ -46,18 +46,28 @@ public class ControllerCommandManager extends BaseCommandManager {
       public Response call() throws Exception {
         // For those commands that do not implement cluster command, run them in
         // a base impl.
-        if (command instanceof ClusterCommand) {
-          return executeClusterCommand(context, command);
-        } else if (command instanceof ClusterReadCombiningCommand) {
+
+        if (command instanceof IndexReadCommand) {
+          return executeIndexReadCommand(args, context, command);
+        }
+        if (command instanceof IndexReadCombiningCommand) {
+          return executeIndexReadCombiningCommand(args, context, command);
+        }
+        if (command instanceof ClusterReadCommand) {
+          throw new RuntimeException("Not implemented");
+        }
+        if (command instanceof ClusterReadCombiningCommand) {
           CombiningContext combiningContext = getCombiningContext(tableContextFactory, args);
           return executeClusterReadCombiningCommand(args, context, command, combiningContext);
-        } else if (command instanceof IndexReadCombiningCommand) {
-          return executeIndexReadCombiningCommand(args, context, command);
-        } else if (command instanceof IndexReadCommand) {
-          return executeIndexReadCommand(args, context, command);
-        } else {
-          throw new IOException("Command type of [" + command.getClass() + "] not supported.");
         }
+        if (command instanceof ClusterExecuteReadCombiningCommand) {
+          return executeClusterCommand(context, command);
+        }
+        if (command instanceof ClusterExecuteCommand) {
+          throw new RuntimeException("Not implemented");
+        }
+
+        throw new IOException("Command type of [" + command.getClass() + "] not supported.");
       }
 
     });
@@ -83,20 +93,20 @@ public class ControllerCommandManager extends BaseCommandManager {
     };
   }
 
-  private Response executeClusterCommand(ClusterContext context, Command command) throws IOException,
+  private Response executeClusterCommand(ClusterContext context, Command<?> command) throws IOException,
       InterruptedException {
-    ClusterCommand<Object> clusterCommand = (ClusterCommand<Object>) command;
+    ClusterExecuteReadCombiningCommand<Object> clusterCommand = (ClusterExecuteReadCombiningCommand<Object>) command;
     Object object = clusterCommand.clusterExecute(context);
     return Response.createNewAggregateResponse(object);
   }
 
-  private Response executeIndexReadCommand(Args args, ClusterContext context, Command command) throws IOException {
+  private Response executeIndexReadCommand(Args args, ClusterContext context, Command<?> command) throws IOException {
     Class<? extends IndexReadCommand<Object>> clazz = (Class<? extends IndexReadCommand<Object>>) command.getClass();
     Map<Shard, Object> result = context.readIndexes(args, clazz);
     return Response.createNewShardResponse(result);
   }
 
-  private Response executeClusterReadCombiningCommand(Args args, ClusterContext context, Command command,
+  private Response executeClusterReadCombiningCommand(Args args, ClusterContext context, Command<?> command,
       CombiningContext combiningContext) throws IOException, InterruptedException {
     Class<? extends ClusterReadCombiningCommand<Object>> clazz = (Class<? extends ClusterReadCombiningCommand<Object>>) command
         .getClass();
@@ -106,7 +116,7 @@ public class ControllerCommandManager extends BaseCommandManager {
     return Response.createNewAggregateResponse(result);
   }
 
-  private Response executeIndexReadCombiningCommand(Args args, ClusterContext context, Command command)
+  private Response executeIndexReadCombiningCommand(Args args, ClusterContext context, Command<?> command)
       throws IOException {
     Class<? extends IndexReadCombiningCommand<Object, Object>> clazz = (Class<? extends IndexReadCombiningCommand<Object, Object>>) command
         .getClass();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/IndexRead.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/IndexRead.java b/blur-core/src/main/java/org/apache/blur/command/IndexRead.java
new file mode 100644
index 0000000..234310e
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/command/IndexRead.java
@@ -0,0 +1,23 @@
+/**
+ * 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.command;
+
+import java.io.IOException;
+
+public interface IndexRead<T> {
+  T execute(IndexContext context) throws IOException, InterruptedException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/IndexReadCombining.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/IndexReadCombining.java b/blur-core/src/main/java/org/apache/blur/command/IndexReadCombining.java
new file mode 100644
index 0000000..ff01dbc
--- /dev/null
+++ b/blur-core/src/main/java/org/apache/blur/command/IndexReadCombining.java
@@ -0,0 +1,27 @@
+/**
+ * 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.command;
+
+import java.io.IOException;
+import java.util.Map;
+
+public interface IndexReadCombining<T1, T2> {
+  
+  T1 execute(IndexContext context) throws IOException, InterruptedException;
+
+  T2 combine(CombiningContext context, Map<? extends Location<?>, T1> results) throws IOException, InterruptedException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/IndexReadCombiningCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/IndexReadCombiningCommand.java b/blur-core/src/main/java/org/apache/blur/command/IndexReadCombiningCommand.java
index 0e2314f..c37f8b8 100644
--- a/blur-core/src/main/java/org/apache/blur/command/IndexReadCombiningCommand.java
+++ b/blur-core/src/main/java/org/apache/blur/command/IndexReadCombiningCommand.java
@@ -19,10 +19,36 @@ package org.apache.blur.command;
 import java.io.IOException;
 import java.util.Map;
 
-public interface IndexReadCombiningCommand<T1, T2> {
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
 
-  T1 execute(IndexContext context) throws IOException, InterruptedException;
+public abstract class IndexReadCombiningCommand<T1, T2> extends Command<Map<Server, T2>> implements
+    IndexReadCombining<T1, T2> {
 
-  T2 combine(CombiningContext context, Map<? extends Location<?>, T1> results) throws IOException, InterruptedException;
+  public abstract T1 execute(IndexContext context) throws IOException, InterruptedException;
 
+  public abstract T2 combine(CombiningContext context, Map<? extends Location<?>, T1> results) throws IOException,
+      InterruptedException;
+
+  @Override
+  public Map<Server, T2> run(Args arguments) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public Map<Server, T2> run(Args arguments, String connectionStr) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments, connectionStr);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/IndexReadCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/IndexReadCommand.java b/blur-core/src/main/java/org/apache/blur/command/IndexReadCommand.java
index ffd3db1..e1d0019 100644
--- a/blur-core/src/main/java/org/apache/blur/command/IndexReadCommand.java
+++ b/blur-core/src/main/java/org/apache/blur/command/IndexReadCommand.java
@@ -17,9 +17,35 @@
 package org.apache.blur.command;
 
 import java.io.IOException;
+import java.util.Map;
 
-public interface IndexReadCommand<T> {
+import org.apache.blur.thirdparty.thrift_0_9_0.TException;
+import org.apache.blur.thrift.generated.BlurException;
 
-  T execute(IndexContext context) throws IOException, InterruptedException;
+public abstract class IndexReadCommand<T> extends Command<Map<Shard, T>> implements IndexRead<T> {
+
+  public abstract T execute(IndexContext context) throws IOException, InterruptedException;
+
+  @Override
+  public Map<Shard, T> run(Args arguments) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
+
+  @Override
+  public Map<Shard, T> run(Args arguments, String connectionStr) throws IOException {
+    try {
+      return CommandRunner.run(this, arguments, connectionStr);
+    } catch (BlurException e) {
+      throw new IOException(e);
+    } catch (TException e) {
+      throw new IOException(e);
+    }
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
index 8b64ca3..67a837d 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
@@ -52,11 +52,11 @@ public class ShardCommandManager extends BaseCommandManager {
     Callable<Response> callable = new Callable<Response>() {
       @Override
       public Response call() throws Exception {
-        Command command = getCommandObject(commandName);
+        Command<?> command = getCommandObject(commandName);
         if (command == null) {
           throw new IOException("Command with name [" + commandName + "] not found.");
         }
-        if (command instanceof IndexReadCommand || command instanceof IndexReadCombiningCommand) {
+        if (command instanceof IndexRead || command instanceof IndexReadCombining) {
           return toResponse(executeReadCommand(shardServerContext, command, tableContextFactory, args), command,
               getServerContext(args, tableContextFactory));
         }
@@ -95,17 +95,17 @@ public class ShardCommandManager extends BaseCommandManager {
   }
 
   @SuppressWarnings("unchecked")
-  private Response toResponse(Map<Shard, Object> results, Command command, CombiningContext serverContext)
+  private Response toResponse(Map<Shard, Object> results, Command<?> command, CombiningContext serverContext)
       throws IOException, InterruptedException {
-    if (command instanceof IndexReadCombiningCommand) {
-      IndexReadCombiningCommand<Object, Object> primitiveCommandAggregator = (IndexReadCombiningCommand<Object, Object>) command;
+    if (command instanceof IndexReadCombining) {
+      IndexReadCombining<Object, Object> primitiveCommandAggregator = (IndexReadCombining<Object, Object>) command;
       Object object = primitiveCommandAggregator.combine(serverContext, results);
       return Response.createNewAggregateResponse(object);
     }
     return Response.createNewShardResponse(results);
   }
 
-  private Map<Shard, Object> executeReadCommand(ShardServerContext shardServerContext, Command command,
+  private Map<Shard, Object> executeReadCommand(ShardServerContext shardServerContext, Command<?> command,
       final TableContextFactory tableContextFactory, final Args args) throws IOException, ExceptionCollector {
     Set<String> tables = getTables(command, args);
     if (tables.isEmpty()) {
@@ -130,11 +130,11 @@ public class ShardCommandManager extends BaseCommandManager {
         }
         final BlurIndex blurIndex = e.getValue();
         Callable<Object> callable;
-        if (command instanceof IndexReadCommand) {
-          final IndexReadCommand<?> readCommand = (IndexReadCommand<?>) command.clone();
+        if (command instanceof IndexRead) {
+          final IndexRead<?> readCommand = (IndexRead<?>) command.clone();
           callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCommand);
-        } else if (command instanceof IndexReadCombiningCommand) {
-          final IndexReadCombiningCommand<?, ?> readCombiningCommand = (IndexReadCombiningCommand<?, ?>) command
+        } else if (command instanceof IndexReadCombining) {
+          final IndexReadCombining<?, ?> readCombiningCommand = (IndexReadCombining<?, ?>) command
               .clone();
           callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCombiningCommand);
         } else {
@@ -171,7 +171,7 @@ public class ShardCommandManager extends BaseCommandManager {
 
   private Callable<Object> getCallable(final ShardServerContext shardServerContext, final TableContext tableContext,
       final Args args, final Shard shard, final BlurIndex blurIndex,
-      final IndexReadCombiningCommand<?, ?> readCombiningCommand) {
+      final IndexReadCombining<?, ?> readCombiningCommand) {
     return new Callable<Object>() {
       @Override
       public Object call() throws Exception {
@@ -188,7 +188,7 @@ public class ShardCommandManager extends BaseCommandManager {
   }
 
   private Callable<Object> getCallable(final ShardServerContext shardServerContext, final TableContext tableContext,
-      final Args args, final Shard shard, final BlurIndex blurIndex, final IndexReadCommand<?> readCommand) {
+      final Args args, final Shard shard, final BlurIndex blurIndex, final IndexRead<?> readCommand) {
     return new Callable<Object>() {
       @Override
       public Object call() throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/test/java/org/apache/blur/command/ThrowException.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/command/ThrowException.java b/blur-core/src/test/java/org/apache/blur/command/ThrowException.java
index 0eef036..06aa3cb 100644
--- a/blur-core/src/test/java/org/apache/blur/command/ThrowException.java
+++ b/blur-core/src/test/java/org/apache/blur/command/ThrowException.java
@@ -22,14 +22,13 @@ import org.apache.blur.command.annotation.Argument;
 import org.apache.blur.command.annotation.OptionalArguments;
 import org.apache.blur.command.annotation.RequiredArguments;
 
-@SuppressWarnings("serial")
 @RequiredArguments({ @Argument(name = "table", value = "The name of the table to execute the wait for N number of seconds command.", type = String.class) })
 @OptionalArguments({
 
-    @Argument(name = "shard", value = "The shard id to execute the wait for N number of seconds command.", type = String.class),
+@Argument(name = "shard", value = "The shard id to execute the wait for N number of seconds command.", type = String.class),
 
 })
-public class ThrowException extends Command implements IndexReadCommand<Boolean> {
+public class ThrowException extends IndexReadCommand<Boolean> {
 
   @Override
   public Boolean execute(IndexContext context) throws IOException, InterruptedException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/test/java/org/apache/blur/command/WaitForSeconds.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/java/org/apache/blur/command/WaitForSeconds.java b/blur-core/src/test/java/org/apache/blur/command/WaitForSeconds.java
index 15476f5..8cf6bf2 100644
--- a/blur-core/src/test/java/org/apache/blur/command/WaitForSeconds.java
+++ b/blur-core/src/test/java/org/apache/blur/command/WaitForSeconds.java
@@ -22,9 +22,8 @@ import java.util.concurrent.TimeUnit;
 import org.apache.blur.command.annotation.Argument;
 import org.apache.blur.command.annotation.OptionalArguments;
 
-@SuppressWarnings("serial")
 @OptionalArguments({ @Argument(name = "seconds", value = "The number of seconds to sleep, the default is 30 seconds.", type = Integer.class) })
-public class WaitForSeconds extends Command implements IndexReadCommand<Boolean> {
+public class WaitForSeconds extends IndexReadCommand<Boolean> {
 
   @Override
   public Boolean execute(IndexContext context) throws IOException, InterruptedException {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/test/resources/org/apache/blur/command/test1/TestCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/resources/org/apache/blur/command/test1/TestCommand.java b/blur-core/src/test/resources/org/apache/blur/command/test1/TestCommand.java
index c639eb5..349f508 100644
--- a/blur-core/src/test/resources/org/apache/blur/command/test1/TestCommand.java
+++ b/blur-core/src/test/resources/org/apache/blur/command/test1/TestCommand.java
@@ -22,7 +22,7 @@ import org.apache.blur.command.IndexContext;
 import org.apache.blur.command.IndexReadCommand;
 
 @SuppressWarnings("serial")
-public class TestCommand extends Command implements IndexReadCommand<String> {
+public class TestCommand extends IndexReadCommand<String> {
 
   @Override
   public String getName() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/test/resources/org/apache/blur/command/test1/test1.jar
----------------------------------------------------------------------
diff --git a/blur-core/src/test/resources/org/apache/blur/command/test1/test1.jar b/blur-core/src/test/resources/org/apache/blur/command/test1/test1.jar
index a06757b..fb71b76 100644
Binary files a/blur-core/src/test/resources/org/apache/blur/command/test1/test1.jar and b/blur-core/src/test/resources/org/apache/blur/command/test1/test1.jar differ

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/test/resources/org/apache/blur/command/test2/TestCommand.java
----------------------------------------------------------------------
diff --git a/blur-core/src/test/resources/org/apache/blur/command/test2/TestCommand.java b/blur-core/src/test/resources/org/apache/blur/command/test2/TestCommand.java
index 6baaf96..12e486e 100644
--- a/blur-core/src/test/resources/org/apache/blur/command/test2/TestCommand.java
+++ b/blur-core/src/test/resources/org/apache/blur/command/test2/TestCommand.java
@@ -22,7 +22,7 @@ import org.apache.blur.command.IndexContext;
 import org.apache.blur.command.IndexReadCommand;
 
 @SuppressWarnings("serial")
-public class TestCommand extends Command implements IndexReadCommand<String> {
+public class TestCommand extends IndexReadCommand<String> {
 
   @Override
   public String getName() {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ac9b75fa/blur-core/src/test/resources/org/apache/blur/command/test2/test2.jar
----------------------------------------------------------------------
diff --git a/blur-core/src/test/resources/org/apache/blur/command/test2/test2.jar b/blur-core/src/test/resources/org/apache/blur/command/test2/test2.jar
index 9a8e3f4..47dca03 100644
Binary files a/blur-core/src/test/resources/org/apache/blur/command/test2/test2.jar and b/blur-core/src/test/resources/org/apache/blur/command/test2/test2.jar differ


Mime
View raw message