1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
21 import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
22 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
23 import org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter;
24 import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
25 import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
26
27 /***
28 * This class genarate the wrapper Webservice.
29 *
30 * @author Srinath Perera(hemapani@opensource.lk)
31 */
32 public abstract class EJBBasedWrapperClassWriter extends JavaClassWriter {
33 protected static Log log =
34 LogFactory.getLog(WrapperWsGenerator.class.getName());
35 protected String seiName = null;
36 protected EJBContext context;
37
38 /***
39 * @param j2eewscontext
40 * @param qulifiedName
41 * @throws GenerationFault
42 */
43 public EJBBasedWrapperClassWriter(J2EEWebServiceContext j2eewscontext)
44 throws GenerationFault {
45 super(j2eewscontext, getName(j2eewscontext) + "Impl");
46 context = j2eewscontext.getEJBDDContext();
47 if (context == null) {
48 throw new UnrecoverableGenerationFault("for ejbbased Impl" +
49 " the EJBDDContext must not be null");
50 }
51 }
52
53 private static String getName(J2EEWebServiceContext j2eewscontext) {
54 String name = j2eewscontext.getWSDLContext().gettargetBinding().getName();
55 if (name == null) {
56 name = Utils.qName2JavaName(j2eewscontext.getWSDLContext().gettargetBinding().getQName());
57 }
58 return name;
59 }
60
61 protected String getimplementsPart() {
62 return " implements " + j2eewscontext.getMiscInfo().getJaxrpcSEI() + ",org.apache.geronimo.ews.ws4j2ee.wsutils.ContextAccessible";
63 }
64
65 protected void writeAttributes() throws GenerationFault {
66 out.write("private " + seiName + " ejb = null;\n");
67 out.write("private org.apache.axis.MessageContext msgcontext;\n");
68 }
69
70 protected void writeConstructors() throws GenerationFault {
71 out.write("\tpublic " + classname + "(){}\n");
72 }
73 }