KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > admin > presentation > WelcomePresentation


1 /*
2  * SimpleCacheAdmin
3  *
4  * Enhydra super-servlet presentation object
5  *
6  */

7
8 package org.enhydra.admin.presentation;
9
10 import org.enhydra.admin.*;
11
12 // Enhydra SuperServlet imports
13
import com.lutris.appserver.server.httpPresentation.HttpPresentation;
14 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms;
15 import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
16 import com.lutris.logging.Logger;
17
18 // Standard imports
19
import java.io.IOException JavaDoc;
20
21 public class WelcomePresentation implements HttpPresentation {
22         
23         public void run(HttpPresentationComms comms)
24         throws HttpPresentationException, IOException JavaDoc {
25
26         WelcomeHTML welcome;
27         
28         welcome = (WelcomeHTML)comms.xmlcFactory.create(WelcomeHTML.class);
29         
30         String JavaDoc action = comms.request.getParameter("action");
31         
32         String JavaDoc message = "This is simple Enhydra Application which walks trough set"+
33                 " of registered Enhydra Application (DatabaseManager) "+
34                 "MBeans and invokes adequate operations.";
35                 
36         SimpleCacheAdmin application = (SimpleCacheAdmin)comms.application;
37         
38         if ("refreshCache".equals(action)){
39             message = application.mBeanTrigger.refreshCache();
40             application.getLogChannel().write(Logger.INFO,message);
41         } else if ("refreshStatistic".equals(action)){
42             message = application.mBeanTrigger.refreshStatistic();
43             application.getLogChannel().write(Logger.INFO,message);
44         } if ("enableCache".equals(action)){
45             message = application.mBeanTrigger.enableCache();
46             application.getLogChannel().write(Logger.INFO,message);
47         } if ("disableCache".equals(action)){
48             message = application.mBeanTrigger.disableCache();
49             application.getLogChannel().write(Logger.INFO,message);
50         } if ("toggleCache".equals(action)){
51             message = application.mBeanTrigger.toggleCache();
52             application.getLogChannel().write(Logger.INFO,message);
53         }
54         welcome.setTextMessage(message);
55         comms.response.writeDOM(welcome);
56     }
57 }
58
Popular Tags