eu.semaine.datatypes.stateinfo
Class StateInfo

java.lang.Object
  extended by eu.semaine.datatypes.stateinfo.StateInfo
Direct Known Subclasses:
AgentStateInfo, ContextStateInfo, DialogStateInfo, SystemStateInfo, UserStateInfo

public abstract class StateInfo
extends java.lang.Object

A class representing one of the information states. It can be created either from an XML document or from a Map of information items, and can be read either as an XML document or as a Map of information items.

Author:
marc

Nested Class Summary
static class StateInfo.Type
           
static class StateInfo.XPathInfoMapper
          A helper class that supports us in mapping short names to XPath expressions.
 
Field Summary
static java.lang.String APIVersion
           
protected  org.w3c.dom.Document doc
           
protected  java.util.Map<java.lang.String,java.lang.String> info
           
static java.util.Map<StateInfo.Type,StateInfo.XPathInfoMapper> infosByType
           
protected  JMSLogger log
           
protected  java.lang.String stateName
           
protected  StateInfo.Type type
           
 
Constructor Summary
protected StateInfo(org.w3c.dom.Document doc, java.lang.String whatState, java.lang.String rootName, java.lang.String rootNamespace, StateInfo.Type type)
           
  StateInfo(java.util.Map<java.lang.String,java.lang.String> infoItems, java.lang.String whatState, StateInfo.Type type)
           
 
Method Summary
protected  void analyseDocument(java.lang.String rootName, java.lang.String rootNamespace)
          Read information from the message document and fill our info as much as possible.
protected  void createDocumentFromInfo()
           
 java.lang.String getAPIVersion()
           
 org.w3c.dom.Document getDocument()
           
 java.lang.String getInfo(java.lang.String name)
          Get the named information, or null if there is no such information.
 java.util.Map<java.lang.String,java.lang.String> getInfos()
          Provide a read-only access to the information in this message.
 StateInfo.Type getType()
          Get the type of state info of this object: AgentState, DialogState, UserState, ContextState, or SystemState.
protected static StateInfo.XPathInfoMapper getXPathExpressions(StateInfo.Type typeForTable, java.util.List<java.lang.String> configSection)
           
 boolean hasInfo(java.lang.String name)
          Indicate whether the current info set contains an entry for the named information.
 void setInfo(java.lang.String name, java.lang.String value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

APIVersion

public static final java.lang.String APIVersion
See Also:
Constant Field Values

infosByType

public static final java.util.Map<StateInfo.Type,StateInfo.XPathInfoMapper> infosByType

info

protected java.util.Map<java.lang.String,java.lang.String> info

doc

protected org.w3c.dom.Document doc

log

protected JMSLogger log

stateName

protected java.lang.String stateName

type

protected StateInfo.Type type
Constructor Detail

StateInfo

protected StateInfo(org.w3c.dom.Document doc,
                    java.lang.String whatState,
                    java.lang.String rootName,
                    java.lang.String rootNamespace,
                    StateInfo.Type type)
             throws MessageFormatException
Throws:
MessageFormatException

StateInfo

public StateInfo(java.util.Map<java.lang.String,java.lang.String> infoItems,
                 java.lang.String whatState,
                 StateInfo.Type type)
          throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

getXPathExpressions

protected static StateInfo.XPathInfoMapper getXPathExpressions(StateInfo.Type typeForTable,
                                                               java.util.List<java.lang.String> configSection)
                                                        throws SystemConfigurationException
Throws:
SystemConfigurationException

getType

public StateInfo.Type getType()
Get the type of state info of this object: AgentState, DialogState, UserState, ContextState, or SystemState.

Returns:

createDocumentFromInfo

protected void createDocumentFromInfo()
                               throws SystemConfigurationException
Throws:
SystemConfigurationException

analyseDocument

protected void analyseDocument(java.lang.String rootName,
                               java.lang.String rootNamespace)
                        throws MessageFormatException
Read information from the message document and fill our info as much as possible. If information is found that cannot be interpreted, the code will emit a warning but continue to work.

Throws:
MessageFormatException - if the structure of the document is inconsistent, i.e. structure expectations are violated.

getInfos

public java.util.Map<java.lang.String,java.lang.String> getInfos()
Provide a read-only access to the information in this message. The map contains as keys all information that can be known according to the API version, and as non-null values the values taken from the message. Values for information items not contained in the message will be null.

Returns:
a map with string keys and string values.

hasInfo

public boolean hasInfo(java.lang.String name)
Indicate whether the current info set contains an entry for the named information.

Parameters:
name -
Returns:

getInfo

public java.lang.String getInfo(java.lang.String name)
Get the named information, or null if there is no such information.

Parameters:
name -
Returns:

setInfo

public void setInfo(java.lang.String name,
                    java.lang.String value)

getDocument

public org.w3c.dom.Document getDocument()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAPIVersion

public java.lang.String getAPIVersion()