org.apache.axis2.jaxws.spi
Class ServiceDelegate

java.lang.Object
  extended by javax.xml.ws.spi.ServiceDelegate
      extended by org.apache.axis2.jaxws.spi.ServiceDelegate

public class ServiceDelegate
extends ServiceDelegate

The ServiceDelegate serves as the backing implementation for all of the methods in the Service API. This is the plug point for the client implementation.


Constructor Summary
ServiceDelegate(URL url, QName qname, Class clazz, WebServiceFeature... features)
           
 
Method Summary
 void addPort(QName portName, String bindingId, String endpointAddress)
           
<T> Dispatch<T>
createDispatch(EndpointReference jaxwsEPR, Class<T> type, Service.Mode mode, WebServiceFeature... features)
           
 Dispatch<Object> createDispatch(EndpointReference jaxwsEPR, JAXBContext context, Service.Mode mode, WebServiceFeature... features)
           
<T> Dispatch<T>
createDispatch(QName portName, Class<T> type, Service.Mode mode)
           
<T> Dispatch<T>
createDispatch(QName portName, Class<T> type, Service.Mode mode, WebServiceFeature... features)
           
 Dispatch<Object> createDispatch(QName portName, JAXBContext context, Service.Mode mode)
           
 Dispatch<Object> createDispatch(QName portName, JAXBContext context, Service.Mode mode, WebServiceFeature... features)
           
protected  void finalize()
           
 Executor getExecutor()
           
 HandlerResolver getHandlerResolver()
           
<T> T
getPort(Class<T> sei)
           
<T> T
getPort(Class<T> sei, WebServiceFeature... features)
           
<T> T
getPort(EndpointReference jaxwsEPR, Class<T> sei, WebServiceFeature... features)
           
<T> T
getPort(EndpointReference axis2EPR, String addressingNamespace, Class<T> sei, WebServiceFeature... features)
           
<T> T
getPort(QName portName, Class<T> sei)
           
<T> T
getPort(QName portName, Class<T> sei, WebServiceFeature... features)
           
 Iterator<QName> getPorts()
           
 ServiceClient getServiceClient(QName portQName)
           
 ServiceDescription getServiceDescription()
          Get the ServiceDescription tree that this ServiceDelegate
 QName getServiceName()
           
 URL getWSDLDocumentLocation()
           
static void releaseService(Service service)
          PROPRIETARY METHOD TO RELEASE RESOUCES.
 void setExecutor(Executor e)
           
 void setHandlerResolver(HandlerResolver handlerresolver)
           
static void setPortMetadata(DescriptionBuilderComposite composite)
          NON-STANDARD SPI! Set any metadata to be used on the creation of the NEXT Port by this thread.
static void setServiceMetadata(DescriptionBuilderComposite composite)
          NON-STANDARD SPI! Set any metadata to be used on the creation of the NEXT Service by this thread.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceDelegate

public ServiceDelegate(URL url,
                       QName qname,
                       Class clazz,
                       WebServiceFeature... features)
                throws WebServiceException
Throws:
WebServiceException
Method Detail

setServiceMetadata

public static void setServiceMetadata(DescriptionBuilderComposite composite)
NON-STANDARD SPI! Set any metadata to be used on the creation of the NEXT Service by this thread. NOTE that this uses ThreadLocal to store the metadata, and that ThreadLocal is cleared after it is used to create a Service. That means: 1) The thread that sets the metadata to use MUST be the thread that creates the Service 2) Creation of the Service should be the very next thing the thread does 3) The metadata will be set to null when the Service is created, so to create another service with the same metadata, it will need to be set again prior to creating the service 4) The metadata can be set prior to creating both generic Service and generated Service instances. This allows creating a generic Service (javax.xml.ws.Service) or a generated Service (subclass of javax.xml.ws.Service) specifying additional metadata via a sparse composite. This can be used by a runtime to create a Service for a requester using additional metadata such as might come from a deployment descriptor or from resource injection processing of @Resource or @WebServiceRef(s) annotations. Additional metadata may include things like @WebServiceClient.wsdlLocation or a @HandlerChain specification.

Parameters:
composite - Additional metadata (if any) to be used in creation of the service
See Also:
Service.create(QName), Service.create(URL, QName)

setPortMetadata

public static void setPortMetadata(DescriptionBuilderComposite composite)
NON-STANDARD SPI! Set any metadata to be used on the creation of the NEXT Port by this thread. NOTE that this uses ThreadLocal to store the metadata, and that ThreadLocal is cleared after it is used to create a Port. That means: 1) The thread that sets the metadata to use MUST be the thread that creates the Port 2) Creation of the Port should be the very next thing the thread does 3) The metadata will be set to null when the Port is created, so to create another Port with the same metadata, it will need to be set again prior to creating the Port 4) The metadata can be set prior to creating Port which specifies a QName via Service.getPort(QName, Class) or one that only specifies the SEI class via Service.getPort(Class) 5) Metadata can not be specified for dynamic ports, i.e. those added via Service.addPort(...). 6) Metadata can not be specfied when creating a dispatch client, i.e. via Service.createDispatch(...) 7) The Service used to create the port can be the generic service or a generated service. This allows creating Port specifying additional metadata via a sparse composite. This can be used by a runtime to create a Port for a requester using additional metadata such as might come from a deployment descriptor or from resource injection processing. Additional metadata might include things like a @HandlerChain specification.

Parameters:
composite - Additional metadata (if any) to be used in creation of the port
See Also:
Service.getPort(Class), Service.getPort(QName, Class)

addPort

public void addPort(QName portName,
                    String bindingId,
                    String endpointAddress)
             throws WebServiceException
Specified by:
addPort in class ServiceDelegate
Throws:
WebServiceException

createDispatch

public <T> Dispatch<T> createDispatch(QName portName,
                                      Class<T> type,
                                      Service.Mode mode)
                           throws WebServiceException
Specified by:
createDispatch in class ServiceDelegate
Throws:
WebServiceException

createDispatch

public Dispatch<Object> createDispatch(QName portName,
                                       JAXBContext context,
                                       Service.Mode mode)
Specified by:
createDispatch in class ServiceDelegate

createDispatch

public <T> Dispatch<T> createDispatch(EndpointReference jaxwsEPR,
                                      Class<T> type,
                                      Service.Mode mode,
                                      WebServiceFeature... features)
Specified by:
createDispatch in class ServiceDelegate

createDispatch

public Dispatch<Object> createDispatch(EndpointReference jaxwsEPR,
                                       JAXBContext context,
                                       Service.Mode mode,
                                       WebServiceFeature... features)
Specified by:
createDispatch in class ServiceDelegate

createDispatch

public <T> Dispatch<T> createDispatch(QName portName,
                                      Class<T> type,
                                      Service.Mode mode,
                                      WebServiceFeature... features)
Specified by:
createDispatch in class ServiceDelegate

createDispatch

public Dispatch<Object> createDispatch(QName portName,
                                       JAXBContext context,
                                       Service.Mode mode,
                                       WebServiceFeature... features)
Specified by:
createDispatch in class ServiceDelegate

getPort

public <T> T getPort(Class<T> sei)
          throws WebServiceException
Specified by:
getPort in class ServiceDelegate
Throws:
WebServiceException

getPort

public <T> T getPort(QName portName,
                     Class<T> sei)
          throws WebServiceException
Specified by:
getPort in class ServiceDelegate
Throws:
WebServiceException

getPort

public <T> T getPort(Class<T> sei,
                     WebServiceFeature... features)
Specified by:
getPort in class ServiceDelegate

getPort

public <T> T getPort(EndpointReference jaxwsEPR,
                     Class<T> sei,
                     WebServiceFeature... features)
Specified by:
getPort in class ServiceDelegate

getPort

public <T> T getPort(QName portName,
                     Class<T> sei,
                     WebServiceFeature... features)
Specified by:
getPort in class ServiceDelegate

getExecutor

public Executor getExecutor()
Specified by:
getExecutor in class ServiceDelegate

getHandlerResolver

public HandlerResolver getHandlerResolver()
Specified by:
getHandlerResolver in class ServiceDelegate

getPorts

public Iterator<QName> getPorts()
Specified by:
getPorts in class ServiceDelegate

getServiceName

public QName getServiceName()
Specified by:
getServiceName in class ServiceDelegate

getWSDLDocumentLocation

public URL getWSDLDocumentLocation()
Specified by:
getWSDLDocumentLocation in class ServiceDelegate

setExecutor

public void setExecutor(Executor e)
Specified by:
setExecutor in class ServiceDelegate

setHandlerResolver

public void setHandlerResolver(HandlerResolver handlerresolver)
Specified by:
setHandlerResolver in class ServiceDelegate

getServiceDescription

public ServiceDescription getServiceDescription()
Get the ServiceDescription tree that this ServiceDelegate


getServiceClient

public ServiceClient getServiceClient(QName portQName)
                               throws WebServiceException
Throws:
WebServiceException

getPort

public <T> T getPort(EndpointReference axis2EPR,
                     String addressingNamespace,
                     Class<T> sei,
                     WebServiceFeature... features)

releaseService

public static void releaseService(Service service)
PROPRIETARY METHOD TO RELEASE RESOUCES. USE OF THIS METHOD IS NOT JAX-WS COMPLIANT AND IS NON-PORTABLE! This method can be called by client code to try to release resources associated with the Service instance parameter. These resources include the JAX-WS metadata objects (e.g. ServiceDescription, EndpointDescription) and the associated Axis2 objects (e.g. AxisService and realted objects). Note that these resources can be shared across multiple service delegates, and so they will not actually be released until the last service delegate using them is closed. Note that it is not necessary to call this method since the service delegate finalizer will also release the resources as appropriate. However, finalizers are not necessarily run in a timely fashion and the timing varies across JVMs. To predictibly release resources to prevent large memory requirements and/or OutOfMemory errors, this proprietary release method can be called.

Parameters:
service - Instance of the Service for which resources may be released.

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.