incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [17/27] Massive changes to the the thrift API. Getting closer to the final version, this commit also removes the controller from the architecture.
Date Sun, 18 Nov 2012 00:52:59 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
deleted file mode 100644
index 255a9d1..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurControllerServer.java
+++ /dev/null
@@ -1,548 +0,0 @@
-package org.apache.blur.thrift;
-
-/**
- * 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.Closeable;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-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.clusterstatus.ZookeeperPathConstants;
-import org.apache.blur.manager.indexserver.DistributedLayoutManager;
-import org.apache.blur.manager.stats.MergerTableStats;
-import org.apache.blur.manager.status.MergerQueryStatus;
-import org.apache.blur.manager.status.MergerQueryStatusSingle;
-import org.apache.blur.thrift.commands.BlurCommand;
-import org.apache.blur.thrift.generated.Blur.Client;
-import org.apache.blur.thrift.generated.Blur.Iface;
-import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.BlurQueryStatus;
-import org.apache.blur.thrift.generated.Schema;
-import org.apache.blur.thrift.generated.TableDescriptor;
-import org.apache.blur.thrift.generated.TableStats;
-import org.apache.blur.utils.BlurConstants;
-import org.apache.blur.utils.BlurExecutorCompletionService;
-import org.apache.blur.utils.BlurUtil;
-import org.apache.blur.utils.ForkJoin;
-import org.apache.blur.utils.ForkJoin.Merger;
-import org.apache.blur.utils.ForkJoin.ParallelCall;
-import org.apache.blur.zookeeper.WatchChildren;
-import org.apache.blur.zookeeper.WatchChildren.OnChange;
-import org.apache.blur.zookeeper.WatchNodeExistance;
-import org.apache.hadoop.io.BytesWritable;
-import org.apache.thrift.TException;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.data.Stat;
-
-public class BlurControllerServer extends TableAdmin implements Iface {
-
-  public static abstract class BlurClient {
-    public abstract <T> T execute(String node, BlurCommand<T> command, int maxRetries, long backOffTime, long maxBackOffTime) throws Exception;
-  }
-
-  public static class BlurClientRemote extends BlurClient {
-    @Override
-    public <T> T execute(String node, BlurCommand<T> command, int maxRetries, long backOffTime, long maxBackOffTime) throws Exception {
-      return BlurClientManager.execute(node, command, maxRetries, backOffTime, maxBackOffTime);
-    }
-  }
-
-  private static final String CONTROLLER_THREAD_POOL = "controller-thread-pool";
-  private static final Log LOG = LogFactory.getLog(BlurControllerServer.class);
-
-  private ExecutorService _executor;
-  private AtomicReference<Map<String, Map<String, String>>> _shardServerLayout = new AtomicReference<Map<String, Map<String, String>>>(new HashMap<String, Map<String, String>>());
-  private BlurClient _client;
-  private int _threadCount = 64;
-  private AtomicBoolean _closed = new AtomicBoolean();
-  private Map<String, Integer> _tableShardCountMap = new ConcurrentHashMap<String, Integer>();
-  private BlurPartitioner<BytesWritable, Void> _blurPartitioner = new BlurPartitioner<BytesWritable, Void>();
-  private String _nodeName;
-  private int _remoteFetchCount = 100;
-  private long _maxTimeToLive = TimeUnit.MINUTES.toMillis(1);
-  private int _maxQueryCacheElements = 128;
-  private AtomicBoolean _running = new AtomicBoolean();
-
-  private int _maxFetchRetries = 3;
-  private int _maxMutateRetries = 3;
-  private int _maxDefaultRetries = 3;
-  private long _fetchDelay = 500;
-  private long _mutateDelay = 500;
-  private long _defaultDelay = 500;
-  private long _maxFetchDelay = 2000;
-  private long _maxMutateDelay = 2000;
-  private long _maxDefaultDelay = 2000;
-
-  private long _defaultParallelCallTimeout = TimeUnit.MINUTES.toMillis(1);
-  private WatchChildren _watchForClusters;
-  private ConcurrentMap<String, WatchNodeExistance> _watchForTablesPerClusterExistance = new ConcurrentHashMap<String, WatchNodeExistance>();
-  private ConcurrentMap<String, WatchNodeExistance> _watchForOnlineShardsPerClusterExistance = new ConcurrentHashMap<String, WatchNodeExistance>();
-  private ConcurrentMap<String, WatchChildren> _watchForTablesPerCluster = new ConcurrentHashMap<String, WatchChildren>();
-  private ConcurrentMap<String, WatchChildren> _watchForOnlineShardsPerCluster = new ConcurrentHashMap<String, WatchChildren>();
-
-  public void init() throws KeeperException, InterruptedException {
-    setupZookeeper();
-    registerMyself();
-    _executor = Executors.newThreadPool(CONTROLLER_THREAD_POOL, _threadCount);
-    _running.set(true);
-    watchForClusterChanges();
-    List<String> clusterList = _clusterStatus.getClusterList(false);
-    for (String cluster : clusterList) {
-      watchForLayoutChanges(cluster);
-    }
-    updateLayout();
-  }
-
-  private void setupZookeeper() throws KeeperException, InterruptedException {
-    BlurUtil.createIfMissing(_zookeeper, "/blur");
-    BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getOnlineControllersPath());
-    BlurUtil.createIfMissing(_zookeeper, ZookeeperPathConstants.getClustersPath());
-  }
-
-  private void watchForClusterChanges() throws KeeperException, InterruptedException {
-    _watchForClusters = new WatchChildren(_zookeeper, ZookeeperPathConstants.getClustersPath());
-    _watchForClusters.watch(new OnChange() {
-      @Override
-      public void action(List<String> children) {
-        for (String cluster : children) {
-          try {
-            watchForLayoutChanges(cluster);
-          } catch (KeeperException e) {
-            LOG.error("Unknown error", e);
-            throw new RuntimeException(e);
-          } catch (InterruptedException e) {
-            LOG.error("Unknown error", e);
-            throw new RuntimeException(e);
-          }
-        }
-      }
-    });
-  }
-
-  private void watchForLayoutChanges(final String cluster) throws KeeperException, InterruptedException {
-    WatchNodeExistance we1 = new WatchNodeExistance(_zookeeper, ZookeeperPathConstants.getTablesPath(cluster));
-    we1.watch(new WatchNodeExistance.OnChange() {
-      @Override
-      public void action(Stat stat) {
-        if (stat != null) {
-          watch(cluster, ZookeeperPathConstants.getTablesPath(cluster), _watchForTablesPerCluster);
-        }
-      }
-    });
-    if (_watchForTablesPerClusterExistance.putIfAbsent(cluster, we1) != null) {
-      we1.close();
-    }
-
-    WatchNodeExistance we2 = new WatchNodeExistance(_zookeeper, ZookeeperPathConstants.getTablesPath(cluster));
-    we2.watch(new WatchNodeExistance.OnChange() {
-      @Override
-      public void action(Stat stat) {
-        if (stat != null) {
-          watch(cluster, ZookeeperPathConstants.getOnlineShardsPath(cluster), _watchForOnlineShardsPerCluster);
-        }
-      }
-    });
-    if (_watchForOnlineShardsPerClusterExistance.putIfAbsent(cluster, we2) != null) {
-      we2.close();
-    }
-  }
-
-  private void watch(String cluster, String path, ConcurrentMap<String, WatchChildren> map) {
-    WatchChildren watchForTables = new WatchChildren(_zookeeper, path);
-    watchForTables.watch(new OnChange() {
-      @Override
-      public void action(List<String> children) {
-        LOG.info("Layout change.");
-        updateLayout();
-      }
-    });
-
-    if (map.putIfAbsent(cluster, watchForTables) != null) {
-      watchForTables.close();
-    }
-  }
-
-  private synchronized void updateLayout() {
-    if (!_clusterStatus.isOpen()) {
-      LOG.warn("The cluster status object has been closed.");
-      return;
-    }
-    List<String> tableList = _clusterStatus.getTableList(false);
-    HashMap<String, Map<String, String>> newLayout = new HashMap<String, Map<String, String>>();
-    for (String table : tableList) {
-      DistributedLayoutManager layoutManager = new DistributedLayoutManager();
-      String cluster = _clusterStatus.getCluster(false, table);
-      if (cluster == null) {
-        continue;
-      }
-      List<String> shardServerList = _clusterStatus.getShardServerList(cluster);
-      List<String> offlineShardServers = _clusterStatus.getOfflineShardServers(false, cluster);
-      List<String> shardList = getShardList(cluster, table);
-      layoutManager.setNodes(shardServerList);
-      layoutManager.setNodesOffline(offlineShardServers);
-      layoutManager.setShards(shardList);
-      layoutManager.init();
-      Map<String, String> layout = layoutManager.getLayout();
-      newLayout.put(table, layout);
-    }
-    _shardServerLayout.set(newLayout);
-  }
-
-  private List<String> getShardList(String cluster, String table) {
-    List<String> shards = new ArrayList<String>();
-    TableDescriptor tableDescriptor = _clusterStatus.getTableDescriptor(true, cluster, table);
-    for (int i = 0; i < tableDescriptor.shardCount; i++) {
-      shards.add(BlurUtil.getShardName(BlurConstants.SHARD_PREFIX, i));
-    }
-    return shards;
-  }
-
-  private void registerMyself() {
-    try {
-      String onlineControllerPath = ZookeeperPathConstants.getOnlineControllersPath() + "/" + _nodeName;
-      while (_zookeeper.exists(onlineControllerPath, false) != null) {
-        LOG.info("Node [{0}] already registered, waiting for path [{1}] to be released", _nodeName, onlineControllerPath);
-        Thread.sleep(3000);
-      }
-      String version = BlurUtil.getVersion();
-      _zookeeper.create(onlineControllerPath, version.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-    } catch (KeeperException e) {
-      throw new RuntimeException(e);
-    } catch (InterruptedException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public synchronized void close() {
-    if (!_closed.get()) {
-      _closed.set(true);
-      _running.set(false);
-      _executor.shutdownNow();
-      close(_watchForClusters);
-      close(_watchForOnlineShardsPerCluster.values());
-      close(_watchForOnlineShardsPerClusterExistance.values());
-      close(_watchForTablesPerCluster.values());
-      close(_watchForTablesPerClusterExistance.values());
-    }
-  }
-
-  private void close(Collection<? extends Closeable> closableLst) {
-    for (Closeable closeable : closableLst) {
-      close(closeable);
-    }
-  }
-
-  private void close(Closeable closeable) {
-    try {
-      closeable.close();
-    } catch (IOException e) {
-      LOG.error("Unknown", e);
-    }
-  }
-
-  @Override
-  public void cancelQuery(final String table, final long uuid) throws BlurException, TException {
-    checkTable(table);
-    try {
-      scatter(getCluster(table), new BlurCommand<Void>() {
-        @Override
-        public Void call(Client client) throws BlurException, TException {
-          client.cancelQuery(table, uuid);
-          return null;
-        }
-      });
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to cancel search table [{0}] uuid [{1}]", e, table, uuid);
-      throw new BException("Unknown error while trying to cancel search table [{0}] uuid [{1}]", e, table, uuid);
-    }
-  }
-
-  @Override
-  public List<BlurQueryStatus> currentQueries(final String table) throws BlurException, TException {
-    checkTable(table);
-    try {
-      return scatterGather(getCluster(table), new BlurCommand<List<BlurQueryStatus>>() {
-        @Override
-        public List<BlurQueryStatus> call(Client client) throws BlurException, TException {
-          return client.currentQueries(table);
-        }
-      }, new MergerQueryStatus(_defaultParallelCallTimeout));
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get current searches [{0}]", e, table);
-      throw new BException("Unknown error while trying to get current searches [{0}]", e, table);
-    }
-  }
-
-  @Override
-  public List<Long> queryStatusIdList(final String table) throws BlurException, TException {
-    checkTable(table);
-    try {
-      return scatterGather(getCluster(table), new BlurCommand<List<Long>>() {
-        @Override
-        public List<Long> call(Client client) throws BlurException, TException {
-          return client.queryStatusIdList(table);
-        }
-      }, new Merger<List<Long>>() {
-        @Override
-        public List<Long> merge(BlurExecutorCompletionService<List<Long>> service) throws BlurException {
-          Set<Long> result = new HashSet<Long>();
-          while (service.getRemainingCount() > 0) {
-            Future<List<Long>> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true);
-            List<Long> ids = service.getResultThrowException(future);
-            result.addAll(ids);
-          }
-          return new ArrayList<Long>(result);
-        }
-      });
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get query status ids for table [{0}]", e, table);
-      throw new BException("Unknown error while trying to get query status ids for table [{0}]", e, table);
-    }
-  }
-
-  @Override
-  public BlurQueryStatus queryStatusById(final String table, final long uuid) throws BlurException, TException {
-    checkTable(table);
-    try {
-      return scatterGather(getCluster(table), new BlurCommand<BlurQueryStatus>() {
-        @Override
-        public BlurQueryStatus call(Client client) throws BlurException, TException {
-          return client.queryStatusById(table, uuid);
-        }
-      }, new MergerQueryStatusSingle(_defaultParallelCallTimeout));
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get query status [{0}]", e, table, uuid);
-      throw new BException("Unknown error while trying to get query status [{0}]", e, table, uuid);
-    }
-  }
-
-  @Override
-  public TableStats tableStats(final String table) throws BlurException, TException {
-    checkTable(table);
-    try {
-      return scatterGather(getCluster(table), new BlurCommand<TableStats>() {
-        @Override
-        public TableStats call(Client client) throws BlurException, TException {
-          return client.tableStats(table);
-        }
-      }, new MergerTableStats(_defaultParallelCallTimeout));
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get table stats [{0}]", e, table);
-      throw new BException("Unknown error while trying to get table stats [{0}]", e, table);
-    }
-  }
-
-  @Override
-  public Map<String, String> shardServerLayout(String table) throws BlurException, TException {
-    checkTable(table);
-    Map<String, Map<String, String>> layout = _shardServerLayout.get();
-    Map<String, String> tableLayout = layout.get(table);
-    if (tableLayout == null) {
-      return new HashMap<String, String>();
-    }
-    return tableLayout;
-  }
-
-  @Override
-  public Schema schema(final String table) throws BlurException, TException {
-    checkTable(table);
-    try {
-      return scatterGather(getCluster(table), new BlurCommand<Schema>() {
-        @Override
-        public Schema call(Client client) throws BlurException, TException {
-          return client.schema(table);
-        }
-      }, new Merger<Schema>() {
-        @Override
-        public Schema merge(BlurExecutorCompletionService<Schema> service) throws BlurException {
-          Schema result = null;
-          while (service.getRemainingCount() > 0) {
-            Future<Schema> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true, table);
-            Schema schema = service.getResultThrowException(future, table);
-            if (result == null) {
-              result = schema;
-            } else {
-              result = BlurControllerServer.merge(result, schema);
-            }
-          }
-          return result;
-        }
-      });
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to schema table [{0}]", e, table);
-      throw new BException("Unknown error while trying to schema table [{0}]", e, table);
-    }
-  }
-
-  private <R> R scatterGather(String cluster, final BlurCommand<R> command, Merger<R> merger) throws Exception {
-    return ForkJoin.execute(_executor, _clusterStatus.getOnlineShardServers(true, cluster), new ParallelCall<String, R>() {
-      @SuppressWarnings("unchecked")
-      @Override
-      public R call(String hostnamePort) throws Exception {
-        return _client.execute(hostnamePort, (BlurCommand<R>) command.clone(), _maxDefaultRetries, _defaultDelay, _maxDefaultDelay);
-      }
-    }).merge(merger);
-  }
-
-  private <R> void scatter(String cluster, BlurCommand<R> command) throws Exception {
-    scatterGather(cluster, command, new Merger<R>() {
-      @Override
-      public R merge(BlurExecutorCompletionService<R> service) throws BlurException {
-        while (service.getRemainingCount() > 0) {
-          Future<R> future = service.poll(_defaultParallelCallTimeout, TimeUnit.MILLISECONDS, true);
-          service.getResultThrowException(future);
-        }
-        return null;
-      }
-    });
-  }
-
-  private String getCluster(String table) throws BlurException, TException {
-    TableDescriptor describe = describe(table);
-    if (describe == null) {
-      throw new BlurException("Table [" + table + "] not found.", null);
-    }
-    return describe.cluster;
-  }
-
-  public static Schema merge(Schema result, Schema schema) {
-    Map<String, Set<String>> destColumnFamilies = result.columnFamilies;
-    Map<String, Set<String>> srcColumnFamilies = schema.columnFamilies;
-    for (String srcColumnFamily : srcColumnFamilies.keySet()) {
-      Set<String> destColumnNames = destColumnFamilies.get(srcColumnFamily);
-      Set<String> srcColumnNames = srcColumnFamilies.get(srcColumnFamily);
-      if (destColumnNames == null) {
-        destColumnFamilies.put(srcColumnFamily, srcColumnNames);
-      } else {
-        destColumnNames.addAll(srcColumnNames);
-      }
-    }
-    return result;
-  }
-
-  public void setNodeName(String nodeName) {
-    _nodeName = nodeName;
-  }
-
-  public int getRemoteFetchCount() {
-    return _remoteFetchCount;
-  }
-
-  public void setRemoteFetchCount(int remoteFetchCount) {
-    _remoteFetchCount = remoteFetchCount;
-  }
-
-  public long getMaxTimeToLive() {
-    return _maxTimeToLive;
-  }
-
-  public void setMaxTimeToLive(long maxTimeToLive) {
-    _maxTimeToLive = maxTimeToLive;
-  }
-
-  public int getMaxQueryCacheElements() {
-    return _maxQueryCacheElements;
-  }
-
-  public void setMaxQueryCacheElements(int maxQueryCacheElements) {
-    _maxQueryCacheElements = maxQueryCacheElements;
-  }
-
-  public void setThreadCount(int threadCount) {
-    _threadCount = threadCount;
-  }
-
-  public void setMaxFetchRetries(int maxFetchRetries) {
-    _maxFetchRetries = maxFetchRetries;
-  }
-
-  public void setMaxMutateRetries(int maxMutateRetries) {
-    _maxMutateRetries = maxMutateRetries;
-  }
-
-  public void setMaxDefaultRetries(int maxDefaultRetries) {
-    _maxDefaultRetries = maxDefaultRetries;
-  }
-
-  public void setFetchDelay(long fetchDelay) {
-    _fetchDelay = fetchDelay;
-  }
-
-  public void setMutateDelay(long mutateDelay) {
-    _mutateDelay = mutateDelay;
-  }
-
-  public void setDefaultDelay(long defaultDelay) {
-    _defaultDelay = defaultDelay;
-  }
-
-  public void setMaxFetchDelay(long maxFetchDelay) {
-    _maxFetchDelay = maxFetchDelay;
-  }
-
-  public void setMaxMutateDelay(long maxMutateDelay) {
-    _maxMutateDelay = maxMutateDelay;
-  }
-
-  public void setMaxDefaultDelay(long maxDefaultDelay) {
-    _maxDefaultDelay = maxDefaultDelay;
-  }
-
-  public BlurClient getClient() {
-    return _client;
-  }
-
-  public void setClient(BlurClient client) {
-    _client = client;
-  }
-
-  @Override
-  public void optimize(final String table, final int numberOfSegmentsPerShard) throws BlurException, TException {
-    checkTable(table);
-    try {
-      scatter(getCluster(table), new BlurCommand<Void>() {
-        @Override
-        public Void call(Client client) throws BlurException, TException {
-          client.optimize(table, numberOfSegmentsPerShard);
-          return null;
-        }
-      });
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to optimize [table={0},numberOfSegmentsPerShard={1}]", e, table, numberOfSegmentsPerShard);
-      throw new BException("Unknown error while trying to optimize [table={0},numberOfSegmentsPerShard={1}]", e, table, numberOfSegmentsPerShard);
-    }
-  }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
index b7f11c5..1c9f8ef 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/BlurShardServer.java
@@ -29,7 +29,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.TreeMap;
 import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
@@ -45,15 +44,14 @@ import org.apache.blur.log.LogFactory;
 import org.apache.blur.manager.IndexManager;
 import org.apache.blur.manager.IndexServer;
 import org.apache.blur.manager.writer.BlurIndex;
+import org.apache.blur.thrift.generated.Blur.Iface;
 import org.apache.blur.thrift.generated.BlurException;
-import org.apache.blur.thrift.generated.BlurQueryStatus;
-import org.apache.blur.thrift.generated.DocLocation;
 import org.apache.blur.thrift.generated.Document;
+import org.apache.blur.thrift.generated.LiveSchema;
 import org.apache.blur.thrift.generated.MutateOptions;
 import org.apache.blur.thrift.generated.QueryArgs;
-import org.apache.blur.thrift.generated.Schema;
+import org.apache.blur.thrift.generated.QueryStatus;
 import org.apache.blur.thrift.generated.Session;
-import org.apache.blur.thrift.generated.ShardServer.Iface;
 import org.apache.blur.thrift.generated.TableStats;
 import org.apache.blur.thrift.generated.Term;
 import org.apache.blur.thrift.generated.TopFieldDocs;
@@ -80,7 +78,6 @@ public class BlurShardServer extends TableAdmin implements Iface {
   private ExecutorService _dataFetch;
   private ExecutorService _indexSearcherExecutor;
   private ExecutorService _searchExecutor;
-  private String _cluster = BlurConstants.BLUR_CLUSTER;
   private int _dataFetchThreadCount = 32;
 
   public void init() throws BlurException {
@@ -91,30 +88,20 @@ public class BlurShardServer extends TableAdmin implements Iface {
     if (_configuration == null) {
       throw new BException("Configuration must be set before initialization.");
     }
-    _cluster = _configuration.get(BlurConstants.BLUR_CLUSTER_NAME, BlurConstants.BLUR_CLUSTER);
     _dataFetchThreadCount = _configuration.getInt(BLUR_SHARD_DATA_FETCH_THREAD_COUNT, 8);
     _maxQueryCacheElements = _configuration.getInt(BLUR_SHARD_CACHE_MAX_QUERYCACHE_ELEMENTS, 128);
     _maxTimeToLive = _configuration.getLong(BLUR_SHARD_CACHE_MAX_TIMETOLIVE, TimeUnit.MINUTES.toMillis(1));
   }
 
-  @Override
-  public void cancelQuery(String table, long uuid) throws BlurException, TException {
-    throw new BlurException("Not implemented", null);
-  }
-
-  @Override
-  public List<BlurQueryStatus> currentQueries(String table) throws BlurException, TException {
-    throw new BlurException("Not implemented", null);
-  }
 
   @Override
   public TableStats tableStats(String table) throws BlurException, TException {
-    checkTable(_cluster, table);
+    checkTable(table);
     try {
       TableStats tableStats = new TableStats();
-      tableStats.tableName = table;
-      tableStats.recordCount = _indexServer.getRecordCount(table);
-      tableStats.rowCount = _indexServer.getRowCount(table);
+//      tableStats.tableName = table;
+//      tableStats.recordCount = _indexServer.getRecordCount(table);
+//      tableStats.rowCount = _indexServer.getRowCount(table);
       tableStats.bytes = _indexServer.getTableSize(table);
       tableStats.queries = 0;
       return tableStats;
@@ -132,36 +119,6 @@ public class BlurShardServer extends TableAdmin implements Iface {
     }
   }
 
-  @Override
-  public Map<String, String> shardServerLayout(String table) throws BlurException, TException {
-    checkTable(_cluster, table);
-    try {
-      Map<String, BlurIndex> blurIndexes = _indexServer.getIndexes(table);
-      Map<String, String> result = new TreeMap<String, String>();
-      String nodeName = _indexServer.getNodeName();
-      for (String shard : blurIndexes.keySet()) {
-        result.put(shard, nodeName);
-      }
-      return result;
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to getting shardServerLayout for table [" + table + "]", e);
-      if (e instanceof BlurException) {
-        throw (BlurException) e;
-      }
-      throw new BException(e.getMessage(), e);
-    }
-  }
-
-  @Override
-  public Schema schema(String table) throws BlurException, TException {
-    checkTable(_cluster, table);
-    try {
-      return _indexManager.schema(table);
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get schema for table [{0}={1}]", e, "table", table);
-      throw new BException(e.getMessage(), e);
-    }
-  }
 
   public long getMaxTimeToLive() {
     return _maxTimeToLive;
@@ -187,26 +144,6 @@ public class BlurShardServer extends TableAdmin implements Iface {
     _indexServer = indexServer;
   }
 
-  @Override
-  public BlurQueryStatus queryStatusById(String table, long uuid) throws BlurException, TException {
-    throw new BlurException("Not implemented", null);
-  }
-
-  @Override
-  public List<Long> queryStatusIdList(String table) throws BlurException, TException {
-    throw new BlurException("Not implemented", null);
-  }
-
-  @Override
-  public void optimize(String table, int numberOfSegmentsPerShard) throws BlurException, TException {
-    checkTable(_cluster, table);
-    try {
-      _indexManager.optimize(table, numberOfSegmentsPerShard);
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to optimize [table={0},numberOfSegmentsPerShard={1}]", e, table, numberOfSegmentsPerShard);
-      throw new BException(e.getMessage(), e);
-    }
-  }
 
   public int getDataFetchThreadCount() {
     return _dataFetchThreadCount;
@@ -226,7 +163,7 @@ public class BlurShardServer extends TableAdmin implements Iface {
 
   @Override
   public Session openReadSession(String table) throws BlurException, TException {
-    checkTable(_cluster, table);
+    checkTable(table);
     BlurAnalyzer analyzer = _indexServer.getAnalyzer(table);
     Map<String, BlurIndex> blurIndexes;
     try {
@@ -254,7 +191,7 @@ public class BlurShardServer extends TableAdmin implements Iface {
       }
     }
     sessions.put(uuid, sessionInfo);
-    return new Session(uuid, null);
+    return new Session(uuid);
   }
 
   @Override
@@ -322,8 +259,8 @@ public class BlurShardServer extends TableAdmin implements Iface {
       topFieldDocs.setShardIndex(shardIndex);
       List<org.apache.blur.thrift.generated.ScoreDoc> scoreDocs = topFieldDocs.getScoreDocs();
       for (org.apache.blur.thrift.generated.ScoreDoc sd : scoreDocs) {
-        DocLocation docLocation = sd.getDocLocation();
-        docLocation.setShardIndex(shardIndex);
+        long docLocation = sd.getDocLocation();
+//        docLocation.setShardIndex(shardIndex);
       }
       return topFieldDocs;
     }
@@ -383,14 +320,19 @@ public class BlurShardServer extends TableAdmin implements Iface {
   }
 
   @Override
-  public List<Document> doc(Session session, List<DocLocation> docLocations, Set<String> fieldsToLoad) throws BlurException, TException {
+  public List<Document> doc(Session session, List<Long> docLocations, Set<String> fieldsToLoad) throws BlurException, TException {
     try {
       SessionInfo sessionInfo = getSessionInfo(session);
       Map<Integer, IndexSearcher> searchers = sessionInfo.getSearchers();
       List<Document> result = new ArrayList<Document>();
-      for (DocLocation docLocation : docLocations) {
-        IndexSearcher searcher = searchers.get(docLocation.getShardIndex());
-        result.add(toThrift(searcher.document(docLocation.getDoc(), fieldsToLoad)));
+      for (Long docLocation : docLocations) {
+        if (docLocation == null) {
+          throw new BlurException("Null docLocation is not allowed.", null);
+        }
+        int shardIndex = BlurUtil.getShardIndex(docLocation);
+        int docId = BlurUtil.getDocumentId(docLocation);
+        IndexSearcher searcher = searchers.get(shardIndex);
+        result.add(toThrift(searcher.document(docId, fieldsToLoad)));
       }
       return result;
     } catch (Throwable t) {
@@ -476,4 +418,34 @@ public class BlurShardServer extends TableAdmin implements Iface {
     BlurIndex index = blurIndexes.get(BlurUtil.getShardName(BlurConstants.SHARD_PREFIX, shardIndex));
     return index;
   }
+
+
+  @Override
+  public List<Integer> serverLayout(String table, String server) throws BlurException, TException {
+    throw new BlurException("Not implemented", null);
+  }
+
+
+  @Override
+  public void cancelQuery(Session session, long id) throws BlurException, TException {
+    throw new BlurException("Not implemented", null);    
+  }
+
+
+  @Override
+  public List<Long> queryStatusIdList(Session session) throws BlurException, TException {
+    throw new BlurException("Not implemented", null);
+  }
+
+
+  @Override
+  public QueryStatus queryStatus(Session session, long id) throws BlurException, TException {
+    throw new BlurException("Not implemented", null);
+  }
+
+
+  @Override
+  public LiveSchema schema(String table) throws BlurException, TException {
+    throw new BlurException("Not implemented", null);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java b/src/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
index c738cb6..5bbf9a7 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/TableAdmin.java
@@ -36,11 +36,12 @@ public abstract class TableAdmin implements Iface {
   protected ZooKeeper _zookeeper;
   protected ClusterStatus _clusterStatus;
   protected BlurConfiguration _configuration;
+  private String cluster;
 
   @Override
-  public boolean isInSafeMode(String cluster) throws BlurException, TException {
+  public boolean isInSafeMode() throws BlurException, TException {
     try {
-      return _clusterStatus.isInSafeMode(true, cluster);
+      return _clusterStatus.isInSafeMode(true);
     } catch (Exception e) {
       LOG.error("Unknown error during safe mode check of [cluster={0}]", e, cluster);
       throw new BException(e.getMessage(), e);
@@ -50,18 +51,12 @@ public abstract class TableAdmin implements Iface {
   @Override
   public final void createTable(TableDescriptor tableDescriptor) throws BlurException, TException {
     try {
-      // @todo Remove this once issue #27 is resolved
-      if (tableDescriptor.compressionBlockSize > 32768) {
-        tableDescriptor.compressionBlockSize = 32768;
-      } else if (tableDescriptor.compressionBlockSize < 8192) {
-        tableDescriptor.compressionBlockSize = 8192;
-      }
       _clusterStatus.createTable(tableDescriptor);
     } catch (Exception e) {
       LOG.error("Unknown error during create of [table={0}, tableDescriptor={1}]", e, tableDescriptor.name, tableDescriptor);
       throw new BException(e.getMessage(), e);
     }
-    if (tableDescriptor.isEnabled) {
+    if (tableDescriptor.isEnabled()) {
       enableTable(tableDescriptor.name);
     }
   }
@@ -69,27 +64,24 @@ public abstract class TableAdmin implements Iface {
   @Override
   public final void disableTable(String table) throws BlurException, TException {
     try {
-      String cluster = _clusterStatus.getCluster(false, table);
-      if (cluster == null) {
-        throw new BlurException("Table [" + table + "] not found.", null);
-      }
-      _clusterStatus.disableTable(cluster, table);
-      waitForTheTableToDisable(cluster, table);
-      waitForTheTableToDisengage(cluster, table);
+      _clusterStatus.disableTable(table);
+      waitForTheTableToDisable(table);
+      waitForTheTableToDisengage(table);
     } catch (Exception e) {
       LOG.error("Unknown error during disable of [table={0}]", e, table);
       throw new BException(e.getMessage(), e);
     }
   }
 
-  private void waitForTheTableToDisengage(String cluster, String table) throws BlurException, TException {
+  private void waitForTheTableToDisengage(String table) throws BlurException, TException {
     // LOG.info("Waiting for shards to disengage on table [" + table + "]");
   }
 
-  private void waitForTheTableToDisable(String cluster, String table) throws BlurException, TException {
+  private void waitForTheTableToDisable(String table) throws BlurException, TException {
     LOG.info("Waiting for shards to disable on table [" + table + "]");
     while (true) {
-      if (!_clusterStatus.isEnabled(false, cluster, table)) {
+      TableDescriptor tableDescriptor = _clusterStatus.getTableDescriptor(false, table);
+      if (!tableDescriptor.isEnabled()) {
         return;
       }
       try {
@@ -104,23 +96,20 @@ public abstract class TableAdmin implements Iface {
   @Override
   public final void enableTable(String table) throws BlurException, TException {
     try {
-      String cluster = _clusterStatus.getCluster(false, table);
-      if (cluster == null) {
-        throw new BlurException("Table [" + table + "] not found.", null);
-      }
-      _clusterStatus.enableTable(cluster, table);
-      waitForTheTableToEnable(cluster, table);
-      waitForTheTableToEngage(cluster, table);
+      _clusterStatus.enableTable(table);
+      waitForTheTableToEnable(table);
+      waitForTheTableToEngage(table);
     } catch (Exception e) {
       LOG.error("Unknown error during enable of [table={0}]", e, table);
       throw new BException(e.getMessage(), e);
     }
   }
 
-  private void waitForTheTableToEnable(String cluster, String table) throws BlurException {
+  private void waitForTheTableToEnable(String table) throws BlurException {
     LOG.info("Waiting for shards to engage on table [" + table + "]");
     while (true) {
-      if (_clusterStatus.isEnabled(false, cluster, table)) {
+      TableDescriptor tableDescriptor = _clusterStatus.getTableDescriptor(false, table);
+      if (tableDescriptor.isEnabled()) {
         return;
       }
       try {
@@ -132,9 +121,9 @@ public abstract class TableAdmin implements Iface {
     }
   }
 
-  private void waitForTheTableToEngage(String cluster, String table) throws BlurException, TException {
-    TableDescriptor describe = describe(table);
-    int shardCount = describe.shardCount;
+  private void waitForTheTableToEngage(String table) throws BlurException, TException {
+    TableDescriptor tableDescriptor = _clusterStatus.getTableDescriptor(false, table);
+    int shardCount = tableDescriptor.shardCount;
     LOG.info("Waiting for shards to engage on table [" + table + "]");
     while (true) {
       try {
@@ -144,7 +133,7 @@ public abstract class TableAdmin implements Iface {
         throw new BException("Unknown error while engaging table [" + table + "]", e);
       }
       try {
-        Map<String, String> shardServerLayout = shardServerLayout(table);
+        Map<String, String> shardServerLayout = getLayout();//shardServerLayout(table);
         LOG.info("Shards [" + shardServerLayout.size() + "/" + shardCount + "] of table [" + table + "] engaged");
         if (shardServerLayout.size() == shardCount) {
           return;
@@ -157,41 +146,32 @@ public abstract class TableAdmin implements Iface {
     }
   }
 
+  private Map<String, String> getLayout() throws BlurException, TException {
+    return null;
+  }
+
   @Override
   public final void removeTable(String table, boolean deleteIndexFiles) throws BlurException, TException {
     try {
-      String cluster = _clusterStatus.getCluster(false, table);
-      if (cluster == null) {
-        throw new BlurException("Table [" + table + "] not found.", null);
-      }
-      _clusterStatus.removeTable(cluster, table, deleteIndexFiles);
+      _clusterStatus.removeTable(table, deleteIndexFiles);
     } catch (Exception e) {
       LOG.error("Unknown error during remove of [table={0}]", e, table);
       throw new BException(e.getMessage(), e);
     }
   }
 
-  public boolean isTableEnabled(boolean useCache, String cluster, String table) {
-    return _clusterStatus.isEnabled(useCache, cluster, table);
-  }
-
   public void checkTable(String table) throws BlurException {
     if (table == null) {
       throw new BlurException("Table cannot be null.", null);
     }
-    String cluster = _clusterStatus.getCluster(true, table);
-    if (cluster == null) {
-      throw new BlurException("Table [" + table + "] does not exist", null);
-    }
-    checkTable(cluster, table);
-  }
-
-  public void checkTable(String cluster, String table) throws BlurException {
-    if (inSafeMode(true, table)) {
+    boolean inSafeMode = _clusterStatus.isInSafeMode(true);
+    if (inSafeMode) {
       throw new BlurException("Cluster for [" + table + "] is in safe mode", null);
     }
-    if (tableExists(true, cluster, table)) {
-      if (isTableEnabled(true, cluster, table)) {
+    boolean exists = _clusterStatus.exists(true, table);
+    if (exists) {
+      TableDescriptor tableDescriptor = _clusterStatus.getTableDescriptor(true, table);
+      if (tableDescriptor.isEnabled()) {
         return;
       }
       throw new BlurException("Table [" + table + "] exists, but is not enabled", null);
@@ -200,34 +180,19 @@ public abstract class TableAdmin implements Iface {
     }
   }
 
-  public void checkForUpdates(String table) throws BlurException {
-    String cluster = _clusterStatus.getCluster(true, table);
-    if (cluster == null) {
-      throw new BlurException("Table [" + table + "] does not exist", null);
-    }
-    checkForUpdates(cluster, table);
-  }
 
-  public void checkForUpdates(String cluster, String table) throws BlurException {
-    if (_clusterStatus.isReadOnly(true, cluster, table)) {
+  public void checkForUpdates(String table) throws BlurException {
+    TableDescriptor tableDescriptor = _clusterStatus.getTableDescriptor(true, table);
+    if (tableDescriptor.isReadOnly()) {
       throw new BlurException("Table [" + table + "] in cluster [" + cluster + "] is read only.", null);
     }
   }
 
-  @Override
-  public final List<String> controllerServerList() throws BlurException, TException {
-    try {
-      return _clusterStatus.getControllerServerList();
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get a controller list.", e);
-      throw new BException("Unknown error while trying to get a controller list.", e);
-    }
-  }
 
   @Override
-  public final List<String> shardServerList(String cluster) throws BlurException, TException {
+  public final List<String> serverList() throws BlurException, TException {
     try {
-      return _clusterStatus.getShardServerList(cluster);
+      return _clusterStatus.getServerList(true);
     } catch (Exception e) {
       LOG.error("Unknown error while trying to get a shard server list.", e);
       throw new BException("Unknown error while trying to get a shard server list.", e);
@@ -235,23 +200,9 @@ public abstract class TableAdmin implements Iface {
   }
 
   @Override
-  public final List<String> shardClusterList() throws BlurException, TException {
-    try {
-      return _clusterStatus.getClusterList(true);
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get a cluster list.", e);
-      throw new BException("Unknown error while trying to get a cluster list.", e);
-    }
-  }
-
-  @Override
   public final TableDescriptor describe(final String table) throws BlurException, TException {
     try {
-      String cluster = _clusterStatus.getCluster(true, table);
-      if (cluster == null) {
-        throw new BlurException("Table [" + table + "] not found.", null);
-      }
-      return _clusterStatus.getTableDescriptor(true, cluster, table);
+      return _clusterStatus.getTableDescriptor(true, table);
     } catch (Exception e) {
       LOG.error("Unknown error while trying to describe a table [" + table + "].", e);
       throw new BException("Unknown error while trying to describe a table [" + table + "].", e);
@@ -259,16 +210,6 @@ public abstract class TableAdmin implements Iface {
   }
 
   @Override
-  public final List<String> tableListByCluster(String cluster) throws BlurException, TException {
-    try {
-      return _clusterStatus.getTableList(true, cluster);
-    } catch (Exception e) {
-      LOG.error("Unknown error while trying to get a table list by cluster [" + cluster + "].", e);
-      throw new BException("Unknown error while trying to get a table list by cluster [" + cluster + "].", e);
-    }
-  }
-
-  @Override
   public final List<String> tableList() throws BlurException, TException {
     try {
       return _clusterStatus.getTableList(true);
@@ -278,18 +219,6 @@ public abstract class TableAdmin implements Iface {
     }
   }
 
-  private boolean inSafeMode(boolean useCache, String table) throws BlurException {
-    String cluster = _clusterStatus.getCluster(useCache, table);
-    if (cluster == null) {
-      throw new BlurException("Table [" + table + "] not found.", null);
-    }
-    return _clusterStatus.isInSafeMode(useCache, cluster);
-  }
-
-  public boolean tableExists(boolean useCache, String cluster, String table) {
-    return _clusterStatus.exists(useCache, cluster, table);
-  }
-
   public ClusterStatus getClusterStatus() {
     return _clusterStatus;
   }
@@ -305,9 +234,4 @@ public abstract class TableAdmin implements Iface {
   public void setConfiguration(BlurConfiguration config) {
     _configuration = config;
   }
-
-  @Override
-  public Map<String, String> configuration() throws BlurException, TException {
-    return _configuration.getProperties();
-  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
deleted file mode 100644
index 5c4b5d0..0000000
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package org.apache.blur.thrift;
-
-/**
- * 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 static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_BIND_ADDRESS;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_BIND_PORT;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_CACHE_MAX_QUERYCACHE_ELEMENTS;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_CACHE_MAX_TIMETOLIVE;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_HOSTNAME;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_REMOTE_FETCH_COUNT;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_DEFAULT_DELAY;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_FETCH_DELAY;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MAX_DEFAULT_DELAY;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MAX_DEFAULT_RETRIES;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MAX_FETCH_DELAY;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MAX_FETCH_RETRIES;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MAX_MUTATE_DELAY;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MAX_MUTATE_RETRIES;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_RETRY_MUTATE_DELAY;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_SERVER_REMOTE_THREAD_COUNT;
-import static org.apache.blur.utils.BlurConstants.BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT;
-import static org.apache.blur.utils.BlurConstants.BLUR_GUI_CONTROLLER_PORT;
-import static org.apache.blur.utils.BlurConstants.BLUR_GUI_SHARD_PORT;
-import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_BIND_PORT;
-import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_CONNECTION;
-import static org.apache.blur.utils.BlurConstants.BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE;
-import static org.apache.blur.utils.BlurUtil.quietClose;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.blur.BlurConfiguration;
-import org.apache.blur.concurrent.SimpleUncaughtExceptionHandler;
-import org.apache.blur.concurrent.ThreadWatcher;
-import org.apache.blur.gui.HttpJettyServer;
-import org.apache.blur.log.Log;
-import org.apache.blur.log.LogFactory;
-import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
-import org.apache.blur.manager.indexserver.BlurServerShutDown;
-import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown;
-import org.apache.blur.metrics.BlurMetrics;
-import org.apache.blur.thrift.generated.Blur;
-import org.apache.blur.thrift.generated.Blur.Iface;
-import org.apache.blur.thrift.generated.Blur.Processor;
-import org.apache.blur.utils.BlurUtil;
-import org.apache.blur.zookeeper.ZkUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.zookeeper.ZooKeeper;
-
-
-public class ThriftBlurControllerServer extends ThriftServer {
-
-  private static final Log LOG = LogFactory.getLog(ThriftBlurControllerServer.class);
-
-  public static void main(String[] args) throws Exception {
-    int serverIndex = getServerIndex(args);
-    LOG.info("Setting up Controller Server");
-    BlurConfiguration configuration = new BlurConfiguration();
-    ThriftServer server = createServer(serverIndex, configuration);
-    server.start();
-  }
-
-  public static ThriftServer createServer(int serverIndex, BlurConfiguration configuration) throws Exception {
-    Thread.setDefaultUncaughtExceptionHandler(new SimpleUncaughtExceptionHandler());
-    String bindAddress = configuration.get(BLUR_CONTROLLER_BIND_ADDRESS);
-    int bindPort = configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1);
-    bindPort += serverIndex;
-
-    LOG.info("Shard Server using index [{0}] bind address [{1}]", serverIndex, bindAddress + ":" + bindPort);
-
-    Configuration config = new Configuration();
-    BlurMetrics blurMetrics = new BlurMetrics(config);
-
-    String nodeName = ThriftBlurShardServer.getNodeName(configuration, BLUR_CONTROLLER_HOSTNAME);
-    nodeName = nodeName + ":" + bindPort;
-    String zkConnectionStr = isEmpty(configuration.get(BLUR_ZOOKEEPER_CONNECTION), BLUR_ZOOKEEPER_CONNECTION);
-
-    final ZooKeeper zooKeeper = ZkUtils.newZooKeeper(zkConnectionStr);
-    ZookeeperSystemTime.checkSystemTime(zooKeeper, configuration.getLong(BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE, 3000));
-
-    BlurUtil.setupZookeeper(zooKeeper);
-
-    final ZookeeperClusterStatus clusterStatus = new ZookeeperClusterStatus(zooKeeper);
-
-    BlurControllerServer.BlurClient client = new BlurControllerServer.BlurClientRemote();
-
-    final BlurControllerServer controllerServer = new BlurControllerServer();
-    controllerServer.setClient(client);
-    controllerServer.setClusterStatus(clusterStatus);
-    controllerServer.setZookeeper(zooKeeper);
-    controllerServer.setNodeName(nodeName);
-    controllerServer.setRemoteFetchCount(configuration.getInt(BLUR_CONTROLLER_REMOTE_FETCH_COUNT, 100));
-    controllerServer.setMaxQueryCacheElements(configuration.getInt(BLUR_CONTROLLER_CACHE_MAX_QUERYCACHE_ELEMENTS, 128));
-    controllerServer.setMaxTimeToLive(configuration.getLong(BLUR_CONTROLLER_CACHE_MAX_TIMETOLIVE, TimeUnit.MINUTES.toMillis(1)));
-    controllerServer.setThreadCount(configuration.getInt(BLUR_CONTROLLER_SERVER_REMOTE_THREAD_COUNT, 64));
-    controllerServer.setMaxFetchRetries(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_FETCH_RETRIES, 3));
-    controllerServer.setMaxMutateRetries(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_MUTATE_RETRIES, 3));
-    controllerServer.setMaxDefaultRetries(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_DEFAULT_RETRIES, 3));
-    controllerServer.setFetchDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_FETCH_DELAY, 500));
-    controllerServer.setMutateDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_MUTATE_DELAY, 500));
-    controllerServer.setDefaultDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_DEFAULT_DELAY, 500));
-    controllerServer.setMaxFetchDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_FETCH_DELAY, 2000));
-    controllerServer.setMaxMutateDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_MUTATE_DELAY, 2000));
-    controllerServer.setMaxDefaultDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_DEFAULT_DELAY, 2000));
-
-    controllerServer.init();
-
-    Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(blurMetrics, controllerServer, Iface.class);
-
-    int threadCount = configuration.getInt(BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT, 32);
-    
-    Processor<Iface> processor = new Blur.Processor<Iface>(iface);
-
-    final ThriftBlurControllerServer server = new ThriftBlurControllerServer();
-    server.setNodeName(nodeName);
-    server.setConfiguration(configuration);
-    server.setBindAddress(bindAddress);
-    server.setBindPort(bindPort);
-    server.setThreadCount(threadCount);
-    server.setProcessor(processor);
-
-    int baseGuiPort = Integer.parseInt(configuration.get(BLUR_GUI_CONTROLLER_PORT));
-    final HttpJettyServer httpServer;
-    if (baseGuiPort > 0) {
-      int webServerPort = baseGuiPort + serverIndex;
-      // TODO: this got ugly, there has to be a better way to handle all these
-      // params
-      // without reversing the mvn dependancy and making blur-gui on top.
-      httpServer = new HttpJettyServer(bindPort, webServerPort, configuration.getInt(BLUR_CONTROLLER_BIND_PORT, -1), configuration.getInt(BLUR_SHARD_BIND_PORT, -1),
-          configuration.getInt(BLUR_GUI_CONTROLLER_PORT, -1), configuration.getInt(BLUR_GUI_SHARD_PORT, -1), "controller", blurMetrics);
-    } else {
-      httpServer = null;
-    }
-
-    // This will shutdown the server when the correct path is set in zk
-    BlurShutdown shutdown = new BlurShutdown() {
-      @Override
-      public void shutdown() {
-        ThreadWatcher threadWatcher = ThreadWatcher.instance();
-        quietClose(server, controllerServer, clusterStatus, zooKeeper, threadWatcher, httpServer);
-      }
-    };
-    server.setShutdown(shutdown);
-    new BlurServerShutDown().register(shutdown, zooKeeper);
-    return server;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index 4d05a7f..79855f4 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -61,8 +61,9 @@ import org.apache.blur.store.blockcache.BlockDirectory;
 import org.apache.blur.store.blockcache.BlockDirectoryCache;
 import org.apache.blur.store.blockcache.Cache;
 import org.apache.blur.store.buffer.BufferStore;
-import org.apache.blur.thrift.generated.ShardServer.Iface;
-import org.apache.blur.thrift.generated.ShardServer.Processor;
+import org.apache.blur.thrift.generated.Blur.Iface;
+import org.apache.blur.thrift.generated.Blur.Processor;
+import org.apache.blur.utils.BlurConstants;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.blur.zookeeper.ZkUtils;
 import org.apache.hadoop.conf.Configuration;
@@ -161,7 +162,7 @@ public class ThriftBlurShardServer extends ThriftServer {
 
     BlurUtil.setupZookeeper(zooKeeper, configuration.get(BLUR_CLUSTER_NAME));
 
-    final ZookeeperClusterStatus clusterStatus = new ZookeeperClusterStatus(zooKeeper);
+    final ZookeeperClusterStatus clusterStatus = new ZookeeperClusterStatus(BlurConstants.BLUR_CLUSTER,zooKeeper);
 
     final BlurIndexRefresher refresher = new BlurIndexRefresher();
     refresher.init();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java b/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
index dd44bdf..38ea977 100644
--- a/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
+++ b/src/blur-core/src/main/java/org/apache/blur/thrift/lucene/Convert.java
@@ -8,7 +8,6 @@ import java.util.List;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
 import org.apache.blur.lucene.serializer.QueryWritable;
-import org.apache.blur.thrift.generated.DocLocation;
 import org.apache.blur.thrift.generated.Field;
 import org.apache.blur.thrift.generated.QueryArgs;
 import org.apache.blur.thrift.generated.ScoreDoc;
@@ -16,6 +15,7 @@ import org.apache.blur.thrift.generated.SortField;
 import org.apache.blur.thrift.generated.SortType;
 import org.apache.blur.thrift.generated.TYPE;
 import org.apache.blur.thrift.generated.TopFieldDocs;
+import org.apache.blur.utils.BlurUtil;
 import org.apache.hadoop.io.DataInputBuffer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.DoubleField;
@@ -37,9 +37,9 @@ import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.util.BytesRef;
 
 public class Convert {
-  
+
   private static final Log LOG = LogFactory.getLog(Convert.class);
-  
+
   public static TopFieldDocs toThrift(TopDocs topDocs) {
     return toThrift(new org.apache.lucene.search.TopFieldDocs(topDocs.totalHits, topDocs.scoreDocs, null, Float.NaN));
   }
@@ -48,7 +48,8 @@ public class Convert {
     if (scoreDoc == null) {
       return null;
     }
-    return new org.apache.lucene.search.ScoreDoc(scoreDoc.docLocation.doc, (float) scoreDoc.score, scoreDoc.docLocation.shardIndex);
+    long docLocation = scoreDoc.getDocLocation();
+    return new org.apache.lucene.search.ScoreDoc(BlurUtil.getDocumentId(docLocation), (float) scoreDoc.score, BlurUtil.getShardIndex(docLocation));
   }
 
   public static org.apache.blur.thrift.generated.Document toThrift(org.apache.lucene.document.Document document) {
@@ -141,14 +142,6 @@ public class Convert {
     return flip(ByteBuffer.allocate(4).putInt(val));
   }
 
-  public static List<DocLocation> toThrift(List<ScoreDoc> scoreDocs) {
-    List<DocLocation> result = new ArrayList<DocLocation>(scoreDocs.size());
-    for (ScoreDoc scoreDoc : scoreDocs) {
-      result.add(scoreDoc.getDocLocation());
-    }
-    return result;
-  }
-
   public static String toString(org.apache.blur.thrift.generated.Document document) {
     StringBuilder builder = new StringBuilder();
     builder.append('{');
@@ -269,7 +262,7 @@ public class Convert {
   public static Term toLucene(org.apache.blur.thrift.generated.Term term) {
     return new Term(term.getField(), new BytesRef(term.getBytes()));
   }
-  
+
   public static Term[] toLucene(org.apache.blur.thrift.generated.Term[] terms) {
     Term[] result = new Term[terms.length];
     for (int i = 0; i < terms.length; i++) {
@@ -277,7 +270,7 @@ public class Convert {
     }
     return result;
   }
-  
+
   public static List<Document> toLucene(List<org.apache.blur.thrift.generated.Document> documents) throws IOException {
     List<Document> docs = new ArrayList<Document>();
     for (org.apache.blur.thrift.generated.Document doc : documents) {
@@ -285,7 +278,7 @@ public class Convert {
     }
     return docs;
   }
-  
+
   public static Query[] toLucene(ByteBuffer[] queries) throws IOException {
     Query[] result = new Query[queries.length];
     for (int i = 0; i < queries.length; i++) {
@@ -293,11 +286,11 @@ public class Convert {
     }
     return result;
   }
-  
+
   public static Query toLucene(QueryArgs queryArgs) throws IOException {
     return toLuceneQuery(queryArgs.query);
   }
-  
+
   public static Query toLuceneQuery(ByteBuffer buf) throws IOException {
     DataInputBuffer in = new DataInputBuffer();
     in.reset(buf.array(), buf.arrayOffset(), buf.limit());
@@ -314,7 +307,7 @@ public class Convert {
   public static Sort toLuceneSort(QueryArgs queryArgs) {
     return null;
   }
-  
+
   public static TopFieldDocs toThrift(org.apache.lucene.search.TopFieldDocs topFieldDocs) {
     TopFieldDocs result = new TopFieldDocs();
     result.setFields(toThrift(topFieldDocs.fields));
@@ -372,7 +365,7 @@ public class Convert {
       return null;
     }
     ScoreDoc result = new ScoreDoc();
-    result.setDocLocation(new DocLocation(scoreDoc.doc, scoreDoc.shardIndex));
+    result.setDocLocation(BlurUtil.getDocLocation(scoreDoc.shardIndex,scoreDoc.doc));
     result.setScore(scoreDoc.score);
     return result;
   }
@@ -382,7 +375,7 @@ public class Convert {
       return null;
     }
     ScoreDoc result = new ScoreDoc();
-    result.setDocLocation(new DocLocation(fieldDoc.doc, fieldDoc.shardIndex));
+    result.setDocLocation(BlurUtil.getDocLocation(fieldDoc.shardIndex,fieldDoc.doc));
     result.setFields(convert(fieldDoc.fields));
     result.setScore(fieldDoc.score);
     return result;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java b/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
index 1a728f9..1fd2ff3 100644
--- a/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
+++ b/src/blur-core/src/main/java/org/apache/blur/utils/BlurUtil.java
@@ -496,4 +496,19 @@ public class BlurUtil {
     return Integer.parseInt(shard.substring(index + 1));
   }
 
+  public static int getShardIndex(long docLocation) {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public static int getDocumentId(long docLocation) {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
+  public static long getDocLocation(int shardIndex, int doc) {
+    // TODO Auto-generated method stub
+    return 0;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java b/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
index b6d0b86..70ec164 100644
--- a/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/manager/clusterstatus/ZookeeperClusterStatusTest.java
@@ -32,9 +32,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.blur.MiniCluster;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
-import org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
-import org.apache.blur.manager.clusterstatus.ZookeeperPathConstants;
-import org.apache.blur.thrift.generated.AnalyzerDefinition;
+import org.apache.blur.thrift.generated.Analyzer;
 import org.apache.blur.thrift.generated.TableDescriptor;
 import org.apache.blur.utils.BlurUtil;
 import org.apache.zookeeper.CreateMode;
@@ -202,12 +200,12 @@ public class ZookeeperClusterStatusTest {
   private void createTable(String name, boolean enabled) throws KeeperException, InterruptedException {
     TableDescriptor tableDescriptor = new TableDescriptor();
     tableDescriptor.setName(name);
-    tableDescriptor.setAnalyzerDefinition(new AnalyzerDefinition());
-    tableDescriptor.setTableUri(new File(TMPDIR, "zk_test_hdfs").getAbsolutePath());
-    tableDescriptor.setIsEnabled(enabled);
+    tableDescriptor.setAnalyzer(new Analyzer());
+    tableDescriptor.setStoragePath(new File(TMPDIR, "zk_test_hdfs").getAbsolutePath());
+    tableDescriptor.setEnabled(enabled);
     clusterStatus.createTable(tableDescriptor);
     if (enabled) {
-      clusterStatus.enableTable(tableDescriptor.getCluster(), name);
+      clusterStatus.enableTable(tableDescriptor.getClusterName(), name);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/test/java/org/apache/blur/search/RandomSuperQueryTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/search/RandomSuperQueryTest.java b/src/blur-core/src/test/java/org/apache/blur/search/RandomSuperQueryTest.java
index f5f8ca0..66d6c01 100644
--- a/src/blur-core/src/test/java/org/apache/blur/search/RandomSuperQueryTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/search/RandomSuperQueryTest.java
@@ -26,8 +26,8 @@ import java.util.HashSet;
 import java.util.Random;
 
 import org.apache.blur.analysis.BlurAnalyzer;
+import org.apache.blur.lucene.search.ScoreType;
 import org.apache.blur.lucene.search.SuperParser;
-import org.apache.blur.thrift.generated.ScoreType;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-core/src/test/java/org/apache/blur/search/SuperQueryTest.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/test/java/org/apache/blur/search/SuperQueryTest.java b/src/blur-core/src/test/java/org/apache/blur/search/SuperQueryTest.java
index a7e2f0d..a95cb82 100644
--- a/src/blur-core/src/test/java/org/apache/blur/search/SuperQueryTest.java
+++ b/src/blur-core/src/test/java/org/apache/blur/search/SuperQueryTest.java
@@ -24,8 +24,8 @@ import java.io.IOException;
 import java.util.concurrent.atomic.AtomicLongArray;
 
 import org.apache.blur.lucene.search.FacetQuery;
+import org.apache.blur.lucene.search.ScoreType;
 import org.apache.blur.lucene.search.SuperQuery;
-import org.apache.blur.thrift.generated.ScoreType;
 import org.apache.lucene.index.CorruptIndexException;
 import org.apache.lucene.index.DirectoryReader;
 import org.apache.lucene.index.IndexReader;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/aee531c2/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/AlternateColumnDefinition.java
----------------------------------------------------------------------
diff --git a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/AlternateColumnDefinition.java b/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/AlternateColumnDefinition.java
deleted file mode 100644
index ae347fb..0000000
--- a/src/blur-thrift/src/main/java/org/apache/blur/thrift/generated/AlternateColumnDefinition.java
+++ /dev/null
@@ -1,420 +0,0 @@
-/**
- * Autogenerated by Thrift Compiler (0.9.0)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.blur.thrift.generated;
-
-/**
- * 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 org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 
- */
-public class AlternateColumnDefinition implements org.apache.thrift.TBase<AlternateColumnDefinition, AlternateColumnDefinition._Fields>, java.io.Serializable, Cloneable {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AlternateColumnDefinition");
-
-  private static final org.apache.thrift.protocol.TField ANALYZER_CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("analyzerClassName", org.apache.thrift.protocol.TType.STRING, (short)1);
-
-  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new AlternateColumnDefinitionStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new AlternateColumnDefinitionTupleSchemeFactory());
-  }
-
-  /**
-   * 
-   */
-  public String analyzerClassName; // required
-
-  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    /**
-     * 
-     */
-    ANALYZER_CLASS_NAME((short)1, "analyzerClassName");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      switch(fieldId) {
-        case 1: // ANALYZER_CLASS_NAME
-          return ANALYZER_CLASS_NAME;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-  static {
-    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.ANALYZER_CLASS_NAME, new org.apache.thrift.meta_data.FieldMetaData("analyzerClassName", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AlternateColumnDefinition.class, metaDataMap);
-  }
-
-  public AlternateColumnDefinition() {
-  }
-
-  public AlternateColumnDefinition(
-    String analyzerClassName)
-  {
-    this();
-    this.analyzerClassName = analyzerClassName;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public AlternateColumnDefinition(AlternateColumnDefinition other) {
-    if (other.isSetAnalyzerClassName()) {
-      this.analyzerClassName = other.analyzerClassName;
-    }
-  }
-
-  public AlternateColumnDefinition deepCopy() {
-    return new AlternateColumnDefinition(this);
-  }
-
-  @Override
-  public void clear() {
-    this.analyzerClassName = null;
-  }
-
-  /**
-   * 
-   */
-  public String getAnalyzerClassName() {
-    return this.analyzerClassName;
-  }
-
-  /**
-   * 
-   */
-  public AlternateColumnDefinition setAnalyzerClassName(String analyzerClassName) {
-    this.analyzerClassName = analyzerClassName;
-    return this;
-  }
-
-  public void unsetAnalyzerClassName() {
-    this.analyzerClassName = null;
-  }
-
-  /** Returns true if field analyzerClassName is set (has been assigned a value) and false otherwise */
-  public boolean isSetAnalyzerClassName() {
-    return this.analyzerClassName != null;
-  }
-
-  public void setAnalyzerClassNameIsSet(boolean value) {
-    if (!value) {
-      this.analyzerClassName = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case ANALYZER_CLASS_NAME:
-      if (value == null) {
-        unsetAnalyzerClassName();
-      } else {
-        setAnalyzerClassName((String)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case ANALYZER_CLASS_NAME:
-      return getAnalyzerClassName();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case ANALYZER_CLASS_NAME:
-      return isSetAnalyzerClassName();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof AlternateColumnDefinition)
-      return this.equals((AlternateColumnDefinition)that);
-    return false;
-  }
-
-  public boolean equals(AlternateColumnDefinition that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_analyzerClassName = true && this.isSetAnalyzerClassName();
-    boolean that_present_analyzerClassName = true && that.isSetAnalyzerClassName();
-    if (this_present_analyzerClassName || that_present_analyzerClassName) {
-      if (!(this_present_analyzerClassName && that_present_analyzerClassName))
-        return false;
-      if (!this.analyzerClassName.equals(that.analyzerClassName))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  public int compareTo(AlternateColumnDefinition other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-    AlternateColumnDefinition typedOther = (AlternateColumnDefinition)other;
-
-    lastComparison = Boolean.valueOf(isSetAnalyzerClassName()).compareTo(typedOther.isSetAnalyzerClassName());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetAnalyzerClassName()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.analyzerClassName, typedOther.analyzerClassName);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("AlternateColumnDefinition(");
-    boolean first = true;
-
-    sb.append("analyzerClassName:");
-    if (this.analyzerClassName == null) {
-      sb.append("null");
-    } else {
-      sb.append(this.analyzerClassName);
-    }
-    first = false;
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    // check for sub-struct validity
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class AlternateColumnDefinitionStandardSchemeFactory implements SchemeFactory {
-    public AlternateColumnDefinitionStandardScheme getScheme() {
-      return new AlternateColumnDefinitionStandardScheme();
-    }
-  }
-
-  private static class AlternateColumnDefinitionStandardScheme extends StandardScheme<AlternateColumnDefinition> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, AlternateColumnDefinition struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // ANALYZER_CLASS_NAME
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.analyzerClassName = iprot.readString();
-              struct.setAnalyzerClassNameIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, AlternateColumnDefinition struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.analyzerClassName != null) {
-        oprot.writeFieldBegin(ANALYZER_CLASS_NAME_FIELD_DESC);
-        oprot.writeString(struct.analyzerClassName);
-        oprot.writeFieldEnd();
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class AlternateColumnDefinitionTupleSchemeFactory implements SchemeFactory {
-    public AlternateColumnDefinitionTupleScheme getScheme() {
-      return new AlternateColumnDefinitionTupleScheme();
-    }
-  }
-
-  private static class AlternateColumnDefinitionTupleScheme extends TupleScheme<AlternateColumnDefinition> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, AlternateColumnDefinition struct) throws org.apache.thrift.TException {
-      TTupleProtocol oprot = (TTupleProtocol) prot;
-      BitSet optionals = new BitSet();
-      if (struct.isSetAnalyzerClassName()) {
-        optionals.set(0);
-      }
-      oprot.writeBitSet(optionals, 1);
-      if (struct.isSetAnalyzerClassName()) {
-        oprot.writeString(struct.analyzerClassName);
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, AlternateColumnDefinition struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(1);
-      if (incoming.get(0)) {
-        struct.analyzerClassName = iprot.readString();
-        struct.setAnalyzerClassNameIsSet(true);
-      }
-    }
-  }
-
-}
-


Mime
View raw message