incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [3/16] git commit: Removed all the old prototype code.
Date Wed, 31 Oct 2012 02:36:14 GMT
Removed all the old prototype code.


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

Branch: refs/heads/0.2-dev
Commit: 617596969e29706781167e40667ae7881966d9be
Parents: b610043
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Oct 30 22:16:29 2012 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Oct 30 22:16:29 2012 -0400

----------------------------------------------------------------------
 src/blur-new-api-prototype/generateThrift.sh       |   17 -
 src/blur-new-api-prototype/service.thrift          |  182 -
 .../java/org/apache/blur/cache/BlockCache.java     |  178 -
 .../java/org/apache/blur/cache/BlockCacheKey.java  |   73 -
 .../org/apache/blur/cache/BlockCacheLocation.java  |   66 -
 .../java/org/apache/blur/cache/BlockDirectory.java |  295 -
 .../org/apache/blur/cache/BlockDirectoryCache.java |   68 -
 .../java/org/apache/blur/cache/BlockLocks.java     |   96 -
 .../java/org/apache/blur/cache/BufferStore.java    |   96 -
 .../src/main/java/org/apache/blur/cache/Cache.java |   29 -
 .../blur/cache/ReusedBufferedIndexInput.java       |  349 -
 .../main/java/org/apache/blur/core/ServerFile.java |   50 -
 .../main/java/org/apache/blur/core/ServerHdfs.java |  369 -
 .../apache/blur/core/TupleStoredFieldVisitor.java  |  169 -
 .../src/main/java/org/apache/blur/core/Util.java   |  121 -
 .../org/apache/blur/core/sessions/ReadSession.java |   56 -
 .../blur/core/sessions/RunningQuerySession.java    |  210 -
 .../apache/blur/core/sessions/WriteSession.java    |   83 -
 .../blur/core/sessions/WriteSessionThreaded.java   |   99 -
 .../core/sessions/WriteSessionThreadedFile.java    |   50 -
 .../core/sessions/WriteSessionThreadedPath.java    |   49 -
 .../example/clients/LoadThriftClientBatch.java     |  117 -
 .../example/clients/ReadThriftClientBatch.java     |   97 -
 .../blur/proto/example/clients/SimpleCli.java      |  128 -
 .../org/apache/blur/store/SimpleHDFSDirectory.java |  201 -
 .../org/apache/blur/thrift/AbstractCommand.java    |   30 -
 .../java/org/apache/blur/thrift/ClientManager.java |  336 -
 .../main/java/org/apache/blur/thrift/Command.java  |   24 -
 .../java/org/apache/blur/thrift/Connection.java    |  130 -
 .../apache/blur/thrift/generated/Attribute.java    |  524 -
 .../org/apache/blur/thrift/generated/Blur.java     | 7007 -----------
 .../blur/thrift/generated/BlurException.java       |  408 -
 .../apache/blur/thrift/generated/BlurShard.java    | 7105 -----------
 .../apache/blur/thrift/generated/BlurTuple.java    | 7007 -----------
 .../apache/blur/thrift/generated/DocLocation.java  |  403 -
 .../org/apache/blur/thrift/generated/Document.java |  357 -
 .../org/apache/blur/thrift/generated/Field.java    |  613 -
 .../org/apache/blur/thrift/generated/Lucene.java   | 9299 ---------------
 .../apache/blur/thrift/generated/QueryArgs.java    |  993 --
 .../apache/blur/thrift/generated/QuerySession.java |  409 -
 .../org/apache/blur/thrift/generated/Record.java   |  357 -
 .../org/apache/blur/thrift/generated/ScoreDoc.java |  537 -
 .../org/apache/blur/thrift/generated/Session.java  |  453 -
 .../org/apache/blur/thrift/generated/Sort.java     |  357 -
 .../apache/blur/thrift/generated/SortField.java    |  513 -
 .../org/apache/blur/thrift/generated/SortType.java |  116 -
 .../org/apache/blur/thrift/generated/TYPE.java     |   62 -
 .../org/apache/blur/thrift/generated/Term.java     |  419 -
 .../apache/blur/thrift/generated/TopFieldDocs.java |  657 -
 .../org/apache/blur/thrift/generated/Tuple.java    |  357 -
 src/blur-new-api-prototype/startServer.sh          |   17 -
 51 files changed, 0 insertions(+), 41738 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/generateThrift.sh
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/generateThrift.sh b/src/blur-new-api-prototype/generateThrift.sh
deleted file mode 100755
index 876625a..0000000
--- a/src/blur-new-api-prototype/generateThrift.sh
+++ /dev/null
@@ -1,17 +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.
-
-thrift -out src/main/java/ --gen java service.thrift

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/service.thrift
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/service.thrift b/src/blur-new-api-prototype/service.thrift
deleted file mode 100644
index 19a8731..0000000
--- a/src/blur-new-api-prototype/service.thrift
+++ /dev/null
@@ -1,182 +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.
- */
- 
-namespace java org.apache.blur.thrift.generated
-
-exception BlurException {
-  1:string message,
-  2:string stackTraceStr
-}
-
-enum TYPE {
-  STRING, BOOL, SHORT, INT, LONG, FLOAT, DOUBLE, BINARY
-}
-
-struct Attribute {
-  1:string name,
-  2:binary value,
-  3:TYPE type
-}
-
-struct Record {
-  1:list<Attribute> attributes
-}
-
-struct Session {
-  1:string sessionId,
-  2:map<string,string> properties
-}
-
-struct QuerySession {
-  1:Session session,
-  2:string queryId
-}
-
-service Blur {
-
-  Session openReadSession() throws (1:BlurException e)
-  QuerySession executeQuery(1:Session session, 2:string query) throws (1:BlurException e)
-  list<Record> nextMetaDataResults(1:QuerySession session, 2:i32 batchSize) throws (1:BlurException e)
-  list<Record> nextResults(1:QuerySession session, 2:i32 batchSize) throws (1:BlurException e)
-  void closeReadSession(1:Session session) throws (1:BlurException e)
-
-  Session openWriteSession(1:string table) throws (1:BlurException e)
-  void writeRecords(1:Session session, 2:list<Record> records) throws (1:BlurException e)
-  void commitWriteSession(1:Session session) throws (1:BlurException e)
-  void rollbackWriteSession(1:Session session) throws (1:BlurException e)
-  
-}
-
-enum SortType {
-    /** Sort by document score (relevance).  Sort values are Float and higher
-     * values are at the front. */
-    SCORE,
-
-    /** Sort by document number (index order).  Sort values are Integer and lower
-     * values are at the front. */
-    DOC,
-
-    /** Sort using term values as Strings.  Sort values are String and lower
-     * values are at the front. */
-    STRING,
-
-    /** Sort using term values as encoded Integers.  Sort values are Integer and
-     * lower values are at the front. */
-    INT,
-
-    /** Sort using term values as encoded Floats.  Sort values are Float and
-     * lower values are at the front. */
-    FLOAT,
-
-    /** Sort using term values as encoded Longs.  Sort values are Long and
-     * lower values are at the front. */
-    LONG,
-
-    /** Sort using term values as encoded Doubles.  Sort values are Double and
-     * lower values are at the front. */
-    DOUBLE,
-
-    /** Sort using term values as encoded Shorts.  Sort values are Short and
-     * lower values are at the front. */
-    SHORT,
-
-    /** Sort using term values as encoded Bytes.  Sort values are Byte and
-     * lower values are at the front. */
-    BYTE,
-
-    /** Sort using term values as Strings, but comparing by
-     * value (using String.compareTo) for all comparisons.
-     * This is typically slower than {@link #STRING}, which
-     * uses ordinals to do the sorting. */
-    STRING_VAL,
-
-    /** Sort use byte[] index values. */
-    BYTES,
-}
-
-struct SortField {
- 1:string field,
- 2:SortType type, 
- 3:bool reverse
-}
-
-struct Sort {
- 1:list<SortField> fields
-}
-
-struct DocLocation {
- 1:i32 doc,
- 2:i32 shardIndex
-}
-
-struct ScoreDoc {
- 1:double score,
- 2:DocLocation docLocation,
- 4:list<binary> fields
-}
-
-struct QueryArgs {
- 1:ScoreDoc after,
- 2:binary query,
- 3:binary filter,
- 4:i32 numberToFetch,
- 5:Sort sort,
- 6:bool doDocScores,
- 7:bool doMaxScore,
- 8:list<i32> shardIndexes
-}
-
-struct TopFieldDocs {
- 1:i64 totalHits,
- 2:list<ScoreDoc> scoreDocs,
- 3:double maxScore,
- 4:list<SortField> fields
-}
-
-struct Field {
-  1:string name,
-  2:binary value,
-  3:TYPE type,
-  4:double boost
-}
-
-struct Document {
- 1:list<Field> fields
-}
-
-struct Term {
-  1:string field,
-  2:binary bytes
-}
-
-service Lucene {
-
-  Session openReadSession(1:string table) throws (1:BlurException e)
-  TopFieldDocs search(1:Session session, 2:QueryArgs queryArgs) throws (1:BlurException e)
-  list<Document> doc(1:Session session, 2:list<DocLocation> docLocations, 4:set<string> fields) throws (1:BlurException e)
-  void closeReadSession(1:Session session) throws (1:BlurException e)
-  
-  Session openWriteSession(1:string table) throws (1:BlurException e)
-  void addDocuments(1:Session session, 2:i32 shardIndex, 3:list<Document> document) throws (1:BlurException e)
-  void deleteDocumentsByQueries(1:Session session, 2:i32 shardIndex, 3:list<QueryArgs> queries) throws (1:BlurException e)
-  void deleteDocuments(1:Session session, 2:i32 shardIndex, 3:list<Term> terms) throws (1:BlurException e)
-  void updateDocuments(1:Session session, 2:i32 shardIndex, 3:list<Term> terms, 4:list<Document> document) throws (1:BlurException e)
-  
-  void commit(1:Session session) throws (1:BlurException e)
-  void rollback(1:Session session) throws (1:BlurException e)
-  
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCache.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCache.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCache.java
deleted file mode 100644
index 2a3beea..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCache.java
+++ /dev/null
@@ -1,178 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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.nio.ByteBuffer;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
-import com.googlecode.concurrentlinkedhashmap.EvictionListener;
-
-public class BlockCache {
-
-  public static final int _128M = 134217728;
-  public static final int _8K = 8192;
-  private final ConcurrentMap<BlockCacheKey, BlockCacheLocation> _cache;
-  private final ByteBuffer[] _slabs;
-  private final BlockLocks[] _locks;
-  private final AtomicInteger[] _lockCounters;
-  private final int _blockSize = _8K;
-  private final int _numberOfBlocksPerSlab;
-  private final int _maxEntries;
-
-  public BlockCache(boolean directAllocation, long totalMemory) {
-    this(directAllocation, totalMemory, _128M);
-  }
-
-  public BlockCache(boolean directAllocation, long totalMemory, int slabSize) {
-    _numberOfBlocksPerSlab = slabSize / _blockSize;
-    int numberOfSlabs = (int) (totalMemory / slabSize);
-
-    _slabs = new ByteBuffer[numberOfSlabs];
-    _locks = new BlockLocks[numberOfSlabs];
-    _lockCounters = new AtomicInteger[numberOfSlabs];
-    _maxEntries = (_numberOfBlocksPerSlab * numberOfSlabs) - 1;
-    for (int i = 0; i < numberOfSlabs; i++) {
-      if (directAllocation) {
-        _slabs[i] = ByteBuffer.allocateDirect(_numberOfBlocksPerSlab * _blockSize);
-      } else {
-        _slabs[i] = ByteBuffer.allocate(_numberOfBlocksPerSlab * _blockSize);
-      }
-      _locks[i] = new BlockLocks(_numberOfBlocksPerSlab);
-      _lockCounters[i] = new AtomicInteger();
-    }
-
-    EvictionListener<BlockCacheKey, BlockCacheLocation> listener = new EvictionListener<BlockCacheKey, BlockCacheLocation>() {
-      @Override
-      public void onEviction(BlockCacheKey key, BlockCacheLocation location) {
-        releaseLocation(location);
-      }
-    };
-    _cache = new ConcurrentLinkedHashMap.Builder<BlockCacheKey, BlockCacheLocation>().maximumWeightedCapacity(_maxEntries).listener(listener).build();
-  }
-
-  private void releaseLocation(BlockCacheLocation location) {
-    if (location == null) {
-      return;
-    }
-    int slabId = location.getSlabId();
-    int block = location.getBlock();
-    location.setRemoved(true);
-    _locks[slabId].clear(block);
-    _lockCounters[slabId].decrementAndGet();
-  }
-
-  public boolean store(BlockCacheKey blockCacheKey, byte[] data) {
-    checkLength(data);
-    BlockCacheLocation location = _cache.get(blockCacheKey);
-    boolean newLocation = false;
-    if (location == null) {
-      newLocation = true;
-      location = new BlockCacheLocation();
-      if (!findEmptyLocation(location)) {
-        return false;
-      }
-    }
-    if (location.isRemoved()) {
-      return false;
-    }
-    int slabId = location.getSlabId();
-    int offset = location.getBlock() * _blockSize;
-    ByteBuffer slab = getSlab(slabId);
-    slab.position(offset);
-    slab.put(data, 0, _blockSize);
-    if (newLocation) {
-      releaseLocation(_cache.put(blockCacheKey.clone(), location));
-    }
-    return true;
-  }
-
-  public boolean fetch(BlockCacheKey blockCacheKey, byte[] buffer, int blockOffset, int off, int length) {
-    BlockCacheLocation location = _cache.get(blockCacheKey);
-    if (location == null) {
-      return false;
-    }
-    if (location.isRemoved()) {
-      return false;
-    }
-    int slabId = location.getSlabId();
-    int offset = location.getBlock() * _blockSize;
-    location.touch();
-    ByteBuffer slab = getSlab(slabId);
-    slab.position(offset + blockOffset);
-    slab.get(buffer, off, length);
-    return true;
-  }
-
-  public boolean fetch(BlockCacheKey blockCacheKey, byte[] buffer) {
-    checkLength(buffer);
-    return fetch(blockCacheKey, buffer, 0, 0, _blockSize);
-  }
-
-  private boolean findEmptyLocation(BlockCacheLocation location) {
-    // This is a tight loop that will try and find a location to
-    // place the block before giving up
-    for (int j = 0; j < 10; j++) {
-      OUTER: for (int slabId = 0; slabId < _slabs.length; slabId++) {
-        AtomicInteger bitSetCounter = _lockCounters[slabId];
-        BlockLocks bitSet = _locks[slabId];
-        if (bitSetCounter.get() == _numberOfBlocksPerSlab) {
-          // if bitset is full
-          continue OUTER;
-        }
-        // this check needs to spin, if a lock was attempted but not obtained
-        // the rest of the slab should not be skipped
-        int bit = bitSet.nextClearBit(0);
-        INNER: while (bit != -1) {
-          if (bit >= _numberOfBlocksPerSlab) {
-            // bit set is full
-            continue OUTER;
-          }
-          if (!bitSet.set(bit)) {
-            // lock was not obtained
-            // this restarts at 0 because another block could have been unlocked
-            // while this was executing
-            bit = bitSet.nextClearBit(0);
-            continue INNER;
-          } else {
-            // lock obtained
-            location.setSlabId(slabId);
-            location.setBlock(bit);
-            bitSetCounter.incrementAndGet();
-            return true;
-          }
-        }
-      }
-    }
-    return false;
-  }
-
-  private void checkLength(byte[] buffer) {
-    if (buffer.length != _blockSize) {
-      throw new RuntimeException("Buffer wrong size, expecting [" + _blockSize + "] got [" + buffer.length + "]");
-    }
-  }
-
-  private ByteBuffer getSlab(int slabId) {
-    return _slabs[slabId].duplicate();
-  }
-
-  public int getSize() {
-    return _cache.size();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheKey.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheKey.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheKey.java
deleted file mode 100644
index d8adb32..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheKey.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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 BlockCacheKey implements Cloneable {
-
-  private long _block;
-  private int _file;
-
-  public long getBlock() {
-    return _block;
-  }
-
-  public int getFile() {
-    return _file;
-  }
-
-  public void setBlock(long block) {
-    _block = block;
-  }
-
-  public void setFile(int file) {
-    _file = file;
-  }
-
-  @Override
-  public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + (int) (_block ^ (_block >>> 32));
-    result = prime * result + _file;
-    return result;
-  }
-
-  @Override
-  public boolean equals(Object obj) {
-    if (this == obj)
-      return true;
-    if (obj == null)
-      return false;
-    if (getClass() != obj.getClass())
-      return false;
-    BlockCacheKey other = (BlockCacheKey) obj;
-    if (_block != other._block)
-      return false;
-    if (_file != other._file)
-      return false;
-    return true;
-  }
-
-  @Override
-  public BlockCacheKey clone() {
-    try {
-      return (BlockCacheKey) super.clone();
-    } catch (CloneNotSupportedException e) {
-      throw new RuntimeException(e);
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheLocation.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheLocation.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheLocation.java
deleted file mode 100644
index cc00872..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockCacheLocation.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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.util.concurrent.atomic.AtomicBoolean;
-
-public class BlockCacheLocation {
-
-  private int _block;
-  private int _slabId;
-  private long _lastAccess = System.currentTimeMillis();
-  private long _accesses;
-  private AtomicBoolean _removed = new AtomicBoolean(false);
-
-  public void setBlock(int block) {
-    _block = block;
-  }
-
-  public void setSlabId(int slabId) {
-    _slabId = slabId;
-  }
-
-  public int getBlock() {
-    return _block;
-  }
-
-  public int getSlabId() {
-    return _slabId;
-  }
-
-  public void touch() {
-    _lastAccess = System.currentTimeMillis();
-    _accesses++;
-  }
-
-  public long getLastAccess() {
-    return _lastAccess;
-  }
-
-  public long getNumberOfAccesses() {
-    return _accesses;
-  }
-
-  public boolean isRemoved() {
-    return _removed.get();
-  }
-
-  public void setRemoved(boolean removed) {
-    _removed.set(removed);
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectory.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectory.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectory.java
deleted file mode 100644
index 6231d99..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectory.java
+++ /dev/null
@@ -1,295 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Set;
-
-import org.apache.blur.store.SimpleHDFSDirectory;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.store.IOContext;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.store.Lock;
-import org.apache.lucene.store.LockFactory;
-
-public class BlockDirectory extends Directory {
-
-  public static final long BLOCK_SHIFT = 13; // 2^13 = 8,192 bytes per block
-  public static final long BLOCK_MOD = 0x1FFF;
-  public static final int BLOCK_SIZE = 1 << BLOCK_SHIFT;
-
-  public static long getBlock(long pos) {
-    return pos >>> BLOCK_SHIFT;
-  }
-
-  public static long getPosition(long pos) {
-    return pos & BLOCK_MOD;
-  }
-
-  public static long getRealPosition(long block, long positionInBlock) {
-    return (block << BLOCK_SHIFT) + positionInBlock;
-  }
-
-  public static Cache NO_CACHE = new Cache() {
-
-    @Override
-    public void update(String name, long blockId, byte[] buffer) {
-
-    }
-
-    @Override
-    public boolean fetch(String name, long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock) {
-      return false;
-    }
-
-    @Override
-    public void delete(String name) {
-
-    }
-
-    @Override
-    public long size() {
-      return 0;
-    }
-  };
-
-  private Directory _directory;
-  private int _blockSize;
-  private String _dirName;
-  private Cache _cache;
-  private Set<String> _blockCacheFileTypes;
-
-  public BlockDirectory(String dirName, Directory directory) throws IOException {
-    this(dirName, directory, NO_CACHE);
-  }
-
-  public BlockDirectory(String dirName, Directory directory, Cache cache) throws IOException {
-    this(dirName, directory, cache, null);
-  }
-
-  public BlockDirectory(String dirName, Directory directory, Cache cache, Set<String> blockCacheFileTypes) throws IOException {
-    _dirName = dirName;
-    _directory = directory;
-    _blockSize = BLOCK_SIZE;
-    _cache = cache;
-    if (blockCacheFileTypes == null || blockCacheFileTypes.isEmpty()) {
-      _blockCacheFileTypes = null;
-    } else {
-      _blockCacheFileTypes = blockCacheFileTypes;
-    }
-    setLockFactory(directory.getLockFactory());
-  }
-
-  private boolean isCachableFile(String name) {
-    for (String ext : _blockCacheFileTypes) {
-      if (name.endsWith(ext)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  @Override
-  public IndexInput openInput(final String name, IOContext context) throws IOException {
-    final IndexInput source = _directory.openInput(name, context);
-    if (_blockCacheFileTypes == null || isCachableFile(name)) {
-      return new CachedIndexInput(source, _blockSize, name, getFileCacheName(name), _cache, context);
-    }
-    return source;
-  }
-
-  static class CachedIndexInput extends ReusedBufferedIndexInput {
-
-    private IndexInput _source;
-    private int _blockSize;
-    private long _fileLength;
-    private String _cacheName;
-    private Cache _cache;
-
-    public CachedIndexInput(IndexInput source, int blockSize, String name, String cacheName, Cache cache, IOContext context) {
-      super(name, context);
-      _source = source;
-      _blockSize = blockSize;
-      _fileLength = source.length();
-      _cacheName = cacheName;
-      _cache = cache;
-    }
-
-    @Override
-    public CachedIndexInput clone() {
-      CachedIndexInput clone = (CachedIndexInput) super.clone();
-      clone._source = (IndexInput) _source.clone();
-      return clone;
-    }
-
-    @Override
-    public long length() {
-      return _source.length();
-    }
-
-    @Override
-    protected void seekInternal(long pos) throws IOException {
-    }
-
-    @Override
-    protected void readInternal(byte[] b, int off, int len) throws IOException {
-      long position = getFilePointer();
-      while (len > 0) {
-        int length = fetchBlock(position, b, off, len);
-        position += length;
-        len -= length;
-        off += length;
-      }
-    }
-
-    private int fetchBlock(long position, byte[] b, int off, int len) throws IOException {
-      // read whole block into cache and then provide needed data
-      long blockId = getBlock(position);
-      int blockOffset = (int) getPosition(position);
-      int lengthToReadInBlock = Math.min(len, _blockSize - blockOffset);
-      if (checkCache(blockId, blockOffset, b, off, lengthToReadInBlock)) {
-        return lengthToReadInBlock;
-      } else {
-        readIntoCacheAndResult(blockId, blockOffset, b, off, lengthToReadInBlock);
-      }
-      return lengthToReadInBlock;
-    }
-
-    private void readIntoCacheAndResult(long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock) throws IOException {
-      long position = getRealPosition(blockId, 0);
-      int length = (int) Math.min(_blockSize, _fileLength - position);
-      _source.seek(position);
-
-      byte[] buf = BufferStore.takeBuffer(_blockSize);
-      _source.readBytes(buf, 0, length);
-      System.arraycopy(buf, blockOffset, b, off, lengthToReadInBlock);
-      _cache.update(_cacheName, blockId, buf);
-      BufferStore.putBuffer(buf);
-    }
-
-    private boolean checkCache(long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock) {
-      return _cache.fetch(_cacheName, blockId, blockOffset, b, off, lengthToReadInBlock);
-    }
-
-    @Override
-    protected void closeInternal() throws IOException {
-      _source.close();
-    }
-  }
-
-  @Override
-  public void close() throws IOException {
-    String[] files = listAll();
-    for (String file : files) {
-      _cache.delete(getFileCacheName(file));
-    }
-    _directory.close();
-  }
-
-  private String getFileCacheName(String name) throws IOException {
-    return _dirName + "/" + name + ":" + getFileModified(name);
-  }
-
-  private long getFileModified(String name) throws IOException {
-    if (_directory instanceof FSDirectory) {
-      File directory = ((FSDirectory) _directory).getDirectory();
-      File file = new File(directory,name);
-      if (!file.exists()) {
-        throw new FileNotFoundException("File [" + name + "] not found");
-      }
-      return file.lastModified();
-    } else if (_directory instanceof SimpleHDFSDirectory) {
-      return ((SimpleHDFSDirectory) _directory).getFileModified(name);
-    } else {
-      throw new RuntimeException("Not supported");
-    }
-  }
-
-  public void clearLock(String name) throws IOException {
-    _directory.clearLock(name);
-  }
-
-  @Override
-  public void copy(Directory to, String src, String dest, IOContext context) throws IOException {
-    _directory.copy(to, src, dest, context);
-  }
-
-  @Override
-  public LockFactory getLockFactory() {
-    return _directory.getLockFactory();
-  }
-
-  @Override
-  public String getLockID() {
-    return _directory.getLockID();
-  }
-
-  @Override
-  public Lock makeLock(String name) {
-    return _directory.makeLock(name);
-  }
-
-  @Override
-  public void setLockFactory(LockFactory lockFactory) throws IOException {
-    _directory.setLockFactory(lockFactory);
-  }
-
-  @Override
-  public void sync(Collection<String> names) throws IOException {
-    _directory.sync(names);
-  }
-
-  public String toString() {
-    return _directory.toString();
-  }
-
-  @Override
-  public IndexOutput createOutput(String name, IOContext context) throws IOException {
-    return _directory.createOutput(name, context);
-  }
-
-  @Override
-  public void deleteFile(String name) throws IOException {
-    _cache.delete(getFileCacheName(name));
-    _directory.deleteFile(name);
-  }
-
-  @Override
-  public boolean fileExists(String name) throws IOException {
-    return _directory.fileExists(name);
-  }
-
-  @Override
-  public long fileLength(String name) throws IOException {
-    return _directory.fileLength(name);
-  }
-
-  @Override
-  public String[] listAll() throws IOException {
-    return _directory.listAll();
-  }
-
-  public Directory getDirectory() {
-    return _directory;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectoryCache.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectoryCache.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectoryCache.java
deleted file mode 100644
index fe1c5b4..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockDirectoryCache.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-
-public class BlockDirectoryCache implements Cache {
-  private BlockCache _blockCache;
-  private AtomicInteger _counter = new AtomicInteger();
-  private Map<String, Integer> _names = new ConcurrentHashMap<String, Integer>();
-
-  public BlockDirectoryCache(BlockCache blockCache) {
-    _blockCache = blockCache;
-  }
-
-  @Override
-  public void delete(String name) {
-    _names.remove(name);
-  }
-
-  @Override
-  public void update(String name, long blockId, byte[] buffer) {
-    Integer file = _names.get(name);
-    if (file == null) {
-      file = _counter.incrementAndGet();
-      _names.put(name, file);
-    }
-    BlockCacheKey blockCacheKey = new BlockCacheKey();
-    blockCacheKey.setBlock(blockId);
-    blockCacheKey.setFile(file);
-    _blockCache.store(blockCacheKey, buffer);
-  }
-
-  @Override
-  public boolean fetch(String name, long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock) {
-    Integer file = _names.get(name);
-    if (file == null) {
-      return false;
-    }
-    BlockCacheKey blockCacheKey = new BlockCacheKey();
-    blockCacheKey.setBlock(blockId);
-    blockCacheKey.setFile(file);
-    boolean fetch = _blockCache.fetch(blockCacheKey, b, blockOffset, off, lengthToReadInBlock);
-    return fetch;
-  }
-
-  @Override
-  public long size() {
-    return _blockCache.getSize();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockLocks.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockLocks.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockLocks.java
deleted file mode 100644
index f097891..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BlockLocks.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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.util.concurrent.atomic.AtomicLongArray;
-
-import org.apache.lucene.util.BitUtil;
-import org.apache.lucene.util.OpenBitSet;
-
-public class BlockLocks {
-
-  private AtomicLongArray bits;
-  private int wlen;
-
-  public BlockLocks(long numBits) {
-    int length = OpenBitSet.bits2words(numBits);
-    bits = new AtomicLongArray(length);
-    wlen = length;
-  }
-
-  /**
-   * Find the next clear bit in the bit set.
-   * 
-   * @param index
-   * @return
-   */
-  public int nextClearBit(int index) {
-    int i = index >> 6;
-    if (i >= wlen)
-      return -1;
-    int subIndex = index & 0x3f; // index within the word
-    long word = ~bits.get(i) >> subIndex; // skip all the bits to the right of
-                                          // index
-    if (word != 0) {
-      return (i << 6) + subIndex + BitUtil.ntz(word);
-    }
-    while (++i < wlen) {
-      word = ~bits.get(i);
-      if (word != 0) {
-        return (i << 6) + BitUtil.ntz(word);
-      }
-    }
-    return -1;
-  }
-
-  /**
-   * Thread safe set operation that will set the bit if and only if the bit was
-   * not previously set.
-   * 
-   * @param index
-   *          the index position to set.
-   * @return returns true if the bit was set and false if it was already set.
-   */
-  public boolean set(int index) {
-    int wordNum = index >> 6; // div 64
-    int bit = index & 0x3f; // mod 64
-    long bitmask = 1L << bit;
-    long word, oword;
-    do {
-      word = bits.get(wordNum);
-      // if set another thread stole the lock
-      if ((word & bitmask) != 0) {
-        return false;
-      }
-      oword = word;
-      word |= bitmask;
-    } while (!bits.compareAndSet(wordNum, oword, word));
-    return true;
-  }
-
-  public void clear(int index) {
-    int wordNum = index >> 6;
-    int bit = index & 0x03f;
-    long bitmask = 1L << bit;
-    long word, oword;
-    do {
-      word = bits.get(wordNum);
-      oword = word;
-      word &= ~bitmask;
-    } while (!bits.compareAndSet(wordNum, oword, word));
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BufferStore.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BufferStore.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BufferStore.java
deleted file mode 100644
index eb47740..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/BufferStore.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class BufferStore {
-
-  private static final Log LOG = LogFactory.getLog(BufferStore.class);
-
-  private static BlockingQueue<byte[]> _1024 = setupBuffers(1024, 1);
-  private static BlockingQueue<byte[]> _8192 = setupBuffers(8192, 1);
-
-  public static void init() {
-    int _1024Size = 8192;
-    int _8192Size = 8192;
-    LOG.info("Initializing the 1024 buffers with [" + _1024Size + "] buffers.");
-    _1024 = setupBuffers(1024, _1024Size);
-    LOG.info("Initializing the 8192 buffers with [" + _8192Size + "] buffers.");
-    _8192 = setupBuffers(8192, _8192Size);
-  }
-
-  private static BlockingQueue<byte[]> setupBuffers(int bufferSize, int count) {
-    BlockingQueue<byte[]> queue = new ArrayBlockingQueue<byte[]>(count);
-    for (int i = 0; i < count; i++) {
-      queue.add(new byte[bufferSize]);
-    }
-    return queue;
-  }
-
-  public static byte[] takeBuffer(int bufferSize) {
-    switch (bufferSize) {
-    case 1024:
-      return newBuffer1024(_1024.poll());
-    case 8192:
-      return newBuffer8192(_8192.poll());
-    default:
-      return newBuffer(bufferSize);
-    }
-  }
-
-  public static void putBuffer(byte[] buffer) {
-    if (buffer == null) {
-      return;
-    }
-    int bufferSize = buffer.length;
-    switch (bufferSize) {
-    case 1024:
-      checkReturn(_1024.offer(buffer));
-      return;
-    case 8192:
-      checkReturn(_8192.offer(buffer));
-      return;
-    }
-  }
-
-  private static void checkReturn(boolean offer) {
-
-  }
-
-  private static byte[] newBuffer1024(byte[] buf) {
-    if (buf != null) {
-      return buf;
-    }
-    return new byte[1024];
-  }
-
-  private static byte[] newBuffer8192(byte[] buf) {
-    if (buf != null) {
-      return buf;
-    }
-    return new byte[8192];
-  }
-
-  private static byte[] newBuffer(int size) {
-    return new byte[size];
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/Cache.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/Cache.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/Cache.java
deleted file mode 100644
index 0037129..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/Cache.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.blur.cache;
-
-/**
- * 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 Cache {
-
-  void delete(String name);
-
-  void update(String name, long blockId, byte[] buffer);
-
-  boolean fetch(String name, long blockId, int blockOffset, byte[] b, int off, int lengthToReadInBlock);
-
-  long size();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/ReusedBufferedIndexInput.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/ReusedBufferedIndexInput.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/ReusedBufferedIndexInput.java
deleted file mode 100644
index b90634b..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/cache/ReusedBufferedIndexInput.java
+++ /dev/null
@@ -1,349 +0,0 @@
-package org.apache.blur.cache;
-
-/*
- * 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.EOFException;
-import java.io.IOException;
-
-import org.apache.lucene.store.IOContext;
-import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.store.IndexOutput;
-
-/** Base implementation class for buffered {@link IndexInput}. */
-public abstract class ReusedBufferedIndexInput extends IndexInput {
-
-  public static final int BUFFER_SIZE = 1024;
-  public static final int MERGE_BUFFER_SIZE = 8192;
-  private int bufferSize = BUFFER_SIZE;
-
-  protected byte[] buffer;
-
-  private long bufferStart = 0; // position in file of buffer
-  private int bufferLength = 0; // end of valid bytes
-  private int bufferPosition = 0; // next byte to read
-
-  @Override
-  public final byte readByte() throws IOException {
-    if (bufferPosition >= bufferLength)
-      refill();
-    return buffer[bufferPosition++];
-  }
-
-  public ReusedBufferedIndexInput(String resourceDesc) {
-    this(resourceDesc, BUFFER_SIZE);
-  }
-
-  public ReusedBufferedIndexInput(String resourceDesc, IOContext context) {
-    this(resourceDesc, bufferSize(context));
-  }
-
-  /** Inits BufferedIndexInput with a specific bufferSize */
-  public ReusedBufferedIndexInput(String resourceDesc, int bufferSize) {
-    super(resourceDesc);
-    checkBufferSize(bufferSize);
-    this.bufferSize = bufferSize;
-  }
-
-  /** Returns buffer size. @see #setBufferSize */
-  public final int getBufferSize() {
-    return bufferSize;
-  }
-
-  private void checkBufferSize(int bufferSize) {
-    if (bufferSize <= 0)
-      throw new IllegalArgumentException("bufferSize must be greater than 0 (got " + bufferSize + ")");
-  }
-
-  @Override
-  public final void readBytes(byte[] b, int offset, int len) throws IOException {
-    readBytes(b, offset, len, true);
-  }
-
-  @Override
-  public final void readBytes(byte[] b, int offset, int len, boolean useBuffer) throws IOException {
-
-    if (len <= (bufferLength - bufferPosition)) {
-      // the buffer contains enough data to satisfy this request
-      if (len > 0) // to allow b to be null if len is 0...
-        System.arraycopy(buffer, bufferPosition, b, offset, len);
-      bufferPosition += len;
-    } else {
-      // the buffer does not have enough data. First serve all we've got.
-      int available = bufferLength - bufferPosition;
-      if (available > 0) {
-        System.arraycopy(buffer, bufferPosition, b, offset, available);
-        offset += available;
-        len -= available;
-        bufferPosition += available;
-      }
-      // and now, read the remaining 'len' bytes:
-      if (useBuffer && len < bufferSize) {
-        // If the amount left to read is small enough, and
-        // we are allowed to use our buffer, do it in the usual
-        // buffered way: fill the buffer and copy from it:
-        refill();
-        if (bufferLength < len) {
-          // Throw an exception when refill() could not read len bytes:
-          System.arraycopy(buffer, 0, b, offset, bufferLength);
-          throw new EOFException("read past EOF: " + this);
-        } else {
-          System.arraycopy(buffer, 0, b, offset, len);
-          bufferPosition = len;
-        }
-      } else {
-        // The amount left to read is larger than the buffer
-        // or we've been asked to not use our buffer -
-        // there's no performance reason not to read it all
-        // at once. Note that unlike the previous code of
-        // this function, there is no need to do a seek
-        // here, because there's no need to reread what we
-        // had in the buffer.
-        long after = bufferStart + bufferPosition + len;
-        if (after > length())
-          throw new EOFException("read past EOF: " + this);
-        readInternal(b, offset, len);
-        bufferStart = after;
-        bufferPosition = 0;
-        bufferLength = 0; // trigger refill() on read
-      }
-    }
-  }
-
-  @Override
-  public final short readShort() throws IOException {
-    if (2 <= (bufferLength - bufferPosition)) {
-      return (short) (((buffer[bufferPosition++] & 0xFF) << 8) | (buffer[bufferPosition++] & 0xFF));
-    } else {
-      return super.readShort();
-    }
-  }
-
-  @Override
-  public final int readInt() throws IOException {
-    if (4 <= (bufferLength - bufferPosition)) {
-      return ((buffer[bufferPosition++] & 0xFF) << 24) | ((buffer[bufferPosition++] & 0xFF) << 16) | ((buffer[bufferPosition++] & 0xFF) << 8) | (buffer[bufferPosition++] & 0xFF);
-    } else {
-      return super.readInt();
-    }
-  }
-
-  @Override
-  public final long readLong() throws IOException {
-    if (8 <= (bufferLength - bufferPosition)) {
-      final int i1 = ((buffer[bufferPosition++] & 0xff) << 24) | ((buffer[bufferPosition++] & 0xff) << 16) | ((buffer[bufferPosition++] & 0xff) << 8)
-          | (buffer[bufferPosition++] & 0xff);
-      final int i2 = ((buffer[bufferPosition++] & 0xff) << 24) | ((buffer[bufferPosition++] & 0xff) << 16) | ((buffer[bufferPosition++] & 0xff) << 8)
-          | (buffer[bufferPosition++] & 0xff);
-      return (((long) i1) << 32) | (i2 & 0xFFFFFFFFL);
-    } else {
-      return super.readLong();
-    }
-  }
-
-  @Override
-  public final int readVInt() throws IOException {
-    if (5 <= (bufferLength - bufferPosition)) {
-      byte b = buffer[bufferPosition++];
-      if (b >= 0)
-        return b;
-      int i = b & 0x7F;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7F) << 7;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7F) << 14;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7F) << 21;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      // Warning: the next ands use 0x0F / 0xF0 - beware copy/paste errors:
-      i |= (b & 0x0F) << 28;
-      if ((b & 0xF0) == 0)
-        return i;
-      throw new IOException("Invalid vInt detected (too many bits)");
-    } else {
-      return super.readVInt();
-    }
-  }
-
-  @Override
-  public final long readVLong() throws IOException {
-    if (9 <= bufferLength - bufferPosition) {
-      byte b = buffer[bufferPosition++];
-      if (b >= 0)
-        return b;
-      long i = b & 0x7FL;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 7;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 14;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 21;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 28;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 35;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 42;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 49;
-      if (b >= 0)
-        return i;
-      b = buffer[bufferPosition++];
-      i |= (b & 0x7FL) << 56;
-      if (b >= 0)
-        return i;
-      throw new IOException("Invalid vLong detected (negative values disallowed)");
-    } else {
-      return super.readVLong();
-    }
-  }
-
-  private void refill() throws IOException {
-    long start = bufferStart + bufferPosition;
-    long end = start + bufferSize;
-    if (end > length()) // don't read past EOF
-      end = length();
-    int newLength = (int) (end - start);
-    if (newLength <= 0)
-      throw new EOFException("read past EOF: " + this);
-
-    if (buffer == null) {
-      buffer = BufferStore.takeBuffer(bufferSize);
-      seekInternal(bufferStart);
-    }
-    readInternal(buffer, 0, newLength);
-    bufferLength = newLength;
-    bufferStart = start;
-    bufferPosition = 0;
-  }
-
-  /**
-   * Expert: implements buffer refill. Reads bytes from the current position in
-   * the input.
-   * 
-   * @param b
-   *          the array to read bytes into
-   * @param offset
-   *          the offset in the array to start storing bytes
-   * @param length
-   *          the number of bytes to read
-   */
-  protected abstract void readInternal(byte[] b, int offset, int length) throws IOException;
-
-  @Override
-  public final long getFilePointer() {
-    return bufferStart + bufferPosition;
-  }
-
-  @Override
-  public final void seek(long pos) throws IOException {
-    if (pos >= bufferStart && pos < (bufferStart + bufferLength))
-      bufferPosition = (int) (pos - bufferStart); // seek within buffer
-    else {
-      bufferStart = pos;
-      bufferPosition = 0;
-      bufferLength = 0; // trigger refill() on read()
-      seekInternal(pos);
-    }
-  }
-
-  /**
-   * Expert: implements seek. Sets current position in this file, where the next
-   * {@link #readInternal(byte[],int,int)} will occur.
-   * 
-   * @see #readInternal(byte[],int,int)
-   */
-  protected abstract void seekInternal(long pos) throws IOException;
-
-  @Override
-  public ReusedBufferedIndexInput clone() {
-    ReusedBufferedIndexInput clone = (ReusedBufferedIndexInput) super.clone();
-
-    clone.buffer = null;
-    clone.bufferLength = 0;
-    clone.bufferPosition = 0;
-    clone.bufferStart = getFilePointer();
-
-    return clone;
-  }
-
-  /**
-   * Flushes the in-memory bufer to the given output, copying at most
-   * <code>numBytes</code>.
-   * <p>
-   * <b>NOTE:</b> this method does not refill the buffer, however it does
-   * advance the buffer position.
-   * 
-   * @return the number of bytes actually flushed from the in-memory buffer.
-   */
-  protected final int flushBuffer(IndexOutput out, long numBytes) throws IOException {
-    int toCopy = bufferLength - bufferPosition;
-    if (toCopy > numBytes) {
-      toCopy = (int) numBytes;
-    }
-    if (toCopy > 0) {
-      out.writeBytes(buffer, bufferPosition, toCopy);
-      bufferPosition += toCopy;
-    }
-    return toCopy;
-  }
-
-  /**
-   * Returns default buffer sizes for the given {@link IOContext}
-   */
-  public static int bufferSize(IOContext context) {
-    switch (context.context) {
-    case DEFAULT:
-    case FLUSH:
-    case READ:
-      return BUFFER_SIZE;
-    case MERGE:
-      return MERGE_BUFFER_SIZE;
-    default:
-      assert false : "unknown IOContext " + context.context;
-      return BUFFER_SIZE;
-    }
-  }
-
-  @Override
-  public final void close() throws IOException {
-    closeInternal();
-    BufferStore.putBuffer(buffer);
-    buffer = null;
-  }
-
-  protected abstract void closeInternal() throws IOException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerFile.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerFile.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerFile.java
deleted file mode 100644
index 5d90f7c..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerFile.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.apache.blur.core;
-
-/**
- * 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 java.net.InetSocketAddress;
-
-import org.apache.blur.thrift.generated.BlurTuple.Iface;
-import org.apache.blur.thrift.generated.BlurTuple.Processor;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.server.TThreadPoolServer.Args;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TTransportException;
-
-public class ServerFile {
-
-
-  public static void main(String[] argsStr) throws TTransportException, IOException {
-    Configuration conf = new Configuration();
-    ServerHdfs server = new ServerHdfs(conf, new Path(argsStr[0]), true);
-    Processor<Iface> processor = new Processor<Iface>(server);
-    Args args = new Args(new TServerSocket(new InetSocketAddress("127.0.0.1", 9000)));
-    args.minWorkerThreads(50);
-    args.maxWorkerThreads(50);
-    args.processor(processor);
-    args.transportFactory(new TFramedTransport.Factory());
-    args.protocolFactory(new TBinaryProtocol.Factory(true, true));
-
-    TThreadPoolServer tserver = new TThreadPoolServer(args);
-    tserver.serve();
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
deleted file mode 100644
index a7eb11f..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/ServerHdfs.java
+++ /dev/null
@@ -1,369 +0,0 @@
-package org.apache.blur.core;
-
-/**
- * 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.File;
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.net.InetSocketAddress;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.blur.cache.BlockCache;
-import org.apache.blur.cache.BlockDirectory;
-import org.apache.blur.cache.BlockDirectoryCache;
-import org.apache.blur.cache.BufferStore;
-import org.apache.blur.core.sessions.ReadSession;
-import org.apache.blur.core.sessions.RunningQuerySession;
-import org.apache.blur.core.sessions.WriteSession;
-import org.apache.blur.core.sessions.WriteSessionThreadedFile;
-import org.apache.blur.core.sessions.WriteSessionThreadedPath;
-import org.apache.blur.parser.BqlParser;
-import org.apache.blur.store.SimpleHDFSDirectory;
-import org.apache.blur.thrift.generated.Attribute;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.BlurTuple.Iface;
-import org.apache.blur.thrift.generated.BlurTuple.Processor;
-import org.apache.blur.thrift.generated.QuerySession;
-import org.apache.blur.thrift.generated.Session;
-import org.apache.blur.thrift.generated.Tuple;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.core.KeywordAnalyzer;
-import org.apache.lucene.codecs.appending.AppendingCodec;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.index.DirectoryReader;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
-import org.apache.lucene.index.TieredMergePolicy;
-import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.util.Version;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.server.TThreadPoolServer.Args;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TTransportException;
-
-public class ServerHdfs implements Iface {
-
-  private static final Log LOG = LogFactory.getLog(ServerHdfs.class);
-
-  private static final String XX_MAX_DIRECT_MEMORY_SIZE = "-XX:MaxDirectMemorySize=";
-  private static final int MIN_SLABSIZE = 33554432;
-  private static final int MAX_SLABSIZE = 134217728;
-
-  private static final long KILO = 1024;
-  private static final long MEG = KILO * 1024;
-  private static final long GIG = MEG * 1024;
-
-  public static void main(String[] argsStr) throws TTransportException, IOException {
-    Configuration conf = new Configuration();
-    ServerHdfs server = new ServerHdfs(conf, new Path(argsStr[0]), false);
-    Processor<Iface> processor = new Processor<Iface>(server);
-    Args args = new Args(new TServerSocket(new InetSocketAddress("127.0.0.1", 9000)));
-    args.minWorkerThreads(50);
-    args.maxWorkerThreads(50);
-    args.processor(processor);
-    args.transportFactory(new TFramedTransport.Factory());
-    args.protocolFactory(new TBinaryProtocol.Factory(true, true));
-
-    TThreadPoolServer tserver = new TThreadPoolServer(args);
-    tserver.serve();
-  }
-
-  private Map<String, ReadSession> readSessions = new ConcurrentHashMap<String, ReadSession>();
-  private Map<String, WriteSession> writeSessions = new ConcurrentHashMap<String, WriteSession>();
-  private Map<String, IndexWriter> tables = new ConcurrentHashMap<String, IndexWriter>();
-  private Path path;
-  private Configuration configuration;
-  private Analyzer analyzer = new KeywordAnalyzer();
-  private boolean nativeDirectory;
-
-  public ServerHdfs(Configuration configuration, Path p, boolean nativeDirectory) throws IOException {
-    this.configuration = configuration;
-    this.nativeDirectory = nativeDirectory;
-    FileSystem fileSystem = p.getFileSystem(configuration);
-    this.path = fileSystem.makeQualified(p);
-    fileSystem.close();
-    if (nativeDirectory) {
-      File file = getFile(this.path);
-      for (File f : file.listFiles()) {
-        FSDirectory directory = FSDirectory.open(f);
-        tables.put(f.getName(), openWriter(directory));
-      }
-    } else {
-      BufferStore.init();
-      long totalMemory = getTotalMemory();
-      int slabSize = MAX_SLABSIZE;
-      BlockCache cache;
-      if (totalMemory < 0) {
-        LOG.info("Block cache using [" + MIN_SLABSIZE + "] total memory in cache, with slab size of [" + MIN_SLABSIZE + "].");
-        cache = new BlockCache(false, MIN_SLABSIZE, MIN_SLABSIZE);
-      } else {
-        LOG.info("Block cache using [" + totalMemory + "] total memory in off heap cache, with slab size of [" + slabSize + "].");
-        cache = new BlockCache(true, totalMemory, slabSize);
-      }
-
-      FileStatus[] listStatus = fileSystem.listStatus(path);
-      for (FileStatus status : listStatus) {
-        Path tablePath = status.getPath();
-        Directory directory = new SimpleHDFSDirectory(configuration, tablePath);
-        BlockDirectoryCache blockDirectoryCache = new BlockDirectoryCache(cache);
-        BlockDirectory blockDirectory = new BlockDirectory("embedded", directory, blockDirectoryCache);
-        tables.put(tablePath.getName(), openWriter(blockDirectory));
-      }
-    }
-  }
-
-  private File getFile(Path p) {
-    URI uri = p.toUri();
-    return new File(uri);
-  }
-
-  private long getTotalMemory() {
-    RuntimeMXBean RuntimemxBean = ManagementFactory.getRuntimeMXBean();
-    List<String> arguments = RuntimemxBean.getInputArguments();
-    String maxDirectMemorySize = null;
-    for (String argument : arguments) {
-      if (argument.startsWith(XX_MAX_DIRECT_MEMORY_SIZE)) {
-        maxDirectMemorySize = argument;
-      }
-    }
-    if (maxDirectMemorySize == null) {
-      return -1L;
-    }
-    String directSize = maxDirectMemorySize.substring(XX_MAX_DIRECT_MEMORY_SIZE.length());
-    return getSize(directSize.toLowerCase()) - MAX_SLABSIZE;
-  }
-
-  private long getSize(String directSize) {
-    if (directSize.endsWith("g")) {
-      return Long.parseLong(directSize.substring(0, directSize.length() - 1)) * GIG;
-    } else if (directSize.endsWith("m")) {
-      return Long.parseLong(directSize.substring(0, directSize.length() - 1)) * MEG;
-    } else if (directSize.endsWith("k")) {
-      return Long.parseLong(directSize.substring(0, directSize.length() - 1)) * KILO;
-    } else {
-      return Long.parseLong(directSize.substring(0, directSize.length()));
-    }
-  }
-
-  private IndexWriter openWriter(Directory directory) throws IOException {
-    IndexWriterConfig conf = new IndexWriterConfig(Version.LUCENE_40, new KeywordAnalyzer());
-    conf.setCodec(new AppendingCodec());
-    TieredMergePolicy mergePolicy = (TieredMergePolicy) conf.getMergePolicy();
-    mergePolicy.setUseCompoundFile(false);
-    return new IndexWriter(directory, conf);
-  }
-
-  @Override
-  public Session openReadSession() throws BlurException, TException {
-    try {
-      Map<String, IndexReader> readers = getReaders();
-      ReadSession session = new ReadSession(UUID.randomUUID().toString(), readers);
-      readSessions.put(session.getSessionId(), session);
-      return new Session(session.getSessionId(), null);
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  private Map<String, IndexReader> getReaders() throws IOException {
-    Map<String, IndexReader> readers = new HashMap<String, IndexReader>();
-    for (Entry<String, IndexWriter> e : tables.entrySet()) {
-      IndexReader reader = DirectoryReader.open(e.getValue(), true);
-      readers.put(e.getKey(), reader);
-    }
-    return readers;
-  }
-
-  @Override
-  public QuerySession executeQuery(Session readSession, String query) throws BlurException, TException {
-    try {
-      ReadSession session = getReadSession(readSession);
-      BqlParser bqlParser = new BqlParser(analyzer);
-      bqlParser.parse(query);
-
-      QuerySession querySession = new QuerySession();
-      querySession.setQueryId(UUID.randomUUID().toString());
-      querySession.setSession(readSession);
-
-      RunningQuerySession runningQuerySession = session.create(querySession.getQueryId());
-      runningQuerySession.executeBql(bqlParser);
-
-      return querySession;
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public List<Tuple> nextMetaDataResults(QuerySession querySession, int batchSize) throws BlurException, TException {
-    try {
-      ReadSession session = getReadSession(querySession.getSession());
-      RunningQuerySession runningQuerySession = session.getRunningQuerySession(querySession.getQueryId());
-      List<Tuple> results = new ArrayList<Tuple>();
-      for (int i = 0; i < batchSize; i++) {
-        Tuple tuple = runningQuerySession.nextMetaData();
-        if (tuple == null) {
-          break;
-        }
-        results.add(tuple);
-      }
-      return results;
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public List<Tuple> nextResults(QuerySession querySession, int batchSize) throws BlurException, TException {
-    try {
-      ReadSession session = getReadSession(querySession.getSession());
-      RunningQuerySession runningQuerySession = session.getRunningQuerySession(querySession.getQueryId());
-      List<Tuple> results = new ArrayList<Tuple>();
-      for (int i = 0; i < batchSize; i++) {
-        Tuple tuple = runningQuerySession.nextData();
-        if (tuple == null) {
-          break;
-        }
-        results.add(tuple);
-      }
-      return results;
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public void closeReadSession(Session readSession) throws BlurException, TException {
-    try {
-      ReadSession session = readSessions.remove(readSession.getSessionId());
-      session.close();
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public Session openWriteSession(String table) throws BlurException, TException {
-    try {
-      String id = UUID.randomUUID().toString();
-      Path p = new Path(path, id);
-      WriteSession session;
-      if (nativeDirectory) {
-        File file = getFile(p);
-        Directory directory = FSDirectory.open(file);
-        session = new WriteSessionThreadedFile(id, openWriter(directory), directory, file);
-      } else {
-        Directory directory = new SimpleHDFSDirectory(configuration, p);
-        session = new WriteSessionThreadedPath(id, openWriter(directory), directory, configuration, p);
-      }
-      writeSessions.put(session.getSessionId(), session);
-      Map<String, String> properties = new HashMap<String, String>();
-      properties.put("table", table);
-      return new Session(session.getSessionId(), properties);
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public void writeTuples(Session writeSession, List<Tuple> tuples) throws BlurException, TException {
-    try {
-      WriteSession session = getWriteSession(writeSession);
-      session.addDocuments(convert(tuples));
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public void commitWriteSession(Session writeSession) throws BlurException, TException {
-    try {
-      WriteSession session = writeSessions.remove(writeSession.getSessionId());
-      String table = writeSession.getProperties().get("table");
-      IndexWriter writer = tables.get(table);
-      session.commit(writer);
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  @Override
-  public void rollbackWriteSession(Session writeSession) throws BlurException, TException {
-    try {
-      WriteSession session = writeSessions.remove(writeSession.getSessionId());
-      session.closeWriter();
-      session.removeTempSpace();
-    } catch (Throwable t) {
-      throw Util.wrapThrowable(t);
-    }
-  }
-
-  private Document convert(Tuple tuple) throws BlurException {
-    if (tuple == null) {
-      return null;
-    }
-    Document newDoc = new Document();
-    for (Attribute attribute : tuple.getAttributes()) {
-      newDoc.add(Util.getField(attribute));
-    }
-    return newDoc;
-  }
-
-  private List<Document> convert(List<Tuple> tuples) throws BlurException {
-    List<Document> docs = new ArrayList<Document>();
-    for (Tuple tuple : tuples) {
-      docs.add(convert(tuple));
-    }
-    return docs;
-  }
-
-  private WriteSession getWriteSession(Session session) throws BlurException {
-    WriteSession wsession = writeSessions.get(session.getSessionId());
-    if (wsession == null) {
-      throw new BlurException("Write Session [" + session + "] not found", null);
-    }
-    return wsession;
-  }
-
-  private ReadSession getReadSession(Session session) throws BlurException {
-    ReadSession rsession = readSessions.get(session.getSessionId());
-    if (rsession == null) {
-      throw new BlurException("Read Session [" + session + "] not found", null);
-    }
-    return rsession;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
deleted file mode 100644
index 86c7539..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/TupleStoredFieldVisitor.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.apache.blur.core;
-
-/**
- * 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 java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.blur.thrift.generated.Attribute;
-import org.apache.blur.thrift.generated.TYPE;
-import org.apache.lucene.index.FieldInfo;
-import org.apache.lucene.index.StoredFieldVisitor;
-
-public class TupleStoredFieldVisitor extends StoredFieldVisitor {
-
-  private Map<String, int[]> fieldToAttributeLookup;
-  private Attribute[] attributes;
-  private List<String> attributeNames;
-  private boolean allColumns;
-  private List<Attribute> allColumnsList = new ArrayList<Attribute>();
-
-  public TupleStoredFieldVisitor(List<String> attributeTokens, List<String> attributeTokenAliases) {
-    if (attributeTokens.size() != attributeTokenAliases.size()) {
-      throw new RuntimeException("something went wrong here");
-    }
-    Map<String, List<Integer>> fieldToAttributeLookupInternal = new HashMap<String, List<Integer>>();
-    attributeNames = new ArrayList<String>();
-    for (int i = 0; i < attributeTokens.size(); i++) {
-      String attributeToken = attributeTokens.get(i);
-      String returnName = attributeTokenAliases.get(i);
-      if (returnName == null) {
-        returnName = attributeToken;
-      }
-      attributeNames.add(returnName);
-      List<Integer> attributeCollection = fieldToAttributeLookupInternal.get(attributeToken);
-      if (attributeCollection == null) {
-        attributeCollection = new ArrayList<Integer>();
-        fieldToAttributeLookupInternal.put(attributeToken, attributeCollection);
-      }
-      attributeCollection.add(i);
-    }
-    fieldToAttributeLookup = convert(fieldToAttributeLookupInternal);
-    attributes = new Attribute[attributeTokens.size()];
-  }
-
-  public TupleStoredFieldVisitor() {
-    allColumns = true;
-  }
-
-  private Map<String, int[]> convert(Map<String, List<Integer>> map) {
-    Map<String, int[]> result = new HashMap<String, int[]>();
-    for (Entry<String, List<Integer>> e : map.entrySet()) {
-      int[] array = convert(e.getValue());
-      result.put(e.getKey(), array);
-    }
-    return result;
-  }
-
-  private int[] convert(List<Integer> list) {
-    int[] array = new int[list.size()];
-    for (int i = 0; i < list.size(); i++) {
-      array[i] = list.get(i);
-    }
-    return array;
-  }
-
-  @Override
-  public Status needsField(FieldInfo fieldInfo) throws IOException {
-    if (allColumns) {
-      return Status.YES;
-    }
-    int[] list = fieldToAttributeLookup.get(fieldInfo.name);
-    if (list == null) {
-      return Status.NO;
-    }
-    return Status.YES;
-  }
-
-  @Override
-  public void stringField(FieldInfo fieldInfo, String value) throws IOException {
-    if (allColumns) {
-      allColumnsList.add(getStringAttribute(fieldInfo, value));
-      return;
-    }
-    int[] indexes = fieldToAttributeLookup.get(fieldInfo.name);
-    if (indexes == null) {
-      return;
-    }
-    Attribute attribute = getStringAttribute(fieldInfo, value);
-    for (int i = 0; i < indexes.length; i++) {
-      attributes[indexes[i]] = attribute;
-    }
-  }
-
-  private Attribute getStringAttribute(FieldInfo fieldInfo, String value) throws IOException {
-    Attribute attribute = new Attribute();
-    attribute.setType(TYPE.STRING);
-    attribute.setName(fieldInfo.name);
-    attribute.setValue(value.getBytes("UTF-8"));
-    return attribute;
-  }
-
-  @Override
-  public void intField(FieldInfo fieldInfo, int value) {
-    notSupportedYet();
-  }
-
-  @Override
-  public void longField(FieldInfo fieldInfo, long value) {
-    notSupportedYet();
-  }
-
-  @Override
-  public void floatField(FieldInfo fieldInfo, float value) {
-    notSupportedYet();
-  }
-
-  @Override
-  public void doubleField(FieldInfo fieldInfo, double value) {
-    notSupportedYet();
-  }
-
-  private void notSupportedYet() {
-    throw new RuntimeException("not supported yet");
-  }
-
-  public List<Attribute> getTupleAndReset() {
-    List<Attribute> tuple = new ArrayList<Attribute>();
-    if (allColumns) {
-      tuple.addAll(allColumnsList);
-      allColumnsList.clear();
-      return tuple;
-    }
-    for (int i = 0; i < attributes.length; i++) {
-      String name = attributeNames.get(i);
-      tuple.add(copy(attributes[i]).setName(name));
-    }
-    reset(attributes);
-    return tuple;
-  }
-
-  private Attribute copy(Attribute attribute) {
-    return new Attribute(attribute);
-  }
-
-  private static void reset(Attribute[] attributes) {
-    for (int i = 0; i < attributes.length; i++) {
-      attributes[i] = null;
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/Util.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/Util.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/Util.java
deleted file mode 100644
index 8b6abb6..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/Util.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.apache.blur.core;
-
-/**
- * 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.PrintWriter;
-import java.io.StringWriter;
-import java.nio.ByteBuffer;
-import java.util.List;
-
-import org.apache.blur.thrift.generated.Attribute;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.TYPE;
-import org.apache.blur.thrift.generated.Tuple;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.IndexableField;
-
-public class Util {
-
-  public static Attribute newAttribute(String name, String value) {
-    return new Attribute(name, ByteBuffer.wrap(value.getBytes()), TYPE.STRING);
-  }
-
-  public static Attribute newAttribute(String name, int value) {
-    ByteBuffer buffer = ByteBuffer.allocate(4);
-    buffer.putInt(value);
-    buffer.flip();
-    Attribute attribute = new Attribute();
-    attribute.setName(name);
-    attribute.setValue(buffer.array());
-    attribute.setType(TYPE.INT);
-    return attribute;
-  }
-  
-  public static Attribute newAttribute(String name, double value) {
-    ByteBuffer buffer = ByteBuffer.allocate(8);
-    buffer.putDouble(value);
-    buffer.flip();
-    Attribute attribute = new Attribute();
-    attribute.setName(name);
-    attribute.setValue(buffer.array());
-    attribute.setType(TYPE.DOUBLE);
-    return attribute;
-  }
-
-  public static Attribute toAttribute(IndexableField fieldable) {
-    return newAttribute(fieldable.name(), fieldable.stringValue());
-  }
-
-  public static IndexableField getField(Attribute attribute) throws BlurException {
-    switch (attribute.getType()) {
-    case STRING:
-      return new StringField(attribute.getName(), toString(attribute.getValue()), Store.YES);
-    default:
-      throw new BlurException("Not supported [" + attribute.getType() + "]", null);
-    }
-  }
-
-  public static String toString(byte[] bs) {
-    return new String(bs);
-  }
-
-  public static String toString(Tuple tuple) {
-    List<Attribute> attributes = tuple.getAttributes();
-    String s = "";
-    for (Attribute attribute : attributes) {
-      if (!s.isEmpty()) {
-        s += ",";
-      }
-      String name = attribute.getName();
-      s += "\"" + name + "\":";
-      switch (attribute.getType()) {
-      case STRING:
-        s += "\"" + toString(attribute.getValue()) + "\"";
-        break;
-      case INT:
-        s += toInt(attribute.getValue());
-        break;
-      case DOUBLE:
-        s += toDouble(attribute.getValue());
-        break;
-      default:
-        throw new RuntimeException("Type [" + attribute.getType() + "] not supported.");
-      }
-    }
-    return "{" + s + "}";
-  }
-
-  private static double toDouble(byte[] bs) {
-    return ByteBuffer.wrap(bs).getDouble();
-  }
-
-  public static int toInt(byte[] bs) {
-    return ByteBuffer.wrap(bs).getInt();
-  }
-
-  public static BlurException wrapThrowable(Throwable t) {
-    StringWriter writer = new StringWriter();
-    PrintWriter printWriter = new PrintWriter(writer);
-    t.printStackTrace(printWriter);
-    printWriter.close();
-    String stackTraceStr = writer.toString();
-    return new BlurException(t.getMessage(), stackTraceStr);
-  }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/61759696/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/ReadSession.java
----------------------------------------------------------------------
diff --git a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/ReadSession.java b/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/ReadSession.java
deleted file mode 100644
index 1ea7927..0000000
--- a/src/blur-new-api-prototype/src/main/java/org/apache/blur/core/sessions/ReadSession.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.apache.blur.core.sessions;
-
-/**
- * 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 java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.lucene.index.IndexReader;
-
-public class ReadSession {
-
-  private String sessionId;
-  private Map<String, IndexReader> readers;
-  private Map<String, RunningQuerySession> runningQueries = new ConcurrentHashMap<String, RunningQuerySession>();
-
-  public ReadSession(String sessionId, Map<String, IndexReader> readers) {
-    this.sessionId = sessionId;
-    this.readers = readers;
-  }
-
-  public String getSessionId() {
-    return sessionId;
-  }
-
-  public RunningQuerySession create(String queryId) {
-    RunningQuerySession runningQuerySession = new RunningQuerySession(readers, sessionId, queryId);
-    runningQueries.put(queryId, runningQuerySession);
-    return runningQuerySession;
-  }
-
-  public RunningQuerySession getRunningQuerySession(String queryId) {
-    return runningQueries.get(queryId);
-  }
-
-  public void close() throws IOException {
-    for (IndexReader reader : readers.values()) {
-      reader.close();
-    }
-  }
-
-}


Mime
View raw message