|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jsmpp.session.AbstractSession
org.jsmpp.session.SMPPSession
public class SMPPSession
This is an object that used to communicate with SMPP Server or SMSC. It hide all un-needed SMPP operation that might harm if the user code use it such as :
SMPPClient
implementation give
ability to the asynchronous way by executing the SUBMIT_SM operation parallel
on a different thread. The very simple implementation by using Thread pool,
ExecutorService
will do.
To receive the incoming message such as DELIVER_SM or DATA_SM will be managed
by internal thread. User code only have to set listener
MessageReceiverListener
.
Nested Class Summary | |
---|---|
private class |
SMPPSession.BoundSessionStateListener
Session state listener for internal class use. |
private class |
SMPPSession.PDUReaderWorker
Worker to read the PDU. |
private class |
SMPPSession.ResponseHandlerImpl
|
Nested classes/interfaces inherited from class org.jsmpp.session.AbstractSession |
---|
AbstractSession.EnquireLinkSender |
Field Summary | |
---|---|
private Connection |
conn
|
private ConnectionFactory |
connFactory
|
private java.io.DataInputStream |
in
|
private static org.slf4j.Logger |
logger
|
private MessageReceiverListener |
messageReceiverListener
|
private java.io.OutputStream |
out
|
private PDUReader |
pduReader
|
private SMPPSession.PDUReaderWorker |
pduReaderWorker
|
private ResponseHandler |
responseHandler
|
private SMPPSessionContext |
sessionContext
|
private SMPPSession.BoundSessionStateListener |
sessionStateListener
|
Fields inherited from class org.jsmpp.session.AbstractSession |
---|
enquireLinkSender |
Constructor Summary | |
---|---|
SMPPSession()
Default constructor of SMPPSession . |
|
SMPPSession(PDUSender pduSender,
PDUReader pduReader,
ConnectionFactory connFactory)
|
|
SMPPSession(java.lang.String host,
int port,
BindParameter bindParam)
|
|
SMPPSession(java.lang.String host,
int port,
BindParameter bindParam,
PDUSender pduSender,
PDUReader pduReader,
ConnectionFactory connFactory)
|
Method Summary | |
---|---|
void |
cancelShortMessage(java.lang.String serviceType,
java.lang.String messageId,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
TypeOfNumber destAddrTon,
NumberingPlanIndicator destAddrNpi,
java.lang.String destinationAddress)
Cancel the previous submitted short message. |
void |
close()
Forced close connection without sending UNBIND command to Message Center. |
java.lang.String |
connectAndBind(java.lang.String host,
int port,
BindParameter bindParam)
Open connection and bind immediately. |
java.lang.String |
connectAndBind(java.lang.String host,
int port,
BindParameter bindParam,
long timeout)
Open connection and bind immediately. |
void |
connectAndBind(java.lang.String host,
int port,
BindType bindType,
java.lang.String systemId,
java.lang.String password,
java.lang.String systemType,
TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi,
java.lang.String addressRange)
Open connection and bind immediately. |
void |
connectAndBind(java.lang.String host,
int port,
BindType bindType,
java.lang.String systemId,
java.lang.String password,
java.lang.String systemType,
TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi,
java.lang.String addressRange,
long timeout)
Open connection and bind immediately with specified timeout. |
protected Connection |
connection()
|
protected void |
finalize()
|
private void |
fireAcceptAlertNotification(AlertNotification alertNotification)
|
private void |
fireAcceptDeliverSm(DeliverSm deliverSm)
|
MessageReceiverListener |
getMessageReceiverListener()
Get the current message receiver listener that is currently registered for this smpp session. |
protected GenericMessageReceiverListener |
messageReceiverListener()
|
QuerySmResult |
queryShortMessage(java.lang.String messageId,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr)
Query previous submitted short message based on it's message_id and message_id. |
void |
replaceShortMessage(java.lang.String messageId,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
java.lang.String scheduleDeliveryTime,
java.lang.String validityPeriod,
RegisteredDelivery registeredDelivery,
byte smDefaultMsgId,
byte[] shortMessage)
Replace the previous submitted short message. |
private java.lang.String |
sendBind(BindType bindType,
java.lang.String systemId,
java.lang.String password,
java.lang.String systemType,
InterfaceVersion interfaceVersion,
TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi,
java.lang.String addressRange,
long timeout)
Sending bind. |
protected AbstractSessionContext |
sessionContext()
|
void |
setMessageReceiverListener(MessageReceiverListener messageReceiverListener)
Sets a message receiver listener for this smpp session. |
SubmitMultiResult |
submitMultiple(java.lang.String serviceType,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
Address[] destinationAddresses,
ESMClass esmClass,
byte protocolId,
byte priorityFlag,
java.lang.String scheduleDeliveryTime,
java.lang.String validityPeriod,
RegisteredDelivery registeredDelivery,
ReplaceIfPresentFlag replaceIfPresentFlag,
DataCoding dataCoding,
byte smDefaultMsgId,
byte[] shortMessage,
OptionalParameter... optionalParameters)
Submit short message to multiple destination address. |
java.lang.String |
submitShortMessage(java.lang.String serviceType,
TypeOfNumber sourceAddrTon,
NumberingPlanIndicator sourceAddrNpi,
java.lang.String sourceAddr,
TypeOfNumber destAddrTon,
NumberingPlanIndicator destAddrNpi,
java.lang.String destinationAddr,
ESMClass esmClass,
byte protocolId,
byte priorityFlag,
java.lang.String scheduleDeliveryTime,
java.lang.String validityPeriod,
RegisteredDelivery registeredDelivery,
byte replaceIfPresentFlag,
DataCoding dataCoding,
byte smDefaultMsgId,
byte[] shortMessage,
OptionalParameter... optionalParameters)
Submit a short message to specified destination address. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.jsmpp.session.Session |
---|
addSessionStateListener, dataShortMessage, getEnquireLinkTimer, getLastActivityTimestamp, getSessionId, getSessionState, getTransactionTimer, removeSessionStateListener, setEnquireLinkTimer, setTransactionTimer, unbindAndClose |
Field Detail |
---|
private static final org.slf4j.Logger logger
private final PDUReader pduReader
private final ConnectionFactory connFactory
private Connection conn
private java.io.DataInputStream in
private java.io.OutputStream out
private SMPPSession.PDUReaderWorker pduReaderWorker
private final ResponseHandler responseHandler
private MessageReceiverListener messageReceiverListener
private SMPPSession.BoundSessionStateListener sessionStateListener
private SMPPSessionContext sessionContext
Constructor Detail |
---|
public SMPPSession()
SMPPSession
. The next action might be
connect and bind to a destination message center.
connectAndBind(String, int, BindType, String, String, String, TypeOfNumber, NumberingPlanIndicator, String)
public SMPPSession(PDUSender pduSender, PDUReader pduReader, ConnectionFactory connFactory)
public SMPPSession(java.lang.String host, int port, BindParameter bindParam, PDUSender pduSender, PDUReader pduReader, ConnectionFactory connFactory) throws java.io.IOException
java.io.IOException
public SMPPSession(java.lang.String host, int port, BindParameter bindParam) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void connectAndBind(java.lang.String host, int port, BindType bindType, java.lang.String systemId, java.lang.String password, java.lang.String systemType, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, java.lang.String addressRange) throws java.io.IOException
connectAndBind
in interface ClientSession
host
- is the SMSC host address.port
- is the SMSC listen port.bindType
- is the bind type.systemId
- is the system id.password
- is the password.systemType
- is the system type.addrTon
- is the address TON.addrNpi
- is the address NPI.addressRange
- is the address range.
java.io.IOException
- if there is an IO error found.public void connectAndBind(java.lang.String host, int port, BindType bindType, java.lang.String systemId, java.lang.String password, java.lang.String systemType, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, java.lang.String addressRange, long timeout) throws java.io.IOException
connectAndBind
in interface ClientSession
host
- is the SMSC host address.port
- is the SMSC listen port.bindType
- is the bind type.systemId
- is the system id.password
- is the password.systemType
- is the system type.addrTon
- is the address TON.addrNpi
- is the address NPI.addressRange
- is the address range.timeout
- is the timeout.
java.io.IOException
- if there is an IO error found.public java.lang.String connectAndBind(java.lang.String host, int port, BindParameter bindParam) throws java.io.IOException
connectAndBind
in interface ClientSession
host
- is the SMSC host address.port
- is the SMSC listen port.bindParam
- is the bind parameters.
java.io.IOException
- if there is an IO error found.public java.lang.String connectAndBind(java.lang.String host, int port, BindParameter bindParam, long timeout) throws java.io.IOException
connectAndBind
in interface ClientSession
host
- is the SMSC host address.port
- is the SMSC listen port.bindParam
- is the bind parameters.timeout
- is the timeout.
java.io.IOException
- if there is an IO error found.private java.lang.String sendBind(BindType bindType, java.lang.String systemId, java.lang.String password, java.lang.String systemType, InterfaceVersion interfaceVersion, TypeOfNumber addrTon, NumberingPlanIndicator addrNpi, java.lang.String addressRange, long timeout) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
bindType
- is the bind type.systemId
- is the system id.password
- is the password.systemTypeis
- the system type.interfaceVersion
- is the interface version.addrTon
- is the address TON.addrNpi
- is the address NPI.addressRange
- is the address range.timeout
- is the max time waiting for bind response.
PDUException
- if we enter invalid bind parameter(s).
ResponseTimeoutException
- if there is no valid response after defined millisecond.
InvalidResponseException
- if there is invalid response found.
NegativeResponseException
- if we receive negative response.
java.io.IOException
- if there is an IO error occur.public java.lang.String submitShortMessage(java.lang.String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, java.lang.String destinationAddr, ESMClass esmClass, byte protocolId, byte priorityFlag, java.lang.String scheduleDeliveryTime, java.lang.String validityPeriod, RegisteredDelivery registeredDelivery, byte replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
submitShortMessage
in interface ClientSession
serviceType
- is the service_type.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.destAddrTon
- is the dest_addr_ton.destAddrNpi
- is the dest_addr_npi.destinationAddr
- is the destination_addr.esmClass
- is the esm_class.protocolId
- is the protocol_id.priorityFlag
- is the priority_flag.scheduleDeliveryTime
- is the schedule_delivery_time.validityPeriod
- is the validity_period.registeredDelivery
- is the registered_delivery.replaceIfPresentFlag
- is the replace_if_present_flag.dataCoding
- is the data_coding.smDefaultMsgId
- is the sm_default_msg_id.shortMessage
- is the short_message.optionalParameters
- is the optional parameters.
PDUException
- if there is invalid PDU parameter found..
ResponseTimeoutException
- if timeout has been reach.
InvalidResponseException
- if response is invalid.
NegativeResponseException
- if negative response received.
java.io.IOException
- if there is an I/O error found.public SubmitMultiResult submitMultiple(java.lang.String serviceType, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, Address[] destinationAddresses, ESMClass esmClass, byte protocolId, byte priorityFlag, java.lang.String scheduleDeliveryTime, java.lang.String validityPeriod, RegisteredDelivery registeredDelivery, ReplaceIfPresentFlag replaceIfPresentFlag, DataCoding dataCoding, byte smDefaultMsgId, byte[] shortMessage, OptionalParameter... optionalParameters) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
submitMultiple
in interface ClientSession
serviceType
- is the service_type.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.destinationAddresses
- is the destination addresses.esmClass
- is the esm_class.protocolId
- is the protocol_id.priorityFlag
- is the priority_flag.scheduleDeliveryTime
- is the schedule_delivery_time.validityPeriod
- is the validity_period.registeredDelivery
- is the registered_delivery.replaceIfPresentFlag
- is the replace_if_present_flag.dataCoding
- is the data_coding.smDefaultMsgId
- is the sm_default_msg_id.shortMessage
- is the short_message.optionalParameters
- is the optional parameters.
PDUException
- if there is invalid PDU parameter found.
ResponseTimeoutException
- if timeout has been reach.
InvalidResponseException
- if response is invalid.
NegativeResponseException
- if negative response received.
java.io.IOException
- if there is an I/O error found.public QuerySmResult queryShortMessage(java.lang.String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
queryShortMessage
in interface ClientSession
messageId
- is the message_id.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.
PDUException
- if there is invalid PDU parameter found.
ResponseTimeoutException
- if timeout has been reach.
InvalidResponseException
- if response is invalid.
NegativeResponseException
- if negative response received.
java.io.IOException
- if there is an I/O error found.public void replaceShortMessage(java.lang.String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, java.lang.String scheduleDeliveryTime, java.lang.String validityPeriod, RegisteredDelivery registeredDelivery, byte smDefaultMsgId, byte[] shortMessage) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
replaceShortMessage
in interface ClientSession
messageId
- is the message_id.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.scheduleDeliveryTime
- is the schedule_delivery_time.validityPeriod
- is the validity_period.registeredDelivery
- is the registered_delivery.smDefaultMsgId
- is the sm_default_msg_id.shortMessage
- is the short_message.
PDUException
- if there is invalid PDU parameter found.
ResponseTimeoutException
- if timeout has been reach.
InvalidResponseException
- if response is invalid.
NegativeResponseException
- if negative response received.
java.io.IOException
- if there is an I/O error found.public void cancelShortMessage(java.lang.String serviceType, java.lang.String messageId, TypeOfNumber sourceAddrTon, NumberingPlanIndicator sourceAddrNpi, java.lang.String sourceAddr, TypeOfNumber destAddrTon, NumberingPlanIndicator destAddrNpi, java.lang.String destinationAddress) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, java.io.IOException
ClientSession
cancelShortMessage
in interface ClientSession
serviceType
- is the service_type.messageId
- is the message_id.sourceAddrTon
- is the source_addr_ton.sourceAddrNpi
- is the source_addr_npi.sourceAddr
- is the source_addr.destAddrTon
- is the dest_addr_ton.destAddrNpi
- is the dest_addr_npi.destinationAddress
- is destination_address.
PDUException
- if there is invalid PDU parameter found.
ResponseTimeoutException
- if timeout has been reach.
InvalidResponseException
- if response is invalid.
NegativeResponseException
- if negative response received.
java.io.IOException
- if there is an I/O error found.public MessageReceiverListener getMessageReceiverListener()
ClientSession
getMessageReceiverListener
in interface ClientSession
public void setMessageReceiverListener(MessageReceiverListener messageReceiverListener)
ClientSession
setMessageReceiverListener
in interface ClientSession
messageReceiverListener
- is the new listenerprotected Connection connection()
connection
in class AbstractSession
protected AbstractSessionContext sessionContext()
sessionContext
in class AbstractSession
protected GenericMessageReceiverListener messageReceiverListener()
messageReceiverListener
in class AbstractSession
public void close()
Session
close
in interface Session
close
in class AbstractSession
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
private void fireAcceptDeliverSm(DeliverSm deliverSm) throws ProcessRequestException
ProcessRequestException
private void fireAcceptAlertNotification(AlertNotification alertNotification)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |