1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.geronimo.ews.ws4j2ee.toWs;
18
19 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
20 import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
21
22 /***
23 * abstract class writer
24 *
25 * @author Srianth Perera(hemapani@opensource.lk)
26 */
27 public abstract class JavaInterfaceWriter extends AbstractWriter {
28 protected String qulifiedName;
29 protected String classname;
30 protected String packageName/package-summary.html">ong> String packageName;
31 private String pacakgesatement;
32 private String targetDirectory;
33
34 public JavaInterfaceWriter(J2EEWebServiceContext j2eewscontext, String qulifiedName) throws GenerationFault {
35 super(j2eewscontext, Utils.getFileNamefromClass(j2eewscontext, qulifiedName));
36 if (qulifiedName == null) {
37 throw new GenerationFault("the class qualified name must not be null");
38 }
39 this.qulifiedName = qulifiedName;
40 packageName = Utils.getPackageNameFromQuallifiedName(qulifiedName);
41 classname = Utils.getClassNameFromQuallifiedName(qulifiedName);
42 }
43
44 public void writeCode() throws GenerationFault {
45 if (out == null)
46 return;
47 out.write((packageName != null) ? ("package " + packageName + ";\n") : "");
48 writeImportStatements();
49 writeClassComment();
50 out.write("public interface "
51 + classname
52 + getExtendsPart()
53 + "{\n");
54 writeAttributes();
55 writeMethods();
56 out.write("}\n");
57 }
58
59 protected String getExtendsPart() {
60 return " ";
61 }
62
63 protected void writeClassComment() throws GenerationFault {
64 }
65
66 protected void writeImportStatements() throws GenerationFault {
67 }
68
69 protected abstract void writeAttributes() throws GenerationFault;
70
71 protected abstract void writeMethods() throws GenerationFault;
72 }