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 AbleRemoteUdfDecisionLogicAdapter

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

All Implemented Interfaces:
  DecisionLogicAdapter

public class AbleRemoteUdfDecisionLogicAdapter
extends AbleOwned
implements DecisionLogicAdapter

The AbleRemoteUdfDecisionLogicAdapter uses ABLE's user-defined functions (UDFs)--cf. `AbleUserDefinedFunction`--as the means of passing inputs to the agent's decision logic.

It contains a mapping from conversational contexts to names of user-defined functions, and a reference to an AbleUserDefinedFunctionManager--which is, in general, the agent that owns this DecisionLogicAdapter. When an AbleRemoteUdfDecisionLogicAdapter receives decision data from a Conversation, it uses the mapping to find the name of a user-defined function to invoke, then it uses the AbleUserDefinedFunctionManager to invoke that user-defined function.

Each of these user-defined functions must take parameters `(Conversation, DecisionDataHandle)`

The mapping from conversation contexts to names is highly constrained. The only parts of the conversational context used are the name and current state of the active conversation policy.

In addition to table entries for the decision data names, there are two special user-defined function names that must be supplied:

- A user-defined function for handling all "timeout" inputs. It must take parameters `(Conversation, String)`.
- A user-defined function for handling all "unexpected message" inputs. It must take parameters `(Conversation, MessageHandle)`.

Constructor Summary
`AbleRemoteUdfDecisionLogicAdapter()` Constructs an AbleRemoteUdrDecisionLogicAdapter object.
`AbleRemoteUdfDecisionLogicAdapter(AbleBean newOwner, AbleUserDefinedFunctionRemoteManager newMgr)` Constructs an AbleRemoteUdrDecisionLogicAdapter object.
`AbleRemoteUdfDecisionLogicAdapter(AbleUserDefinedFunctionRemoteManager newMgr)` Constructs an AbleRemoteUdrDecisionLogicAdapter object.

Method Summary
`void` | `createTarget(java.lang.String cpName, java.lang.String callbackName, java.lang.Object target)` Helper routine to create and register as a UDF the given target for the given decision callback.
`AbleUserDefinedFunction` | `createUdf(java.lang.String udfName, java.lang.Object targetObject, java.lang.String targetMethodName, java.lang.Class[] targetArgTypes)` Helper routine to create a new UDF and register it with the UDF Manager.
`void` | `decisionPoint(Conversation conv, DecisionDataHandle ddh)` Looks up and invokes the user-defined function associated with the Conversation's current context.
`java.lang.String` | `getDefaultDecisionUdfName()` Returns the name of the user-defined function to invoke as a last resort on "decision point" and "inbound data" inputs, when there is no appropriate table entry.
`java.lang.String` | `getTimeoutUdfName()` Returns the name of the user-defined function to invoke on all "timeout" inputs.
`protected java.lang.String` | `getUdfName(java.lang.String policyName, java.lang.String stateName)` Returns the AbleUserDefinedFunction name associated with the given policy and state.
`java.lang.String` | `getUnexpectedMessageUdfName()` Returns the name of the user-defined function to invoke on all "unexpected message" inputs.
`java.lang.String` | `getUnusedUdfName(java.lang.String baseName, int arity)` Helper routine to find a unique name for a new UDF.
`void` | `inboundData(Conversation conv, DecisionDataHandle ddh)` Looks up and invokes the user-defined function associated with the Conversation's current context.
`protected void` | `invokeTarget(java.lang.String name, java.lang.Object[] args)`
`void` | `registerUdf(java.lang.String policyName, java.lang.String stateName, java.lang.String udfName)` Associates the given AbleUserDefinedFunction name with the given policy and state.
`void` | `setDefaultDecisionUdfName(java.lang.String udfName)` Sets the name of the user-defined function to invoke as a last resort on "decision point" and "inbound data" inputs, when there is no appropriate table entry.
`void` | `setTimeoutUdfName(java.lang.String timeoutUdfName)` Sets the the name of the user-defined function to invoke on all "timeout" inputs.
`void` | `setUdfManager(AbleUserDefinedFunctionRemoteManager newMgr)` Sets the AbleUserDefinedFunctionRemoteManager to use.
`void` | `setUnexpectedMessageUdfName(java.lang.String unexpectedMessageUdfName)` Sets the name of the user-defined function to invoke on all "unexpected message" inputs.
`void` | `timeout(Conversation conv, java.lang.String newStateName)` Invokes the user-defined function with the name specified for "timeout" inputs.
`void` | `unexpectedMessage(Conversation conv, MessageHandle mh)` Invokes the user-defined function with the name specified for "unexpected message" inputs.

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`

Constructor Detail

### AbleRemoteUdfDecisionLogicAdapter

    public AbleRemoteUdfDecisionLogicAdapter()

  Constructs an AbleRemoteUdrDecisionLogicAdapter object.

### AbleRemoteUdfDecisionLogicAdapter

    public AbleRemoteUdfDecisionLogicAdapter(AbleUserDefinedFunctionRemoteManager newMgr)

  Constructs an AbleRemoteUdrDecisionLogicAdapter object.

Parameters:
  `newMgr` - The new AbleUserDefinedFunctionRemoteManager.

### AbleRemoteUdfDecisionLogicAdapter

    public AbleRemoteUdfDecisionLogicAdapter(AbleBean newOwner,
                                             AbleUserDefinedFunctionRemoteManager newMgr)

  Constructs an AbleRemoteUdrDecisionLogicAdapter object.

Parameters:
  `newOwner` - The AbleBean that owns this object.
  `newMgr` - The AbleUserDefinedFunctionRemoteManager to use.

Method Detail

### setUdfManager

    public void setUdfManager(AbleUserDefinedFunctionRemoteManager newMgr)

  Sets the AbleUserDefinedFunctionRemoteManager to use.

  Parameters:
    `newMgr` - The new AbleUserDefinedFunctionRemoteManager.

### registerUdf

    public void registerUdf(java.lang.String policyName,
                            java.lang.String stateName,
                            java.lang.String udfName)

  Associates the given AbleUserDefinedFunction name with the given policy and state.

  The user-defined function with the given name must take parameters `(Conversation, DecisionDataHandle)`.

  Parameters:
    `policyName` - The policy part of the key to be associated with the given user-defined function name.
    `stateName` - The state-name part of the key to be associated with the given user-defined function name.
    `udfName` - The user-defined function name.

### getUdfName

    protected java.lang.String getUdfName(java.lang.String policyName,
                                          java.lang.String stateName)

  Returns the AbleUserDefinedFunction name associated with the given policy and state.

  Parameters:
    `policyName` - The policy part of the key to be associated with the given user-defined function name.
    `stateName` - The state-name part of the key to be associated with the given user-defined function name.
  Returns:
    The user-defined function name, or null if not found.

### getTimeoutUdfName

    public java.lang.String getTimeoutUdfName()

  Returns the name of the user-defined function to invoke on all "timeout" inputs.

  Returns:
    The user-defined function name.

### setTimeoutUdfName

    public void setTimeoutUdfName(java.lang.String timeoutUdfName)

  Sets the the name of the user-defined function to invoke on all "timeout" inputs.

  The user-defined function with the given name must take parameters `(Conversation, String)`.

  Parameters:
    `timeoutUdfName` - The user-defined function name to set.

### getUnexpectedMessageUdfName

    public java.lang.String getUnexpectedMessageUdfName()

  Returns the name of the user-defined function to invoke on all "unexpected message" inputs.

  Returns:
    The user-defined function name.

### setUnexpectedMessageUdfName

    public void setUnexpectedMessageUdfName(java.lang.String unexpectedMessageUdfName)

  Sets the name of the user-defined function to invoke on all "unexpected message" inputs.

  The user-defined function with the given name must take parameters `(Conversation, MessageHandle)`.

  Parameters:
    `unexpectedMessageUdfName` - The user-defined function name to set.

### getDefaultDecisionUdfName

    public java.lang.String getDefaultDecisionUdfName()

  Returns the name of the user-defined function to invoke as a last resort on "decision point" and "inbound data" inputs, when there is no appropriate table entry.

  Returns:
    The user-defined function name.

### setDefaultDecisionUdfName

    public void setDefaultDecisionUdfName(java.lang.String udfName)

  Sets the name of the user-defined function to invoke as a last resort on "decision point" and "inbound data" inputs, when there is no appropriate table entry.

  The user-defined function with the given name must take parameters `(Conversation, DecisionDataHandle)`.

  Parameters:
    `udfName` - The user-defined function name to set.

### getUnusedUdfName

    public java.lang.String getUnusedUdfName(java.lang.String baseName,
                                             int arity)
                                      throws java.rmi.RemoteException

  Helper routine to find a unique name for a new UDF.

  Parameters:
    `baseName` - The base part of the name.
    `arity` - The arity of the UDF.
  Returns:
    A name that is not used for a UDF with the given arity.
  Throws:
    `java.rmi.RemoteException`

### createUdf

    public AbleUserDefinedFunction createUdf(java.lang.String udfName,
                                             java.lang.Object targetObject,
                                             java.lang.String targetMethodName,
                                             java.lang.Class[] targetArgTypes)
                                      throws java.rmi.RemoteException,
                                             java.lang.NoSuchMethodException

  Helper routine to create a new UDF and register it with the UDF Manager.

  Parameters:
    `udfName` - The name of the UDF to create. Not tested for uniqueness.
    `targetObject` - The object of the UDF.
    `targetMethodName` - The method of the UDF.
    `targetArgTypes` - The class types of the UDF's parameters.
  Returns:
    The newly created UDF.
  Throws:
    `java.rmi.RemoteException` - If UDF creation failed.
    `java.lang.NoSuchMethodException` - If targetObject does not have the given method.

### createTarget

    public void createTarget(java.lang.String cpName,
                             java.lang.String callbackName,
                             java.lang.Object target)
                      throws java.rmi.RemoteException,
                             java.lang.NoSuchMethodException

  Helper routine to create and register as a UDF the given target for the given decision callback.

  Parameters:
    `cpName` - The name of the conversation policy for the callback.
    `callbackName` - The name of the decision callback
    `target` - The object to invoke through the callback.
  Throws:
    `java.rmi.RemoteException` - If UDF creation failed.
    `java.lang.NoSuchMethodException` - If the target doesn't have the right method.

### decisionPoint

    public void decisionPoint(Conversation conv,
                              DecisionDataHandle ddh)

  Looks up and invokes the user-defined function associated with the Conversation's current context.

  The user-defined function is invoked with these input parameters: (conv, ddh).

  Specified by:
    `decisionPoint` in interface `DecisionLogicAdapter`
  Parameters:
    `conv` - The Conversation to which this decision point applies.
    `ddh` - The decision-data for this decision point.

### inboundData

    public void inboundData(Conversation conv,
                            DecisionDataHandle ddh)

  Looks up and invokes the user-defined function associated with the Conversation's current context.

  The user-defined function is invoked with these input parameters: (conv, ddh).

  Specified by:
    `inboundData` in interface `DecisionLogicAdapter`
  Parameters:
    `conv` - The Conversation to which this inbound decision-data applies.
    `ddh` - The inbound decision-data.

### timeout

    public void timeout(Conversation conv,
                        java.lang.String newStateName)

  Invokes the user-defined function with the name specified for "timeout" inputs.

  The user-defined function is invoked with these input parameters: (conv, newStateName).

  Specified by:
    `timeout` in interface `DecisionLogicAdapter`
  Parameters:
    `conv` - The Conversation to which this timeout applies.
    `newStateName` - The policy's current state.

### unexpectedMessage

    public void unexpectedMessage(Conversation conv,
                                  MessageHandle mh)

  Invokes the user-defined function with the name specified for "unexpected message" inputs.

  The user-defined function is invoked with these input parameters: (conv, mh).

  Specified by:
    `unexpectedMessage` in interface `DecisionLogicAdapter`
  Parameters:
    `conv` - The Conversation to which this unexpected message applies.
    `mh` - The unexpected message.
  See Also:
    `com.ibm.able.conversation`

### invokeTarget

    protected void invokeTarget(java.lang.String name,
                                java.lang.Object[] args)

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