01: package org.zilonis.tool.ui.shell;
02:
03: import java.io.DataInputStream;
04: import java.io.IOException;
05: import java.io.PrintStream;
06:
07: /**
08: * The shell will call on an interpretor with this interface.
09: *
10: * @author John Pritchard
11: */
12: public interface Plugin {
13:
14: /**
15: * String displayed in the UI, under the console, with the interpreter's
16: * name and version.
17: */
18: public String userVersion();
19:
20: /**
21: * The interpreter handles I/O on this interface as if on the command
22: * line, until this method throws an exception.
23: *
24: * @param stdin
25: * GUI console input.
26: *
27: * @param stdout
28: * GUI console output.
29: *
30: * @param stderr
31: * GUI console output.
32: */
33: public void console(DataInputStream stdin, PrintStream stdout,
34: PrintStream stderr) throws IOException;
35:
36: /**
37: * Called with an exception from the "console" method. If the "console"
38: * method returns, interpretation continues. However, if it throws an
39: * exception, this method is called with that exception to verify that
40: * the shell interpretation thread should exit.
41: *
42: * @param exc
43: * Exception thrown by the console.
44: *
45: * @param stdout
46: * GUI console output.
47: *
48: * @param stderr
49: * GUI console output.
50: *
51: * @return Whether to continue the shell intepretation thread or return.
52: */
53: public boolean exception(Exception exc, PrintStream stdout,
54: PrintStream stderr);
55:
56: }
|