HADOOP-2004 [hbase] webapp hql formatting bugs
git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@582867 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eb22494fb4
commit
79b3b1c6b2
|
@ -69,6 +69,7 @@ Trunk (unreleased changes)
|
||||||
HADOOP-1996 TestHStoreFile fails on windows if run multiple times
|
HADOOP-1996 TestHStoreFile fails on windows if run multiple times
|
||||||
HADOOP-1937 When the master times out a region server's lease, it is too
|
HADOOP-1937 When the master times out a region server's lease, it is too
|
||||||
aggressive in reclaiming the server's log.
|
aggressive in reclaiming the server's log.
|
||||||
|
HADOOP-2004 webapp hql formatting bugs
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HADOOP-1737 Make HColumnDescriptor data publically members settable
|
HADOOP-1737 Make HColumnDescriptor data publically members settable
|
||||||
|
|
|
@ -76,8 +76,8 @@ public class DescCommand extends BasicCommand {
|
||||||
tmp = tmp.substring(1, tmp.length() - 1);
|
tmp = tmp.substring(1, tmp.length() - 1);
|
||||||
}
|
}
|
||||||
columnStrs[i] = tmp;
|
columnStrs[i] = tmp;
|
||||||
|
formatter.row(new String [] {columnStrs[i]});
|
||||||
}
|
}
|
||||||
formatter.row(columnStrs);
|
|
||||||
formatter.footer();
|
formatter.footer();
|
||||||
return new ReturnMsg(1, columns.length + " columnfamily(s) in set");
|
return new ReturnMsg(1, columns.length + " columnfamily(s) in set");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package org.apache.hadoop.hbase.shell.formatter;
|
package org.apache.hadoop.hbase.shell.formatter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.shell.TableFormatter;
|
import org.apache.hadoop.hbase.shell.TableFormatter;
|
||||||
|
@ -8,14 +9,14 @@ import org.znerd.xmlenc.LineBreak;
|
||||||
import org.znerd.xmlenc.XMLOutputter;
|
import org.znerd.xmlenc.XMLOutputter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formatter that outputs data inside an HTML table.
|
* Formatter that outputs data inside an HTML table. If only a single cell
|
||||||
* If only a single cell result, then no formatting is done. Presumption is
|
* result, then no formatting is done. Presumption is that client manages
|
||||||
* that client manages serial access outputting tables. Does not close passed
|
* serial access outputting tables. Does not close passed {@link Writer}.
|
||||||
* {@link Writer}.
|
* Since hbase columns have no typing, the formatter presumes a type of
|
||||||
|
* UTF-8 String. If cells contain images, etc., this formatter will mangle
|
||||||
|
* their display.
|
||||||
* <p>TODO: Uses xmlenc. Hopefully it flushes every so often (Claims its a
|
* <p>TODO: Uses xmlenc. Hopefully it flushes every so often (Claims its a
|
||||||
* stream-based outputter). Verify.
|
* stream-based outputter). Verify.
|
||||||
* <p>For now, invoke it this way (until shell starts to take cmdline params);
|
|
||||||
* <code>$ HBASE_OPTS='-Dhbaseshell.formatter=org.apache.hadoop.hbase.shell.TableFormatterFactory$HtmlTableFormatter' ./bin/hbase shell</code>
|
|
||||||
*/
|
*/
|
||||||
public class HtmlTableFormatter implements TableFormatter {
|
public class HtmlTableFormatter implements TableFormatter {
|
||||||
private final XMLOutputter outputter;
|
private final XMLOutputter outputter;
|
||||||
|
@ -70,7 +71,7 @@ public class HtmlTableFormatter implements TableFormatter {
|
||||||
|
|
||||||
public void row(String [] cells) throws IOException{
|
public void row(String [] cells) throws IOException{
|
||||||
if (isNoFormatting()) {
|
if (isNoFormatting()) {
|
||||||
this.outputter.pcdata(cells[0]);
|
getOut().write(cells[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.outputter.startTag("tr");
|
this.outputter.startTag("tr");
|
||||||
|
@ -108,4 +109,12 @@ public class HtmlTableFormatter implements TableFormatter {
|
||||||
public void setNoFormatting(boolean noFormatting) {
|
public void setNoFormatting(boolean noFormatting) {
|
||||||
this.noFormatting = noFormatting;
|
this.noFormatting = noFormatting;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
HtmlTableFormatter f =
|
||||||
|
new HtmlTableFormatter(new OutputStreamWriter(System.out, "UTF-8"));
|
||||||
|
f.header(new String [] {"a", "b"});
|
||||||
|
f.row(new String [] {"a", "b"});
|
||||||
|
f.footer();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue