|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.app.xmlui.utils.DSpaceValidity
public class DSpaceValidity
This is a validity object specifically implemented for the caching needs of DSpace, Manakin, and Cocoon. The basic idea is that each time a DSpace object rendered by a cocoon component the object and everything about it that makes it unique should be reflected in the validity object for the component. By following this principle if the object has been updated externally then the cache will be invalidated. This DSpaceValidity object makes this processes easier by abstracting out the processes of determining what is unique about a DSpace object. A class is expected to create a new DSpaceValidity object and add() to it all DSpaceObjects that are rendered by the component. This validity object will serialize all those objects to a string, take a hash of the string and compare the hash of the string for any updates.
| Field Summary | |
|---|---|
protected long |
assumedValidityDelay
The length of time that a cache is assumed to be valid |
protected long |
assumedValidityTime
The time when the validity is no longer assumed to be valid |
protected boolean |
completed
Simple flag to note if the object has been completed. |
protected long |
hash
A hash of the validityKey taken after completetion |
protected java.lang.StringBuffer |
validityKey
The validityKey while it is being build, once it is completed. |
| Fields inherited from interface org.apache.excalibur.source.SourceValidity |
|---|
INVALID, UNKNOWN, VALID |
| Constructor Summary | |
|---|---|
DSpaceValidity()
|
|
DSpaceValidity(java.lang.String initialValidityKey)
Create a new DSpace validity object. |
|
| Method Summary | |
|---|---|
void |
add(DSpaceObject dso)
Add a DSpace object to the validity. |
void |
add(java.lang.String nonDSpaceObject)
Add a non DSpaceObject to the validity, the object should be seralized into a string form. |
DSpaceValidity |
complete()
Complete this validity object. |
int |
isValid()
Determine if the cache is still valid |
int |
isValid(org.apache.excalibur.source.SourceValidity otherObject)
Determine if the cache is still valid based upon the other validity object. |
void |
setAssumedValidityDelay(long milliseconds)
Set the time delay for how long this cache will be assumed to be valid. |
void |
setAssumedValidityDelay(java.lang.String delay)
Set the time delay for how long this cache will be assumed to be valid. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.StringBuffer validityKey
protected boolean completed
protected long hash
protected long assumedValidityTime
protected long assumedValidityDelay
| Constructor Detail |
|---|
public DSpaceValidity(java.lang.String initialValidityKey)
initialValidityKey - The initial stringpublic DSpaceValidity()
| Method Detail |
|---|
public DSpaceValidity complete()
public void setAssumedValidityDelay(long milliseconds)
milliseconds - The delay time in millieseconds.public void setAssumedValidityDelay(java.lang.String delay)
delay - The delay time in a variable scale.
public void add(DSpaceObject dso)
throws java.sql.SQLException
dso - The object to add to the validity.
java.sql.SQLException
public void add(java.lang.String nonDSpaceObject)
throws java.sql.SQLException
nonDSpaceObject - The non DSpace object to add to the validity.
java.sql.SQLExceptionpublic int isValid()
isValid in interface org.apache.excalibur.source.SourceValiditypublic int isValid(org.apache.excalibur.source.SourceValidity otherObject)
isValid in interface org.apache.excalibur.source.SourceValidityotherObject - The other validity object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||