org.apache.avalon.repository.impl
Class DefaultRepository

java.lang.Object
  extended byorg.apache.avalon.repository.impl.DefaultRepository
All Implemented Interfaces:
Repository

public class DefaultRepository
extends Object
implements Repository

A component that provides access to versioned resources based on an underlying file system.

Version:
$Revision: 1.4 $ $Date: 2003/12/19 16:46:15 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.repository.Repository
KEY, SEPERATOR
 
Constructor Summary
DefaultRepository(CacheManager cache, String[] hosts)
          Creation of a new instance of the default repository.
 
Method Summary
 Attributes getAttributes(Artifact artifact)
          Return the metadata attribututes associated with an artifact.
 ClassLoader getClassLoader(Artifact artifact)
          Returns a classloader based on the metadata associated with a supplied artifact.
 ClassLoader getClassLoader(ClassLoader parent, Artifact artifact)
          Returns a classloader based on the metadata associated with a supplied artifact.
 URL getResource(Artifact artifact)
          Get a resource url relative to the supplied artifact.
 String toString()
          Return a string representation of this repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultRepository

public DefaultRepository(CacheManager cache,
                         String[] hosts)
Creation of a new instance of the default repository.

Parameters:
cache - the cache manager assigned to the repository
hosts - the set of remote hosts
Throws:
NullPointerException - if the cache or hosts argument is null
Method Detail

getAttributes

public Attributes getAttributes(Artifact artifact)
                         throws RepositoryException
Return the metadata attribututes associated with an artifact.

Specified by:
getAttributes in interface Repository
Parameters:
artifact - the relative artifact from which a .meta resource will be resolved to establish the artifact attributes
Returns:
the attributes associated with the artifact
Throws:
RepositoryException - if an error occurs while retrieving or building the attributes
NullPointerException - if the supplied artifact is null

getResource

public URL getResource(Artifact artifact)
                throws RepositoryException
Get a resource url relative to the supplied artifact.

Specified by:
getResource in interface Repository
Parameters:
artifact - the artifact describing the resource
Returns:
the resource url
Throws:
RepositoryException

getClassLoader

public ClassLoader getClassLoader(Artifact artifact)
                           throws RepositoryException
Returns a classloader based on the metadata associated with a supplied artifact. The classloader is created relative to the system classloader.

Specified by:
getClassLoader in interface Repository
Parameters:
artifact - the artifact fro which dependency metadata will be resolved
Returns:
the classloader
Throws:
RepositoryException - if there is a problem caching and accessing repository artifacts and reading their attributes.

getClassLoader

public ClassLoader getClassLoader(ClassLoader parent,
                                  Artifact artifact)
                           throws RepositoryException
Returns a classloader based on the metadata associated with a supplied artifact. The classloader is created relative to the supplied parent classloader.

Specified by:
getClassLoader in interface Repository
Parameters:
parent - the parent classloader
artifact - the implementation artifact
Returns:
the classloader
Throws:
RepositoryException - if there is a problem caching and accessing repository artifacts and reading their attributes.

toString

public String toString()
Return a string representation of this repository.

Returns:
the string representation


Copyright © Apache Software Foundation. All Rights Reserved.