1 4 package com.tcsimulator.listener; 5 6 import com.tc.object.config.ConfigVisitor; 7 import com.tc.object.config.DSOClientConfigHelper; 8 import com.tc.object.config.TransparencyClassSpec; 9 import com.tc.simulator.app.ErrorContext; 10 import com.tc.simulator.listener.ResultsListener; 11 12 import java.util.ArrayList ; 13 import java.util.List ; 14 15 public final class ResultsListenerObject implements ResultsListener { 16 17 boolean startTimeout = false; 18 boolean executionTimeout = false; 19 private Object result; 20 private List errors; 21 22 public static void visitL1DSOConfig(ConfigVisitor visitor, DSOClientConfigHelper cfg) { 23 String classname = ResultsListenerObject.class.getName(); 24 TransparencyClassSpec spec = cfg.getOrCreateSpec(classname); 25 26 spec.addTransient("startTimeout"); 27 spec.addTransient("results"); 28 spec.addTransient("errors"); 29 } 30 31 public synchronized void notifyStartTimeout() { 32 startTimeout = true; 33 } 34 35 public synchronized void notifyExecutionTimeout() { 36 executionTimeout = true; 37 } 38 39 public synchronized void notifyError(ErrorContext ectxt) { 40 if (this.errors == null) this.errors = new ArrayList (); 41 this.errors.add(ectxt); 42 } 43 44 public synchronized void notifyResult(Object theResult) { 45 this.result = theResult; 46 } 47 48 public synchronized void addErrorsTo(List addTo) { 49 addTo.addAll(this.errors); 50 } 51 52 Object getResult() { 53 return this.result; 54 } 55 } | Popular Tags |