1 4 package org.oddjob.scheduling; 5 6 import java.io.Serializable ; 7 8 import org.apache.log4j.Logger; 9 import org.oddjob.arooa.registry.ComponentRegistry; 10 import org.oddjob.framework.Exportable; 11 import org.oddjob.framework.Transportable; 12 13 18 abstract public class ScheduleInstruction 19 implements Transportable, Exportable, Serializable , Cloneable { 20 private static final long serialVersionUID = 20051128; 21 private static final Logger logger = Logger.getLogger(ScheduleInstruction.class); 22 23 24 private String name; 25 26 27 private String id; 28 29 35 private Object job; 36 37 public Transportable exportTransportable() { 38 if (job == null) { 39 return null; 40 } 41 if (! (job instanceof Exportable)) { 42 logger.debug("A remote server can not schedule a local job."); 43 return null; 44 } 45 ScheduleInstruction out; 46 try { 47 out = (ScheduleInstruction) clone(); 48 } catch (CloneNotSupportedException e) { 49 throw new IllegalStateException ("This should never happen " + e.getMessage()); 50 } 51 out.job = ((Exportable) job).exportTransportable(); 52 return out; 53 } 54 55 public Object importResolve(ComponentRegistry componentRegistry) { 56 job = ((Transportable) job).importResolve(componentRegistry); 57 return this; 58 } 59 60 public Object getJob() { 61 return job; 62 } 63 64 public void setJob(Object job) { 65 this.job = job; 66 } 67 68 public String getName() { 69 return name; 70 } 71 72 public void setName(String name) { 73 this.name = name; 74 } 75 76 public String getId() { 77 return id; 78 } 79 80 public void setId(String id) { 81 this.id = id; 82 } 83 } 84 | Popular Tags |