|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ResourceLoader
Loads resources, from somewhere.
This is a service provider interface (SPI) for JSilver. Users of JSilver can easily create their
own implementations. However, it is recommended that new implementations don't implement this
interface directly, but instead extends BaseResourceLoader
. This allows API changes to be
made to JSilver that maintain compatibility with existing ResourceLoader implementations.
BaseResourceLoader
,
InMemoryResourceLoader
,
FileSystemResourceLoader
,
ClassLoaderResourceLoader
,
ClassResourceLoader
Method Summary | |
---|---|
void |
close(Reader reader)
Close the reader. |
Object |
getKey(String filename)
Returns an object that can be used to uniquely identify the file corresponding to the given file name in the context of this ResourceLoader. |
Object |
getResourceVersionId(String name)
Returns an object that can be used to identify when a resource has changed. |
Reader |
open(String name)
Open a resource. |
Reader |
openOrFail(String name)
Open a resource or throw an exception if no such resource is found. |
Method Detail |
---|
Reader open(String name) throws IOException
close(Reader)
when done with the
reader.
name
- the name of the resource
IOException
- if resource fails to openReader openOrFail(String name) throws JSilverTemplateNotFoundException, IOException
close(Reader)
when done with the
reader.
name
- the name of the resource
JSilverTemplateNotFoundException
- if resource is not found
IOException
- if resource fails to openvoid close(Reader reader) throws IOException
reader
- the reader to close
IOException
- if reader fasils to closeObject getKey(String filename)
filename
- the name we want to identify
Object getResourceVersionId(String name)
Object.equals(Object)
and
Object.hashCode()
.
If the ResourceLoader does not or cannot compute a version identifier then it is sufficient to
always return the same Object, e.g. the resource name. Null, however, should only be returned
if a call to open(String)
would also return null.
name
- the name of the resource to check for resources
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |