1 package com.instantbank.lettertemplate.control.web;
2
3 import java.util.Locale;
4 import java.util.Collection;
5 import java.io.Serializable;
6 import java.rmi.RemoteException;
7
8 import javax.rmi.PortableRemoteObject;
9 import javax.naming.InitialContext;
10 import javax.servlet.http.HttpSession;
11 import javax.ejb.FinderException;
12 import javax.ejb.CreateException;
13 import javax.ejb.RemoveException;
14 import javax.naming.NamingException;
15 import com.instantbank.lettertemplate.control.GeneralFailureException;
16 import com.instantbank.lettertemplate.control.util.WebKeys;
17 import com.instantbank.common.utilcomponents.Debug;
18 import com.instantbank.lettertemplate.control.LetterTemplateEventException;
19 import com.instantbank.lettertemplate.control.ejb.LetterTemplateController;
20 import com.instantbank.lettertemplate.control.event.LetterTemplateEvent;
21 import com.instantbank.component.job.ejb.Job;
22
23
35 public class LetterTemplateControllerProxy
36 implements Serializable {
37
38 private ModelManager mm;
39 private LetterTemplateController sccEjb;
40 private HttpSession session;
41 private Debug debug = null;
42
43
44
47 public LetterTemplateControllerProxy() { }
48
49
50
55 public LetterTemplateControllerProxy(HttpSession session) {
56 debug = new Debug();
57 debug.setDebugginOn(true);
58 debug.setPreMessage("** LetterTemplateControllerProxy: ");
59 debug.println("constructor");
60
61 this.session = session;
62 mm = (ModelManager)session.getAttribute(WebKeys.ModelManagerKey);
63 sccEjb = mm.getSCCEJB();
64 }
65
66
67
73 public synchronized Job getJobEJB(Long jobId) {
74 try {
75 return sccEjb.getOldJob(jobId);
76 }
77 catch(RemoteException re) {
78 throw new GeneralFailureException(re.getMessage());
79 }
80 }
81
82
83
95 public synchronized Collection handleEvent(LetterTemplateEvent ese)
96 throws LetterTemplateEventException {
97 try {
98 debug.println("passing event from Application tier to Service tier");
99 debug.println("event=" + ese);
100 sccEjb = mm.getSCCEJB();
101 return sccEjb.handleEvent(ese);
102 }
103 catch(RemoteException re) {
104 throw new GeneralFailureException(re.getMessage());
105 }
106 }
107
108
109
113 public synchronized void remove() {
114
115 try {
116 debug.println("before sccEjb.remove()");
117 sccEjb.remove();
118 }
119 catch(RemoveException re) {
120
121 debug.println(re.toString());
122 }
123 catch(RemoteException rte) {
124
125 debug.println(rte.toString());
126 }
127 }
128 }
129
130