<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration/xmpp"
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"
			xmlns:tool="http://www.springframework.org/schema/tool"
			xmlns:integration="http://www.springframework.org/schema/integration"
			targetNamespace="http://www.springframework.org/schema/integration/xmpp"
			elementFormDefault="qualified">

	<xsd:import namespace="http://www.springframework.org/schema/beans"/>
	<xsd:import namespace="http://www.springframework.org/schema/tool"/>
	<xsd:import namespace="http://www.springframework.org/schema/integration"
				schemaLocation="https://www.springframework.org/schema/integration/spring-integration.xsd"/>

	<xsd:element name="xmpp-connection">
		<xsd:annotation>
			<xsd:documentation>
				Configures an XMPP connection ('org.springframework.integration.xmpp.config.XmppConnectionFactoryBean')
				that can in turn be referenced by other components
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:attribute name="id" type="xsd:string" default="xmppConnection"/>
			<xsd:attribute name="user" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>
						The user name (e.g., someuser@gmail.com) that will be used by this connection object
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="password" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>
						The user's password
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="host" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>
						The host name to connect TO
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="service-name" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>
						The XMPP service name for this connection
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="resource" type="xsd:string">
				<xsd:annotation>
					<xsd:documentation>
						The resource field specifies the XMPP resource you are using. The use of unique resources allows
						you to connect to your XMPP server from multiple locations simultaneously. Resources might
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="port" type="xsd:string" default="5222">
				<xsd:annotation>
					<xsd:documentation>
						The port on which the host is running
					</xsd:documentation>
				</xsd:annotation>
			</xsd:attribute>
			<xsd:attribute name="subscription-mode" default="accept_all">
				<xsd:annotation>
					<xsd:documentation>
						The subscription mode for the XMPP connection.
						Dictates the policy for handling inbound messages from entries not already on the roster.
						Values can be "accept_all", "manual", "reject_all" or empty assuming 'null'
						to disable the Roster subscription altogether.
					</xsd:documentation>
				</xsd:annotation>
				<xsd:simpleType>
					<xsd:union memberTypes="subscriptionModeEnumeration xsd:string"/>
				</xsd:simpleType>
			</xsd:attribute>
			<xsd:attributeGroup ref="integration:smartLifeCycleAttributeGroup">
				<xsd:annotation>
					<xsd:documentation><![CDATA[
                     Note, the default 'phase' value for XmppConnectionFactoryBean is Integer.MIN_VALUE
				]]></xsd:documentation>
				</xsd:annotation>
			</xsd:attributeGroup>
		</xsd:complexType>
	</xsd:element>

	<xsd:simpleType name="subscriptionModeEnumeration">
		<xsd:restriction base="xsd:NMTOKEN">
			<xsd:enumeration value="accept_all"/>
			<xsd:enumeration value="manual"/>
			<xsd:enumeration value="reject_all"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:element name="inbound-channel-adapter">
		<xsd:annotation>
			<xsd:documentation>
				Configures a Message Producing Endpoint for the
				'org.springframework.integration.xmpp.inbound.ChatMessageListeningEndpoint' that
				that will receive chat messages sent to a given account and then forward those messages
				to a MessageChannel.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:complexContent>
				<xsd:extension base="xmppInboundAdapterType">
					<xsd:attribute name="payload-expression">
						<xsd:annotation>
							<xsd:documentation>
								A SpEL expression to evaluate a 'payload' with the incoming
								'org.jivesoftware.smack.packet.Message' as root object.
								It useful in case of custom (XEP) XMPP interactions, e.g. GCM.
								By default, a Message 'body' is used as 'payload'.
								The '#extension' SpEL variable is registered in the evaluation context
								if one and only one extension is present in the Message.
								Replaces 'extract-payload' attribute since 4.3.
							</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
					<xsd:attribute name="stanza-filter">
						<xsd:annotation>
							<xsd:appinfo>
								<tool:annotation kind="ref">
									<tool:expected-type type="org.jivesoftware.smack.filter.StanzaFilter"/>
								</tool:annotation>
							</xsd:appinfo>
							<xsd:documentation>
								Reference to an XMPP 'org.jivesoftware.smack.filter.StanzaFilter' bean.
								See 'XMPPConnection.addAsyncStanzaListener(StanzaListener, StanzaFilter)' JavaDocs.
							</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
				</xsd:extension>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="outbound-channel-adapter">
		<xsd:annotation>
			<xsd:documentation>
				Configures a Consumer Endpoint for the
				'org.springframework.integration.xmpp.outbound.ChatMessageSendingMessageHandler' that sends chat
				messages.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:complexContent>
				<xsd:extension base="xmppOutboundAdapterType">
					<xsd:attribute name="extension-provider" type="xsd:string">
						<xsd:annotation>
							<xsd:appinfo>
								<tool:annotation kind="ref">
									<tool:expected-type
											type="org.jivesoftware.smack.provider.ExtensionElementProvider"/>
								</tool:annotation>
							</xsd:appinfo>
							<xsd:documentation>
								Reference to org.jivesoftware.smack.provider.ExtensionElementProvider bean.
							</xsd:documentation>
						</xsd:annotation>
					</xsd:attribute>
				</xsd:extension>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="presence-inbound-channel-adapter">
		<xsd:annotation>
			<xsd:documentation>
				Configures a Message Producing Endpoint for the
				'org.springframework.integration.xmpp.inbound.PresenceListeningEndpoint'
				that will forward Presence state changes to a MessageChannel.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:complexContent>
				<xsd:extension base="xmppInboundAdapterType"/>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:element name="presence-outbound-channel-adapter">
		<xsd:annotation>
			<xsd:documentation>
				Configures a Consumer Endpoint for the
				'org.springframework.integration.xmpp.outbound.PresenceSendingMessageHandler'
				that will publish an updated 'Presence' state on the 'XMPPConnection' object.
			</xsd:documentation>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:complexContent>
				<xsd:extension base="xmppOutboundAdapterType"/>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>


	<xsd:complexType name="xmppInboundAdapterType">
		<xsd:attributeGroup ref="integration:channelAdapterAttributes"/>
		<xsd:attribute name="error-channel" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation><![CDATA[
						Identifies channel that error messages will be sent to if a failure occurs in this
						adapter's invocation.
					]]></xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="xmpp-connection" type="xsd:string">
			<xsd:annotation>
				<xsd:appinfo>
					<tool:annotation kind="ref">
						<tool:expected-type type="org.jivesoftware.smack.XMPPConnection"/>
					</tool:annotation>
				</xsd:appinfo>
				<xsd:documentation>
					Reference to XMPP connection bean
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="header-mapper">
			<xsd:annotation>
				<xsd:documentation>
					Allows you to reference custom implementation of HeaderMapper.
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="mapped-request-headers" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation><![CDATA[
	Comma-separated list of names of MessageHeaders to be mapped into the XMPP Headers of the request.
	This can only be provided if the 'header-mapper' reference is not being set directly. The values in
	this list can also be simple patterns to be matched against the header names (e.g. "foo*" or "*foo").
					]]></xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
	</xsd:complexType>

	<xsd:complexType name="xmppOutboundAdapterType">
		<xsd:choice minOccurs="0" maxOccurs="2">
			<xsd:element ref="integration:poller" minOccurs="0" maxOccurs="1"/>
			<xsd:element name="request-handler-advice-chain" type="integration:handlerAdviceChainType" minOccurs="0"
						 maxOccurs="1"/>
		</xsd:choice>
		<xsd:attributeGroup ref="integration:channelAdapterAttributes"/>
		<xsd:attribute name="xmpp-connection" type="xsd:string">
			<xsd:annotation>
				<xsd:appinfo>
					<tool:annotation kind="ref">
						<tool:expected-type type="org.jivesoftware.smack.XMPPConnection"/>
					</tool:annotation>
				</xsd:appinfo>
				<xsd:documentation>
					Reference to XMPP connection bean
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="order">
			<xsd:annotation>
				<xsd:documentation>
					Specifies the order for invocation when this endpoint is connected as a
					subscriber to a SubscribableChannel.
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="header-mapper">
			<xsd:annotation>
				<xsd:documentation>
					Allows you to reference custom implementation of HeaderMapper.
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="mapped-request-headers" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation><![CDATA[
	Comma-separated list of names of MessageHeaders to be mapped into the XMPP Headers of the request.
	This can only be provided if the 'header-mapper' reference is not being set directly. The values in
	this list can also be simple patterns to be matched against the header names (e.g. "foo*" or "*foo").
					]]></xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
	</xsd:complexType>

	<xsd:element name="header-enricher">
		<xsd:complexType>
			<xsd:annotation>
				<xsd:documentation>
					Defines a 'org.springframework.integration.transformer.HeaderEnricher' for adding XMPP headers.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:complexContent>
				<xsd:extension base="transformerType">
					<xsd:choice maxOccurs="unbounded">
						<xsd:element name="chat-to" type="headerType">
							<xsd:annotation>
								<xsd:documentation>
									The id of the user the message is sent to (e.g., user@gmail.com)
								</xsd:documentation>
							</xsd:annotation>
						</xsd:element>
						<xsd:element name="chat-thread-id" type="headerType">
							<xsd:annotation>
								<xsd:documentation>
									The conversation thread id used to correlate XMPP packets as
									belonging to a particular conversation
								</xsd:documentation>
							</xsd:annotation>
						</xsd:element>
						<xsd:element ref="integration:poller" minOccurs="0"/>
					</xsd:choice>
					<xsd:attribute name="default-overwrite">
						<xsd:annotation>
							<xsd:documentation>
								Specify the default boolean value for whether to overwrite existing header values. This
								will only take effect for
								sub-elements that do not provide their own 'overwrite' attribute. If the
								'default-overwrite' attribute is not
								provided, then the specified header values will NOT overwrite any existing ones with the
								same header names.
							</xsd:documentation>
						</xsd:annotation>
						<xsd:simpleType>
							<xsd:union memberTypes="xsd:boolean xsd:string"/>
						</xsd:simpleType>
					</xsd:attribute>
				</xsd:extension>
			</xsd:complexContent>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="headerType">
		<xsd:attribute name="value" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation>
					Value of this header in a Message
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="ref" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation>
					Reference to a bean that contains a method that will compute the header value
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="expression" type="xsd:string">
			<xsd:annotation>
				<xsd:documentation>
					SpEL expression that will compute the header value
				</xsd:documentation>
			</xsd:annotation>
		</xsd:attribute>
		<xsd:attribute name="overwrite">
			<xsd:annotation>
				<xsd:documentation>
					Boolean value to indicate whether this header value should overwrite an existing header value for
					the same name.
				</xsd:documentation>
			</xsd:annotation>
			<xsd:simpleType>
				<xsd:union memberTypes="xsd:boolean xsd:string"/>
			</xsd:simpleType>
		</xsd:attribute>
	</xsd:complexType>

	<xsd:complexType name="transformerType">
		<xsd:attribute name="id" type="xsd:string"/>
		<xsd:attributeGroup ref="integration:inputOutputChannelGroup"/>
	</xsd:complexType>

</xsd:schema>
