org.scribble.protocol.monitor
Class DefaultSession

java.lang.Object
  extended by org.scribble.protocol.monitor.DefaultSession
All Implemented Interfaces:
Externalizable, Serializable, Session

public class DefaultSession
extends Object
implements Session, Externalizable

This class represents the default implementation of the conversation interface.

See Also:
Serialized Form

Constructor Summary
  DefaultSession()
          Default constructor.
protected DefaultSession(int returnIndex)
          This constructor is initialized with the return index for use when the nested session completes.
protected DefaultSession(Session main, int returnIndex)
          This constructor is initialized with the return index for use when the nested session completes.
 
Method Summary
 void addNodeIndex(int index)
          This method adds a node index to the session.
 Session createInterruptConversation(Session main, int returnIndex)
          This method creates a nested conversation, associated with an interrupt scope, that should return to the supplied index when it completes.
 Session createNestedConversation(int returnIndex)
          This method creates a nested conversation that should return to the supplied index when it completes.
 List<Session> getInterruptConversations()
          This method returns the list of interrupt conversations.
 List<Session> getNestedConversations()
          This method returns the list of nested conversations.
 int getNodeIndexAt(int pos)
          This method returns the node index at the specified position.
 int getNumberOfNodeIndexes()
          This method returns the number of node indexes associated with the session.
 Session getParentConversation()
          This method returns the parent conversation.
 int getReturnIndex()
          This method retrieves the 'return' index associated with a nested session.
 boolean isFinished()
          This method indicates whether the session has finished.
 void readExternal(ObjectInput ois)
          
 void removeNestedConversation(Session session)
          This method removes the nested session.
 void removeNodeIndexAt(int pos)
          This method removes a node index to the session.
 void setReturnIndex(int returnIndex)
          
 void writeExternal(ObjectOutput oos)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSession

public DefaultSession()
Default constructor.


DefaultSession

protected DefaultSession(int returnIndex)
This constructor is initialized with the return index for use when the nested session completes.

Parameters:
returnIndex - The return index

DefaultSession

protected DefaultSession(Session main,
                         int returnIndex)
This constructor is initialized with the return index for use when the nested session completes.

Parameters:
main - The main session
returnIndex - The return index
Method Detail

addNodeIndex

public void addNodeIndex(int index)
This method adds a node index to the session.

Specified by:
addNodeIndex in interface Session
Parameters:
index - The index

removeNodeIndexAt

public void removeNodeIndexAt(int pos)
This method removes a node index to the session.

Specified by:
removeNodeIndexAt in interface Session
Parameters:
pos - The index

getNumberOfNodeIndexes

public int getNumberOfNodeIndexes()
This method returns the number of node indexes associated with the session.

Specified by:
getNumberOfNodeIndexes in interface Session
Returns:
The number of node indexes

getNodeIndexAt

public int getNodeIndexAt(int pos)
This method returns the node index at the specified position.

Specified by:
getNodeIndexAt in interface Session
Parameters:
pos - The position
Returns:
The node index, or -1 if not found

isFinished

public boolean isFinished()
This method indicates whether the session has finished.

Specified by:
isFinished in interface Session
Returns:
Whether the session has finished

createNestedConversation

public Session createNestedConversation(int returnIndex)
This method creates a nested conversation that should return to the supplied index when it completes.

Specified by:
createNestedConversation in interface Session
Parameters:
returnIndex - The return index
Returns:
The nested session

createInterruptConversation

public Session createInterruptConversation(Session main,
                                           int returnIndex)
This method creates a nested conversation, associated with an interrupt scope, that should return to the supplied index when it completes.

Specified by:
createInterruptConversation in interface Session
Parameters:
main - The main session
returnIndex - The return index
Returns:
The session

getReturnIndex

public int getReturnIndex()
This method retrieves the 'return' index associated with a nested session.

Specified by:
getReturnIndex in interface Session
Returns:
The return index, or -1 if not set

setReturnIndex

public void setReturnIndex(int returnIndex)


getNestedConversations

public List<Session> getNestedConversations()
This method returns the list of nested conversations.

Specified by:
getNestedConversations in interface Session
Returns:
The list of nested conversations

removeNestedConversation

public void removeNestedConversation(Session session)
This method removes the nested session.

Specified by:
removeNestedConversation in interface Session
Parameters:
session - The session to be removed

getParentConversation

public Session getParentConversation()
This method returns the parent conversation.

Specified by:
getParentConversation in interface Session
Returns:
The parent conversation

getInterruptConversations

public List<Session> getInterruptConversations()
This method returns the list of interrupt conversations.

Specified by:
getInterruptConversations in interface Session
Returns:
The interrupt conversations

readExternal

public void readExternal(ObjectInput ois)
                  throws IOException,
                         ClassNotFoundException

Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput oos)
                   throws IOException

Specified by:
writeExternal in interface Externalizable
Throws:
IOException


Copyright © 2008-Present Scribble.org. All Rights Reserved.