INT-1756 added support for auto-creating remote directories

This commit is contained in:
Oleg Zhurakousky
2011-03-09 09:54:27 -05:00
parent d16ba3061d
commit d12eadf33c
9 changed files with 65 additions and 3 deletions

View File

@@ -140,4 +140,12 @@ class SftpSession implements Session {
}
}
public void mkdir(String directory) throws IOException {
try {
this.channel.mkdir(directory);
} catch (SftpException e) {
throw new NestedIOException("failed to create remote directory '" + directory + "'.", e);
}
}
}

View File

@@ -77,6 +77,14 @@
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="auto-create-directory" type="xsd:string" default="false">
<xsd:annotation>
<xsd:documentation>
Specify whether to automatically create the remote target directory if it doesn't exist.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="remote-filename-generator" type="xsd:string">
<xsd:annotation>
<xsd:documentation>

View File

@@ -64,7 +64,7 @@ public class SftpInboundOutboundSanitySample {
}
@Test
@Ignore
//@Ignore
public void testOutbound() throws Exception{
ApplicationContext ac =
new ClassPathXmlApplicationContext("SftpOutboundTransferSample-ignored.xml", this.getClass());

View File

@@ -24,6 +24,7 @@
charset="UTF-8"
temporary-file-suffix=".foo"
remote-filename-generator-expression="payload.getName() + '-foo'"
remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-target-dir"/>
auto-create-directory="true"
remote-directory="/Users/ozhurakousky/workspace-sts-2.3.3.M2/si/spring-integration/spring-integration-sftp/remote-target-dir/foo/bar/baz"/>
</beans>