org.apache.maven.wagon.providers.ssh.external
Class ScpExternalWagon

java.lang.Object
  extended by org.apache.maven.wagon.AbstractWagon
      extended by org.apache.maven.wagon.providers.ssh.external.ScpExternalWagon
All Implemented Interfaces:
CommandExecutor, Wagon
Direct Known Subclasses:
ScpExternalCommandExecutor

public class ScpExternalWagon
extends AbstractWagon
implements CommandExecutor

SCP deployer using "external" scp program. To allow for ssh-agent type behavior, until we can construct a Java SSH Agent and interface for JSch.

Version:
$Id:ScpExternalWagon.java 477260 2006-11-20 17:11:39Z brett $
Author:
Brett Porter
Plexus component:
role-hint:
"scpexe"
instantiation-strategy:
"per-lookup"
role:
"org.apache.maven.wagon.Wagon"

Field Summary
 
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
ScpExternalWagon()
           
 
Method Summary
 void closeConnection()
           
 void executeCommand(String command)
           
 Streams executeCommand(String command, boolean ignoreFailures)
           
 void get(String resourceName, File destination)
          Downloads specified resource from the repository to given file.
 List<String> getFileList(String destinationDirectory)
          

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

 boolean getIfNewer(String resourceName, File destination, long timestamp)
          Downloads specified resource from the repository if it was modified since specified date.
 String getScpArgs()
           
 String getScpExecutable()
           
 String getSshArgs()
           
 String getSshExecutable()
           
protected  boolean isPuTTY()
           
protected  void openConnectionInternal()
           
 void put(File source, String destination)
          Copy a file from local system to remote
 void putDirectory(File sourceDirectory, String destinationDirectory)
          Copy a directory from local system to remote
 boolean resourceExists(String resourceName)
          Check if a remote resource exists
 void setScpArgs(String scpArgs)
           
 void setScpExecutable(String scpExecutable)
           
 void setSshArgs(String sshArgs)
           
 void setSshExecutable(String sshExecutable)
           
 boolean supportsDirectoryCopy()
          Flag indicating if this wagon supports directory copy operations.
 
Methods inherited from class org.apache.maven.wagon.AbstractWagon
addSessionListener, addTransferListener, cleanupGetTransfer, cleanupPutTransfer, connect, connect, connect, connect, connect, connect, createParentDirectories, disconnect, finishGetTransfer, finishPutTransfer, 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, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, removeSessionListener, removeTransferListener, setInteractive, setTimeout
 

Constructor Detail

ScpExternalWagon

public ScpExternalWagon()
Method Detail

openConnectionInternal

protected void openConnectionInternal()
                               throws AuthenticationException
Specified by:
openConnectionInternal in class AbstractWagon
Throws:
AuthenticationException

closeConnection

public void closeConnection()
Specified by:
closeConnection in class AbstractWagon

getIfNewer

public boolean getIfNewer(String resourceName,
                          File destination,
                          long timestamp)
                   throws TransferFailedException,
                          ResourceDoesNotExistException,
                          AuthorizationException
Description copied from interface: Wagon
Downloads specified resource from the repository if it was modified since specified date. The date is measured in milliseconds, between the current time and midnight, January 1, 1970 UTC and aligned to GMT timezone.

Specified by:
getIfNewer in interface Wagon
Returns:
true if newer resource has been downloaded, false if resource in the repository is older or has the same age.
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

executeCommand

public void executeCommand(String command)
                    throws CommandExecutionException
Specified by:
executeCommand in interface CommandExecutor
Throws:
CommandExecutionException

executeCommand

public Streams executeCommand(String command,
                              boolean ignoreFailures)
                       throws CommandExecutionException
Specified by:
executeCommand in interface CommandExecutor
Throws:
CommandExecutionException

isPuTTY

protected boolean isPuTTY()

put

public void put(File source,
                String destination)
         throws TransferFailedException,
                ResourceDoesNotExistException,
                AuthorizationException
Description copied from interface: Wagon
Copy a file from local system to remote

Specified by:
put in interface Wagon
Parameters:
source - the local file
destination - the remote destination
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

get

public void get(String resourceName,
                File destination)
         throws TransferFailedException,
                ResourceDoesNotExistException,
                AuthorizationException
Description copied from interface: Wagon
Downloads specified resource from the repository to given file.

Specified by:
get in interface Wagon
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

getFileList

public List<String> 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 AbstractWagon
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

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 AbstractWagon
Parameters:
sourceDirectory - the local directory
destinationDirectory - the remote destination
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

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 AbstractWagon
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

supportsDirectoryCopy

public boolean supportsDirectoryCopy()
Description copied from interface: Wagon
Flag indicating if this wagon supports directory copy operations.

Specified by:
supportsDirectoryCopy in interface Wagon
Overrides:
supportsDirectoryCopy in class AbstractWagon
Returns:
whether if this wagon supports directory operations

getScpExecutable

public String getScpExecutable()

setScpExecutable

public void setScpExecutable(String scpExecutable)

getSshExecutable

public String getSshExecutable()

setSshExecutable

public void setSshExecutable(String sshExecutable)

getScpArgs

public String getScpArgs()

setScpArgs

public void setScpArgs(String scpArgs)

getSshArgs

public String getSshArgs()

setSshArgs

public void setSshArgs(String sshArgs)


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