org.norther.tammi.spray.engine.resource
Class AbstractResourceResolver.AbstractResource

java.lang.Object
  extended by org.norther.tammi.core.cache.PlainResource
      extended by org.norther.tammi.spray.engine.resource.AbstractResourceResolver.AbstractResource
All Implemented Interfaces:
Serializable, EventListener, CacheListener, Resource
Enclosing class:
AbstractResourceResolver

protected abstract class AbstractResourceResolver.AbstractResource
extends PlainResource
implements Resource

An abstract resource.

See Also:
Serialized Form

Constructor Summary
protected AbstractResourceResolver.AbstractResource(String name, Object src)
          Constructs a new resource.
 
Method Summary
 boolean equals(Object object)
           
 long getCheckInterval()
          Gets the interval of checking validity of the resource.
 InputStream getInputStream()
          Gets the resource as a stream.
protected abstract  InputStream getInputStream(Object src)
          Implements getting of the source specific input stream.
 long getLastModified()
          Gets the resource modification time.
 long getLength()
          Gets the length of the resource.
 int getSizeLimit()
          Gets the size limit for a cached resource.
 int hashCode()
           
 boolean isValid()
          Checks whether the original resource is still valid.
 void release()
          Releases the cached resource.
 void setCheckInterval(long range)
          Sets the interval of checking validity of the resource.
 void setSizeLimit(int lim)
          Sets a size limit for a resource.
 
Methods inherited from class org.norther.tammi.core.cache.PlainResource
activated, expired, getContents, getContents, getName, getPath, getSource, isDeleteOnRelease, passivated, setDeleteOnRelease, setPath
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.cache.Resource
getContents, getName, getPath, getSource, isDeleteOnRelease, setDeleteOnRelease, setPath
 

Constructor Detail

AbstractResourceResolver.AbstractResource

protected AbstractResourceResolver.AbstractResource(String name,
                                                    Object src)
Constructs a new resource.

Parameters:
name - the resource.
src - the source.
Method Detail

getLength

public long getLength()
Description copied from interface: Resource
Gets the length of the resource.

Specified by:
getLength in interface Resource
Overrides:
getLength in class PlainResource
Returns:
the resource length or -1 if not known.

getLastModified

public long getLastModified()
Description copied from interface: Resource
Gets the resource modification time.

Specified by:
getLastModified in interface Resource
Overrides:
getLastModified in class PlainResource
Returns:
the resource modification time.

getCheckInterval

public long getCheckInterval()
Description copied from interface: Resource
Gets the interval of checking validity of the resource.

Specified by:
getCheckInterval in interface Resource
Overrides:
getCheckInterval in class PlainResource
Returns:
the check interval in milliseconds.

setCheckInterval

public void setCheckInterval(long range)
Description copied from interface: Resource
Sets the interval of checking validity of the resource.

Specified by:
setCheckInterval in interface Resource
Overrides:
setCheckInterval in class PlainResource
Parameters:
range - the check interval in milliseconds (-1 = only once).

getSizeLimit

public int getSizeLimit()
Description copied from interface: Resource
Gets the size limit for a cached resource.

Specified by:
getSizeLimit in interface Resource
Overrides:
getSizeLimit in class PlainResource
Returns:
the limit for a resource size in bytes.

setSizeLimit

public void setSizeLimit(int lim)
Description copied from interface: Resource
Sets a size limit for a resource.

Specified by:
setSizeLimit in interface Resource
Overrides:
setSizeLimit in class PlainResource
Parameters:
lim - a limit for a resource size in bytes (-1 = unlimited).

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from interface: Resource
Gets the resource as a stream.

Specified by:
getInputStream in interface Resource
Overrides:
getInputStream in class PlainResource
Returns:
the resource as a stream.
Throws:
IOException - on I/O errors.

isValid

public boolean isValid()
Description copied from interface: Resource
Checks whether the original resource is still valid.

Specified by:
isValid in interface Resource
Overrides:
isValid in class PlainResource
Returns:
true for a valid resource, otherwise false.

release

public void release()
Description copied from interface: Resource
Releases the cached resource.

Specified by:
release in interface Resource
Overrides:
release in class PlainResource

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getInputStream

protected abstract InputStream getInputStream(Object src)
                                       throws IOException
Implements getting of the source specific input stream.

Parameters:
src - the resource source.
Returns:
the source specific input stream.
Throws:
IOException - on I/O errors.


Copyright © 2004 The Norther Organization. All rights reserved.