net.anzix.aws.maven
Class SimpleStorageServiceWagon

java.lang.Object
  extended by net.anzix.aws.maven.AbstractWagon
      extended by net.anzix.aws.maven.SimpleStorageServiceWagon
All Implemented Interfaces:
org.apache.maven.wagon.Wagon

public class SimpleStorageServiceWagon
extends AbstractWagon

An implementation of the Maven Wagon interface that allows you to access the Amazon S3 service. URLs that reference the S3 service should be in the form of s3://bucket.name. As an example s3://static.springframework.org would put files into the static.springframework.org bucket on the S3 service.

This implementation uses the username and passphrase portions of the server authentication metadata for credentials.

Author:
Ben Hale

Field Summary
 
Fields inherited from interface org.apache.maven.wagon.Wagon
ROLE
 
Constructor Summary
SimpleStorageServiceWagon()
           
 
Method Summary
protected  void connectToRepository(org.apache.maven.wagon.repository.Repository source, org.apache.maven.wagon.authentication.AuthenticationInfo authenticationInfo, org.apache.maven.wagon.proxy.ProxyInfoProvider proxyInfoProvider)
          Subclass must implement with specific connection behavior
protected  void disconnectFromRepository()
          Subclasses must implement with specific disconnection behavior
protected  boolean doesRemoteResourceExist(String resourceName)
          Subclass must implement with specific detection behavior
protected  void getResource(String resourceName, File destination, net.anzix.aws.maven.TransferProgress progress)
          Subclass must implement with specific get behavior
protected  boolean isRemoteResourceNewer(String resourceName, long timestamp)
          Subclass must implement with newer detection behavior
protected  List<String> listDirectory(String directory)
          Subclass must implement with specific directory listing behavior
protected  void putResource(File source, String destination, net.anzix.aws.maven.TransferProgress progress)
          Subclasses must implement with specific put behavior
 
Methods inherited from class net.anzix.aws.maven.AbstractWagon
addSessionListener, addTransferListener, connect, connect, connect, connect, connect, connect, disconnect, get, getFileList, getIfNewer, getRepository, getSessionListeners, getTimeout, getTransferListeners, hasSessionListener, hasTransferListener, isInteractive, openConnection, put, putDirectory, removeSessionListener, removeTransferListener, resourceExists, setInteractive, setTimeout, supportsDirectoryCopy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleStorageServiceWagon

public SimpleStorageServiceWagon()
Method Detail

connectToRepository

protected void connectToRepository(org.apache.maven.wagon.repository.Repository source,
                                   org.apache.maven.wagon.authentication.AuthenticationInfo authenticationInfo,
                                   org.apache.maven.wagon.proxy.ProxyInfoProvider proxyInfoProvider)
                            throws org.apache.maven.wagon.authentication.AuthenticationException
Description copied from class: AbstractWagon
Subclass must implement with specific connection behavior

Specified by:
connectToRepository in class AbstractWagon
Parameters:
source - The repository connection information
authenticationInfo - Authentication information, if any
proxyInfoProvider - Proxy information, if any
Throws:
org.apache.maven.wagon.authentication.AuthenticationException

doesRemoteResourceExist

protected boolean doesRemoteResourceExist(String resourceName)
Description copied from class: AbstractWagon
Subclass must implement with specific detection behavior

Specified by:
doesRemoteResourceExist in class AbstractWagon
Parameters:
resourceName - The remote resource to detect
Returns:
true if the remote resource exists

disconnectFromRepository

protected void disconnectFromRepository()
Description copied from class: AbstractWagon
Subclasses must implement with specific disconnection behavior

Specified by:
disconnectFromRepository in class AbstractWagon

getResource

protected void getResource(String resourceName,
                           File destination,
                           net.anzix.aws.maven.TransferProgress progress)
                    throws org.apache.maven.wagon.ResourceDoesNotExistException,
                           org.jets3t.service.ServiceException,
                           IOException
Description copied from class: AbstractWagon
Subclass must implement with specific get behavior

Specified by:
getResource in class AbstractWagon
Parameters:
resourceName - The name of the remote resource to read
destination - The local file to write to
progress - A progress notifier for the upload. It must be used or hashes will not be calculated correctly
Throws:
org.apache.maven.wagon.ResourceDoesNotExistException
org.jets3t.service.ServiceException
IOException

isRemoteResourceNewer

protected boolean isRemoteResourceNewer(String resourceName,
                                        long timestamp)
                                 throws org.jets3t.service.ServiceException
Description copied from class: AbstractWagon
Subclass must implement with newer detection behavior

Specified by:
isRemoteResourceNewer in class AbstractWagon
Parameters:
resourceName - The name of the resource being compared
timestamp - The timestamp to compare against
Returns:
true if the current version of the resource is newer than the timestamp
Throws:
org.jets3t.service.ServiceException

listDirectory

protected List<String> listDirectory(String directory)
                              throws Exception
Description copied from class: AbstractWagon
Subclass must implement with specific directory listing behavior

Specified by:
listDirectory in class AbstractWagon
Parameters:
directory - The directory to list files in
Returns:
A collection of file names
Throws:
Exception - Implementations can throw any exception and it will be handled by the base class

putResource

protected void putResource(File source,
                           String destination,
                           net.anzix.aws.maven.TransferProgress progress)
                    throws org.jets3t.service.ServiceException,
                           IOException
Description copied from class: AbstractWagon
Subclasses must implement with specific put behavior

Specified by:
putResource in class AbstractWagon
Parameters:
source - The local source file to read from
destination - The name of the remote resource to write to
progress - A progress notifier for the upload. It must be used or hashes will not be calculated correctly
Throws:
org.jets3t.service.ServiceException
IOException


Copyright © 2007-2010. All Rights Reserved.