Coverage Report - org.mule.transport.stdio.StdioConnector
 
Classes in this File Line Coverage Branch Coverage Complexity
StdioConnector
29%
4/14
N/A
1
 
 1  
 /*
 2  
  * $Id: StdioConnector.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.stdio;
 12  
 
 13  
 import org.mule.api.endpoint.InboundEndpoint;
 14  
 import org.mule.api.service.Service;
 15  
 import org.mule.api.transport.MessageReceiver;
 16  
 import org.mule.transport.AbstractConnector;
 17  
 import org.mule.transport.AbstractPollingMessageReceiver;
 18  
 
 19  
 import java.io.InputStream;
 20  
 import java.io.OutputStream;
 21  
 
 22  
 import org.apache.commons.io.IOUtils;
 23  
 
 24  
 /**
 25  
  * <code>StdioConnector</code> can send and receive Mule events over IO streams.
 26  
  */
 27  
 
 28  36
 public abstract class StdioConnector extends AbstractConnector
 29  
 {
 30  
 
 31  
     public static final String STDIO = "stdio";
 32  
     public static final String STREAM_SYSTEM_IN = "system.in";
 33  
     public static final String STREAM_SYSTEM_OUT = "system.out";
 34  
     public static final String STREAM_SYSTEM_ERR = "system.err";
 35  
 
 36  
     protected OutputStream outputStream;
 37  
     protected InputStream inputStream;
 38  
 
 39  
     /*
 40  
      * (non-Javadoc)
 41  
      * 
 42  
      * @see org.mule.api.transport.Connector#registerListener(org.mule.api.MuleSession,
 43  
      *      org.mule.api.endpoint.Endpoint)
 44  
      */
 45  
     public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception
 46  
     {
 47  8
         return serviceDescriptor.createMessageReceiver(this, service, endpoint,
 48  
             new Object[]{new Long(AbstractPollingMessageReceiver.DEFAULT_POLL_FREQUENCY)});
 49  
     }
 50  
 
 51  
     /*
 52  
      * (non-Javadoc)
 53  
      * 
 54  
      * @see org.mule.transport.AbstractConnector#doStop()
 55  
      */
 56  
     public void doStop()
 57  
     {
 58  
         // template method
 59  32
     }
 60  
 
 61  
     protected void doDispose()
 62  
     {
 63  0
         IOUtils.closeQuietly(inputStream);
 64  0
         IOUtils.closeQuietly(outputStream);
 65  0
     }
 66  
 
 67  
     /*
 68  
      * (non-Javadoc)
 69  
      * 
 70  
      * @see org.mule.transport.AbstractConnector#doStart()
 71  
      */
 72  
     public void doStart()
 73  
     {
 74  
         // template method
 75  0
     }
 76  
 
 77  
     /*
 78  
      * (non-Javadoc)
 79  
      * 
 80  
      * @see org.mule.api.transport.Connector#getProtocol()
 81  
      */
 82  
 
 83  
     public String getProtocol()
 84  
     {
 85  88
         return STDIO;
 86  
     }
 87  
 
 88  
     public InputStream getInputStream()
 89  
     {
 90  0
         return inputStream;
 91  
     }
 92  
 
 93  
     public void setInputStream(InputStream inputStream)
 94  
     {
 95  0
         this.inputStream = inputStream;
 96  0
     }
 97  
 
 98  
     public OutputStream getOutputStream()
 99  
     {
 100  0
         return outputStream;
 101  
     }
 102  
 
 103  
     public void setOutputStream(OutputStream outputStream)
 104  
     {
 105  0
         this.outputStream = outputStream;
 106  0
     }
 107  
 
 108  
 }