1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jelly.avalon;
18
19 import java.util.Map;
20 import java.util.HashMap;
21 import java.util.Iterator;
22 import java.net.URL;
23 import java.net.MalformedURLException;
24 import java.io.File;
25 import java.io.InputStream;
26 import java.io.OutputStream;
27
28
29 import org.apache.avalon.framework.configuration.Configurable;
30 import org.apache.avalon.framework.configuration.Configuration;
31 import org.apache.avalon.framework.configuration.ConfigurationException;
32
33
34 import org.apache.commons.jelly.Jelly;
35 import org.apache.commons.jelly.JellyContext;
36 import org.apache.commons.jelly.JellyException;
37 import org.apache.commons.jelly.Script;
38 import org.apache.commons.jelly.XMLOutput;
39
40 /***
41 * An Avalon based service for executing Jelly scripts. The
42 * service allows executing a script based on a name as well
43 * as by a URL.
44 *
45 * @author <a href="mailto:robert@bull-enterprises.com">Robert McIntosh</a>
46 * @version 1.1
47 */
48 public interface JellyService {
49
50 /***
51 * Executes a named script with the supplied
52 * Map of parameters.
53 *
54 * @param params Parameters to be supplied to the script
55 * @return All of the variables from the JellyContext
56 * @exception Exception if the script raises some kind of exception while processing
57 */
58 public Map runNamedScript( String name, Map params ) throws Exception;
59
60 /***
61 * Executes a named script with the supplied
62 * Map of parameters.
63 *
64 * @param name is the name of the script to run
65 * @param params Parameters to be supplied to the script
66 * @param output is the XMLOutput for any output to be sent
67 * @return All of the variables from the JellyContext
68 * @exception Exception if the script raises some kind of exception while processing
69 */
70 public Map runNamedScript( String name, Map params, XMLOutput output ) throws Exception;
71
72 /***
73 * Executes a named script with the supplied
74 * Map of parameters and send the output of the script
75 * to the supplied output stream.
76 *
77 * @param name is the name of the script to run
78 * @param params Parameters to be supplied to the script
79 * @param out is the outputStream for output to be sent
80 * @return All of the variables from the JellyContext
81 * @exception Exception if the script raises some kind of exception while processing
82 */
83 public Map runNamedScript( String name, Map params, OutputStream out ) throws Exception;
84
85 /***
86 * Runs a script from the supplied url
87 *
88 * @param url The URL of the script
89 * @param params Parameters to be supplied to the script
90 * @param output is the XMLOutput where output of the script will go
91 * @return All of the variables from the JellyContext
92 */
93 public Map runScript( String url, Map params, XMLOutput output ) throws Exception;
94
95 /***
96 * Runs a script from the supplied url and sends the output of the script to
97 * the supplied OutputStream.
98 *
99 * @param url The URL of the script
100 * @param params Parameters to be supplied to the script
101 * @param out The OutputStream to send the output of the script to
102 * @return All of the variables from the JellyContext
103 * @exception Exception if the script raises some kind of exception while processing
104 */
105 public Map runScript( String url, Map params, OutputStream out ) throws Exception;
106
107 /***
108 * Runs a script from the supplied url
109 *
110 * @param url The URL of the script
111 * @param params Parameters to be supplied to the script
112 * @return All of the variables from the JellyContext
113 * @exception Exception if the script raises some kind of exception while processing
114 */
115 public Map runScript( String url, Map params ) throws Exception;
116
117 }
118