You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

propertyfile.html 3.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <head>
  2. <meta http-equiv="Content-Language" content="en-us">
  3. <title>Ant PropertyFile Task</title>
  4. </head>
  5. <body>
  6. <h1>Ant PropertyFile Task User Manual</h1>
  7. <p>by</p>
  8. <!-- Names are in alphabetical order, on last name -->
  9. <ul>
  10. <li>Jeremy Mawson (<a href="mailto:jem@loftinspace.com.au">jem@loftinspace.com/au</a>)</li>
  11. </ul>
  12. <p>Version 1.0 - 2000/11/02</p>
  13. <hr>
  14. <h2>Table of Contents</h2>
  15. <ul>
  16. <li><a href="#introduction">Introduction</a></li>
  17. <li><a href="#proptask">PropertyFile Task</a></li>
  18. <li><a href="#entrytask">Entry Task</a></li>
  19. </ul>
  20. <hr>
  21. <h2><a name="introduction">Introduction</a></h2>
  22. <p>Ant provides an optional task for editing property files. Thes is very useful
  23. when wanting to make unattended modifications to configuration files for application
  24. servers and applications. Currently, the task maintains a working property file with
  25. the ability to add properties or make changes to existing ones. However, any comments
  26. are lost. Work is being done to make this task a bit more "human friendly".
  27. <hr>
  28. <h2><a name="tasks">PropertyFile Task</a></h2>
  29. <h3>Parameters</h3>
  30. <table border="1" cellpadding="2" cellspacing="0">
  31. <tr>
  32. <td width="12%" valign="top"><b>Attribute</b></td>
  33. <td width="78%" valign="top"><b>Description</b></td>
  34. <td width="10%" valign="top"><b>Required</b></td>
  35. </tr>
  36. <tr>
  37. <td width="12%" valign="top">file</td>
  38. <td width="78%" valign="top">Location of the property file to be edited</td>
  39. <td width="10%" valign="top">Yes</td>
  40. </tr>
  41. <tr>
  42. <td width="12%" valign="top">comment</td>
  43. <td width="78%" valign="top">Header for the file itself</td>
  44. <td width="10%" valign="top">no</td>
  45. </tr>
  46. </table>
  47. <h3>Parameters specified as nested elements</h3>
  48. <h4>Entry</h4>
  49. <p>Use nested <code>&lt;entry&gt;</code>
  50. elements to specify actual modifcations to the property file itself
  51. <table border="1" cellpadding="2" cellspacing="0">
  52. <tr>
  53. <td valign="top"><b>Attribute</b></td>
  54. <td valign="top"><b>Description</b></td>
  55. <td align="center" valign="top"><b>Required</b></td>
  56. </tr>
  57. <tr>
  58. <td valign="top">key</td>
  59. <td valign="top">Name of the property name/value pair</td>
  60. <td valign="top" align="center">Yes</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">value</td>
  64. <td valign="top">Value to set for the key the property name/value pair</td>
  65. <td valign="top" align="center">Yes</td>
  66. </tr>
  67. <tr>
  68. <td valign="top">type</td>
  69. <td valign="top">Manipulate the value as type: int, date</td>
  70. <td valign="top" align="center">No, but must be used if opertion attribute used</td>
  71. </tr>
  72. <tr>
  73. <td valign="top">operation</td>
  74. <td valign="top">If type is date, this cane be "now" or "never". If the type is int, only "-" and "+" may be used.</td>
  75. <td valign="top" align="center">No</td>
  76. </tr>
  77. </table>
  78. <h3>Examples</h3>
  79. <p>The following changes the my.properties file. Assume my.properties look like:<br>
  80. <p>
  81. <ul># A comment<br>
  82. akey=novalue<br></ul>
  83. </p>
  84. After running, the file would now look like
  85. <p>
  86. <ul>#Thu Nov 02 23:41:47 EST 2000<br>
  87. akey=avalue<br>
  88. adate=2000/11/02 23\:41<br>
  89. anint=1<br></ul>
  90. </p>
  91. 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.
  92. </p>
  93. <pre><blockquote>&lt;propertyfile
  94. file="my.properties"
  95. comment"My properties" &gt;
  96. &lt;entry key="akey" value="avalue" /&gt;
  97. &lt;entry key="adate" type="date" operation="now"/&gt;
  98. &lt;entry key="anint" type="int" operation="+"/&gt;
  99. &lt;/propertyfile&gt;
  100. </pre></blockquote>
  101. </body>
  102. </html>