incubator-blur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron McCurry <amccu...@gmail.com>
Subject Re: git commit: Some console code cleanup
Date Mon, 23 Jun 2014 20:04:04 GMT
On Wed, Jun 18, 2014 at 8:20 AM, <crohr@apache.org> wrote:

> Repository: incubator-blur
> Updated Branches:
>   refs/heads/apache-blur-0.2 871f5260d -> 88a61dfd1
>
>
> Some console code cleanup
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/88a61dfd
> Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/88a61dfd
> Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/88a61dfd
>
> Branch: refs/heads/apache-blur-0.2
> Commit: 88a61dfd1e566575eb8fd085a07209ce36548f04
> Parents: 871f526
> Author: Chris Rohr <rohr.chris@gmail.com>
> Authored: Wed Jun 18 08:19:55 2014 -0400
> Committer: Chris Rohr <rohr.chris@gmail.com>
> Committed: Wed Jun 18 08:19:55 2014 -0400
>
> ----------------------------------------------------------------------
>  blur-console/checkstyle.xml                     | 135 +++++++++++++++++++
>  blur-console/pom.xml                            |  71 ++++++++--
>  .../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    |  47 +++----
>  .../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, 417 insertions(+), 341 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/checkstyle.xml
> ----------------------------------------------------------------------
> diff --git a/blur-console/checkstyle.xml b/blur-console/checkstyle.xml
> new file mode 100644
> index 0000000..81208b1
> --- /dev/null
> +++ b/blur-console/checkstyle.xml
> @@ -0,0 +1,135 @@
> +<?xml version="1.0"?>
> +<!-- Licensed to the Apache Software Foundation (ASF) under one or more
> contributor
> +       license agreements. See the NOTICE file distributed with this work
> for additional
> +       information regarding copyright ownership. The ASF licenses this
> file to
> +       you under the Apache License, Version 2.0 (the "License"); you may
> not use
> +       this file except in compliance with the License. You may obtain a
> copy of
> +       the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
> required
> +       by applicable law or agreed to in writing, software distributed
> under the
> +       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
> CONDITIONS
> +       OF ANY KIND, either express or implied. See the License for the
> specific
> +       language governing permissions and limitations under the License.
> -->
> +<!DOCTYPE module PUBLIC
> +        "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
> +        "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
> +
> +<module name="Checker">
> +    <!-- Checks whether files end with a new line.
>  -->
> +    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile
> -->
> +    <module name="NewlineAtEndOfFile"/>
> +
> +    <!-- Checks that property files contain the same keys.         -->
> +    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
> +    <module name="Translation"/>
> +
> +    <!-- Checks for Size Violations.                    -->
> +    <!-- See http://checkstyle.sf.net/config_sizes.html -->
> +    <module name="FileLength"/>
> +
> +    <!-- Checks for whitespace                               -->
> +    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
> +    <module name="FileTabCharacter"/>
> +
> +    <!-- Miscellaneous other checks.                   -->
> +    <!-- See http://checkstyle.sf.net/config_misc.html -->
> +    <module name="RegexpSingleline">
> +        <property name="format" value="\s+$"/>
> +        <property name="minimum" value="0"/>
> +        <property name="maximum" value="0"/>
> +        <property name="message" value="Line has trailing spaces."/>
> +    </module>
> +
> +    <module name="TreeWalker">
> +
> +        <!-- Checks for Naming Conventions.                  -->
> +        <!-- See http://checkstyle.sf.net/config_naming.html -->
> +        <module name="ConstantName"/>
> +        <module name="LocalFinalVariableName"/>
> +        <module name="LocalVariableName"/>
> +        <module name="MemberName"/>
> +        <module name="MethodName"/>
> +        <module name="PackageName"/>
> +        <module name="ParameterName"/>
> +        <module name="StaticVariableName"/>
> +        <module name="TypeName"/>
> +
> +        <!-- Checks for imports                              -->
> +        <!-- See http://checkstyle.sf.net/config_import.html -->
> +        <module name="AvoidStarImport"/>
> +        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
> +        <module name="RedundantImport"/>
> +        <module name="UnusedImports"/>
> +
> +
> +        <!-- Checks for Size Violations.                    -->
> +        <!-- See http://checkstyle.sf.net/config_sizes.html -->
> +        <module name="LineLength">
> +            <property name="max" value="120"/>
> +        </module>
> +        <module name="MethodLength"/>
> +        <module name="ParameterNumber"/>
> +
> +
> +        <!-- Checks for whitespace                               -->
> +        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
> +        <module name="EmptyForIteratorPad"/>
> +        <module name="GenericWhitespace"/>
> +        <module name="MethodParamPad"/>
> +        <module name="NoWhitespaceAfter"/>
> +        <module name="NoWhitespaceBefore"/>
> +        <module name="OperatorWrap"/>
> +        <module name="ParenPad"/>
> +        <module name="TypecastParenPad"/>
> +        <module name="WhitespaceAfter"/>
> +        <module name="WhitespaceAround"/>
> +
> +
> +        <!-- Modifier Checks                                    -->
> +        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
> +        <module name="ModifierOrder"/>
> +        <module name="RedundantModifier"/>
> +
> +
> +        <!-- Checks for blocks. You know, those {}'s         -->
> +        <!-- See http://checkstyle.sf.net/config_blocks.html -->
> +        <module name="AvoidNestedBlocks"/>
> +        <module name="EmptyBlock"/>
> +        <module name="LeftCurly"/>
> +        <module name="NeedBraces"/>
> +        <module name="RightCurly"/>
> +
> +
> +        <!-- Checks for common coding problems               -->
> +        <!-- See http://checkstyle.sf.net/config_coding.html -->
> +        <module name="AvoidInlineConditionals"/>
> +        <module name="EmptyStatement"/>
> +        <module name="EqualsHashCode"/>
> +        <module name="HiddenField">
> +            <property name="ignoreSetter" value="true"/>
> +            <property name="ignoreConstructorParameter" value="true"/>
> +        </module>
> +        <module name="IllegalInstantiation"/>
> +        <module name="InnerAssignment"/>
> +        <module name="MagicNumber"/>
> +        <module name="MissingSwitchDefault"/>
> +        <module name="RedundantThrows"/>
> +        <module name="SimplifyBooleanExpression"/>
> +        <module name="SimplifyBooleanReturn"/>
> +
> +        <!-- Checks for class design                         -->
> +        <!-- See http://checkstyle.sf.net/config_design.html -->
> +        <module name="FinalClass"/>
> +        <module name="HideUtilityClassConstructor"/>
> +        <module name="InterfaceIsType"/>
> +        <module name="VisibilityModifier"/>
> +
> +
> +        <!-- Miscellaneous other checks.                   -->
> +        <!-- See http://checkstyle.sf.net/config_misc.html -->
> +        <module name="ArrayTypeStyle"/>
> +        <module name="TodoComment"/>
> +        <module name="UpperEll"/>
> +
> +    </module>
> +
> +</module>
> \ No newline at end of file
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/pom.xml
> ----------------------------------------------------------------------
> diff --git a/blur-console/pom.xml b/blur-console/pom.xml
> index 6d16975..025a761 100644
> --- a/blur-console/pom.xml
> +++ b/blur-console/pom.xml
> @@ -1,13 +1,13 @@
>  <?xml version="1.0" encoding="UTF-8" ?>
> -<!-- 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
> +<!-- 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.
> -->
>  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> @@ -155,10 +155,61 @@
>                         <configuration>
>                           <configLocation>checkstyle.xml</configLocation>
>                         </configuration>
> -                     </plugin>
> +                   </plugin>
> +            <plugin>
> +                <groupId>org.apache.maven.plugins</groupId>
> +                <artifactId>maven-site-plugin</artifactId>
> +                <version>3.3</version>
> +            </plugin>
> +            <!--<plugin>-->
> +                <!--<groupId>org.codehaus.mojo</groupId>-->
> +                <!--<artifactId>cobertura-maven-plugin</artifactId>-->
> +                <!--<version>2.6</version>-->
> +                <!--<configuration>-->
> +                    <!--<instrumentation>-->
> +                        <!--<excludes>-->
> +
>  <!--<exclude>org/apache/blur/console/**/*Test.class</exclude>-->
> +                        <!--</excludes>-->
> +                    <!--</instrumentation>-->
> +                <!--</configuration>-->
> +                <!--<executions>-->
> +                    <!--<execution>-->
> +                        <!--<goals>-->
> +                            <!--<goal>clean</goal>-->
> +                        <!--</goals>-->
> +                    <!--</execution>-->
> +                <!--</executions>-->
> +            <!--</plugin>-->
>                 </plugins>
>         </build>
>
> +    <reporting>
> +        <plugins>
> +            <plugin>
> +                <groupId>org.apache.maven.plugins</groupId>
> +                <artifactId>maven-checkstyle-plugin</artifactId>
> +                <version>2.12.1</version>
> +                <configuration>
> +                    <configLocation>checkstyle.xml</configLocation>
> +                </configuration>
> +            </plugin>
> +            <plugin>
> +                <groupId>org.apache.maven.plugins</groupId>
> +                <artifactId>maven-surefire-plugin</artifactId>
> +            </plugin>
> +            <!--<plugin>-->
> +                <!--<groupId>org.codehaus.mojo</groupId>-->
> +                <!--<artifactId>cobertura-maven-plugin</artifactId>-->
> +                <!--<configuration>-->
> +                    <!--<formats>-->
> +                        <!--<format>html</format>-->
> +                        <!--<format>xml</format>-->
> +                    <!--</formats>-->
> +                <!--</configuration>-->
> +            <!--</plugin>-->
> +        </plugins>
> +    </reporting>
> +
>      <profiles>
>          <profile>
>              <id>hadoop-1x</id>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
> b/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
> index 07fccff..2bcb190 100644
> --- a/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
> +++ b/blur-console/src/main/java/org/apache/blur/console/JettyServer.java
> @@ -31,25 +31,26 @@ import org.mortbay.jetty.webapp.WebAppContext;
>  import java.net.URL;
>
>  public class JettyServer {
> -       private final static String DEV_WEBAPPDIR = "../classes/";
> -       private final static String PROD_WEBAPPDIR = "webapp/";
> -       private final static String CONTEXTPATH = "/console";
> -       private final Log log = LogFactory.getLog(JettyServer.class);
> -
>         private int port;
>         private Server server;
>         private boolean devMode;
> -
> +
> +    private static final String DEV_WEBAPPDIR = "../classes/";
> +    private static final String PROD_WEBAPPDIR = "webapp/";
> +    private static final String CONTEXTPATH = "/console";
> +
> +    private final Log log = LogFactory.getLog(JettyServer.class);
> +
>         public JettyServer(int port, boolean devMode) {
>                 this.port = port;
>                 this.devMode = devMode;
>         }
> -
> +
>         public JettyServer start() {
>                 createServer();
>                 return this;
>         }
> -
> +
>         public void join() {
>                 try {
>                         server.join();
> @@ -57,13 +58,18 @@ public class JettyServer {
>                         log.info("Server shutting down");
>                 }
>         }
> -
> +
>         private void createServer() {
>                 server = new Server(port);
> -
> +
>                 // for localhost:port/console/index.html and whatever else
> is in the webapp directory
> -           final URL warUrl = devMode ?
> this.getClass().getClassLoader().getResource(DEV_WEBAPPDIR) :
> this.getClass().getClassLoader().getResource(PROD_WEBAPPDIR);
> -           final String warUrlString = warUrl.toExternalForm();
> +           URL warUrl = null;
> +        if (devMode) {
> +            this.getClass().getClassLoader().getResource(DEV_WEBAPPDIR);
> +        } else {
> +            this.getClass().getClassLoader().getResource(PROD_WEBAPPDIR);
> +        }
> +           String warUrlString = warUrl.toExternalForm();
>

Pretty sure this bit of code has the warURL always be null and produce a
NPE.

Aaron


>             server.setHandler(new WebAppContext(warUrlString,
> CONTEXTPATH));
>
>             // for localhost:port/service/dashboard, etc.
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/model/ResultRow.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/model/ResultRow.java
> b/blur-console/src/main/java/org/apache/blur/console/model/ResultRow.java
> index d92597c..b8e4399 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/model/ResultRow.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/model/ResultRow.java
> @@ -24,15 +24,15 @@ import java.util.Map;
>  public class ResultRow {
>         private String rowid;
>         private List<Map<String, String>> records = new
> ArrayList<Map<String, String>>();
> -
> +
>         public ResultRow() {
> -
> +
>         }
> -
> +
>         public ResultRow(String rowid) {
>                 this.rowid = rowid;
>         }
> -
> +
>         public String getRowid() {
>                 return rowid;
>         }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/servlets/BaseConsoleServlet.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/servlets/BaseConsoleServlet.java
> b/blur-console/src/main/java/org/apache/blur/console/servlets/BaseConsoleServlet.java
> index 4f74966..86ba33a 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/servlets/BaseConsoleServlet.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/servlets/BaseConsoleServlet.java
> @@ -32,14 +32,15 @@ public abstract class BaseConsoleServlet extends
> HttpServlet {
>                 String body = e.getMessage();
>                 response.setContentType("application/json");
>                 response.setContentLength(body.getBytes().length);
> -               response.setStatus(500);
> +
> response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
>                 IOUtils.write(body, response.getOutputStream());
>         }
> -
> +
>         protected void sendGenericOk(HttpServletResponse response) throws
> IOException {
> +        String responseBody = "success";
>                 response.setContentType("text/plain");
> -               response.setContentLength(6);
> -               response.setStatus(200);
> -               IOUtils.write("success", response.getOutputStream());
> +               response.setContentLength(responseBody.getBytes().length);
> +               response.setStatus(HttpServletResponse.SC_OK);
> +               IOUtils.write(responseBody, response.getOutputStream());
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/servlets/NodesServlet.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/servlets/NodesServlet.java
> b/blur-console/src/main/java/org/apache/blur/console/servlets/NodesServlet.java
> index 31b77f2..2333bad 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/servlets/NodesServlet.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/servlets/NodesServlet.java
> @@ -34,13 +34,13 @@ public class NodesServlet extends BaseConsoleServlet {
>         private static final long serialVersionUID = 6522056391102413432L;
>
>         @Override
> -       protected void doGet(HttpServletRequest request,
> HttpServletResponse response) throws ServletException, IOException {
> -               String path = request.getPathInfo();
> +       protected void doGet(HttpServletRequest req, HttpServletResponse
> res) throws ServletException, IOException {
> +               String path = req.getPathInfo();
>                 if (path == null) {
> -                       sendNodeStatus(response);
> +                       sendNodeStatus(res);
>                 } else {
> -                       response.setStatus(404);
> -                       IOUtils.write("Route [" + path + "] doesn't
> exist", response.getOutputStream());
> +                       res.setStatus(HttpServletResponse.SC_NOT_FOUND);
> +                       IOUtils.write("Route [" + path + "] doesn't
> exist", res.getOutputStream());
>                 }
>         }
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/servlets/QueriesServlet.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/servlets/QueriesServlet.java
> b/blur-console/src/main/java/org/apache/blur/console/servlets/QueriesServlet.java
> index 8a9a30c..816d391 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/servlets/QueriesServlet.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/servlets/QueriesServlet.java
> @@ -37,21 +37,21 @@ public class QueriesServlet extends BaseConsoleServlet
> {
>         private static Pattern queryCancelPattern =
> Pattern.compile("/(.*)/cancel");
>
>         @Override
> -       protected void doGet(HttpServletRequest request,
> HttpServletResponse response) throws ServletException, IOException {
> -               String path = request.getPathInfo();
> +       protected void doGet(HttpServletRequest req, HttpServletResponse
> res) throws ServletException, IOException {
> +               String path = req.getPathInfo();
>                 Matcher m;
>                 if (path == null) {
> -                       sendQueries(response);
> +                       sendQueries(res);
>                 } else if ("/performance".equalsIgnoreCase(path)) {
> -                       sendCurrentQueryCount(response);
> +                       sendCurrentQueryCount(res);
>                 } else if ((m =
> queryCancelPattern.matcher(path)).matches()) {
> -                       cancelQuery(response, m.group(1),
> request.getParameter("table"));
> +                       cancelQuery(res, m.group(1),
> req.getParameter("table"));
>                 } else {
> -                       response.setStatus(404);
> -                       IOUtils.write("Route [" + path + "] doesn't
> exist", response.getOutputStream());
> +                       res.setStatus(HttpServletResponse.SC_NOT_FOUND);
> +                       IOUtils.write("Route [" + path + "] doesn't
> exist", res.getOutputStream());
>                 }
>         }
> -
> +
>         private void sendCurrentQueryCount(HttpServletResponse response)
> throws IOException {
>                 int count;
>                 try {
> @@ -62,10 +62,10 @@ public class QueriesServlet extends BaseConsoleServlet
> {
>                         sendError(response, e);
>                         return;
>                 }
> -
> +
>                 HttpUtil.sendResponse(response, new
> ObjectMapper().writeValueAsString(count), HttpUtil.JSON);
>         }
> -
> +
>         private void sendQueries(HttpServletResponse response) throws
> IOException {
>                 Map<String, Object> queries = new HashMap<String,
> Object>();
>                 try {
> @@ -76,10 +76,10 @@ public class QueriesServlet extends BaseConsoleServlet
> {
>                         sendError(response, e);
>                         return;
>                 }
> -
> +
>                 HttpUtil.sendResponse(response, new
> ObjectMapper().writeValueAsString(queries), HttpUtil.JSON);
>         }
> -
> +
>         private void cancelQuery(HttpServletResponse response, String
> uuid, String table) throws IOException {
>                 try {
>                         QueryUtil.cancelQuery(table, uuid);
> @@ -89,7 +89,7 @@ public class QueriesServlet extends BaseConsoleServlet {
>                         sendError(response, e);
>                         return;
>                 }
> -
> +
>                 sendGenericOk(response);
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/servlets/SearchServlet.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/servlets/SearchServlet.java
> b/blur-console/src/main/java/org/apache/blur/console/servlets/SearchServlet.java
> index c7abcef..cf64515 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/servlets/SearchServlet.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/servlets/SearchServlet.java
> @@ -35,28 +35,28 @@ public class SearchServlet extends BaseConsoleServlet {
>         private static final long serialVersionUID = 8236015799570635548L;
>
>         @Override
> -       protected void doPost(HttpServletRequest request,
> HttpServletResponse response) throws ServletException, IOException {
> -               String path = request.getPathInfo();
> +       protected void doPost(HttpServletRequest req, HttpServletResponse
> res) throws ServletException, IOException {
> +               String path = req.getPathInfo();
>                 if (path == null) {
> -                       String remoteHost = request.getRemoteHost();
> -                       sendSearch(response, request.getParameterMap(),
> remoteHost);
> +                       String remoteHost = req.getRemoteHost();
> +                       search(res, req.getParameterMap(), remoteHost);
>                 } else {
> -                       response.setStatus(404);
> -                       IOUtils.write("Route [" + path + "] doesn't
> exist", response.getOutputStream());
> +                       res.setStatus(HttpServletResponse.SC_NOT_FOUND);
> +                       IOUtils.write("Route [" + path + "] doesn't
> exist", res.getOutputStream());
>                 }
>         }
> -
> -       private void sendSearch(HttpServletResponse response, Map<String,
> String[]> params, String remoteHost) throws IOException {
> +
> +       private void search(HttpServletResponse res, Map<String, String[]>
> params, String remoteHost) throws IOException {
>                 Map<String, Object> results = new HashMap<String,
> Object>();
>                 try {
>                         results = SearchUtil.search(params, remoteHost);
>                 } catch (IOException e) {
>                         throw new IOException(e);
>                 } catch (Exception e) {
> -                       sendError(response, e);
> +                       sendError(res, e);
>                         return;
>                 }
> -
> -               HttpUtil.sendResponse(response, new
> ObjectMapper().writeValueAsString(results), HttpUtil.JSON);
> +
> +               HttpUtil.sendResponse(res, new
> ObjectMapper().writeValueAsString(results), HttpUtil.JSON);
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/servlets/TablesServlet.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/servlets/TablesServlet.java
> b/blur-console/src/main/java/org/apache/blur/console/servlets/TablesServlet.java
> index 13d8280..61983aa 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/servlets/TablesServlet.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/servlets/TablesServlet.java
> @@ -43,29 +43,29 @@ public class TablesServlet extends BaseConsoleServlet {
>         private static Pattern tableTermsPattern =
> Pattern.compile("/(.*)/(.*)/(.*)/terms");
>
>         @Override
> -       protected void doGet(HttpServletRequest request,
> HttpServletResponse response) throws ServletException, IOException {
> -               String path = request.getPathInfo();
> +       protected void doGet(HttpServletRequest req, HttpServletResponse
> res) throws ServletException, IOException {
> +               String path = req.getPathInfo();
>                 Matcher m;
>                 if (path == null) {
> -                       sendSummaries(response);
> +                       summary(res);
>                 } else if ((m =
> tableSchemaPattern.matcher(path)).matches()) {
> -                       sendSchema(response, m.group(1));
> +                       schema(res, m.group(1));
>                 } else if ((m =
> tableTermsPattern.matcher(path)).matches()) {
> -                       sendTerms(response, m.group(1), m.group(2),
> m.group(3), request.getParameter("startsWith"));
> +                       terms(res, m.group(1), m.group(2), m.group(3),
> req.getParameter("startsWith"));
>                 } else if ((m =
> tableEnablePattern.matcher(path)).matches()) {
> -                       enableTable(response, m.group(1));
> +                       enable(res, m.group(1));
>                 } else if ((m =
> tableDisablePattern.matcher(path)).matches()) {
> -                       disableTable(response, m.group(1));
> +                       disable(res, m.group(1));
>                 } else if ((m =
> tableDeletePattern.matcher(path)).matches()) {
> -                       deleteTable(response, m.group(1),
> request.getParameter("includeFiles"));
> +                       delete(res, m.group(1),
> req.getParameter("includeFiles"));
>                 } else {
> -                       response.setStatus(404);
> -                       IOUtils.write("Route [" + path + "] doesn't
> exist", response.getOutputStream());
> +                       res.setStatus(HttpServletResponse.SC_NOT_FOUND);
> +                       IOUtils.write("Route [" + path + "] doesn't
> exist", res.getOutputStream());
>                 }
>         }
> -
> +
>         @SuppressWarnings("rawtypes")
> -       private void sendSummaries(HttpServletResponse response) throws
> IOException {
> +       private void summary(HttpServletResponse response) throws
> IOException {
>                 Map<String, List> tableSummaries = new HashMap<String,
> List>();
>                 try {
>                         tableSummaries = TableUtil.getTableSummaries();
> @@ -75,11 +75,11 @@ public class TablesServlet extends BaseConsoleServlet {
>                         sendError(response, e);
>                         return;
>                 }
> -
> +
>                 HttpUtil.sendResponse(response, new
> ObjectMapper().writeValueAsString(tableSummaries), HttpUtil.JSON);
>         }
> -
> -       private void sendSchema(HttpServletResponse response, String
> table) throws IOException{
> +
> +       private void schema(HttpServletResponse response, String table)
> throws IOException {
>                 Object schema;
>                 try {
>                         schema = TableUtil.getSchema(table);
> @@ -89,25 +89,25 @@ public class TablesServlet extends BaseConsoleServlet {
>                         sendError(response, e);
>                         return;
>                 }
> -
> +
>                 HttpUtil.sendResponse(response, new
> ObjectMapper().writeValueAsString(schema), HttpUtil.JSON);
>         }
> -
> -       private void sendTerms(HttpServletResponse response, String table,
> String family, String column, String startsWith) throws IOException {
> +
> +       private void terms(HttpServletResponse res, String table, String
> family, String column, String startsWith) throws IOException {
>                 List<String> terms = new ArrayList<String>();
>                 try {
>                         terms = TableUtil.getTerms(table, family, column,
> startsWith);
>                 } catch (IOException e) {
>                         throw new IOException(e);
>                 } catch (Exception e) {
> -                       sendError(response, e);
> +                       sendError(res, e);
>                         return;
>                 }
> -
> -               HttpUtil.sendResponse(response, new
> ObjectMapper().writeValueAsString(terms), HttpUtil.JSON);
> +
> +               HttpUtil.sendResponse(res, new
> ObjectMapper().writeValueAsString(terms), HttpUtil.JSON);
>         }
> -
> -       private void enableTable(HttpServletResponse response, String
> table) throws IOException {
> +
> +       private void enable(HttpServletResponse response, String table)
> throws IOException {
>                 try {
>                         TableUtil.enableTable(table);
>                 } catch (IOException e) {
> @@ -118,8 +118,8 @@ public class TablesServlet extends BaseConsoleServlet {
>                 }
>                 sendGenericOk(response);
>         }
> -
> -       private void disableTable(HttpServletResponse response, String
> table) throws IOException {
> +
> +       private void disable(HttpServletResponse response, String table)
> throws IOException {
>                 try {
>                         TableUtil.disableTable(table);
>                 } catch (IOException e) {
> @@ -130,8 +130,8 @@ public class TablesServlet extends BaseConsoleServlet {
>                 }
>                 sendGenericOk(response);
>         }
> -
> -       private void deleteTable(HttpServletResponse response, String
> table, String includeFiles) throws IOException {
> +
> +       private void delete(HttpServletResponse response, String table,
> String includeFiles) throws IOException {
>                 try {
>                         TableUtil.deleteTable(table,
> Boolean.parseBoolean(includeFiles));
>                 } catch (IOException e) {
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/util/Config.java
> ----------------------------------------------------------------------
> diff --git
> 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
> index 784440b..2e092af 100644
> --- 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
> @@ -41,7 +41,8 @@ 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 final int DEFAULT_PORT = 8080;
> +
>         private static int port;
>         private static BlurConfiguration blurConfig;
>         private static ZookeeperClusterStatus zk;
> @@ -55,13 +56,13 @@ public class Config {
>         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");
> @@ -69,48 +70,48 @@ public class Config {
>                         } 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);
> +               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>>() {};
> +                       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 {
> @@ -125,8 +126,8 @@ public class Config {
>                         }
>                 }
>         }
> -
> -
> +
> +
>         @SuppressWarnings({ "unchecked", "rawtypes" })
>         public static void setupMiniCluster() throws IOException {
>             File testDirectory = new File(TMPDIR,
> "blur-cluster-test").getAbsoluteFile();
> @@ -135,7 +136,7 @@ public class Config {
>             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);
> @@ -146,14 +147,14 @@ public class Config {
>                 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;
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/util/HttpUtil.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/util/HttpUtil.java
> b/blur-console/src/main/java/org/apache/blur/console/util/HttpUtil.java
> index cdc8c41..1a9253b 100644
> --- a/blur-console/src/main/java/org/apache/blur/console/util/HttpUtil.java
> +++ b/blur-console/src/main/java/org/apache/blur/console/util/HttpUtil.java
> @@ -24,13 +24,13 @@ import javax.servlet.http.HttpServletResponse;
>  import org.apache.commons.io.IOUtils;
>
>  public class HttpUtil {
> -       public static String JSON = "application/json";
> -       public static String TEXT = "plain/text";
> -
> -       public static void sendResponse(HttpServletResponse response,
> String body, String contentType) throws IOException {
> -               response.setContentType(contentType);
> -               response.setContentLength(body.getBytes().length);
> -               response.setStatus(200);
> -               IOUtils.write(body, response.getOutputStream());
> +       public static final String JSON = "application/json";
> +       public static final String TEXT = "plain/text";
> +
> +       public static void sendResponse(HttpServletResponse res, String
> body, String contentType) throws IOException {
> +               res.setContentType(contentType);
> +               res.setContentLength(body.getBytes().length);
> +               res.setStatus(HttpServletResponse.SC_OK);
> +               IOUtils.write(body, res.getOutputStream());
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
> b/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
> index 8c20d42..4b59adb 100644
> --- a/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
> +++ b/blur-console/src/main/java/org/apache/blur/console/util/NodeUtil.java
> @@ -36,16 +36,16 @@ import
> org.apache.blur.manager.clusterstatus.ZookeeperClusterStatus;
>  import org.apache.commons.collections.CollectionUtils;
>
>  public class NodeUtil {
> -
> +
>         @SuppressWarnings("unchecked")
>         public static Map<String, Object> getControllerStatus() throws
> IOException {
>                 ZookeeperClusterStatus zk = Config.getZookeeper();
> -
> +
>                 List<String> allControllers = new ArrayList<String>();
>                 List<String> oControllers = new ArrayList<String>();
>                 allControllers = zk.getOnlineControllerList();
>                 oControllers = zk.getControllerServerList();
> -
> +
>                 Collection<String> onlineControllers =
> CollectionUtils.intersection(allControllers, oControllers);
>                 Collection<String> offlineControllers =
> CollectionUtils.subtract(allControllers, oControllers);
>
> @@ -53,14 +53,14 @@ public class NodeUtil {
>
>                 data.put("online", onlineControllers);
>                 data.put("offline", offlineControllers);
> -
> +
>                 return data;
>         }
>
>         public static List<Map<String, Object>> getClusterStatus() throws
> IOException {
>                 ZookeeperClusterStatus zk = Config.getZookeeper();
>
> -               List<Map<String, Object>> data = new
> ArrayList<Map<String,Object>>();
> +               List<Map<String, Object>> data = new ArrayList<Map<String,
> Object>>();
>                 List<String> clusters = zk.getClusterList(false);
>
>                 for (String cluster : clusters) {
> @@ -83,7 +83,7 @@ public class NodeUtil {
>                 String[] connections =
> Config.getBlurConfig().get("blur.zookeeper.connection").split(",");
>                 Set<String> onlineZookeepers = new HashSet<String>();
>                 Set<String> offlineZookeepers = new HashSet<String>();
> -
> +
>                 for (String connection : connections) {
>                         Socket socket = null;
>                         InputStream response = null;
> @@ -132,12 +132,12 @@ public class NodeUtil {
>                                 }
>                         }
>                 }
> -
> +
>                 Map<String, Object> data = new HashMap<String, Object>();
> -
> +
>                 data.put("online", onlineZookeepers);
>                 data.put("offline", offlineZookeepers);
> -
> +
>                 return data;
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/util/QueryUtil.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/util/QueryUtil.java
> b/blur-console/src/main/java/org/apache/blur/console/util/QueryUtil.java
> index a6c2041..6c6942f 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/util/QueryUtil.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/util/QueryUtil.java
> @@ -26,40 +26,39 @@ import java.util.Map;
>  import org.apache.blur.thirdparty.thrift_0_9_0.TException;
>  import org.apache.blur.thrift.BlurClient;
>  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.Status;
>
>  public class QueryUtil {
> -
> -       public static int getCurrentQueryCount() throws IOException,
> BlurException, TException {
> +
> +       public static int getCurrentQueryCount() throws IOException,
> TException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 int count = 0;
>                 List<String> tableList = client.tableList();
>                 for (String table : tableList) {
>                         List<String> queries =
> client.queryStatusIdList(table);
>                         count += queries.size();
>                 }
> -
> +
>                 return count;
>         }
> -
> -       public static Map<String, Object> getQueries() throws
> BlurException, TException, IOException {
> +
> +       public static Map<String, Object> getQueries() throws TException,
> IOException {
>                 Map<String, Object> queriesInfo = new HashMap<String,
> Object>();
> -
> +
>                 int slow = 0;
> -
> -               List<Map<String, Object>> queries = new
> ArrayList<Map<String,Object>>();
> -
> +
> +               List<Map<String, Object>> queries = new
> ArrayList<Map<String, Object>>();
> +
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
>                 List<String> tableList = client.tableList();
> -
> +
>                 for (String table : tableList) {
>                         List<String> queriesForTable =
> client.queryStatusIdList(table);
>                         for (String id : queriesForTable) {
>                                 BlurQueryStatus status =
> client.queryStatusById(table, id);
> -
> +
>                                 if
> (Status.FOUND.equals(status.getStatus())) {
>                                         Map<String, Object> info = new
> HashMap<String, Object>();
>                                         info.put("uuid", id);
> @@ -67,29 +66,29 @@ public class QueryUtil {
>                                         info.put("query",
> status.getQuery().getQuery().getQuery());
>                                         info.put("table", table);
>                                         info.put("state",
> status.getState().getValue());
> -                                       info.put("percent",
> ((double)status.getCompleteShards())/((double)status.getTotalShards())*100);
> -
> -
> +                                       info.put("percent", ((double)
> status.getCompleteShards()) / ((double) status.getTotalShards()) * 100);
> +
> +
>                                         long startTime =
> status.getQuery().getStartTime();
>                                         info.put("startTime", startTime);
>                                         queries.add(info);
> -
> +
>                                         if (System.currentTimeMillis() -
> startTime > 60000) {
>                                                 slow++;
>                                         }
>                                 }
>                         }
>                 }
> -
> +
>                 queriesInfo.put("slowQueries", slow);
>                 queriesInfo.put("queries", queries);
> -
> +
>                 return queriesInfo;
>         }
> -
> -       public static void cancelQuery(String table, String uuid) throws
> IOException, BlurException, TException {
> +
> +       public static void cancelQuery(String table, String uuid) throws
> IOException, TException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 client.cancelQuery(table, uuid);
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/util/SearchUtil.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/util/SearchUtil.java
> b/blur-console/src/main/java/org/apache/blur/console/util/SearchUtil.java
> index 8e5a8b8..f932bb2 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/util/SearchUtil.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/util/SearchUtil.java
> @@ -12,7 +12,6 @@ import java.util.TreeMap;
>  import org.apache.blur.console.model.ResultRow;
>  import org.apache.blur.thirdparty.thrift_0_9_0.TException;
>  import org.apache.blur.thrift.generated.Blur.Iface;
> -import org.apache.blur.thrift.generated.BlurException;
>  import org.apache.blur.thrift.generated.BlurQuery;
>  import org.apache.blur.thrift.generated.BlurResult;
>  import org.apache.blur.thrift.generated.BlurResults;
> @@ -49,64 +48,64 @@ public class SearchUtil {
>         private static final String TOTAL_KEY = "total";
>         private static final String DATA_KEY = "results";
>         private static final String FAMILY_KEY = "families";
> -
> +
>         private static final String ROW_ROW_OPTION = "rowrow";
>         private static final String RECORD_RECORD_OPTION = "recordrecord";
> -
> -       public static Map<String, Object> search(Map<String, String[]>
> params, String remoteHost) throws IOException, BlurException, TException {
> +
> +       public static Map<String, Object> search(Map<String, String[]>
> params, String remoteHost) throws IOException, TException {
>                 String table = params.get("table")[0];
>                 String query = params.get("query")[0];
>                 String rowQuery = params.get("rowRecordOption")[0];
>                 String start = params.get("start")[0];
>                 String fetch = params.get("fetch")[0];
>                 String[] families = params.get("families[]");
> -
> +
>                 if (query.indexOf("rowid:") >= 0) {
>                         return fetchRow(table, query, families,
> remoteHost);
>                 }
> -
> +
>                 if (families == null || families.length == 0) {
>                         return fullTextSearch(table, query, remoteHost);
>                 }
> -
> +
>                 return searchAndFetch(table, query, rowQuery, start,
> fetch, families, remoteHost);
>         }
> -
> +
>         @SuppressWarnings({ "unchecked", "rawtypes" })
> -       private static Map<String, Object> searchAndFetch(String table,
> String query, String rowQuery, String start, String fetch, String[]
> families, String remoteHost) throws IOException, BlurException, TException {
> +       private static Map<String, Object> searchAndFetch(String table,
> String query, String rowQuery, String start, String fetch, String[]
> families, String remoteHost) throws IOException, TException {
>                 try {
>                         Iface client = Config.getClient(remoteHost);
> -
> +
>                         boolean recordsOnly =
> RECORD_RECORD_OPTION.equalsIgnoreCase(rowQuery);
> -
> +
>                         BlurQuery blurQuery = new BlurQuery();
> -
> +
>                         Query q = new Query(query,
> ROW_ROW_OPTION.equalsIgnoreCase(rowQuery), ScoreType.SUPER, null, null);
>                         blurQuery.setQuery(q);
>                         blurQuery.setStart(Long.parseLong(start));
>                         blurQuery.setFetch(Integer.parseInt(fetch));
> -
> +
>                         Selector s = new Selector();
>                         s.setRecordOnly(recordsOnly);
>                         s.setColumnFamiliesToFetch(new
> HashSet<String>(Arrays.asList(families)));
>                         blurQuery.setSelector(s);
> -
> +
>                         BlurResults blurResults = client.query(table,
> blurQuery);
> -
> +
>                         Map<String, Object> results = new HashMap<String,
> Object>();
>                         results.put(TOTAL_KEY,
> blurResults.getTotalResults());
> -
> +
>                         Map<String, List> rows = new HashMap<String,
> List>();
>                         for (BlurResult result : blurResults.getResults())
> {
>                                 FetchResult fetchResult =
> result.getFetchResult();
> -
> +
>                                 if (recordsOnly) {
>                                         // Record Result
>                                         FetchRecordResult recordResult =
> fetchResult.getRecordResult();
>                                         Record record =
> recordResult.getRecord();
> -
> +
>                                         String family = record.getFamily();
> -
> +
>                                         List<Map<String, String>> fam =
> (List<Map<String, String>>) getFam(family, rows, recordsOnly);
>
> fam.add(buildRow(record.getColumns(), record.getRecordId()));
>                                 } else {
> @@ -114,14 +113,14 @@ public class SearchUtil {
>                                         FetchRowResult rowResult =
> fetchResult.getRowResult();
>                                         Row row = rowResult.getRow();
>                                         if (row.getRecords() == null ||
> row.getRecords().size() == 0) {
> -                                               for(String family :
> families) {
> +                                               for (String family :
> families) {
>                                                         List<ResultRow>
> fam = (List<ResultRow>) getFam(family, rows, recordsOnly);
>
> getRow(row.getId(), fam);
>                                                 }
>                                         } else {
>                                                 for (Record record :
> row.getRecords()) {
>                                                         String family =
> record.getFamily();
> -
> +
>                                                         List<ResultRow>
> fam = (List<ResultRow>) getFam(family, rows, recordsOnly);
>                                                         ResultRow rowData
> = getRow(row.getId(), fam);
>
> rowData.getRecords().add(buildRow(record.getColumns(),
> record.getRecordId()));
> @@ -129,26 +128,26 @@ public class SearchUtil {
>                                         }
>                                 }
>                         }
> -
> +
>                         results.put(FAMILY_KEY, new
> HashSet<String>(Arrays.asList(families)));
>                         results.put(DATA_KEY, rows);
> -
> +
>                         return results;
>                 } finally {
>                         UserContext.reset();
>                 }
>         }
> -
> -       private static Map<String, Object> fullTextSearch(String table,
> String query, String remoteHost) throws IOException, BlurException,
> TException {
> +
> +       private static Map<String, Object> fullTextSearch(String table,
> String query, String remoteHost) throws IOException, TException {
>                 try {
>                         Iface client = Config.getClient(remoteHost);
> -
> +
>                         BlurQuery blurQuery = new BlurQuery();
> -
> +
>                         Query q = new Query(query, true, ScoreType.SUPER,
> null, null);
>                         blurQuery.setQuery(q);
>                         BlurResults blurResults = client.query(table,
> blurQuery);
> -
> +
>                         Map<String, Object> results = new HashMap<String,
> Object>();
>                         results.put(TOTAL_KEY,
> blurResults.getTotalResults());
>                         return results;
> @@ -156,28 +155,28 @@ public class SearchUtil {
>                         UserContext.reset();
>                 }
>         }
> -
> +
>         @SuppressWarnings({ "unchecked", "rawtypes" })
> -       private static Map<String, Object> fetchRow(String table, String
> query, String[] families, String remoteHost) throws IOException,
> BlurException, TException {
> +       private static Map<String, Object> fetchRow(String table, String
> query, String[] families, String remoteHost) throws IOException, TException
> {
>                 try {
>                         Iface client = Config.getClient(remoteHost);
> -
> +
>                         Selector selector = new Selector();
>                         String rowid = StringUtils.remove(query, "rowid:");
>                         selector.setRowId(rowid);
>                         selector.setColumnFamiliesToFetch(new
> HashSet<String>(Arrays.asList(families)));
> -
> +
>                         FetchResult fetchRow = client.fetchRow(table,
> selector);
> -
> +
>                         Map<String, Object> results = new HashMap<String,
> Object>();
>                         results.put(TOTAL_KEY,
> fetchRow.getRowResult().getRow() == null ? 0 : 1);
> -
> +
>                         Map<String, List> rows = new HashMap<String,
> List>();
>                         Row row = fetchRow.getRowResult().getRow();
>                         if (row != null && row.getRecords() != null) {
>                                 for (Record record : row.getRecords()) {
>                                         String family = record.getFamily();
> -
> +
>                                         List<ResultRow> fam =
> (List<ResultRow>) getFam(family, rows, false);
>                                         ResultRow rowData =
> getRow(row.getId(), fam);
>
> rowData.getRecords().add(buildRow(record.getColumns(),
> record.getRecordId()));
> @@ -185,54 +184,54 @@ public class SearchUtil {
>                         }
>                         results.put(DATA_KEY, rows);
>                         results.put(FAMILY_KEY, new
> HashSet<String>(Arrays.asList(families)));
> -
> +
>                         return results;
>                 } finally {
>                         UserContext.reset();
>                 }
>         }
> -
> +
>         private static Map<String, String> buildRow(List<Column> columns,
> String recordid) {
>                 Map<String, String> map = new TreeMap<String, String>();
>                 map.put("recordid", recordid);
> -
> +
>                 for (Column column : columns) {
>                         map.put(column.getName(), column.getValue());
>                 }
> -
> +
>                 return map;
>         }
> -
> +
>         @SuppressWarnings("rawtypes")
>         private static List getFam(String fam, Map<String, List> results,
> boolean recordOnly) {
>                 List famResults = results.get(fam);
> -
> +
>                 if (famResults == null) {
>                         if (recordOnly) {
> -                               famResults = new ArrayList<Map<String,
> String>>();
> +                               famResults = new ArrayList<Map<String,
> String>>();
>                         } else {
>                                 famResults = new ArrayList<ResultRow>();
>                         }
>                         results.put(fam, famResults);
>                 }
> -
> +
>                 return famResults;
>         }
> -
> +
>         private static ResultRow getRow(String rowid, List<ResultRow>
> rows) {
>                 ResultRow row = null;
> -               for(ResultRow r : rows) {
> +               for (ResultRow r : rows) {
>                         if (r.getRowid().equals(rowid)) {
>                                 row = r;
>                                 break;
>                         }
>                 }
> -
> +
>                 if (row == null) {
>                         row = new ResultRow(rowid);
>                         rows.add(row);
>                 }
> -
> +
>                 return row;
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
> ----------------------------------------------------------------------
> diff --git
> a/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
> b/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
> index 4b12308..cec47aa 100644
> ---
> a/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
> +++
> b/blur-console/src/main/java/org/apache/blur/console/util/TableUtil.java
> @@ -27,37 +27,36 @@ import java.util.TreeMap;
>  import org.apache.blur.thirdparty.thrift_0_9_0.TException;
>  import org.apache.blur.thrift.BlurClient;
>  import org.apache.blur.thrift.generated.Blur.Iface;
> -import org.apache.blur.thrift.generated.BlurException;
>  import org.apache.blur.thrift.generated.ColumnDefinition;
>  import org.apache.blur.thrift.generated.Schema;
>  import org.apache.blur.thrift.generated.TableDescriptor;
>  import org.apache.blur.thrift.generated.TableStats;
>
>  public class TableUtil {
> -
> +
>         @SuppressWarnings("rawtypes")
> -       public static Map<String, List> getTableSummaries() throws
> IOException, BlurException, TException {
> +       public static Map<String, List> getTableSummaries() throws
> IOException, TException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 List<Map<String, Object>> summaries = new
> ArrayList<Map<String, Object>>();
> -
> +
>                 List<String> clusters = client.shardClusterList();
> -
> +
>                 for (String cluster : clusters) {
>                         List<String> tables =
> client.tableListByCluster(cluster);
>                         for (String table : tables) {
>                                 Map<String, Object> tableInfo = new
> HashMap<String, Object>();
>                                 TableDescriptor descriptor =
> client.describe(table);
> -
> +
>                                 tableInfo.put("cluster", cluster);
>                                 tableInfo.put("name", table);
>                                 tableInfo.put("enabled",
> descriptor.isEnabled());
> -
> +
>                                 if (descriptor.isEnabled()) {
>                                         TableStats stats =
> client.tableStats(table);
>                                         tableInfo.put("rows",
> stats.getRowCount());
>                                         tableInfo.put("records",
> stats.getRecordCount());
> -
> +
>                                         Schema schema =
> client.schema(table);
>                                         tableInfo.put("families", new
> ArrayList<String>(schema.getFamilies().keySet()));
>                                 } else {
> @@ -65,27 +64,27 @@ public class TableUtil {
>                                         tableInfo.put("records", "?");
>                                         tableInfo.put("families", new
> ArrayList<String>());
>                                 }
> -
> +
>                                 summaries.add(tableInfo);
>                         }
>                 }
> -
> +
>                 Map<String, List> data = new HashMap<String, List>();
>                 data.put("tables", summaries);
>                 data.put("clusters", clusters);
> -
> +
>                 return data;
>         }
> -
> -       public static Map<String, Map<String, Map<String, Object>>>
> getSchema(String table) throws IOException, BlurException, TException {
> +
> +       public static Map<String, Map<String, Map<String, Object>>>
> getSchema(String table) throws IOException, TException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 Schema schema = client.schema(table);
> -
> -               Map<String, Map<String, Map<String, Object>>> schemaInfo =
> new TreeMap<String, Map<String,Map<String, Object>>>();
> +
> +               Map<String, Map<String, Map<String, Object>>> schemaInfo =
> new TreeMap<String, Map<String, Map<String, Object>>>();
>                 for (Map.Entry<String, Map<String, ColumnDefinition>>
> famEntry : schema.getFamilies().entrySet()) {
>                         Map<String, Map<String, Object>> columns = new
> TreeMap<String, Map<String, Object>>();
> -                       for(Map.Entry<String, ColumnDefinition> colEntry :
> famEntry.getValue().entrySet()) {
> +                       for (Map.Entry<String, ColumnDefinition> colEntry
> : famEntry.getValue().entrySet()) {
>                                 Map<String, Object> info = new
> HashMap<String, Object>();
>                                 ColumnDefinition def = colEntry.getValue();
>                                 info.put("fieldLess",
> def.isFieldLessIndexed());
> @@ -95,29 +94,29 @@ public class TableUtil {
>                         }
>                         schemaInfo.put(famEntry.getKey(), columns);
>                 }
> -
> +
>                 return schemaInfo;
>         }
> -
> -       public static List<String> getTerms(String table, String family,
> String column, String startWith) throws IOException, BlurException,
> TException {
> +
> +       public static List<String> getTerms(String table, String family,
> String column, String startWith) throws IOException, TException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> -               return client.terms(table, family, column, startWith,
> (short)10);
> +
> +               return client.terms(table, family, column, startWith,
> (short) 10);
>         }
> -
> -       public static void disableTable(String table) throws
> BlurException, TException, IOException {
> +
> +       public static void disableTable(String table) throws TException,
> IOException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 client.disableTable(table);
>         }
> -       public static void enableTable(String table) throws BlurException,
> TException, IOException {
> +       public static void enableTable(String table) throws TException,
> IOException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 client.enableTable(table);
>         }
> -       public static void deleteTable(String table, boolean includeFiles)
> throws BlurException, TException, IOException {
> +       public static void deleteTable(String table, boolean includeFiles)
> throws TException, IOException {
>                 Iface client =
> BlurClient.getClient(Config.getConnectionString());
> -
> +
>                 client.removeTable(table, includeFiles);
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/88a61dfd/blur-console/src/main/resources/checkstyle.xml
> ----------------------------------------------------------------------
> diff --git a/blur-console/src/main/resources/checkstyle.xml
> b/blur-console/src/main/resources/checkstyle.xml
> deleted file mode 100644
> index 9667c40..0000000
> --- a/blur-console/src/main/resources/checkstyle.xml
> +++ /dev/null
> @@ -1,115 +0,0 @@
> -
> -<?xml version="1.0"?>
> -<!-- Licensed to the Apache Software Foundation (ASF) under one or more
> contributor
> -       license agreements. See the NOTICE file distributed with this work
> for additional
> -       information regarding copyright ownership. The ASF licenses this
> file to
> -       you under the Apache License, Version 2.0 (the "License"); you may
> not use
> -       this file except in compliance with the License. You may obtain a
> copy of
> -       the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
> required
> -       by applicable law or agreed to in writing, software distributed
> under the
> -       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
> CONDITIONS
> -       OF ANY KIND, either express or implied. See the License for the
> specific
> -       language governing permissions and limitations under the License.
> -->
> -<!DOCTYPE module PUBLIC
> -    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
> -    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
> -
> -<module name="Checker">
> -    <!-- Checks whether files end with a new line.
>  -->
> -    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile
> -->
> -    <module name="NewlineAtEndOfFile"/>
> -
> -    <!-- Checks that property files contain the same keys.         -->
> -    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
> -    <module name="Translation"/>
> -
> -
> -    <module name="TreeWalker">
> -
> -        <!-- Checks for Naming Conventions.                  -->
> -        <!-- See http://checkstyle.sf.net/config_naming.html -->
> -        <module name="ConstantName"/>
> -        <module name="LocalFinalVariableName"/>
> -        <module name="LocalVariableName"/>
> -        <module name="MemberName"/>
> -        <module name="MethodName"/>
> -        <module name="PackageName"/>
> -        <module name="ParameterName"/>
> -        <module name="StaticVariableName"/>
> -        <module name="TypeName"/>
> -
> -        <!-- Checks for imports                              -->
> -        <!-- See http://checkstyle.sf.net/config_import.html -->
> -        <module name="AvoidStarImport"/>
> -        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
> -        <module name="RedundantImport"/>
> -        <module name="UnusedImports"/>
> -
> -        <!-- Checks for Size Violations.                    -->
> -        <!-- See http://checkstyle.sf.net/config_sizes.html -->
> -        <module name="FileLength"/>
> -        <module name="LineLength"/>
> -        <module name="MethodLength"/>
> -        <module name="ParameterNumber"/>
> -
> -        <!-- Checks for whitespace                               -->
> -        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
> -        <module name="EmptyForIteratorPad">
> -               <property name="option" value="space" />
> -               </module>
> -        <module name="MethodParamPad"/>
> -        <module name="NoWhitespaceAfter"/>
> -        <module name="NoWhitespaceBefore"/>
> -        <module name="OperatorWrap"/>
> -        <module name="ParenPad"/>
> -        <module name="TypecastParenPad"/>
> -        <module name="WhitespaceAfter" />
> -        <module name="WhitespaceAround"/>
> -
> -        <!-- Modifier Checks                                    -->
> -        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
> -        <module name="ModifierOrder"/>
> -        <module name="RedundantModifier"/>
> -
> -        <!-- Checks for blocks. You know, those {}'s         -->
> -        <!-- See http://checkstyle.sf.net/config_blocks.html -->
> -        <module name="AvoidNestedBlocks"/>
> -        <module name="EmptyBlock"/>
> -        <module name="LeftCurly"/>
> -        <module name="NeedBraces"/>
> -        <module name="RightCurly"/>
> -
> -        <!-- Checks for common coding problems               -->
> -        <!-- See http://checkstyle.sf.net/config_coding.html -->
> -        <module name="DoubleCheckedLocking"/>
> -        <module name="EmptyStatement"/>
> -        <module name="EqualsHashCode"/>
> -        <module name="HiddenField"/>
> -        <module name="IllegalInstantiation"/>
> -        <module name="InnerAssignment"/>
> -        <module name="MagicNumber"/>
> -        <module name="MissingSwitchDefault"/>
> -        <module name="RedundantThrows"/>
> -        <module name="SimplifyBooleanExpression"/>
> -        <module name="SimplifyBooleanReturn"/>
> -
> -        <!-- Checks for class design                         -->
> -        <!-- See http://checkstyle.sf.net/config_design.html -->
> -        <module name="InterfaceIsType"/>
> -        <module name="VisibilityModifier"/>
> -
> -        <!-- Miscellaneous other checks.                   -->
> -        <!-- See http://checkstyle.sf.net/config_misc.html -->
> -        <module name="GenericIllegalRegexp">
> -            <property name="format" value="\s+$"/>
> -            <property name="message" value="Line has trailing spaces."/>
> -        </module>
> -        <module name="TodoComment"/>
> -        <module name="UpperEll"/>
> -
> -               <!-- Optional Checks -->
> -        <module name="usage.OneMethodPrivateField"/>
> -        <module name="usage.UnusedLocalVariable"/>
> -        <module name="usage.UnusedParameter"/>
> -    </module>
> -</module>
> \ No newline at end of file
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message