Chapter 3. XML Types
Prev |  |

## Chapter 3. XML Types

This chapter bundles the documentation for common XML types used by XServices web service.

### AntProperty type

The AntProperty type defines a list of key/value pairs.

The defining Java class is `net.brutex.xservices.types.AntProperty` .

    <xs:complexType name="antProperty">
       <xs:sequence>
          <xs:element name="name" type="xs:string"/>
          <xs:element name="value" type="xs:string"/>
       </xs:sequence>
    </xs:complexType>

    <AntProperty>
        <name>key2</name>
        <value>value2</value>
    </AntProperty>

### FileResource type

The FileResource type defines an URI to a file with optional on-the-fly decompression.

The defining Java class is `net.brutex.xservices.types.FileResource` .

    <xs:complexType name="FileResourceType">
    	<xs:sequence>
        	<xs:element default="FILE" name="type" type="tns:type"/>
            <xs:element name="uri" type="xs:string"/>
       </xs:sequence>
    </xs:complexType>

Available types:

FILE: URI points to a local file resource. Examples: c:\temp\something.txt, c:/dir/another.file, /home/brian/file

URL: File from URL (http, https, ftp, ...). Example: http://brutex.net/file.pdf

GZIP and BZIP2: File from a local file system with on-the-fly decompression.

    <resource>
    	<type>FILE</type>
        <uri>c:\temp\xservices.war</uri>
    </resource>

### HostConnection type

The HostConnection type identifies a server resource and login credentials.

The defining Java class is `net.brutex.xservices.types.HostConnection` .

#### Schema definition

    <xs:complexType name="connection">
       <xs:sequence>
          <xs:element name="hostname" type="xs:string"/>
          <xs:element name="port" type="xs:int"/>
          <xs:element minOccurs="0" name="user" type="xs:string"/>
          <xs:element minOccurs="0" name="password" type="xs:string"/>
       </xs:sequence>
    </xs:complexType>

#### Example XML

    <host>
       <hostname>server.brutex.net</hostname>
       <port>512</port> <!-- default rExec port -->
       <user>brian</user>
       <!--Optional:-->
       <password>somepass</password>
    </host>

### PatternElement type

The PatternElement type defines single string pattern for file/ directory matching.

The defining Java class is `net.brutex.xservices.types.PatternElement` .

These patterns look exactly like those used in Apache Ant Patterns. The '*' matches zero or more characters and the '?' will match a single character. Both symbols can be combined in one pattern. The '**' symbol can be used to match any directory deepth.

Some example patterns:

`**/mydir/**`

Match all file that are located in any directory that has "mydir" string in its pathname. Also applies to files with "mydir" in their name.

`/mydir/`

The parser will automatically append an '**' symbol, thus the resulting pattern is `/mydir/**`. All files below the "/mydir/" directory (including its sub-directories will be chosen.

| Note
The pattern is OS independent. You should always use "/" as path separator, even on windows based systems.

#### Schema definition

    <xs:simpleType name="patternElement">
        <xs:restriction base="xs:string"/>
    </xs:simpleType>

#### Example XML

    <PatternElement>**/*</PatternElement>

### PatternSetType type

The PatternSetType exposes various filters/ selectors for the selection of resources (files).

The defining Java class is `net.brutex.xservices.types.PatternSetType` .

#### Schema definition

    <xs:complexType name="patternSetType">
        <xs:sequence>
            <xs:element default="**/*" maxOccurs="unbounded" minOccurs="0" name="include" type="tns:patternElement"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="exclude" type="tns:patternElement"/>
            <xs:element minOccurs="0" name="selector" nillable="true" type="tns:selectorType"/>
        </xs:sequence>
    </xs:complexType>

#### Example XML

                tbd.

### ReturnCode type

The ReturnCode type is used as the generic answer type for most of the BruteXservices operations.

The defining Java class is `net.brutex.xservices.types.ReturnCode` .

#### Schema definition

    <xs:complexType name="ReturnCodeType">
        <xs:sequence>
            <xs:element name="returnCode" type="xs:int"/>
            <xs:element minOccurs="0" name="stdOut" type="xs:string"/>
            <xs:element minOccurs="0" name="stdErr" type="xs:string"/>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="propertyList" nillable="true" type="tns:antProperty"/>
        </xs:sequence>
    </xs:complexType>

#### Example XML

    		<ReturnCode
    		xmlns:ns2="http://ws.xservices.brutex.net">
    		<returnCode>0</returnCode>
    		<stdOut/>
    		<stdErr/>
    		<propertyList>

    			See
    			tns:antProperty
    			for details about the <propertyList> elements.

    		<name>key1</name>
    		<value>value1</value>
    		</propertyList>
    		<propertyList>
    		<name>key2</name>
    		<value>value2</value>
    		</propertyList>
    		</ReturnCode>

### SelectorType type

The SelectorType exposes various selectors for the selection of resources (files).

The defining Java class is `net.brutex.xservices.types.SelectorType`.

#### Schema definition

             <xs:complexType abstract="true" name="selectorType">
                <xs:sequence>
                   <xs:element maxOccurs="unbounded" minOccurs="0" name="contains" nillable="true" type="tns:containsSelectorType"/>
                </xs:sequence>
             </xs:complexType>

#### Example XML

                tbd.

Prev |  |
MiscServices | Home |