*/
protected void compile(
String name, File baseDirectory, String encoding
) throws LanguageException {
try {
Main compiler = (Main) this.compilerClass.newInstance();
int pos = name.lastIndexOf(File.separatorChar);
String filename = name.substring(pos + 1);
String pathname =
baseDirectory.getCanonicalPath() + File.separator +
name.substring(0, pos).replace(File.separatorChar, '/');
String packageName =
name.substring(0, pos).replace(File.separatorChar, '.');
String[] args = {
"-extends",
"org.apache.cocoon.components.language.markup.xsp.JSGenerator",
"-nosource",
"-O", "9",
"-package", packageName,
"-o", filename + ".class",
pathname + File.separator + filename + "." + this.getSourceExtension()
};
compiler.main(args);
} catch (Exception e) {
getLogger().warn("JavascriptLanguage.compile", e);
throw new LanguageException(e.getMessage());
}
}