|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.components.flow.WebContinuation
public class WebContinuation
Representation of continuations in a Web environment.
Because a user may click on the back button of the browser and
restart a saved computation in a continuation, each
WebContinuation
becomes the parent of a subtree of
continuations.
If there is no parent WebContinuation
, the created
continuation becomes the root of a tree of
WebContinuation
s.
Field Summary | |
---|---|
protected List |
children
The children continuations. |
protected Object |
continuation
The continuation this object represents. |
protected ContinuationsDisposer |
disposer
Holds the ContinuationsDisposer to call when this continuation
gets invalidated. |
protected String |
id
The continuation id used to represent this instance in Web pages. |
protected String |
interpreterId
Interpreter id that this continuation is bound to |
protected long |
lastAccessTime
When was this continuation accessed last time. |
protected WebContinuation |
parentContinuation
The parent WebContinuation from which processing
last started. |
protected int |
timeToLive
Indicates how long does this continuation will live (in seconds). |
protected Object |
userObject
A user definable object. |
Method Summary | |
---|---|
Object |
clone()
Creates a clone of this WebContinuation without trying to clone the actual continuation, the user object or the disposer. |
int |
compareTo(Object other)
Compares the expiration time of this instance with that of the WebContinuation passed as argument. |
void |
detachFromParent()
|
protected String |
display(int depth)
Debugging method. |
void |
dispose()
Dispose this continuation. |
boolean |
disposed()
Return true if this continuation was disposed of |
boolean |
equals(Object another)
True if the identifiers are the same, false otherwise. |
Object |
getAttribute(String name)
Get an attribute of this continuation |
Enumeration |
getAttributeNames()
Enumerate the attributes of this continuation. |
List |
getChildren()
Return the children WebContinuation which were
created as a result of resuming the processing from the current
continuation . |
Object |
getContinuation()
Return the continuation object. |
WebContinuation |
getContinuation(int level)
Return the ancestor continuation situated level s
above the current continuation. |
String |
getId()
Returns the string identifier of this WebContinuation . |
String |
getInterpreterId()
Returns the string identifier of the interpreter to which this WebContinuation is bound. |
long |
getLastAccessTime()
Returns the last time this WebContinuation was accessed. |
WebContinuation |
getParentContinuation()
Return the parent WebContinuation . |
long |
getTimeToLive()
Returns the the timetolive for this WebContinuation . |
Object |
getUserObject()
Obtains the user object associated with this instance. |
boolean |
hasExpired()
Determines whether this continuation has expired |
int |
hashCode()
Returns the hash code of the associated identifier. |
boolean |
interpreterMatches(String interpreterId)
|
void |
removeAttribute(String name)
Remove an attribute of this continuation |
void |
setAttribute(String name,
Object value)
Set an attribute of this continuation |
void |
setUserObject(Object obj)
Sets the user object associated with this instance. |
String |
toString()
Debugging method. |
protected void |
updateLastAccessTime()
Update the continuation in the |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Object continuation
protected WebContinuation parentContinuation
WebContinuation
from which processing
last started. If null, there is no parent continuation
associated, and this is the first one to be created in a
processing. In this case this WebContinuation
instance becomes the root of the tree maintained by the
ContinuationsManager
.
ContinuationsManager
protected List children
continuation
.
protected String id
protected String interpreterId
protected Object userObject
WebContinuation
a particular implementation might
need.
protected long lastAccessTime
protected int timeToLive
lastAccessTime + timeToLive
.
protected ContinuationsDisposer disposer
ContinuationsDisposer
to call when this continuation
gets invalidated.
Method Detail |
---|
public Object getAttribute(String name)
name
- the attribute name.public void setAttribute(String name, Object value)
name
- the attribute namevalue
- its valuepublic void removeAttribute(String name)
name
- the attribute namepublic Enumeration getAttributeNames()
public Object getContinuation()
Object
valuepublic WebContinuation getContinuation(int level)
level
s
above the current continuation. The current instance is
considered to be at level 0. The parent continuation of the
receiving instance at level 1, its parent is at level 2 relative
to the receiving instance. If level
is bigger than
the depth of the tree, the root of the tree is returned.
level
- an int
value
WebContinuation
valuepublic WebContinuation getParentContinuation()
WebContinuation
. Equivalent with
getContinuation(1)
.
WebContinuation
valuepublic List getChildren()
WebContinuation
which were
created as a result of resuming the processing from the current
continuation
.
List
valuepublic String getId()
WebContinuation
.
String
valuepublic String getInterpreterId()
WebContinuation
is bound.
String
valuepublic long getLastAccessTime()
WebContinuation
was accessed.
long
valuepublic long getTimeToLive()
WebContinuation
.
long
valuepublic void setUserObject(Object obj)
obj
- an Object
valuepublic Object getUserObject()
Object
valuepublic int hashCode()
hashCode
in class Object
int
valuepublic boolean equals(Object another)
equals
in class Object
another
- an Object
value
boolean
valuepublic int compareTo(Object other)
Note: this class has a natural ordering that is
inconsistent with equals
.
compareTo
in interface Comparable
other
- an Object
value, which should be a
WebContinuation
instance
int
valueprotected void updateLastAccessTime()
public boolean hasExpired()
boolean
valuepublic void dispose()
public boolean disposed()
public boolean interpreterMatches(String interpreterId)
public void detachFromParent()
public Object clone()
Cloneable
or
Serializable
.
clone
in class Object
public String toString()
Assumes the receiving instance as the root of a tree and displays the tree of continuations.
toString
in class Object
protected String display(int depth)
Displays the receiving instance as if it is at the
indent
depth in the tree of continuations. Each
level is indented 2 spaces.
depth
- an int
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |