KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > loom > classman > builder > LoaderResolver


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.loom.classman.builder;
9
10 import java.net.URL JavaDoc;
11
12 import org.codehaus.loom.extension.Extension;
13
14 /**
15  * This is the class that clients provide to implement a specific policy with
16  * respect to how ClassLoader hierarchy is constructed.
17  *
18  * @author Peter Donald
19  * @version $Revision: 1.1 $ $Date: 2004/04/19 22:19:25 $
20  */

21 public interface LoaderResolver
22 {
23     /**
24      * Resolve an Extension to a URL. The URL that locates the "Optional
25      * Package" that provides specified Extension.
26      *
27      * @param extension the extension
28      * @return the URL that locates the "Optional Package" that provides
29      * specified Extension.
30      * @throws Exception if unable to locate Extension
31      */

32     URL JavaDoc resolveExtension( Extension extension )
33         throws Exception JavaDoc;
34
35     /**
36      * Resolve a string into a URL. This allows resolvers to anchor URLs using
37      * relative URL or by handling non-standard URL protocols (such as
38      * "sar:/SAR-INF/lib/cornerstone.jar").
39      *
40      * @param location the location to transform into a URL
41      * @return the URL
42      * @throws Exception if unable to resolve URL
43      */

44     URL JavaDoc resolveURL( String JavaDoc location )
45         throws Exception JavaDoc;
46
47     /**
48      * Resolve a fileset to a set of URLs.
49      *
50      * @param baseDirectory the Base directory of fileset
51      * @return the set of URLs making up fileset
52      * @throws Exception if unable to resolve fileset
53      */

54     URL JavaDoc[] resolveFileSet( String JavaDoc baseDirectory,
55                           String JavaDoc[] includes,
56                           String JavaDoc[] excludes )
57         throws Exception JavaDoc;
58
59     /**
60      * Create a Join ClassLoader for specified ClassLoaders.
61      *
62      * @param classLoaders the ClassLoaders to "join"
63      * @return the joined ClassLoader
64      * @throws Exception if unable to create classloader
65      */

66     ClassLoader JavaDoc createJoinClassLoader( ClassLoader JavaDoc[] classLoaders )
67         throws Exception JavaDoc;
68
69     /**
70      * Create a ClassLoader with specified parent and containing specified
71      * URLs.
72      *
73      * @param parent the parent classloader
74      * @param urls the URLs that the ClassLoader should contain
75      * @return the newly created ClassLoader
76      * @throws Exception if unable to create classloader
77      */

78     ClassLoader JavaDoc createClassLoader( ClassLoader JavaDoc parent, URL JavaDoc[] urls )
79         throws Exception JavaDoc;
80 }
Popular Tags