KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > ws > axis > JService


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: JService.java,v 1.8 2005/01/25 13:39:52 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.jonas.ws.axis;
26
27 import java.io.InputStream JavaDoc;
28 import java.net.URL JavaDoc;
29 import java.rmi.Remote JavaDoc;
30 import java.util.Hashtable JavaDoc;
31 import java.util.Map JavaDoc;
32 import java.util.Properties JavaDoc;
33
34 import javax.xml.namespace.QName JavaDoc;
35 import javax.xml.rpc.Call JavaDoc;
36 import javax.xml.rpc.ServiceException JavaDoc;
37
38 import org.apache.axis.EngineConfiguration;
39 import org.apache.axis.client.Service;
40 import org.apache.axis.wsdl.gen.Parser;
41
42 /**
43  * JService is the JOnAS J2EE layer on top of axis Service implementation. It is
44  * currently a no-op class.
45  * @author Guillaume Sauthier
46  */

47 public class JService extends Service {
48
49     /**
50      * Internal Map that store service-endpoint-interface names to wsdl:port
51      * QName
52      */

53     private Map JavaDoc classname2wsdlPort = null;
54
55     /**
56      * Hastable to store call instances properties
57      */

58     private Hashtable JavaDoc mapCallProperties = new Hashtable JavaDoc();
59
60     /**
61      * Hastable to store stub instances properties
62      */

63     private Hashtable JavaDoc mapStubProperties = new Hashtable JavaDoc();
64
65     /**
66      * @see org.apache.axis.client.Service#Service()
67      */

68     public JService() {
69         super();
70     }
71
72     /**
73      * @see org.apache.axis.client.Service#Service(javax.xml.rpc.QName)
74      */

75     public JService(QName JavaDoc serviceName) {
76         super(serviceName);
77     }
78
79     /**
80      * @see org.apache.axis.client.Service#Service(org.apache.axis.EngineConfiguration)
81      */

82     public JService(EngineConfiguration config) {
83         super(config);
84     }
85
86     /**
87      * @see org.apache.axis.client.Service#Service(java.net.URL,
88      * javax.xml.rpc.QName)
89      */

90     public JService(URL JavaDoc wsdlDoc, QName JavaDoc serviceName) throws ServiceException JavaDoc {
91         super(wsdlDoc, serviceName);
92     }
93
94     /**
95      * @see org.apache.axis.client.Service#Service(org.apache.axis.wsdl.gen.Parser,
96      * javax.xml.rpc.QName)
97      */

98     public JService(Parser parser, QName JavaDoc serviceName) throws ServiceException JavaDoc {
99         super(parser, serviceName);
100     }
101
102     /**
103      * @see org.apache.axis.client.Service#Service(java.lang.String,
104      * javax.xml.rpc.QName)
105      */

106     public JService(String JavaDoc wsdlLocation, QName JavaDoc serviceName) throws ServiceException JavaDoc {
107         super(wsdlLocation, serviceName);
108     }
109
110     /**
111      * @see org.apache.axis.client.Service#Service(java.io.InputStream,
112      * javax.xml.rpc.QName)
113      */

114     public JService(InputStream JavaDoc wsdlInputStream, QName JavaDoc serviceName) throws ServiceException JavaDoc {
115         super(wsdlInputStream, serviceName);
116     }
117
118     /**
119      * @see javax.xml.rpc.Service#getPort(java.lang.Class)
120      */

121     public Remote JavaDoc getPort(Class JavaDoc proxyInterface) throws ServiceException JavaDoc {
122         if (this.classname2wsdlPort != null) {
123             QName JavaDoc portname = (QName JavaDoc) this.classname2wsdlPort.get(proxyInterface.getName());
124             if (portname != null) {
125                 return getPort(portname, proxyInterface);
126             } else {
127                 return super.getPort(proxyInterface);
128             }
129         }
130         return super.getPort(proxyInterface);
131     }
132
133     /**
134      * @see javax.xml.rpc.Service#createCall()
135      */

136     public Call JavaDoc createCall() throws ServiceException JavaDoc {
137
138         return new JCall(this);
139     }
140
141     /**
142      * Assign the classname 2 port Map.
143      * @param map Map to be used
144      */

145     public void assignSEIClassnameToWSDLPort(Map JavaDoc map) {
146         this.classname2wsdlPort = map;
147     }
148
149     /**
150      * @param name port name
151      * @param callProperties properties used to configure the Call instances
152      */

153     public void assignCallProperties(String JavaDoc name, Properties JavaDoc callProperties) {
154         this.mapCallProperties.put(name, callProperties);
155     }
156
157     /**
158      * @param name port name
159      * @param stubProperties properties used to configure the Stub instances
160      */

161     public void assignStubProperties(String JavaDoc name, Properties JavaDoc stubProperties) {
162         this.mapStubProperties.put(name, stubProperties);
163     }
164
165     /**
166      * @param name port name
167      * @return Returns the callProperties.
168      */

169     public Properties JavaDoc getCallProperties(String JavaDoc name) {
170         Properties JavaDoc props = null;
171         if (mapCallProperties.containsKey(name)) {
172             props = (Properties JavaDoc) mapCallProperties.get(name);
173         }
174         return props;
175     }
176
177     /**
178      * @param name port name
179      * @return Returns the stubProperties.
180      */

181     public Properties JavaDoc getStubProperties(String JavaDoc name) {
182         Properties JavaDoc props = null;
183         if (mapStubProperties.containsKey(name)) {
184             props = (Properties JavaDoc) mapStubProperties.get(name);
185         }
186         return props;
187     }
188
189 }
Popular Tags