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 | 2 | public class StreamingScriptComponent extends AbstractScriptComponent implements StreamingService |
26 | |
{ |
27 | |
|
28 | |
public void call(InputStream in, OutputStream out, UMOEventContext eventContext) throws Exception |
29 | |
{ |
30 | 2 | Bindings bindings = this.getBindings(); |
31 | 2 | this.populateBindings(bindings, in, out, eventContext); |
32 | 2 | this.runScript(bindings); |
33 | 2 | } |
34 | |
|
35 | |
protected void populateBindings(Bindings namespace, InputStream in, OutputStream out, |
36 | |
UMOEventContext context) |
37 | |
{ |
38 | 2 | super.populateBindings(namespace, context); |
39 | |
|
40 | 2 | namespace.put("inputStream", in); |
41 | 2 | namespace.put("outputStream", out); |
42 | 2 | } |
43 | |
|
44 | |
} |