Repository: incubator-blur Updated Branches: refs/heads/master c7a934a9f -> e97a120df
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/ObjectArrayPacking.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/ObjectArrayPacking.java b/blur-core/src/main/java/org/apache/blur/manager/command/ObjectArrayPacking.java deleted file mode 100644 index 31e9d36..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/ObjectArrayPacking.java +++ /dev/null @@ -1,165 +0,0 @@ -package org.apache.blur.manager.command; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.blur.thrift.generated.BlurException; -import org.apache.blur.thrift.generated.BlurObjectType; -import org.apache.blur.thrift.generated.BlurPackedObject; - -/** - * 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 class ObjectArrayPacking { - - public static void main(String[] args) throws BlurException { - BlurObject object = newBlurObject(); - System.out.println(object.toString(1)); - - List<BlurPackedObject> packedVersion = pack(object); - - int index = 0; - for (BlurPackedObject packedObject : packedVersion) { - System.out.println(index + " " + packedObject); - index++; - } - - BlurObject object2 = (BlurObject) unpack(packedVersion); - System.out.println(object2.toString(1)); - System.out.println(object2.toString()); - } - - public static List<BlurPackedObject> pack(Object object) throws BlurException { - List<BlurPackedObject> packed = new ArrayList<BlurPackedObject>(); - pack(-1, object, packed); - return packed; - } - - public static Object unpack(List<BlurPackedObject> packedVersion) { - int size = packedVersion.size(); - Object[] objects = new Object[size]; - for (int i = 0; i < size; i++) { - BlurPackedObject packedObject = packedVersion.get(i); - switch (packedObject.type) { - case MAP: - objects[i] = new BlurObject(); - break; - case LIST: - objects[i] = new BlurArray(); - break; - case VALUE: - objects[i] = CommandUtil.toObject(packedObject.value); - break; - case NAME: - objects[i] = CommandUtil.toObject(packedObject.value); - break; - default: - throw new RuntimeException(); - } - } - - for (int i = 0; i < size; i++) { - BlurPackedObject packedObject = packedVersion.get(i); - switch (packedObject.type) { - case NAME: - break; - case MAP: - case LIST: - case VALUE: - addValue(i, objects, packedVersion); - break; - default: - throw new RuntimeException(); - } - } - return objects[0]; - } - - private static void addValue(int index, Object[] objects, List<BlurPackedObject> packedVersion) { - BlurPackedObject packedObject = packedVersion.get(index); - int parentId = packedObject.parentId; - if (parentId == -1) { - // root - return; - } - Object value = objects[index]; - BlurPackedObject po = packedVersion.get(parentId); - if (po.type == BlurObjectType.NAME) { - BlurObject map = (BlurObject) objects[po.parentId]; - String key = (String) CommandUtil.toObject(po.value); - map.put(key, value); - } else if (po.type == BlurObjectType.LIST) { - BlurArray array = (BlurArray) objects[parentId]; - array.put(value); - } else { - throw new RuntimeException(); - } - } - - private static void pack(int parentId, Object object, List<BlurPackedObject> packed) throws BlurException { - if (object instanceof BlurObject) { - int id = packed.size(); - BlurPackedObject packedObject = new BlurPackedObject(parentId, BlurObjectType.MAP, null); - packed.add(packedObject); - BlurObject blurObject = (BlurObject) object; - Iterator<String> keys = blurObject.keys(); - while (keys.hasNext()) { - String key = keys.next(); - Object o = blurObject.getObject(key); - BlurPackedObject po = new BlurPackedObject(id, BlurObjectType.NAME, CommandUtil.toValue(key)); - int newId = packed.size(); - packed.add(po); - pack(newId, o, packed); - } - } else if (object instanceof BlurArray) { - int id = packed.size(); - BlurPackedObject packedObject = new BlurPackedObject(parentId, BlurObjectType.LIST, null); - packed.add(packedObject); - BlurArray array = (BlurArray) object; - int length = array.length(); - for (int i = 0; i < length; i++) { - Object o = array.getObject(i); - pack(id, o, packed); - } - } else { - packed.add(new BlurPackedObject(parentId, BlurObjectType.VALUE, CommandUtil.toValue(object))); - } - } - - private static BlurObject newBlurObject() { - BlurObject jsonObject = new BlurObject(); - BlurObject node1 = new BlurObject(); - node1.accumulate("f1", "v1"); - node1.accumulate("f2", "v2a"); - node1.accumulate("f2", "v2b"); - jsonObject.accumulate("node1", node1); - BlurArray node2 = new BlurArray(); - node2.put("val1"); - node2.put("val2"); - node2.put("val3"); - jsonObject.put("node2", node2); - - BlurObject node3 = new BlurObject(); - BlurObject node3n1 = new BlurObject(); - node3n1.put("a", "b"); - node3.put("n1", node3n1); - jsonObject.put("node3", node3); - return jsonObject; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/Response.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/Response.java b/blur-core/src/main/java/org/apache/blur/manager/command/Response.java deleted file mode 100644 index ff27a48..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/Response.java +++ /dev/null @@ -1,63 +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.manager.command; - -import java.util.Map; - -public class Response { - - private final Map<Shard, Object> _shardResults; - private final Map<Server, Object> _serverResults; - private final Object _serverResult; - private final boolean _aggregatedResults; - - private Response(Map<Shard, Object> shardResults, Object serverResult, Map<Server, Object> serverResults, - boolean aggregatedResults) { - _shardResults = shardResults; - _serverResult = serverResult; - _aggregatedResults = aggregatedResults; - _serverResults = serverResults; - } - - public boolean isAggregatedResults() { - return _aggregatedResults; - } - - public Map<Shard, Object> getShardResults() { - return _shardResults; - } - - public Object getServerResult() { - return _serverResult; - } - - public Map<Server, Object> getServerResults() { - return _serverResults; - } - - public static Response createNewAggregateResponse(Object object) { - return new Response(null, object, null, true); - } - - public static Response createNewShardResponse(Map<Shard, Object> map) { - return new Response(map, null, null, false); - } - - public static Response createNewServerResponse(Map<Server, Object> result) { - return new Response(null, null, result, false); - } -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/Server.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/Server.java b/blur-core/src/main/java/org/apache/blur/manager/command/Server.java deleted file mode 100644 index 9454b65..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/Server.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.blur.manager.command; - -/** - * 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 class Server implements Comparable<Server> { - - private final String _server; - - public Server(String server) { - _server = server; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((_server == null) ? 0 : _server.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Server other = (Server) obj; - if (_server == null) { - if (other._server != null) - return false; - } else if (!_server.equals(other._server)) - return false; - return true; - } - - public String getServer() { - return _server; - } - - @Override - public int compareTo(Server o) { - if (o == null) { - return -1; - } - return _server.compareTo(o._server); - } - - @Override - public String toString() { - return "Server [server=" + _server + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/Shard.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/Shard.java b/blur-core/src/main/java/org/apache/blur/manager/command/Shard.java deleted file mode 100644 index e61d87a..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/Shard.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.blur.manager.command; - -/** - * 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 class Shard implements Comparable<Shard> { - - private final String _shard; - - public Shard(String shard) { - _shard = shard; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((_shard == null) ? 0 : _shard.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Shard other = (Shard) obj; - if (_shard == null) { - if (other._shard != null) - return false; - } else if (!_shard.equals(other._shard)) - return false; - return true; - } - - public String getShard() { - return _shard; - } - - @Override - public int compareTo(Shard o) { - if (o == null) { - return -1; - } - return _shard.compareTo(o._shard); - } - - @Override - public String toString() { - return "Shard [shard=" + _shard + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/ShardCommandManager.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/ShardCommandManager.java b/blur-core/src/main/java/org/apache/blur/manager/command/ShardCommandManager.java deleted file mode 100644 index 6a89394..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/ShardCommandManager.java +++ /dev/null @@ -1,206 +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.manager.command; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import org.apache.blur.BlurConfiguration; -import org.apache.blur.manager.IndexServer; -import org.apache.blur.manager.command.cmds.BaseCommand; -import org.apache.blur.manager.writer.BlurIndex; -import org.apache.blur.server.IndexSearcherClosable; -import org.apache.blur.server.ShardServerContext; -import org.apache.blur.server.TableContext; -import org.apache.hadoop.conf.Configuration; -import org.apache.lucene.index.IndexReader; -import org.apache.lucene.search.IndexSearcher; - -public class ShardCommandManager extends BaseCommandManager { - - private final IndexServer _indexServer; - - public ShardCommandManager(IndexServer indexServer, int threadCount, long connectionTimeout) throws IOException { - super(threadCount, connectionTimeout); - _indexServer = indexServer; - } - - public Response execute(final TableContext tableContext, final String commandName, final Args args) - throws IOException, TimeoutException { - final ShardServerContext shardServerContext = ShardServerContext.getShardServerContext(); - Callable<Response> callable = new Callable<Response>() { - @Override - public Response call() throws Exception { - BaseCommand command = getCommandObject(commandName); - if (command == null) { - throw new IOException("Command with name [" + commandName + "] not found."); - } - 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."); - } - }; - return submitCallable(callable); - } - - @SuppressWarnings("unchecked") - private Response toResponse(Map<Shard, Object> results, BaseCommand command) throws IOException { - if (command instanceof IndexReadCombiningCommand) { - IndexReadCombiningCommand<Object, Object> primitiveCommandAggregator = (IndexReadCombiningCommand<Object, Object>) command; - Object object = primitiveCommandAggregator.combine(results); - return Response.createNewAggregateResponse(object); - } - return Response.createNewShardResponse(results); - } - - private Map<Shard, Object> executeReadWriteCommand(ShardServerContext shardServerContext, BaseCommand command, - TableContext tableContext, Args args) { - return null; - } - - private Map<Shard, Object> executeReadCommand(ShardServerContext shardServerContext, BaseCommand command, - final TableContext tableContext, final Args args) throws IOException { - Map<String, BlurIndex> indexes = _indexServer.getIndexes(tableContext.getTable()); - Map<String, Future<?>> futureMap = new HashMap<String, Future<?>>(); - for (Entry<String, BlurIndex> e : indexes.entrySet()) { - String shardId = e.getKey(); - final Shard shard = new Shard(shardId); - final BlurIndex blurIndex = e.getValue(); - Callable<Object> callable; - if (command instanceof IndexReadCommand) { - final IndexReadCommand<?> readCommand = (IndexReadCommand<?>) command.clone(); - callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCommand); - } else if (command instanceof IndexReadCombiningCommand) { - final IndexReadCombiningCommand<?, ?> readCombiningCommand = (IndexReadCombiningCommand<?, ?>) command.clone(); - callable = getCallable(shardServerContext, tableContext, args, shard, blurIndex, readCombiningCommand); - } else { - throw new IOException("Command type of [" + command.getClass() + "] not supported."); - } - Future<Object> future = _executorService.submit(callable); - futureMap.put(shardId, future); - } - Map<Shard, Object> resultMap = new HashMap<Shard, Object>(); - for (Entry<String, Future<?>> e : futureMap.entrySet()) { - Future<?> future = e.getValue(); - Object object; - try { - object = future.get(); - } catch (InterruptedException ex) { - throw new IOException(ex); - } catch (ExecutionException ex) { - throw new IOException(ex.getCause()); - } - resultMap.put(new Shard(e.getKey()), object); - } - return resultMap; - } - - private Callable<Object> getCallable(final ShardServerContext shardServerContext, final TableContext tableContext, - final Args args, final Shard shard, final BlurIndex blurIndex, - final IndexReadCombiningCommand<?, ?> readCombiningCommand) { - return new Callable<Object>() { - @Override - public Object call() throws Exception { - String table = tableContext.getTable(); - String shardId = shard.getShard(); - IndexSearcherClosable searcher = shardServerContext.getIndexSearcherClosable(table, shardId); - if (searcher == null) { - searcher = blurIndex.getIndexSearcher(); - shardServerContext.setIndexSearcherClosable(table, shardId, searcher); - } - return readCombiningCommand.execute(new ShardIndexContext(tableContext, shard, searcher, args)); - } - }; - } - - private Callable<Object> getCallable(final ShardServerContext shardServerContext, final TableContext tableContext, - final Args args, final Shard shard, final BlurIndex blurIndex, final IndexReadCommand<?> readCommand) { - return new Callable<Object>() { - @Override - public Object call() throws Exception { - String table = tableContext.getTable(); - String shardId = shard.getShard(); - IndexSearcherClosable searcher = shardServerContext.getIndexSearcherClosable(table, shardId); - if (searcher == null) { - searcher = blurIndex.getIndexSearcher(); - shardServerContext.setIndexSearcherClosable(table, shardId, searcher); - } - return readCommand.execute(new ShardIndexContext(tableContext, shard, searcher, args)); - } - }; - } - - static class ShardIndexContext extends IndexContext { - - private final TableContext _tableContext; - private final Shard _shard; - private final IndexSearcher _searcher; - private final Args _args; - - public ShardIndexContext(TableContext tableContext, Shard shard, IndexSearcher searcher, Args args) { - _tableContext = tableContext; - _shard = shard; - _searcher = searcher; - _args = args; - } - - @Override - public Args getArgs() { - return _args; - } - - @Override - public IndexReader getIndexReader() { - return getIndexSearcher().getIndexReader(); - } - - @Override - public IndexSearcher getIndexSearcher() { - return _searcher; - } - - @Override - public TableContext getTableContext() { - return _tableContext; - } - - @Override - public Shard getShard() { - return _shard; - } - - @Override - public BlurConfiguration getBlurConfiguration() { - return _tableContext.getBlurConfiguration(); - } - - @Override - public Configuration getConfiguration() { - return _tableContext.getConfiguration(); - } - - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/ShardResultFuture.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/ShardResultFuture.java b/blur-core/src/main/java/org/apache/blur/manager/command/ShardResultFuture.java deleted file mode 100644 index 4e3abdb..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/ShardResultFuture.java +++ /dev/null @@ -1,64 +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.manager.command; - -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -public class ShardResultFuture<T> implements Future<T> { - - private final Shard _shard; - private final Future<Map<Shard, T>> _future; - - public boolean cancel(boolean mayInterruptIfRunning) { - return _future.cancel(mayInterruptIfRunning); - } - - public boolean isCancelled() { - return _future.isCancelled(); - } - - public boolean isDone() { - return _future.isDone(); - } - - public T get() throws InterruptedException, ExecutionException { - Map<Shard, T> map = _future.get(); - if (map == null) { - return null; - } - return map.get(_shard); - } - - public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, - TimeoutException { - Map<Shard, T> map = _future.get(timeout, unit); - if (map == null) { - return null; - } - return map.get(_shard); - } - - public ShardResultFuture(Shard shard, Future<Map<Shard, T>> future) { - _shard = shard; - _future = future; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/TimeoutException.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/TimeoutException.java b/blur-core/src/main/java/org/apache/blur/manager/command/TimeoutException.java deleted file mode 100644 index 9e44839..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/TimeoutException.java +++ /dev/null @@ -1,32 +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.manager.command; - -@SuppressWarnings("serial") -public class TimeoutException extends Exception { - - private final String _executionId; - - public TimeoutException(String executionId) { - _executionId = executionId; - } - - public String getExecutionId() { - return _executionId; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Argument.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Argument.java b/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Argument.java deleted file mode 100644 index 7fc6376..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Argument.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.apache.blur.manager.command.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * 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. - */ - -@Retention(RetentionPolicy.RUNTIME) -public @interface Argument { - String name(); - - String value(); -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Arguments.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Arguments.java b/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Arguments.java deleted file mode 100644 index fa16955..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/annotation/Arguments.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.blur.manager.command.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * 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. - */ - -@Retention(RetentionPolicy.RUNTIME) -public @interface Arguments { - Argument[] value(); -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java deleted file mode 100644 index db3ac8b..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/AddDocument.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.apache.blur.manager.command.cmds; - -import java.io.IOException; - -import org.apache.blur.manager.command.Args; -import org.apache.blur.manager.command.IndexContext; -import org.apache.blur.manager.command.IndexWriteCommand; -import org.apache.blur.manager.command.annotation.Argument; -import org.apache.blur.manager.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 BaseCommand 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/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/BaseCommand.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/BaseCommand.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/BaseCommand.java deleted file mode 100644 index 8c227d8..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/BaseCommand.java +++ /dev/null @@ -1,35 +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.manager.command.cmds; - -import java.io.Serializable; - -@SuppressWarnings("serial") -public abstract class BaseCommand implements Serializable, Cloneable { - - public abstract String getName(); - - @Override - public BaseCommand clone() { - try { - return (BaseCommand) super.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException(e); - } - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCount.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCount.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCount.java deleted file mode 100644 index 48357e1..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCount.java +++ /dev/null @@ -1,39 +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.manager.command.cmds; - -import java.io.IOException; - -import org.apache.blur.manager.command.IndexContext; -import org.apache.blur.manager.command.IndexReadCommand; - -@SuppressWarnings("serial") -public class DocumentCount extends BaseCommand implements IndexReadCommand<Integer> { - - private static final String DOC_COUNT = "docCount"; - - @Override - public String getName() { - return DOC_COUNT; - } - - @Override - public Integer execute(IndexContext context) throws IOException { - return context.getIndexReader().numDocs(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountCombiner.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountCombiner.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountCombiner.java deleted file mode 100644 index e2e074e..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountCombiner.java +++ /dev/null @@ -1,65 +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.manager.command.cmds; - -import java.io.IOException; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.blur.manager.command.ClusterCommand; -import org.apache.blur.manager.command.ClusterContext; -import org.apache.blur.manager.command.IndexContext; -import org.apache.blur.manager.command.IndexReadCombiningCommand; -import org.apache.blur.manager.command.Server; -import org.apache.blur.manager.command.Shard; - -@SuppressWarnings("serial") -public class DocumentCountCombiner extends BaseCommand implements ClusterCommand<Long>, - IndexReadCombiningCommand<Integer, Long> { - - private static final String DOC_COUNT_AGGREGATE = "docCountAggregate"; - - @Override - public String getName() { - return DOC_COUNT_AGGREGATE; - } - - @Override - public Integer execute(IndexContext context) throws IOException { - return context.getIndexReader().numDocs(); - } - - @Override - public Long combine(Map<Shard, Integer> results) throws IOException { - long total = 0; - for (Integer i : results.values()) { - total += i; - } - return total; - } - - @Override - public Long clusterExecute(ClusterContext context) throws IOException { - Map<Server, Long> results = context.readServers(null, DocumentCountCombiner.class); - long total = 0; - for (Entry<Server, Long> e : results.entrySet()) { - total += e.getValue(); - } - return total; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountNoCombine.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountNoCombine.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountNoCombine.java deleted file mode 100644 index e3d1f07..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/DocumentCountNoCombine.java +++ /dev/null @@ -1,54 +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.manager.command.cmds; - -import java.io.IOException; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.blur.manager.command.ClusterCommand; -import org.apache.blur.manager.command.ClusterContext; -import org.apache.blur.manager.command.IndexContext; -import org.apache.blur.manager.command.IndexReadCommand; -import org.apache.blur.manager.command.Shard; - -@SuppressWarnings("serial") -public class DocumentCountNoCombine extends BaseCommand implements IndexReadCommand<Integer>, ClusterCommand<Long> { - - private static final String DOC_COUNT_NO_COMBINE = "docCountNoCombine"; - - @Override - public String getName() { - return DOC_COUNT_NO_COMBINE; - } - - @Override - public Integer execute(IndexContext context) throws IOException { - return context.getIndexReader().numDocs(); - } - - @Override - public Long clusterExecute(ClusterContext context) throws IOException { - Map<Shard, Integer> indexes = context.readIndexes(null, DocumentCountNoCombine.class); - long total = 0; - for (Entry<Shard, Integer> e : indexes.entrySet()) { - total += e.getValue(); - } - return total; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommand.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommand.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommand.java deleted file mode 100644 index a509d9d..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommand.java +++ /dev/null @@ -1,72 +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.manager.command.cmds; - -import java.io.IOException; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.blur.manager.command.BlurObject; -import org.apache.blur.manager.command.ClusterCommand; -import org.apache.blur.manager.command.ClusterContext; -import org.apache.blur.manager.command.IndexContext; -import org.apache.blur.manager.command.IndexReadCombiningCommand; -import org.apache.blur.manager.command.Server; -import org.apache.blur.manager.command.Shard; - -@SuppressWarnings("serial") -public class TestBlurObjectCommand extends BaseCommand implements IndexReadCombiningCommand<BlurObject, BlurObject>, - ClusterCommand<BlurObject> { - - @Override - public BlurObject execute(IndexContext context) throws IOException { - BlurObject blurObject = new BlurObject(); - blurObject.accumulate("docCount", context.getIndexReader().numDocs()); - return blurObject; - } - - @Override - public BlurObject combine(Map<Shard, BlurObject> results) throws IOException { - BlurObject blurObject = new BlurObject(); - long total = 0; - for (Entry<Shard, BlurObject> e : results.entrySet()) { - total += e.getValue().getInteger("docCount"); - } - blurObject.put("docCount", total); - return blurObject; - } - - @Override - public BlurObject clusterExecute(ClusterContext context) throws IOException { - BlurObject blurObject = new BlurObject(); - Map<Server, BlurObject> results = context.readServers(null, TestBlurObjectCommand.class); - long total = 0; - for (Entry<Server, BlurObject> e : results.entrySet()) { - BlurObject value = e.getValue(); - Long count = value.getLong("docCount"); - total += count; - } - blurObject.put("docCount", total); - return blurObject; - } - - @Override - public String getName() { - return "testBlurObject"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommandUsing.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommandUsing.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommandUsing.java deleted file mode 100644 index 91ed1c5..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/TestBlurObjectCommandUsing.java +++ /dev/null @@ -1,41 +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.manager.command.cmds; - -import java.io.IOException; - -import org.apache.blur.manager.command.BlurObject; -import org.apache.blur.manager.command.ObjectArrayPacking; -import org.apache.blur.thirdparty.thrift_0_9_0.TException; -import org.apache.blur.thrift.BlurClientManager; -import org.apache.blur.thrift.Connection; -import org.apache.blur.thrift.generated.Blur.Client; -import org.apache.blur.thrift.generated.BlurException; -import org.apache.blur.thrift.generated.Response; - -public class TestBlurObjectCommandUsing { - - public static void main(String[] args) throws BlurException, TException, IOException { - Client client = BlurClientManager.getClientPool().getClient(new Connection("localhost:40010")); - Response response = client.execute("test", "testBlurObject", null); - BlurObject object = (BlurObject) ObjectArrayPacking.unpack(response.getValue().getBlurObject()); - System.out.println(object); - // prints => {"docCount":10005} - System.out.println(object.getLong("docCount")); - // prints => 10005 - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/manager/command/cmds/WaitForSeconds.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/WaitForSeconds.java b/blur-core/src/main/java/org/apache/blur/manager/command/cmds/WaitForSeconds.java deleted file mode 100644 index 3ffde62..0000000 --- a/blur-core/src/main/java/org/apache/blur/manager/command/cmds/WaitForSeconds.java +++ /dev/null @@ -1,42 +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.manager.command.cmds; - -import java.io.IOException; - -import org.apache.blur.manager.command.IndexContext; -import org.apache.blur.manager.command.IndexReadCommand; - -@SuppressWarnings("serial") -public class WaitForSeconds extends BaseCommand implements IndexReadCommand<Boolean> { - - @Override - public Boolean execute(IndexContext context) throws IOException { - try { - Thread.sleep(30000); - } catch (InterruptedException e) { - throw new IOException(e); - } - return true; - } - - @Override - public String getName() { - return "wait"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java index c31a032..a8d6b45 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java @@ -47,15 +47,15 @@ import java.util.concurrent.atomic.AtomicLongArray; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReferenceArray; +import org.apache.blur.command.CommandUtil; +import org.apache.blur.command.ControllerCommandManager; +import org.apache.blur.command.Response; import org.apache.blur.concurrent.Executors; import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; import org.apache.blur.manager.BlurPartitioner; import org.apache.blur.manager.BlurQueryChecker; import org.apache.blur.manager.IndexManager; -import org.apache.blur.manager.command.CommandUtil; -import org.apache.blur.manager.command.ControllerCommandManager; -import org.apache.blur.manager.command.Response; import org.apache.blur.manager.indexserver.DistributedLayout; import org.apache.blur.manager.indexserver.DistributedLayoutFactory; import org.apache.blur.manager.indexserver.DistributedLayoutFactoryImpl; @@ -1514,8 +1514,8 @@ public class BlurControllerServer extends TableAdmin implements Iface { tableLayout); return CommandUtil.fromObjectToThrift(response); } catch (Exception e) { - if (e instanceof org.apache.blur.manager.command.TimeoutException) { - throw new TimeoutException(((org.apache.blur.manager.command.TimeoutException) e).getExecutionId()); + if (e instanceof org.apache.blur.command.TimeoutException) { + throw new TimeoutException(((org.apache.blur.command.TimeoutException) e).getExecutionId()); } LOG.error("Unknown error while trying to execute command [{0}] for table [{1}]", e, commandName, table); if (e instanceof BlurException) { @@ -1536,8 +1536,8 @@ public class BlurControllerServer extends TableAdmin implements Iface { Response response = _commandManager.reconnect(executionId); return CommandUtil.fromObjectToThrift(response); } catch (Exception e) { - if (e instanceof org.apache.blur.manager.command.TimeoutException) { - throw new TimeoutException(((org.apache.blur.manager.command.TimeoutException) e).getExecutionId()); + if (e instanceof org.apache.blur.command.TimeoutException) { + throw new TimeoutException(((org.apache.blur.command.TimeoutException) e).getExecutionId()); } LOG.error("Unknown error while trying to reconnect to executing command [{0}]", e, executionId); if (e instanceof BlurException) { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java index e39f202..5579a50 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java @@ -30,15 +30,15 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLongArray; +import org.apache.blur.command.CommandUtil; +import org.apache.blur.command.Response; +import org.apache.blur.command.ShardCommandManager; import org.apache.blur.concurrent.Executors; import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; import org.apache.blur.manager.BlurQueryChecker; import org.apache.blur.manager.IndexManager; import org.apache.blur.manager.IndexServer; -import org.apache.blur.manager.command.CommandUtil; -import org.apache.blur.manager.command.Response; -import org.apache.blur.manager.command.ShardCommandManager; import org.apache.blur.manager.results.BlurResultIterable; import org.apache.blur.manager.writer.BlurIndex; import org.apache.blur.server.ShardServerContext; @@ -599,8 +599,8 @@ public class BlurShardServer extends TableAdmin implements Iface { Response response = _commandManager.execute(getTableContext(table), commandName, CommandUtil.toArgs(arguments)); return CommandUtil.fromObjectToThrift(response); } catch (Exception e) { - if (e instanceof org.apache.blur.manager.command.TimeoutException) { - throw new TimeoutException(((org.apache.blur.manager.command.TimeoutException) e).getExecutionId()); + if (e instanceof org.apache.blur.command.TimeoutException) { + throw new TimeoutException(((org.apache.blur.command.TimeoutException) e).getExecutionId()); } LOG.error("Unknown error while trying to execute command [{0}] for table [{1}]", e, commandName, table); if (e instanceof BlurException) { @@ -625,8 +625,8 @@ public class BlurShardServer extends TableAdmin implements Iface { Response response = _commandManager.reconnect(executionId); return CommandUtil.fromObjectToThrift(response); } catch (Exception e) { - if (e instanceof org.apache.blur.manager.command.TimeoutException) { - throw new TimeoutException(((org.apache.blur.manager.command.TimeoutException) e).getExecutionId()); + if (e instanceof org.apache.blur.command.TimeoutException) { + throw new TimeoutException(((org.apache.blur.command.TimeoutException) e).getExecutionId()); } LOG.error("Unknown error while trying to reconnect to executing command [{0}]", e, executionId); if (e instanceof BlurException) { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java index d9aad1f..5be19cd 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java @@ -46,6 +46,7 @@ import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_TIMEOUT_DEFAULT import static org.apache.blur.utils.BlurUtil.quietClose; import org.apache.blur.BlurConfiguration; +import org.apache.blur.command.ControllerCommandManager; import org.apache.blur.concurrent.SimpleUncaughtExceptionHandler; import org.apache.blur.concurrent.ThreadWatcher; import org.apache.blur.gui.HttpJettyServer; @@ -54,7 +55,6 @@ import org.apache.blur.log.Log; import org.apache.blur.log.LogFactory; import org.apache.blur.manager.BlurQueryChecker; import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus; -import org.apache.blur.manager.command.ControllerCommandManager; import org.apache.blur.manager.indexserver.BlurServerShutDown; import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown; import org.apache.blur.metrics.ReporterSetup; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java ---------------------------------------------------------------------- diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java index 6cddf17..ad2207a 100644 --- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java +++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java @@ -58,6 +58,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import org.apache.blur.BlurConfiguration; +import org.apache.blur.command.ShardCommandManager; import org.apache.blur.concurrent.SimpleUncaughtExceptionHandler; import org.apache.blur.concurrent.ThreadWatcher; import org.apache.blur.gui.HttpJettyServer; @@ -70,7 +71,6 @@ import org.apache.blur.manager.BlurQueryChecker; import org.apache.blur.manager.DefaultBlurFilterCache; import org.apache.blur.manager.IndexManager; import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus; -import org.apache.blur.manager.command.ShardCommandManager; import org.apache.blur.manager.indexserver.BlurIndexWarmup; import org.apache.blur.manager.indexserver.BlurServerShutDown; import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown; http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/blur-core/src/test/java/org/apache/blur/manager/command/BlurArrayTest.java ---------------------------------------------------------------------- diff --git a/blur-core/src/test/java/org/apache/blur/manager/command/BlurArrayTest.java b/blur-core/src/test/java/org/apache/blur/manager/command/BlurArrayTest.java index e717838..acdb9cc 100644 --- a/blur-core/src/test/java/org/apache/blur/manager/command/BlurArrayTest.java +++ b/blur-core/src/test/java/org/apache/blur/manager/command/BlurArrayTest.java @@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; +import org.apache.blur.command.BlurArray; import org.junit.Test; public class BlurArrayTest { http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e97a120d/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 184052a..b2efd59 100644 --- a/pom.xml +++ b/pom.xml @@ -400,6 +400,7 @@ under the License. <module>blur-util</module> <module>blur-gui</module> <module>blur-shell</module> + <module>blur-command</module> <module>distribution</module> </modules> </profile> @@ -423,6 +424,7 @@ under the License. <module>blur-util</module> <module>blur-gui</module> <module>blur-shell</module> + <module>blur-command</module> <module>distribution</module> </modules> </profile>
