org.apache.maven.wagon.providers.webdav
Class WebDavWagon

java.lang.Object
  extended byorg.apache.maven.wagon.AbstractWagon
      extended byorg.apache.maven.wagon.providers.webdav.WebDavWagon
All Implemented Interfaces:
org.apache.maven.wagon.Wagon

public class WebDavWagon
extends org.apache.maven.wagon.AbstractWagon

WebDavWagon

Allows using a webdav remote repository for downloads and deployments

TODO: webdav https server is not tested

Author:
Henry Isidro, Joakim Erdfelt, Carlos Sanchez

Nested Class Summary
 
Nested classes inherited from class org.apache.maven.wagon.Wagon
 
Field Summary
private  java.text.DateFormat dateFormat
           
private static java.util.TimeZone TIMESTAMP_TIME_ZONE
           
private static java.lang.String wagonVersion
           
private  CorrectedWebdavResource webdavResource
           
 
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
WebDavWagon()
           
 
Method Summary
private  java.lang.String checkUri(java.lang.String uri)
          Determine which URI to use at the prompt.
 void closeConnection()
          Closes the connection
 void get(java.lang.String resourceName, java.io.File destination)
           
 boolean get(java.lang.String resourceName, java.io.File destination, long timestamp)
          Get a file from remote server
 java.util.List getFileList(java.lang.String destinationDirectory)
           
 boolean getIfNewer(java.lang.String resourceName, java.io.File destination, long timestamp)
           
private  java.lang.String getURL(org.apache.maven.wagon.repository.Repository repository)
           
 void openConnection()
          Opens a connection via web-dav resource
 void put(java.io.File source, java.lang.String resourceName)
          Puts a file into the remote repository
 void putDirectory(java.io.File sourceDirectory, java.lang.String destinationDirectory)
          Copy a directory from local system to remote webdav server
 boolean resourceExists(java.lang.String resourceName)
           
 boolean supportsDirectoryCopy()
          This wagon supports directory copying
private  org.apache.commons.httpclient.HttpURL urlToHttpURL(java.lang.String url)
          Converts a String url to an HttpURL
 
Methods inherited from class org.apache.maven.wagon.AbstractWagon
addSessionListener, addTransferListener, connect, connect, connect, connect, createParentDirectories, createZip, disconnect, fireGetCompleted, fireGetInitiated, fireGetStarted, firePutCompleted, firePutInitiated, firePutStarted, fireSessionConnectionRefused, fireSessionDebug, fireSessionDisconnected, fireSessionDisconnecting, fireSessionError, fireSessionLoggedIn, fireSessionLoggedOff, fireSessionOpened, fireSessionOpening, fireTransferDebug, fireTransferError, fireTransferProgress, getAuthenticationInfo, getPath, getProxyInfo, getRepository, getSessionEventSupport, getTransfer, getTransfer, getTransferEventSupport, hasSessionListener, hasTransferListener, isInteractive, postProcessListeners, putTransfer, removeSessionListener, removeTransferListener, setInteractive, setSessionEventSupport, 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
 

Field Detail

TIMESTAMP_TIME_ZONE

private static final java.util.TimeZone TIMESTAMP_TIME_ZONE

wagonVersion

private static java.lang.String wagonVersion

dateFormat

private java.text.DateFormat dateFormat

webdavResource

private CorrectedWebdavResource webdavResource
Constructor Detail

WebDavWagon

public WebDavWagon()
Method Detail

openConnection

public void openConnection()
                    throws org.apache.maven.wagon.authentication.AuthenticationException,
                           org.apache.maven.wagon.ConnectionException
Opens a connection via web-dav resource

Throws:
org.apache.maven.wagon.authentication.AuthenticationException
org.apache.maven.wagon.ConnectionException

closeConnection

public void closeConnection()
                     throws org.apache.maven.wagon.ConnectionException
Closes the connection

Throws:
org.apache.maven.wagon.ConnectionException

put

public void put(java.io.File source,
                java.lang.String resourceName)
         throws org.apache.maven.wagon.TransferFailedException,
                org.apache.maven.wagon.ResourceDoesNotExistException,
                org.apache.maven.wagon.authorization.AuthorizationException
Puts a file into the remote repository

Parameters:
source - the file to transfer
resourceName - the name of the resource
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

urlToHttpURL

private org.apache.commons.httpclient.HttpURL urlToHttpURL(java.lang.String url)
                                                    throws org.apache.commons.httpclient.URIException
Converts a String url to an HttpURL

Parameters:
url - String url to convert to an HttpURL
Returns:
an HttpURL object created from the String url
Throws:
org.apache.commons.httpclient.URIException

checkUri

private java.lang.String checkUri(java.lang.String uri)
                           throws java.io.IOException
Determine which URI to use at the prompt.

Parameters:
uri - the path to be set.
Returns:
the absolute path.
Throws:
java.io.IOException

get

public void get(java.lang.String resourceName,
                java.io.File destination)
         throws org.apache.maven.wagon.TransferFailedException,
                org.apache.maven.wagon.ResourceDoesNotExistException,
                org.apache.maven.wagon.authorization.AuthorizationException
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

getIfNewer

public boolean getIfNewer(java.lang.String resourceName,
                          java.io.File destination,
                          long timestamp)
                   throws org.apache.maven.wagon.TransferFailedException,
                          org.apache.maven.wagon.ResourceDoesNotExistException,
                          org.apache.maven.wagon.authorization.AuthorizationException
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

get

public boolean get(java.lang.String resourceName,
                   java.io.File destination,
                   long timestamp)
            throws org.apache.maven.wagon.TransferFailedException,
                   org.apache.maven.wagon.ResourceDoesNotExistException,
                   org.apache.maven.wagon.authorization.AuthorizationException
Get a file from remote server

Parameters:
resourceName -
destination -
timestamp - the timestamp to check against, only downloading if newer. If 0, always download
Returns:
true if newer version was downloaded, false otherwise.
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

getURL

private java.lang.String getURL(org.apache.maven.wagon.repository.Repository repository)

supportsDirectoryCopy

public boolean supportsDirectoryCopy()
This wagon supports directory copying

Returns:
true always

putDirectory

public void putDirectory(java.io.File sourceDirectory,
                         java.lang.String destinationDirectory)
                  throws org.apache.maven.wagon.TransferFailedException,
                         org.apache.maven.wagon.ResourceDoesNotExistException,
                         org.apache.maven.wagon.authorization.AuthorizationException
Copy a directory from local system to remote webdav server

Parameters:
sourceDirectory - the local directory
destinationDirectory - the remote destination
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

getFileList

public java.util.List getFileList(java.lang.String destinationDirectory)
                           throws org.apache.maven.wagon.TransferFailedException,
                                  org.apache.maven.wagon.ResourceDoesNotExistException,
                                  org.apache.maven.wagon.authorization.AuthorizationException
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

resourceExists

public boolean resourceExists(java.lang.String resourceName)
                       throws org.apache.maven.wagon.TransferFailedException,
                              org.apache.maven.wagon.authorization.AuthorizationException
Throws:
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.authorization.AuthorizationException