Activity Type: File
The use of this activity requires the jar: "jakarta-oro-2.0.7.jar" to be loaded on the server, for the handling of regular expressions.
Edit the contents of a file:
<!-- Insert "!!" at the first character position of the file -->
<fileWritingActivity name="insert">
<file>path/file.ext</file>
<locate>
<offset>1</offset>
</locate>
<insert text="!!"/>
<output name="out"/>
</fileWritingActivity>
<!-- Insert "!!" at the beginning of the file -->
<fileWritingActivity name="insert">
<file>path/file.ext</file>
<locate>
<offset>BOF</offset>
<perLine>true</perLine>
</locate>
<insert text="!!" />
<output name="out"/>
</fileWritingActivity>
<!-- Append "!!" to the end of the file --> <fileWritingActivity name="append"> <file>path/file.ext</file> <append text="!!"/> <output name="out"/> </fileWritingActivity>
<!-- Append "!!" to the end of each line -->
<fileWritingActivity name="append">
<file>path/file.ext</file>
<locate>
<perLine>true</perLine>
</locate>
<append text="!!"/>
<output name="out"/>
</fileWritingActivity>
<!-- Delete characters 1 to 4 inclusive from the file -->
<fileWritingActivity name="delete">
<file>path/file.ext</file>
<locate>
<offset>1</offset>
<length>3</length>
</locate>
<delete/>
<output name="out"/>
</fileWritingActivity>
<!-- Delete the first three occurrences of the string "zonk" -->
<fileWritingActivity name="delete">
<file>path/file.ext</file>
<locate>
<regexp>zonk</regexp>
<match>1-3</match>
</locate>
<delete/>
<output name="out"/>
</fileWritingActivity>
<!-- Replace the first, fourth, ninth, sixteenth occurrences -->
<!-- of the string "zonk" -->
<fileWritingActivity name="matchSequence">
<file>path/file.ext</file>
<locate>
<regexp>zonk</regexp>
<match>1:4:9:...</match>
<perLine>false</perLine>
</locate>
<replace text="!!" />
<output name="out"/>
</fileWritingActivity>
<!-- Replace the third to final characters of the file with -->
<!-- input from the "data" activity output stream. -->
<fileWritingActivity name="replaceOffsetPerLine">
<file>path/file.ext</file>
<locate>
<offset>3</offset>
<length>toEOF</length>
<perLine>false</perLine>
</locate>
<replace from="data"/>
<output name="out"/>
</fileWritingActivity>
Element fileWritingActivity:
This activity can be used by clients to potentially access any directory on your server below that exposed by the associated OGSA-DAI service.
OGSA-DAI/schema/ogsadai/xsd/activities/file_writing.xsd
OGSA-DAI/src/java/activities/uk/org/ogsadai/activity/files/FileWritingActivity.java
| Up: Activities | ||
| © International Business Machines Corporation, 2004. | © The University of Edinburgh, 2004. |