01: /*
02: * calculator
03: * A sample Enhydra Application
04: * 1/99
05: * Andy John
06: * andy@enhydra.org
07: *
08: */
09: package calculator;
10:
11: import com.lutris.appserver.server.*;
12: import com.lutris.appserver.server.httpPresentation.*;
13: import com.lutris.appserver.server.session.*;
14: import com.lutris.util.*;
15:
16: /**
17: * This is a sample Enhydra application. It simulates a simple calculator.
18: * A scan of a real calculator is used for the front end, with an image map.<P>
19: *
20: * A global counter of the number of buttons pushed (across all users) is
21: * kept here. <P>
22: *
23: * Noramlly an Enhydra application would make note of various settings
24: * in the config file, but this application is so simple it needs no
25: * configuration.
26: */
27: public class CalcApp extends StandardApplication {
28:
29: /**
30: * A hit counter for the number of buttons pressed by all users.
31: */
32: public long buttonsPushed = 0;
33:
34: /*
35: * A few methods you might want to add to.
36: * See StandardApplication for more details.
37: */
38: public void startup(Config appConfig) throws ApplicationException {
39: super .startup(appConfig);
40: // Here is where you would read application-specific settings from
41: // your config file.
42: }
43:
44: public boolean requestPreprocessor(HttpPresentationComms comms)
45: throws Exception {
46: return super .requestPreprocessor(comms);
47: }
48:
49: /**
50: * Show the number of buttons pressed. This will only be called by the
51: * Enhydra Multiserver (it won't show up in other servers).
52: *
53: * @return HTML that is displayed in the status page of the Multiserver.
54: */
55: public String toHtml() {
56: return "This is a sample Enhydra Application. " + buttonsPushed
57: + " buttons have been pushed so far.";
58: }
59:
60: }
|