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: SamplePlugin.java,v 1.1 2002/05/06 06:57:56 hzeller Exp $
05: * author: Henner Zeller <H.Zeller@acm.org>
06: */
07: package henplus;
08:
09: /**
10: * This is a Sample plugin. Its simple: just implement the Command
11: * interface and a public default constructor. Thats it.
12: */
13: public class SamplePlugin extends AbstractCommand {
14:
15: public SamplePlugin() { /* default constructor */
16: }
17:
18: /**
19: * returns the command-strings this plug-in can handle
20: */
21: public String[] getCommandList() {
22: return new String[] { "sample-plugin", "do-something" };
23: }
24:
25: public int execute(SQLSession session, String cmd, String param) {
26: System.err.println("This plugin does nothing.");
27: return SUCCESS;
28: }
29:
30: public boolean requiresValidSession(String cmd) {
31: return false; // this plugin works always.
32: }
33:
34: public String getShortDescription() {
35: return "sample plugin";
36: }
37:
38: public String getLongDescription(String cmd) {
39: return "\tThis is an example for the long description of the\n"
40: + "\tsample plugin. Actually, this plugin does really nothing\n"
41: + "\tbut shows how simple it is to implement a plugin that\n"
42: + "\tbehaves like a normal built-in command. This one is\n"
43: + "\tjust simply derived from henplus.AbstractCommand and\n"
44: + "\toverrides some methods.\n" + "\tThats it.";
45: }
46:
47: public String getSynopsis(String cmd) {
48: return cmd;
49: }
50: }
51:
52: /*
53: * Local variables:
54: * c-basic-offset: 4
55: * compile-command: "ant -emacs -find build.xml"
56: * End:
57: */
|