Methods Summary |
---|
private void | CheckForMutuallyExclusiveAttribute()This private class checks for any mutually exclusive attributes.
If mutually exclusive attributes that are specified, then a
BuildException is thrown.
if(webAppBaseDir!=null && srcDir!=null) {
final String msg = lsm.getString("MutuallyExclusivelyAttribute",
new Object[] {"srcdir",
"webapp"});
throw new BuildException(msg, getLocation());
}
|
private org.apache.tools.ant.types.Path | constructPath()
StringBuffer classPathBuffer = new StringBuffer();
if(getAsinstalldir()!=null)
{
for(int i=0;i<CLASSPATH_ELEMENTS.length;i++)
{
classPathBuffer.append((new File(getAsinstalldir(),CLASSPATH_ELEMENTS[i])).getPath());
classPathBuffer.append(":");
}
}
if(classPath!=null)
{
classPathBuffer.append(classPath);
classPathBuffer.append(":");
}
classPathBuffer.append(Path.systemClasspath);
return new Path(getProject(),classPathBuffer.toString());
|
public org.apache.tools.ant.types.Path | createClasspath()Nested ClassPath Element
if(classPath==null)
classPath = new Path(project);
return classPath.createPath();
|
protected boolean | doCompilation(java.lang.String[] args)
try
{
Java java = (Java)project.createTask("java");
java.setClasspath(constructPath());
java.setClassname("org.apache.jasper.JspC");
for(int i=0;i<args.length;i++)
{
java.createArg().setValue(args[i]);
}
java.setFailonerror(failOnError);
java.setFork(true);
log("Executing Jasper Compiler");
int returnCode = java.executeJava();
if(returnCode == 1)
{
log(lsm.getString("SetVerbose"));
return false;
}
return true;
}
catch(Exception ex)
{
log(lsm.getString("ExceptionMessage", new Object[] {ex.toString()}));
return false;
}
|
public void | execute()
CheckForMutuallyExclusiveAttribute();
if(webAppBaseDir==null)
{
if(srcDir==null)
throw new BuildException(lsm.getString("SourceDirectoryProviced"), location);
if(!srcDir.exists() || !srcDir.isDirectory())
throw new BuildException(lsm.getString("SourceDirectoryDoesNotExist",
new Object[] {srcDir.getAbsolutePath()}),
location);
}
else
{
if(!webAppBaseDir.exists() || !webAppBaseDir.isDirectory())
throw new BuildException(lsm.getString("WebAppDirectoryDoesNotExist",
new Object [] {webAppBaseDir.getAbsolutePath()}),
location);
}
if(destDir!=null)
{
if(!destDir.exists())
throw new BuildException(lsm.getString("DestinationDirectoryDoesNotExist",
new Object[] {destDir}));
if(!destDir.isDirectory())
throw new BuildException(lsm.getString("InvalidDestinationDirectory",
new Object[] {destDir}));
}
else
{
throw new BuildException(lsm.getString("DestinationDirectoryNoProvided"));
}
String args[] = getCommandString();
if(srcDir!=null)
log(lsm.getString("PreCompilation", new Object[] {String.valueOf(compileListLength),
destDir.getAbsolutePath()}));
if(!doCompilation(args))
throw new BuildException(lsm.getString("CompilationFailed"));
|
protected java.io.File | getAsinstalldir()Returns the asinstalldir attribute specify by in the build script.
If asinstalldir hasn't been explicitly set (using
the setAsinstalldir method), the value stored in the
sunone.home property will be returned.
if (asinstalldir == null) {
String home = getProject().getProperty("asinstall.dir");
if (home != null) {
asinstalldir = new File(home);
}
else {
home = getProject().getProperty("sunone.home");
if (home != null)
{
final String msg = lsm.getString("DeprecatedProperty", new Object[] {"sunone.home", "asinstall.dir"});
log(msg, Project.MSG_WARN);
asinstalldir = new File(home);
}
}
}
if (asinstalldir!=null) verifyAsinstalldir(asinstalldir);
return asinstalldir;
|
protected java.lang.String[] | getCommandString()
ArrayList commandList = new ArrayList();
commandList.add("-d");
commandList.add(destDir.getAbsolutePath());
if(packageName!=null && packageName.length()>0)
{
commandList.add("-p");
commandList.add(packageName);
}
if(verboseLevel!=null)
commandList.add("-v".concat(verboseLevel));
if(uriRoot!=null && uriRoot.exists())
{
commandList.add("-uriroot");
commandList.add(uriRoot.getAbsolutePath());
}
if(uriBase!=null && uriBase.exists())
{
commandList.add("-uribase");
commandList.add(uriBase.getAbsolutePath());
}
else if(uriRoot!=null && uriRoot.exists())
{
commandList.add("-uribase");
commandList.add(uriRoot.getAbsolutePath());
}
// START PWC 6386258
commandList.add("-dtds");
commandList.add("/dtds/");
commandList.add("-schemas");
commandList.add("/schemas/");
// END PWC 6386258
commandList.add("-die1");
if(webAppBaseDir!=null)
{
commandList.add("-webapp");
commandList.add(webAppBaseDir.getAbsolutePath());
}
else
{
DirectoryScanner ds = super.getDirectoryScanner(srcDir);
String files[] = ds.getIncludedFiles();
compileListLength = files.length;
for(int i=0;i<files.length;i++)
{
File tempFile = new File(srcDir,files[i]);
commandList.add(tempFile.getAbsolutePath());
}
}
String args[] = (String[])commandList.toArray(new String[commandList.size()]);
return args;
|
public java.io.File | getDestdir()
return destDir;
|
public boolean | getFailonerror()
return failOnError;
|
public java.lang.String | getPackage()
return packageName;
|
public java.io.File | getSrcdir()
return srcDir;
|
public java.io.File | getUribase()
if(uriBase!=null)
return uriBase;
return uriRoot;
|
public java.io.File | getUriroot()
return uriRoot;
|
public java.lang.String | getVerbose()
return verboseLevel;
|
public java.io.File | getWebapp()
return webAppBaseDir;
|
public void | setAsinstalldir(java.io.File asinstalldir)Specifies the installation directory for the Sun ONE Application Server
8. This may be used if the application server is installed on the
local machine.
this.asinstalldir = asinstalldir;
|
public void | setClasspath(org.apache.tools.ant.types.Path cp)
if(classPath == null)
classPath = cp;
else
classPath.append(cp);
|
public void | setClasspathref(org.apache.tools.ant.types.Reference ref)Class Path Reference
createClasspath().setRefid(ref);
|
public void | setDestdir(java.io.File dest)
destDir = dest;
|
public void | setFailonerror(boolean fail)
failOnError = fail;
|
public void | setPackage(java.lang.String name)
packageName = name;
|
public void | setSrcdir(java.io.File src)
srcDir = src;
|
public void | setSunonehome(java.io.File sunoneHome)
final String msg = lsm.getString("DeprecatedAttribute", new Object[] {"sunonehome",
"asinstalldir"});
log(msg, Project.MSG_WARN);
this.asinstalldir = sunoneHome;
|
public void | setUribase(java.io.File base)
uriBase = base;
|
public void | setUriroot(java.io.File root)
uriRoot = root;
|
public void | setVerbose(java.lang.String level)
verboseLevel = level;
|
public void | setWebapp(java.io.File baseDir)
webAppBaseDir = baseDir;
|
private boolean | verifyAsinstalldir(java.io.File home)verify if asinsatlldir attribute is valid.
asinstalldir must be a valid directory and must contain the config directory.
if (home!= null && home.isDirectory()) {
if ( new File(home, "config").isDirectory() ) {
return true;
}
}
throw new ClassNotFoundException("ClassCouldNotBeFound");
|