1
2
3
4
5
6
7
8
9
10
11 package org.mule.components.script.jsr223;
12
13 import org.mule.impl.model.streaming.StreamingService;
14 import org.mule.umo.UMOEventContext;
15
16 import java.io.InputStream;
17 import java.io.OutputStream;
18
19 import javax.script.Bindings;
20
21
22
23
24
25 public class StreamingScriptComponent extends AbstractScriptComponent implements StreamingService
26 {
27
28 public void call(InputStream in, OutputStream out, UMOEventContext eventContext) throws Exception
29 {
30 Bindings bindings = this.getBindings();
31 this.populateBindings(bindings, in, out, eventContext);
32 this.runScript(bindings);
33 }
34
35 protected void populateBindings(Bindings namespace, InputStream in, OutputStream out,
36 UMOEventContext context)
37 {
38 super.populateBindings(namespace, context);
39
40 namespace.put("inputStream", in);
41 namespace.put("outputStream", out);
42 }
43
44 }