org.wegra.util.resource
Class CachedResourceLoader

java.lang.Object
  extended byorg.wegra.util.resource.CachedResourceLoader
All Implemented Interfaces:
ResourceLoader

public class CachedResourceLoader
extends java.lang.Object
implements ResourceLoader

ResourceLoader that loads from specified loader and uses a cache. You can specify your own cache. if you don't specify cache it will use GenericCache that never return resource until cache is referenced.

Version:
1.0, 07/04/2002
Author:
wegra(Bok-Youn Lee)

Field Summary
protected  Cache fCache
           
protected  ResourceLoader fLoader
           
 
Constructor Summary
CachedResourceLoader(ResourceLoader loader)
          Creates a CachedResourceLoader that loads from the specified loader and uses default cache.
CachedResourceLoader(ResourceLoader loader, Cache cache)
          Creates a CachedResourceLoader that loads from the specified loader and uses specified cache.
 
Method Summary
 java.lang.Object getResource(java.lang.Object key)
          Loads specified resource.
 java.lang.Object getResource(java.lang.String location)
          Loads specified resource.
 java.lang.Object[] getResources(java.lang.Object baseKey)
          Loads sub resources of specified baseKey.
 java.lang.Object[] getResources(java.lang.String baseLocation)
          Loads sub resources of specified baseLocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLoader

protected ResourceLoader fLoader

fCache

protected Cache fCache
Constructor Detail

CachedResourceLoader

public CachedResourceLoader(ResourceLoader loader)
Creates a CachedResourceLoader that loads from the specified loader and uses default cache.

Parameters:
loader - loader to read from.

CachedResourceLoader

public CachedResourceLoader(ResourceLoader loader,
                            Cache cache)
Creates a CachedResourceLoader that loads from the specified loader and uses specified cache.

Parameters:
loader - loader to read from.
cache - cache to use.
Method Detail

getResource

public java.lang.Object getResource(java.lang.Object key)
                             throws ResourceLoaderException
Loads specified resource.

Specified by:
getResource in interface ResourceLoader
Parameters:
key - key of resource.
Returns:
loaded resource.
Throws:
ResourceLoaderException

getResource

public java.lang.Object getResource(java.lang.String location)
                             throws ResourceLoaderException
Loads specified resource.

Specified by:
getResource in interface ResourceLoader
Parameters:
location - resource location.
Returns:
loaded resource.
Throws:
ResourceLoaderException

getResources

public java.lang.Object[] getResources(java.lang.Object baseKey)
                                throws ResourceLoaderException
Loads sub resources of specified baseKey.

Specified by:
getResources in interface ResourceLoader
Parameters:
baseKey - base key of resource.
Returns:
loaded resources.
Throws:
ResourceLoaderException

getResources

public java.lang.Object[] getResources(java.lang.String baseLocation)
                                throws ResourceLoaderException
Loads sub resources of specified baseLocation.

Specified by:
getResources in interface ResourceLoader
Parameters:
baseLocation - base location of resource.
Returns:
loaded resources.
Throws:
ResourceLoaderException