1 4 package org.oddjob.jobs; 5 6 import org.oddjob.framework.SimpleJob; 7 import org.oddjob.state.JobState; 8 9 13 public class DummyStateJob extends SimpleJob { 14 private JobState desired; 15 16 protected int execute() throws Exception { 17 if (desired.equals(JobState.COMPLETE)) { 18 return 0; 19 } 20 if (desired.equals(JobState.NOT_COMPLETE)) { 21 return 1; 22 } 23 throw new Exception ("An exception."); 24 } 25 26 29 public String getDesired() { 30 return desired.toString(); 31 } 32 35 public void setDesired(String desired) { 36 this.desired = JobState.stateFor(desired); 37 if (this.desired == null) { 38 throw new IllegalArgumentException ("Invalid state " + desired); 39 } 40 } 41 } 42 | Popular Tags |