]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/tasks/Echo.java
Ignore files
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / tasks / Echo.java
index 07ec879aa2b15c6192118d2a5f8758664896493f..d47149b86a7a8e9d2ce2b7d236132c04c3530d60 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.argeo.slc.core.execution.tasks;
 
 import java.io.File;
@@ -14,7 +29,7 @@ public class Echo implements Runnable {
        private Resource writeTo = null;
 
        private Log log;
-       private String message;
+       private Object message;
 
        public void run() {
                log().info(message);
@@ -24,22 +39,19 @@ public class Echo implements Runnable {
                                File file = writeTo.getFile();
                                if (log().isDebugEnabled())
                                        log().debug("Write to " + file);
-                               FileUtils.writeStringToFile(file, message);
+                               if (message != null)
+                                       FileUtils.writeStringToFile(file, message.toString());
                        } catch (IOException e) {
                                throw new SlcException("Could not write to " + writeTo, e);
                        }
                }
        }
 
-       protected Log log() {
+       private Log log() {
                return log != null ? log : defaultLog;
        }
 
-       public void setLog(Log log) {
-               this.log = log;
-       }
-
-       public void setMessage(String message) {
+       public void setMessage(Object message) {
                this.message = message;
        }