00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 package de.picana.ant;
00014
00015 import org.apache.tools.ant.BuildException;
00016 import org.apache.tools.ant.Task;
00017 import de.picana.control.*;
00018 import de.picana.logging.*;
00019 import java.util.*;
00020
00021
00031 public class PicanaTask extends org.apache.tools.ant.Task {
00032
00033 private String taskname;
00034 private de.picana.control.ParameterSet pset;
00035
00037 public PicanaTask() {
00038 pset = new de.picana.control.ParameterSet();
00039 }
00040
00041 public void setTask(String taskname) {
00042 this.taskname = taskname;
00043 this.setTaskName(taskname);
00044 this.pset.setName(this.taskname);
00045 }
00046
00047 public void addConfiguredParameter(de.picana.ant.Parameter param) {
00048 this.pset.setParameter(param.getName(), param.getValue());
00049 }
00050
00051 public void addConfiguredParamset(de.picana.ant.ParameterSet pset) {
00052 this.pset.setParameter(pset.getName(), pset.getValue());
00053 }
00054
00055 public void execute() throws BuildException {
00056 try {
00057 de.picana.control.Task task = (de.picana.control.Task)
00058 Class.forName("de.picana." + taskname).newInstance();
00059 AntLogger logger = new AntLogger(this);
00060 logger.setLogging(true);
00061 task.init(pset, logger);
00062 try {
00063 task.start();
00064 } catch (TaskException te) {
00065 logger.error("PicanaTask", te.toString());
00066 throw new BuildException(te.toString());
00067 }
00068 } catch (Exception e) {
00069
00070 throw new BuildException(e.toString());
00071 }
00072 }
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 }