01: package org.enhydra.server;
02:
03: import com.lutris.appserver.server.Application;
04: import com.lutris.appserver.server.httpPresentation.HttpPresentationManager;
05: import com.lutris.util.Config;
06: import com.lutris.util.KeywordValueException;
07:
08: /**
09: * <p>Title: </p>
10: * <p>Description:
11: * JavaBean class provide information about Presentation Manager
12: * from config file and currently active database from application
13: * DatabaseManager.</p>
14: * <p>Copyright: Copyright (c) 2002</p>
15: * <p>Company: www.together.at</p>
16: * @author Zeljko Tufegdzic, tufex@uns.ns.ac.yu
17: * @version 1.0
18: */
19:
20: public class PresentationInfo {
21:
22: public PresentationInfo() {
23: }
24:
25: private String POCache = "Enabled";
26: private String resourceCache = "Disabled";
27: private String EntriesPOCache;
28: private String EntriesResourceCache;
29: private Config config;
30: private HttpPresentationManager pm;
31:
32: public PresentationInfo(Application app, Config pmConfig)
33: throws KeywordValueException {
34: // Initialize properties from PresentationManager
35: config = pmConfig;
36: pm = null;
37: POCache = "Enabled";
38: resourceCache = "Disabled";
39: EntriesPOCache = "N/A";
40: EntriesResourceCache = "N/A";
41: if (config != null) {
42: if (config.containsKey("CacheClasses"))
43: if (config.getBoolean("CacheClasses"))
44: POCache = "Enabled";
45: else
46: POCache = "Disabled";
47: if (config.containsKey("CacheFiles"))
48: if (config.getBoolean("CacheFiles"))
49: resourceCache = "Enabled";
50: else
51: resourceCache = "Disabled";
52: }
53: if (app != null) {
54: pm = app.getHttpPresentationManager();
55: if (pm != null) {
56: EntriesPOCache = String.valueOf(pm.sizeofPOCache());
57: EntriesResourceCache = String.valueOf(pm
58: .sizeofResourceCache());
59: } else
60: log("WARNING: PresentationManager = null");
61: } else
62: log("WARNING: application = null");
63: }
64:
65: public String getPOCache() {
66: return POCache;
67: }
68:
69: public String getResourceCache() {
70: return resourceCache;
71: }
72:
73: public String getEntriesPOCache() {
74: return EntriesPOCache;
75: }
76:
77: public String getEntriesResourceCache() {
78: return EntriesResourceCache;
79: }
80:
81: private void log(String msg) {
82: // FIXME.DEBUG.Log to file
83: System.err.println("EnhydraServer, Presentation Info: " + msg);
84: }
85: }
|