|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
com.davesag.smpp.AbstractSMPPCommander
A base for your implimentation of a SMPPCommander.
NOTE: this implimentation is currently very simple and only runs against a simulator.
I have not added any but the most basic of event handling and could possibly
extend ie.omk.smpp.event.SMPPEventAdapter and fill in the methods
accordingly. But for now this works and I see no reason why it shouldn't work
against an actual service. I may need to refine the error handling slightly.
| Nested Class Summary | |
class |
AbstractSMPPCommander.CloseHook
this thread is attached to the system as a system shutdownHook. |
| Nested classes inherited from class com.davesag.smpp.SMPPCommander |
SMPPCommander.Factory |
| Field Summary | |
protected ie.omk.smpp.Connection |
theConnection
The connection to the SMPP server |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
AbstractSMPPCommander()
|
|
| Method Summary | |
protected void |
bind()
bind the connection once it has been connected. |
protected abstract void |
cleanup()
Application specific post-command processing cleanup. |
protected void |
connect()
Connect to the SMPP server. |
ie.omk.smpp.Connection |
getConnection()
accessor for the connection to the SMPP server. |
protected abstract void |
logCommand(Command command,
Response response)
Application specific command logging. |
protected abstract void |
logCommandFormatException(CommandFormatException cfex,
ErrorResponse response)
Application specific command logging of invalid commands. |
protected void |
logPacket(ie.omk.smpp.message.SMPPPacket packet,
String direction)
log the packet details. |
void |
packetReceived(ie.omk.smpp.Connection conn,
ie.omk.smpp.message.SMPPPacket pack)
Connection Observer method that is called when a packet is sent to us. |
protected ie.omk.smpp.message.SubmitSM |
processRequest(ie.omk.smpp.message.SMPPPacket request)
Process the request using the CommandFactory class
you specify with the property sms.command.factory
in smpp_commander.properties. |
void |
run()
keep us connected to the SMPP server. |
protected ie.omk.smpp.message.SubmitSM |
submitResponse(Response response)
prepare the response as a submission to the SMPP server. |
void |
update(ie.omk.smpp.Connection conn,
ie.omk.smpp.event.SMPPEvent ev)
Connection Observer method that handles any events other than incoming requests. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.davesag.smpp.SMPPCommander |
start |
| Field Detail |
protected ie.omk.smpp.Connection theConnection
| Constructor Detail |
public AbstractSMPPCommander()
| Method Detail |
protected abstract void logCommand(Command command,
Response response)
command - The command to log.response - The response to log.
protected abstract void logCommandFormatException(CommandFormatException cfex,
ErrorResponse response)
cfex - The exception carrying details of the invalid command.response - The error response.protected abstract void cleanup()
public void run()
run in interface Runnable
public void update(ie.omk.smpp.Connection conn,
ie.omk.smpp.event.SMPPEvent ev)
update in interface ie.omk.smpp.event.ConnectionObserverconn - The connection to the SMPP server.ev - The event.
public void packetReceived(ie.omk.smpp.Connection conn,
ie.omk.smpp.message.SMPPPacket pack)
packetReceived in interface ie.omk.smpp.event.ConnectionObserverconn - The connection to the SMPP serverpack - The packet of data sent.public ie.omk.smpp.Connection getConnection()
getConnection in interface SMPPCommanderprotected void connect()
protected void bind()
connect().
protected ie.omk.smpp.message.SubmitSM processRequest(ie.omk.smpp.message.SMPPPacket request)
throws ie.omk.smpp.BadCommandIDException
CommandFactory class
you specify with the property sms.command.factory
in smpp_commander.properties.
The processing follows the following lifecycle.
log the command and response.CommandFormatException and log
the excpetion and response.
request - The incoming SMPP packet.
ie.omk.smpp.BadCommandIDException - if the command in the request was crap.
protected ie.omk.smpp.message.SubmitSM submitResponse(Response response)
throws ie.omk.smpp.BadCommandIDException
response - The response to submit.
ie.omk.smpp.BadCommandIDException
protected void logPacket(ie.omk.smpp.message.SMPPPacket packet,
String direction)
packet - The SMPP packet to logdirection - One of IN or OUT.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||