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: * $Id: AboutCommand.java,v 1.12 2006/03/19 22:41:57 hzeller Exp $
05: * author: Henner Zeller <H.Zeller@acm.org>
06: */
07: package henplus.commands;
08:
09: import henplus.AbstractCommand;
10: import henplus.HenPlus;
11: import henplus.SQLSession;
12: import henplus.Version;
13:
14: /**
15: * document me.
16: */
17: public class AboutCommand extends AbstractCommand {
18: final static String LICENSE = "GNU Public License <http://www.gnu.org/licenses/gpl.txt>";
19:
20: final static String ABOUT = "---------------------------------------------------------------------------\n"
21: + " HenPlus II "
22: + Version.getVersion()
23: + " Copyright(C) 1997..2006 Henner Zeller <H.Zeller@acm.org>\n"
24: + " HenPlus is provided AS IS and comes with ABSOLUTELY NO WARRANTY\n"
25: + " This is free software, and you are welcome to redistribute it under the\n"
26: + " conditions of the "
27: + LICENSE
28: + "\n"
29: + "---------------------------------------------------------------------------\n";
30:
31: /**
32: * returns the command-strings this command can handle.
33: */
34: public String[] getCommandList() {
35: return new String[] { "about", "version", "license" };
36: }
37:
38: public AboutCommand(boolean quiet) {
39: if (!quiet) {
40: System.err.print(ABOUT);
41: }
42: }
43:
44: /**
45: * execute the command given.
46: */
47: public int execute(SQLSession session, String cmd, String param) {
48: if ("about".equals(cmd)) {
49: HenPlus.msg().print(ABOUT);
50: } else if ("version".equals(cmd)) {
51: HenPlus.msg().println(
52: Version.getVersion() + " / compiled "
53: + Version.getCompileTime());
54: } else if ("license".equals(cmd)) {
55: HenPlus.msg().println(LICENSE);
56: }
57: return SUCCESS;
58: }
59:
60: public boolean requiresValidSession(String cmd) {
61: return false;
62: }
63:
64: /**
65: * return a descriptive string.
66: */
67: public String getShortDescription() {
68: return "about HenPlus";
69: }
70: }
71:
72: /*
73: * Local variables:
74: * c-basic-offset: 4
75: * compile-command: "ant -emacs -find build.xml"
76: * End:
77: */
|