SMSLib 3.5.3

org.smslib
Class Service

java.lang.Object
  extended by org.smslib.Service

public class Service
extends java.lang.Object

This is main library class. Your primary interface with SMSLib is via methods defined in this class.


Nested Class Summary
static class Service.ServiceStatus
           
 
Field Summary
 Settings S
           
 
Method Summary
 void addGateway(AGateway gateway)
          Adds a gateway to the list of gateways managed by the Service class.
 boolean addToGroup(java.lang.String groupName, java.lang.String number)
          Adds a number to the specified group.
 boolean checkInGroup(java.lang.String groupName, java.lang.String number)
          Checks if a number belongs to a group.
 boolean createGroup(java.lang.String groupName)
          Creates a destination group.
 boolean deleteMessage(InboundMessage msg)
          Deletes the specified message.
 java.util.ArrayList<java.lang.String> expandGroup(java.lang.String groupName)
          Expands a group to its recipient numbers.
 AGateway findGateway(java.lang.String gatewayId)
          Find and return a gateway by its ID.
 ICallNotification getCallNotification()
          Returns the call notification method.
 AGateway getGateway(java.lang.String gatewayId)
          Returns the gateway object based on the provided id.
 java.util.Collection<AGateway> getGateways()
          Returns the list of defined gateways.
 AGateway[] getGatewaysNET()
          .NET bridge method.
 IGatewayStatusNotification getGatewayStatusNotification()
          Returns the gateway status notification method.
 int getInboundMessageCount()
          Returns the total number of messages received by all gateways.
 int getInboundMessageCount(AGateway gateway)
          Returns the total number of messages received by the specified gateway.
 int getInboundMessageCount(java.lang.String gatewayId)
          Returns the total number of messages received by the specified gateway.
 IInboundMessageNotification getInboundMessageNotification()
          Returns the notification method set for inbound messages.
static Service getInstance()
           
 KeyManager getKeyManager()
           
 LoadBalancer getLoadBalancer()
          Returns the active Load Balancer class.
 org.smslib.notify.NotifyQueueManager getNotifyQueueManager()
           
 IOrphanedMessageNotification getOrphanedMessageNotification()
          Returns the orphaned message notification method, or null if no-one is set.
 int getOutboundMessageCount()
          Returns the total number of messages sent via all gateways.
 int getOutboundMessageCount(AGateway gateway)
          Returns the total number of messages sent via the specified gateway.
 int getOutboundMessageCount(java.lang.String gatewayId)
          Returns the total number of messages sent via the specified gateway.
 IOutboundMessageNotification getOutboundMessageNotification()
          Returns the notification method set for outbound messages.
 AbstractQueueManager getQueueManager()
           
 IQueueSendingNotification getQueueSendingNotification()
          Returns the notification method set for Queue sending operation.
 Router getRouter()
          Returns the active Router class.
 Service.ServiceStatus getServiceStatus()
           
 Settings getSettings()
          Returns the Settings object, holding SMSLib run-time values.
 long getStartMillis()
           
 IUSSDNotification getUSSDNotification()
          Returns the USSD notification method.
static void main(java.lang.String[] args)
           
 boolean queueMessage(OutboundMessage msg)
          Queues a message for sending.
 boolean queueMessage(OutboundMessage msg, java.lang.String gatewayId)
          Queues a message for sending from the specific gateway.
 boolean queueMessageAt(OutboundMessage msg, java.util.Date at)
          Queues a message for sending at a specific time.
 boolean queueMessageAt(OutboundMessage msg, long delayMillis)
          Queues a message for sending with a specific delay.
 int queueMessages(java.util.Collection<OutboundMessage> msgList)
          Queues a list of messages for sending.
 int queueMessages(java.util.Collection<OutboundMessage> msgList, java.lang.String gatewayId)
          Queues a list of messages for sending from the specific gateway.
 int queueMessages(OutboundMessage[] msgArray)
          .NET bridge method.
 int queueMessages(OutboundMessage[] msgArray, java.lang.String gatewayId)
          .NET bridge method.
 InboundMessage readMessage(java.lang.String gatewayId, java.lang.String memLoc, int memIndex)
          Reads a specific gateway for a message matching the given Memory Location and Memory Index.
 int readMessages(java.util.Collection<InboundMessage> msgList, InboundMessage.MessageClasses msgClass)
          Reads inbound messages from ALL gateways with the Inbound attribute set.
 int readMessages(java.util.Collection<InboundMessage> msgList, InboundMessage.MessageClasses msgClass, AGateway gateway)
          Reads inbound messages from the SPECIFIC gateway.
 int readMessages(java.util.Collection<InboundMessage> msgList, InboundMessage.MessageClasses msgClass, java.lang.String gatewayId)
          Reads inbound messages from the SPECIFIC gateway.
 InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass)
          .NET bridge method.
 InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass, AGateway gateway)
          .NET bridge method.
 InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass, java.lang.String gatewayId)
          .NET bridge method.
 int readPhonebook(Phonebook phonebook, java.lang.String gatewayId)
          Loads the phonebook from the specified gateway into a Phonebook class.
 boolean removeFromGroup(java.lang.String groupName, java.lang.String number)
          Removes a number from the specified group.
 boolean removeGateway(AGateway gateway)
          Removes a gateway from the list of gateways managed by the Service class.
 boolean removeGroup(java.lang.String groupName)
          Removes a group.
 boolean removeMessage(OutboundMessage msg)
          Attempts to remove the specified message from the background sending queue.
 boolean removeMessage(java.lang.String messageId)
          Attempts to remove the message with the specified ID from the background queue.
 AGateway routeMessage(OutboundMessage msg)
          Find best suitable gateway to send specific message through Router and Load Balancer.
 boolean sendMessage(OutboundMessage msg)
          Sends a single message.
 boolean sendMessage(OutboundMessage msg, java.lang.String gatewayId)
          Sends a single message from the specified gateway.
 int sendMessages(java.util.Collection<OutboundMessage> msgList)
          Sends a list of messages.
 int sendMessages(java.util.Collection<OutboundMessage> msgList, java.lang.String gatewayId)
          Sends a list of messages from the specified gateway.
 int sendMessages(OutboundMessage[] msgArray)
          .NET bridge method.
 int sendMessages(OutboundMessage[] msgArray, java.lang.String gatewayId)
          .NET bridge method.
 boolean sendUSSDRequest(USSDRequest request, java.lang.String gatewayId)
           
 void setCallNotification(ICallNotification callNotification)
          Sets the call notification method.
 void setGatewayStatusNotification(IGatewayStatusNotification gatewayStatusNotification)
          Sets the gateway status notification method.
 void setInboundMessageNotification(IInboundMessageNotification inboundNotification)
          Sets the inbound message notification method.
 void setLoadBalancer(LoadBalancer loadBalancer)
          Sets a new Load Balancer.
 void setOrphanedMessageNotification(IOrphanedMessageNotification orphanedMessageNotification)
          Sets the orphaned message notification.
 void setOutboundMessageNotification(IOutboundMessageNotification outboundNotification)
          Sets the outbound notification method.
 boolean setQueueManager(AbstractQueueManager myQueueManager)
           
 void setQueueSendingNotification(IQueueSendingNotification queueSendingNotification)
          Sets the Queue sending notification method.
 void setRouter(Router router)
          Sets a new Router.
 void setUSSDNotification(IUSSDNotification ussdNotification)
          Sets the USSD notification method.
 void startService()
          Initializes and starts the SMSLib service.
 void startService(boolean startAllGateways)
          Initializes and starts the SMSLib service.
 void stopService()
          Stops all gateways - does not remove them from Service's internal list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S

public Settings S
Method Detail

getInstance

public static Service getInstance()

addGateway

public void addGateway(AGateway gateway)
                throws GatewayException
Adds a gateway to the list of gateways managed by the Service class. The Service should be stopped in order to add gateways.

Parameters:
gateway - The gateway to be added.
Throws:
GatewayException - You tried to add a gateway while the Service is started.
See Also:
removeGateway(AGateway), getGateways()

removeGateway

public boolean removeGateway(AGateway gateway)
                      throws GatewayException
Removes a gateway from the list of gateways managed by the Service class. The Service should be stopped in order to remove a gateway.

Parameters:
gateway - The gateway to be removed.
Returns:
True if the requested gateway has been removed successfully.
Throws:
GatewayException - You tried to remove a gateway while the Service is started.
See Also:
addGateway(AGateway), getGateways()

getGateway

public AGateway getGateway(java.lang.String gatewayId)
Returns the gateway object based on the provided id. Returns null if no gateway matches the provided id.

Parameters:
gatewayId - The gateway id to search for.
Returns:
The gateway which matches the provided gateway id, or null.

startService

public void startService()
                  throws SMSLibException,
                         TimeoutException,
                         GatewayException,
                         java.io.IOException,
                         java.lang.InterruptedException
Initializes and starts the SMSLib service. This should be the first call before you use the Service class for sending/receiving messages. The call will try to start all defined gateways.

Throws:
SMSLibException - No Gateways are defined.
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
stopService()

startService

public void startService(boolean startAllGateways)
                  throws SMSLibException,
                         TimeoutException,
                         GatewayException,
                         java.io.IOException,
                         java.lang.InterruptedException
Initializes and starts the SMSLib service. Depending on the parameter, all defined gateways can be requested to start or some may be allowed to fail. This should be the first call before you use the Service class for sending/receiving messages.

Parameters:
startAllGateways - True if all gateways should be started, False if some gateways are allowed to fail.
Throws:
SMSLibException - No Gateways are defined.
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
stopService()

stopService

public void stopService()
                 throws SMSLibException,
                        TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Stops all gateways - does not remove them from Service's internal list. Once stopped, all SMSLib operations will fail. You need to start the gateways again before proceeding.

Throws:
SMSLibException - No Gateways are defined.
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
startService()

readMessages

public int readMessages(java.util.Collection<InboundMessage> msgList,
                        InboundMessage.MessageClasses msgClass)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Reads inbound messages from ALL gateways with the Inbound attribute set. When successful, the message list will contain all messages read.

Parameters:
msgList - A (probably empty) list that will be populated with Inbound messages read.
msgClass - Filtering: Class of messages that need to be read.
Returns:
The number of messages read.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
InboundMessage.MessageClasses

readMessages

public InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass)
                              throws TimeoutException,
                                     GatewayException,
                                     java.io.IOException,
                                     java.lang.InterruptedException
.NET bridge method.

Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

readMessages

public int readMessages(java.util.Collection<InboundMessage> msgList,
                        InboundMessage.MessageClasses msgClass,
                        java.lang.String gatewayId)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Reads inbound messages from the SPECIFIC gateway. When successful, the message list will contain all messages read.

Parameters:
msgList - A (probably empty) list that will be populated with Inbound messages read.
msgClass - Filtering: Class of messages that need to be read.
gatewayId - The identifier of the gateway from which to read messages.
Returns:
The number of messages read.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
InboundMessage.MessageClasses, AGateway

readMessages

public InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass,
                                     java.lang.String gatewayId)
                              throws TimeoutException,
                                     GatewayException,
                                     java.io.IOException,
                                     java.lang.InterruptedException
.NET bridge method.

Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

readMessages

public int readMessages(java.util.Collection<InboundMessage> msgList,
                        InboundMessage.MessageClasses msgClass,
                        AGateway gateway)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Reads inbound messages from the SPECIFIC gateway. When successful, the message list will contain all messages read.

Parameters:
msgList - A (probably empty) list that will be populated with inbound messages read.
msgClass - Filtering: Class of messages that need to be read.
gateway - The gateway object from which to read messages.
Returns:
The number of messages read.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
InboundMessage.MessageClasses, AGateway

readMessages

public InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass,
                                     AGateway gateway)
                              throws TimeoutException,
                                     GatewayException,
                                     java.io.IOException,
                                     java.lang.InterruptedException
.NET bridge method.

Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

readMessage

public InboundMessage readMessage(java.lang.String gatewayId,
                                  java.lang.String memLoc,
                                  int memIndex)
                           throws TimeoutException,
                                  GatewayException,
                                  java.io.IOException,
                                  java.lang.InterruptedException
Reads a specific gateway for a message matching the given Memory Location and Memory Index.

This is a "dummy" approach. It does not implement the CGMR command, rather it reads all messages and searches for a match.

Parameters:
gatewayId - The Gateway ID of the gateway to read from.
memLoc - The memory location string.
memIndex - The memory index.
Returns:
The message read. Null if no relevant message is found or if the Gateway ID given is invalid.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.

sendMessage

public boolean sendMessage(OutboundMessage msg)
                    throws TimeoutException,
                           GatewayException,
                           java.io.IOException,
                           java.lang.InterruptedException
Sends a single message. The following logic is applied in order for SMSLib to decide from which gateway it will send the message:
1. If the message holds gateway information (member field "gatewayId"), SMSLib will try to send it from that gateway.
2. If the message does not hold gateway information (member field "gatewayId" is empty or "*") then if router and load balancer is defined, then message is processed by these classes.
3. Otherwise the method selects the first outbound-capable gateway defined and sends the message from it.
The method blocks until the message is actually sent (synchronous operation).

Parameters:
msg - An OutboundMessage object.
Returns:
True if the message is sent.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
queueMessage(OutboundMessage)

sendMessage

public boolean sendMessage(OutboundMessage msg,
                           java.lang.String gatewayId)
                    throws TimeoutException,
                           GatewayException,
                           java.io.IOException,
                           java.lang.InterruptedException
Sends a single message from the specified gateway.

Parameters:
msg - An OutboundMessage object.
gatewayId - The id of the gateway that will be used for sending.
Returns:
True if the message is sent.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
sendMessage(OutboundMessage)

sendMessages

public int sendMessages(java.util.Collection<OutboundMessage> msgList)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Sends a list of messages.

Parameters:
msgList - A list of OutboundMessage objects.
Returns:
The number of messages sent.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
sendMessage(OutboundMessage)

sendMessages

public int sendMessages(OutboundMessage[] msgArray)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
.NET bridge method.

Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

sendMessages

public int sendMessages(java.util.Collection<OutboundMessage> msgList,
                        java.lang.String gatewayId)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Sends a list of messages from the specified gateway.

Parameters:
msgList - A list of OutboundMessage objects.
gatewayId - The id of the gateway that will be used for sending.
Returns:
The number of messages sent.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.
See Also:
sendMessage(OutboundMessage)

sendMessages

public int sendMessages(OutboundMessage[] msgArray,
                        java.lang.String gatewayId)
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
.NET bridge method.

Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

queueMessage

public boolean queueMessage(OutboundMessage msg)
Queues a message for sending. The gateway selection logic is the same as for sendMessage(). The method does not block - returns immediately. If you wish to be alerted about the fate of the message, you may implement a IOutboundMessageNotification listener.

Parameters:
msg - Message to be sent
Returns:
True if the message is accepted in the Queue.
See Also:
queueMessageAt(OutboundMessage, Date), sendMessage(OutboundMessage), IOutboundMessageNotification

queueMessage

public boolean queueMessage(OutboundMessage msg,
                            java.lang.String gatewayId)
Queues a message for sending from the specific gateway.

Parameters:
msg - A OutboundMessage object.
gatewayId - The id of the gateway that will be used for sending.
Returns:
True if the message is accepted in the Queue.
See Also:
queueMessage(OutboundMessage)

queueMessages

public int queueMessages(java.util.Collection<OutboundMessage> msgList)
Queues a list of messages for sending.

Parameters:
msgList - A list of OutboundMessage objects.
Returns:
The number of messages accepted in the Queue.
See Also:
queueMessage(OutboundMessage)

queueMessages

public int queueMessages(OutboundMessage[] msgArray)
.NET bridge method.


queueMessages

public int queueMessages(java.util.Collection<OutboundMessage> msgList,
                         java.lang.String gatewayId)
Queues a list of messages for sending from the specific gateway.

Parameters:
msgList - A list of OutboundMessage objects.
gatewayId - The id of the gateway to be used for sending.
Returns:
The number of messages accepted in the Queue.
See Also:
queueMessage(OutboundMessage)

queueMessages

public int queueMessages(OutboundMessage[] msgArray,
                         java.lang.String gatewayId)
.NET bridge method.


queueMessageAt

public boolean queueMessageAt(OutboundMessage msg,
                              java.util.Date at)
Queues a message for sending at a specific time. The gateway selection logic is the same as for sendMessage(). The method does not block - returns immediately. If you wish to be alerted about the fate of the message, you may implement a IOutboundMessageNotification listener.

Parameters:
msg - The message to be sent.
at - The date/time that the message should be sent at.
Returns:
True if the message is accepted in the Queue.
See Also:
queueMessageAt(OutboundMessage, long), queueMessage(OutboundMessage)

queueMessageAt

public boolean queueMessageAt(OutboundMessage msg,
                              long delayMillis)
Queues a message for sending with a specific delay. The gateway selection logic is the same as for sendMessage(). The method does not block - returns immediately. If you wish to be alerted about the fate of the message, you may implement a IOutboundMessageNotification listener.

Parameters:
msg - The message to be sent.
delayMillis - The delay (ms) that the message should be sent after.
Returns:
True if the message is accepted in the Queue.
See Also:
queueMessageAt(OutboundMessage, Date), queueMessage(OutboundMessage)

removeMessage

public boolean removeMessage(OutboundMessage msg)
Attempts to remove the specified message from the background sending queue. Can only be used for messages previously queued up with the queueMessage() calls.

Parameters:
msg - The outbound message to be removed.
Returns:
true if the message was removed from the queue.

removeMessage

public boolean removeMessage(java.lang.String messageId)
Attempts to remove the message with the specified ID from the background queue. Can only be used for messages previously queued with the queueMessage() call.

Parameters:
messageId - The ID of the message to be removed.
Returns:
true if the message was removed from the queue.

deleteMessage

public boolean deleteMessage(InboundMessage msg)
                      throws TimeoutException,
                             GatewayException,
                             java.io.IOException,
                             java.lang.InterruptedException
Deletes the specified message. The operation is not supported by all gateways.

Parameters:
msg - The message to be deleted. It must be a valid InboundMessage object. DO NOT PASS invalid objects to the method!
Returns:
True if the message is deleted.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.

sendUSSDRequest

public boolean sendUSSDRequest(USSDRequest request,
                               java.lang.String gatewayId)
                        throws GatewayException,
                               TimeoutException,
                               java.io.IOException,
                               java.lang.InterruptedException
Throws:
GatewayException
TimeoutException
java.io.IOException
java.lang.InterruptedException

readPhonebook

public int readPhonebook(Phonebook phonebook,
                         java.lang.String gatewayId)
                  throws TimeoutException,
                         GatewayException,
                         java.io.IOException,
                         java.lang.InterruptedException
Loads the phonebook from the specified gateway into a Phonebook class.

Parameters:
phonebook - An already instantiated, empty Phonebook class.
gatewayId - The gateway id for which the phonebook should be loaded
Returns:
The number of phonebook entries read.
Throws:
TimeoutException - The gateway did not respond in a timely manner.
GatewayException - A Gateway error occurred.
java.io.IOException - An IO error occurred.
java.lang.InterruptedException - The call was interrupted.

getInboundMessageCount

public int getInboundMessageCount(java.lang.String gatewayId)
Returns the total number of messages received by the specified gateway.

Parameters:
gatewayId - The id of the gateway to query.
Returns:
The number of received messages or -1 on error.

getInboundMessageCount

public int getInboundMessageCount(AGateway gateway)
Returns the total number of messages received by the specified gateway.

Parameters:
gateway - The AGateway object to query.
Returns:
The number of received messages or -1 on error.

getOutboundMessageCount

public int getOutboundMessageCount(java.lang.String gatewayId)
Returns the total number of messages sent via the specified gateway.

Parameters:
gatewayId - The id of the gateway to query.
Returns:
The number of sent messages or -1 on error.

getOutboundMessageCount

public int getOutboundMessageCount(AGateway gateway)
Returns the total number of messages sent via the specified gateway.

Parameters:
gateway - The AGateway object to query.
Returns:
The number of sent messages or -1 on error.

getInboundMessageCount

public int getInboundMessageCount()
Returns the total number of messages received by all gateways.

Returns:
The number of received messages.

getOutboundMessageCount

public int getOutboundMessageCount()
Returns the total number of messages sent via all gateways.

Returns:
The number of sent messages.

findGateway

public AGateway findGateway(java.lang.String gatewayId)
Find and return a gateway by its ID.

Parameters:
gatewayId - The ID of gateway to find.
Returns:
Gateway object bearing given name, or NULL if not found.

getGateways

public java.util.Collection<AGateway> getGateways()
Returns the list of defined gateways.

Returns:
The list of gateways.

getGatewaysNET

public AGateway[] getGatewaysNET()
.NET bridge method.


getLoadBalancer

public LoadBalancer getLoadBalancer()
Returns the active Load Balancer class.

Returns:
The active LoadBalancer class.
See Also:
LoadBalancer

setLoadBalancer

public void setLoadBalancer(LoadBalancer loadBalancer)
Sets a new Load Balancer.

Parameters:
loadBalancer - The Load Balancer that will take effect.
See Also:
LoadBalancer

getRouter

public Router getRouter()
Returns the active Router class.

Returns:
The active Router class.
See Also:
Router

setRouter

public void setRouter(Router router)
Sets a new Router.

Parameters:
router - The Router that will take effect.
See Also:
Router

routeMessage

public AGateway routeMessage(OutboundMessage msg)
Find best suitable gateway to send specific message through Router and Load Balancer.

Parameters:
msg - Message to be routed
Returns:
Reference to gateway or null if no suitable gateway is found.

getInboundMessageNotification

public IInboundMessageNotification getInboundMessageNotification()
Returns the notification method set for inbound messages. Returns null if no such method is set.

Returns:
The notification method.
See Also:
setInboundMessageNotification(IInboundMessageNotification)

setInboundMessageNotification

public void setInboundMessageNotification(IInboundMessageNotification inboundNotification)
Sets the inbound message notification method. The method must adhere to the IInboundMessageNotification interface. If set, SMSLib will call this method upon arrival of a new inbound message.

Parameters:
inboundNotification - The method to be called.
See Also:
getInboundMessageNotification(), IInboundMessageNotification

getOutboundMessageNotification

public IOutboundMessageNotification getOutboundMessageNotification()
Returns the notification method set for outbound messages. Returns null if no such method is set.

Returns:
The notification method.
See Also:
setOutboundMessageNotification(IOutboundMessageNotification)

setOutboundMessageNotification

public void setOutboundMessageNotification(IOutboundMessageNotification outboundNotification)
Sets the outbound notification method. The method must adhere to the IOutboundMessageNotification interface. If set, SMSLib will call this method upon dispatch of a message through the queueing (asyncronous) calls.

Parameters:
outboundNotification -
See Also:
getOutboundMessageNotification(), IOutboundMessageNotification

getCallNotification

public ICallNotification getCallNotification()
Returns the call notification method. Returns null if no such method is set.

Returns:
The notification method.
See Also:
setCallNotification(ICallNotification)

setCallNotification

public void setCallNotification(ICallNotification callNotification)
Sets the call notification method. The method must adhere to the ICallNotification interface. If set, SMSLib will call this method upon detection of an inbound call.

Parameters:
callNotification -
See Also:
getCallNotification(), ICallNotification

getUSSDNotification

public IUSSDNotification getUSSDNotification()
Returns the USSD notification method. Returns null if no such method is set.

Returns:
The USSD notification method.
See Also:
setUSSDNotification(IUSSDNotification)

setUSSDNotification

public void setUSSDNotification(IUSSDNotification ussdNotification)
Sets the USSD notification method. The method must adhere to the IUSSDNotification interface. If set, SMSLib will call this method upon detection of an inbound USSD datagram.

Parameters:
ussdNotification -
See Also:
getUSSDNotification(), IUSSDNotification

getGatewayStatusNotification

public IGatewayStatusNotification getGatewayStatusNotification()
Returns the gateway status notification method. Returns null if no such method has been set.

Returns:
The notification method.
See Also:
setGatewayStatusNotification(IGatewayStatusNotification)

setGatewayStatusNotification

public void setGatewayStatusNotification(IGatewayStatusNotification gatewayStatusNotification)
Sets the gateway status notification method. The method must adhere to the IGatewayStatusNotification interface. If set, SMSLib will call this method upon every gateway status change.

Parameters:
gatewayStatusNotification -
See Also:
getGatewayStatusNotification(), IGatewayStatusNotification

getQueueSendingNotification

public IQueueSendingNotification getQueueSendingNotification()
Returns the notification method set for Queue sending operation. Returns null if no such method is set.

Returns:
The notification method.
See Also:
setQueueSendingNotification(IQueueSendingNotification)

setQueueSendingNotification

public void setQueueSendingNotification(IQueueSendingNotification queueSendingNotification)
Sets the Queue sending notification method. The method must adhere to the IQueueSendingNotification interface. If set, SMSLib will call this method upon dispatch of a message through the queueing (asyncronous) calls.

Parameters:
queueSendingNotification -
See Also:
getQueueSendingNotification(), IQueueSendingNotification

getOrphanedMessageNotification

public IOrphanedMessageNotification getOrphanedMessageNotification()
Returns the orphaned message notification method, or null if no-one is set.

Returns:
The orphaned notification method.
See Also:
setOrphanedMessageNotification(IOrphanedMessageNotification)

setOrphanedMessageNotification

public void setOrphanedMessageNotification(IOrphanedMessageNotification orphanedMessageNotification)
Sets the orphaned message notification. The method must implement the IOrphanedMessageNotification interface.

Parameters:
orphanedMessageNotification -
See Also:
getOrphanedMessageNotification()

getStartMillis

public long getStartMillis()

getServiceStatus

public Service.ServiceStatus getServiceStatus()

getSettings

public Settings getSettings()
Returns the Settings object, holding SMSLib run-time values.

Returns:
The Settings object.
See Also:
Settings

createGroup

public boolean createGroup(java.lang.String groupName)
Creates a destination group. A group can hold an unlimited number of recipients. Sending a message to a predefined group expands and sends the message to all numbers defined by the group. A group is valid for as long as this instance of SMSLib is active.

Parameters:
groupName - The group name.
Returns:
True if the group creation succeded.
See Also:
removeGroup(String)

removeGroup

public boolean removeGroup(java.lang.String groupName)
Removes a group.

Parameters:
groupName - The name of the group to be removed.
Returns:
True if the removal was a success.
See Also:
createGroup(String)

expandGroup

public java.util.ArrayList<java.lang.String> expandGroup(java.lang.String groupName)
Expands a group to its recipient numbers.

Parameters:
groupName - The group name to be expanded.
Returns:
A list of the numbers that this group represents. If the group is not defined, an empty list is returned.
See Also:
addToGroup(String, String), removeFromGroup(String, String)

addToGroup

public boolean addToGroup(java.lang.String groupName,
                          java.lang.String number)
Adds a number to the specified group.

Parameters:
groupName - The group to which the number is to be added.
number - The number to add.
Returns:
True if the number is added. False if the group is not found.
See Also:
createGroup(String), removeFromGroup(String, String)

removeFromGroup

public boolean removeFromGroup(java.lang.String groupName,
                               java.lang.String number)
Removes a number from the specified group.

Parameters:
groupName - The group from which the number is to be removed.
number - The number to remove.
Returns:
True if the number was removed. False if the group or the number is not found.
See Also:
removeGroup(String), addToGroup(String, String)

checkInGroup

public boolean checkInGroup(java.lang.String groupName,
                            java.lang.String number)
Checks if a number belongs to a group.

Parameters:
groupName - The group in which the number is to be searched.
number - The number to search.
Returns:
True if the number is found.

setQueueManager

public boolean setQueueManager(AbstractQueueManager myQueueManager)

getQueueManager

public AbstractQueueManager getQueueManager()

getNotifyQueueManager

public org.smslib.notify.NotifyQueueManager getNotifyQueueManager()

getKeyManager

public KeyManager getKeyManager()

main

public static void main(java.lang.String[] args)

SMSLib 3.5.3

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