15.1 Configuration Contract Example

This is a simple configuration contract example from the DTK examples. The example shows a Disk Collection agent configuration including a directory field and a fileNamePrefix field.

<?xml version="1.0" encoding="UTF-8"?>
    <contract object-version='1.0'>
        <class-name>DiskCollectionConfig</class-name> 
        <package-name>com.domain.diskcollection</package-name>
        <storable-id>companyname.DiskCollectionConfig</storable-id> 
        <section id='Disk Collection'>
            <field id='directory'> 
                <title>Directory</title> 
                <name>Directory</name> 
                <description>The path to the source directory</description> 
                <type><object-type name='java.lang.String'/></type> 
                <default-value>""</default-value> 
                <validation> 
                    <validate minLength='1' message='Directory may not be empty'/> 
                </validation> 
            </field>
            <field id='fileNamePrefix'> 
                <title>Filename Prefix</title> 
                <name>Filename Prefix</name> 
                <description>The filename prefix</description> 
                <type><object-type name='java.lang.String'/></type> 
                <default-value>""</default-value> 
            </field>
         </section> 
</contract>