View Javadoc

1   /***
2    *
3    * Copyright 2005 LogicBlaze, Inc.
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   *
17   **/
18  package org.logicblaze.lingo.jms.marshall;
19  
20  import org.logicblaze.lingo.LingoInvocation;
21  import org.logicblaze.lingo.jms.Requestor;
22  import org.springframework.remoting.support.RemoteInvocation;
23  import org.springframework.remoting.support.RemoteInvocationResult;
24  
25  import javax.jms.JMSException;
26  import javax.jms.Message;
27  import javax.jms.Session;
28  
29  /***
30   * @version $Revision: 1.3 $
31   */
32  public interface Marshaller {
33  
34      /***
35       * Creates the request message
36       *
37       * @param requestor
38       * @param invocation the remote invocation to send
39       * @throws javax.jms.JMSException if the message could not be created
40       */
41      Message createRequestMessage(Requestor requestor, LingoInvocation invocation) throws JMSException;
42  
43      /***
44       * Creates the response message
45       * 
46       * @param session the JMS session to use
47       * @param result the result invocation
48       * @param requestMessage the original request message
49       * @return the response message to send
50       * @throws JMSException if the message could not be created
51       */
52      Message createResponseMessage(Session session, RemoteInvocationResult result, Message requestMessage) throws JMSException;
53  
54      /***
55       * Extracts the invocation result from the response message
56       *
57       * @param message the response message
58       * @return the invocation result
59       * @throws javax.jms.JMSException is thrown if a JMS exception occurs
60       */
61      RemoteInvocationResult extractInvocationResult(Message message) throws JMSException;
62  
63      /***
64       * Read a RemoteInvocation from the given JMS message
65       *
66       * @param message current JMS message
67       * @return the RemoteInvocation object
68       */
69      RemoteInvocation readRemoteInvocation(Message message) throws JMSException;
70      
71      /***
72       * Creates a message for a Java Object for when distributing objects in collections
73       */
74      Message createObjectMessage(Session session, Object value) throws JMSException;
75  
76      /***
77       * Extracts the body from the given JMS message
78       * @throws JMSException 
79       */
80      Object readMessage(Message message) throws JMSException;
81  
82  
83  }