// TODO: why doesn't this work?
// Reader in = src.getCharacterStream();
Reader in = new java.io.InputStreamReader(this.inputSource.getInputStream());
// Set up the BSF manager and register relevant helper "beans"
BSFManager mgr = new BSFManager();
// add support for additional languages
if (this.additionalLanguages != null)
{
for (int i = 0; i < this.additionalLanguages.length; ++i)
{
getLogger().debug("adding BSF language " + this.additionalLanguages[i].name + " with engine " + this.additionalLanguages[i].engineSrc);
mgr.registerScriptingEngine(this.additionalLanguages[i].name,
this.additionalLanguages[i].engineSrc,
this.additionalLanguages[i].extensions);
}
}
StringBuffer output = new StringBuffer();
mgr.registerBean("resolver", this.resolver);
mgr.registerBean("source", super.source);
mgr.registerBean("objectModel", this.objectModel);
mgr.registerBean("parameters", this.parameters);
mgr.registerBean("output", output);
mgr.registerBean("logger", getLogger());
getLogger().debug("BSFManager execution begining");
// Execute the script
mgr.exec(BSFManager.getLangFromFilename(this.inputSource.getSystemId()),
this.inputSource.getSystemId(), 0, 0, IOUtils.getStringFromReader(in));
getLogger().debug("BSFManager execution complete");
getLogger().debug("output = [" + output.toString() + "]");