<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:int="http://www.springframework.org/schema/integration"
	xmlns:int-smb="http://www.springframework.org/schema/integration/smb"
	xmlns:int-file="http://www.springframework.org/schema/integration/file"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/integration/smb http://www.springframework.org/schema/integration/smb/spring-integration-smb.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

	<context:property-placeholder />

	<!--
		smb://[[[domain;]username[:password]@]server[:port]/[[share/[dir/]file]]][?[param=value[param2=value2[...]]]
	 -->
	<bean id="smbSession" class="org.springframework.integration.smb.session.SmbSessionFactory">
		<property name="host" value="${host}"/>
		<property name="username" value="${username}"/>
		<property name="password" value="${password}"/>
		<property name="shareAndDir" value="${shareAndDir}"/>
	</bean>

	<int-smb:inbound-channel-adapter local-directory="target/smb-transfer-work"
		session-factory="smbSession" remote-directory="."
		auto-create-local-directory="true" delete-remote-files="false"
		channel="inboundChannel">
		<int:poller fixed-rate="10000" max-messages-per-poll="1"/>
	</int-smb:inbound-channel-adapter>

	<int:channel id="inboundChannel">
		<int:interceptors>
			<int:wire-tap channel="loggit"/>
		</int:interceptors>
	</int:channel>

	<int:logging-channel-adapter id="loggit" level="INFO"
		logger-name="org.springframework.integration.samples.smb"
		expression="'File Name: ' + payload.name + '(' + payload.length() + ')'"/>
	<int-file:outbound-channel-adapter channel="inboundChannel" directory="target/smb-out"/>
</beans>
