import java.util.Date; import java.util.EventListener; import java.util.EventObject; import java.util.Properties; interface BatchSubmission { BatchSubmitter create(String farm); } interface BatchSubmitter { void setCommand(String command); void setArgument(String[] args); void setTimeLimit(int time); void setPriority(int priority); void setStartAt(Date when); void setEnvironment(Properties props); void addFile(String name, String file); void setArchitecture(String architecture); BatchJob submit() throws BatchSubmissionException; } interface BatchJob { Long getID(); void cancel() throws UnsupportedOperationException; void suspend() throws UnsupportedOperationException; void resume() throws UnsupportedOperationException; void addBatchListener(BatchListener l); void removeBatchListener(BatchListener l); long getCPUTime(); long getMemoryUsed(); // Waiting, Running, Finished, Suspended, Aborted int getStatus(); } interface BatchListener extends EventListener { void jobSubmitted(BatchEvent e); void jobStarted(BatchEvent e); void jobStopped(BatchEndEvent e); void jobAborted(BatchEvent e); } class BatchEvent extends EventObject { BatchEvent(BatchJob source) { super(source); } BatchJob getJob() { return (BatchJob) getSource(); } } class BatchEndEvent extends BatchEvent { long getElapsedTime(); long getCPUTime(); long getMemoryUsed(); int getReturnCode(); Properties getMetaData(); String getLogFile(); } class BatchSubmissionException extends Exception { BatchSubmissionException(String message) { super(message); } }