KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > generator > eventhandler > GROnlineHandler


1 package de.webman.generator.eventhandler;
2
3 import java.io.*;
4 import java.net.*;
5
6 import com.teamkonzept.lib.*;
7 import com.teamkonzept.web.TKEvent;
8 import com.teamkonzept.web.TKHttpInterface;
9 import com.teamkonzept.webman.ProcessStarter;
10 import de.webman.acl.LoginFactory;
11 import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
12 import com.teamkonzept.webman.WebManEvent;
13 import com.teamkonzept.webman.mainint.events.*;
14
15 /**
16  * Intershop goes online
17  * @author $Author: mischa $
18  * @version $Revision: 1.2 $
19  */

20 public class GROnlineHandler
21     extends DefaultEventHandler
22 {
23     private static GROnlineHandler instance = new GROnlineHandler();
24
25     private GROnlineHandler()
26     {
27     }
28
29     public static GROnlineHandler getInstance()
30     {
31         return instance;
32     }
33
34     public void handleEvent(TKEvent evt) throws TKException
35     {
36         try
37         {
38             // WebManEvent.checkEvent(evt, INTERSHOP); // ????
39

40             TKHttpInterface httpInf = evt.getHttpInterface();
41             GRHTMLWrapper out = new GRHTMLWrapper(new PrintWriter(httpInf.getOutputStream()), httpInf.getContextPath());
42             PrintWriter log = new PrintWriter(httpInf.getLogStream());
43
44             out.start("Publisher",
45                       LoginFactory.getInstance().getLogin(evt.getRemoteUser()).getName());
46
47             boolean success = false;
48             ProcessStarter ps = new ProcessStarter(out, log);
49
50             try
51             {
52                 success = ps.start("WebManPublish",
53                                    "intershop.properties",
54                                    ProcessStarter.getWMClasspath(httpInf.getDocumentRoot()));
55             }
56             catch (Exception JavaDoc e)
57             {
58                 out.println(e);
59                 log.println(e);
60             }
61
62             out.end(success);
63             out.close();
64             log.close();
65         }
66         catch (Throwable JavaDoc e)
67         {
68             // TO DO : Analyze Exception !
69
throw WebmanExceptionHandler.getException(e);
70         }
71     }
72
73     public boolean isHandler(TKEvent evt)
74     {
75         return evt.getName().equalsIgnoreCase("GR_ONLINE");
76     }
77
78 }
79
Popular Tags