KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > repository > Repository


1 /*
2  * Copyright 2004 Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.avalon.repository;
19
20 import java.net.URL JavaDoc;
21 import javax.naming.directory.Attributes JavaDoc ;
22
23 /**
24  * A service that provides access to versioned resources.
25  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
26  * @version $Revision: 1.4 $ $Date: 2004/03/04 03:26:41 $
27  */

28 public interface Repository
29 {
30     /**
31      * The context resolution key.
32      */

33     String JavaDoc KEY = "urn:assembly:repository" ;
34
35     /**
36      * The seperator character between the group and resource name values
37      * in an artifact name.
38      */

39     String JavaDoc SEPERATOR = ":" ;
40
41    /**
42     * Return the metadata of an artifact as attributes.
43     * @param artifact the artifact
44     * @return the attributes resolved relative to the artifact address
45     * @exception RepositoryException if an error occurs while resolving
46     * artifact metadata attributes
47     */

48     Attributes JavaDoc getAttributes( Artifact artifact )
49         throws RepositoryException ;
50     
51     /**
52      * Get a resource url relative to the supplied artifact.
53      *
54      * @param artifact the artifact describing the resource
55      * @return the resource url
56      */

57     URL JavaDoc getResource( Artifact artifact ) throws RepositoryException;
58
59    /**
60     * Return the set of available artifacts capable of providing the
61     * supplied service class.
62     *
63     * @return the set of candidate factory artifacts
64     */

65     Artifact[] getCandidates( Class JavaDoc service );
66
67     /**
68      * Creates a ClassLoader chain returning the lowest ClassLoader containing
69      * the jar artifact in the loader's path. The dependencies of the argument
70      * artifact jar and an api, spi and implementation attribute on the jar and
71      * its dependencies are used to construct the ClassLoaders.
72      *
73      * @param artifact the implementation artifact
74      * @return the lowest ClassLoader in a chain
75      * @throws RepositoryException if there is a problem caching and accessing
76      * repository artifacts and reading their attributes.
77      */

78     ClassLoader JavaDoc getClassLoader( Artifact artifact )
79         throws RepositoryException ;
80
81     /**
82      * Creates a ClassLoader chain returning the lowest ClassLoader containing
83      * the jar artifact in the loader's path. The dependencies of the argument
84      * artifact jar and an api, spi and implementation attribute on the jar and
85      * its dependencies are used to construct the ClassLoaders.
86      *
87      * @param parent the parent classloader
88      * @param artifact the implementation artifact
89      * @return the lowest ClassLoader in a chain
90      * @throws RepositoryException if there is a problem caching and accessing
91      * repository artifacts and reading their attributes.
92      */

93     ClassLoader JavaDoc getClassLoader( ClassLoader JavaDoc parent, Artifact artifact )
94         throws RepositoryException ;
95 }
96
Popular Tags