/*
 * UnsetProperty.java
 *
 * Created on March 26, 2001, 10:41 AM
 */

package com.sns.tools.ant.taskdefs;

import org.apache.tools.ant.*;
import org.apache.tools.ant.taskdefs.*;
import java.util.Hashtable;

/**
 * Removes a property from the project's environment. This can be used to clear
 * flags set by certain targets.  
 *
 *Usage:
 *<pre>
 *  <target name="init" unless="init.done">
 *      <mkdir dir="directory"/>
 *      <property name="init.done" value="true"/>
 *  </target>
 *
 *  <target name="clean">
 *      <delete dir="directory"/>
 *      <unset-property property="init.done"/>
 *  </target>
 *
 *  <target name="deploy" depends="init">
 *      <echo message="deploying to directory ${directory}"/>
 *  </target>
 *
 *  <target name="make.admin" depends="init">
 *      <echo message="making admin tool to directory ${directory}"/>
 *  </target>
 *
 *  <target name="main" depends="deploy, clean, make.admin"/>
 *</pre>
 *
 * @author  <a href="mailto:John.D.Casey@mail.sprint.com">John Casey</a>
 * @version 1.0
 */
public class UnsetProperty extends Taskdef {
    private String property;
    
    /**
     * Sets the property name to remove from the environment.
     *
     *@param property The property to unset.
     */
    public void setProperty(String property){
        this.property = property;
    }
    
    /**
     * Executes the task.
     */
    public void execute(){
        Hashtable props = project.getProperties();
        props.remove(property);
    }
}
