1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.geronimo.ews.ws4j2ee.context.impl;
18
19 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
20 import org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext;
21 import org.apache.geronimo.ews.ws4j2ee.context.MiscInfo;
22 import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
23 import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.WebContext;
24 import org.apache.geronimo.ews.ws4j2ee.context.webservices.client.interfaces.ServiceReferanceContext;
25 import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFContext;
26 import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
27 import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
28 import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeFactory;
29
30 import java.util.Vector;
31
32 /***
33 * <p>Code should use parsers and create runtime representation
34 * of the information taken fom the WSDL and configaration files.</p>
35 * <p>depend on hasWSDL or the not the implementation should
36 * <ol>
37 * <li>parse the WSDL and populate informatio in <code>WSDLContext</code></li>
38 * <li>parse the SEI or EJB and populate the information in <code>WSDLContext</code>
39 * with the help of the jaxrpc mapping file information.
40 * </li>
41 * </ol>
42 * </p>
43 *
44 * @author Srinath Perera(hemapani@opensorce.lk)
45 * @see org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext
46 */
47 public class J2EEWebServiceContextImpl implements J2EEWebServiceContext {
48 private boolean hasWSDL = true;
49 private WSCFContext wscfcontext;
50 private WSDLContext wsdlcontext;
51 private JaxRpcMapperContext jaxrpcmappingcontext;
52 private MiscInfo miscInfo;
53 private Ws4J2eeFactory factory;
54 private Vector srcontext;
55 private EJBContext ejbcontext;
56 private WebContext webcontext;
57
58 public J2EEWebServiceContextImpl(boolean hasWSDL) {
59 this.hasWSDL = hasWSDL;
60 srcontext = new Vector();
61 }
62
63
64
65
66 public WSDLContext getWSDLContext() {
67 return wsdlcontext;
68 }
69
70
71
72
73 public void setWSDLContext(WSDLContext wsdlcontext) {
74 this.wsdlcontext = wsdlcontext;
75 }
76
77
78
79
80 public JaxRpcMapperContext getJAXRPCMappingContext() {
81 return jaxrpcmappingcontext;
82 }
83
84
85
86
87 public void setJAXRPCMappingContext(JaxRpcMapperContext context) {
88 this.jaxrpcmappingcontext = context;
89 }
90
91 public WSCFContext getWSCFContext() {
92 return wscfcontext;
93 }
94
95
96
97
98 public void setWSCFContext(WSCFContext wscfcontext) {
99 this.wscfcontext = wscfcontext;
100 }
101
102 public MiscInfo getMiscInfo() {
103 return miscInfo;
104 }
105
106 /***
107 * @param info
108 */
109 public void setMiscInfo(MiscInfo info) {
110 this.miscInfo = info;
111 }
112
113 public void validate() {
114 if (wscfcontext == null || miscInfo == null ||
115 (hasWSDL && wsdlcontext == null) || jaxrpcmappingcontext == null)
116 throw new UnrecoverableGenerationFault("valdation of the j2ee context failed");
117 miscInfo.validate();
118 }
119
120 public void setFactory(Ws4J2eeFactory factory) {
121 this.factory = factory;
122 }
123
124 public Ws4J2eeFactory getFactory() {
125 return this.factory;
126 }
127
128 public void addServiceReferanceContext(ServiceReferanceContext context) {
129 srcontext.add(context);
130 }
131
132 public EJBContext getEJBDDContext() {
133 return ejbcontext;
134 }
135
136 public ServiceReferanceContext getServiceReferanceContext(int index) {
137 return (ServiceReferanceContext) srcontext.get(index);
138 }
139
140 public int getServiceReferanceContextCount() {
141 return srcontext.size();
142 }
143
144 public WebContext getWebDDContext() {
145 return webcontext;
146 }
147
148 public void setEJBDDContext(EJBContext context) {
149 this.ejbcontext = context;
150 }
151
152 public void setWebDDContext(WebContext context) {
153 webcontext = context;
154 }
155
156 }