]>
git.argeo.org Git - gpl/argeo-slc.git/blob - tasks/Echo.java
1 package org
.argeo
.slc
.core
.execution
.tasks
;
4 import java
.io
.IOException
;
6 import org
.apache
.commons
.io
.FileUtils
;
7 import org
.apache
.commons
.logging
.Log
;
8 import org
.apache
.commons
.logging
.LogFactory
;
9 import org
.argeo
.slc
.SlcException
;
10 import org
.springframework
.core
.io
.Resource
;
12 public class Echo
implements Runnable
{
13 private final static Log defaultLog
= LogFactory
.getLog(Echo
.class);
14 private Resource writeTo
= null;
17 private String message
;
22 if (writeTo
!= null) {
24 File file
= writeTo
.getFile();
25 if (log().isDebugEnabled())
26 log().debug("Write to " + file
);
27 FileUtils
.writeStringToFile(file
, message
);
28 } catch (IOException e
) {
29 throw new SlcException("Could not write to " + writeTo
, e
);
35 return log
!= null ? log
: defaultLog
;
38 public void setLog(Log log
) {
42 public void setMessage(String message
) {
43 this.message
= message
;
46 public void setWriteTo(Resource writeTo
) {
47 this.writeTo
= writeTo
;