|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory
org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor
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. For typical usage, it is not necessary to specify those, though.
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".
setPortName(java.lang.String)
,
setServiceInterface(java.lang.Class)
,
setPortInterface(java.lang.Class)
,
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()
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware). |
protected boolean |
alwaysUseJaxRpcCall()
Return whether to always use JAX-RPC dynamic calls. |
Properties |
getCustomProperties()
Return custom properties to be set on the stub or call. |
String |
getEndpointAddress()
Return the endpoint address to specify on the stub or call. |
Service |
getJaxRpcService()
Return a reference to an existing JAX-RPC Service instance, if any. |
String |
getPassword()
Return the password to specify on the stub or call. |
Class |
getPortInterface()
Return the JAX-RPC port interface to use. |
String |
getPortName()
Return the name of the port. |
protected QName |
getPortQName()
Return the prepared QName for the port. |
protected Remote |
getPortStub()
Return the underlying JAX-RPC port stub that this interceptor delegates to for each method invocation on the proxy. |
Class |
getServiceInterface()
Return the interface of the service that this factory should create a proxy for. |
String |
getUsername()
Return the username to specify on the stub or call. |
Object |
invoke(MethodInvocation invocation)
|
boolean |
isMaintainSession()
Return the maintain session flag to specify on the stub or call. |
protected Object |
performJaxRpcCall(MethodInvocation invocation)
Perform a JAX-RPC dynamic call for the given AOP method invocation. |
protected void |
postProcessJaxRpcCall(Call call,
MethodInvocation invocation)
Post-process the given JAX-RPC call. |
protected void |
postProcessPortStub(Stub stub)
Post-process the given JAX-RPC port stub. |
void |
prepare()
Create and initialize the JAX-RPC service for the specified port. |
protected void |
prepareJaxRpcCall(Call call)
Prepare the given JAX-RPC call, applying properties to it. |
protected void |
preparePortStub(Stub stub)
Prepare the given JAX-RPC port stub, applying properties to it. |
void |
setCustomProperties(Properties customProperties)
Set custom properties to be set on the stub or call. |
void |
setEndpointAddress(String endpointAddress)
Set the endpoint address to specify on the stub or call. |
void |
setJaxRpcService(Service jaxRpcService)
Set a reference to an existing JAX-RPC Service instance, for example looked up via JndiObjectFactoryBean. |
void |
setMaintainSession(boolean maintainSession)
Set the maintain session flag to specify on the stub or call. |
void |
setPassword(String password)
Set the password to specify on the stub or call. |
void |
setPortInterface(Class portInterface)
Set the JAX-RPC port interface to use. |
void |
setPortName(String portName)
Set the name of the port. |
void |
setServiceInterface(Class serviceInterface)
Set the interface of the service that this factory should create a proxy for. |
void |
setUsername(String username)
Set the username to specify on the stub or call. |
Methods inherited from class org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory |
createJaxRpcService, createServiceFactory, getNamespaceUri, getQName, getServiceFactoryClass, getServiceName, getServicePostProcessors, getWsdlDocumentUrl, postProcessJaxRpcService, setNamespaceUri, setServiceFactoryClass, setServiceName, setServicePostProcessors, setWsdlDocumentUrl |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JaxRpcPortClientInterceptor()
Method Detail |
public void setJaxRpcService(Service jaxRpcService)
LocalJaxRpcServiceFactory.setServiceFactoryClass(java.lang.Class)
,
LocalJaxRpcServiceFactory.setWsdlDocumentUrl(java.net.URL)
,
LocalJaxRpcServiceFactory.setNamespaceUri(java.lang.String)
,
LocalJaxRpcServiceFactory.setServiceName(java.lang.String)
,
JndiObjectFactoryBean
public Service getJaxRpcService()
public void setPortName(String portName)
public String getPortName()
public void setUsername(String username)
Stub.USERNAME_PROPERTY
,
Call.USERNAME_PROPERTY
public String getUsername()
public void setPassword(String password)
Stub.PASSWORD_PROPERTY
,
Call.PASSWORD_PROPERTY
public String getPassword()
public void setEndpointAddress(String endpointAddress)
Stub.ENDPOINT_ADDRESS_PROPERTY
,
Call.setTargetEndpointAddress(java.lang.String)
public String getEndpointAddress()
public void setMaintainSession(boolean maintainSession)
Stub.SESSION_MAINTAIN_PROPERTY
,
Call.SESSION_MAINTAIN_PROPERTY
public boolean isMaintainSession()
public void setCustomProperties(Properties customProperties)
Stub._setProperty(java.lang.String, java.lang.Object)
,
Call.setProperty(java.lang.String, java.lang.Object)
public Properties getCustomProperties()
public void setServiceInterface(Class serviceInterface)
If the specified service interface is a non-RMI business interface, invocations will either be translated to the underlying RMI port interface (in case of a "portInterface" being specified) or to JAX-RPC dynamic calls.
The dynamic call mechanism has the advantage that you don't need to maintain an RMI port interface in addition to an existing non-RMI business interface. In terms of configuration, specifying the business interface as "serviceInterface" will be enough; this interceptor will automatically switch to dynamic calls in such a scenario.
setPortInterface(java.lang.Class)
public Class getServiceInterface()
public void setPortInterface(Class portInterface)
The interface must be suitable for a JAX-RPC port, i.e. it must be an
RMI service interface (that extends java.rmi.Remote
).
setServiceInterface(java.lang.Class)
,
Remote
public Class getPortInterface()
public void afterPropertiesSet() throws ServiceException
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
ServiceException
public void prepare() throws ServiceException
Prepares a JAX-RPC stub if possible (if an RMI interface is available);
falls back to JAX-RPC dynamic calls else. Using dynamic calls can be
enforced through overriding alwaysUseJaxRpcCall
to return true.
postProcessJaxRpcService
and postProcessPortStub
hooks are available for customization in subclasses. When using dynamic calls,
each can be post-processed via postProcessJaxRpcCall
.
ServiceException
alwaysUseJaxRpcCall()
,
LocalJaxRpcServiceFactory.postProcessJaxRpcService(javax.xml.rpc.Service)
,
postProcessPortStub(javax.xml.rpc.Stub)
,
postProcessJaxRpcCall(javax.xml.rpc.Call, org.aopalliance.intercept.MethodInvocation)
protected QName getPortQName()
setPortName(java.lang.String)
,
LocalJaxRpcServiceFactory.getQName(java.lang.String)
protected boolean alwaysUseJaxRpcCall()
afterPropertiesSet
.
Default is false; if an RMI interface is specified as "portInterface" or "serviceInterface", it will be used to create a JAX-RPC port stub.
Can be overridden to enforce the use of the JAX-RPC Call API, for example if there is a need to customize at the Call level. This just necessary if you you want to use an RMI interface as "serviceInterface", though; in case of only a non-RMI interface being available, this interceptor will fall back to the Call API anyway.
postProcessJaxRpcCall(javax.xml.rpc.Call, org.aopalliance.intercept.MethodInvocation)
protected void preparePortStub(Stub stub)
afterPropertiesSet
.
Just applied when actually creating a JAX-RPC port stub, in case of a specified JAX-RPC-compliant port interface. Else, JAX-RPC dynamic calls will be used.
stub
- the current JAX-RPC port stubafterPropertiesSet()
,
setUsername(java.lang.String)
,
setPassword(java.lang.String)
,
setEndpointAddress(java.lang.String)
,
setMaintainSession(boolean)
,
setCustomProperties(java.util.Properties)
,
setPortInterface(java.lang.Class)
,
prepareJaxRpcCall(javax.xml.rpc.Call)
protected void postProcessPortStub(Stub stub)
prepare
.
Just applied when actually creating a JAX-RPC port stub, in case of a specified JAX-RPC-compliant port interface. Else, JAX-RPC dynamic calls will be used.
stub
- the current JAX-RPC port stub
(can be cast to an implementation-specific class if necessary)prepare()
,
setPortInterface(java.lang.Class)
,
postProcessJaxRpcCall(javax.xml.rpc.Call, org.aopalliance.intercept.MethodInvocation)
protected Remote getPortStub()
public Object invoke(MethodInvocation invocation) throws Throwable
invoke
in interface MethodInterceptor
Throwable
protected Object performJaxRpcCall(MethodInvocation invocation) throws Throwable
prepareJaxRpcCall
and
postProcessJaxRpcCall
for setting up the call object.
Default implementation uses method name as JAX-RPC operation name and method arguments as arguments for the JAX-RPC call. Can be overridden in subclasses for custom operation names and/or arguments.
invocation
- the current AOP MethodInvocation that should
be converted to a JAX-RPC call
Throwable
- the exception thrown by the invocation, if anygetJaxRpcService()
,
getPortQName()
,
prepareJaxRpcCall(javax.xml.rpc.Call)
,
postProcessJaxRpcCall(javax.xml.rpc.Call, org.aopalliance.intercept.MethodInvocation)
protected void prepareJaxRpcCall(Call call)
invoke
.
Just applied when actually using JAX-RPC dynamic calls, i.e. if no JAX-RPC-compliant port interface was specified. Else, a JAX-RPC port stub will be used.
call
- the current JAX-RPC call objectinvoke(org.aopalliance.intercept.MethodInvocation)
,
setUsername(java.lang.String)
,
setPassword(java.lang.String)
,
setEndpointAddress(java.lang.String)
,
setMaintainSession(boolean)
,
setCustomProperties(java.util.Properties)
,
setPortInterface(java.lang.Class)
,
preparePortStub(javax.xml.rpc.Stub)
protected void postProcessJaxRpcCall(Call call, MethodInvocation invocation)
invoke
.
Just applied when actually using JAX-RPC dynamic calls, i.e. if no JAX-RPC-compliant port interface was specified. Else, a JAX-RPC port stub will be used.
call
- the current JAX-RPC call object
(can be cast to an implementation-specific class if necessary)invocation
- the current AOP MethodInvocation that the call was
created for (can be used to check method name, method parameters
and/or passed-in arguments)invoke(org.aopalliance.intercept.MethodInvocation)
,
setPortInterface(java.lang.Class)
,
postProcessPortStub(javax.xml.rpc.Stub)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |