Write the following Task object class.
Note: Although undo()
methods are included in the worker object API, they are reserved for future use.
package atg.cim.task; import atg.cim.worker.ITask; import atg.cim.worker.IProgressMonitor; import atg.cim.worker.TaskException; /* This is simply a dummy demo task and prints * Hello World! at the console. */ public class HelloWorldTask implements ITask { String mMessage; /** * Simply returns true */ public boolean canExecute() { return true; } /** * Returns false, as sending output to console * can not be undone * @return false */ public boolean canUndo() { return false; } /** * * Prints "Hello World!" at console. * * @param pProgressMonitor * @exception TaskException */ public void execute(IProgressMonitor pProgressMonitor) throws TaskException { try { System.out.println("Hello World!"); mMessage = " Executed HelloWorldTask"; } catch(Exception exp) { mMessage = "Error executing HelloWorldTask"; throw new TaskException("Error ", exp); } }