KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > source > SourceResolver


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

8 package org.apache.avalon.excalibur.source;
9
10 import org.apache.avalon.framework.component.Component;
11 import org.apache.avalon.framework.component.ComponentException;
12 import java.io.IOException JavaDoc;
13 import java.net.MalformedURLException JavaDoc;
14 import java.net.URL JavaDoc;
15
16 /**
17  * Base interface for resolving a source by system identifiers.
18  * Instead of using the java.net.URL classes which prevent you
19  * from adding your own custom protocols in a server environment,
20  * you should use this resolver for all URLs.
21  *
22  * The resolver creates for each source a <code>Source</code>
23  * object, which could then be asked for an <code>InputStream</code>
24  * etc.
25  *
26  * When the <code>Source</code> object is no longer needed
27  * it must be released using the resolver. This is very similar like
28  * looking up components from a <code>ComponentManager</code>.
29  * In fact a source object can implement most lifecycle interfaces
30  * like Composable, Initializable, Disposable etc.
31  *
32  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
33  * @version CVS $Revision: 1.8 $ $Date: 2002/01/25 21:12:56 $
34  */

35
36 public interface SourceResolver
37 extends Component {
38
39     String JavaDoc ROLE = "org.apache.avalon.excalibur.source.SourceResolver";
40
41     /**
42      * Get a <code>Source</code> object.
43      */

44     Source resolve(String JavaDoc location)
45     throws MalformedURLException JavaDoc, IOException JavaDoc, ComponentException;
46
47     /**
48      * Get a <code>Source</code> object.
49      */

50     Source resolve(URL JavaDoc base, String JavaDoc location)
51     throws MalformedURLException JavaDoc, IOException JavaDoc, ComponentException;
52
53     /**
54      * Get a <code>Source</code> object.
55      */

56     Source resolve(String JavaDoc location,
57                    SourceParameters parameters)
58     throws MalformedURLException JavaDoc, IOException JavaDoc, ComponentException;
59
60     /**
61      * Get a <code>Source</code> object.
62      */

63     Source resolve(URL JavaDoc base,
64                    String JavaDoc location,
65                    SourceParameters parameters)
66     throws MalformedURLException JavaDoc, IOException JavaDoc, ComponentException;
67
68     /**
69      * Releases a resolved resource
70      */

71     void release( Source source );
72 }
73
74
Popular Tags