1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.geronimo.ews.ws4j2ee.toWs.dd.geronimo;
18
19 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
20 import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
21 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
22 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
23
24 /***
25 * @author hemapani
26 */
27 public class GeronimoDDWriter extends AbstractWriter {
28 public GeronimoDDWriter(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
29 super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath() +
30 "/META-INF/" + GenerationConstants.GERONIMO_DD);
31 }
32
33 public void writeCode() throws GenerationFault {
34 writeEJBDD();
35 }
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 public void writeEJBDD() {
51 String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
52 int index = ejbname.lastIndexOf(".");
53 if (index > 0) {
54 ejbname = ejbname.substring(index + 1);
55 }
56 out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
57 out.write("<openejb-jar\n");
58 out.write(" xmlns=\"http://www.openejb.org/xml/ns/openejb-jar\"\n");
59 out.write(" configId=\"j2ee/geronimo/ews/" + ejbname + "\"\n");
60 out.write(" parentId=\"org/apache/geronimo/Server\">\n");
61 out.write(" <enterprise-beans>\n");
62 out.write(" <session>\n");
63 out.write(" <ejb-name>" + ejbname + "</ejb-name>\n");
64 String implStyle = j2eewscontext.getMiscInfo().getImplStyle();
65 if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
66 || GenerationConstants.USE_REMOTE.equals(implStyle)) {
67 out.write(" <jndi-name>" + "ejb/" + ejbname + "</jndi-name>\n");
68 }
69 if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
70 || GenerationConstants.USE_LOCAL.equals(implStyle)) {
71 out.write(" <local-jndi-name>" + "ejb/" + ejbname + "Local" + "</local-jndi-name>\n");
72 }
73 out.write(" </session>\n");
74 out.write(" </enterprise-beans>\n");
75 out.write("</openejb-jar>\n");
76 out.flush();
77 }
78
79
80
81
82
83
84
85
86
87
88
89 public void writeWebDD() {
90 String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
91 int index = ejbname.lastIndexOf(".");
92 if (index > 0) {
93 ejbname = ejbname.substring(index + 1);
94 }
95 out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
96 out.write("<web-app\n");
97 out.write(" xmlns=\"http://www.openejb.org/xml/ns/openejb-jar\"\n");
98 out.write(" configId=\"j2ee/geronimo/ews/" + ejbname + "\"\n");
99 out.write(" parentId=\"org/apache/geronimo/Server\">\n");
100 out.write(" <context-root>/axis</context-root>");
101 out.write(" <context-priority-classloader>false</context-priority-classloader>");
102 out.write("</web-app>");
103 }
104
105 }