org.sonatype.aether.util.listener
Class DefaultTransferResource

java.lang.Object
  extended by org.sonatype.aether.util.listener.DefaultTransferResource
All Implemented Interfaces:
TransferResource

public class DefaultTransferResource
extends java.lang.Object
implements TransferResource

A simple transfer resource.

Author:
Benjamin Bentmann

Constructor Summary
DefaultTransferResource(java.lang.String repositoryUrl, java.lang.String resourceName, java.io.File file)
          Creates a new transfer resource with the specified properties.
 
Method Summary
 long getContentLength()
          The size of the resource in bytes.
 java.io.File getFile()
          Gets the local file being uploaded or downloaded.
 java.lang.String getRepositoryUrl()
          The base URL of the repository, e.g.
 java.lang.String getResourceName()
          The path of the resource relative to the repository's base URL, e.g.
 long getTransferStartTime()
          Gets the timestamp when the transfer of this resource was started.
 DefaultTransferResource setContentLength(long contentLength)
          Sets the size of the resource in bytes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultTransferResource

public DefaultTransferResource(java.lang.String repositoryUrl,
                               java.lang.String resourceName,
                               java.io.File file)
Creates a new transfer resource with the specified properties.

Parameters:
repositoryUrl - The base URL of the repository, may be null or empty if unknown. If not empty, a trailing slash will automatically be added if missing.
resourceName - The relative path to the resource within the repository, may be null. A leading slash (if any) will be automatically removed.
file - The source/target file involved in the transfer, may be null.
Method Detail

getRepositoryUrl

public java.lang.String getRepositoryUrl()
Description copied from interface: TransferResource
The base URL of the repository, e.g. "http://repo1.maven.org/maven2/". Unless the URL is unknown, it will be terminated by a trailing slash.

Specified by:
getRepositoryUrl in interface TransferResource
Returns:
The base URL of the repository or an empty string if unknown, never null.

getResourceName

public java.lang.String getResourceName()
Description copied from interface: TransferResource
The path of the resource relative to the repository's base URL, e.g. "org/apache/maven/maven/3.0/maven-3.0.pom".

Specified by:
getResourceName in interface TransferResource
Returns:
The path of the resource, never null.

getFile

public java.io.File getFile()
Description copied from interface: TransferResource
Gets the local file being uploaded or downloaded. When the repository system merely checks for the existence of a remote resource, no local file will be involved in the transfer.

Specified by:
getFile in interface TransferResource
Returns:
The source/target file involved in the transfer or null if none.

getContentLength

public long getContentLength()
Description copied from interface: TransferResource
The size of the resource in bytes.

Specified by:
getContentLength in interface TransferResource
Returns:
The size of the resource in bytes or a negative value if unknown.

setContentLength

public DefaultTransferResource setContentLength(long contentLength)
Sets the size of the resource in bytes.

Parameters:
contentLength - The size of the resource in bytes or a negative value if unknown.
Returns:
This resource for chaining, never null.

getTransferStartTime

public long getTransferStartTime()
Description copied from interface: TransferResource
Gets the timestamp when the transfer of this resource was started.

Specified by:
getTransferStartTime in interface TransferResource
Returns:
The timestamp when the transfer of this resource was started.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010 Sonatype, Inc.. All Rights Reserved.