Subversion Repositories XServices

Compare Revisions

Regard whitespace Rev 12 → Rev 11

/xservices/trunk/src/java/net/brutex/xservices/util/RunTask.java
13,15 → 13,17
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
package net.brutex.xservices.util;
 
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.brutex.xservices.types.AntProperty;
import net.brutex.xservices.types.ReturnCode;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.BuildLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
import org.apache.tools.ant.Task;
37,6 → 39,7
Project antproject;
Target anttarget;
Task anttask;
 
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
TimestampedLogger log = null;
71,28 → 74,19
antproject.addOrReplaceTarget(anttarget);
}
 
public ReturnCode postTask() {
int returnCode = 0;
Map<String, String> origMap = new HashMap<String, String>();
Map<String, String> newMap = null;
origMap.putAll(antproject.getProperties());
public Map<String, String> postTask()
throws BuildException
{
try {
antproject.executeTarget(anttarget.getName());
} catch (BuildException ex) {
} catch (Exception ex) {
new PrintStream(err).println(ex.getMessage());
returnCode = 1;
}
newMap = antproject.getProperties();
 
for (Map.Entry<String, String> e : origMap.entrySet()) {
newMap.remove(e.getKey());
}
 
Map<String, String> map = antproject.getProperties();
map.put("System.stdOut", out.toString());
map.put("System.stdErr", err.toString());
//anttask.execute();
return new ReturnCode(returnCode,
out.toString(),
err.toString(),
AntProperty.createAntPropertyList(newMap));
return map;
 
}
}