public String callFunction(String type, String source, String function, Map params) throws Exception {
redirector.reset();
ServiceSelector selector = null;
Interpreter interpreter = null;
SourceResolver resolver = null;
try {
selector = (ServiceSelector) this.lookup(Interpreter.ROLE);
assertNotNull("Test lookup of interpreter selector", selector);
resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
assertNotNull("Test lookup of source resolver", resolver);
assertNotNull("Test if interpreter name is not null", type);
interpreter = (Interpreter) selector.select(type);
assertNotNull("Test lookup of interpreter", interpreter);
((AbstractInterpreter)interpreter).register(source);
ArrayList parameters = new ArrayList();
for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
Map.Entry me = (Map.Entry)i.next();
String name = (String)me.getKey();
String value = (String)me.getValue();
parameters.add(new Interpreter.Argument(name, value));
}
interpreter.callFunction(function, parameters, getRedirector());
} catch (ServiceException ce) {
getLogger().error("Could not retrieve interpeter", ce);
fail("Could not retrieve interpreter: " + ce.toString());
} finally {