Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.conversation
Class AbleConversationPolicyHandlerFactory

    java.lang.Object
      com.ibm.able.conversation.AbleOwned
          com.ibm.able.conversation.AbleConversationPolicyHandlerFactory

All Implemented Interfaces:
  ConversationPolicyHandlerFactory

public class AbleConversationPolicyHandlerFactory
extends AbleOwned
implements ConversationPolicyHandlerFactory

The AbleConversationPolicyHandlerFactory class is an ABLE-specific implementation of the ConversationPolicyHandlerFactory interface.

The ABLE-specific features consist of exception messages and logging and trace-logging mechanisms. The latter are implemented as calls to the appropriate methods on an AbleBean designated as this AbleConversationPolicyHandlerFactory's "owner".

There is also an additional feature, not defined in the ConversationPolicyHandler interface, to find and read graph-layout files for conversation policies. A graph-layout file specifies the positions to assign to the states in a conversation policy state machine, e.g., for displaying the graph.

Field Summary
`static java.lang.String` | `CP_PATH_NAME` Key under which the cpXML file's path name is stored in a CP's property sheet.
`static java.lang.String` | `LAYOUT_PATH_NAME` Key under which the layout file's path name is stored in a CP's property sheet.
`static java.lang.String` | `STATE_MACHINE` Key under which the state machine is stored in a CP's property sheet.

Constructor Summary
`AbleConversationPolicyHandlerFactory()` Constructs an AbleConversationPolicyHandlerFactory object using the default repository path name (".").
`AbleConversationPolicyHandlerFactory(AbleBean newOwner)` Constructs an AbleConversationPolicyHandlerFactory object using the default repository path name (".").
`AbleConversationPolicyHandlerFactory(AbleBean newOwner, java.lang.String newName)` Constructs an AbleConversationPolicyHandlerFactory object using the given repository path name.
`AbleConversationPolicyHandlerFactory(java.lang.String newName)` Constructs an AbleConversationPolicyHandlerFactory object using the given repository path name.

Method Summary
`protected void` | `addConversationPolicy(java.lang.String cpUri)` Creates and initializes a CpStateMachine by reading the cpXML file at the given URI.
`protected void` | `addConversationPolicyLayout(java.lang.String layoutFile)` Adds the given graph-layout file to the property sheet of the conversation policy it's associated with.
`protected java.util.Properties` | `findOrCreatePropertySheet(java.lang.String policyName)` Finds or creates the property sheet for the given conversation policy.
`java.lang.String` | `getLayoutFile(java.lang.String policyName)` Returns the graph-layout file's pathname for the given conversation policy.
`java.lang.String` | `getPartnerRole(java.lang.String policyName, java.lang.String selfRole)` Returns the role taken by an agent's partner in the given CP, if the agent is taking the given role.
`ConversationPolicyHandler` | `getPolicyHandler(java.lang.String cpName, java.lang.String selfRole)` Creates and returns a new ConversationPolicyHandler initialized with the given conversation policy and role.
`java.util.Set` | `getPolicyNames()` Returns the names of the policies this factory is able to create.
`java.lang.Object` | `getProperty(java.lang.String policyName, java.lang.String propertyName)` Returns the object stored under the given name in the property sheet of the given policy.
`java.util.Properties` | `getPropertySheet(java.lang.String policyName)` Returns the property sheet for the policy with the given name.
`java.lang.String` | `getRepositoryPathName()` Returns the repository path name.
`java.util.Collection` | `getRoles(java.lang.String policyName)` Returns the roles defined by the given conversation policy.
`void` | `init()` Loads the conversation policies and graph-layout files found in the directory given by the repository path name.
`boolean` | `isPolicySupported(java.lang.String cpName, java.lang.String selfRole)` Indicates whether the given policy and role is supported.
`void` | `setRepositoryPathName(java.lang.String newName)` Sets the repository path name.

Methods inherited from class com.ibm.able.conversation.AbleOwned
`getAbleOwner, logException, logMessage, setAbleOwner`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### STATE_MACHINE

    public static final java.lang.String STATE_MACHINE

  Key under which the state machine is stored in a CP's property sheet. (The value is stored as a CpStateMachine).

  See Also:
    Constant Field Values

### CP_PATH_NAME

    public static final java.lang.String CP_PATH_NAME

  Key under which the cpXML file's path name is stored in a CP's property sheet. (The value is stored as a String).

  See Also:
    Constant Field Values

### LAYOUT_PATH_NAME

    public static final java.lang.String LAYOUT_PATH_NAME

  Key under which the layout file's path name is stored in a CP's property sheet. (The value is stored as a String).

  See Also:
    Constant Field Values

Constructor Detail

### AbleConversationPolicyHandlerFactory

    public AbleConversationPolicyHandlerFactory()

  Constructs an AbleConversationPolicyHandlerFactory object using the default repository path name (".").

### AbleConversationPolicyHandlerFactory

    public AbleConversationPolicyHandlerFactory(AbleBean newOwner)

  Constructs an AbleConversationPolicyHandlerFactory object using the default repository path name (".").

Parameters:
  `newOwner` - The AbleBean that "owns" this object.

### AbleConversationPolicyHandlerFactory

    public AbleConversationPolicyHandlerFactory(java.lang.String newName)

  Constructs an AbleConversationPolicyHandlerFactory object using the given repository path name.

Parameters:
  `newName` - The repository path name.

### AbleConversationPolicyHandlerFactory

    public AbleConversationPolicyHandlerFactory(AbleBean newOwner,
                                                java.lang.String newName)

  Constructs an AbleConversationPolicyHandlerFactory object using the given repository path name.

Parameters:
  `newOwner` - The AbleBean that "owns" this object.
  `newName` - The repository path name.

Method Detail

### getRepositoryPathName

    public java.lang.String getRepositoryPathName()

  Returns the repository path name.

  This is the directory in which the factory looks for conversation policy files: both cpXML and graph-layout files. The cpXML files are all assumed to have extension ".xml". The graph-layout files are all assumed to have extension ".glf".

  Returns:
    The repository path name.

### setRepositoryPathName

    public void setRepositoryPathName(java.lang.String newName)

  Sets the repository path name.

  This is the directory in which the factory looks for conversation policy files: both cpXML and graph-layout. The cpXML files are all assumed to have extension ".xml". The graph-layout files are all assumed to have extension ".glf".

  When the directory is set, this factory immediately reads all cpXML and graph-layout files found in the directory and builds a state machine for conversation policy found.

  Parameters:
    `newName` - The new repository path name.

### getPolicyNames

    public java.util.Set getPolicyNames()

  Description copied from interface: `ConversationPolicyHandlerFactory`
  Returns the names of the policies this factory is able to create.

  Specified by:
    `getPolicyNames` in interface `ConversationPolicyHandlerFactory`
  Returns:
    The Set of policy names.

### getRoles

    public java.util.Collection getRoles(java.lang.String policyName)

  Description copied from interface: `ConversationPolicyHandlerFactory`
  Returns the roles defined by the given conversation policy.

  Specified by:
    `getRoles` in interface `ConversationPolicyHandlerFactory`
  Parameters:
    `policyName` - The name of the conversation policy.
  Returns:
    A Collection containing the roles, or `null` if the policyName was not found.

### isPolicySupported

    public boolean isPolicySupported(java.lang.String cpName,
                                     java.lang.String selfRole)

  Description copied from interface: `ConversationPolicyHandlerFactory`
  Indicates whether the given policy and role is supported. This is equivalent to whether a ConversationPolicyHandler for the given policy & role can be created.

  Specified by:
    `isPolicySupported` in interface `ConversationPolicyHandlerFactory`
  Returns:
    true if the policy/role is supported, false if not.

### getPropertySheet

    public java.util.Properties getPropertySheet(java.lang.String policyName)

  Returns the property sheet for the policy with the given name.

  Users may add properties to the property sheet as desired. It already contains entries for state machine (under the key `AbleConversationPolicyHandlerFactory.STATE_MACHINE`), the cpXML file's pathname (under key `AbleConversationPolicyHandlerFactory.CP_PATH_NAME`) and the graph-layout file's pathname (under key `AbleConversationPolicyHandlerFactory.LAYOUT_PATH_NAME`). Users should not change these entries.

  Parameters:
    `policyName` - The name of the conversation policy.
  Returns:
    The property sheet for that conversation policy, or `null` if not found.

### getProperty

    public java.lang.Object getProperty(java.lang.String policyName,
                                        java.lang.String propertyName)

  Returns the object stored under the given name in the property sheet of the given policy.

  Parameters:
    `policyName` - The name of the conversation policy.
    `propertyName` - The name of the desired property.
  Returns:
    The Object stored under that property name, or `null` if not found.

### getLayoutFile

    public java.lang.String getLayoutFile(java.lang.String policyName)

  Returns the graph-layout file's pathname for the given conversation policy. Equivalent to `(String)getProperty(policyName, LAYOUT_PATH_NAME);`.

  The graph-layout file gives the locations to assign to the graph's nodes when displaying the graph.

  Parameters:
    `policyName` - The name of the conversation policy
  Returns:
    The path name of the conversation policy's graph-layout file.

### findOrCreatePropertySheet

    protected java.util.Properties findOrCreatePropertySheet(java.lang.String policyName)

  Finds or creates the property sheet for the given conversation policy.

  If a property sheet exists for the given policyName, returns it. If not, creates one, stores it, and returns it. Does not add any of the predefined properties to the newly created sheet.

  Parameters:
    `policyName` - The name of the conversation policy.
  Returns:
    The property sheet for that conversation policy.

### getPartnerRole

    public java.lang.String getPartnerRole(java.lang.String policyName,
                                           java.lang.String selfRole)

  Returns the role taken by an agent's partner in the given CP, if the agent is taking the given role. Assumes that there are just two roles to the CP.

  Parameters:
    `policyName` - The name of the CP in question
    `selfRole` - The role to find the counterpart of.
  Returns:
    The role of the counterpart of an agent playing the given role in the given CP, or `null` if the policy is unknown or the role is undefined.

### init

    public void init()

  Loads the conversation policies and graph-layout files found in the directory given by the repository path name.

  This is not done at creation time, in case the repository path isn't known until later. It is done automatically every time the repository path is set, however.

### getPolicyHandler

    public ConversationPolicyHandler getPolicyHandler(java.lang.String cpName,
                                                      java.lang.String selfRole)

  Description copied from interface: `ConversationPolicyHandlerFactory`
  Creates and returns a new ConversationPolicyHandler initialized with the given conversation policy and role.

  If there is no known policy with the given name, or if the role does not match one of the roles defined in the policy, returns `null`.

  Specified by:
    `getPolicyHandler` in interface `ConversationPolicyHandlerFactory`
  Parameters:
    `cpName` - The name of the conversation policy to be used.
    `selfRole` - The role to play in the conversation policy.
  Returns:
    The new ConversationPolicyHandler, or `null` if creation failed.

### addConversationPolicy

    protected void addConversationPolicy(java.lang.String cpUri)

  Creates and initializes a CpStateMachine by reading the cpXML file at the given URI.

  Parameters:
    `cpUri` - The URI of the cpXML file.

### addConversationPolicyLayout

    protected void addConversationPolicyLayout(java.lang.String layoutFile)

  Adds the given graph-layout file to the property sheet of the conversation policy it's associated with.

  Parameters:
    `layoutFile` - The filename of the graph-layout file.

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005