01: package example;
02:
03: import com.caucho.util.L10N;
04: import java.util.logging.Logger;
05: import java.util.logging.Level;
06:
07: import java.io.IOException;
08:
09: /**
10: *
11: */
12: public class SetProphetCommand extends AbstractCommand {
13: static protected final Logger log = Logger
14: .getLogger(SetProphetCommand.class.getName());
15: static final L10N L = new L10N(SetProphetCommand.class);
16:
17: String _prophet = null;
18:
19: public void init() {
20: super .init();
21: _prophet = null;
22: }
23:
24: void parse(Parser p) throws IOException {
25: _prophet = p.parseToken();
26: if (_prophet == null)
27: setError("Expecting prophet name");
28: }
29:
30: String act(Magic8Ball magic8ball) {
31: magic8ball.setProphet(_prophet);
32: return "prophet set to `" + magic8ball.getProphet() + "'";
33: }
34:
35: }
|