incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [4/4] git commit: Cleaning up old properties, properties file and adding a unit test to valid the default file with the BlurConstants class.
Date Tue, 03 Feb 2015 15:25:24 GMT
Cleaning up old properties, properties file and adding a unit test to valid the default file
with the BlurConstants class.


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

Branch: refs/heads/master
Commit: f8b2d435415a60ee8b429c7965ab2c42e87cfbc1
Parents: 17e0a79
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Feb 3 10:24:55 2015 -0500
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Feb 3 10:24:55 2015 -0500

----------------------------------------------------------------------
 .../blur/manager/AliasBlurFilterCache.java      | 14 +++-
 .../DistributedLayoutFactoryImpl.java           | 13 +--
 .../org/apache/blur/server/TableContext.java    |  4 +
 .../example/SimpleExampleServerSecurity.java    | 10 +--
 .../blur/thrift/ThriftBlurControllerServer.java |  6 +-
 .../blur/thrift/ThriftBlurShardServer.java      | 10 ++-
 .../java/org/apache/blur/gui/LogServlet.java    | 59 +-------------
 .../blur/lucene/fst/ByteArrayFactory.java       | 14 ++--
 .../store/BlockCacheDirectoryFactoryV2.java     |  5 +-
 .../java/org/apache/blur/user/UserContext.java  | 43 ++++++++--
 .../org/apache/blur/utils/BlurConstants.java    | 24 +++---
 .../src/main/resources/blur-default.properties  | 41 ++++++++--
 .../apache/blur/utils/BlurConstantsTest.java    | 85 ++++++++++++++++++++
 13 files changed, 213 insertions(+), 115 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-core/src/main/java/org/apache/blur/manager/AliasBlurFilterCache.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/AliasBlurFilterCache.java b/blur-core/src/main/java/org/apache/blur/manager/AliasBlurFilterCache.java
index 92491d0..11c492a 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/AliasBlurFilterCache.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/AliasBlurFilterCache.java
@@ -104,6 +104,10 @@ public class AliasBlurFilterCache extends BlurFilterCache {
     Map<String, String> properties = configuration.getProperties();
     for (Entry<String, String> entry : properties.entrySet()) {
       if (isFilterAlias(entry.getKey())) {
+        String value = entry.getValue();
+        if (value == null || value.isEmpty()) {
+          continue;
+        }
         String name = getFilterAlias(entry.getKey());
         int index = name.indexOf('.');
         String table = name.substring(0, index);
@@ -113,7 +117,8 @@ public class AliasBlurFilterCache extends BlurFilterCache {
           aliasFilterMap = new ConcurrentHashMap<String, String>();
           _tableAliasFilterMap.put(table, aliasFilterMap);
         }
-        aliasFilterMap.put(alias, entry.getValue());
+
+        aliasFilterMap.put(alias, value);
       }
     }
   }
@@ -160,8 +165,13 @@ public class AliasBlurFilterCache extends BlurFilterCache {
     Map<String, String> properties = _configuration.getProperties();
     for (Entry<String, String> entry : properties.entrySet()) {
       if (isFilterAlias(entry.getKey())) {
+        String value = entry.getValue();
+        if (value == null || value.isEmpty()) {
+          continue;
+        }
         String filterAlias = getFilterAlias(entry.getKey());
-        String filterQuery = entry.getValue();
+        String filterQuery = value;
+
         Map<String, String> map = getThisTablesMap(table);
         LOG.info("Loading filter alias [{0}] with query [{1}] for table [{2}]", filterAlias,
filterQuery, table);
         map.put(filterAlias, filterQuery);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedLayoutFactoryImpl.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedLayoutFactoryImpl.java
b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedLayoutFactoryImpl.java
index 6c06008..f0a2f9a 100644
--- a/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedLayoutFactoryImpl.java
+++ b/blur-core/src/main/java/org/apache/blur/manager/indexserver/DistributedLayoutFactoryImpl.java
@@ -16,8 +16,6 @@
  */
 package org.apache.blur.manager.indexserver;
 
-import static org.apache.blur.utils.BlurConstants.BLUR_SHARD_DISTRIBUTED_LAYOUT_FACTORY_CLASS;
-
 import org.apache.blur.BlurConfiguration;
 import org.apache.zookeeper.ZooKeeper;
 
@@ -25,16 +23,7 @@ public class DistributedLayoutFactoryImpl {
 
   public static DistributedLayoutFactory getDistributedLayoutFactory(BlurConfiguration configuration,
String cluster,
       ZooKeeper zooKeeper) {
-    String distributedLayoutFactoryClass = configuration.get(BLUR_SHARD_DISTRIBUTED_LAYOUT_FACTORY_CLASS,
"");
-    if (distributedLayoutFactoryClass.isEmpty()) {
-      return new MasterBasedDistributedLayoutFactory(zooKeeper, cluster);
-    }
-    try {
-      Class<?> clazz = Class.forName(distributedLayoutFactoryClass);
-      return (DistributedLayoutFactory) clazz.newInstance();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
+    return new MasterBasedDistributedLayoutFactory(zooKeeper, cluster);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-core/src/main/java/org/apache/blur/server/TableContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/TableContext.java b/blur-core/src/main/java/org/apache/blur/server/TableContext.java
index ef50bff..36b365b 100644
--- a/blur-core/src/main/java/org/apache/blur/server/TableContext.java
+++ b/blur-core/src/main/java/org/apache/blur/server/TableContext.java
@@ -235,6 +235,10 @@ public class TableContext implements Cloneable {
     TableDescriptor descriptor = tableContext._descriptor;
     for (Entry<String, String> entry : entrySet) {
       String key = entry.getKey();
+      String value = entry.getValue();
+      if (value == null || value.isEmpty()) {
+        continue;
+      }
       if (key.startsWith(BLUR_FIELDTYPE)) {
         String className = entry.getValue();
         descriptor.putToTableProperties(key, className);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-core/src/main/java/org/apache/blur/server/example/SimpleExampleServerSecurity.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/server/example/SimpleExampleServerSecurity.java
b/blur-core/src/main/java/org/apache/blur/server/example/SimpleExampleServerSecurity.java
index e6628ae..a0915f8 100644
--- a/blur-core/src/main/java/org/apache/blur/server/example/SimpleExampleServerSecurity.java
+++ b/blur-core/src/main/java/org/apache/blur/server/example/SimpleExampleServerSecurity.java
@@ -20,16 +20,16 @@ import java.lang.reflect.Method;
 import java.net.InetAddress;
 
 import org.apache.blur.BlurConfiguration;
-import org.apache.blur.server.ServerSecurity;
-import org.apache.blur.server.ServerSecurityFactory;
+import org.apache.blur.server.ServerSecurityFilter;
+import org.apache.blur.server.ServerSecurityFilterFactory;
 import org.apache.blur.thrift.generated.BlurException;
 import org.apache.blur.user.User;
 
-public class SimpleExampleServerSecurity extends ServerSecurityFactory {
+public class SimpleExampleServerSecurity extends ServerSecurityFilterFactory {
 
   @Override
-  public ServerSecurity getServerSecurity(ServerType server, BlurConfiguration configuration)
{
-    return new ServerSecurity() {
+  public ServerSecurityFilter getServerSecurity(ServerType server, BlurConfiguration configuration)
{
+    return new ServerSecurityFilter() {
       @Override
       public boolean canAccess(Method method, Object[] args, User user, InetAddress address,
int port) throws BlurException {
         if (method.getName().equals("createTable")) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
index 2e5bb20..1e328ef 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurControllerServer.java
@@ -65,8 +65,8 @@ import org.apache.blur.manager.indexserver.BlurServerShutDown;
 import org.apache.blur.manager.indexserver.BlurServerShutDown.BlurShutdown;
 import org.apache.blur.metrics.ReporterSetup;
 import org.apache.blur.server.ControllerServerEventHandler;
-import org.apache.blur.server.ServerSecurity;
-import org.apache.blur.server.ServerSecurityFactory;
+import org.apache.blur.server.ServerSecurityFilter;
+import org.apache.blur.server.ServerSecurityFilterFactory;
 import org.apache.blur.server.ServerSecurityUtil;
 import org.apache.blur.thirdparty.thrift_0_9_0.protocol.TJSONProtocol;
 import org.apache.blur.thirdparty.thrift_0_9_0.server.TServlet;
@@ -186,7 +186,7 @@ public class ThriftBlurControllerServer extends ThriftServer {
     Trace.setStorage(traceStorage);
     Trace.setNodeName(nodeName);
 
-    List<ServerSecurity> serverSecurity = getServerSecurityList(configuration, ServerSecurityFactory.ServerType.CONTROLLER);
+    List<ServerSecurityFilter> serverSecurity = getServerSecurityList(configuration,
ServerSecurityFilterFactory.ServerType.CONTROLLER);
 
     Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, controllerServer, false);
     iface = ServerSecurityUtil.applySecurity(iface, serverSecurity, false);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
index 5a0549a..e4233a2 100644
--- a/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
+++ b/blur-core/src/main/java/org/apache/blur/thrift/ThriftBlurShardServer.java
@@ -85,8 +85,8 @@ import org.apache.blur.manager.indexserver.DistributedLayoutFactory;
 import org.apache.blur.manager.indexserver.DistributedLayoutFactoryImpl;
 import org.apache.blur.metrics.JSONReporter;
 import org.apache.blur.metrics.ReporterSetup;
-import org.apache.blur.server.ServerSecurity;
-import org.apache.blur.server.ServerSecurityFactory;
+import org.apache.blur.server.ServerSecurityFilter;
+import org.apache.blur.server.ServerSecurityFilterFactory;
 import org.apache.blur.server.ServerSecurityUtil;
 import org.apache.blur.server.ShardServerEventHandler;
 import org.apache.blur.server.TableContext;
@@ -156,6 +156,10 @@ public class ThriftBlurShardServer extends ThriftServer {
     Set<Entry<String, String>> set = configuration.getProperties().entrySet();
     for (Entry<String, String> e : set) {
       String key = e.getKey();
+      String value = e.getValue();
+      if (value == null || value.isEmpty()) {
+        continue;
+      }
       if (key.startsWith("blur.shard.buffercache.")) {
         int index = key.lastIndexOf('.');
         int bufferSize = Integer.parseInt(key.substring(index + 1));
@@ -266,7 +270,7 @@ public class ThriftBlurShardServer extends ThriftServer {
     Trace.setStorage(traceStorage);
     Trace.setNodeName(nodeName);
 
-    List<ServerSecurity> serverSecurity = getServerSecurityList(configuration, ServerSecurityFactory.ServerType.SHARD);
+    List<ServerSecurityFilter> serverSecurity = getServerSecurityList(configuration,
ServerSecurityFilterFactory.ServerType.SHARD);
 
     Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, shardServer, true);
     iface = ServerSecurityUtil.applySecurity(iface, serverSecurity, true);

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
----------------------------------------------------------------------
diff --git a/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java b/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
index 47681ae..ff6ba5c 100644
--- a/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
+++ b/blur-status/src/main/java/org/apache/blur/gui/LogServlet.java
@@ -16,80 +16,27 @@ package org.apache.blur.gui;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.io.RandomAccessFile;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+@SuppressWarnings("serial")
 public class LogServlet extends HttpServlet {
 
-  private static final long serialVersionUID = 1L;
-  private String filePath = null;
-  private int buffLen = 8192;
+  private final String _filePath;
 
   public LogServlet(String filePath) {
-    this.filePath = filePath;
+    _filePath = filePath;
   }
 
   protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
-
     response.setContentType("text/html");
     PrintWriter out = response.getWriter();
 
-    File f = new File(filePath);
-    RandomAccessFile ram = new RandomAccessFile(f, "r");
-
-    String offsetStr = request.getParameter("offset");
-    long offset = -1;
-    if (offsetStr != null)
-      offset = Long.parseLong(offsetStr);
-
-    long start = 0;
-    long length = ram.length();
-    // figure out buffer
-    if (length < buffLen)
-      buffLen = new Long(length).intValue();
-
-    // use offset if passed in
-    if (offset >= 0)
-      start = offset;
-    else
-      start = length - buffLen;
-
-    // calc new offset
-    offset = start - buffLen;
-    if (offset < 0)
-      offset = 0;
-
-    // buffer
-    byte[] buff = new byte[buffLen];
-
-    ram.seek(start);
-    ram.read(buff);
-
-    String returnStr = new String(buff, "UTF-8").replaceAll("\n", "\n<br>");
-
-    out.write("<html><link href='style.css' rel='stylesheet' type='text/css' /><body>");
-    out.write("<a href='index.html'>home</a><br/>");
-    out.write("<p>File:<b> " + f.toString() + "</b> (" + start + "/" +
length + ")</p>");
-    if (start != 0) {
-      out.write("<a href='logs?offset=" + 0 + "'>start</a>");
-      out.write(" <a href='logs?offset=" + offset + "'>prev</a>");
-    }
-    if (start + buffLen < length) {
-      out.write(" <a href='logs?offset=" + (start + buffLen) + "'>next</a>");
-      out.write(" <a href='logs?offset=" + ((length - buffLen > 0) ? (length - buffLen)
: 0) + "'>end</a>");
-    }
-    out.write("<br/>");
-    out.write(returnStr);
-    out.write("</body></html>");
-
-    ram.close();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayFactory.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayFactory.java b/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayFactory.java
index ca298b8..ffbe872 100644
--- a/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayFactory.java
+++ b/blur-store/src/main/java/org/apache/blur/lucene/fst/ByteArrayFactory.java
@@ -43,16 +43,16 @@ public abstract class ByteArrayFactory {
         throw new RuntimeException();
       }
     }
-    ByteArrayFactory factory = new ByteArrayPrimitiveFactory(configuration);
+    ByteArrayFactory factory;
     try {
-      String className = configuration.get(BLUR_LUCENE_FST_BYTEARRAY_FACTORY);
-      if (!(className == null || className.isEmpty())) {
-        Class<?> clazz = Class.forName(className);
-        Constructor<?> constructor = clazz.getConstructor(new Class[] { BlurConfiguration.class
});
-        factory = (ByteArrayFactory) constructor.newInstance(new Object[] { configuration
});
-      }
+      String className = configuration
+          .get(BLUR_LUCENE_FST_BYTEARRAY_FACTORY, ByteArrayPrimitiveFactory.class.getName());
+      Class<?> clazz = Class.forName(className);
+      Constructor<?> constructor = clazz.getConstructor(new Class[] { BlurConfiguration.class
});
+      factory = (ByteArrayFactory) constructor.newInstance(new Object[] { configuration });
     } catch (Exception e) {
       LOG.error("Error while trying create new bytearray factory for lucene bytestore.",
e);
+      throw new RuntimeException(e);
     }
     _factory = factory;
   }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
b/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
index c1b6b72..265226e 100644
--- a/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
+++ b/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
@@ -70,8 +70,11 @@ public class BlockCacheDirectoryFactoryV2 extends BlockCacheDirectoryFactory
{
     Map<String, String> properties = configuration.getProperties();
     for (Entry<String, String> prop : properties.entrySet()) {
       String key = prop.getKey();
+      String value = prop.getValue();
+      if (value == null || value.isEmpty()) {
+        continue;
+      }
       if (key.startsWith(BLUR_SHARD_BLOCK_CACHE_V2_CACHE_BLOCK_SIZE_PREFIX)) {
-        String value = prop.getValue();
         int cacheBlockSizeForFile = Integer.parseInt(value);
         String fieldType = key.substring(BLUR_SHARD_BLOCK_CACHE_V2_CACHE_BLOCK_SIZE_PREFIX.length());
         

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-util/src/main/java/org/apache/blur/user/UserContext.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/user/UserContext.java b/blur-util/src/main/java/org/apache/blur/user/UserContext.java
index 0c3dd5f..6ae373b 100644
--- a/blur-util/src/main/java/org/apache/blur/user/UserContext.java
+++ b/blur-util/src/main/java/org/apache/blur/user/UserContext.java
@@ -16,21 +16,52 @@
  */
 package org.apache.blur.user;
 
+import java.util.HashMap;
+import java.util.Map;
 
 public class UserContext {
-  
-  private static ThreadLocal<User> _user = new ThreadLocal<User>();
-  
+
+  private static User _defaultUser;
+
+  static {
+    String username = System.getProperty("user.name");
+    _defaultUser = new User(username, null);
+  }
+
+  public static void setDefaultUser(User user) {
+    _defaultUser = copy(user);
+  }
+
+  public static User getDefaultUser() {
+    return copy(_defaultUser);
+  }
+
+  public static User copy(User user) {
+    Map<String, String> existingAttributes = user.getAttributes();
+    if (existingAttributes != null) {
+      Map<String, String> attributes = new HashMap<String, String>(existingAttributes);
+      return new User(user.getUsername(), attributes);
+    }
+    return new User(user.getUsername(), null);
+  }
+
+  private static ThreadLocal<User> _user = new ThreadLocal<User>() {
+    @Override
+    protected User initialValue() {
+      return getDefaultUser();
+    }
+  };
+
   public static void setUser(User user) {
     _user.set(user);
   }
-  
+
   public static User getUser() {
     return _user.get();
   }
-  
+
   public static void reset() {
-    setUser(null);
+    setUser(getDefaultUser());
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java
----------------------------------------------------------------------
diff --git a/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java b/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java
index 3655d0f..e14895d 100644
--- a/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java
+++ b/blur-util/src/main/java/org/apache/blur/utils/BlurConstants.java
@@ -42,26 +42,18 @@ public class BlurConstants {
   public static final String BLUR_SHARD_QUEUE_MAX_QUEUE_BATCH_SIZE = "blur.shard.queue.max.queue.batch.size";
   public static final String BLUR_SHARD_QUEUE_MAX_INMEMORY_LENGTH = "blur.shard.queue.max.inmemory.length";
 
-  // public static final String BLUR_TABLE_INDEX_QUEUE_READER_CLASS =
-  // "blur.table.index.queue.reader.class";
-  // public static final String BLUR_TABLE_INDEX_QUEUE_READER_BACKOFF =
-  // "blur.table.index.queue.reader.backoff";
-  // public static final String BLUR_TABLE_INDEX_QUEUE_READER_MAX =
-  // "blur.table.index.queue.reader.max";
-
   public static final String BLUR_RECORD_SECURITY = "blur.record.security";
   public static final String ACL_DISCOVER = "acl-discover";
   public static final String ACL_READ = "acl-read";
-  
 
   public static final String FAST_DECOMPRESSION = "FAST_DECOMPRESSION";
   public static final String FAST = "FAST";
   public static final String HIGH_COMPRESSION = "HIGH_COMPRESSION";
   public static final String BLUR_SHARD_INDEX_CHUNKSIZE = "blur.shard.index.chunksize";
   public static final String BLUR_SHARD_INDEX_COMPRESSIONMODE = "blur.shard.index.compressionmode";
-  public static final String BLUR_TABLE_PATH = "blur.table.path";
+
+  // public static final String BLUR_TABLE_PATH = "blur.table.path";
   public static final String BLUR_ZOOKEEPER_CONNECTION = "blur.zookeeper.connection";
-  public static final String BLUR_ZOOKEEPER_TRACE_PATH = "blur.zookeeper.trace.path";
   public static final String BLUR_HDFS_TRACE_PATH = "blur.hdfs.trace.path";
   public static final String BLUR_ZOOKEEPER_TIMEOUT = "blur.zookeeper.timeout";
   public static final int BLUR_ZOOKEEPER_TIMEOUT_DEFAULT = 30000;
@@ -97,12 +89,10 @@ public class BlurConstants {
   public static final String BLUR_SHARD_OPENER_THREAD_COUNT = "blur.shard.opener.thread.count";
   public static final String BLUR_SHARD_MERGE_THREAD_COUNT = "blur.shard.merge.thread.count";
   public static final String BLUR_SHARD_INDEX_DELETION_POLICY_MAXAGE = "blur.shard.index.deletion.policy.maxage";
-  public static final String BLUR_ZOOKEEPER_SYSTEM_TIME_TOLERANCE = "blur.zookeeper.system.time.tolerance";
   public static final String BLUR_SHARD_INDEX_SIMILARITY = "blur.shard.index.similarity";
   public static final String BLUR_SHARD_THRIFT_SELECTOR_THREADS = "blur.shard.thrift.selector.threads";
   public static final String BLUR_SHARD_THRIFT_MAX_READ_BUFFER_BYTES = "blur.shard.thrift.max.read.buffer.bytes";
   public static final String BLUR_SHARD_THRIFT_ACCEPT_QUEUE_SIZE_PER_THREAD = "blur.shard.thrift.accept.queue.size.per.thread";
-  public static final String BLUR_SHARD_DISTRIBUTED_LAYOUT_FACTORY_CLASS = "blur.shard.distributed.layout.factory.class";
   public static final String BLUR_SHARD_DEEP_PAGING_CACHE_SIZE = "blur.shard.deep.paging.cache.size";
 
   public static final String BLUR_SHARD_BLOCK_CACHE_V2_READ_CACHE_EXT = "blur.shard.block.cache.v2.read.cache.ext";
@@ -168,10 +158,16 @@ public class BlurConstants {
   public static final String BLUR_CONTROLLER_COMMAND_WORKER_THREADS = "blur.controller.command.worker.threads";
   public static final String BLUR_COMMAND_LIB_PATH = "blur.command.lib.path";
   public static final String BLUR_TMP_PATH = "blur.tmp.path";
-  
+
   public static final String BLUR_SECURITY_SASL_TYPE = "blur.security.sasl.type";
   public static final String BLUR_SECURITY_SASL_ENABLED = "blur.security.sasl.enabled";
-  public static final String BLUR_SERVER_SECURITY_CLASS = "blur.server.security.class";
+  public static final String BLUR_SECUTIRY_SASL_CUSTOM_CLASS = "blur.security.sasl.CUSTOM.class";
+
+  public static final String BLUR_SECURITY_SASL_LDAP_DOMAIN = "blur.security.sasl.LDAP.domain";
+  public static final String BLUR_SECURITY_SASL_LDAP_BASEDN = "blur.security.sasl.LDAP.basedn";
+  public static final String BLUR_SECURITY_SASL_LDAP_URL = "blur.security.sasl.LDAP.url";
+
+  public static final String BLUR_SERVER_SECURITY_FILTER_CLASS = "blur.server.security.filter.class.";
 
   public static final String BLUR_HOME = "BLUR_HOME";
 

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-util/src/main/resources/blur-default.properties
----------------------------------------------------------------------
diff --git a/blur-util/src/main/resources/blur-default.properties b/blur-util/src/main/resources/blur-default.properties
index f71c26c..720702f 100644
--- a/blur-util/src/main/resources/blur-default.properties
+++ b/blur-util/src/main/resources/blur-default.properties
@@ -13,6 +13,30 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+# Enable SASL authentication.
+blur.security.sasl.enabled=false
+
+# The SASL authentication type.  Choices are ANONYMOUS, LDAP, CUSTOM.
+blur.security.sasl.type=
+
+# If SASL type is LDAP specify the ldap domain.
+blur.security.sasl.LDAP.domain=
+
+# If SASL type is LDAP specify the ldap base dn.
+blur.security.sasl.LDAP.basedn=
+
+# If SASL type is LDAP specify the ldap url.
+blur.security.sasl.LDAP.url=
+
+# If SASL type is CUSTOM specify the custom authentication class.
+blur.security.sasl.CUSTOM.class=
+
+# Specifies a security filter factory that allows for controlling access to method calls
on the server, this is similar to database object security. Implement 'org.apache.blur.server.ServerSecurityFilterFactory'
and add class name in config like 'blur.server.security.filter.class.1=mysecurity.Filter1'.
NOTE: Many filters can be specified and they are checked in lexicographical order based on
the property name.
+blur.server.security.filter.class.<order>=
+
+# Enables/disables record level security.
+blur.record.security=false
+
 # The zookeeper session timeout
 blur.zookeeper.timeout=90000
 
@@ -44,10 +68,10 @@ blur.metrics.reporters=
 blur.thrift.max.frame.size=16384000
 
 # The command lib path where the controller and shard server processes will poll for new
commands to enable.
-# blur.command.lib.path=
+blur.command.lib.path=
 
 # The command lib path where the controller and shard server processes will poll for new
commands to enable.
-# blur.tmp.path=
+blur.tmp.path=
 
 ### Shard Server Configuration
 
@@ -115,8 +139,7 @@ blur.shard.block.cache.v2.fileBufferSize=8192
 blur.shard.block.cache.v2.cacheBlockSize=8192
 
 # v2 version of block cache only. Specific files type can have their own block cache sizes,
such as filter files that should have a very large mapping. 
-#blur.shard.block.cache.v2.cacheBlockSize.<ext>=
-blur.shard.block.cache.v2.cacheBlockSize.filter=33554432
+blur.shard.block.cache.v2.cacheBlockSize.<ext>=
 
 # v2 version of block cache only. This is used to control if the block are created on or
off heap.  Values are OFF_HEAP | ON_HEAP
 blur.shard.block.cache.v2.store=OFF_HEAP
@@ -181,6 +204,12 @@ blur.indexmanager.mutate.thread.count=8
 # The number of thread used for parallel faceting in the index manager
 blur.indexmanager.facet.thread.count=8
 
+# The default index deletion policy class that manages removing old segments that are no
longer referenced.
+blur.shard.index.deletion.policy.maxage=org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy
+
+# The default index similarity object used for both indexing and searching.
+blur.shard.index.similarity=org.apache.blur.lucene.search.FairSimilarity
+
 # The fetch count per Lucene search, this fetches pointers to hits
 blur.shard.fetchcount=110
 
@@ -197,13 +226,13 @@ blur.gui.shard.port=40090
 blur.shard.filtered.server.class=
 
 # Defines the blur index class to be used to handle index requests.  This class has to extend
org.apache.blur.manager.writer.BlurIndex.  This can be defined globally as well as per table.
-blur.shard.blurindex.class=
+blur.shard.blurindex.class=org.apache.blur.manager.writer.BlurIndexSimpleWriter
 
 # Defines the blur read interceptor class that can mask data from query results as well as
data fetches.
 blur.shard.read.interceptor=
 
 # Defines the byte array factory class that blur will use to manage the FST trees in Lucene
(extends org.apache.blur.lucene.fst.ByteArrayFactory).
-blur.lucene.fst.bytearray.factory=
+blur.lucene.fst.bytearray.factory=org.apache.blur.lucene.fst.ByteArrayPrimitiveFactory
 
 # The maximum amount of time to pause before checking the queue for RowMutations.
 blur.shard.queue.max.pause.time.when.empty=1000

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/f8b2d435/blur-util/src/test/java/org/apache/blur/utils/BlurConstantsTest.java
----------------------------------------------------------------------
diff --git a/blur-util/src/test/java/org/apache/blur/utils/BlurConstantsTest.java b/blur-util/src/test/java/org/apache/blur/utils/BlurConstantsTest.java
new file mode 100644
index 0000000..da4d350
--- /dev/null
+++ b/blur-util/src/test/java/org/apache/blur/utils/BlurConstantsTest.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.blur.utils;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.blur.BlurConfiguration;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BlurConstantsTest {
+
+  private Set<String> _nonPropertyConstants;
+  private Set<String> _emptyDefaultProperties;
+
+  @Before
+  public void setup() {
+    _nonPropertyConstants = new HashSet<String>();
+    _nonPropertyConstants.addAll(Arrays.asList("CONTROLLER", "SHARD", "SHARD_PREFIX", "PRIME_DOC",
"PRIME_DOC_VALUE",
+        "ROW_ID", "RECORD_ID", "FIELDS", "FAMILY", "DEFAULT_FAMILY", "SUPER", "SEP", "BLUR_HOME",
+        "DELETE_MARKER_VALUE", "DELETE_MARKER", "BLUR_ZOOKEEPER_TIMEOUT_DEFAULT", "BLUR_THRIFT_DEFAULT_MAX_FRAME_SIZE",
+        "ZK_WAIT_TIME", "ACL_DISCOVER", "ACL_READ", "FAST_DECOMPRESSION", "FAST", "HIGH_COMPRESSION",
"DEFAULT_VALUE",
+        "OFF_HEAP", "DEFAULT", "BLUR_CLUSTER", "BLUR_HTTP_STATUS_RUNNING_PORT", "SHARED_MERGE_SCHEDULER_PREFIX"));
+    _emptyDefaultProperties = new HashSet<String>();
+    _emptyDefaultProperties.addAll(Arrays.asList("BLUR_HDFS_TRACE_PATH", "BLUR_SHARD_HOSTNAME",
+        "BLUR_SHARD_BLOCK_CACHE_TOTAL_SIZE", "BLUR_CONTROLLER_HOSTNAME", "BLUR_SHARD_READ_INTERCEPTOR",
+        "BLUR_SHARD_BLOCK_CACHE_V2_READ_CACHE_EXT", "BLUR_SHARD_BLOCK_CACHE_V2_WRITE_CACHE_EXT",
+        "BLUR_SHARD_BLOCK_CACHE_V2_CACHE_BLOCK_SIZE_PREFIX", "BLUR_FIELDTYPE", "BLUR_SHARD_FILTERED_SERVER_CLASS",
+        "BLUR_CONTROLLER_FILTERED_SERVER_CLASS", "BLUR_COMMAND_LIB_PATH", "BLUR_TMP_PATH",
"BLUR_SECURITY_SASL_TYPE",
+        "BLUR_SECUTIRY_SASL_CUSTOM_CLASS", "BLUR_SECURITY_SASL_LDAP_DOMAIN", "BLUR_SECURITY_SASL_LDAP_BASEDN",
+        "BLUR_SECURITY_SASL_LDAP_URL", "BLUR_SERVER_SECURITY_FILTER_CLASS", "BLUR_FILTER_ALIAS"));
+  }
+
+  @Test
+  public void test() throws IllegalArgumentException, IllegalAccessException, IOException
{
+    BlurConfiguration blurConfiguration = new BlurConfiguration();
+    Field[] declaredFields = BlurConstants.class.getDeclaredFields();
+
+    String string = blurConfiguration.get("blur.shard.block.cache.v2.cacheBlockSize.<ext>");
+    System.out.println("[" + string + "]");
+    String string2 = blurConfiguration.getProperties().get("blur.shard.block.cache.v2.cacheBlockSize.<ext>");
+    System.out.println("[" + string2 + "]");
+
+    for (Field field : declaredFields) {
+      String constantName = field.getName();
+      if (_nonPropertyConstants.contains(constantName)) {
+        continue;
+      }
+      Object propertyName = field.get(null);
+      if (propertyName instanceof String) {
+        String propertyNameStr = propertyName.toString();
+        String value = blurConfiguration.get(propertyNameStr);
+        if (_emptyDefaultProperties.contains(constantName)) {
+          assertNull(constantName + "=>" + propertyNameStr, value);
+        } else {
+          assertNotNull(constantName + "=>" + propertyNameStr, value);
+        }
+      } else {
+        fail(constantName);
+      }
+    }
+  }
+}


Mime
View raw message