<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://www.mulesource.org/schema/mule/ftp/2.0"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:mule="http://www.mulesource.org/schema/mule/core/2.0"
            xmlns:file="http://www.mulesource.org/schema/mule/file/2.0"
            targetNamespace="http://www.mulesource.org/schema/mule/ftp/2.0"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified">

    <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
    <xsd:import namespace="http://www.mulesource.org/schema/mule/file/2.0"
                schemaLocation="http://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd"/>
    <xsd:import namespace="http://www.mulesource.org/schema/mule/core/2.0" 
                schemaLocation="http://www.mulesource.org/schema/mule/core/2.0/mule.xsd" />

    <xsd:element name="connector" type="ftpConnectorType" substitutionGroup="mule:abstract-connector"/>
    <xsd:complexType name="ftpConnectorType">
        <xsd:complexContent>
            <xsd:extension base="mule:connectorType">
                <xsd:sequence minOccurs="0" maxOccurs="1">
                    <xsd:element ref="abstract-filenameParser"/>
                </xsd:sequence>
                <xsd:attributeGroup ref="inboundAttributes"/>
                <xsd:attributeGroup ref="outboundAttributes"/>
                <xsd:attributeGroup ref="commonAttributes"/>
                <xsd:attribute name="validateConnections" type="mule:substitutableBoolean">
                    <xsd:annotation>
                        <xsd:documentation>
                            Validate connection (via NOOP) before use.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
                <xsd:attribute name="connectionFactoryClass" type="mule:substitutableClass">
                    <xsd:annotation>
                        <xsd:documentation>
                            A class that extends FtpConnectionFactory.
                        </xsd:documentation>
                    </xsd:annotation>
                </xsd:attribute>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="inbound-endpoint" type="inboundEndpointType" substitutionGroup="mule:abstract-inbound-endpoint"/>
    <xsd:complexType name="inboundEndpointType">
        <xsd:complexContent>
            <xsd:extension base="mule:inboundEndpointType">
                <xsd:attributeGroup ref="addressAttributes"/>
                <xsd:attributeGroup ref="commonAttributes"/>
                <xsd:attributeGroup ref="inboundAttributes"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="outbound-endpoint" type="outboundEndpointType" substitutionGroup="mule:abstract-outbound-endpoint"/>
    <xsd:complexType name="outboundEndpointType">
        <xsd:complexContent>
            <xsd:extension base="mule:outboundEndpointType">
                <xsd:attributeGroup ref="addressAttributes"/>
                <xsd:attributeGroup ref="commonAttributes"/>
                <xsd:attributeGroup ref="outboundAttributes"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:element name="endpoint" type="globalEndpointType" substitutionGroup="mule:abstract-global-endpoint"/>
    <xsd:complexType name="globalEndpointType">
        <xsd:complexContent>
            <xsd:extension base="mule:globalEndpointType">
                <xsd:attributeGroup ref="addressAttributes"/>
                <xsd:attributeGroup ref="commonAttributes"/>
                <xsd:attributeGroup ref="inboundAttributes"/>
                <xsd:attributeGroup ref="outboundAttributes"/>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:attributeGroup name="inboundAttributes">
        <xsd:attribute name="pollingFrequency" type="mule:substitutableLong">
            <xsd:annotation>
                <xsd:documentation>
                    The frequency in milliseconds that the read directory should be checked.
                    Note that the read directory is specified by the endpoint of the listening component.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="outboundAttributes">
        <xsd:attribute name="outputPattern" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation>
                    The pattern to use when writing a file to disk.
                    This can use the patterns supported by the filename-parser configured for this connector                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="commonAttributes">
        <xsd:attribute name="binary" type="mule:substitutableBoolean">
            <xsd:annotation>
                <xsd:documentation>
                    Select/disable binary file transfer type.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="passive" type="mule:substitutableBoolean">
            <xsd:annotation>
                <xsd:documentation>
                    Select/disable passive protocol (more likely to work through firewalls).
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>

    <xsd:attributeGroup name="addressAttributes">
        <xsd:attribute name="path" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation>
                    A file location.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="user" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation>
                    A username.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="password" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation>
                    A password.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="host" type="xsd:string">
            <xsd:annotation>
                <xsd:documentation>
                    An IP address (eg www.mulesource.com, localhost, 127.0.0.1).
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
        <xsd:attribute name="port" type="mule:substitutablePortNumber">
            <xsd:annotation>
                <xsd:documentation>
                    A port number.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:attributeGroup>
    
    <xsd:element name="abstract-filenameParser" abstract="true" type="file:filenameParserType"/>
    
    <xsd:element name="legacy-filename-parser" type="file:legacyFilenameParserType" 
                 substitutionGroup="abstract-filenameParser"/>
    <xsd:element name="expression-filename-parser" type="file:expressionFilenameParserType"
                 substitutionGroup="abstract-filenameParser"/>
    <xsd:element name="custom-filename-parser" type="file:customFilenameParserType"
                 substitutionGroup="abstract-filenameParser"/>

</xsd:schema>
