001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2005 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: JService.java 6156 2005-01-25 13:39:52Z sauthieg $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.ws.axis;
025:
026: import java.io.InputStream;
027: import java.net.URL;
028: import java.rmi.Remote;
029: import java.util.Hashtable;
030: import java.util.Map;
031: import java.util.Properties;
032:
033: import javax.xml.namespace.QName;
034: import javax.xml.rpc.Call;
035: import javax.xml.rpc.ServiceException;
036:
037: import org.apache.axis.EngineConfiguration;
038: import org.apache.axis.client.Service;
039: import org.apache.axis.wsdl.gen.Parser;
040:
041: /**
042: * JService is the JOnAS J2EE layer on top of axis Service implementation. It is
043: * currently a no-op class.
044: * @author Guillaume Sauthier
045: */
046: public class JService extends Service {
047:
048: /**
049: * Internal Map that store service-endpoint-interface names to wsdl:port
050: * QName
051: */
052: private Map classname2wsdlPort = null;
053:
054: /**
055: * Hastable to store call instances properties
056: */
057: private Hashtable mapCallProperties = new Hashtable();
058:
059: /**
060: * Hastable to store stub instances properties
061: */
062: private Hashtable mapStubProperties = new Hashtable();
063:
064: /**
065: * @see org.apache.axis.client.Service#Service()
066: */
067: public JService() {
068: super ();
069: }
070:
071: /**
072: * @see org.apache.axis.client.Service#Service(javax.xml.rpc.QName)
073: */
074: public JService(QName serviceName) {
075: super (serviceName);
076: }
077:
078: /**
079: * @see org.apache.axis.client.Service#Service(org.apache.axis.EngineConfiguration)
080: */
081: public JService(EngineConfiguration config) {
082: super (config);
083: }
084:
085: /**
086: * @see org.apache.axis.client.Service#Service(java.net.URL,
087: * javax.xml.rpc.QName)
088: */
089: public JService(URL wsdlDoc, QName serviceName)
090: throws ServiceException {
091: super (wsdlDoc, serviceName);
092: }
093:
094: /**
095: * @see org.apache.axis.client.Service#Service(org.apache.axis.wsdl.gen.Parser,
096: * javax.xml.rpc.QName)
097: */
098: public JService(Parser parser, QName serviceName)
099: throws ServiceException {
100: super (parser, serviceName);
101: }
102:
103: /**
104: * @see org.apache.axis.client.Service#Service(java.lang.String,
105: * javax.xml.rpc.QName)
106: */
107: public JService(String wsdlLocation, QName serviceName)
108: throws ServiceException {
109: super (wsdlLocation, serviceName);
110: }
111:
112: /**
113: * @see org.apache.axis.client.Service#Service(java.io.InputStream,
114: * javax.xml.rpc.QName)
115: */
116: public JService(InputStream wsdlInputStream, QName serviceName)
117: throws ServiceException {
118: super (wsdlInputStream, serviceName);
119: }
120:
121: /**
122: * @see javax.xml.rpc.Service#getPort(java.lang.Class)
123: */
124: public Remote getPort(Class proxyInterface) throws ServiceException {
125: if (this .classname2wsdlPort != null) {
126: QName portname = (QName) this .classname2wsdlPort
127: .get(proxyInterface.getName());
128: if (portname != null) {
129: return getPort(portname, proxyInterface);
130: } else {
131: return super .getPort(proxyInterface);
132: }
133: }
134: return super .getPort(proxyInterface);
135: }
136:
137: /**
138: * @see javax.xml.rpc.Service#createCall()
139: */
140: public Call createCall() throws ServiceException {
141:
142: return new JCall(this );
143: }
144:
145: /**
146: * Assign the classname 2 port Map.
147: * @param map Map to be used
148: */
149: public void assignSEIClassnameToWSDLPort(Map map) {
150: this .classname2wsdlPort = map;
151: }
152:
153: /**
154: * @param name port name
155: * @param callProperties properties used to configure the Call instances
156: */
157: public void assignCallProperties(String name,
158: Properties callProperties) {
159: this .mapCallProperties.put(name, callProperties);
160: }
161:
162: /**
163: * @param name port name
164: * @param stubProperties properties used to configure the Stub instances
165: */
166: public void assignStubProperties(String name,
167: Properties stubProperties) {
168: this .mapStubProperties.put(name, stubProperties);
169: }
170:
171: /**
172: * @param name port name
173: * @return Returns the callProperties.
174: */
175: public Properties getCallProperties(String name) {
176: Properties props = null;
177: if (mapCallProperties.containsKey(name)) {
178: props = (Properties) mapCallProperties.get(name);
179: }
180: return props;
181: }
182:
183: /**
184: * @param name port name
185: * @return Returns the stubProperties.
186: */
187: public Properties getStubProperties(String name) {
188: Properties props = null;
189: if (mapStubProperties.containsKey(name)) {
190: props = (Properties) mapStubProperties.get(name);
191: }
192: return props;
193: }
194:
195: }
|