KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > server > PresentationInfo


1 package org.enhydra.server;
2
3
4 import com.lutris.appserver.server.Application;
5 import com.lutris.appserver.server.httpPresentation.HttpPresentationManager;
6 import com.lutris.util.Config;
7 import com.lutris.util.KeywordValueException;
8
9
10 /**
11  * <p>Title: </p>
12  * <p>Description:
13  * JavaBean class provide information about Presentation Manager
14  * from config file and currently active database from application
15  * DatabaseManager.</p>
16  * <p>Copyright: Copyright (c) 2002</p>
17  * <p>Company: www.together.at</p>
18  * @author Zeljko Tufegdzic, tufex@uns.ns.ac.yu
19  * @version 1.0
20  */

21
22 public class PresentationInfo {
23
24   public PresentationInfo() {
25   }
26   private String JavaDoc POCache = "Enabled";
27   private String JavaDoc resourceCache = "Disabled";
28   private String JavaDoc EntriesPOCache;
29   private String JavaDoc EntriesResourceCache;
30   private Config config;
31   private HttpPresentationManager pm;
32
33   public PresentationInfo(Application app,Config pmConfig)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.sizeofResourceCache());
58       }else log("WARNING: PresentationManager = null");
59     }else log("WARNING: application = null");
60   }
61
62
63
64
65
66   public String JavaDoc getPOCache() {
67     return POCache;
68   }
69   public String JavaDoc getResourceCache() {
70     return resourceCache;
71   }
72   public String JavaDoc getEntriesPOCache() {
73     return EntriesPOCache;
74   }
75   public String JavaDoc getEntriesResourceCache() {
76     return EntriesResourceCache;
77   }
78   private void log(String JavaDoc msg) {
79   // FIXME.DEBUG.Log to file
80
System.err.println("EnhydraServer, Presentation Info: "+msg);
81   }
82 }
Popular Tags