org.apache.avalon.repository.util
Class LoaderUtils

java.lang.Object
  extended byorg.apache.avalon.repository.util.LoaderUtils

public class LoaderUtils
extends Object

Utility class supporting downloading of resources based on artifact references.

Version:
$Revision: 1.7 $
Author:
Avalon Development Team

Constructor Summary
LoaderUtils(boolean online)
           
 
Method Summary
 URL getResource(Artifact artifact, String[] repositories, File root, boolean timestamping)
          Attempts to download and cache a remote artifact trying a set of remote repositories.
 URL getResource(Artifact artifact, String mime, String[] repositories, File root, boolean timestamping)
          Attempts to download and cache a remote artifact trying a set of remote repositories.
 URL getResource(String url, File destination, boolean timestamping)
          Retrieve a remote file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoaderUtils

public LoaderUtils(boolean online)
Method Detail

getResource

public URL getResource(Artifact artifact,
                       String[] repositories,
                       File root,
                       boolean timestamping)
                throws RepositoryException
Attempts to download and cache a remote artifact trying a set of remote repositories. The operation is not fail fast and so it keeps trying if the first repository does not have the artifact in question.

Parameters:
artifact - the artifact to retrieve and cache
repositories - the remote repositories to try to download from
root - the root cache directory
timestamping - whether to check the modified timestamp on the destinationFile against the remote source
Returns:
URL a url referencing the local resource
Throws:
RepositoryException

getResource

public URL getResource(Artifact artifact,
                       String mime,
                       String[] repositories,
                       File root,
                       boolean timestamping)
                throws RepositoryException
Attempts to download and cache a remote artifact trying a set of remote repositories. The operation is not fail fast and so it keeps trying if the first repository does not have the artifact in question.

Parameters:
artifact - the artifact to retrieve and cache
mime - the mime type
repositories - the remote repositories to try to download from
root - the root cache directory
timestamping - whether to check the modified timestamp on the destinationFile against the remote source
Returns:
URL a url referencing the local resource
Throws:
RepositoryException

getResource

public URL getResource(String url,
                       File destination,
                       boolean timestamping)
                throws Exception
Retrieve a remote file.

Parameters:
url - the of the file to retrieve
destination - where to store it
timestamping - whether to check the modified timestamp on the destinationFile against the remote source
Returns:
URL a url referencing the local resource
Throws:
Exception


Copyright © The Apache Software Foundation. All Rights Reserved.