Merge branch 'apache-blur-0.2' of 
https://git-wip-us.apache.org/repos/asf/incubator-blur into apache-blur-0.2

Conflicts:
        blur-console/pom.xml
        blur-console/src/main/java/org/apache/blur/console/util/Config.java


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

Branch: refs/heads/apache-blur-0.2
Commit: cd2673f8a41dd43f30748109b47da167f1687f34
Parents: 397bc0d 88a61df
Author: Aaron McCurry <[email protected]>
Authored: Thu Jun 19 12:32:44 2014 -0400
Committer: Aaron McCurry <[email protected]>
Committed: Thu Jun 19 12:32:44 2014 -0400

----------------------------------------------------------------------
 blur-console/checkstyle.xml                     | 135 +++++++++++
 blur-console/pom.xml                            | 151 ++++++++----
 .../org/apache/blur/console/JettyServer.java    |  30 ++-
 .../apache/blur/console/model/ResultRow.java    |   8 +-
 .../console/servlets/BaseConsoleServlet.java    |  11 +-
 .../blur/console/servlets/NodesServlet.java     |  10 +-
 .../blur/console/servlets/QueriesServlet.java   |  26 +-
 .../blur/console/servlets/SearchServlet.java    |  22 +-
 .../blur/console/servlets/TablesServlet.java    |  54 ++---
 .../org/apache/blur/console/util/Config.java    | 235 ++++++++++---------
 .../org/apache/blur/console/util/HttpUtil.java  |  16 +-
 .../org/apache/blur/console/util/NodeUtil.java  |  18 +-
 .../org/apache/blur/console/util/QueryUtil.java |  43 ++--
 .../apache/blur/console/util/SearchUtil.java    |  93 ++++----
 .../org/apache/blur/console/util/TableUtil.java |  59 +++--
 blur-console/src/main/resources/checkstyle.xml  | 115 ---------
 16 files changed, 551 insertions(+), 475 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cd2673f8/blur-console/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/cd2673f8/blur-console/src/main/java/org/apache/blur/console/util/Config.java
----------------------------------------------------------------------
diff --cc blur-console/src/main/java/org/apache/blur/console/util/Config.java
index 59cc0f6,2e092af..20e37c8
--- a/blur-console/src/main/java/org/apache/blur/console/util/Config.java
+++ b/blur-console/src/main/java/org/apache/blur/console/util/Config.java
@@@ -39,126 -39,122 +39,127 @@@ import org.codehaus.jackson.map.ObjectM
  import org.codehaus.jackson.type.TypeReference;
  
  public class Config {
-   private static final File TMPDIR = new 
File(System.getProperty("blur.tmp.dir", "./target/mini-cluster"));
-   private static final Log log = LogFactory.getLog(Config.class);
- 
-   private static int port;
-   private static BlurConfiguration blurConfig;
-   private static ZookeeperClusterStatus zk;
-   private static String blurConnection;
-   private static Object cluster;
-   private static Map<String, String> globalUserProperties;
- 
-   public static int getConsolePort() {
-     return port;
-   }
- 
-   public static BlurConfiguration getBlurConfig() {
-     return blurConfig;
-   }
- 
-   public static void setupConfig() throws IOException {
-     if (cluster == null) {
-       blurConfig = new BlurConfiguration();
-     } else {
-       blurConfig = new BlurConfiguration(false);
- 
-       String zkConnection = "";
-       try {
-         Method zkMethod = 
cluster.getClass().getMethod("getZkConnectionString");
-         zkConnection = (String) zkMethod.invoke(cluster);
-       } catch (Exception e) {
-         log.fatal("Unable get zookeeper connection string", e);
-       }
- 
-       blurConfig.set("blur.zookeeper.connection", zkConnection);
-     }
-     zk = new 
ZookeeperClusterStatus(blurConfig.get("blur.zookeeper.connection"), blurConfig);
-     blurConnection = buildConnectionString();
-     port = blurConfig.getInt("blur.console.port", 8080);
-     parseSecurity();
-   }
- 
-   private static void parseSecurity() {
-     String securityFile = blurConfig.get("blur.console.security.file");
- 
-     if (securityFile != null) {
-       JsonFactory factory = new JsonFactory();
-       ObjectMapper mapper = new ObjectMapper(factory);
-       File from = new File(securityFile);
-       TypeReference<Map<String, String>> typeRef = new 
TypeReference<Map<String, String>>() {
-       };
- 
-       try {
-         globalUserProperties = mapper.readValue(from, typeRef);
-       } catch (Exception e) {
-         log.error("Unable to parse security file.  Search may not work 
right.", e);
-         globalUserProperties = null;
-       }
-     }
-   }
- 
-   public static String getConnectionString() throws IOException {
-     return blurConnection;
-   }
- 
-   public static ZookeeperClusterStatus getZookeeper() {
-     return zk;
-   }
 +
-   private static String buildConnectionString() {
-     List<String> allControllers = new ArrayList<String>();
-     allControllers = zk.getControllerServerList();
-     return StringUtils.join(allControllers, ",");
-   }
- 
-   public static void shutdownMiniCluster() throws IOException {
-     if (cluster != null) {
-       try {
-         Method method = cluster.getClass().getMethod("shutdownBlurCluster");
-         method.invoke(cluster);
-       } catch (Exception e) {
-         log.fatal("Unable to stop mini cluster through reflection.", e);
-       }
-       File file = new File(TMPDIR, "blur-cluster-test");
-       if (file.exists()) {
-         FileUtils.deleteDirectory(file);
-       }
-     }
-   }
+       private static final File TMPDIR = new 
File(System.getProperty("blur.tmp.dir", "./target/mini-cluster"));
+       private static final Log log = LogFactory.getLog(Config.class);
+     private static final int DEFAULT_PORT = 8080;
+ 
+       private static int port;
+       private static BlurConfiguration blurConfig;
+       private static ZookeeperClusterStatus zk;
+       private static String blurConnection;
+       private static Object cluster;
+       private static Map<String, String> globalUserProperties;
+ 
+       public static int getConsolePort() {
+               return port;
+       }
+       public static BlurConfiguration getBlurConfig() {
+               return blurConfig;
+       }
+ 
+       public static void setupConfig() throws IOException {
+               if (cluster == null) {
+                       blurConfig = new BlurConfiguration();
+               } else {
+                       blurConfig = new BlurConfiguration(false);
+ 
+                       String zkConnection = "";
+                       try {
+                               Method zkMethod = 
cluster.getClass().getMethod("getZkConnectionString");
+                               zkConnection = (String) 
zkMethod.invoke(cluster);
+                       } catch (Exception e) {
+                               log.fatal("Unable get zookeeper connection 
string", e);
+                       }
+ 
+                       blurConfig.set("blur.zookeeper.connection", 
zkConnection);
+               }
+               zk = new 
ZookeeperClusterStatus(blurConfig.get("blur.zookeeper.connection"), blurConfig);
+               blurConnection = buildConnectionString();
+               port = blurConfig.getInt("blur.console.port", DEFAULT_PORT);
+               parseSecurity();
+       }
+ 
+       private static void parseSecurity() {
+               String securityFile = 
blurConfig.get("blur.console.security.file");
+ 
+               if (securityFile != null) {
+                       JsonFactory factory = new JsonFactory();
+                   ObjectMapper mapper = new ObjectMapper(factory);
+                   File from = new File(securityFile);
+                   TypeReference<Map<String, String>> typeRef
+                           = new TypeReference<Map<String, String>>() { };
+ 
+                   try {
+                               globalUserProperties = mapper.readValue(from, 
typeRef);
+                       } catch (Exception e) {
+                               log.error("Unable to parse security file.  
Search may not work right.", e);
+                               globalUserProperties = null;
+                       }
+               }
+       }
+ 
+       public static String getConnectionString() throws IOException {
+               return blurConnection;
+       }
+ 
+       public static ZookeeperClusterStatus getZookeeper() {
+               return zk;
+       }
+ 
+       private static String buildConnectionString() {
+               List<String> allControllers = new ArrayList<String>();
+               allControllers = zk.getControllerServerList();
+               return StringUtils.join(allControllers, ",");
+       }
+ 
+       public static void shutdownMiniCluster() throws IOException {
+               if (cluster != null) {
+                       try {
+                               Method method = 
cluster.getClass().getMethod("shutdownBlurCluster");
+                               method.invoke(cluster);
+                       } catch (Exception e) {
+                               log.fatal("Unable to stop mini cluster through 
reflection.", e);
+                       }
+                       File file = new File(TMPDIR, "blur-cluster-test");
+                       if (file.exists()) {
+                               FileUtils.deleteDirectory(file);
+                       }
+               }
+       }
+ 
+ 
+       @SuppressWarnings({ "unchecked", "rawtypes" })
+       public static void setupMiniCluster() throws IOException {
+           File testDirectory = new File(TMPDIR, 
"blur-cluster-test").getAbsoluteFile();
+           testDirectory.mkdirs();
+ 
+           testDirectory.delete();
+           try {
+               Class clusterClass = 
Class.forName("org.apache.blur.MiniCluster", false, 
Config.class.getClassLoader());
+ 
+                   if (clusterClass != null) {
+                       cluster = clusterClass.newInstance();
+                       Method startBlurCluster = 
clusterClass.getDeclaredMethod("startBlurCluster", String.class, int.class, 
int.class, boolean.class);
+                       startBlurCluster.invoke(cluster, new 
File(testDirectory, "cluster").getAbsolutePath(), 2, 3, true);
+                   }
+           } catch (Exception e) {
+               log.fatal("Unable to start in dev mode because MiniCluster 
isn't in classpath", e);
+               cluster = null;
+           }
+       }
+ 
+       public static Iface getClient(String username) throws IOException {
+               Iface client = BlurClient.getClient(getConnectionString());
+ 
+               if (globalUserProperties != null) {
+                       UserContext.setUser(new User(username, 
globalUserProperties));
+               }
+ 
+               return client;
+       }
 +
 +  public static boolean isClusterSetup() {
 +    return cluster != null;
 +  }
- 
-   @SuppressWarnings({ "unchecked", "rawtypes" })
-   public static void setupMiniCluster() throws IOException {
-     File testDirectory = new File(TMPDIR, 
"blur-cluster-test").getAbsoluteFile();
-     testDirectory.mkdirs();
- 
-     testDirectory.delete();
-     try {
-       Class clusterClass = Class.forName("org.apache.blur.MiniCluster", 
false, Config.class.getClassLoader());
- 
-       if (clusterClass != null) {
-         cluster = clusterClass.newInstance();
-         Method startBlurCluster = 
clusterClass.getDeclaredMethod("startBlurCluster", String.class, int.class,
-             int.class, boolean.class);
-         startBlurCluster.invoke(cluster, new File(testDirectory, 
"cluster").getAbsolutePath(), 2, 3, true);
-       }
-     } catch (Exception e) {
-       log.fatal("Unable to start in dev mode because MiniCluster isn't in 
classpath", e);
-       cluster = null;
-     }
-   }
- 
-   public static Iface getClient(String username) throws IOException {
-     Iface client = BlurClient.getClient(getConnectionString());
- 
-     if (globalUserProperties != null) {
-       UserContext.setUser(new User(username, globalUserProperties));
-     }
- 
-     return client;
-   }
  }

Reply via email to