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.10 $ $Date: 2004/03/17 10:50:03 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from interface org.apache.avalon.repository.Repository
KEY, SEPERATOR
 
Method Summary
 Attributes getAttributes(Artifact artifact)
          Return the metadata attribututes associated with an artifact.
 Artifact[] getCandidates(Class service)
          Return the set of available artifacts capable of providing the supplied service class.
 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
 

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

getCandidates

public Artifact[] getCandidates(Class service)
Return the set of available artifacts capable of providing the supplied service class.

Specified by:
getCandidates in interface Repository
Returns:
the set of candidate factory artifacts

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 © The Apache Software Foundation. All Rights Reserved.