org.apache.maven.wagon.providers.ssh.jsch
Class SftpWagon

java.lang.Object
  extended by org.apache.maven.wagon.AbstractWagon
      extended by org.apache.maven.wagon.StreamWagon
          extended by org.apache.maven.wagon.providers.ssh.jsch.AbstractJschWagon
              extended by org.apache.maven.wagon.providers.ssh.jsch.SftpWagon
All Implemented Interfaces:
CommandExecutor, SshWagon, StreamingWagon, Wagon

public class SftpWagon
extends AbstractJschWagon

SFTP protocol wagon.

Version:
$Id: SftpWagon.java 1172843 2011-09-19 21:28:04Z hboutemy $
Author:
Brett Porter
Plexus component:
role-hint:
"sftp"
instantiation-strategy:
"per-lookup"
role:
"org.apache.maven.wagon.Wagon"

Field Summary
 
Fields inherited from class org.apache.maven.wagon.providers.ssh.jsch.AbstractJschWagon
EXEC_CHANNEL, session, sshTool
 
Fields inherited from class org.apache.maven.wagon.AbstractWagon
authenticationInfo, DEFAULT_BUFFER_SIZE, interactive, proxyInfo, repository, sessionEventSupport, transferEventSupport
 
Fields inherited from interface org.apache.maven.wagon.CommandExecutor
ROLE
 
Constructor Summary
SftpWagon()
           
 
Method Summary
protected  void cleanupGetTransfer(Resource resource)
           
protected  void cleanupPutTransfer(Resource resource)
           
 void closeConnection()
           
 void fillInputData(InputData inputData)
           
 void fillOutputData(OutputData outputData)
           
protected  void finishPutTransfer(Resource resource, InputStream input, OutputStream output)
           
 int getDirectoryMode(RepositoryPermissions permissions)
           
 List getFileList(String destinationDirectory)
          

Returns a List of strings naming the files and directories in the directory denoted by this abstract pathname.

 int getOctalMode(String mode)
           
 void openConnectionInternal()
           
 void putDirectory(File sourceDirectory, String destinationDirectory)
          Copy a directory from local system to remote
 boolean resourceExists(String resourceName)
          Check if a remote resource exists
 
Methods inherited from class org.apache.maven.wagon.providers.ssh.jsch.AbstractJschWagon
executeCommand, executeCommand, getInteractiveUserInfo, getKnownHostsProvider, handleGetException, setInteractiveUserInfo, setKnownHostsProvider, supportsDirectoryCopy
 
Methods inherited from class org.apache.maven.wagon.StreamWagon
checkInputStream, checkOutputStream, get, getIfNewer, getIfNewerToStream, getInputStream, getOutputStream, getToStream, put, putFromStream, putFromStream
 
Methods inherited from class org.apache.maven.wagon.AbstractWagon
addSessionListener, addTransferListener, connect, connect, connect, connect, connect, connect, createParentDirectories, disconnect, finishGetTransfer, fireGetCompleted, fireGetInitiated, fireGetStarted, firePutCompleted, firePutInitiated, firePutStarted, fireSessionConnectionRefused, fireSessionDebug, fireSessionDisconnected, fireSessionDisconnecting, fireSessionError, fireSessionLoggedIn, fireSessionLoggedOff, fireSessionOpened, fireSessionOpening, fireTransferDebug, fireTransferError, fireTransferProgress, getAuthenticationInfo, getPath, getPermissionsOverride, getProxyInfo, getProxyInfo, getRepository, getSessionEventSupport, getTimeout, getTransfer, getTransfer, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, openConnection, postProcessListeners, putTransfer, putTransfer, removeSessionListener, removeTransferListener, setInteractive, setPermissionsOverride, setSessionEventSupport, setTimeout, setTransferEventSupport, transfer, transfer, transfer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.wagon.Wagon
addSessionListener, addTransferListener, connect, connect, connect, connect, connect, connect, disconnect, get, getIfNewer, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, put, removeSessionListener, removeTransferListener, setInteractive, setTimeout
 

Constructor Detail

SftpWagon

public SftpWagon()
Method Detail

closeConnection

public void closeConnection()
Overrides:
closeConnection in class AbstractJschWagon

openConnectionInternal

public void openConnectionInternal()
                            throws AuthenticationException
Overrides:
openConnectionInternal in class AbstractJschWagon
Throws:
AuthenticationException

putDirectory

public void putDirectory(File sourceDirectory,
                         String destinationDirectory)
                  throws TransferFailedException,
                         ResourceDoesNotExistException,
                         AuthorizationException
Description copied from interface: Wagon
Copy a directory from local system to remote

Specified by:
putDirectory in interface Wagon
Overrides:
putDirectory in class AbstractJschWagon
Parameters:
sourceDirectory - the local directory
destinationDirectory - the remote destination
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

getFileList

public List getFileList(String destinationDirectory)
                 throws TransferFailedException,
                        ResourceDoesNotExistException,
                        AuthorizationException
Description copied from interface: Wagon

Returns a List of strings naming the files and directories in the directory denoted by this abstract pathname.

If this abstract pathname does not denote a directory, or does not exist, then this method throws ResourceDoesNotExistException. Otherwise a List of strings is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.

There is no guarantee that the name strings in the resulting list will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

Specified by:
getFileList in interface Wagon
Overrides:
getFileList in class AbstractJschWagon
Parameters:
destinationDirectory - directory to list contents of
Returns:
A List of strings naming the files and directories in the directory denoted by this abstract pathname. The List will be empty if the directory is empty.
Throws:
TransferFailedException - if there's an error trying to access the remote side
ResourceDoesNotExistException - if destinationDirectory does not exist or is not a directory
AuthorizationException - if not authorized to list the contents of the directory

resourceExists

public boolean resourceExists(String resourceName)
                       throws TransferFailedException,
                              AuthorizationException
Description copied from interface: Wagon
Check if a remote resource exists

Specified by:
resourceExists in interface Wagon
Overrides:
resourceExists in class AbstractJschWagon
Returns:
whether the resource exists or not
Throws:
TransferFailedException - if there's an error trying to access the remote side
AuthorizationException - if not authorized to verify the existence of the resource

cleanupGetTransfer

protected void cleanupGetTransfer(Resource resource)
Overrides:
cleanupGetTransfer in class AbstractWagon

cleanupPutTransfer

protected void cleanupPutTransfer(Resource resource)
Overrides:
cleanupPutTransfer in class AbstractWagon

finishPutTransfer

protected void finishPutTransfer(Resource resource,
                                 InputStream input,
                                 OutputStream output)
                          throws TransferFailedException
Overrides:
finishPutTransfer in class AbstractWagon
Throws:
TransferFailedException

fillInputData

public void fillInputData(InputData inputData)
                   throws TransferFailedException,
                          ResourceDoesNotExistException
Specified by:
fillInputData in class StreamWagon
Throws:
TransferFailedException
ResourceDoesNotExistException

fillOutputData

public void fillOutputData(OutputData outputData)
                    throws TransferFailedException
Specified by:
fillOutputData in class StreamWagon
Throws:
TransferFailedException

getDirectoryMode

public int getDirectoryMode(RepositoryPermissions permissions)
Parameters:
permissions - repository's permissions
Returns:
the directory mode for the repository or -1 if it wasn't set

getOctalMode

public int getOctalMode(String mode)


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.