Java Doc for JmsInvokerClientInterceptor.java in  » J2EE » spring-framework-2.0.6 » org » springframework » jms » remoting » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.jms.remoting 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.jms.remoting.JmsInvokerClientInterceptor

All known Subclasses:   org.springframework.jms.remoting.JmsInvokerProxyFactoryBean,
JmsInvokerClientInterceptor
public class JmsInvokerClientInterceptor implements MethodInterceptor,InitializingBean(Code)
Interceptor for accessing a JMS-based remote service.

Serializes remote invocation objects and deserializes remote invocation result objects. Uses Java serialization just like RMI, but with the JMS provider as communication infrastructure.

To be configured with a javax.jms.QueueConnectionFactory and a target queue (either as javax.jms.Queue reference or as queue name).

Thanks to James Strachan for the original prototype that this JMS invoker mechanism was inspired by!
author:
   Juergen Hoeller
author:
   James Strachan
since:
   2.0
See Also:   JmsInvokerClientInterceptor.setConnectionFactory
See Also:   JmsInvokerClientInterceptor.setQueue
See Also:   JmsInvokerClientInterceptor.setQueueName
See Also:   org.springframework.jms.remoting.JmsInvokerServiceExporter
See Also:   org.springframework.jms.remoting.JmsInvokerProxyFactoryBean





Method Summary
public  voidafterPropertiesSet()
    
protected  RemoteInvocationcreateRemoteInvocation(MethodInvocation methodInvocation)
     Create a new RemoteInvocation object for the given AOP method invocation.
protected  MessagecreateRequestMessage(Session session, RemoteInvocation invocation)
     Create the invoker request message.
protected  MessagedoExecuteRequest(QueueSession session, Queue queue, Message requestMessage)
     Actually execute the given request, sending the invoker request message to the specified target queue and waiting for a corresponding response.
protected  RemoteInvocationResultexecuteRequest(RemoteInvocation invocation)
     Execute the given remote invocation, sending an invoker request message to this accessor's target queue and waiting for a corresponding response.
protected  RemoteInvocationResultextractInvocationResult(Message responseMessage)
     Extract the invocation result from the response message.

The default implementation expects a JMS ObjectMessage carrying a RemoteInvocationResult object.

protected  QueueConnectionFactorygetConnectionFactory()
     Return the QueueConnectionFactory to use for obtaining JMS QueueConnections.
public  Objectinvoke(MethodInvocation methodInvocation)
    
protected  RemoteInvocationResultonInvalidResponse(Message responseMessage)
     Callback that is invoked by extractInvocationResult when it encounters an invalid response message.
protected  ObjectrecreateRemoteInvocationResult(RemoteInvocationResult result)
     Recreate the invocation result contained in the given RemoteInvocationResult object.
protected  QueueresolveQueue(Session session)
     Resolve this accessor's target queue.
protected  QueueresolveQueueName(Session session, String queueName)
     Resolve the given queue name into a JMS javax.jms.Queue , via this accessor's DestinationResolver .
public  voidsetConnectionFactory(QueueConnectionFactory connectionFactory)
     Set the QueueConnectionFactory to use for obtaining JMS QueueConnections.
public  voidsetDestinationResolver(DestinationResolver destinationResolver)
     Set the DestinationResolver that is to be used to resolve Queue references for this accessor.

The default resolver is a DynamicDestinationResolver.

public  voidsetMessageConverter(MessageConverter messageConverter)
     Specify the MessageConverter to use for turning org.springframework.remoting.support.RemoteInvocation objects into request messages, as well as response messages into org.springframework.remoting.support.RemoteInvocationResult objects.
public  voidsetQueue(Queue queue)
     Set the target Queue to send invoker requests to.
public  voidsetQueueName(String queueName)
     Set the name of target queue to send invoker requests to.
public  voidsetRemoteInvocationFactory(RemoteInvocationFactory remoteInvocationFactory)
     Set the RemoteInvocationFactory to use for this accessor.



Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)



createRemoteInvocation
protected RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation)(Code)
Create a new RemoteInvocation object for the given AOP method invocation. The default implementation delegates to the RemoteInvocationFactory.

Can be overridden in subclasses to provide custom RemoteInvocation subclasses, containing additional invocation parameters like user credentials. Note that it is preferable to use a custom RemoteInvocationFactory which is a reusable strategy.
Parameters:
  methodInvocation - the current AOP method invocation the RemoteInvocation object
See Also:   RemoteInvocationFactory.createRemoteInvocation




createRequestMessage
protected Message createRequestMessage(Session session, RemoteInvocation invocation) throws JMSException(Code)
Create the invoker request message.

The default implementation creates a JMS ObjectMessage for the given RemoteInvocation object.
Parameters:
  session - the current JMS Session
Parameters:
  invocation - the remote invocation to send the JMS Message to send
throws:
  JMSException - if the message could not be created




doExecuteRequest
protected Message doExecuteRequest(QueueSession session, Queue queue, Message requestMessage) throws JMSException(Code)
Actually execute the given request, sending the invoker request message to the specified target queue and waiting for a corresponding response.

The default implementation is based on a standard JMS javax.jms.QueueRequestor , using a freshly obtained JMS Session.
Parameters:
  session - the JMS Session to use
Parameters:
  queue - the resolved target Queue to send to
Parameters:
  requestMessage - the JMS Message to send the RemoteInvocationResult object
throws:
  JMSException - in case of JMS failure




executeRequest
protected RemoteInvocationResult executeRequest(RemoteInvocation invocation) throws JMSException(Code)
Execute the given remote invocation, sending an invoker request message to this accessor's target queue and waiting for a corresponding response.
Parameters:
  invocation - the RemoteInvocation to execute the RemoteInvocationResult object
throws:
  JMSException - in case of JMS failure
See Also:   JmsInvokerClientInterceptor.doExecuteRequest



extractInvocationResult
protected RemoteInvocationResult extractInvocationResult(Message responseMessage) throws JMSException(Code)
Extract the invocation result from the response message.

The default implementation expects a JMS ObjectMessage carrying a RemoteInvocationResult object. If an invalid response message is encountered, the onInvalidResponse callback gets invoked.
Parameters:
  responseMessage - the response message the invocation result
throws:
  JMSException - is thrown if a JMS exception occurs
See Also:   JmsInvokerClientInterceptor.onInvalidResponse




getConnectionFactory
protected QueueConnectionFactory getConnectionFactory()(Code)
Return the QueueConnectionFactory to use for obtaining JMS QueueConnections.



invoke
public Object invoke(MethodInvocation methodInvocation) throws Throwable(Code)



onInvalidResponse
protected RemoteInvocationResult onInvalidResponse(Message responseMessage) throws JMSException(Code)
Callback that is invoked by extractInvocationResult when it encounters an invalid response message.

The default implementation throws a MessageFormatException.
Parameters:
  responseMessage - the invalid response message an alternative invocation result that should bereturned to the caller (if desired)
throws:
  JMSException - if the invalid response should leadto an infrastructure exception propagated to the caller
See Also:   JmsInvokerClientInterceptor.extractInvocationResult




recreateRemoteInvocationResult
protected Object recreateRemoteInvocationResult(RemoteInvocationResult result) throws Throwable(Code)
Recreate the invocation result contained in the given RemoteInvocationResult object. The default implementation calls the default recreate method.

Can be overridden in subclass to provide custom recreation, potentially processing the returned result object.
Parameters:
  result - the RemoteInvocationResult to recreate a return value if the invocation result is a successful return
throws:
  Throwable - if the invocation result is an exception
See Also:   org.springframework.remoting.support.RemoteInvocationResult.recreate




resolveQueue
protected Queue resolveQueue(Session session) throws JMSException(Code)
Resolve this accessor's target queue.
Parameters:
  session - the current JMS Session the resolved target Queue
throws:
  JMSException - if resolution failed



resolveQueueName
protected Queue resolveQueueName(Session session, String queueName) throws JMSException(Code)
Resolve the given queue name into a JMS javax.jms.Queue , via this accessor's DestinationResolver .
Parameters:
  session - the current JMS Session
Parameters:
  queueName - the name of the queue the located Queue
throws:
  JMSException - if resolution failed
See Also:   JmsInvokerClientInterceptor.setDestinationResolver



setConnectionFactory
public void setConnectionFactory(QueueConnectionFactory connectionFactory)(Code)
Set the QueueConnectionFactory to use for obtaining JMS QueueConnections.



setDestinationResolver
public void setDestinationResolver(DestinationResolver destinationResolver)(Code)
Set the DestinationResolver that is to be used to resolve Queue references for this accessor.

The default resolver is a DynamicDestinationResolver. Specify a JndiDestinationResolver for resolving destination names as JNDI locations.
See Also:   org.springframework.jms.support.destination.DynamicDestinationResolver
See Also:   org.springframework.jms.support.destination.JndiDestinationResolver




setMessageConverter
public void setMessageConverter(MessageConverter messageConverter)(Code)
Specify the MessageConverter to use for turning org.springframework.remoting.support.RemoteInvocation objects into request messages, as well as response messages into org.springframework.remoting.support.RemoteInvocationResult objects.

Default is a org.springframework.jms.support.converter.SimpleMessageConverter , using a standard JMS javax.jms.ObjectMessage for each invocation / invocation result object.

Custom implementations may generally adapt Serializables into special kinds of messages, or might be specifically tailored for translating RemoteInvocation(Result)s into specific kinds of messages.




setQueue
public void setQueue(Queue queue)(Code)
Set the target Queue to send invoker requests to.



setQueueName
public void setQueueName(String queueName)(Code)
Set the name of target queue to send invoker requests to. The specified name will be dynamically resolved via the JmsInvokerClientInterceptor.setDestinationResolver DestinationResolver .



setRemoteInvocationFactory
public void setRemoteInvocationFactory(RemoteInvocationFactory remoteInvocationFactory)(Code)
Set the RemoteInvocationFactory to use for this accessor. Default is a org.springframework.remoting.support.DefaultRemoteInvocationFactory .

A custom invocation factory can add further context information to the invocation, for example user credentials.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.