| java.lang.Object org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor
All known Subclasses: org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean,
JaxRpcPortClientInterceptor | public class JaxRpcPortClientInterceptor extends LocalJaxRpcServiceFactory implements MethodInterceptor,InitializingBean(Code) | | 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
(e.g. obtained via
org.springframework.jndi.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.
In standard JAX-RPC style, this invoker is used with an RMI service interface.
Alternatively, this invoker can also proxy a JAX-RPC service with a matching
non-RMI business interface, that is, an interface that declares the service methods
without RemoteExceptions. In the latter case, RemoteExceptions thrown by JAX-RPC
will automatically get converted to Spring's unchecked RemoteAccessException.
Setting "serviceInterface" is usually sufficient: The invoker will automatically
use JAX-RPC "dynamic invocations" via the Call API in this case, no matter whether
the specified interface is an RMI or non-RMI interface. Alternatively, a corresponding
JAX-RPC port interface can be specified as "portInterface", which will turn this
invoker into "static invocation" mode (operating on a standard JAX-RPC port stub).
author: Juergen Hoeller since: 15.12.2003 See Also: JaxRpcPortClientInterceptor.setPortName See Also: JaxRpcPortClientInterceptor.setServiceInterface See Also: JaxRpcPortClientInterceptor.setPortInterface See Also: javax.xml.rpc.Service.createCall See Also: javax.xml.rpc.Service.getPort See Also: org.springframework.remoting.RemoteAccessException See Also: org.springframework.jndi.JndiObjectFactoryBean |
Method Summary | |
public void | addCustomProperty(String name, Object value) Add a custom property to this JAX-RPC Stub/Call. | public void | afterPropertiesSet() Prepares the JAX-RPC service and port if the "lookupServiceOnStartup"
is turned on (which it is by default). | protected boolean | alwaysUseJaxRpcCall() Return whether to always use JAX-RPC dynamic calls. | protected Object | doInvoke(MethodInvocation invocation) Perform a JAX-RPC service invocation based on the given method invocation. | protected Object | doInvoke(MethodInvocation invocation, Remote portStub) Perform a JAX-RPC service invocation based on the given port stub. | public Map | getCustomPropertyMap() Allow Map access to the custom properties to be set on the stub
or call, with the option to add or override specific entries.
Useful for specifying entries directly, for example via
"customPropertyMap[myKey]". | public String | getEndpointAddress() Return the endpoint address to specify on the stub or call. | public Service | getJaxRpcService() Return a reference to an existing JAX-RPC Service instance, if any. | public String | getPassword() Return the password to specify on the stub or call. | public Class | getPortInterface() Return the JAX-RPC port interface to use. | public 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. | public Class | getServiceInterface() Return the interface of the service that this factory should create a proxy for. | public String | getUsername() Return the username to specify on the stub or call. | public Object | invoke(MethodInvocation invocation) Translates the method invocation into a JAX-RPC service invocation. | protected boolean | isConnectFailure(RemoteException ex) Determine whether the given RMI exception indicates a connect failure. | public boolean | isMaintainSession() Return the maintain session flag to specify on the stub or call. | protected boolean | isPrepared() Return whether this client interceptor has already been prepared,
i.e. | protected Object | performJaxRpcCall(MethodInvocation invocation) | protected Object | performJaxRpcCall(MethodInvocation invocation, Service service) Perform a JAX-RPC dynamic call for the given AOP method invocation.
Delegates to
JaxRpcPortClientInterceptor.prepareJaxRpcCall and
JaxRpcPortClientInterceptor.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. | 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. | public void | prepare() Create and initialize the JAX-RPC service for the specified port.
Prepares a JAX-RPC stub if possible (if an RMI interface is available);
falls back to JAX-RPC dynamic calls else. | 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.
Called by
JaxRpcPortClientInterceptor.afterPropertiesSet .
Just applied when actually creating a JAX-RPC port stub, in case of a
compliant port interface. | protected void | reset() Reset the prepared service of this interceptor,
allowing for reinitialization on next access. | public void | setCustomProperties(Properties customProperties) Set custom properties to be set on the stub or call. | public void | setCustomPropertyMap(Map customProperties) Set custom properties to be set on the stub or call. | public void | setEndpointAddress(String endpointAddress) Set the endpoint address to specify on the stub or call. | public void | setJaxRpcService(Service jaxRpcService) Set a reference to an existing JAX-RPC Service instance,
for example obtained via
org.springframework.jndi.JndiObjectFactoryBean . | public void | setLookupServiceOnStartup(boolean lookupServiceOnStartup) Set whether to look up the JAX-RPC service on startup.
Default is "true". | public void | setMaintainSession(boolean maintainSession) Set the maintain session flag to specify on the stub or call. | public void | setPassword(String password) Set the password to specify on the stub or call. | public void | setPortInterface(Class portInterface) Set the JAX-RPC port interface to use. | public void | setPortName(String portName) Set the name of the port. | public void | setRefreshServiceAfterConnectFailure(boolean refreshServiceAfterConnectFailure) Set whether to refresh the JAX-RPC service on connect failure,
that is, whenever a JAX-RPC invocation throws a RemoteException.
Default is "false", keeping a reference to the JAX-RPC service
in any case, retrying the next invocation on the same service
even in case of failure. | public void | setServiceInterface(Class serviceInterface) Set the interface of the service that this factory should create a proxy for.
This will typically be a non-RMI business interface, although you can also
use an RMI port interface as recommended by JAX-RPC here.
Calls on the specified service interface will either be translated to the
underlying RMI port interface (in case of a "portInterface" being specified)
or to dynamic calls (using the JAX-RPC Dynamic Invocation Interface).
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. | public void | setUsername(String username) Set the username to specify on the stub or call. |
addCustomProperty | public void addCustomProperty(String name, Object value)(Code) | | Add a custom property to this JAX-RPC Stub/Call.
Parameters: name - the name of the attribute to expose Parameters: value - the attribute value to expose See Also: javax.xml.rpc.Stub._setProperty See Also: javax.xml.rpc.Call.setProperty |
afterPropertiesSet | public void afterPropertiesSet() throws ServiceException(Code) | | Prepares the JAX-RPC service and port if the "lookupServiceOnStartup"
is turned on (which it is by default).
|
alwaysUseJaxRpcCall | protected boolean alwaysUseJaxRpcCall()(Code) | | Return whether to always use JAX-RPC dynamic calls.
Called by 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.
See Also: JaxRpcPortClientInterceptor.postProcessJaxRpcCall |
getCustomPropertyMap | public Map getCustomPropertyMap()(Code) | | Allow Map access to the custom properties to be set on the stub
or call, with the option to add or override specific entries.
Useful for specifying entries directly, for example via
"customPropertyMap[myKey]". This is particularly useful for
adding or overriding entries in child bean definitions.
|
getEndpointAddress | public String getEndpointAddress()(Code) | | Return the endpoint address to specify on the stub or call.
|
getJaxRpcService | public Service getJaxRpcService()(Code) | | Return a reference to an existing JAX-RPC Service instance, if any.
|
getPassword | public String getPassword()(Code) | | Return the password to specify on the stub or call.
|
getPortInterface | public Class getPortInterface()(Code) | | Return the JAX-RPC port interface to use.
|
getPortName | public String getPortName()(Code) | | Return the name of the port.
|
getPortStub | protected Remote getPortStub()(Code) | | Return the underlying JAX-RPC port stub that this interceptor delegates to
for each method invocation on the proxy.
|
getServiceInterface | public Class getServiceInterface()(Code) | | Return the interface of the service that this factory should create a proxy for.
|
getUsername | public String getUsername()(Code) | | Return the username to specify on the stub or call.
|
isMaintainSession | public boolean isMaintainSession()(Code) | | Return the maintain session flag to specify on the stub or call.
|
isPrepared | protected boolean isPrepared()(Code) | | Return whether this client interceptor has already been prepared,
i.e. has already looked up the JAX-RPC service and port.
|
postProcessJaxRpcCall | protected void postProcessJaxRpcCall(Call call, MethodInvocation invocation)(Code) | | Post-process the given JAX-RPC call. Called by
JaxRpcPortClientInterceptor.invoke .
The default implementation is empty.
Just applied when actually using JAX-RPC dynamic calls, i.e. if no compliant
port interface was specified. Else, a JAX-RPC port stub will be used.
Parameters: call - the current JAX-RPC call object(can be cast to an implementation-specific class if necessary) Parameters: invocation - the current AOP MethodInvocation that the call wascreated for (can be used to check method name, method parametersand/or passed-in arguments) See Also: JaxRpcPortClientInterceptor.setPortInterface See Also: JaxRpcPortClientInterceptor.postProcessPortStub |
reset | protected void reset()(Code) | | Reset the prepared service of this interceptor,
allowing for reinitialization on next access.
|
setCustomProperties | public void setCustomProperties(Properties customProperties)(Code) | | Set custom properties to be set on the stub or call.
Can be populated with a String "value" (parsed via PropertiesEditor)
or a "props" element in XML bean definitions.
See Also: javax.xml.rpc.Stub._setProperty See Also: javax.xml.rpc.Call.setProperty |
setCustomPropertyMap | public void setCustomPropertyMap(Map customProperties)(Code) | | Set custom properties to be set on the stub or call.
Can be populated with a "map" or "props" element in XML bean definitions.
See Also: javax.xml.rpc.Stub._setProperty See Also: javax.xml.rpc.Call.setProperty |
setEndpointAddress | public void setEndpointAddress(String endpointAddress)(Code) | | Set the endpoint address to specify on the stub or call.
See Also: javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY See Also: javax.xml.rpc.Call.setTargetEndpointAddress |
setLookupServiceOnStartup | public void setLookupServiceOnStartup(boolean lookupServiceOnStartup)(Code) | | Set whether to look up the JAX-RPC service on startup.
Default is "true". Turn this flag off to allow for late start
of the target server. In this case, the JAX-RPC service will be
lazily fetched on first access.
|
setMaintainSession | public void setMaintainSession(boolean maintainSession)(Code) | | Set the maintain session flag to specify on the stub or call.
See Also: javax.xml.rpc.Stub.SESSION_MAINTAIN_PROPERTY See Also: javax.xml.rpc.Call.SESSION_MAINTAIN_PROPERTY |
setPassword | public void setPassword(String password)(Code) | | Set the password to specify on the stub or call.
See Also: javax.xml.rpc.Stub.PASSWORD_PROPERTY See Also: javax.xml.rpc.Call.PASSWORD_PROPERTY |
setPortInterface | public void setPortInterface(Class portInterface)(Code) | | Set the JAX-RPC port interface to use. Only needs to be set if a JAX-RPC
port stub should be used instead of the dynamic call mechanism.
See the javadoc of the "serviceInterface" property for more details.
The interface must be suitable for a JAX-RPC port, that is, it must be
an RMI service interface (that extends java.rmi.Remote ).
NOTE: Check whether your JAX-RPC provider returns thread-safe
port stubs. If not, use the dynamic call mechanism instead, which will
always be thread-safe. In particular, do not use JAX-RPC port stubs
with Apache Axis, whose port stubs are known to be non-thread-safe.
See Also: javax.xml.rpc.Service.getPort See Also: java.rmi.Remote See Also: JaxRpcPortClientInterceptor.setServiceInterface |
setPortName | public void setPortName(String portName)(Code) | | Set the name of the port.
Corresponds to the "wsdl:port" name.
|
setRefreshServiceAfterConnectFailure | public void setRefreshServiceAfterConnectFailure(boolean refreshServiceAfterConnectFailure)(Code) | | Set whether to refresh the JAX-RPC service on connect failure,
that is, whenever a JAX-RPC invocation throws a RemoteException.
Default is "false", keeping a reference to the JAX-RPC service
in any case, retrying the next invocation on the same service
even in case of failure. Turn this flag on to reinitialize the
entire service in case of connect failures.
|
setServiceInterface | public void setServiceInterface(Class serviceInterface)(Code) | | Set the interface of the service that this factory should create a proxy for.
This will typically be a non-RMI business interface, although you can also
use an RMI port interface as recommended by JAX-RPC here.
Calls on the specified service interface will either be translated to the
underlying RMI port interface (in case of a "portInterface" being specified)
or to dynamic calls (using the JAX-RPC Dynamic Invocation Interface).
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
use dynamic calls in such a scenario.
See Also: javax.xml.rpc.Service.createCall See Also: JaxRpcPortClientInterceptor.setPortInterface |
setUsername | public void setUsername(String username)(Code) | | Set the username to specify on the stub or call.
See Also: javax.xml.rpc.Stub.USERNAME_PROPERTY See Also: javax.xml.rpc.Call.USERNAME_PROPERTY |
Fields inherited from org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory | final protected Log logger(Code)(Java Doc)
|
|
|