| Method from org.apache.openjpa.lib.ant.AbstractTask Detail: |
public void addFileset(FileSet set) {
fileSets.add(set);
}
|
protected void assertFiles(String[] files) {
if (files.length == 0)
throw new BuildException(_loc.get("no-filesets").getMessage());
}
Helper method to throw a standard exception if the task is not given
any files to execute on. Implementations might call this method as
the first step in #executeOn to validate that they are given
files to work on. |
public Path createClasspath() {
if (classpath == null)
classpath = new Path(project);
return classpath.createPath();
}
|
public Object createConfig() {
return getConfiguration();
}
|
public void execute() throws BuildException {
// if the user didn't supply a conf file, load the default
if (_conf == null)
_conf = newConfiguration();
if (_conf.getPropertiesResource() == null) {
ConfigurationProvider cp = ProductDerivations.loadDefaults
((ClassLoader) AccessController.doPrivileged(
J2DoPrivHelper.getClassLoaderAction(_conf.getClass())));
if (cp != null)
cp.setInto(_conf);
}
String[] files = getFiles();
try {
executeOn(files);
} catch (Throwable e) {
e.printStackTrace();
if (haltOnError)
throw new BuildException(e);
} finally {
_conf.close();
_conf = null;
}
}
|
abstract protected void executeOn(String[] files) throws Exception
Perform the task action on the given files. |
protected ClassLoader getClassLoader() {
if (_cl != null)
return _cl;
if (classpath != null)
_cl = new AntClassLoader(project, classpath, useParent);
else
_cl = new AntClassLoader(project.getCoreLoader(), project,
new Path(project), useParent);
_cl.setIsolated(isolate);
return _cl;
}
Return the classloader to use. |
public Configuration getConfiguration() {
if (_conf == null)
_conf = newConfiguration();
return _conf;
}
|
abstract protected ConfigurationImpl newConfiguration()
Implement this method to return a configuration object for the
product in use. |
public void setClasspath(Path classPath) {
createClasspath().append(classPath);
}
|
public void setHaltOnError(boolean haltOnError) {
this.haltOnError = haltOnError;
}
Set whether we want the task to ignore all errors. |
public void setIsolate(boolean isolate) {
this.isolate = isolate;
}
Whether we want the ClassLoader to be isolated from
all other ClassLoaders |
public void setUseParentClassloader(boolean useParent) {
this.useParent = useParent;
}
Whether we want to delegate to the parent ClassLoader
for resolveing classes. This may "taint" classes. |