org.apache.maven.wagon.providers.scm
Class ScmWagon

java.lang.Object
  extended by org.apache.maven.wagon.AbstractWagon
      extended by org.apache.maven.wagon.providers.scm.ScmWagon
All Implemented Interfaces:
Wagon

public class ScmWagon
extends AbstractWagon

Wagon provider to get and put files from and to SCM systems, using Maven-SCM as underlying transport.

TODO it probably creates problems if the same wagon is used in two different SCM protocols, as instance variables can keep incorrect state. TODO: For doing releases we either have to be able to add files with checking out the repository structure which may not be possible, or the checkout directory needs to be a constant. Doing releases won't scale if you have to checkout the whole repository structure in order to add 3 files.

Version:
$Id: ScmWagon.java 894435 2009-12-29 16:38:38Z bentmann $
Author:
Brett Porter, Emmanuel Venisse, Carlos Sanchez, Jason van Zyl

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
ROLE
 
Constructor Summary
ScmWagon()
           
 
Method Summary
 void closeConnection()
           
 void get(String resourceName, File destination)
           
 File getCheckoutDirectory()
          Get the directory where Wagon will checkout files from SCM.
 List getFileList(String resourcePath)
           
 boolean getIfNewer(String resourceName, File destination, long timestamp)
          Not implemented
 org.apache.maven.scm.manager.ScmManager getScmManager()
          Get the ScmManager used in this Wagon
 org.apache.maven.scm.provider.ScmProvider getScmProvider(String scmType)
          Convenience method to get the ScmProvider implementation to handle the provided SCM type
 void openConnectionInternal()
          This will cleanup the checkout directory
 void put(File source, String targetName)
           
 void putDirectory(File sourceDirectory, String destinationDirectory)
           
 boolean resourceExists(String resourceName)
           
 void setCheckoutDirectory(File checkoutDirectory)
          Set the directory where Wagon will checkout files from SCM.
 void setScmManager(org.apache.maven.scm.manager.ScmManager scmManager)
          Set the ScmManager used in this Wagon
 boolean supportsDirectoryCopy()
           
 
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
 

Constructor Detail

ScmWagon

public ScmWagon()
Method Detail

getScmManager

public org.apache.maven.scm.manager.ScmManager getScmManager()
Get the ScmManager used in this Wagon

Returns:
the ScmManager

setScmManager

public void setScmManager(org.apache.maven.scm.manager.ScmManager scmManager)
Set the ScmManager used in this Wagon

Parameters:
scmManager -

getCheckoutDirectory

public File getCheckoutDirectory()
Get the directory where Wagon will checkout files from SCM. This directory will be deleted!

Returns:
directory

setCheckoutDirectory

public void setCheckoutDirectory(File checkoutDirectory)
Set the directory where Wagon will checkout files from SCM. This directory will be deleted!

Parameters:
checkoutDirectory -

getScmProvider

public org.apache.maven.scm.provider.ScmProvider getScmProvider(String scmType)
                                                         throws org.apache.maven.scm.manager.NoSuchScmProviderException
Convenience method to get the ScmProvider implementation to handle the provided SCM type

Parameters:
scmType - type of SCM, eg. svn, cvs
Returns:
the ScmProvider that will handle provided SCM type
Throws:
org.apache.maven.scm.manager.NoSuchScmProviderException - if there is no ScmProvider able to handle that SCM type

openConnectionInternal

public void openConnectionInternal()
                            throws ConnectionException
This will cleanup the checkout directory

Specified by:
openConnectionInternal in class AbstractWagon
Throws:
ConnectionException

put

public void put(File source,
                String targetName)
         throws TransferFailedException,
                ResourceDoesNotExistException,
                AuthorizationException
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

supportsDirectoryCopy

public boolean supportsDirectoryCopy()
Specified by:
supportsDirectoryCopy in interface Wagon
Overrides:
supportsDirectoryCopy in class AbstractWagon
Returns:
true

putDirectory

public void putDirectory(File sourceDirectory,
                         String destinationDirectory)
                  throws TransferFailedException,
                         ResourceDoesNotExistException,
                         AuthorizationException
Specified by:
putDirectory in interface Wagon
Overrides:
putDirectory in class AbstractWagon
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

closeConnection

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

getIfNewer

public boolean getIfNewer(String resourceName,
                          File destination,
                          long timestamp)
                   throws TransferFailedException,
                          ResourceDoesNotExistException,
                          AuthorizationException
Not implemented

Throws:
UnsupportedOperationException - always
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

get

public void get(String resourceName,
                File destination)
         throws TransferFailedException,
                ResourceDoesNotExistException,
                AuthorizationException
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException

getFileList

public List getFileList(String resourcePath)
                 throws TransferFailedException,
                        ResourceDoesNotExistException,
                        AuthorizationException
Specified by:
getFileList in interface Wagon
Overrides:
getFileList in class AbstractWagon
Returns:
a List<String> with filenames/directories at the resourcepath.
Throws:
TransferFailedException
ResourceDoesNotExistException
AuthorizationException
See Also:
AbstractWagon.getFileList(java.lang.String)

resourceExists

public boolean resourceExists(String resourceName)
                       throws TransferFailedException,
                              AuthorizationException
Specified by:
resourceExists in interface Wagon
Overrides:
resourceExists in class AbstractWagon
Throws:
TransferFailedException
AuthorizationException


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