org.apache.excalibur.source
Interface SourceResolver

All Superinterfaces:
Component
All Known Implementing Classes:
SourceResolverImpl

public interface SourceResolver
extends Component

Base interface for resolving a source by system identifiers. Instead of using the java.net.URL classes which prevent you from adding your own custom protocols in a server environment, you should use this resolver for all URLs. The resolver creates for each source a Source object, which could then be asked for an InputStream etc. When the Source object is no longer needed it must be released using the resolver. This is very similar like looking up components from a ComponentLocator. In fact a source object can implement most lifecycle interfaces like Composable, Initializable, Disposable etc.

Version:
CVS $Revision: 1.7 $ $Date: 2004/02/28 11:47:26 $
Author:
Avalon Development Team

Field Summary
static java.lang.String METHOD
          With this parameter you can specify the method to use for getting the content.
static java.lang.String ROLE
           
static java.lang.String URI_ENCODING
          With this parameter you can specify the encoding to use for encoding the additional request parameters the URI.
static java.lang.String URI_PARAMETERS
          With this parameter you can specify additional request parameters which are appended to the URI.
 
Method Summary
 void release(Source source)
          Releases a resolved resource.
 Source resolveURI(java.lang.String location)
          Get a Source object.
 Source resolveURI(java.lang.String location, java.lang.String base, java.util.Map parameters)
          Get a Source object.
 

Field Detail

ROLE

public static final java.lang.String ROLE

METHOD

public static final java.lang.String METHOD
With this parameter you can specify the method to use for getting the content. It is up to the protocol implementation (SourceFactory) to support this or not


URI_PARAMETERS

public static final java.lang.String URI_PARAMETERS
With this parameter you can specify additional request parameters which are appended to the URI. It is up to the protocol implementation (SourceFactory) to support this or not.


URI_ENCODING

public static final java.lang.String URI_ENCODING
With this parameter you can specify the encoding to use for encoding the additional request parameters the URI. It is up to the protocol implementation (SourceFactory) to support this or not.

Method Detail

resolveURI

public Source resolveURI(java.lang.String location)
                  throws java.net.MalformedURLException,
                         java.io.IOException
Get a Source object. This is a shortcut for (String, String, Map).

Returns:
the resolved source object.
Throws:
java.net.MalformedURLException - if location is malformed.
java.io.IOException - if the source couldn't be created for some other reason.

resolveURI

public Source resolveURI(java.lang.String location,
                         java.lang.String base,
                         java.util.Map parameters)
                  throws java.net.MalformedURLException,
                         java.io.IOException
Get a Source object.

Parameters:
location - - the URI to resolve. If this is relative it is either resolved relative to the base parameter (if not null) or relative to a base setting of the source resolver itself.
base - - a base URI for resolving relative locations. This is optional and can be null.
parameters - - Additional parameters for the URI. The parameters are specific to the used scheme.
Returns:
the resolved source object.
Throws:
java.net.MalformedURLException - if location is malformed.
java.io.IOException - if the source couldn't be created for some other reason.

release

public void release(Source source)
Releases a resolved resource.

Parameters:
source - the source to release.


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.