Application Programmer Interfact (API)RepositoryThe Repository interface provides a simple protocol independent API against which a client can retrieve physical artifacts, artifact metadata, and composite objects derived from metadata information. Get an artifact.The getResource( Artifact artifact ) operation provides a simple protocol independent method to get a concrete url to a resource. The actual url returned to the client is a function of the repository implementation established at runtime. /** * Get a resource url relative to the supplied artifact. * * @param artifact the artifact describing the resource * @return the resource url */ URL getResource( Artifact artifact ) throws RepositoryException; Artifact Attribute Retrival.The getAttributes operation provides support for the retrival of a set of attributes corresponding to metadata about an artifact. This information is used to construct higher level objecets such as classloaders based on dependencies declaring in metadata. /** * Return the metadata of an artifact as attributes. * @param artifact the artifact * @return the attributes resolved relative to the artifact address * @exception RepositoryException if an error occurs while resolving * artifact metadata attributes */ Attributes getAttributes( Artifact artifact ) throws RepositoryException; Classloader creation.Using matadata associated with an artifact, the repository can construct a component classloader tree that can be used in the subsequent deployment of compoents and applications. /** * Creates a ClassLoader chain returning the lowest ClassLoader containing * the jar artifact in the loader's path. The dependencies of the argument * artifact jar and an api, spi and implementation attribute on the jar and * its dependencies are used to construct the ClassLoaders. * * @param artifact the implementation artifact * @return the lowest ClassLoader in a chain * @throws RepositoryException if there is a problem caching and accessing * repository artifacts and reading their attributes. */ ClassLoader getClassLoader( Artifact artifact ) throws RepositoryException; Classloader creation (using a parent).This function is equivalent to the basic getClassloader operation except that it allows the declaration of the parent classloader to be used when constructing the new classloader chain. /** * Creates a ClassLoader chain returning the lowest ClassLoader containing * the jar artifact in the loader's path. The dependencies of the argument * artifact jar and an api, spi and implementation attribute on the jar and * its dependencies are used to construct the ClassLoaders. * * @param parent the parent classloader * @param artifact the implementation artifact * @return the lowest ClassLoader in a chain * @throws RepositoryException if there is a problem caching and accessing * repository artifacts and reading their attributes. */ ClassLoader getClassLoader( ClassLoader parent, Artifact artifact ) throws RepositoryException ; |