org.mobicents.protocols.smpp.util
Class AutoResponder

java.lang.Object
  extended by org.mobicents.protocols.smpp.util.AutoResponder
All Implemented Interfaces:
SessionObserver

public class AutoResponder
extends Object
implements SessionObserver

A connection observer that can automatically respond to some of the basic packet types. An instance of this class can be added as an observer to a Session and configured to send response packets to any of unbind, deliver_sm, data_sm or enquire_link requests.

After construction, the default configuration for an AutoResponder is not to respond to anything. Each setting must be explicitly enabled by the caller. As an example, in order to respond to enquire_link and deliver_sm packets but to ignore bind and data_sm packets, code like the following could be used:

 Connection connection = new Connection(...);
 AutoResponder responder = new AutoResponder();
 responder.setAckDeliverSm(true);
 responder.setAckEnqureLink(true);
 connection.addObserver(responder);
 

Version:
$Id: AutoResponder.java 457 2009-01-15 17:37:42Z orank $

Constructor Summary
AutoResponder()
          Constructor that will initialise with all 'ack' properties initially set to false.
AutoResponder(boolean respond)
          Constructor that will initialise with all 'ack' properties initially set to respond.
 
Method Summary
 boolean isAckDataSm()
           
 boolean isAckDeliverSm()
           
 boolean isAckEnquireLink()
           
 boolean isAckUnbind()
           
 void packetReceived(Session source, SMPPPacket packet)
          Called when a new SMPP packet has been received from the SMSC.
 void setAckDataSm(boolean ackDataSm)
           
 void setAckDeliverSm(boolean ackDeliverSm)
           
 void setAckEnquireLink(boolean ackEnquireLink)
           
 void setAckUnbind(boolean ackUnbind)
           
 void update(Session source, SMPPEvent event)
          Called for all events other than packet reception.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoResponder

public AutoResponder()
Constructor that will initialise with all 'ack' properties initially set to false.


AutoResponder

public AutoResponder(boolean respond)
Constructor that will initialise with all 'ack' properties initially set to respond.

Parameters:
respond - The value to assign to all of this class' ack properties.
Method Detail

isAckDataSm

public boolean isAckDataSm()

setAckDataSm

public void setAckDataSm(boolean ackDataSm)

isAckDeliverSm

public boolean isAckDeliverSm()

setAckDeliverSm

public void setAckDeliverSm(boolean ackDeliverSm)

isAckEnquireLink

public boolean isAckEnquireLink()

setAckEnquireLink

public void setAckEnquireLink(boolean ackEnquireLink)

isAckUnbind

public boolean isAckUnbind()

setAckUnbind

public void setAckUnbind(boolean ackUnbind)

packetReceived

public void packetReceived(Session source,
                           SMPPPacket packet)
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.
packet - the SMPP packet received.

update

public 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


Copyright © 2011 Mobicents. All Rights Reserved.