1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.geronimo.ews.ws4j2ee.toWs.ejb;
17
18 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
19 import org.apache.geronimo.ews.ws4j2ee.context.SEIOperation;
20 import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
21 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
22 import org.apache.geronimo.ews.ws4j2ee.toWs.JavaInterfaceWriter;
23
24 import java.util.ArrayList;
25 import java.util.Iterator;
26
27 /***
28 * This class can be used to write the appropriate EJB Remote interface
29 * class for the given port type.
30 *
31 * @author Rajith Priyanga
32 * @author Srinath Perera
33 * @date Nov 26, 2003
34 */
35 public class EJBLocalWriter extends JavaInterfaceWriter {
36 private String name;
37 protected EJBContext ejbcontext;
38
39 /***
40 * Constructs a EJBRemoteWriter.
41 *
42 * @param portType The port type which contains the details.
43 * @throws GenerationFault
44 */
45 public EJBLocalWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
46 super(context, ejbcontext.getEjbLocalInterface());
47 this.ejbcontext = ejbcontext;
48 }
49
50 protected String getExtendsPart() {
51 return " extends javax.ejb.EJBLocalObject";
52 }
53
54 protected void writeAttributes() throws GenerationFault {
55 }
56
57 protected void writeMethods() throws GenerationFault {
58 String parmlistStr = "";
59 ArrayList operations = j2eewscontext.getMiscInfo().getSEIOperations();
60 for (int i = 0; i < operations.size(); i++) {
61 SEIOperation op = (SEIOperation) operations.get(i);
62 String returnType = op.getReturnType();
63 if (returnType == null)
64 returnType = "void";
65 out.write("\tpublic " + returnType + " " + op.getMethodName() + "(");
66 Iterator pas = op.getParameterNames().iterator();
67 boolean first = true;
68 while (pas.hasNext()) {
69 String name = (String) pas.next();
70 String type = (String) op.getParameterType(name);
71 if (first) {
72 first = false;
73 out.write(type + " " + name);
74 parmlistStr = parmlistStr + name;
75 } else {
76 out.write("," + type + " " + name);
77 parmlistStr = "," + name;
78 }
79 }
80 out.write(")");
81
82
83
84
85
86 out.write(";\n");
87 }
88 }
89
90 }