LogTask.java |
1 /* 2 * Copyright 2005 Paul Hinds 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package org.tp23.antinstaller.antmod.taskdefs; 17 18import org.apache.tools.ant.BuildException; 19import org.apache.tools.ant.Task; 20import org.tp23.antinstaller.InstallerContext; 21import org.tp23.antinstaller.antmod.RuntimeLauncher; 22/** 23 * usage: 24 * <antinstaller-log message="log message"/> 25 * @author teknopaul 26 * 27 */ 28public class LogTask extends Task { 29 30 private String message; 31 /** 32 * Ant Tasks must have a noargs constructor 33 */ 34 public LogTask(){ 35 } 36 37 /** 38 * the "main" method 39 */ 40 public void execute() throws BuildException { 41 InstallerContext ctx = (InstallerContext)getProject().getReference(RuntimeLauncher.CONTEXT_REFERENCE); 42 ctx.log(message); 43 } 44 45 public String getMessage() { 46 return message; 47 } 48 49 public void setMessage(String message) { 50 this.message = message; 51 } 52 53 54} 55