1 /* 2 * $Id: JdbcMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ 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 CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.transport.jdbc; 12 13 import org.mule.api.MuleEvent; 14 import org.mule.api.MuleMessage; 15 import org.mule.api.endpoint.InboundEndpoint; 16 import org.mule.transport.AbstractMessageRequester; 17 18 19 public class JdbcMessageRequester extends AbstractMessageRequester 20 { 21 22 private JdbcConnector connector; 23 24 public JdbcMessageRequester(InboundEndpoint endpoint) 25 { 26 super(endpoint); 27 this.connector = (JdbcConnector) endpoint.getConnector(); 28 } 29 30 /* 31 * (non-Javadoc) 32 * 33 * @see org.mule.transport.AbstractMessageDispatcher#doDispose() 34 */ 35 protected void doDispose() 36 { 37 // template method 38 } 39 40 /** 41 * Make a specific request to the underlying transport 42 * 43 * @param timeout the maximum time the operation should block before returning. 44 * The call should return immediately if there is data available. If 45 * no data becomes available before the timeout elapses, null will be 46 * returned 47 * @return the result of the request wrapped in a MuleMessage object. Null will be 48 * returned if no data was available 49 * @throws Exception if the call to the underlying protocol causes an exception 50 */ 51 protected MuleMessage doRequest(long timeout) throws Exception 52 { 53 return doRequest(timeout, null); 54 } 55 56 /** 57 * Make a specific request to the underlying transport 58 * Special case: The event is need when doReceive was called from doSend 59 * @param timeout only for compatibility with doRequest(long timeout) 60 * @param event There is a need to get params from message 61 * @return the result of the request wrapped in a MuleMessage object. Null will be 62 * returned if no data was available 63 * @throws Exception if the call to the underlying protocol causes an exception 64 */ 65 protected MuleMessage doRequest(long timeout, MuleEvent event) throws Exception 66 { 67 return JdbcMessageDispatcher.executeRequest(timeout, event, connector, endpoint); 68 } 69 70 71 protected void doConnect() throws Exception 72 { 73 // template method 74 } 75 76 protected void doDisconnect() throws Exception 77 { 78 // template method 79 } 80 81 }