org.apache.camel.component.file.remote
Class SftpOperations

java.lang.Object
  extended by org.apache.camel.component.file.remote.SftpOperations
All Implemented Interfaces:
GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>, RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>

public class SftpOperations
extends Object
implements RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>

SFTP remote file operations


Constructor Summary
SftpOperations()
           
 
Method Summary
 boolean buildDirectory(String directory, boolean absolute)
           
 void changeCurrentDirectory(String path)
           
 void changeToParentDirectory()
           
 boolean connect(RemoteFileConfiguration configuration)
          Connects to the remote server
protected  com.jcraft.jsch.Session createSession(RemoteFileConfiguration configuration)
           
 boolean deleteFile(String name)
           
 void disconnect()
          Disconnects from the remote server
 boolean existsFile(String name)
           
 String getCurrentDirectory()
           
 boolean isConnected()
          Returns whether we are connected to the remote server or not
 List<com.jcraft.jsch.ChannelSftp.LsEntry> listFiles()
           
 List<com.jcraft.jsch.ChannelSftp.LsEntry> listFiles(String path)
           
 boolean renameFile(String from, String to)
           
 boolean retrieveFile(String name, Exchange exchange)
           
 boolean sendNoop()
          Sends a noop command to the remote server
 boolean sendSiteCommand(String command)
          Sends a site command to the remote server
 void setEndpoint(GenericFileEndpoint endpoint)
           
 boolean storeFile(String name, Exchange exchange)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SftpOperations

public SftpOperations()
Method Detail

setEndpoint

public void setEndpoint(GenericFileEndpoint endpoint)
Specified by:
setEndpoint in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>

connect

public boolean connect(RemoteFileConfiguration configuration)
                throws GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Connects to the remote server

Specified by:
connect in interface RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Parameters:
configuration - configuration
Returns:
true if connected
Throws:
GenericFileOperationFailedException - can be thrown

createSession

protected com.jcraft.jsch.Session createSession(RemoteFileConfiguration configuration)
                                         throws com.jcraft.jsch.JSchException
Throws:
com.jcraft.jsch.JSchException

isConnected

public boolean isConnected()
                    throws GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Returns whether we are connected to the remote server or not

Specified by:
isConnected in interface RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Returns:
true if connected, false if not
Throws:
GenericFileOperationFailedException - can be thrown

disconnect

public void disconnect()
                throws GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Disconnects from the remote server

Specified by:
disconnect in interface RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException - can be thrown

deleteFile

public boolean deleteFile(String name)
                   throws GenericFileOperationFailedException
Specified by:
deleteFile in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

renameFile

public boolean renameFile(String from,
                          String to)
                   throws GenericFileOperationFailedException
Specified by:
renameFile in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

buildDirectory

public boolean buildDirectory(String directory,
                              boolean absolute)
                       throws GenericFileOperationFailedException
Specified by:
buildDirectory in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

getCurrentDirectory

public String getCurrentDirectory()
                           throws GenericFileOperationFailedException
Specified by:
getCurrentDirectory in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

changeCurrentDirectory

public void changeCurrentDirectory(String path)
                            throws GenericFileOperationFailedException
Specified by:
changeCurrentDirectory in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

changeToParentDirectory

public void changeToParentDirectory()
                             throws GenericFileOperationFailedException
Specified by:
changeToParentDirectory in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

listFiles

public List<com.jcraft.jsch.ChannelSftp.LsEntry> listFiles()
                                                    throws GenericFileOperationFailedException
Specified by:
listFiles in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

listFiles

public List<com.jcraft.jsch.ChannelSftp.LsEntry> listFiles(String path)
                                                    throws GenericFileOperationFailedException
Specified by:
listFiles in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

retrieveFile

public boolean retrieveFile(String name,
                            Exchange exchange)
                     throws GenericFileOperationFailedException
Specified by:
retrieveFile in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

storeFile

public boolean storeFile(String name,
                         Exchange exchange)
                  throws GenericFileOperationFailedException
Specified by:
storeFile in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

existsFile

public boolean existsFile(String name)
                   throws GenericFileOperationFailedException
Specified by:
existsFile in interface GenericFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Throws:
GenericFileOperationFailedException

sendNoop

public boolean sendNoop()
                 throws GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Sends a noop command to the remote server

Specified by:
sendNoop in interface RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Returns:
true if the noop was a success, false otherwise
Throws:
GenericFileOperationFailedException - can be thrown

sendSiteCommand

public boolean sendSiteCommand(String command)
                        throws GenericFileOperationFailedException
Description copied from interface: RemoteFileOperations
Sends a site command to the remote server

Specified by:
sendSiteCommand in interface RemoteFileOperations<com.jcraft.jsch.ChannelSftp.LsEntry>
Parameters:
command - the command
Returns:
true if the command was a success, false otherwise
Throws:
GenericFileOperationFailedException - can be thrown


Apache CAMEL