From ff4aac71c3921d9258f84e35951fe6ea380588eb Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 15 Jan 2008 05:14:34 +0000 Subject: [PATCH] HADOOP-2589 Change an classes/package name from shell to hql git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@612016 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 + build.xml | 10 +-- conf/hbase-default.xml | 2 +- src/java/org/apache/hadoop/hbase/Shell.java | 38 ++++-------- .../hbase/generated/master/hql_jsp.java | 12 ++-- .../hbase/generated/master/master_jsp.java | 8 +-- .../hbase/{shell => hql}/AlterCommand.java | 2 +- .../hbase/{shell => hql}/BasicCommand.java | 2 +- .../hbase/{shell => hql}/ClearCommand.java | 2 +- .../hadoop/hbase/{shell => hql}/Command.java | 2 +- .../hbase/{shell => hql}/CommandFactory.java | 2 +- .../hbase/{shell => hql}/CreateCommand.java | 2 +- .../hbase/{shell => hql}/DeleteCommand.java | 2 +- .../hbase/{shell => hql}/DescCommand.java | 2 +- .../hbase/{shell => hql}/DisableCommand.java | 2 +- .../hbase/{shell => hql}/DropCommand.java | 2 +- .../hbase/{shell => hql}/EnableCommand.java | 2 +- .../hbase/{shell => hql}/ExitCommand.java | 2 +- .../hbase/{shell => hql}/ExitException.java | 2 +- .../hbase/{shell => hql}/FsCommand.java | 2 +- .../apache/hadoop/hbase/hql/HQLClient.java | 62 +++++++++++++++++++ .../{shell/HBaseShell.jj => hql/HQLParser.jj} | 13 ++-- .../HQLSecurityManager.java} | 4 +- .../hbase/{shell => hql}/HelpCommand.java | 2 +- .../hbase/{shell => hql}/InsertCommand.java | 2 +- .../hbase/{shell => hql}/JarCommand.java | 2 +- .../hbase/{shell => hql}/ReturnMsg.java | 2 +- .../SchemaModificationCommand.java | 2 +- .../hbase/{shell => hql}/SelectCommand.java | 6 +- .../hbase/{shell => hql}/ShowCommand.java | 2 +- .../hbase/{shell => hql}/TableFormatter.java | 4 +- .../{shell => hql}/TableFormatterFactory.java | 4 +- .../hbase/{shell => hql}/TruncateCommand.java | 2 +- .../formatter/AsciiTableFormatter.java | 4 +- .../formatter/HtmlTableFormatter.java | 4 +- .../generated/HQLParser.java} | 37 ++++++----- .../generated/HQLParserConstants.java} | 6 +- .../generated/HQLParserTokenManager.java} | 12 ++-- .../generated/ParseException.java | 21 +------ .../generated/SimpleCharStream.java | 21 +------ .../hbase/{shell => hql}/generated/Token.java | 21 +------ .../generated/TokenMgrError.java | 21 +------ .../TestHBaseShell.java => hql/TestHQL.java} | 14 ++--- src/webapps/master/hql.jsp | 12 ++-- src/webapps/master/master.jsp | 8 +-- 45 files changed, 179 insertions(+), 209 deletions(-) rename src/java/org/apache/hadoop/hbase/{shell => hql}/AlterCommand.java (99%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/BasicCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/ClearCommand.java (97%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/Command.java (97%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/CommandFactory.java (96%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/CreateCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/DeleteCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/DescCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/DisableCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/DropCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/EnableCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/ExitCommand.java (97%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/ExitException.java (97%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/FsCommand.java (97%) create mode 100644 src/java/org/apache/hadoop/hbase/hql/HQLClient.java rename src/java/org/apache/hadoop/hbase/{shell/HBaseShell.jj => hql/HQLParser.jj} (98%) rename src/java/org/apache/hadoop/hbase/{shell/ShellSecurityManager.java => hql/HQLSecurityManager.java} (95%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/HelpCommand.java (99%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/InsertCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/JarCommand.java (99%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/ReturnMsg.java (97%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/SchemaModificationCommand.java (99%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/SelectCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/ShowCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/TableFormatter.java (94%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/TableFormatterFactory.java (96%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/TruncateCommand.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/formatter/AsciiTableFormatter.java (98%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/formatter/HtmlTableFormatter.java (98%) rename src/java/org/apache/hadoop/hbase/{shell/generated/Parser.java => hql/generated/HQLParser.java} (98%) rename src/java/org/apache/hadoop/hbase/{shell/generated/ParserConstants.java => hql/generated/HQLParserConstants.java} (94%) rename src/java/org/apache/hadoop/hbase/{shell/generated/ParserTokenManager.java => hql/generated/HQLParserTokenManager.java} (99%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/generated/ParseException.java (87%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/generated/SimpleCharStream.java (92%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/generated/Token.java (74%) rename src/java/org/apache/hadoop/hbase/{shell => hql}/generated/TokenMgrError.java (82%) rename src/test/org/apache/hadoop/hbase/{shell/TestHBaseShell.java => hql/TestHQL.java} (95%) diff --git a/CHANGES.txt b/CHANGES.txt index 9c1c6f25d71..f96ca7b37b6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -179,6 +179,8 @@ Trunk (unreleased changes) HADOOP-2548 Make TableMap and TableReduce generic (Frederik Hedberg via Stack) HADOOP-2557 Shell count function (Edward Yoon via Stack) + HADOOP-2589 Change an classes/package name from Shell to hql + (Edward Yoon via Stack) Release 0.15.1 Branch 0.15 diff --git a/build.xml b/build.xml index 6ed7fcf3be2..9aeab292c5f 100644 --- a/build.xml +++ b/build.xml @@ -66,12 +66,12 @@ - - + + diff --git a/conf/hbase-default.xml b/conf/hbase-default.xml index 26b4b1b25ea..d77430733e7 100644 --- a/conf/hbase-default.xml +++ b/conf/hbase-default.xml @@ -229,7 +229,7 @@ hbaseshell.formatter - org.apache.hadoop.hbase.shell.formatter.AsciiTableFormatter + org.apache.hadoop.hbase.hql.formatter.AsciiTableFormatter TableFormatter to use outputting HQL result sets. diff --git a/src/java/org/apache/hadoop/hbase/Shell.java b/src/java/org/apache/hadoop/hbase/Shell.java index 546bd96ba6e..3acdea5b6e3 100644 --- a/src/java/org/apache/hadoop/hbase/Shell.java +++ b/src/java/org/apache/hadoop/hbase/Shell.java @@ -25,16 +25,13 @@ import java.io.Writer; import jline.ConsoleReader; -import org.apache.hadoop.hbase.shell.Command; -import org.apache.hadoop.hbase.shell.HelpCommand; -import org.apache.hadoop.hbase.shell.ReturnMsg; -import org.apache.hadoop.hbase.shell.ShellSecurityManager; -import org.apache.hadoop.hbase.shell.TableFormatter; -import org.apache.hadoop.hbase.shell.TableFormatterFactory; -import org.apache.hadoop.hbase.shell.formatter.HtmlTableFormatter; -import org.apache.hadoop.hbase.shell.generated.ParseException; -import org.apache.hadoop.hbase.shell.generated.Parser; -import org.apache.hadoop.hbase.shell.generated.TokenMgrError; +import org.apache.hadoop.hbase.hql.HQLClient; +import org.apache.hadoop.hbase.hql.HelpCommand; +import org.apache.hadoop.hbase.hql.ReturnMsg; +import org.apache.hadoop.hbase.hql.HQLSecurityManager; +import org.apache.hadoop.hbase.hql.TableFormatter; +import org.apache.hadoop.hbase.hql.TableFormatterFactory; +import org.apache.hadoop.hbase.hql.formatter.HtmlTableFormatter; /** * An hbase shell. @@ -90,7 +87,7 @@ public class Shell { HBaseConfiguration conf = new HBaseConfiguration(); ConsoleReader reader = new ConsoleReader(); - System.setSecurityManager(new ShellSecurityManager()); + System.setSecurityManager(new HQLSecurityManager()); reader.setBellEnabled(conf.getBoolean("hbaseshell.jline.bell.enabled", DEFAULT_BELL_ENABLED)); Writer out = new OutputStreamWriter(System.out, "UTF-8"); @@ -112,22 +109,9 @@ public class Shell { if (isEndOfCommand(extendedLine)) { queryStr.append(" " + extendedLine); long start = System.currentTimeMillis(); - Parser parser = new Parser(queryStr.toString(), out, tableFormater); - ReturnMsg rs = null; - try { - Command cmd = parser.terminatedCommand(); - if (cmd != null) { - rs = cmd.execute(conf); - } - } catch (ParseException pe) { - String[] msg = pe.getMessage().split("[\n]"); - System.out.println("Syntax error : Type 'help;' for usage.\nMessage : " - + msg[0]); - } catch (TokenMgrError te) { - String[] msg = te.getMessage().split("[\n]"); - System.out.println("Lexical error : Type 'help;' for usage.\nMessage : " - + msg[0]); - } + + HQLClient hql = new HQLClient(conf, MASTER_ADDRESS, out, tableFormater); + ReturnMsg rs = hql.executeQuery(queryStr.toString()); long end = System.currentTimeMillis(); if (rs != null && rs.getType() > -1) diff --git a/src/java/org/apache/hadoop/hbase/generated/master/hql_jsp.java b/src/java/org/apache/hadoop/hbase/generated/master/hql_jsp.java index b1b909bf7e2..a6020734ce7 100644 --- a/src/java/org/apache/hadoop/hbase/generated/master/hql_jsp.java +++ b/src/java/org/apache/hadoop/hbase/generated/master/hql_jsp.java @@ -5,11 +5,11 @@ import javax.servlet.http.*; import javax.servlet.jsp.*; import java.util.*; import org.apache.hadoop.hbase.HBaseConfiguration; -import org.apache.hadoop.hbase.shell.TableFormatter; -import org.apache.hadoop.hbase.shell.ReturnMsg; -import org.apache.hadoop.hbase.shell.generated.Parser; -import org.apache.hadoop.hbase.shell.Command; -import org.apache.hadoop.hbase.shell.formatter.HtmlTableFormatter; +import org.apache.hadoop.hbase.hql.TableFormatter; +import org.apache.hadoop.hbase.hql.ReturnMsg; +import org.apache.hadoop.hbase.hql.generated.HQLParser; +import org.apache.hadoop.hbase.hql.Command; +import org.apache.hadoop.hbase.hql.formatter.HtmlTableFormatter; public final class hql_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent { @@ -60,7 +60,7 @@ public final class hql_jsp extends org.apache.jasper.runtime.HttpJspBase out.write("\n
\n "); - Parser parser = new Parser(query, out, new HtmlTableFormatter(out)); + HQLParser parser = new HQLParser(query, out, new HtmlTableFormatter(out)); Command cmd = parser.terminatedCommand(); if (cmd.getCommandType() != Command.CommandType.SELECT) { diff --git a/src/java/org/apache/hadoop/hbase/generated/master/master_jsp.java b/src/java/org/apache/hadoop/hbase/generated/master/master_jsp.java index 1380c6bbf4e..02f194d612e 100644 --- a/src/java/org/apache/hadoop/hbase/generated/master/master_jsp.java +++ b/src/java/org/apache/hadoop/hbase/generated/master/master_jsp.java @@ -14,10 +14,10 @@ import org.apache.hadoop.hbase.HServerInfo; import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HBaseConfiguration; -import org.apache.hadoop.hbase.shell.ShowCommand; -import org.apache.hadoop.hbase.shell.TableFormatter; -import org.apache.hadoop.hbase.shell.ReturnMsg; -import org.apache.hadoop.hbase.shell.formatter.HtmlTableFormatter; +import org.apache.hadoop.hbase.hql.ShowCommand; +import org.apache.hadoop.hbase.hql.TableFormatter; +import org.apache.hadoop.hbase.hql.ReturnMsg; +import org.apache.hadoop.hbase.hql.formatter.HtmlTableFormatter; import org.apache.hadoop.hbase.HTableDescriptor; public final class master_jsp extends org.apache.jasper.runtime.HttpJspBase diff --git a/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java b/src/java/org/apache/hadoop/hbase/hql/AlterCommand.java similarity index 99% rename from src/java/org/apache/hadoop/hbase/shell/AlterCommand.java rename to src/java/org/apache/hadoop/hbase/hql/AlterCommand.java index 654503956bb..8a8355910aa 100644 --- a/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/AlterCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java b/src/java/org/apache/hadoop/hbase/hql/BasicCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/BasicCommand.java rename to src/java/org/apache/hadoop/hbase/hql/BasicCommand.java index db1e4ebf796..e31d72ed387 100644 --- a/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/BasicCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java b/src/java/org/apache/hadoop/hbase/hql/ClearCommand.java similarity index 97% rename from src/java/org/apache/hadoop/hbase/shell/ClearCommand.java rename to src/java/org/apache/hadoop/hbase/hql/ClearCommand.java index bfe4fb32b0b..58d2ad7f83c 100644 --- a/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/ClearCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/Command.java b/src/java/org/apache/hadoop/hbase/hql/Command.java similarity index 97% rename from src/java/org/apache/hadoop/hbase/shell/Command.java rename to src/java/org/apache/hadoop/hbase/hql/Command.java index 2a9b5d2ce46..5d009b74d40 100644 --- a/src/java/org/apache/hadoop/hbase/shell/Command.java +++ b/src/java/org/apache/hadoop/hbase/hql/Command.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import org.apache.hadoop.hbase.HBaseConfiguration; diff --git a/src/java/org/apache/hadoop/hbase/shell/CommandFactory.java b/src/java/org/apache/hadoop/hbase/hql/CommandFactory.java similarity index 96% rename from src/java/org/apache/hadoop/hbase/shell/CommandFactory.java rename to src/java/org/apache/hadoop/hbase/hql/CommandFactory.java index 2ef996d0a1a..bde68dffa32 100644 --- a/src/java/org/apache/hadoop/hbase/shell/CommandFactory.java +++ b/src/java/org/apache/hadoop/hbase/hql/CommandFactory.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; /** * Parser uses command factories to create command. diff --git a/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java b/src/java/org/apache/hadoop/hbase/hql/CreateCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/CreateCommand.java rename to src/java/org/apache/hadoop/hbase/hql/CreateCommand.java index 1ac74eeddee..1dabdb7e08d 100644 --- a/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/CreateCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.Writer; import java.util.HashMap; diff --git a/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java b/src/java/org/apache/hadoop/hbase/hql/DeleteCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java rename to src/java/org/apache/hadoop/hbase/hql/DeleteCommand.java index 4b09d17753f..beb7df770b1 100644 --- a/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/DeleteCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/DescCommand.java b/src/java/org/apache/hadoop/hbase/hql/DescCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/DescCommand.java rename to src/java/org/apache/hadoop/hbase/hql/DescCommand.java index f66895a24f5..0eff6a33269 100644 --- a/src/java/org/apache/hadoop/hbase/shell/DescCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/DescCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java b/src/java/org/apache/hadoop/hbase/hql/DisableCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/DisableCommand.java rename to src/java/org/apache/hadoop/hbase/hql/DisableCommand.java index 8d49f453522..a76181b4018 100644 --- a/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/DisableCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/DropCommand.java b/src/java/org/apache/hadoop/hbase/hql/DropCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/DropCommand.java rename to src/java/org/apache/hadoop/hbase/hql/DropCommand.java index 070b19048bc..a2b9f921644 100644 --- a/src/java/org/apache/hadoop/hbase/shell/DropCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/DropCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java b/src/java/org/apache/hadoop/hbase/hql/EnableCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/EnableCommand.java rename to src/java/org/apache/hadoop/hbase/hql/EnableCommand.java index 93a8138e8f3..4410c680588 100644 --- a/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/EnableCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/ExitCommand.java b/src/java/org/apache/hadoop/hbase/hql/ExitCommand.java similarity index 97% rename from src/java/org/apache/hadoop/hbase/shell/ExitCommand.java rename to src/java/org/apache/hadoop/hbase/hql/ExitCommand.java index cd7d5ba131d..c427d78c7c9 100644 --- a/src/java/org/apache/hadoop/hbase/shell/ExitCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/ExitCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/ExitException.java b/src/java/org/apache/hadoop/hbase/hql/ExitException.java similarity index 97% rename from src/java/org/apache/hadoop/hbase/shell/ExitException.java rename to src/java/org/apache/hadoop/hbase/hql/ExitException.java index 6d9261345d4..d7a9fb13a0a 100644 --- a/src/java/org/apache/hadoop/hbase/shell/ExitException.java +++ b/src/java/org/apache/hadoop/hbase/hql/ExitException.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; public class ExitException extends SecurityException { private static final long serialVersionUID = -8085525076856622991L; diff --git a/src/java/org/apache/hadoop/hbase/shell/FsCommand.java b/src/java/org/apache/hadoop/hbase/hql/FsCommand.java similarity index 97% rename from src/java/org/apache/hadoop/hbase/shell/FsCommand.java rename to src/java/org/apache/hadoop/hbase/hql/FsCommand.java index f17b7b43224..ae0bbcea378 100644 --- a/src/java/org/apache/hadoop/hbase/shell/FsCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/FsCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.Writer; import java.util.List; diff --git a/src/java/org/apache/hadoop/hbase/hql/HQLClient.java b/src/java/org/apache/hadoop/hbase/hql/HQLClient.java new file mode 100644 index 00000000000..862a872b653 --- /dev/null +++ b/src/java/org/apache/hadoop/hbase/hql/HQLClient.java @@ -0,0 +1,62 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * 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.hadoop.hbase.hql; + +import java.io.Writer; + +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.hql.generated.HQLParser; +import org.apache.hadoop.hbase.hql.generated.ParseException; +import org.apache.hadoop.hbase.hql.generated.TokenMgrError; + +public class HQLClient { + public static String MASTER_ADDRESS = null; + static HBaseConfiguration conf; + static TableFormatter tableFormater; + static Writer out; + + public HQLClient(HBaseConfiguration config, String master, Writer output, + TableFormatter formatter) { + conf = config; + out = output; + tableFormater = formatter; + MASTER_ADDRESS = master; + } + + public ReturnMsg executeQuery(String query) { + HQLParser parser = new HQLParser(query, out, tableFormater); + ReturnMsg rs = null; + + try { + Command cmd = parser.terminatedCommand(); + if (cmd != null) { + rs = cmd.execute(conf); + } + } catch (ParseException pe) { + String[] msg = pe.getMessage().split("[\n]"); + rs = new ReturnMsg(-9, "Syntax error : Type 'help;' for usage.\nMessage : " + msg[0]); + } catch (TokenMgrError te) { + String[] msg = te.getMessage().split("[\n]"); + rs = new ReturnMsg(-9, "Lexical error : Type 'help;' for usage.\nMessage : " + msg[0]); + } + + return rs; + } +} \ No newline at end of file diff --git a/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj b/src/java/org/apache/hadoop/hbase/hql/HQLParser.jj similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj rename to src/java/org/apache/hadoop/hbase/hql/HQLParser.jj index 0a71fd6a00d..4e1edb36c41 100644 --- a/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj +++ b/src/java/org/apache/hadoop/hbase/hql/HQLParser.jj @@ -3,8 +3,8 @@ options { IGNORE_CASE = true; } -PARSER_BEGIN(Parser) -package org.apache.hadoop.hbase.shell.generated; +PARSER_BEGIN(HQLParser) +package org.apache.hadoop.hbase.hql.generated; /** * Copyright 2007 The Apache Software Foundation @@ -36,18 +36,17 @@ import java.io.Writer; import java.net.URLEncoder; import java.io.UnsupportedEncodingException; -import org.apache.hadoop.hbase.shell.*; +import org.apache.hadoop.hbase.hql.*; /** * Parsing command line. */ -public class Parser { +public class HQLParser { private String QueryString; private TableFormatter formatter; private Writer out; - private String secondR; - public Parser(final String query, final Writer o, final TableFormatter f) { + public HQLParser(final String query, final Writer o, final TableFormatter f) { this((Reader)(new StringReader(query))); this.QueryString = query; this.formatter = f; @@ -59,7 +58,7 @@ public class Parser { } } -PARSER_END(Parser) +PARSER_END(HQLParser) SKIP : { diff --git a/src/java/org/apache/hadoop/hbase/shell/ShellSecurityManager.java b/src/java/org/apache/hadoop/hbase/hql/HQLSecurityManager.java similarity index 95% rename from src/java/org/apache/hadoop/hbase/shell/ShellSecurityManager.java rename to src/java/org/apache/hadoop/hbase/hql/HQLSecurityManager.java index 0214a55a918..8f48a0825de 100644 --- a/src/java/org/apache/hadoop/hbase/shell/ShellSecurityManager.java +++ b/src/java/org/apache/hadoop/hbase/hql/HQLSecurityManager.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.security.Permission; @@ -33,7 +33,7 @@ import org.apache.hadoop.hbase.Shell; * * @see ExitException */ -public class ShellSecurityManager extends SecurityManager { +public class HQLSecurityManager extends SecurityManager { /** * Override SecurityManager#checkExit. This throws an ExitException(status) diff --git a/src/java/org/apache/hadoop/hbase/shell/HelpCommand.java b/src/java/org/apache/hadoop/hbase/hql/HelpCommand.java similarity index 99% rename from src/java/org/apache/hadoop/hbase/shell/HelpCommand.java rename to src/java/org/apache/hadoop/hbase/hql/HelpCommand.java index 10806a111e1..39ebb989433 100644 --- a/src/java/org/apache/hadoop/hbase/shell/HelpCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/HelpCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.OutputStreamWriter; diff --git a/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java b/src/java/org/apache/hadoop/hbase/hql/InsertCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/InsertCommand.java rename to src/java/org/apache/hadoop/hbase/hql/InsertCommand.java index 720e1dcc6f0..2d2b66de377 100644 --- a/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/InsertCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/JarCommand.java b/src/java/org/apache/hadoop/hbase/hql/JarCommand.java similarity index 99% rename from src/java/org/apache/hadoop/hbase/shell/JarCommand.java rename to src/java/org/apache/hadoop/hbase/hql/JarCommand.java index 5b6efd6ca61..534dc2b676b 100644 --- a/src/java/org/apache/hadoop/hbase/shell/JarCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/JarCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.File; import java.io.IOException; diff --git a/src/java/org/apache/hadoop/hbase/shell/ReturnMsg.java b/src/java/org/apache/hadoop/hbase/hql/ReturnMsg.java similarity index 97% rename from src/java/org/apache/hadoop/hbase/shell/ReturnMsg.java rename to src/java/org/apache/hadoop/hbase/hql/ReturnMsg.java index 7295eee5d76..a6faa4b3953 100644 --- a/src/java/org/apache/hadoop/hbase/shell/ReturnMsg.java +++ b/src/java/org/apache/hadoop/hbase/hql/ReturnMsg.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import org.apache.hadoop.hbase.HBaseConfiguration; diff --git a/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java b/src/java/org/apache/hadoop/hbase/hql/SchemaModificationCommand.java similarity index 99% rename from src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java rename to src/java/org/apache/hadoop/hbase/hql/SchemaModificationCommand.java index 75d309d4903..30afcecc735 100644 --- a/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/SchemaModificationCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.Writer; import java.util.Map; diff --git a/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java b/src/java/org/apache/hadoop/hbase/hql/SelectCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/SelectCommand.java rename to src/java/org/apache/hadoop/hbase/hql/SelectCommand.java index abfde4f7560..c3afa0f39b6 100644 --- a/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/SelectCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.OutputStreamWriter; @@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.Shell; import org.apache.hadoop.hbase.filter.RowFilterInterface; import org.apache.hadoop.hbase.filter.StopRowFilter; import org.apache.hadoop.hbase.filter.WhileMatchRowFilter; -import org.apache.hadoop.hbase.shell.generated.Parser; +import org.apache.hadoop.hbase.hql.generated.HQLParser; import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.io.Text; @@ -375,7 +375,7 @@ public class SelectCommand extends BasicCommand { HBaseConfiguration c = new HBaseConfiguration(); // For debugging TableFormatterFactory tff = new TableFormatterFactory(out, c); - Parser parser = new Parser("select * from 'x' where row='x';", out, tff.get()); + HQLParser parser = new HQLParser("select * from 'x' where row='x';", out, tff.get()); Command cmd = parser.terminatedCommand(); ReturnMsg rm = cmd.execute(c); diff --git a/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java b/src/java/org/apache/hadoop/hbase/hql/ShowCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/ShowCommand.java rename to src/java/org/apache/hadoop/hbase/hql/ShowCommand.java index 2ffb2f34ab7..551bdaf7671 100644 --- a/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/ShowCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/TableFormatter.java b/src/java/org/apache/hadoop/hbase/hql/TableFormatter.java similarity index 94% rename from src/java/org/apache/hadoop/hbase/shell/TableFormatter.java rename to src/java/org/apache/hadoop/hbase/hql/TableFormatter.java index 0bf8c58d818..204ad91df64 100644 --- a/src/java/org/apache/hadoop/hbase/shell/TableFormatter.java +++ b/src/java/org/apache/hadoop/hbase/hql/TableFormatter.java @@ -17,12 +17,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; -import org.apache.hadoop.hbase.shell.formatter.AsciiTableFormatter; +import org.apache.hadoop.hbase.hql.formatter.AsciiTableFormatter; /** * Interface implemented by table formatters outputting select results. diff --git a/src/java/org/apache/hadoop/hbase/shell/TableFormatterFactory.java b/src/java/org/apache/hadoop/hbase/hql/TableFormatterFactory.java similarity index 96% rename from src/java/org/apache/hadoop/hbase/shell/TableFormatterFactory.java rename to src/java/org/apache/hadoop/hbase/hql/TableFormatterFactory.java index 172354d30de..3647733df80 100644 --- a/src/java/org/apache/hadoop/hbase/shell/TableFormatterFactory.java +++ b/src/java/org/apache/hadoop/hbase/hql/TableFormatterFactory.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.Writer; import java.lang.reflect.Constructor; @@ -25,7 +25,7 @@ import java.lang.reflect.Constructor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.shell.formatter.AsciiTableFormatter; +import org.apache.hadoop.hbase.hql.formatter.AsciiTableFormatter; /** * Table formatter. Specify formatter by setting "hbaseshell.formatter" property diff --git a/src/java/org/apache/hadoop/hbase/shell/TruncateCommand.java b/src/java/org/apache/hadoop/hbase/hql/TruncateCommand.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/TruncateCommand.java rename to src/java/org/apache/hadoop/hbase/hql/TruncateCommand.java index 1d9e1e4d7cf..e7613c0b5f2 100644 --- a/src/java/org/apache/hadoop/hbase/shell/TruncateCommand.java +++ b/src/java/org/apache/hadoop/hbase/hql/TruncateCommand.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.IOException; import java.io.Writer; diff --git a/src/java/org/apache/hadoop/hbase/shell/formatter/AsciiTableFormatter.java b/src/java/org/apache/hadoop/hbase/hql/formatter/AsciiTableFormatter.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/formatter/AsciiTableFormatter.java rename to src/java/org/apache/hadoop/hbase/hql/formatter/AsciiTableFormatter.java index 9eb4fc50bb3..41e65999723 100644 --- a/src/java/org/apache/hadoop/hbase/shell/formatter/AsciiTableFormatter.java +++ b/src/java/org/apache/hadoop/hbase/hql/formatter/AsciiTableFormatter.java @@ -15,12 +15,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell.formatter; +package org.apache.hadoop.hbase.hql.formatter; import java.io.IOException; import java.io.Writer; -import org.apache.hadoop.hbase.shell.TableFormatter; +import org.apache.hadoop.hbase.hql.TableFormatter; /** diff --git a/src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java b/src/java/org/apache/hadoop/hbase/hql/formatter/HtmlTableFormatter.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java rename to src/java/org/apache/hadoop/hbase/hql/formatter/HtmlTableFormatter.java index 87d6d5fca48..346711c4e17 100644 --- a/src/java/org/apache/hadoop/hbase/shell/formatter/HtmlTableFormatter.java +++ b/src/java/org/apache/hadoop/hbase/hql/formatter/HtmlTableFormatter.java @@ -15,14 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell.formatter; +package org.apache.hadoop.hbase.hql.formatter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; -import org.apache.hadoop.hbase.shell.TableFormatter; +import org.apache.hadoop.hbase.hql.TableFormatter; import org.znerd.xmlenc.LineBreak; import org.znerd.xmlenc.XMLOutputter; import org.znerd.xmlenc.XMLEncoder; diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java b/src/java/org/apache/hadoop/hbase/hql/generated/HQLParser.java similarity index 98% rename from src/java/org/apache/hadoop/hbase/shell/generated/Parser.java rename to src/java/org/apache/hadoop/hbase/hql/generated/HQLParser.java index 2218c61db5c..5c5e70838cc 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/HQLParser.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. Parser.java */ -package org.apache.hadoop.hbase.shell.generated; +/* Generated By:JavaCC: Do not edit this line. HQLParser.java */ +package org.apache.hadoop.hbase.hql.generated; /** * Copyright 2007 The Apache Software Foundation @@ -31,18 +31,17 @@ import java.io.Writer; import java.net.URLEncoder; import java.io.UnsupportedEncodingException; -import org.apache.hadoop.hbase.shell.*; +import org.apache.hadoop.hbase.hql.*; /** * Parsing command line. */ -public class Parser implements ParserConstants { +public class HQLParser implements HQLParserConstants { private String QueryString; private TableFormatter formatter; private Writer out; - private String secondR; - public Parser(final String query, final Writer o, final TableFormatter f) { + public HQLParser(final String query, final Writer o, final TableFormatter f) { this((Reader)(new StringReader(query))); this.QueryString = query; this.formatter = f; @@ -1081,6 +1080,11 @@ public class Parser implements ParserConstants { finally { jj_save(0, xla); } } + final private boolean jj_3R_11() { + if (jj_scan_token(ID)) return true; + return false; + } + final private boolean jj_3R_10() { Token xsp; xsp = jj_scanpos; @@ -1107,12 +1111,7 @@ public class Parser implements ParserConstants { return false; } - final private boolean jj_3R_11() { - if (jj_scan_token(ID)) return true; - return false; - } - - public ParserTokenManager token_source; + public HQLParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; private int jj_ntk; @@ -1143,12 +1142,12 @@ public class Parser implements ParserConstants { private boolean jj_rescan = false; private int jj_gc = 0; - public Parser(java.io.InputStream stream) { + public HQLParser(java.io.InputStream stream) { this(stream, null); } - public Parser(java.io.InputStream stream, String encoding) { + public HQLParser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new ParserTokenManager(jj_input_stream); + token_source = new HQLParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; @@ -1169,9 +1168,9 @@ public class Parser implements ParserConstants { for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } - public Parser(java.io.Reader stream) { + public HQLParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ParserTokenManager(jj_input_stream); + token_source = new HQLParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; @@ -1189,7 +1188,7 @@ public class Parser implements ParserConstants { for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } - public Parser(ParserTokenManager tm) { + public HQLParser(HQLParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; @@ -1198,7 +1197,7 @@ public class Parser implements ParserConstants { for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } - public void ReInit(ParserTokenManager tm) { + public void ReInit(HQLParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java b/src/java/org/apache/hadoop/hbase/hql/generated/HQLParserConstants.java similarity index 94% rename from src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java rename to src/java/org/apache/hadoop/hbase/hql/generated/HQLParserConstants.java index 75d159843a6..b2d46fb3008 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/HQLParserConstants.java @@ -1,7 +1,7 @@ -/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ -package org.apache.hadoop.hbase.shell.generated; +/* Generated By:JavaCC: Do not edit this line. HQLParserConstants.java */ +package org.apache.hadoop.hbase.hql.generated; -public interface ParserConstants { +public interface HQLParserConstants { int EOF = 0; int HELP = 5; diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java b/src/java/org/apache/hadoop/hbase/hql/generated/HQLParserTokenManager.java similarity index 99% rename from src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java rename to src/java/org/apache/hadoop/hbase/hql/generated/HQLParserTokenManager.java index 1af3e7d9dca..8a55c477f06 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/HQLParserTokenManager.java @@ -1,5 +1,5 @@ -/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ -package org.apache.hadoop.hbase.shell.generated; +/* Generated By:JavaCC: Do not edit this line. HQLParserTokenManager.java */ +package org.apache.hadoop.hbase.hql.generated; /** * Copyright 2007 The Apache Software Foundation * @@ -29,9 +29,9 @@ import java.io.Reader; import java.io.Writer; import java.net.URLEncoder; import java.io.UnsupportedEncodingException; -import org.apache.hadoop.hbase.shell.*; +import org.apache.hadoop.hbase.hql.*; -public class ParserTokenManager implements ParserConstants +public class HQLParserTokenManager implements HQLParserConstants { public java.io.PrintStream debugStream = System.out; public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } @@ -1480,12 +1480,12 @@ protected SimpleCharStream input_stream; private final int[] jjrounds = new int[32]; private final int[] jjstateSet = new int[64]; protected char curChar; -public ParserTokenManager(SimpleCharStream stream){ +public HQLParserTokenManager(SimpleCharStream stream){ if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } -public ParserTokenManager(SimpleCharStream stream, int lexState){ +public HQLParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/ParseException.java b/src/java/org/apache/hadoop/hbase/hql/generated/ParseException.java similarity index 87% rename from src/java/org/apache/hadoop/hbase/shell/generated/ParseException.java rename to src/java/org/apache/hadoop/hbase/hql/generated/ParseException.java index 466c22e2446..6c81e008105 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/ParseException.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/ParseException.java @@ -1,24 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ -/** - * Copyright 2007 The Apache Software Foundation - * - * 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.hadoop.hbase.shell.generated; +package org.apache.hadoop.hbase.hql.generated; /** * This exception is thrown when parse errors are encountered. diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/SimpleCharStream.java b/src/java/org/apache/hadoop/hbase/hql/generated/SimpleCharStream.java similarity index 92% rename from src/java/org/apache/hadoop/hbase/shell/generated/SimpleCharStream.java rename to src/java/org/apache/hadoop/hbase/hql/generated/SimpleCharStream.java index 2a23ed690ad..c26c94be1d5 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/SimpleCharStream.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/SimpleCharStream.java @@ -1,24 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 4.0 */ -/** - * Copyright 2007 The Apache Software Foundation - * - * 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.hadoop.hbase.shell.generated; +package org.apache.hadoop.hbase.hql.generated; /** * An implementation of interface CharStream, where the stream is assumed to diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/Token.java b/src/java/org/apache/hadoop/hbase/hql/generated/Token.java similarity index 74% rename from src/java/org/apache/hadoop/hbase/shell/generated/Token.java rename to src/java/org/apache/hadoop/hbase/hql/generated/Token.java index 21cb04ff1b2..8b71d0fe642 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/Token.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/Token.java @@ -1,24 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */ -/** - * Copyright 2007 The Apache Software Foundation - * - * 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.hadoop.hbase.shell.generated; +package org.apache.hadoop.hbase.hql.generated; /** * Describes the input token stream. diff --git a/src/java/org/apache/hadoop/hbase/shell/generated/TokenMgrError.java b/src/java/org/apache/hadoop/hbase/hql/generated/TokenMgrError.java similarity index 82% rename from src/java/org/apache/hadoop/hbase/shell/generated/TokenMgrError.java rename to src/java/org/apache/hadoop/hbase/hql/generated/TokenMgrError.java index 8c6b26d2c47..1e1dc826fbb 100644 --- a/src/java/org/apache/hadoop/hbase/shell/generated/TokenMgrError.java +++ b/src/java/org/apache/hadoop/hbase/hql/generated/TokenMgrError.java @@ -1,24 +1,5 @@ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ -/** - * Copyright 2007 The Apache Software Foundation - * - * 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.hadoop.hbase.shell.generated; +package org.apache.hadoop.hbase.hql.generated; public class TokenMgrError extends Error { diff --git a/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java b/src/test/org/apache/hadoop/hbase/hql/TestHQL.java similarity index 95% rename from src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java rename to src/test/org/apache/hadoop/hbase/hql/TestHQL.java index 76450c5a19d..333f9104b20 100644 --- a/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java +++ b/src/test/org/apache/hadoop/hbase/hql/TestHQL.java @@ -17,7 +17,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.hadoop.hbase.shell; +package org.apache.hadoop.hbase.hql; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -32,21 +32,21 @@ import org.apache.hadoop.hbase.HBaseAdmin; import org.apache.hadoop.hbase.HBaseClusterTestCase; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HTableDescriptor; -import org.apache.hadoop.hbase.shell.generated.ParseException; -import org.apache.hadoop.hbase.shell.generated.Parser; +import org.apache.hadoop.hbase.hql.generated.ParseException; +import org.apache.hadoop.hbase.hql.generated.HQLParser; import org.apache.hadoop.io.Text; /** - * Tests for Hbase shell + * Tests for HQL */ -public class TestHBaseShell extends HBaseClusterTestCase { +public class TestHQL extends HBaseClusterTestCase { protected final Log LOG = LogFactory.getLog(this.getClass().getName()); private ByteArrayOutputStream baos; private HBaseAdmin admin; /** constructor */ - public TestHBaseShell() { + public TestHQL() { super(1 /*One region server only*/); } @@ -161,7 +161,7 @@ public class TestHBaseShell extends HBaseClusterTestCase { LOG.info("Running command: " + cmdStr); Writer out = new OutputStreamWriter(System.out, "UTF-8"); TableFormatterFactory tff = new TableFormatterFactory(out, this.conf); - Parser parser = new Parser(cmdStr, out, tff.get()); + HQLParser parser = new HQLParser(cmdStr, out, tff.get()); Command cmd = parser.terminatedCommand(); ReturnMsg rm = cmd.execute(this.conf); dumpStdout(); diff --git a/src/webapps/master/hql.jsp b/src/webapps/master/hql.jsp index 97abc6d753c..f9a60e24169 100644 --- a/src/webapps/master/hql.jsp +++ b/src/webapps/master/hql.jsp @@ -1,11 +1,11 @@ <%@ page contentType="text/html;charset=UTF-8" import="java.util.*" import="org.apache.hadoop.hbase.HBaseConfiguration" - import="org.apache.hadoop.hbase.shell.TableFormatter" - import="org.apache.hadoop.hbase.shell.ReturnMsg" - import="org.apache.hadoop.hbase.shell.generated.Parser" - import="org.apache.hadoop.hbase.shell.Command" - import="org.apache.hadoop.hbase.shell.formatter.HtmlTableFormatter" + import="org.apache.hadoop.hbase.hql.TableFormatter" + import="org.apache.hadoop.hbase.hql.ReturnMsg" + import="org.apache.hadoop.hbase.hql.generated.Parser" + import="org.apache.hadoop.hbase.hql.Command" + import="org.apache.hadoop.hbase.hql.formatter.HtmlTableFormatter" %> @@ -41,7 +41,7 @@ %>
<% - Parser parser = new Parser(query, out, new HtmlTableFormatter(out)); + HQLParser parser = new HQLParser(query, out, new HtmlTableFormatter(out)); Command cmd = parser.terminatedCommand(); if (cmd.getCommandType() != Command.CommandType.SELECT) { %> diff --git a/src/webapps/master/master.jsp b/src/webapps/master/master.jsp index ffb7fc7bd26..03493694b3b 100644 --- a/src/webapps/master/master.jsp +++ b/src/webapps/master/master.jsp @@ -10,10 +10,10 @@ import="org.apache.hadoop.hbase.HServerAddress" import="org.apache.hadoop.hbase.HRegionInfo" import="org.apache.hadoop.hbase.HBaseConfiguration" - import="org.apache.hadoop.hbase.shell.ShowCommand" - import="org.apache.hadoop.hbase.shell.TableFormatter" - import="org.apache.hadoop.hbase.shell.ReturnMsg" - import="org.apache.hadoop.hbase.shell.formatter.HtmlTableFormatter" + import="org.apache.hadoop.hbase.hql.ShowCommand" + import="org.apache.hadoop.hbase.hql.TableFormatter" + import="org.apache.hadoop.hbase.hql.ReturnMsg" + import="org.apache.hadoop.hbase.hql.formatter.HtmlTableFormatter" import="org.apache.hadoop.hbase.HTableDescriptor" %><% HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); HBaseConfiguration conf = new HBaseConfiguration();