/xservices/trunk/src/java/net/brutex/xservices/ws/MiscService.java |
---|
39,4 → 39,8 |
@WebParam(name="to") String tolist, |
@WebParam(name="subject") String subject, |
@WebParam(name="message") String message); |
@WebMethod(operationName="sleep") |
public ReturnCode sleep(@WebParam(name="minutes") int minutes, |
@WebParam(name="seconds") int seconds); |
} |
/xservices/trunk/src/java/net/brutex/xservices/ws/MiscServiceImpl.java |
---|
22,8 → 22,8 |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.util.RunTask; |
import org.apache.tools.ant.taskdefs.HostInfo; |
import org.apache.tools.ant.taskdefs.Sleep; |
import org.apache.tools.ant.taskdefs.email.EmailTask; |
import org.apache.tools.ant.taskdefs.email.Mailer; |
/** |
* |
56,8 → 56,12 |
false); |
} |
public ReturnCode sleep(int minutes, int seconds) { |
return sleep(0, minutes, seconds, 0); |
} |
private ReturnCode antGetHostinfo(String hostname, String prefix) { |
HostInfo info = new HostInfo(); |
info.setTaskName("HostInfo"); |
107,4 → 111,15 |
return runner.postTask(); |
} |
private ReturnCode sleep(int hours, int minutes, int seconds, int milliseconds) { |
Sleep sleep = new Sleep(); |
sleep.setTaskName("Sleep"); |
RunTask runner = new RunTask(sleep); |
sleep.setHours(hours); |
sleep.setMinutes(minutes); |
sleep.setSeconds(seconds); |
sleep.setMilliseconds(milliseconds); |
return runner.postTask(); |
} |
} |
/xservices/trunk/src/java/net/brutex/xservices/util/RunTask.java |
---|
37,8 → 37,10 |
Project antproject; |
Target anttarget; |
Task anttask; |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
ByteArrayOutputStream err = new ByteArrayOutputStream(); |
ByteArrayOutputStream myout = new ByteArrayOutputStream(); |
ByteArrayOutputStream myerr = new ByteArrayOutputStream(); |
PrintStream out = new PrintStream(myout); |
PrintStream err = new PrintStream(myerr); |
TimestampedLogger log = null; |
public RunTask(Task anttask) { |
47,8 → 49,8 |
antproject.init(); |
antproject.setBasedir(System.getProperty("java.io.tmpdir")); |
log = new TimestampedLogger(); |
log.setOutputPrintStream(new PrintStream(out)); |
log.setErrorPrintStream(new PrintStream(err)); |
log.setOutputPrintStream(out); |
log.setErrorPrintStream(err); |
log.setMessageOutputLevel(Echo.EchoLevel.WARN.getLevel()); |
antproject.addBuildListener(log); |
79,7 → 81,7 |
try { |
antproject.executeTarget(anttarget.getName()); |
} catch (BuildException ex) { |
new PrintStream(err).println(ex.getMessage()); |
err.print(ex.getMessage()); |
returnCode = 1; |
} |
newMap = antproject.getProperties(); |
90,8 → 92,8 |
//anttask.execute(); |
return new ReturnCode(returnCode, |
out.toString(), |
err.toString(), |
myout.toString(), |
myerr.toString(), |
AntProperty.createAntPropertyList(newMap)); |
} |