allow running from an instance with a client
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/4e0759d8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/4e0759d8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/4e0759d8 Branch: refs/heads/blur-384-random-port-cleanup Commit: 4e0759d8d42b77b44422a97a2671313af3dffc66 Parents: 7701555 Author: twilliams <[email protected]> Authored: Fri Sep 26 19:51:29 2014 -0400 Committer: twilliams <[email protected]> Committed: Fri Sep 26 19:51:29 2014 -0400 ---------------------------------------------------------------------- .../command/ClusterExecuteReadCombiningCommand.java | 11 +++++++++++ .../blur/command/ClusterReadCombiningCommand.java | 11 +++++++++++ .../org/apache/blur/command/ClusterReadCommand.java | 12 ++++++++++++ .../src/main/java/org/apache/blur/command/Command.java | 3 +++ .../java/org/apache/blur/command/IndexReadCommand.java | 11 +++++++++++ 5 files changed, 48 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e0759d8/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 index fad26c9..42277bf 100644 --- a/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteReadCombiningCommand.java +++ b/blur-core/src/main/java/org/apache/blur/command/ClusterExecuteReadCombiningCommand.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.Map; import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import org.apache.blur.thrift.generated.Blur.Iface; import org.apache.blur.thrift.generated.BlurException; public abstract class ClusterExecuteReadCombiningCommand<T> extends Command<T> implements IndexReadCombining<T, T> { @@ -53,4 +54,14 @@ public abstract class ClusterExecuteReadCombiningCommand<T> extends Command<T> i } } + @Override + public T run(Args arguments, Iface client) throws IOException { + try { + return CommandRunner.run(this, arguments, client); + } 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/4e0759d8/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 2861b83..7b8b1d4 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 @@ -21,6 +21,7 @@ import java.util.Map; import org.apache.blur.thirdparty.thrift_0_9_0.TException; import org.apache.blur.thrift.generated.BlurException; +import org.apache.blur.thrift.generated.Blur.Iface; public abstract class ClusterReadCombiningCommand<T> extends Command<T> implements IndexReadCombining<T, T> { @@ -50,4 +51,14 @@ public abstract class ClusterReadCombiningCommand<T> extends Command<T> implemen throw new IOException(e); } } + @Override + public T run(Args arguments, Iface client) throws IOException { + try { + return CommandRunner.run(this, arguments, client); + } 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/4e0759d8/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 index 478f173..8d8b46e 100644 --- a/blur-core/src/main/java/org/apache/blur/command/ClusterReadCommand.java +++ b/blur-core/src/main/java/org/apache/blur/command/ClusterReadCommand.java @@ -19,6 +19,7 @@ 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.Blur.Iface; import org.apache.blur.thrift.generated.BlurException; public abstract class ClusterReadCommand<T1, T2> extends Command<T2> implements IndexRead<T1> { @@ -48,4 +49,15 @@ public abstract class ClusterReadCommand<T1, T2> extends Command<T2> implements throw new IOException(e); } } + + @Override + public T2 run(Args arguments, Iface client) throws IOException { + try { + return CommandRunner.run(this, arguments, client); + } 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/4e0759d8/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 780d7f0..20d824a 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 @@ -21,6 +21,7 @@ import java.io.IOException; 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.thrift.generated.Blur.Iface; @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) }) @@ -31,6 +32,8 @@ public abstract class Command<R> implements Cloneable { public abstract R run(Args arguments) throws IOException; public abstract R run(Args arguments, String connectionStr) throws IOException; + + public abstract R run(Args arguments, Iface client) throws IOException; @SuppressWarnings({ "unchecked", "rawtypes" }) @Override http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4e0759d8/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 e1d0019..fbeb116 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 @@ -20,6 +20,7 @@ import java.io.IOException; import java.util.Map; import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import org.apache.blur.thrift.generated.Blur.Iface; import org.apache.blur.thrift.generated.BlurException; public abstract class IndexReadCommand<T> extends Command<Map<Shard, T>> implements IndexRead<T> { @@ -48,4 +49,14 @@ public abstract class IndexReadCommand<T> extends Command<Map<Shard, T>> impleme } } + @Override + public Map<Shard, T> run(Args arguments, Iface client) throws IOException { + try { + return CommandRunner.run(this, arguments, client); + } catch (BlurException e) { + throw new IOException(e); + } catch (TException e) { + throw new IOException(e); + } + } }
