org.sapia.resource
Interface ResourceHandler

All Known Implementing Classes:
ClasspathResourceHandler, FileResourceHandler, UrlResourceHandler

public interface ResourceHandler

Specifies the behavior of classes used to resolve resources.

Author:
Yanick Duchesne

Method Summary
 boolean accepts(String uri)
          Returns true if this handler "recognizes" resources with the given URI.
 boolean accepts(URI uri)
           
 InputStream getResource(String uri)
          Returns the stream corresponding to the given URI.
 Resource getResourceObject(String uri)
          Returns the resource object corresponding to the given URI.
 

Method Detail

getResource

InputStream getResource(String uri)
                        throws IOException,
                               ResourceNotFoundException
Returns the stream corresponding to the given URI.

Parameters:
uri - a URI.
Returns:
an InputStream.
Throws:
ResourceNotFoundException - if a resource corresponding to the URI could does not exist.
IOException - if a problem occurs.

getResourceObject

Resource getResourceObject(String uri)
                           throws IOException
Returns the resource object corresponding to the given URI.

Parameters:
uri - a URI.
Returns:
a Resource.
Throws:
IOException - if a problem occurs.

accepts

boolean accepts(String uri)
Returns true if this handler "recognizes" resources with the given URI. This methods is used to hold resource handlers in a chain of responsability.

Parameters:
uri - a URI.
Returns:
true if this handler can handle resources with the given URI.

accepts

boolean accepts(URI uri)
Parameters:
uri - a URI.
Returns:
true if this handler can handle resources with the given URI.
See Also:
accepts(String)


Copyright © 2007 Sapia Open Community, Inc. All Rights Reserved.