1 10 11 package org.mule.providers.stream; 12 13 import java.io.InputStream ; 14 import java.io.OutputStream ; 15 16 import org.apache.commons.io.IOUtils; 17 import org.mule.providers.AbstractServiceEnabledConnector; 18 import org.mule.umo.UMOComponent; 19 import org.mule.umo.endpoint.UMOEndpoint; 20 import org.mule.umo.provider.UMOMessageReceiver; 21 22 25 26 public abstract class StreamConnector extends AbstractServiceEnabledConnector 27 { 28 public static final String STREAM_SYSTEM_IN = "system.in"; 29 public static final String STREAM_SYSTEM_OUT = "system.out"; 30 public static final String STREAM_SYSTEM_ERR = "system.err"; 31 32 protected OutputStream outputStream; 33 protected InputStream inputStream; 34 35 41 public UMOMessageReceiver createReceiver(UMOComponent component, UMOEndpoint endpoint) throws Exception 42 { 43 return serviceDescriptor.createMessageReceiver(this, component, endpoint, 44 new Object []{new Long (1000)}); 45 } 46 47 52 public void doStop() 53 { 54 } 56 57 protected void doDispose() 58 { 59 IOUtils.closeQuietly(inputStream); 60 IOUtils.closeQuietly(outputStream); 61 } 62 63 68 public void doStart() 69 { 70 } 72 73 78 79 public String getProtocol() 80 { 81 return "stream"; 82 } 83 84 public InputStream getInputStream() 85 { 86 return inputStream; 87 } 88 89 public void setInputStream(InputStream inputStream) 90 { 91 this.inputStream = inputStream; 92 } 93 94 public OutputStream getOutputStream() 95 { 96 return outputStream; 97 } 98 99 public void setOutputStream(OutputStream outputStream) 100 { 101 this.outputStream = outputStream; 102 } 103 104 } 105 | Popular Tags |