|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.cache.PlainResource
public class PlainResource
A plain implementation of CachedResource supporting file and URL resources but no caching of content.
| Constructor Summary | |
|---|---|
PlainResource(String name,
Object src)
Constructs a new resource. |
|
| Method Summary | |
|---|---|
void |
activated(CachedEntryEvent event)
Notifies the object that it has been activated to the cache. |
void |
expired(CachedEntryEvent event)
Notifies the object that it has been expired from the cache. |
long |
getCheckInterval()
Gets the interval of checking validity of the resource. |
byte[] |
getContents()
Gets the contents of the resource as bytes. |
protected byte[] |
getContents(InputStream in)
Gets the contents from the specified stream as bytes. |
InputStream |
getInputStream()
Gets the resource as a stream. |
long |
getLastModified()
Gets the resource modification time. |
long |
getLength()
Gets the length of the resource. |
String |
getName()
Gets the name of the resource. |
String |
getPath()
Gets the path of the resource. |
int |
getSizeLimit()
Gets the size limit for a cached resource. |
Object |
getSource()
Gets the source of the resource. |
boolean |
isDeleteOnRelease()
Checks whether the resource source should be deleted on release. |
boolean |
isValid()
Checks whether the original resource is still valid. |
void |
passivated(CachedEntryEvent event)
Notifies the object that it has been passivated from the cache. |
void |
release()
Releases the cached resource. |
void |
setCheckInterval(long msecs)
Sets the interval of checking validity of the resource. |
void |
setDeleteOnRelease(boolean flag)
Sets whether the resource source should be deleted on release. |
void |
setPath(String path)
Sets the path of the resource. |
void |
setSizeLimit(int limit)
Sets a size limit for a resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PlainResource(String name,
Object src)
name - the name.src - the source.| Method Detail |
|---|
public String getName()
Resource
getName in interface Resourcepublic Object getSource()
Resource
getSource in interface Resourcepublic long getLength()
Resource
getLength in interface Resourcepublic long getLastModified()
Resource
getLastModified in interface Resourcepublic long getCheckInterval()
Resource
getCheckInterval in interface Resourcepublic void setCheckInterval(long msecs)
Resource
setCheckInterval in interface Resourcemsecs - the check interval in milliseconds (-1 = only once).public boolean isDeleteOnRelease()
Resource
isDeleteOnRelease in interface Resourcepublic void setDeleteOnRelease(boolean flag)
Resource
setDeleteOnRelease in interface Resourceflag - true if to be deleted, false otherwise.public int getSizeLimit()
Resource
getSizeLimit in interface Resourcepublic void setSizeLimit(int limit)
Resource
setSizeLimit in interface Resourcelimit - a limit for a resource size in bytes (-1 = unlimited).public String getPath()
Resource
getPath in interface Resourcepublic void setPath(String path)
Resource
setPath in interface Resourcepath - the path of the resource.
public InputStream getInputStream()
throws IOException
Resource
getInputStream in interface ResourceIOException - on I/O errors.
public byte[] getContents()
throws IOException
Resource
getContents in interface ResourceIOException - on I/O errors.public boolean isValid()
Resource
isValid in interface Resourcepublic void release()
Resource
release in interface Resourcepublic void expired(CachedEntryEvent event)
CacheListener
expired in interface CacheListenerevent - the cached entry event.public void passivated(CachedEntryEvent event)
CacheListener
passivated in interface CacheListenerevent - the cached entry event.public void activated(CachedEntryEvent event)
CacheListener
activated in interface CacheListenerevent - the cached entry event.
protected byte[] getContents(InputStream in)
throws IOException
in - the input stream to read from.
IOException - on I/O errors.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||