Comments? Feedback?

This wiki does not yet support public comments (a limitation of Google Sites), so we encourage you to post your comments either:

On Twitter by responding to @orbeon.

On our community mailing list: subscribe sending an email to ops-users-subscribe@ow2.org (content of subject/body doesn't matter), you'll get a response with the email to use to send your message to the community mailing list.

Recent site activity

Processors - File Processor

Introduction

The oxf:file processor allows you to perform operations related to files on disk.

NOTE: As of October 2009, it supports a limited number of functions. In the future, it may be enhanced to provide more actions such as renaming files, moving files, etc.

Type Name Purpose Mandatory
Input config Configuration Yes

Configuration

The config input contains a root config element containing a sequence of elements named by the operation to perform. For example,  the delete element deletes a file.

Deleting elements

The delete element allows you to delete a file on disk.

The delete element contains a file element which specifies the name of the file to delete, and an optional directory element containing a base directory against which the file name is resolved.

If the file exists and is writable, the processor attempts to delete it. Otherwise, no attempt is made. If an attempt is made and deleting fails, an exception is raised.

The following is an example of a pipeline running oxf:file in order to delete a file called SomeImpossibleFileName.jpg present under the C:/TEMP directory.

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf="http://www.orbeon.com/oxf/processors">
    <p:processor name="oxf:file">
        <p:input name="config">
            <config>
                <delete>
                    <file>SomeImpossibleFileName.jpg</file>
                    <directory>C:/TEMP</directory>
                </delete>
            </config>
        </p:input>
    </p:processor>
</p:config>

Copying files with scp

The scp element allows you to copy files through the scp (secure copy) protocol.

The scp element contains attributes controlling the connection, source, and destination of the copy. The attributes are the same as those supported by the scp ant task.

The following example shows how to copy a local file to a remote destination, and then copy it back under a different name:

<config>
    <scp trust="true"
         file="/my/local/file.txt"
         remoteTodir="john@example.org:"/>
    <scp trust="true"
         file="john@example.org:file.txt"
         localTofile="/my/local/new-file.txt"/>
</config>

Here is the list of ant attributes supported on the scp element (from the scp ant task):

Attribute Description Required
file The file to copy. This can be a local path or a remote path of the form user[:password]@host:/directory/path. :password can be omitted if you use key based authentication or specify the password attribute. The way remote path is recognized is whether it contains @ character or not. This will not work if your localPath contains @ character. Yes, unless a nested element is used.
localFile This is an alternative to the file attribute. But this must always point to a local file. The reason this was added was that when you give file attribute it is treated as remote if it contains @ character. This character can exist also in local paths. since Ant 1.6.2 Alternative to file attribute.
remoteFile This is an alternative to the file attribute. But this must always point to a remote file. since Ant 1.6.2 Alternative to file attribute.
todir The directory to copy to. This can be a local path or a remote path of the form user[:password]@host:/directory/path. :password can be omitted if you use key based authentication or specify the password attribute. The way remote path is recognized is whether it contains @ character or not. This will not work if your localPath contains @ character. Yes
localTodir This is an alternative to the todir attribute. But this must always point to a local directory. The reason this was added was that when you give todir attribute it is treated as remote if it contains @ character. This character can exist also in local paths. since Ant 1.6.2 Alternative to todir attribute.
localTofile Changes the file name to the given name while receiving it, only useful if receiving a single file. since Ant 1.6.2 Alternative to todir attribute.
remoteTodir This is an alternative to the todir attribute. But this must always point to a remote directory. since Ant 1.6.2 Alternative to todir attribute.
remoteTofile Changes the file name to the given name while sending it, only useful if sending a single file. since Ant 1.6.2 Alternative to todir attribute.
port The port to connect to on the remote host. No, defaults to 22.
trust This trusts all unknown hosts if set to yes/true.
Note If you set this to false (the default), the host you connect to must be listed in your knownhosts file, this also implies that the file exists.
No, defaults to No.
knownhosts This sets the known hosts file to use to validate the identity of the remote host. This must be a SSH2 format file. SSH1 format is not supported. No, defaults to ${user.home}/.ssh/known_hosts.
failonerror Whether to halt the build if the transfer fails. No; defaults to true.
password The password. Not if you are using key based authentication or the password has been given in the file or todir attribute.
keyfile Location of the file holding the private key. Yes, if you are using key based authentication.
passphrase Passphrase for your private key. Yes, if you are using key based authentication.
verbose Determines whether SCP outputs verbosely to the user. Currently this means outputting dots/stars showing the progress of a file transfer. since Ant 1.6.2 No; defaults to false.