com.uwyn.rife.continuations
Class ContinuationManager<T extends ContinuableObject>

java.lang.Object
  extended by com.uwyn.rife.continuations.ContinuationManager<T>

public class ContinuationManager<T extends ContinuableObject>
extends Object

Manages a collection of ContinuationContext instances.

A ContinuationManager instance is typically associated with a specific context, like for example a Site for RIFE's web engine. It's up to you to provide an API to your users if you want them to be able to interact with the appropriate continuations manager. For instance, in RIFE, to gain access to the ContinuationManager of an active ElementSupport instance, the following code can be used: getElementInfo().getSite().getContinuationManager(). Your application or library will have to provide its own.

Since:
1.6
Version:
$Revision: 3812 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)
See Also:
ContinuationManager

Constructor Summary
ContinuationManager(ContinuationConfigRuntime config)
          Instantiates a new continuation manager and uses the default values for the continuations duration and purging.
 
Method Summary
 void addContext(ContinuationContext<T> context)
          Adds a particular ContinuationContext to this manager.
 ContinuationConfigRuntime getConfigRuntime()
          Retrieves the runtime configuration that was provided to the manager at instantiation.
 ContinuationContext<T> getContext(String id)
          Retrieves a ContinuationContext instance from this continuation manager.
 boolean isExpired(ContinuationContext<T> context)
          Checks if a particular continuation context is expired.
 void removeContext(String id)
          Removes a ContinuationContext instance from this continuation manager.
 ContinuationContext<T> resumeContext(String id)
          Creates a new ContinuationContext from an existing one so that the execution can be resumed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContinuationManager

public ContinuationManager(ContinuationConfigRuntime config)
Instantiates a new continuation manager and uses the default values for the continuations duration and purging.

Parameters:
config - the runtime configuration that will be used be this manager
Since:
1.6
Method Detail

getConfigRuntime

public ContinuationConfigRuntime getConfigRuntime()
Retrieves the runtime configuration that was provided to the manager at instantiation.

Returns:
this manager's runtime configuration
Since:
1.6

isExpired

public boolean isExpired(ContinuationContext<T> context)
Checks if a particular continuation context is expired.

Parameters:
context - the context that needs to be verified
Returns:
true if the continuation context is expired; and

false otherwise

Since:
1.6
See Also:
RifeConfig.Engine.getContinuationDuration()

addContext

public void addContext(ContinuationContext<T> context)
Adds a particular ContinuationContext to this manager.

Parameters:
context - the context that will be added
Since:
1.6

removeContext

public void removeContext(String id)
Removes a ContinuationContext instance from this continuation manager.

Parameters:
id - the unique string that identifies the ContinuationContext instance that will be removed
Since:
1.6
See Also:
getContext(java.lang.String)

resumeContext

public ContinuationContext<T> resumeContext(String id)
                                                               throws CloneNotSupportedException
Creates a new ContinuationContext from an existing one so that the execution can be resumed.

If the existing continuation context couldn't be found, no new one can be created. However, if it could be found, the result of ContinuationConfigRuntime.cloneContinuations(T) will determine whether the existing continuation context will be cloned to create the new one, or if its state will be reused.

The new continuation context will have its own unique ID.

Parameters:
id - the ID of the existing continuation context
Returns:
the new ContinuationContext; or

null if the existing continuation context couldn't be found

Throws:
CloneNotSupportedException
Since:
1.6

getContext

public ContinuationContext<T> getContext(String id)
Retrieves a ContinuationContext instance from this continuation manager.

Parameters:
id - the unique string that identifies the ContinuationContext instance that has to be retrieved
Returns:
the ContinuationContext instance that corresponds to the provided identifier; or

null if the identifier isn't known by the continuation manager.

Since:
1.6
See Also:
removeContext(java.lang.String)


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.