KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jms > support > converter > MessageConverter


1 /*
2  * Copyright 2002-2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.jms.support.converter;
18
19 import javax.jms.JMSException JavaDoc;
20 import javax.jms.Message JavaDoc;
21 import javax.jms.Session JavaDoc;
22
23 /**
24  * Strategy interface that specifies a MessageConverter
25  * between Java objects and JMS messages.
26  *
27  * @author Mark Pollack
28  * @author Juergen Hoeller
29  * @since 1.1
30  */

31 public interface MessageConverter {
32
33     /**
34      * Convert a Java object to a JMS Message using the supplied session
35      * to create the message object.
36      * @param object the object to convert
37      * @param session the Session to use for creating a JMS Message
38      * @return the JMS Message
39      * @throws javax.jms.JMSException if thrown by JMS API methods
40      * @throws org.springframework.jms.support.converter.MessageConversionException in case of conversion failure
41      */

42     Message JavaDoc toMessage(Object JavaDoc object, Session JavaDoc session) throws JMSException JavaDoc, MessageConversionException;
43
44     /**
45      * Convert from a JMS Message to a Java object.
46      * @param message the message to convert
47      * @return the converted Java object
48      * @throws org.springframework.jms.support.converter.MessageConversionException in case of conversion failure
49      */

50     Object JavaDoc fromMessage(Message JavaDoc message) throws JMSException JavaDoc, MessageConversionException;
51
52 }
53
Popular Tags