SMSLib 3.5.3

org.smslib.smsserver.interfaces
Class Database

java.lang.Object
  extended by org.smslib.smsserver.interfaces.Interface<java.lang.Integer>
      extended by org.smslib.smsserver.interfaces.Database

public class Database
extends Interface<java.lang.Integer>

Interface for database communication with SMSServer.
Inbound messages and calls are logged in special tables, outbound messages are retrieved from another table.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.smslib.smsserver.interfaces.Interface
Interface.InterfaceTypes
 
Constructor Summary
Database(java.lang.String myInterfaceId, java.util.Properties myProps, SMSServer myServer, Interface.InterfaceTypes myType)
           
 
Method Summary
 void callReceived(java.lang.String gtwId, java.lang.String callerId)
          This method is called by SMSServer every time an inbound call is received.
 java.util.Collection<OutboundMessage> getMessagesToSend()
          SMSServer calls this method in order to query the interface for messages that need to be send out.
 int getPendingMessagesToSend()
          This method returns the number of outbound queued messages identified by this interface.
 void markMessage(OutboundMessage msg)
          After a successful or unsuccessful attempt to send a message, SMSServer calls this method.
 void messagesReceived(java.util.Collection<InboundMessage> msgList)
          This method is called by SMSServer every time a message (or more messages) is received.
 void start()
          Called once before SMSServer starts its operation.
 void stop()
          Called once after SMSServer has finished.
 
Methods inherited from class org.smslib.smsserver.interfaces.Interface
getDescription, getId, getMessageCache, getProperty, getProperty, getServer, getType, isInbound, isOutbound, markMessages, setDescription
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Database

public Database(java.lang.String myInterfaceId,
                java.util.Properties myProps,
                SMSServer myServer,
                Interface.InterfaceTypes myType)
Method Detail

start

public void start()
           throws java.lang.Exception
Description copied from class: Interface
Called once before SMSServer starts its operation. Use this method for initialization.

Override this call if you wish to implement your own functionality.

Overrides:
start in class Interface<java.lang.Integer>
Throws:
java.lang.Exception - An exception thrown will stop SMSServer from starting its processing.

stop

public void stop()
          throws java.lang.Exception
Description copied from class: Interface
Called once after SMSServer has finished. Use this method for cleaning up your interface.

Override this call if you wish to implement your own functionality.

Overrides:
stop in class Interface<java.lang.Integer>
Throws:
java.lang.Exception

callReceived

public void callReceived(java.lang.String gtwId,
                         java.lang.String callerId)
                  throws java.lang.Exception
Description copied from class: Interface
This method is called by SMSServer every time an inbound call is received. SMSServer calls this method for all available/active interfaces.

Override this call if you wish to implement your own functionality.

Overrides:
callReceived in class Interface<java.lang.Integer>
Parameters:
gtwId - The Id of the gateway which received the call.
callerId - The caller id.
Throws:
java.lang.Exception

messagesReceived

public void messagesReceived(java.util.Collection<InboundMessage> msgList)
                      throws java.lang.Exception
Description copied from class: Interface
This method is called by SMSServer every time a message (or more messages) is received. SMSServer calls this method for all available/active interfaces.

Override this call if you wish to implement your own functionality.

Overrides:
messagesReceived in class Interface<java.lang.Integer>
Parameters:
msgList - A message list of all received messages.
Throws:
java.lang.Exception

getMessagesToSend

public java.util.Collection<OutboundMessage> getMessagesToSend()
                                                        throws java.lang.Exception
Description copied from class: Interface
SMSServer calls this method in order to query the interface for messages that need to be send out.

Override this call if you wish to implement your own functionality.

Overrides:
getMessagesToSend in class Interface<java.lang.Integer>
Returns:
A list of Outbound messages to be sent. Return an empty list if the interface has no messages for dispatch.
Throws:
java.lang.Exception

getPendingMessagesToSend

public int getPendingMessagesToSend()
                             throws java.lang.Exception
Description copied from class: Interface
This method returns the number of outbound queued messages identified by this interface. Should return (-1) if this method is not implemented or if the number cannot be determined.

Overrides:
getPendingMessagesToSend in class Interface<java.lang.Integer>
Returns:
The number of pending messages to be sent via this interface.
Throws:
java.lang.Exception

markMessage

public void markMessage(OutboundMessage msg)
                 throws java.lang.Exception
Description copied from class: Interface
After a successful or unsuccessful attempt to send a message, SMSServer calls this method. The interface can then decide what to do with the message. Note that the message status and errors member fields are updated, so you should examine them in order to determine whether the message has been sent out, etc.

Override this call if you wish to implement your own functionality.

Overrides:
markMessage in class Interface<java.lang.Integer>
Parameters:
msg - The Outbound message.
Throws:
java.lang.Exception

SMSLib 3.5.3

(c) 2002-2011, http://smslib.org