1 /* 2 * $Id: UMOStreamMessageAdapter.java 7976 2007-08-21 14:26:13Z dirk.olmes $ 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.umo.provider; 12 13 import org.mule.umo.UMOEvent; 14 15 import java.io.IOException; 16 import java.io.InputStream; 17 import java.io.OutputStream; 18 19 /** 20 * A stream message adapter rovides a generic base class for stream based message 21 * flows in Mule. This adapter represents the 3 flows of data that Mule identifies, 22 * namely inbound, outbound and response flows. These are represented by three 23 * streams on the adapter. 24 */ 25 26 public interface UMOStreamMessageAdapter extends UMOMessageAdapter 27 { 28 /** 29 * Gets the input Stream associated with this event 30 * 31 * @return the input Stream associated with this event 32 */ 33 InputStream getInputStream(); 34 35 /** 36 * Gets the output Stream associated with this event 37 * 38 * @return the output Stream associated with this event 39 */ 40 OutputStream getOutputStream(); 41 42 /** 43 * Writes the event to the current outputStream using the OutputHandler set on 44 * the StreamAdapter. 45 * 46 * @param event the event to write to the stream 47 * @throws IOException 48 */ 49 void write(UMOEvent event) throws IOException; 50 51 /** 52 * The Output handler is a callback that will handle the writing to an output 53 * Stream when the Stream is available 54 * 55 * @return the handler used to write to the stream 56 */ 57 OutputHandler getOutputHandler(); 58 59 /** 60 * The Output handler is a callback that will handle the writing to an output 61 * Stream when the Stream is available 62 * 63 * @param handler the handler used to write to the stream 64 */ 65 void setOutputHandler(OutputHandler handler); 66 67 /** 68 * The release method is called by Mule to notify this adapter that it is no 69 * longer needed. This method can be used to release any resources that a custom 70 * StreamAdapter may have associated with it. 71 */ 72 void release(); 73 }