Class AbstractJschWagon
- java.lang.Object
-
- org.apache.maven.wagon.AbstractWagon
-
- org.apache.maven.wagon.StreamWagon
-
- org.apache.maven.wagon.providers.ssh.jsch.AbstractJschWagon
-
- All Implemented Interfaces:
CommandExecutor,SshWagon,StreamingWagon,Wagon
public abstract class AbstractJschWagon extends StreamWagon implements SshWagon, CommandExecutor
AbstractJschWagon
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringEXEC_CHANNELprivate InteractiveUserInfointeractiveUserInfoprivate KnownHostsProviderknownHostsProviderprivate java.lang.StringpreferredAuthenticationsprotected com.jcraft.jsch.Sessionsessionprivate static intSOCKS5_PROXY_PORTprotected ScpHelpersshToolprivate java.lang.StringstrictHostKeyCheckingprivate com.jcraft.jsch.UIKeyboardInteractiveuIKeyboardInteractive-
Fields inherited from class org.apache.maven.wagon.AbstractWagon
authenticationInfo, BUFFER_SEGMENT_SIZE, DEFAULT_BUFFER_SIZE, interactive, MAXIMUM_BUFFER_SIZE, MINIMUM_AMOUNT_OF_TRANSFER_CHUNKS, proxyInfo, repository, sessionEventSupport, transferEventSupport
-
Fields inherited from interface org.apache.maven.wagon.CommandExecutor
ROLE
-
Fields inherited from interface org.apache.maven.wagon.Wagon
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE
-
-
Constructor Summary
Constructors Constructor Description AbstractJschWagon()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection()voidexecuteCommand(java.lang.String command)StreamsexecuteCommand(java.lang.String command, boolean ignoreFailures)StreamsexecuteCommand(java.lang.String command, boolean ignoreStdErr, boolean ignoreNoneZeroExitCode)java.util.List<java.lang.String>getFileList(java.lang.String destinationDirectory)Returns aListof strings naming the files and directories in the directory denoted by this abstract pathname.InteractiveUserInfogetInteractiveUserInfo()KnownHostsProvidergetKnownHostsProvider()java.lang.StringgetPreferredAuthentications()java.lang.StringgetStrictHostKeyChecking()protected voidhandleGetException(Resource resource, java.lang.Exception e)voidopenConnectionInternal()voidputDirectory(java.io.File sourceDirectory, java.lang.String destinationDirectory)Copy a directory from local system to remotebooleanresourceExists(java.lang.String resourceName)Check if a remote resource existsvoidsetInteractiveUserInfo(InteractiveUserInfo interactiveUserInfo)voidsetKnownHostsProvider(KnownHostsProvider knownHostsProvider)voidsetPreferredAuthentications(java.lang.String preferredAuthentications)voidsetStrictHostKeyChecking(java.lang.String strictHostKeyChecking)voidsetUIKeyboardInteractive(com.jcraft.jsch.UIKeyboardInteractive uIKeyboardInteractive)booleansupportsDirectoryCopy()Flag indicating if this wagon supports directory copy operations.protected voidtransfer(Resource resource, java.io.InputStream input, java.io.OutputStream output, int requestType, long maxSize)Write fromInputStreamtoOutputStream.-
Methods inherited from class org.apache.maven.wagon.StreamWagon
checkInputStream, checkOutputStream, fillInputData, fillOutputData, get, getIfNewer, getIfNewerToStream, getInputStream, getOutputStream, getToStream, put, putFromStream, putFromStream, putFromStream
-
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, getBufferCapacityForTransfer, getPath, getPermissionsOverride, getProxyInfo, getProxyInfo, getReadTimeout, getRepository, getSessionEventSupport, getTimeout, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, openConnection, postProcessListeners, putTransfer, putTransfer, removeSessionListener, removeTransferListener, setInteractive, setPermissionsOverride, setReadTimeout, 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, getReadTimeout, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, put, removeSessionListener, removeTransferListener, setInteractive, setReadTimeout, setTimeout
-
-
-
-
Field Detail
-
sshTool
protected ScpHelper sshTool
-
session
protected com.jcraft.jsch.Session session
-
strictHostKeyChecking
private java.lang.String strictHostKeyChecking
-
knownHostsProvider
private volatile KnownHostsProvider knownHostsProvider
-
interactiveUserInfo
private volatile InteractiveUserInfo interactiveUserInfo
-
preferredAuthentications
private volatile java.lang.String preferredAuthentications
-
uIKeyboardInteractive
private volatile com.jcraft.jsch.UIKeyboardInteractive uIKeyboardInteractive
-
SOCKS5_PROXY_PORT
private static final int SOCKS5_PROXY_PORT
- See Also:
- Constant Field Values
-
EXEC_CHANNEL
protected static final java.lang.String EXEC_CHANNEL
- See Also:
- Constant Field Values
-
-
Method Detail
-
openConnectionInternal
public void openConnectionInternal() throws AuthenticationException- Specified by:
openConnectionInternalin classAbstractWagon- Throws:
AuthenticationException
-
closeConnection
public void closeConnection()
- Specified by:
closeConnectionin classStreamWagon
-
executeCommand
public Streams executeCommand(java.lang.String command, boolean ignoreStdErr, boolean ignoreNoneZeroExitCode) throws CommandExecutionException
- Throws:
CommandExecutionException
-
handleGetException
protected void handleGetException(Resource resource, java.lang.Exception e) throws TransferFailedException
- Throws:
TransferFailedException
-
getFileList
public java.util.List<java.lang.String> getFileList(java.lang.String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationExceptionDescription copied from interface:WagonReturns aListof 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 throwsResourceDoesNotExistException. Otherwise aListof 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:
getFileListin interfaceWagon- Overrides:
getFileListin classAbstractWagon- Parameters:
destinationDirectory- directory to list contents of- Returns:
- A
Listof strings naming the files and directories in the directory denoted by this abstract pathname. TheListwill be empty if the directory is empty. - Throws:
TransferFailedException- if there's an error trying to access the remote sideResourceDoesNotExistException- if destinationDirectory does not exist or is not a directoryAuthorizationException- if not authorized to list the contents of the directory
-
putDirectory
public void putDirectory(java.io.File sourceDirectory, java.lang.String destinationDirectory) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationExceptionDescription copied from interface:WagonCopy a directory from local system to remote- Specified by:
putDirectoryin interfaceWagon- Overrides:
putDirectoryin classAbstractWagon- Parameters:
sourceDirectory- the local directorydestinationDirectory- the remote destination- Throws:
TransferFailedExceptionResourceDoesNotExistExceptionAuthorizationException
-
resourceExists
public boolean resourceExists(java.lang.String resourceName) throws TransferFailedException, AuthorizationExceptionDescription copied from interface:WagonCheck if a remote resource exists- Specified by:
resourceExistsin interfaceWagon- Overrides:
resourceExistsin classAbstractWagon- Returns:
- whether the resource exists or not
- Throws:
TransferFailedException- if there's an error trying to access the remote sideAuthorizationException- if not authorized to verify the existence of the resource
-
supportsDirectoryCopy
public boolean supportsDirectoryCopy()
Description copied from interface:WagonFlag indicating if this wagon supports directory copy operations.- Specified by:
supportsDirectoryCopyin interfaceWagon- Overrides:
supportsDirectoryCopyin classAbstractWagon- Returns:
- whether if this wagon supports directory operations
-
executeCommand
public void executeCommand(java.lang.String command) throws CommandExecutionException- Specified by:
executeCommandin interfaceCommandExecutor- Throws:
CommandExecutionException
-
executeCommand
public Streams executeCommand(java.lang.String command, boolean ignoreFailures) throws CommandExecutionException
- Specified by:
executeCommandin interfaceCommandExecutor- Throws:
CommandExecutionException
-
getInteractiveUserInfo
public InteractiveUserInfo getInteractiveUserInfo()
-
getKnownHostsProvider
public KnownHostsProvider getKnownHostsProvider()
-
setInteractiveUserInfo
public void setInteractiveUserInfo(InteractiveUserInfo interactiveUserInfo)
-
setKnownHostsProvider
public void setKnownHostsProvider(KnownHostsProvider knownHostsProvider)
- Specified by:
setKnownHostsProviderin interfaceSshWagon
-
setUIKeyboardInteractive
public void setUIKeyboardInteractive(com.jcraft.jsch.UIKeyboardInteractive uIKeyboardInteractive)
-
getPreferredAuthentications
public java.lang.String getPreferredAuthentications()
-
setPreferredAuthentications
public void setPreferredAuthentications(java.lang.String preferredAuthentications)
-
getStrictHostKeyChecking
public java.lang.String getStrictHostKeyChecking()
-
setStrictHostKeyChecking
public void setStrictHostKeyChecking(java.lang.String strictHostKeyChecking)
-
transfer
protected void transfer(Resource resource, java.io.InputStream input, java.io.OutputStream output, int requestType, long maxSize) throws java.io.IOException
Write fromInputStreamtoOutputStream. Equivalent toAbstractWagon.transfer(Resource, InputStream, OutputStream, int, long)with a maxSize equals toInteger.MAX_VALUE- Overrides:
transferin classAbstractWagon- Parameters:
resource- resource to transferinput- input streamoutput- output streamrequestType- one ofTransferEvent.REQUEST_GETorTransferEvent.REQUEST_PUTmaxSize- size of the buffer- Throws:
java.io.IOException
-
-