org.apache.shale.dialog.basic.config
Class DialogImpl

java.lang.Object
  extended by org.apache.shale.dialog.basic.config.DialogImpl
All Implemented Interfaces:
Dialog

public final class DialogImpl
extends Object
implements Dialog

DialogImpl is a basic implementation of Dialog.

Since:
1.0.4

Constructor Summary
DialogImpl()
           
 
Method Summary
 void addState(State state)
          Add the specified State to the States owned by this Dialog.
 void addTransition(Transition transition)
          Add the specified Transition to the global Transitions associated with this Dialog.
 State findState(String id)
          Return the specified State, owned by this Dialog, if any.
 Transition findTransition(String outcome)
          Return the global Transition for the specified logical outcome, if any; otherwise, return null.
 Class getDataClass()
          Return the class of a JavaBean to be instantiated as the initial value of the data property of a newly instantiated DialogContext.
 String getDataClassName()
          Return the data class name for the data property of a newly instantiated DialogContext.
 String getName()
          Return the name of this Dialog.
 String getStart()
          Return the name of the starting State for this Dialog.
 Iterator getStateIds()
          Return an Iterator over the names of States that are owned by this Dialog.
 Iterator getTransitionOutcomes()
          Return an Iterator over the logical outcomes of global Transitions for this Dialog.
 void removeState(State state)
          Remove the specified State from the States owned by this Dialog, if it is currently registered.
 void removeTransition(Transition transition)
          Remove the specified Transition from the global Transitions associated with this Dialog, if it is currently registered.
 void setDataClassName(String dataClassName)
          Set the data class name for the data property of a newly instantiated DialogContext.
 void setName(String name)
          Set the name of this Dialog.
 void setStart(String start)
          Set the name of the starting State for this Dialog.
 String toString()
          Render a printable version of this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DialogImpl

public DialogImpl()
Method Detail

getDataClass

public Class getDataClass()

Return the class of a JavaBean to be instantiated as the initial value of the data property of a newly instantiated DialogContext.

Specified by:
getDataClass in interface Dialog
Returns:
The JavaBean class whose instance becomes the data property of a new instance of this dialog

getName

public String getName()

Return the name of this Dialog.

Specified by:
getName in interface Dialog
Returns:
The name of this Dialog

getStart

public String getStart()

Return the name of the starting State for this Dialog.

Specified by:
getStart in interface Dialog
Returns:
The starting state associated with this Dialog

getStateIds

public Iterator getStateIds()

Return an Iterator over the names of States that are owned by this Dialog. If there are no such States, an empty Iterator is returned.

Specified by:
getStateIds in interface Dialog
Returns:
An Iterator over all the States in this Dialog

getTransitionOutcomes

public Iterator getTransitionOutcomes()

Return an Iterator over the logical outcomes of global Transitions for this Dialog. If there are no such Transitions, an empty Iterator is returned.

Specified by:
getTransitionOutcomes in interface Dialog
Returns:
An Iterator over the logical outcomes of global Transitions for this Dialog

findState

public State findState(String id)

Return the specified State, owned by this Dialog, if any. Otherwise, return null.

Specified by:
findState in interface Dialog
Parameters:
id - Identifier of the requested State
Returns:
The State specified by the identifier, may be null

findTransition

public Transition findTransition(String outcome)

Return the global Transition for the specified logical outcome, if any; otherwise, return null.

Specified by:
findTransition in interface Dialog
Parameters:
outcome - Logical outcome for which to return a Transition
Returns:
The global Transition for the specified logical outcome

toString

public String toString()

Render a printable version of this instance.

Overrides:
toString in class Object
Returns:
A printable version of this instance

addState

public void addState(State state)
              throws IllegalArgumentException

Add the specified State to the States owned by this Dialog.

Parameters:
state - State to be added
Throws:
IllegalArgumentException - if there is already a State with the specified id owned by this Dialog

addTransition

public void addTransition(Transition transition)
                   throws IllegalArgumentException

Add the specified Transition to the global Transitions associated with this Dialog.

Parameters:
transition - Transition to be added
Throws:
IllegalArgumentException - if the specified Transition cannot be added to this State

getDataClassName

public String getDataClassName()

Return the data class name for the data property of a newly instantiated DialogContext.

Returns:
The fully qualified class name whose instance becomes the data property of a new instance of this dialog

setDataClassName

public void setDataClassName(String dataClassName)

Set the data class name for the data property of a newly instantiated DialogContext.

Parameters:
dataClassName - New data class name
Throws:
Exception - if the specified class name cannot be loaded

setName

public void setName(String name)

Set the name of this Dialog.

Parameters:
name - New name

setStart

public void setStart(String start)

Set the name of the starting State for this Dialog.

Parameters:
start - Name of the starting State

removeState

public void removeState(State state)

Remove the specified State from the States owned by this Dialog, if it is currently registered. Otherwise, do nothing.

Parameters:
state - State to be removed

removeTransition

public void removeTransition(Transition transition)

Remove the specified Transition from the global Transitions associated with this Dialog, if it is currently registered. Otherwise, do nothing.

Parameters:
transition - Transition to be removed


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.