JspCompilerAdapterFactorypublic final class JspCompilerAdapterFactory extends Object Creates the necessary compiler adapter, given basic criteria. |
Constructors Summary |
---|
private JspCompilerAdapterFactory()This is a singleton -- can't create instances!!
|
Methods Summary |
---|
public static JspCompilerAdapter | getCompiler(java.lang.String compilerType, org.apache.tools.ant.Task task)Based on the parameter passed in, this method creates the necessary
factory desired.
The current mapping for compiler names are as follows:
- jasper = jasper compiler (the default)
- a fully quallified classname = the name of a jsp compiler
adapter
return getCompiler(compilerType, task,
task.getProject().createClassLoader(null));
| public static JspCompilerAdapter | getCompiler(java.lang.String compilerType, org.apache.tools.ant.Task task, org.apache.tools.ant.AntClassLoader loader)Based on the parameter passed in, this method creates the necessary
factory desired.
The current mapping for compiler names are as follows:
- jasper = jasper compiler (the default)
- a fully quallified classname = the name of a jsp compiler
adapter
if (compilerType.equalsIgnoreCase("jasper")) {
//tomcat4.0 gets the old mangler
return new JasperC(new JspNameMangler());
}
if (compilerType.equalsIgnoreCase("jasper41")) {
//tomcat4.1 gets the new one
return new JasperC(new Jasper41Mangler());
}
return resolveClassName(compilerType, loader);
| private static JspCompilerAdapter | resolveClassName(java.lang.String className, org.apache.tools.ant.AntClassLoader classloader)Tries to resolve the given classname into a compiler adapter.
Throws a fit if it can't.
try {
Class c = classloader.findClass(className);
Object o = c.newInstance();
return (JspCompilerAdapter) o;
} catch (ClassNotFoundException cnfe) {
throw new BuildException(className + " can\'t be found.", cnfe);
} catch (ClassCastException cce) {
throw new BuildException(className + " isn\'t the classname of "
+ "a compiler adapter.", cce);
} catch (Throwable t) {
// for all other possibilities
throw new BuildException(className + " caused an interesting "
+ "exception.", t);
}
|
|