com.ibm.etill.framework.eventmgr
Class CassetteEvent

java.lang.Object
  |
  +--com.ibm.etill.framework.eventmgr.PSEvent
        |
        +--com.ibm.etill.framework.eventmgr.CassetteEvent
All Implemented Interfaces:
EventConstants

public class CassetteEvent
extends PSEvent

CassetteEvent allows cassettes to define and generate their own external events. This class can be used as-is, without being extended.

Note that cassettes should only generate CassetteEvent event objects - they should never generate events that are defined by the Framework.

Events are external asynchronous notifications of a change that has occurred within Commerce Payments or one of its cassettes. To generate an event, the cassette must:

  1. Instantiate and initialize the appropriate event object (again, cassettes should only generate CassetteEvent event objects)
  2. Add any cassette-specific parameters to the event object using the setCassetteData method
  3. Add the new event object to the thread's CommitPoint through that object's addEventToList method
  4. (Eventually) call the CommitPoint object's commit method.
When the commit call executes, the CommitPoint passes all of the events on its event list to the Framework's Event Notification service for delivery to the appropriate event listeners.

Here is an example of the code to perform these steps:


// create cassetteEvent object
CassetteEvent ce = new CassetteEvent(this, cassetteName, merchantNumber);

// Create a hashtable and load it with our event data
Hashtable cassetteHashtable = new Hashtable();
cassetteHashtable.put("csKeyword1", "csValue1");
cassetteHashtable.put("csKeyword2", "csValue2");

// Referenct hashtable from the event object
ce.setCassetteData(cassetteHashtable);

...

// Commit this object to the database and send our event to registered
// event listeners
Supervisor.getThreadCommitPoint().commit();

See Also:
CommitPoint.addToEventList(com.ibm.etill.framework.eventmgr.PSEvent), Supervisor.getThreadCommitPoint()

Fields inherited from interface com.ibm.etill.framework.eventmgr.EventConstants
ACCOUNTNUMBER, BATCH_OBJECT, BATCHNUMBER, CASSETTE_EVENT, CASSETTENAME, COMPONENTNAME, CREDIT_OBJECT, CREDITNUMBER, CURRENTSTATE, DOWN, ENABLED, EVENTLISTENER, EVENTTYPE, FRAMEWORK, HOSTNAME, LISTENERURI, MERCHANT_EVENT, MERCHANTNUMBER, NETMGR_EVENT, OBJECTNAME, ORDER_OBJECT, ORDERDATA1, ORDERDATA2, ORDERDATA3, ORDERDATA4, ORDERDATA5, ORDERNUMBER, PAYMENT_OBJECT, PAYMENTNUMBER, PORTNUMBER, PREVIOUSSTATE, PRIMARYRC, SECONDARYRC, SEPARATOR, SOCKSHOST, SOCKSPORT, STATE_CHANGE_EVENT, STATUS, TIMEGENERATED, TIMEREGISTERED, TRANSACTIONID, UP
 
Constructor Summary
CassetteEvent(Object source, String cName, String merNumber)
          Constructs a CassetteEvent object with the input object for the specified cassette and merchant.
 
Method Summary
 Hashtable getCassetteData()
          Returns the cassette-specifc keyword/value pairs for this event object.
 String getCassetteName()
          Returns the name of the cassette with which this event is associated.
 String getMerchantNumber()
          Returns the merchant number of the merchant with which this event is associated.
 void setCassetteData(Hashtable cData)
          Assigns a set of cassette-specific parameters to this event object.
 String toString()
          Returns a string representation of this event object for tracing purposes.
 
Methods inherited from class com.ibm.etill.framework.eventmgr.PSEvent
getEventType, getSource, getTimestamp, getTimestampAsString, setEventType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CassetteEvent

public CassetteEvent(Object source,
                     String cName,
                     String merNumber)
Constructs a CassetteEvent object with the input object for the specified cassette and merchant. The event type is automatically set to CASSETTE_EVENT.
Parameters:
source - the Java object that generated this event.
cName - a String containing the configured name of the cassette that is generating the event.
merNumber - a String containing the merchant number associated with this event.
Method Detail

setCassetteData

public void setCassetteData(Hashtable cData)
Assigns a set of cassette-specific parameters to this event object. These parameters are keyword/value pairs represented through the input Hashtable.
Returns:
String - the merchant number

getMerchantNumber

public String getMerchantNumber()
Returns the merchant number of the merchant with which this event is associated.
Returns:
String - the merchant number

getCassetteName

public String getCassetteName()
Returns the name of the cassette with which this event is associated.
Returns:
String - the configured cassette name

getCassetteData

public Hashtable getCassetteData()
Returns the cassette-specifc keyword/value pairs for this event object.
Returns:
Hashtable - the cassette-specific parameters as provided on the setCassetteData method.

toString

public String toString()
Returns a string representation of this event object for tracing purposes.
Overrides:
toString in class PSEvent
Returns:
String - a string representation of the key elements of this event object.