org.apache.maven.wagon
Class StreamWagon

java.lang.Object
  extended by org.apache.maven.wagon.AbstractWagon
      extended by org.apache.maven.wagon.StreamWagon
All Implemented Interfaces:
StreamingWagon, Wagon
Direct Known Subclasses:
AbstractHttpClientWagon, AbstractHttpClientWagon, AbstractJschWagon, FileWagon, FtpWagon, LightweightHttpWagon

public abstract class StreamWagon
extends AbstractWagon
implements StreamingWagon

Base class for wagon which provide stream based API.

Version:
$Id: StreamWagon.java 1179571 2011-10-06 11:13:09Z olamy $
Author:
Michal Maczka

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.Wagon
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_READ_TIMEOUT, ROLE
 
Constructor Summary
StreamWagon()
           
 
Method Summary
protected  void checkInputStream(InputStream is, Resource resource)
           
protected  void checkOutputStream(Resource resource, OutputStream os)
           
abstract  void closeConnection()
           
abstract  void fillInputData(InputData inputData)
           
abstract  void fillOutputData(OutputData outputData)
           
 void get(String resourceName, File destination)
          Downloads specified resource from the repository to given file.
 boolean getIfNewer(String resourceName, File destination, long timestamp)
          Downloads specified resource from the repository if it was modified since specified date.
 boolean getIfNewerToStream(String resourceName, OutputStream stream, long timestamp)
          Downloads specified resource from the repository if it was modified since specified date.
protected  InputStream getInputStream(Resource resource)
           
protected  OutputStream getOutputStream(Resource resource)
           
 void getToStream(String resourceName, OutputStream stream)
          Downloads specified resource from the repository to given output stream.
 void put(File source, String resourceName)
          Copy a file from local system to remote
protected  void putFromStream(InputStream stream, Resource resource)
           
 void putFromStream(InputStream stream, String destination)
           
 void putFromStream(InputStream stream, String destination, long contentLength, long lastModified)
          Copy from a local input stream to remote.
 
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, getFileList, getPath, getPermissionsOverride, getProxyInfo, getProxyInfo, getReadTimeout, getRepository, getSessionEventSupport, getTimeout, getTransfer, getTransfer, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, openConnection, openConnectionInternal, postProcessListeners, putDirectory, putTransfer, putTransfer, removeSessionListener, removeTransferListener, resourceExists, setInteractive, setPermissionsOverride, setReadTimeout, setSessionEventSupport, setTimeout, setTransferEventSupport, supportsDirectoryCopy, 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, getFileList, getReadTimeout, getRepository, getTimeout, hasSessionListener, hasTransferListener, isInteractive, openConnection, putDirectory, removeSessionListener, removeTransferListener, resourceExists, setInteractive, setReadTimeout, setTimeout, supportsDirectoryCopy
 

Constructor Detail

StreamWagon

public StreamWagon()
Method Detail

fillInputData

public abstract void fillInputData(InputData inputData)
                            throws TransferFailedException,
                                   ResourceDoesNotExistException,
                                   AuthorizationException
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

fillOutputData

public abstract void fillOutputData(OutputData outputData)
                             throws TransferFailedException
Throws:
TransferFailedException

closeConnection

public abstract void closeConnection()
                              throws ConnectionException
Specified by:
closeConnection in class AbstractWagon
Throws:
ConnectionException

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

checkInputStream

protected void checkInputStream(InputStream is,
                                Resource resource)
                         throws TransferFailedException
Throws:
TransferFailedException

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

getInputStream

protected InputStream getInputStream(Resource resource)
                              throws TransferFailedException,
                                     ResourceDoesNotExistException,
                                     AuthorizationException
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

put

public void put(File source,
                String resourceName)
         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
resourceName - the remote destination
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

checkOutputStream

protected void checkOutputStream(Resource resource,
                                 OutputStream os)
                          throws TransferFailedException
Throws:
TransferFailedException

getOutputStream

protected OutputStream getOutputStream(Resource resource)
                                throws TransferFailedException
Throws:
TransferFailedException

getIfNewerToStream

public boolean getIfNewerToStream(String resourceName,
                                  OutputStream stream,
                                  long timestamp)
                           throws ResourceDoesNotExistException,
                                  TransferFailedException,
                                  AuthorizationException
Description copied from interface: StreamingWagon
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:
getIfNewerToStream in interface StreamingWagon
Returns:
true if newer resource has been downloaded, false if resource in the repository is older or has the same age.
Throws:
ResourceDoesNotExistException
TransferFailedException
AuthorizationException

getToStream

public void getToStream(String resourceName,
                        OutputStream stream)
                 throws ResourceDoesNotExistException,
                        TransferFailedException,
                        AuthorizationException
Description copied from interface: StreamingWagon
Downloads specified resource from the repository to given output stream.

Specified by:
getToStream in interface StreamingWagon
Throws:
ResourceDoesNotExistException
TransferFailedException
AuthorizationException

putFromStream

public void putFromStream(InputStream stream,
                          String destination)
                   throws TransferFailedException,
                          ResourceDoesNotExistException,
                          AuthorizationException
Specified by:
putFromStream in interface StreamingWagon
Parameters:
stream - the local stream
destination - the remote destination
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

putFromStream

public void putFromStream(InputStream stream,
                          String destination,
                          long contentLength,
                          long lastModified)
                   throws TransferFailedException,
                          ResourceDoesNotExistException,
                          AuthorizationException
Description copied from interface: StreamingWagon
Copy from a local input stream to remote.

Specified by:
putFromStream in interface StreamingWagon
Parameters:
stream - the local stream
destination - the remote destination
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

putFromStream

protected void putFromStream(InputStream stream,
                             Resource resource)
                      throws TransferFailedException,
                             AuthorizationException,
                             ResourceDoesNotExistException
Throws:
TransferFailedException
AuthorizationException
ResourceDoesNotExistException


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