com.mockrunner.connector
Class InteractionHandler

java.lang.Object
  extended by com.mockrunner.connector.InteractionHandler

public class InteractionHandler
extends java.lang.Object

This class can be used to add implementations of InteractionImplementor. The MockInteraction delegates the execute calls to this class to find a suitable InteractionImplementor that can handle the request. The execute method of the first InteractionImplementor that returns true for InteractionImplementor.canHandle(javax.resource.cci.InteractionSpec, javax.resource.cci.Record, javax.resource.cci.Record) will be called.


Constructor Summary
InteractionHandler()
           
 
Method Summary
 void addImplementor(InteractionImplementor implementor)
          Add an implementation of InteractionImplementor, e.g.
 void clearImplementors()
          Clears the list of current InteractionImplementor objects.
 javax.resource.cci.Record execute(javax.resource.cci.InteractionSpec is, javax.resource.cci.Record request)
          Delegator for MockInteraction.
 boolean execute(javax.resource.cci.InteractionSpec is, javax.resource.cci.Record request, javax.resource.cci.Record response)
          Delegator for MockInteraction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractionHandler

public InteractionHandler()
Method Detail

addImplementor

public void addImplementor(InteractionImplementor implementor)
Add an implementation of InteractionImplementor, e.g. StreamableRecordByteArrayInteraction or WSIFInteraction. You can add more than one InteractionImplementor, the first one that can handle the request will be called.

Parameters:
implementor - the InteractionImplementor

clearImplementors

public void clearImplementors()
Clears the list of current InteractionImplementor objects.


execute

public javax.resource.cci.Record execute(javax.resource.cci.InteractionSpec is,
                                         javax.resource.cci.Record request)
                                  throws javax.resource.ResourceException
Delegator for MockInteraction. Dispatches the call to the InteractionImplementor that returns true for InteractionImplementor.canHandle(javax.resource.cci.InteractionSpec, javax.resource.cci.Record, javax.resource.cci.Record).

Throws:
javax.resource.ResourceException

execute

public boolean execute(javax.resource.cci.InteractionSpec is,
                       javax.resource.cci.Record request,
                       javax.resource.cci.Record response)
                throws javax.resource.ResourceException
Delegator for MockInteraction. Dispatches the call to the InteractionImplementor that returns true for InteractionImplementor.canHandle(javax.resource.cci.InteractionSpec, javax.resource.cci.Record, javax.resource.cci.Record).

Throws:
javax.resource.ResourceException