Author: chirino Date: Sat Mar 26 20:23:30 2005 New Revision: 159136 URL: http://svn.apache.org/viewcvs?view=rev&rev=159136 Log: Fixing ServiceImpl to provide info accessible via the SEEIFactory.
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java?view=diff&r1=159135&r2=159136 ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactory.java Sat Mar 26 20:23:30 2005 @@ -16,7 +16,10 @@ */ package org.apache.geronimo.axis.client; +import java.net.URL; import java.rmi.Remote; + +import javax.xml.namespace.QName; import javax.xml.rpc.ServiceException; import javax.xml.rpc.handler.HandlerChain; @@ -28,4 +31,12 @@ Remote createServiceEndpoint() throws ServiceException; HandlerChain createHandlerChain(); + + OperationInfo[] getOperationInfos(); + + QName getPortQName(); + + QName getServiceName(); + + URL getWSDLDocumentLocation(); } Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java?view=diff&r1=159135&r2=159136 ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/SEIFactoryImpl.java Sat Mar 26 20:23:30 2005 @@ -16,28 +16,31 @@ */ package org.apache.geronimo.axis.client; +import java.io.InvalidClassException; +import java.io.ObjectStreamException; +import java.io.Serializable; import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; import java.rmi.Remote; -import java.io.Serializable; -import java.io.ObjectStreamException; -import java.io.InvalidClassException; +import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Iterator; -import java.net.URL; + +import javax.xml.namespace.QName; import javax.xml.rpc.ServiceException; import javax.xml.rpc.handler.HandlerChain; -import javax.xml.namespace.QName; +import net.sf.cglib.core.Signature; import net.sf.cglib.proxy.Callback; import net.sf.cglib.proxy.Enhancer; import net.sf.cglib.proxy.MethodProxy; -import net.sf.cglib.reflect.FastConstructor; import net.sf.cglib.reflect.FastClass; -import net.sf.cglib.core.Signature; +import net.sf.cglib.reflect.FastConstructor; + import org.apache.axis.client.Service; -import org.apache.axis.handlers.HandlerInfoChainFactory; import org.apache.axis.description.TypeDesc; +import org.apache.axis.handlers.HandlerInfoChainFactory; /** * @version $Rev: $ $Date: $ @@ -45,6 +48,7 @@ public class SEIFactoryImpl implements SEIFactory, Serializable { private static final Class[] SERVICE_ENDPOINT_CONSTRUCTOR_TYPES = new Class[]{GenericServiceEndpoint.class}; + private final QName serviceName; private final QName portQName; private final Class serviceEndpointClass; private final OperationInfo[] operationInfos; @@ -57,7 +61,8 @@ private transient HandlerInfoChainFactory handlerInfoChainFactory; private transient OperationInfo[] sortedOperationInfos; - public SEIFactoryImpl(String portName, Class serviceEndpointClass, OperationInfo[] operationInfos, Object serviceImpl, List typeMappings, Map typeDescriptors, URL location, List handlerInfos, ClassLoader classLoader) throws ClassNotFoundException { + public SEIFactoryImpl(QName serviceName, String portName, Class serviceEndpointClass, OperationInfo[] operationInfos, Object serviceImpl, List typeMappings, Map typeDescriptors, URL location, List handlerInfos, ClassLoader classLoader) throws ClassNotFoundException { + this.serviceName = serviceName; this.portQName = new QName("", portName); this.serviceEndpointClass = serviceEndpointClass; this.operationInfos = operationInfos; @@ -111,9 +116,30 @@ private Object readResolve() throws ObjectStreamException { try { - return new SEIFactoryImpl(portQName.getLocalPart(), serviceEndpointClass, operationInfos, serviceImpl, typeMappings, typeDescriptors, location, handlerInfos, null); + return new SEIFactoryImpl(serviceName, portQName.getLocalPart(), serviceEndpointClass, operationInfos, serviceImpl, typeMappings, typeDescriptors, location, handlerInfos, null); } catch (ClassNotFoundException e) { throw new InvalidClassException(GenericServiceEndpoint.class.getName(), "this is impossible"); + } + } + + public OperationInfo[] getOperationInfos() { + return operationInfos; + } + + public QName getPortQName() { + return portQName; + } + + public QName getServiceName() { + return serviceName; + } + + public URL getWSDLDocumentLocation() { + try { + return new URL(location.toExternalForm()+"?wsdl"); + } + catch (MalformedURLException e) { + return null; } } } Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java?view=diff&r1=159135&r2=159136 ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java Sat Mar 26 20:23:30 2005 @@ -23,16 +23,16 @@ import java.rmi.Remote; import java.util.Iterator; import java.util.Map; + import javax.xml.namespace.QName; import javax.xml.rpc.Call; import javax.xml.rpc.ServiceException; import javax.xml.rpc.encoding.TypeMappingRegistry; import javax.xml.rpc.handler.HandlerRegistry; -import org.apache.axis.client.Service; -import org.apache.axis.client.AxisClient; import org.apache.axis.EngineConfiguration; -import org.apache.axis.configuration.EngineConfigurationFactoryFinder; +import org.apache.axis.client.AxisClient; +import org.apache.axis.client.Service; import org.apache.axis.configuration.FileProvider; @@ -44,7 +44,7 @@ private transient Service delegate; private final Map seiClassNameToFactoryMap; private final Map portToImplementationMap; - + public ServiceImpl(Map portToImplementationMap, Map seiClassNameToFactoryMap) { this.portToImplementationMap = portToImplementationMap; this.seiClassNameToFactoryMap = seiClassNameToFactoryMap; @@ -77,8 +77,22 @@ return port; } - public Call[] getCalls(QName qName) throws ServiceException { - return delegate.getCalls(qName); + public Call[] getCalls(QName portName) throws ServiceException { + + if (portName == null) + throw new ServiceException("Portname cannot be null"); + + SEIFactory factory = (SEIFactory) portToImplementationMap.get(portName.getLocalPart()); + if( factory == null ) + throw new ServiceException("No port for portname: " + portName); + + OperationInfo[] operationInfos = factory.getOperationInfos(); + javax.xml.rpc.Call[] array = new javax.xml.rpc.Call[operationInfos.length]; + for (int i = 0; i < operationInfos.length; i++) { + OperationInfo operation = operationInfos[i]; + array[i] = delegate.createCall(factory.getPortQName(), operation.getOperationName()); + } + return array; } public Call createCall(QName qName) throws ServiceException { @@ -98,7 +112,11 @@ } public QName getServiceName() { - return delegate.getServiceName(); + Iterator iterator = portToImplementationMap.values().iterator(); + if( !iterator.hasNext() ) + return null; + SEIFactory factory = (SEIFactory)iterator.next(); + return factory.getServiceName(); } public Iterator getPorts() throws ServiceException { @@ -106,15 +124,20 @@ } public URL getWSDLDocumentLocation() { - return delegate.getWSDLDocumentLocation(); + Iterator iterator = portToImplementationMap.values().iterator(); + if( !iterator.hasNext() ) + return null; + SEIFactory factory = (SEIFactory)iterator.next(); + return factory.getWSDLDocumentLocation(); } public TypeMappingRegistry getTypeMappingRegistry() { - return delegate.getTypeMappingRegistry(); + throw new UnsupportedOperationException(); + //return delegate.getTypeMappingRegistry(); } public HandlerRegistry getHandlerRegistry() { - return delegate.getHandlerRegistry(); + throw new UnsupportedOperationException(); } Remote internalGetPort(String portName) throws ServiceException {