1 package org.sapia.taskman; 2 3 29 class TxTaskOutput implements TaskOutput { 30 private TaskOutput _out; 31 private TaskmanTransaction _tx; 32 private boolean _closed; 33 34 TxTaskOutput(TaskOutput out, TaskmanTransaction tx) { 35 _out = out; 36 _tx = tx; 37 } 38 39 42 public void setTaskName(String name) { 43 _out.setTaskName(name); 44 } 45 46 49 public void close() { 50 if(!_closed) { 51 _out.close(); 52 _closed = true; 53 } 54 } 55 56 59 public TaskOutput debug(Object message) { 60 if(!_closed) 61 _out.debug(message); 62 return this; 63 } 64 65 68 public TaskOutput info(Object message) { 69 if(!_closed) 70 _out.info(message); 71 return this; 72 } 73 74 77 public TaskOutput warning(Object message) { 78 if(!_closed) 79 _out.warning(message); 80 return this; 81 } 82 83 86 public TaskOutput error(Object message) { 87 _tx.notifyError(message, null); 88 if(!_closed) 89 _out.error(message); 90 return this; 91 } 92 93 97 public TaskOutput error(Object message, Throwable err) { 98 _tx.notifyError(message, err); 99 if(!_closed) 100 _out.error(message, err); 101 return this; 102 } 103 104 107 public TaskOutput error(Throwable err) { 108 _tx.notifyError(err, err); 109 if(!_closed) 110 _out.error(err); 111 return this; 112 } 113 114 public TaskOutput internalOutput() { 115 return _out; 116 } 117 } 118 | Popular Tags |