org.apache.maven.wagon

Class AbstractWagon

public abstract class AbstractWagon extends Object implements Wagon

Implementation of common facilties for Wagon providers.

Version: $Id: AbstractWagon.java 480330 2006-11-29 01:55:47Z brett $

Author: Michal Maczka

UNKNOWN: [BP] The proxy information should probably be validated to match the wagon type

Field Summary
protected AuthenticationInfoauthenticationInfo
protected static intDEFAULT_BUFFER_SIZE
protected booleaninteractive
protected ProxyInfoproxyInfo
protected Repositoryrepository
protected SessionEventSupportsessionEventSupport
protected TransferEventSupporttransferEventSupport
Method Summary
voidaddSessionListener(SessionListener listener)
voidaddTransferListener(TransferListener listener)
protected abstract voidcloseConnection()
voidconnect(Repository repository)
voidconnect(Repository repository, ProxyInfo proxyInfo)
voidconnect(Repository repository, AuthenticationInfo authenticationInfo)
voidconnect(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo)
protected voidcreateParentDirectories(File destination)
voidcreateZip(List files, File zipName, File basedir)
voiddisconnect()
protected voidfireGetCompleted(Resource resource, File localFile)
protected voidfireGetInitiated(Resource resource, File localFile)
protected voidfireGetStarted(Resource resource, File localFile)
protected voidfirePutCompleted(Resource resource, File localFile)
protected voidfirePutInitiated(Resource resource, File localFile)
protected voidfirePutStarted(Resource resource, File localFile)
protected voidfireSessionConnectionRefused()
protected voidfireSessionDebug(String message)
protected voidfireSessionDisconnected()
protected voidfireSessionDisconnecting()
protected voidfireSessionError(Exception exception)
protected voidfireSessionLoggedIn()
protected voidfireSessionLoggedOff()
protected voidfireSessionOpened()
protected voidfireSessionOpening()
protected voidfireTransferDebug(String message)
protected voidfireTransferError(Resource resource, Exception e, int requestType)
protected voidfireTransferProgress(TransferEvent transferEvent, byte[] buffer, int n)
AuthenticationInfogetAuthenticationInfo()
ListgetFileList(String destinationDirectory)
protected static StringgetPath(String basedir, String dir)
ProxyInfogetProxyInfo()
RepositorygetRepository()
SessionEventSupportgetSessionEventSupport()
protected voidgetTransfer(Resource resource, File destination, InputStream input)
protected voidgetTransfer(Resource resource, File destination, InputStream input, boolean closeInput, int maxSize)
TransferEventSupportgetTransferEventSupport()
booleanhasSessionListener(SessionListener listener)
booleanhasTransferListener(TransferListener listener)
booleanisInteractive()
protected voidpostProcessListeners(Resource resource, File source, int requestType)
This method is used if you are not streaming the transfer, to make sure any listeners dependent on state (eg checksum observers) succeed.
voidputDirectory(File sourceDirectory, String destinationDirectory)
protected voidputTransfer(Resource resource, File source, OutputStream output, boolean closeOutput)
voidremoveSessionListener(SessionListener listener)
voidremoveTransferListener(TransferListener listener)
booleanresourceExists(String resourceName)
voidsetInteractive(boolean interactive)
voidsetSessionEventSupport(SessionEventSupport sessionEventSupport)
voidsetTransferEventSupport(TransferEventSupport transferEventSupport)
booleansupportsDirectoryCopy()
protected voidtransfer(Resource resource, File source, OutputStream output, boolean closeOutput)
Write from File to OutputStream
protected voidtransfer(Resource resource, InputStream input, OutputStream output, int requestType)
Write from InputStream to OutputStream.
protected voidtransfer(Resource resource, InputStream input, OutputStream output, int requestType, int maxSize)
Write from InputStream to OutputStream.
voidwriteZipEntry(ZipOutputStream jar, File source, String entryName)

Field Detail

authenticationInfo

protected AuthenticationInfo authenticationInfo

DEFAULT_BUFFER_SIZE

protected static final int DEFAULT_BUFFER_SIZE

interactive

protected boolean interactive

proxyInfo

protected ProxyInfo proxyInfo

repository

protected Repository repository

sessionEventSupport

protected SessionEventSupport sessionEventSupport

transferEventSupport

protected TransferEventSupport transferEventSupport

Method Detail

addSessionListener

public void addSessionListener(SessionListener listener)

addTransferListener

public void addTransferListener(TransferListener listener)

closeConnection

protected abstract void closeConnection()

connect

public void connect(Repository repository)

connect

public void connect(Repository repository, ProxyInfo proxyInfo)

connect

public void connect(Repository repository, AuthenticationInfo authenticationInfo)

connect

public void connect(Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo)

createParentDirectories

protected void createParentDirectories(File destination)

createZip

public void createZip(List files, File zipName, File basedir)

disconnect

public void disconnect()

fireGetCompleted

protected void fireGetCompleted(Resource resource, File localFile)

fireGetInitiated

protected void fireGetInitiated(Resource resource, File localFile)

fireGetStarted

protected void fireGetStarted(Resource resource, File localFile)

firePutCompleted

protected void firePutCompleted(Resource resource, File localFile)

firePutInitiated

protected void firePutInitiated(Resource resource, File localFile)

firePutStarted

protected void firePutStarted(Resource resource, File localFile)

fireSessionConnectionRefused

protected void fireSessionConnectionRefused()

fireSessionDebug

protected void fireSessionDebug(String message)

fireSessionDisconnected

protected void fireSessionDisconnected()

fireSessionDisconnecting

protected void fireSessionDisconnecting()

fireSessionError

protected void fireSessionError(Exception exception)

fireSessionLoggedIn

protected void fireSessionLoggedIn()

fireSessionLoggedOff

protected void fireSessionLoggedOff()

fireSessionOpened

protected void fireSessionOpened()

fireSessionOpening

protected void fireSessionOpening()

fireTransferDebug

protected void fireTransferDebug(String message)

fireTransferError

protected void fireTransferError(Resource resource, Exception e, int requestType)

fireTransferProgress

protected void fireTransferProgress(TransferEvent transferEvent, byte[] buffer, int n)

getAuthenticationInfo

public AuthenticationInfo getAuthenticationInfo()

getFileList

public List getFileList(String destinationDirectory)

getPath

protected static String getPath(String basedir, String dir)

getProxyInfo

public ProxyInfo getProxyInfo()

getRepository

public Repository getRepository()

getSessionEventSupport

public SessionEventSupport getSessionEventSupport()

getTransfer

protected void getTransfer(Resource resource, File destination, InputStream input)

getTransfer

protected void getTransfer(Resource resource, File destination, InputStream input, boolean closeInput, int maxSize)

getTransferEventSupport

public TransferEventSupport getTransferEventSupport()

hasSessionListener

public boolean hasSessionListener(SessionListener listener)

hasTransferListener

public boolean hasTransferListener(TransferListener listener)

isInteractive

public boolean isInteractive()

postProcessListeners

protected void postProcessListeners(Resource resource, File source, int requestType)
This method is used if you are not streaming the transfer, to make sure any listeners dependent on state (eg checksum observers) succeed.

putDirectory

public void putDirectory(File sourceDirectory, String destinationDirectory)

putTransfer

protected void putTransfer(Resource resource, File source, OutputStream output, boolean closeOutput)

removeSessionListener

public void removeSessionListener(SessionListener listener)

removeTransferListener

public void removeTransferListener(TransferListener listener)

resourceExists

public boolean resourceExists(String resourceName)

setInteractive

public void setInteractive(boolean interactive)

setSessionEventSupport

public void setSessionEventSupport(SessionEventSupport sessionEventSupport)

setTransferEventSupport

public void setTransferEventSupport(TransferEventSupport transferEventSupport)

supportsDirectoryCopy

public boolean supportsDirectoryCopy()

transfer

protected void transfer(Resource resource, File source, OutputStream output, boolean closeOutput)
Write from File to OutputStream

Parameters: resource resource to transfer source file to read from output output stream closeOutput whether the output stream should be closed or not

Throws: TransferFailedException

Since: 1.0-beta-1

transfer

protected void transfer(Resource resource, InputStream input, OutputStream output, int requestType)
Write from InputStream to OutputStream. Equivalent to AbstractWagon with a maxSize equal to Integer#MAX_VALUE

Parameters: resource resource to transfer input input stream output output stream requestType one of REQUEST_GET or REQUEST_PUT

Throws: IOException

transfer

protected void transfer(Resource resource, InputStream input, OutputStream output, int requestType, int maxSize)
Write from InputStream to OutputStream. Equivalent to AbstractWagon with a maxSize equal to Integer#MAX_VALUE

Parameters: resource resource to transfer input input stream output output stream requestType one of REQUEST_GET or REQUEST_PUT maxSize size of the buffer

Throws: IOException

writeZipEntry

private void writeZipEntry(ZipOutputStream jar, File source, String entryName)