]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.runtime/src/org/argeo/slc/runtime/tasks/Echo.java
1 package org
.argeo
.slc
.runtime
.tasks
;
4 import java
.io
.IOException
;
5 import java
.nio
.file
.Path
;
7 import org
.apache
.commons
.io
.FileUtils
;
8 import org
.argeo
.api
.cms
.CmsLog
;
9 import org
.argeo
.slc
.SlcException
;
11 public class Echo
implements Runnable
{
12 private final static CmsLog defaultLog
= CmsLog
.getLog(Echo
.class);
13 private Path writeTo
= null;
16 private Object message
;
21 if (writeTo
!= null) {
23 File file
= writeTo
.toFile();
24 if (log().isDebugEnabled())
25 log().debug("Write to " + file
);
27 FileUtils
.writeStringToFile(file
, message
.toString());
28 } catch (IOException e
) {
29 throw new SlcException("Could not write to " + writeTo
, e
);
34 private CmsLog
log() {
35 return log
!= null ? log
: defaultLog
;
38 public void setMessage(Object message
) {
39 this.message
= message
;
42 public void setWriteTo(Path writeTo
) {
43 this.writeTo
= writeTo
;