Submitted by: Glenn McAllister <glennm@ca.ibm.com> git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267991 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -961,8 +961,9 @@ listed as <code>#IMPLIED</code>.</p> | |||||
| <h3>Description</h3> | <h3>Description</h3> | ||||
| <p>Sets a property if a resource is available at runtime. This resource can be a | <p>Sets a property if a resource is available at runtime. This resource can be a | ||||
| file resource, a class in classpath or a JVM system resource.</p> | file resource, a class in classpath or a JVM system resource.</p> | ||||
| <p>The value part of the properties being set is <i>true</i> if the resource is | |||||
| present, otherwise, the property is not set.</p> | |||||
| <p>If the resource is present, the property value is set to true by | |||||
| default, otherwise the property is not set. You can set the value to | |||||
| something specific by using the value attribute.</p> | |||||
| <p>Normally, this task is used to set properties that are useful to avoid target | <p>Normally, this task is used to set properties that are useful to avoid target | ||||
| execution depending on system parameters.</p> | execution depending on system parameters.</p> | ||||
| <h3>Parameters</h3> | <h3>Parameters</h3> | ||||
| @@ -977,6 +978,11 @@ execution depending on system parameters.</p> | |||||
| <td valign="top">the name of the property to set.</td> | <td valign="top">the name of the property to set.</td> | ||||
| <td valign="top" align="center">Yes</td> | <td valign="top" align="center">Yes</td> | ||||
| </tr> | </tr> | ||||
| <tr> | |||||
| <td valign="top">value</td> | |||||
| <td valign="top">the value to set the property to. Defaults to "true".</td> | |||||
| <td valign="top" align="center">No</td> | |||||
| </tr> | |||||
| <tr> | <tr> | ||||
| <td valign="top">classname</td> | <td valign="top">classname</td> | ||||
| <td valign="top">the class to look for in classpath.</td> | <td valign="top">the class to look for in classpath.</td> | ||||
| @@ -70,16 +70,14 @@ public class Available extends Task { | |||||
| private String classname; | private String classname; | ||||
| private File file; | private File file; | ||||
| private String resource; | private String resource; | ||||
| private String value = "true"; | |||||
| public void setProperty(String property) { | public void setProperty(String property) { | ||||
| this.property = property; | this.property = property; | ||||
| } | } | ||||
| public void XsetClass(String classname) { | |||||
| log("The class attribute is deprecated. " + | |||||
| "Please use the classname attribute.", | |||||
| Project.MSG_WARN); | |||||
| this.classname = classname; | |||||
| public void setValue(String value) { | |||||
| this.value = value; | |||||
| } | } | ||||
| public void setClassname(String classname) { | public void setClassname(String classname) { | ||||
| @@ -99,7 +97,7 @@ public class Available extends Task { | |||||
| if ((file != null) && !checkFile(file)) return; | if ((file != null) && !checkFile(file)) return; | ||||
| if ((resource != null) && !checkResource(resource)) return; | if ((resource != null) && !checkResource(resource)) return; | ||||
| this.project.setProperty(property, "true"); | |||||
| this.project.setProperty(property, value); | |||||
| } | } | ||||
| private boolean checkFile(File file) { | private boolean checkFile(File file) { | ||||
| @@ -65,6 +65,8 @@ import java.util.*; | |||||
| * setKeys method to understand how to do the substitutions. | * setKeys method to understand how to do the substitutions. | ||||
| * | * | ||||
| * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a> | * @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a> | ||||
| * | |||||
| * @deprecated KeySubst is deprecated. Use Filter + CopyDir instead. | |||||
| */ | */ | ||||
| public class KeySubst extends Task { | public class KeySubst extends Task { | ||||
| private File source = null; | private File source = null; | ||||
| @@ -200,4 +202,4 @@ public class KeySubst extends Task { | |||||
| finalString.append (origString.substring(i)); | finalString.append (origString.substring(i)); | ||||
| return finalString.toString(); | return finalString.toString(); | ||||
| } | } | ||||
| } | |||||
| } | |||||