org.apache.excalibur.source
Interface SourceFactory

All Superinterfaces:
Component
All Known Implementing Classes:
CommonsVFSSourceFactory, FileSourceFactory, FTPSourceFactory, HTTPClientSourceFactory, ResourceSourceFactory, URLSourceFactory

public interface SourceFactory
extends Component

A source factory creates new source objects.

Source factories are used to extend the source resolving mechanism with new URI schemes. A new source factory is added in order to handle a specific prototol. The SourceResolver delegates the handling of a URI containing this new scheme to the factory, and the factory can create a corresponding Source object.

Version:
$Id: SourceFactory.java,v 1.4 2004/02/28 11:47:26 cziegeler Exp $
Author:
Avalon Development Team

Field Summary
static java.lang.String ROLE
           
 
Method Summary
 Source getSource(java.lang.String location, java.util.Map parameters)
          Get a Source object.
 void release(Source source)
          Release a Source object.
 

Field Detail

ROLE

public static final java.lang.String ROLE
Method Detail

getSource

public Source getSource(java.lang.String location,
                        java.util.Map parameters)
                 throws java.io.IOException,
                        java.net.MalformedURLException
Get a Source object. The factory creates a new Source object that can be used by the application. However, when this source object is not needed anymore it has to be released again using the release(Source) method. This is achieved by using SourceResolver.release(Source) which finds the appropriate SourceFactory.

Parameters:
location - The URI to resolve - this URI includes the scheme.
parameters - additionnal named parameters (optionnal and can be null) that drive the creation of the Source object. Each implementation must specify what parameters it accepts.
Returns:
the created source object.
Throws:
java.io.IOException - if the source couldn't be created for some reason.
java.net.MalformedURLException

release

public void release(Source source)
Release a Source object.

Parameters:
source - the source to release.


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