01: package de.webman.generator.eventhandler;
02:
03: import java.io.*;
04: import java.net.*;
05:
06: import com.teamkonzept.lib.*;
07: import com.teamkonzept.web.TKEvent;
08: import com.teamkonzept.web.TKHttpInterface;
09: 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 extends DefaultEventHandler {
21: private static GROnlineHandler instance = new GROnlineHandler();
22:
23: private GROnlineHandler() {
24: }
25:
26: public static GROnlineHandler getInstance() {
27: return instance;
28: }
29:
30: public void handleEvent(TKEvent evt) throws TKException {
31: try {
32: // WebManEvent.checkEvent(evt, INTERSHOP); // ????
33:
34: TKHttpInterface httpInf = evt.getHttpInterface();
35: GRHTMLWrapper out = new GRHTMLWrapper(new PrintWriter(
36: httpInf.getOutputStream()), httpInf
37: .getContextPath());
38: PrintWriter log = new PrintWriter(httpInf.getLogStream());
39:
40: out.start("Publisher", LoginFactory.getInstance().getLogin(
41: evt.getRemoteUser()).getName());
42:
43: boolean success = false;
44: ProcessStarter ps = new ProcessStarter(out, log);
45:
46: try {
47: success = ps.start("WebManPublish",
48: "intershop.properties", ProcessStarter
49: .getWMClasspath(httpInf
50: .getDocumentRoot()));
51: } catch (Exception e) {
52: out.println(e);
53: log.println(e);
54: }
55:
56: out.end(success);
57: out.close();
58: log.close();
59: } catch (Throwable e) {
60: // TO DO : Analyze Exception !
61: throw WebmanExceptionHandler.getException(e);
62: }
63: }
64:
65: public boolean isHandler(TKEvent evt) {
66: return evt.getName().equalsIgnoreCase("GR_ONLINE");
67: }
68:
69: }
|