KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > jdbc > JdbcMessageAdapter


1 /*
2  * $Id: JdbcMessageAdapter.java 3982 2006-11-22 14:28:01Z lajos $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.providers.jdbc;
12
13 import org.mule.providers.AbstractMessageAdapter;
14
15 public class JdbcMessageAdapter extends AbstractMessageAdapter
16 {
17     /**
18      * Serial version
19      */

20     private static final long serialVersionUID = 6770314376258549559L;
21
22     private final Object JavaDoc payload;
23
24     public JdbcMessageAdapter(Object JavaDoc obj)
25     {
26         this.payload = obj;
27     }
28
29     /**
30      * Converts the message implementation into a String representation
31      *
32      * @param encoding The encoding to use when transforming the message (if
33      * necessary). The parameter is used when converting from a byte array
34      * @return String representation of the message payload
35      * @throws Exception Implementation may throw an endpoint specific exception
36      */

37     public String JavaDoc getPayloadAsString(String JavaDoc encoding) throws Exception JavaDoc
38     {
39         return payload.toString();
40     }
41
42     /*
43      * (non-Javadoc)
44      *
45      * @see org.mule.umo.provider.UMOMessageAdapter#getPayloadAsBytes()
46      */

47     public byte[] getPayloadAsBytes() throws Exception JavaDoc
48     {
49         return payload.toString().getBytes();
50     }
51
52     /*
53      * (non-Javadoc)
54      *
55      * @see org.mule.umo.provider.UMOMessageAdapter#getPayload()
56      */

57     public Object JavaDoc getPayload()
58     {
59         return payload;
60     }
61
62 }
63
Popular Tags