INT-2981 Add Support for 'mv' to (S)FTP Outbound Gateways #779

Closed
wants to merge 6 commits into
from

Projects

None yet

2 participants

@garyrussell
Member

I took the opportunity to do a little refatoring (mainly change commands and options to enums, and change a big if/else block to a switch statement).

You may find it easier to review each commit individually.

@ghillert ghillert and 1 other commented on an outdated diff Apr 11, 2013
...remote/gateway/AbstractRemoteFileOutboundGateway.java
- public static final String COMMAND_LS = "ls";
+ public static enum Command {
@ghillert
ghillert Apr 11, 2013 Member

As the class already has 500+ lines of code, wouldn't it be more advisable to move the 2 enums Command and Option into their own classes? Possibly also adding some JavaDoc?

@garyrussell
garyrussell Apr 11, 2013 Member

I prefer the encapsulation but we could add javadoc.

@ghillert ghillert and 1 other commented on an outdated diff Apr 11, 2013
...tegration/sftp/config/spring-integration-sftp-3.0.xsd
@@ -243,7 +243,7 @@
<xsd:attribute name="command" use="required" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
- sftp command - ls, get or rm
+ sftp command - ls, get, rm, mget or mv.
@ghillert
ghillert Apr 11, 2013 Member

Technically, I would love seeing the type to be an enumeration - In order to provide a slightly better user experience for STS users, could you do:

<xsd:simpleType>
    <xsd:union memberTypes=remoteCommand xsd:string"/>
</xsd:simpleType>

<xsd:simpleType name="remoteCommand">
    <xsd:restriction base="xsd:token">
        <xsd:enumeration value="ls"/>
        <xsd:enumeration value="get"/>
        <xsd:enumeration value="rm"/>
        <xsd:enumeration value="mget"/>
        <xsd:enumeration value="mv"/>
    </xsd:restriction>
</xsd:simpleType>
@garyrussell
garyrussell Apr 11, 2013 Member

But then you can't use property placeholders. Maybe that's unlikely in this case, but...

@ghillert
ghillert Apr 11, 2013 Member

I think you can - any String is still allowed (xsd:string). It just provides some additional hint to STS to provide code completion.

@garyrussell
garyrussell Apr 11, 2013 Member

Sorry - missed the union

@garyrussell
Member

Pushed - added javadocs to enums; polished schemas to use an enumerated type.

@ghillert
Member

Merged.

@ghillert ghillert closed this Apr 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment