org.springframework.remoting.jaxrpc
Class JaxRpcPortClientInterceptor

java.lang.Object
  extended byorg.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory
      extended byorg.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, InitializingBean, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor
Direct Known Subclasses:
JaxRpcPortProxyFactoryBean

public class JaxRpcPortClientInterceptor
extends LocalJaxRpcServiceFactory
implements org.aopalliance.intercept.MethodInterceptor, InitializingBean

Interceptor for accessing a specific port of a JAX-RPC service. Uses either LocalJaxRpcServiceFactory's facilities underneath, or takes an explicit reference to an existing JAX-RPC Service instance, for example looked up via JndiObjectFactoryBean.

Allows to set JAX-RPC's standard stub properties directly, via the "username", "password", "endpointAddress" and "maintainSession" properties.

This invoker is typically used with an RMI service interface. Alternatively, this invoker can also proxy a JAX-RPC service with a matching non-RMI business interface, i.e. an interface that mirrors the RMI service methods but does not declare RemoteExceptions. In the latter case, RemoteExceptions thrown by the JAX-RPC stub will automatically get converted to Spring's unchecked RemoteAccessException.

If exposing the JAX-RPC port interface (i.e. an RMI interface) directly, setting "serviceInterface" is sufficient. If exposing a non-RMI business interface, the business interface needs to be set as "serviceInterface", and the JAX-RPC port interface as "portInterface".

Since:
15.12.2003
Author:
Juergen Hoeller
See Also:
Service.getPort(javax.xml.namespace.QName, java.lang.Class), Stub, RemoteAccessException, JndiObjectFactoryBean

Field Summary
 
Fields inherited from class org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory
logger
 
Constructor Summary
JaxRpcPortClientInterceptor()
           
 
Method Summary
 void afterPropertiesSet()
          Create and initialize the JAX-RPC proxy for the specified port.
 java.util.Properties getCustomProperties()
          Return custom properties to be set on the stub for the port.
 java.lang.String getEndpointAddress()
           
 javax.xml.rpc.Service getJaxRpcService()
          Return a reference to an existing JAX-RPC Service instance, if any.
 java.lang.String getPassword()
           
 java.lang.Class getPortInterface()
          Return the JAX-RPC port interface to use.
 java.lang.String getPortName()
          Return the name of the port.
 java.rmi.Remote getPortProxy()
          Return the underlying JAX-RPC port proxy that this interceptor delegates to.
 java.lang.Class getServiceInterface()
          Return the interface of the service that this factory should create a proxy for.
 java.lang.String getUsername()
           
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
           
 boolean isMaintainSession()
           
protected  void postProcessJaxRpcService(javax.xml.rpc.Service service)
          Post-process the given JAX-RPC Service.
protected  void postProcessPortProxy(java.rmi.Remote portProxy)
          Post-process the given JAX-RPC port proxy.
 void setCustomProperties(java.util.Properties customProperties)
          Set custom properties to be set on the stub for the port.
 void setEndpointAddress(java.lang.String endpointAddress)
           
 void setJaxRpcService(javax.xml.rpc.Service jaxRpcService)
          Set a reference to an existing JAX-RPC Service instance, for example looked up via JndiObjectFactoryBean.
 void setMaintainSession(boolean maintainSession)
           
 void setPassword(java.lang.String password)
           
 void setPortInterface(java.lang.Class portInterface)
          Set the JAX-RPC port interface to use.
 void setPortName(java.lang.String portName)
          Set the name of the port.
 void setServiceInterface(java.lang.Class serviceInterface)
          Set the interface of the service that this factory should create a proxy for.
 void setUsername(java.lang.String username)
           
 
Methods inherited from class org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory
createJaxRpcService, createServiceFactory, getNamespaceUri, getQName, getServiceFactoryClass, getServiceName, getWsdlDocumentUrl, setNamespaceUri, setServiceFactoryClass, setServiceName, setWsdlDocumentUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxRpcPortClientInterceptor

public JaxRpcPortClientInterceptor()
Method Detail

setJaxRpcService

public void setJaxRpcService(javax.xml.rpc.Service jaxRpcService)
Set a reference to an existing JAX-RPC Service instance, for example looked up via JndiObjectFactoryBean. If not set, LocalJaxRpcServiceFactory's properties have to be set.

See Also:
JndiObjectFactoryBean

getJaxRpcService

public javax.xml.rpc.Service getJaxRpcService()
Return a reference to an existing JAX-RPC Service instance, if any.


setPortName

public void setPortName(java.lang.String portName)
Set the name of the port. Corresponds to the "wsdl:port" name.


getPortName

public java.lang.String getPortName()
Return the name of the port.


setUsername

public void setUsername(java.lang.String username)

getUsername

public java.lang.String getUsername()

setPassword

public void setPassword(java.lang.String password)

getPassword

public java.lang.String getPassword()

setEndpointAddress

public void setEndpointAddress(java.lang.String endpointAddress)

getEndpointAddress

public java.lang.String getEndpointAddress()

setMaintainSession

public void setMaintainSession(boolean maintainSession)

isMaintainSession

public boolean isMaintainSession()

setCustomProperties

public void setCustomProperties(java.util.Properties customProperties)
Set custom properties to be set on the stub for the port.

See Also:
Stub._setProperty(java.lang.String, java.lang.Object)

getCustomProperties

public java.util.Properties getCustomProperties()
Return custom properties to be set on the stub for the port.


setServiceInterface

public void setServiceInterface(java.lang.Class serviceInterface)
Set the interface of the service that this factory should create a proxy for. Can be different from the JAX-RPC port interface, if using a non-RMI business interface for exposed proxies.

The interface must be suitable for a JAX-RPC port, it "portInterface" is not set. Else, it must match the methods in the port interface but can be a non-RMI business interface.

See Also:
setPortInterface(java.lang.Class)

getServiceInterface

public java.lang.Class getServiceInterface()
Return the interface of the service that this factory should create a proxy for.


setPortInterface

public void setPortInterface(java.lang.Class portInterface)
Set the JAX-RPC port interface to use. Only needs to be set if the exposed service interface is different from the port interface, i.e. when using a non-RMI business interface as service interface for exposed proxies.

The interface must be suitable for a JAX-RPC port.

See Also:
setServiceInterface(java.lang.Class)

getPortInterface

public java.lang.Class getPortInterface()
Return the JAX-RPC port interface to use.


afterPropertiesSet

public void afterPropertiesSet()
                        throws javax.xml.rpc.ServiceException
Create and initialize the JAX-RPC proxy for the specified port.

Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
javax.xml.rpc.ServiceException

postProcessJaxRpcService

protected void postProcessJaxRpcService(javax.xml.rpc.Service service)
Post-process the given JAX-RPC Service. Called by afterPropertiesSet. Useful for example to register custom type mappings.

Parameters:
service - the current JAX-RPC Service
See Also:
Service.getTypeMappingRegistry()

postProcessPortProxy

protected void postProcessPortProxy(java.rmi.Remote portProxy)
Post-process the given JAX-RPC port proxy. Called by afterPropertiesSet.

Parameters:
portProxy - the current JAX-RPC port proxy

getPortProxy

public java.rmi.Remote getPortProxy()
Return the underlying JAX-RPC port proxy that this interceptor delegates to.


invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation invocation)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable


Copyright (C) 2003-2004 The Spring Framework Project.