org.mobicents.protocols.smpp.event
Class SMPPEventAdapter

java.lang.Object
  extended by org.mobicents.protocols.smpp.event.SMPPEventAdapter
All Implemented Interfaces:
SessionObserver

public abstract class SMPPEventAdapter
extends Object
implements SessionObserver

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 457 2009-01-15 17:37:42Z orank $

Constructor Summary
SMPPEventAdapter()
          Default constructor.
 
Method Summary
 void bindResponse(Session source, BindResp br)
          Bind response packet received from the SMSC.
 void cancelSMResponse(Session source, CancelSMResp cmr)
          CancelSM response packet received from the SMSC.
 void deliverSM(Session source, DeliverSM dm)
          DeliverSM packet received from the SMSC.
 void genericNack(Session source, GenericNack nack)
          GenericNack packet received from the SMSC.
 void packetReceived(Session source, SMPPPacket pak)
          Called when a new SMPP packet has been received from the SMSC.
 void paramRetrieveResponse(Session source, ParamRetrieveResp prr)
          ParamRetrieve response packet received from the SMSC.
 void queryLink(Session source, EnquireLink el)
          EnquireLink packet received from the SMSC.
 void queryLinkResponse(Session source, EnquireLinkResp elr)
          EnquireLink response packet received from the SMSC.
 void queryResponse(Session source, SMPPPacket qr)
          One of a QuerySM, QueryLastMsgs or QueryMsgDetails response packet has been received from the SMSC.
 void receiverException(Session source, ReceiverExceptionEvent rev)
          Receiver thread caught a non-fatal exception.
 void receiverExit(Session source, ReceiverExitEvent rev)
          Receiver thread exited normally.
 void receiverExitException(Session source, ReceiverExitEvent rev)
          Receiver thread exited due to fatal exception.
 void receiverStart(Session source, ReceiverStartEvent rs)
          Receiver thread has started up.
 void replaceSMResponse(Session source, ReplaceSMResp rmr)
          ReplaceSM response packet received from the SMSC.
 void submitMultiResponse(Session source, SubmitMultiResp smr)
          SubmitMulti response packet received from the SMSC.
 void submitSMResponse(Session source, SubmitSMResp smr)
          SubmitSM response packet received from the SMSC.
 void unbind(Session source, Unbind ubd)
          Unbind packet received from the SMSC.
 void unbindResponse(Session source, UnbindResp ubr)
          Unbind response packet received from the SMSC.
 void unidentified(Session source, SMPPPacket pak)
          An unidentified packet has been received from the SMSC.
 void update(Session source, SMPPEvent event)
          Called for all events other than packet reception.
 void userEvent(Session 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(Session source,
                         SMPPEvent event)
Description copied from interface: SessionObserver
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 SessionObserver.packetReceived(org.mobicents.protocols.smpp.Session, org.mobicents.protocols.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 SessionObserver
Parameters:
source - the Connection which received the packet.
event - the SMPP event type.
See Also:
com.adenki.smpp.event.SMPPEvent#getType

packetReceived

public final void packetReceived(Session source,
                                 SMPPPacket pak)
Description copied from interface: SessionObserver
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 SessionObserver
Parameters:
source - the Connection which received the packet.
pak - the SMPP packet received.

receiverExit

public void receiverExit(Session 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(Session 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(Session 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(Session 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(Session source,
                      SMPPEvent ev)
PLACEHOLDER. This method will currently never be called.


deliverSM

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


submitSMResponse

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


submitMultiResponse

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


cancelSMResponse

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


replaceSMResponse

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


paramRetrieveResponse

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


queryResponse

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


queryLink

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


queryLinkResponse

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


unbind

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


unbindResponse

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


bindResponse

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


genericNack

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


unidentified

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



Copyright © 2011 Mobicents. All Rights Reserved.