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