ie.omk.smpp.event
Class SMPPEventAdapter

java.lang.Object
  extended by ie.omk.smpp.event.SMPPEventAdapter
All Implemented Interfaces:
ConnectionObserver

public abstract class SMPPEventAdapter
extends Object
implements ConnectionObserver

Base class for applications to extend for SMPP event handling. This class handles incoming events and provides a set of blank handler methods for the various events. This makes it easy for an application to extend this class and only override the methods it's interested in.

Version:
$Id: SMPPEventAdapter.java 244 2006-01-22 21:56:28Z orank $
Author:
Oran Kelly

Constructor Summary
SMPPEventAdapter()
          Default constructor.
 
Method Summary
 void bindResponse(Connection source, BindResp br)
          Bind response packet received from the SMSC.
 void cancelSMResponse(Connection source, CancelSMResp cmr)
          CancelSM response packet received from the SMSC.
 void deliverSM(Connection source, DeliverSM dm)
          DeliverSM packet received from the SMSC.
 void genericNack(Connection source, GenericNack nack)
          GenericNack packet received from the SMSC.
 void packetReceived(Connection source, SMPPPacket pak)
          Called when a new SMPP packet has been received from the SMSC.
 void paramRetrieveResponse(Connection source, ParamRetrieveResp prr)
          ParamRetrieve response packet received from the SMSC.
 void queryLink(Connection source, EnquireLink el)
          EnquireLink packet received from the SMSC.
 void queryLinkResponse(Connection source, EnquireLinkResp elr)
          EnquireLink response packet received from the SMSC.
 void queryResponse(Connection source, SMPPResponse qr)
          One of a QuerySM, QueryLastMsgs or QueryMsgDetails response packet has been received from the SMSC.
 void receiverException(Connection source, ReceiverExceptionEvent rev)
          Receiver thread caught a non-fatal exception.
 void receiverExit(Connection source, ReceiverExitEvent rev)
          Receiver thread exited normally.
 void receiverExitException(Connection source, ReceiverExitEvent rev)
          Receiver thread exited due to fatal exception.
 void receiverStart(Connection source, ReceiverStartEvent rs)
          Receiver thread has started up.
 void replaceSMResponse(Connection source, ReplaceSMResp rmr)
          ReplaceSM response packet received from the SMSC.
 void submitMultiResponse(Connection source, SubmitMultiResp smr)
          SubmitMulti response packet received from the SMSC.
 void submitSMResponse(Connection source, SubmitSMResp smr)
          SubmitSM response packet received from the SMSC.
 void unbind(Connection source, Unbind ubd)
          Unbind packet received from the SMSC.
 void unbindResponse(Connection source, UnbindResp ubr)
          Unbind response packet received from the SMSC.
 void unidentified(Connection source, SMPPPacket pak)
          An unidentified packet has been received from the SMSC.
 void update(Connection source, SMPPEvent event)
          Called for all events other than packet reception.
 void userEvent(Connection source, SMPPEvent ev)
          PLACEHOLDER.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMPPEventAdapter

public SMPPEventAdapter()
Default constructor.

Method Detail

update

public final void update(Connection source,
                         SMPPEvent event)
Description copied from interface: ConnectionObserver
Called for all events other than packet reception. This method is called for all events generated by the API framework except that of a packet received. The ConnectionObserver.packetReceived(ie.omk.smpp.Connection, ie.omk.smpp.message.SMPPPacket)method is called in that case. The update method is mostly used for control events, such as signifying the exit of the receiver thread or notifying of error conditions.

Specified by:
update in interface ConnectionObserver
Parameters:
source - the Connection which received the packet.
event - the SMPP event type.
See Also:
SMPPEvent.getType()

packetReceived

public final void packetReceived(Connection source,
                                 SMPPPacket pak)
Description copied from interface: ConnectionObserver
Called when a new SMPP packet has been received from the SMSC. This method is called by the API framework whenever an SMPP packet has been read and decoded from the network connection to the SMSC. Identification of the packet type can be achieved by calling SMPPPacket.getCommandId().

Specified by:
packetReceived in interface ConnectionObserver
Parameters:
source - the Connection which received the packet.
pak - the SMPP packet received.

receiverExit

public void receiverExit(Connection source,
                         ReceiverExitEvent rev)
Receiver thread exited normally. This method is called by the event adapter when it receives a receiver exit event from the API that does not contain an exception. This normally means that either the SMSC has requested an unbind and the response has been successfully sent or that an unbind request has been successfully acknowledged.

Parameters:
source - the source connection of the event.
rev - the receiver exit event object received from the API.

receiverExitException

public void receiverExitException(Connection source,
                                  ReceiverExitEvent rev)
Receiver thread exited due to fatal exception. This method is called by the event adapter when the receiver thread has exited due to an exception it caught. Handling code for this method should assume that the SMPP link to the SMSC and probably the network-specific connection has been lost. It should do any clean up and either exit gracefully or re-establish the network connection and re-bind to the SMSC.

Parameters:
source - the source connection of the event.
rev - the receiver exit event object received from the API.

receiverException

public void receiverException(Connection source,
                              ReceiverExceptionEvent rev)
Receiver thread caught a non-fatal exception. This method is called when an exception has been caught by the receiver thread but it is not exiting due to it. If this method gets called it may be indicitive of a network communications error or possibly an unidentified incoming packet type from the SMSC.

Parameters:
source - the source connection of the event.
rev - the receiver exception event received from the API, which contains the caught exception.

receiverStart

public void receiverStart(Connection source,
                          ReceiverStartEvent rs)
Receiver thread has started up. This method is called when the receiver thread starts. Most applications will ignore this event and just use the default (blank) implementation of this method.

Parameters:
source - the source connection of the event.
rs - the receiver start event received from the API.

userEvent

public void userEvent(Connection source,
                      SMPPEvent ev)
PLACEHOLDER. This method will currently never be called.


deliverSM

public void deliverSM(Connection source,
                      DeliverSM dm)
DeliverSM packet received from the SMSC.


submitSMResponse

public void submitSMResponse(Connection source,
                             SubmitSMResp smr)
SubmitSM response packet received from the SMSC.


submitMultiResponse

public void submitMultiResponse(Connection source,
                                SubmitMultiResp smr)
SubmitMulti response packet received from the SMSC.


cancelSMResponse

public void cancelSMResponse(Connection source,
                             CancelSMResp cmr)
CancelSM response packet received from the SMSC.


replaceSMResponse

public void replaceSMResponse(Connection source,
                              ReplaceSMResp rmr)
ReplaceSM response packet received from the SMSC.


paramRetrieveResponse

public void paramRetrieveResponse(Connection source,
                                  ParamRetrieveResp prr)
ParamRetrieve response packet received from the SMSC.


queryResponse

public void queryResponse(Connection source,
                          SMPPResponse qr)
One of a QuerySM, QueryLastMsgs or QueryMsgDetails response packet has been received from the SMSC.


queryLink

public void queryLink(Connection source,
                      EnquireLink el)
EnquireLink packet received from the SMSC.


queryLinkResponse

public void queryLinkResponse(Connection source,
                              EnquireLinkResp elr)
EnquireLink response packet received from the SMSC.


unbind

public void unbind(Connection source,
                   Unbind ubd)
Unbind packet received from the SMSC.


unbindResponse

public void unbindResponse(Connection source,
                           UnbindResp ubr)
Unbind response packet received from the SMSC.


bindResponse

public void bindResponse(Connection source,
                         BindResp br)
Bind response packet received from the SMSC.


genericNack

public void genericNack(Connection source,
                        GenericNack nack)
GenericNack packet received from the SMSC.


unidentified

public void unidentified(Connection source,
                         SMPPPacket pak)
An unidentified packet has been received from the SMSC.



Copyright © 2011 smppapi at Sourceforge. All Rights Reserved.