Repository: incubator-blur Updated Branches: refs/heads/master 3ae19454f -> 96145e16a
Removing the index write commands for now. Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/96145e16 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/96145e16 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/96145e16 Branch: refs/heads/master Commit: 96145e16a605e12ad46b73f0192604348cc1ecec Parents: 3ae1945 Author: Aaron McCurry <[email protected]> Authored: Wed Sep 10 16:07:44 2014 -0400 Committer: Aaron McCurry <[email protected]> Committed: Wed Sep 10 16:07:44 2014 -0400 ---------------------------------------------------------------------- .../org/apache/blur/command/AddDocument.java | 55 -------------------- .../org/apache/blur/command/ClusterContext.java | 5 -- .../blur/command/ControllerClusterContext.java | 11 ---- .../blur/command/ControllerCommandManager.java | 8 --- .../apache/blur/command/IndexReadCommand.java | 2 +- .../apache/blur/command/IndexWriteCommand.java | 27 ---------- .../blur/command/ShardCommandManager.java | 9 +--- .../org/apache/blur/command/WaitForSeconds.java | 8 +-- 8 files changed, 4 insertions(+), 121 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/blur-command/src/main/java/org/apache/blur/command/AddDocument.java ---------------------------------------------------------------------- diff --git a/blur-command/src/main/java/org/apache/blur/command/AddDocument.java b/blur-command/src/main/java/org/apache/blur/command/AddDocument.java deleted file mode 100644 index 6b1c05a..0000000 --- a/blur-command/src/main/java/org/apache/blur/command/AddDocument.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.apache.blur.command; - -import java.io.IOException; - -import org.apache.blur.command.Args; -import org.apache.blur.command.Command; -import org.apache.blur.command.IndexContext; -import org.apache.blur.command.IndexWriteCommand; -import org.apache.blur.command.annotation.Argument; -import org.apache.blur.command.annotation.Arguments; -import org.apache.lucene.document.Document; -import org.apache.lucene.index.IndexWriter; - -/** - * 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. - */ - -@SuppressWarnings("serial") -@Arguments({ - @Argument(name = "shard", value = "The shard id that the addDocument command is to be applied."), - @Argument(name = "doc", value = "Is a map of string key to string values that will be converted" - + "into a Lucene Document via the FieldManager and added to the index.") }) -public class AddDocument extends Command implements IndexWriteCommand<Void> { - - @Override - public String getName() { - return "addDoc"; - } - - @Override - public Void execute(IndexContext context, IndexWriter writer) throws IOException { - Args args = context.getArgs(); - Document doc = getDoc(args); - writer.addDocument(doc); - return null; - } - - private Document getDoc(Args args) { - throw new RuntimeException("Not Implemented"); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/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 8a1f6f7..ce9038b 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 @@ -53,9 +53,4 @@ public abstract class ClusterContext { public abstract <T> Map<Server, Future<T>> readServersAsync(Args args, Class<? extends IndexReadCombiningCommand<?, T>> clazz) throws IOException; - public abstract <T> T writeIndex(Args args, Class<? extends IndexWriteCommand<T>> clazz) throws IOException; - - public abstract <T> Future<T> writeIndexAsync(Args args, Class<? extends IndexWriteCommand<T>> clazz) - throws IOException; - } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/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 fa694c1..c14e8af 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 @@ -103,11 +103,6 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl } @Override - public <T> T writeIndex(Args args, Class<? extends IndexWriteCommand<T>> clazz) { - throw new RuntimeException("Not Implemented"); - } - - @Override public void close() throws IOException { ClientPool clientPool = BlurClientManager.getClientPool(); for (Entry<Server, Client> e : _clientMap.entrySet()) { @@ -201,12 +196,6 @@ public class ControllerClusterContext extends ClusterContext implements Closeabl return futureMap; } - @Override - public <T> Future<T> writeIndexAsync(Args args, Class<? extends IndexWriteCommand<T>> clazz) { - // TODO Auto-generated method stub - return null; - } - private <K, T> Map<K, T> processFutures(Class<?> clazz, Map<K, Future<T>> futures, Map<K, T> result) throws IOException { Throwable firstError = null; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/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 31a938d..18e33af 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 @@ -48,8 +48,6 @@ public class ControllerCommandManager extends BaseCommandManager { return executeIndexReadCombiningCommand(args, context, command); } else if (command instanceof IndexReadCommand) { return executeIndexReadCommand(args, context, command); - } else if (command instanceof IndexWriteCommand) { - return executeIndexWriteCommand(args, context, command); } else { throw new IOException("Command type of [" + command.getClass() + "] not supported."); } @@ -63,12 +61,6 @@ public class ControllerCommandManager extends BaseCommandManager { return Response.createNewAggregateResponse(object); } - private Response executeIndexWriteCommand(Args args, ClusterContext context, Command command) throws IOException { - Class<? extends IndexWriteCommand<Object>> clazz = (Class<? extends IndexWriteCommand<Object>>) command.getClass(); - Object object = context.writeIndex(args, clazz); - return Response.createNewAggregateResponse(object); - } - 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); http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/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 c9e5901..ffd3db1 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,6 @@ import java.io.IOException; public interface IndexReadCommand<T> { - T execute(IndexContext context) throws IOException; + T execute(IndexContext context) throws IOException, InterruptedException; } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/blur-core/src/main/java/org/apache/blur/command/IndexWriteCommand.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/command/IndexWriteCommand.java b/blur-core/src/main/java/org/apache/blur/command/IndexWriteCommand.java deleted file mode 100644 index 67ce100..0000000 --- a/blur-core/src/main/java/org/apache/blur/command/IndexWriteCommand.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.blur.command; - -import java.io.IOException; - -import org.apache.lucene.index.IndexWriter; - -public interface IndexWriteCommand<T> { - - public abstract T execute(IndexContext context, IndexWriter writer) throws IOException; - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/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 16fdb4e..eb6caf0 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 @@ -55,8 +55,6 @@ public class ShardCommandManager extends BaseCommandManager { } if (command instanceof IndexReadCommand || command instanceof IndexReadCombiningCommand) { return toResponse(executeReadCommand(shardServerContext, command, tableContext, args), command); - } else if (command instanceof IndexWriteCommand) { - return toResponse(executeReadWriteCommand(shardServerContext, command, tableContext, args), command); } throw new IOException("Command type of [" + command.getClass() + "] not supported."); } @@ -82,11 +80,6 @@ public class ShardCommandManager extends BaseCommandManager { return Response.createNewShardResponse(results); } - private Map<Shard, Object> executeReadWriteCommand(ShardServerContext shardServerContext, Command command, - TableContext tableContext, Args args) { - return null; - } - private Map<Shard, Object> executeReadCommand(ShardServerContext shardServerContext, Command command, final TableContext tableContext, final Args args) throws IOException { Map<String, BlurIndex> indexes = _indexServer.getIndexes(tableContext.getTable()); @@ -211,7 +204,7 @@ public class ShardCommandManager extends BaseCommandManager { } public void cancel(ExecutionId executionId) { - // TODO + // TODO System.out.println("IMPLEMENT ME!!!!"); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/96145e16/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 eeecf86..f078436 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 @@ -27,14 +27,10 @@ import org.apache.blur.command.IndexReadCommand; public class WaitForSeconds extends Command implements IndexReadCommand<Boolean> { @Override - public Boolean execute(IndexContext context) throws IOException { + public Boolean execute(IndexContext context) throws IOException, InterruptedException { Args args = context.getArgs(); int seconds = args.get("seconds", 30); - try { - Thread.sleep(TimeUnit.SECONDS.toMillis(seconds)); - } catch (InterruptedException e) { - throw new IOException(e); - } + Thread.sleep(TimeUnit.SECONDS.toMillis(seconds)); return true; }
