01: /*
02: * This is free software, licensed under the Gnu Public License (GPL)
03: * get a copy from <http://www.gnu.org/licenses/gpl.html>
04: *
05: * author: Henner Zeller <H.Zeller@acm.org>
06: */
07: package henplus.commands;
08:
09: import henplus.HenPlus;
10: import henplus.SQLSession;
11: import henplus.AbstractCommand;
12:
13: /**
14: * document me.
15: */
16: public class StatusCommand extends AbstractCommand {
17: /**
18: * returns the command-strings this command can handle.
19: */
20: public String[] getCommandList() {
21: return new String[] { "status" };
22: }
23:
24: /**
25: * execute the command given.
26: */
27: public int execute(SQLSession session, String cmd, String param) {
28: HenPlus.msg().println("URL: " + session.getURL());
29: HenPlus.msg().print("uptime: ");
30: TimeRenderer.printTime(session.getUptime(), HenPlus.msg());
31: HenPlus.msg().println(
32: "; statements: " + session.getStatementCount());
33: return SUCCESS;
34: }
35:
36: /**
37: * return a descriptive string.
38: */
39: public String getShortDescription() {
40: return "show status of this connection";
41: }
42: }
43:
44: /*
45: * Local variables:
46: * c-basic-offset: 4
47: * compile-command: "ant -emacs -find build.xml"
48: * End:
49: */
|