From 08eef4e8a6bbe820b1622250bdc08de9b0d0cb15 Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Mon, 6 Nov 2000 14:10:59 +0000
Subject: [PATCH] Changes to
1) documentation.
2) default to String type if type is omitted.
3) use Properties.store (or .save) to write the property file.
Submitted by: Jesse Tilly
I've modified Jesse's original patch to make it compile on JDK 1.1.
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268153 13f79535-47bb-0310-9956-ffa450edef68
---
docs/index.html | 1 +
docs/propertyfile.html | 112 ++++++++++
.../ant/taskdefs/optional/PropertyFile.java | 200 ++++++++++--------
3 files changed, 226 insertions(+), 87 deletions(-)
create mode 100644 docs/propertyfile.html
diff --git a/docs/index.html b/docs/index.html
index 0f3f6ca90..214d5c136 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -4538,6 +4538,7 @@ it had been located at htdocs/manual/ChangeLog.txt
.
Native2Ascii
NetRexxC
Perforce
+ PropertyFile
RenameExtensions
Script
VssGet
diff --git a/docs/propertyfile.html b/docs/propertyfile.html
new file mode 100644
index 000000000..75cd861a9
--- /dev/null
+++ b/docs/propertyfile.html
@@ -0,0 +1,112 @@
+
+
+Ant PropertyFile Task
+
+
+
+
+
+Ant PropertyFile Task User Manual
+by
+
+
+
+Version 1.0 - 2000/11/02
+
+Table of Contents
+
+
+
+
+Ant provides an optional task for editing property files. Thes is very useful
+when wanting to make unattended modifications to configuration files for application
+servers and applications. Currently, the task maintains a working property file with
+the ability to add properties or make changes to existing ones. However, any comments
+are lost. Work is being done to make this task a bit more "human friendly".
+
+
+
+Parameters
+
+
+ Attribute |
+ Description |
+ Required |
+
+
+ file |
+ Location of the property file to be edited |
+ Yes |
+
+
+ comment |
+ Header for the file itself |
+ no |
+
+
+
+Parameters specified as nested elements
+Entry
+Use nested <entry>
+elements to specify actual modifcations to the property file itself
+
+
+ Attribute |
+ Description |
+ Required |
+
+
+ key |
+ Name of the property name/value pair |
+ Yes |
+
+
+ value |
+ Value to set for the key the property name/value pair |
+ Yes |
+
+
+ type |
+ Manipulate the value as type: int, date |
+ No, but must be used if opertion attribute used |
+
+
+ operation |
+ If type is date, this cane be "now" or "never". If the type is int, only "-" and "+" may be used. |
+ No |
+
+
+Examples
+
+The following changes the my.properties file. Assume my.properties look like:
+
+
# A comment
+akey=novalue
+
+After running, the file would now look like
+
+
#Thu Nov 02 23:41:47 EST 2000
+akey=avalue
+adate=2000/11/02 23\:41
+anint=1
+
+The slashes conform to the expectations of the Properties class. The file will be stored in a manner so that each character is examined and escaped if necessary. Note that the original comment is now lost. Please keep this in mind when running this task against heavily commented properties files. It may be best to have a commented version in the source tree, copy it to a deployment area, and then run the modifications on the copy. Future versions of PropertyFile will hopefully eliminate this shortcoming.
+
+
+<propertyfile
+ file="my.properties"
+ comment"My properties" >
+ <entry key="akey" value="avalue" />
+ <entry key="adate" type="date" operation="now"/>
+ <entry key="anint" type="int" operation="+"/>
+</propertyfile>
+
+
+
+