Coverage Report - org.mule.transport.jdbc.JdbcMessageRequester
 
Classes in this File Line Coverage Branch Coverage Complexity
JdbcMessageRequester
0%
0/9
N/A
0
 
 1  
 /*
 2  
  * $Id: JdbcMessageRequester.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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  
 import org.mule.transport.jdbc.sqlstrategy.SqlStatementStrategy;
 18  
 
 19  
 
 20  
 public class JdbcMessageRequester extends AbstractMessageRequester
 21  
 {
 22  
 
 23  
     private JdbcConnector connector;
 24  
 
 25  
     public JdbcMessageRequester(InboundEndpoint endpoint)
 26  
     {
 27  0
         super(endpoint);
 28  0
         this.connector = (JdbcConnector) endpoint.getConnector();
 29  0
     }
 30  
 
 31  
     @Override
 32  
     protected void doDispose()
 33  
     {
 34  
         // template method
 35  0
     }
 36  
 
 37  
     /**
 38  
      * Make a specific request to the underlying transport
 39  
      *
 40  
      * @param timeout the maximum time the operation should block before returning.
 41  
      *            The call should return immediately if there is data available. If
 42  
      *            no data becomes available before the timeout elapses, null will be
 43  
      *            returned
 44  
      * @return the result of the request wrapped in a MuleMessage object. Null will be
 45  
      *         returned if no data was available
 46  
      * @throws Exception if the call to the underlying protocol causes an exception
 47  
      */
 48  
     protected MuleMessage doRequest(long timeout) throws Exception
 49  
     {
 50  0
         return doRequest(timeout, null);
 51  
     }
 52  
 
 53  
     /**
 54  
      * Make a specific request to the underlying transport
 55  
      * Special case: The event is need when doReceive was called from doSend
 56  
      * @param timeout only for compatibility with doRequest(long timeout)
 57  
      * @param event There is a need to get params from message
 58  
      * @return the result of the request wrapped in a MuleMessage object. Null will be
 59  
      *         returned if no data was available
 60  
      * @throws Exception if the call to the underlying protocol causes an exception
 61  
      */
 62  
     protected MuleMessage doRequest(long timeout, MuleEvent event) throws Exception
 63  
     {
 64  0
         SqlStatementStrategy strategy = connector.getSqlStatementStrategyFactory().create("select", null);
 65  0
         return strategy.executeStatement(connector, endpoint, event, timeout);        
 66  
     }
 67  
 
 68  
 
 69  
     @Override
 70  
     protected void doConnect() throws Exception
 71  
     {
 72  
         // template method
 73  0
     }
 74  
 
 75  
     @Override
 76  
     protected void doDisconnect() throws Exception
 77  
     {
 78  
         // template method
 79  0
     }
 80  
 
 81  
 }