1 /* 2 * $Id: OutputHandler.java 3798 2006-11-04 04:07:14Z aperepel $ 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.umo.provider; 12 13 import org.mule.umo.UMOEvent; 14 15 import java.io.IOException; 16 import java.io.OutputStream; 17 import java.util.Map; 18 19 /** 20 * The OutputHandler is a strategy class that is set on the StreamMessageAdapter to 21 * defer the writing of the message payload until there is a stream available to 22 * write it to. 23 * 24 * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a> 25 * @version $Revision: 3798 $ 26 * @see org.mule.providers.streaming.StreamMessageAdapter 27 */ 28 public interface OutputHandler 29 { 30 31 /** 32 * Write the event payload to the stream. Depending on the underlying transport, 33 * attachements and message properties may be written to the stream here too. 34 * 35 * @param event the current event 36 * @param out the output stream to write to 37 * @throws IOException 38 */ 39 public void write(UMOEvent event, OutputStream out) throws IOException; 40 41 /** 42 * Used to obtain a set of headers that will be sent with this stream payload. 43 * Headers are typically set independently from a stream payload. 44 * 45 * @param event the current event 46 * @return a Map of headers or an empty map if there are no headers 47 */ 48 public Map getHeaders(UMOEvent event); 49 } 50