|
SMSLib 3.5.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.smslib.Service
public class Service
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 |
---|
public Settings S
Method Detail |
---|
public static Service getInstance()
public void addGateway(AGateway gateway) throws GatewayException
gateway
- The gateway to be added.
GatewayException
- You tried to add a gateway while the Service is started.removeGateway(AGateway)
,
getGateways()
public boolean removeGateway(AGateway gateway) throws GatewayException
gateway
- The gateway to be removed.
GatewayException
- You tried to remove a gateway while the Service is started.addGateway(AGateway)
,
getGateways()
public AGateway getGateway(java.lang.String gatewayId)
gatewayId
- The gateway id to search for.
public void startService() throws SMSLibException, TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
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.stopService()
public void startService(boolean startAllGateways) throws SMSLibException, TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
startAllGateways
- True if all gateways should be started, False if some gateways
are allowed to fail.
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.stopService()
public void stopService() throws SMSLibException, TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
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.startService()
public int readMessages(java.util.Collection<InboundMessage> msgList, InboundMessage.MessageClasses msgClass) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
msgList
- A (probably empty) list that will be populated with Inbound
messages read.msgClass
- Filtering: Class of messages that need to be read.
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.InboundMessage.MessageClasses
public InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException
public int readMessages(java.util.Collection<InboundMessage> msgList, InboundMessage.MessageClasses msgClass, java.lang.String gatewayId) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
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.
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.InboundMessage.MessageClasses
,
AGateway
public InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass, java.lang.String gatewayId) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException
public int readMessages(java.util.Collection<InboundMessage> msgList, InboundMessage.MessageClasses msgClass, AGateway gateway) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
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.
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.InboundMessage.MessageClasses
,
AGateway
public InboundMessage[] readMessages(InboundMessage.MessageClasses msgClass, AGateway gateway) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException
public InboundMessage readMessage(java.lang.String gatewayId, java.lang.String memLoc, int memIndex) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
This is a "dummy" approach. It does not implement the CGMR command, rather it reads all messages and searches for a match.
gatewayId
- The Gateway ID of the gateway to read from.memLoc
- The memory location string.memIndex
- The memory index.
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.public boolean sendMessage(OutboundMessage msg) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
msg
- An OutboundMessage object.
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.queueMessage(OutboundMessage)
public boolean sendMessage(OutboundMessage msg, java.lang.String gatewayId) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
msg
- An OutboundMessage object.gatewayId
- The id of the gateway that will be used for sending.
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(OutboundMessage)
public int sendMessages(java.util.Collection<OutboundMessage> msgList) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
msgList
- A list of OutboundMessage objects.
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(OutboundMessage)
public int sendMessages(OutboundMessage[] msgArray) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException
public int sendMessages(java.util.Collection<OutboundMessage> msgList, java.lang.String gatewayId) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
msgList
- A list of OutboundMessage objects.gatewayId
- The id of the gateway that will be used for sending.
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(OutboundMessage)
public int sendMessages(OutboundMessage[] msgArray, java.lang.String gatewayId) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException
public boolean queueMessage(OutboundMessage msg)
msg
- Message to be sent
queueMessageAt(OutboundMessage, Date)
,
sendMessage(OutboundMessage)
,
IOutboundMessageNotification
public boolean queueMessage(OutboundMessage msg, java.lang.String gatewayId)
msg
- A OutboundMessage object.gatewayId
- The id of the gateway that will be used for sending.
queueMessage(OutboundMessage)
public int queueMessages(java.util.Collection<OutboundMessage> msgList)
msgList
- A list of OutboundMessage objects.
queueMessage(OutboundMessage)
public int queueMessages(OutboundMessage[] msgArray)
public int queueMessages(java.util.Collection<OutboundMessage> msgList, java.lang.String gatewayId)
msgList
- A list of OutboundMessage objects.gatewayId
- The id of the gateway to be used for sending.
queueMessage(OutboundMessage)
public int queueMessages(OutboundMessage[] msgArray, java.lang.String gatewayId)
public boolean queueMessageAt(OutboundMessage msg, java.util.Date at)
msg
- The message to be sent.at
- The date/time that the message should be sent at.
queueMessageAt(OutboundMessage, long)
,
queueMessage(OutboundMessage)
public boolean queueMessageAt(OutboundMessage msg, long delayMillis)
msg
- The message to be sent.delayMillis
- The delay (ms) that the message should be sent after.
queueMessageAt(OutboundMessage, Date)
,
queueMessage(OutboundMessage)
public boolean removeMessage(OutboundMessage msg)
msg
- The outbound message to be removed.
public boolean removeMessage(java.lang.String messageId)
messageId
- The ID of the message to be removed.
public boolean deleteMessage(InboundMessage msg) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
msg
- The message to be deleted. It must be a valid InboundMessage
object. DO NOT PASS invalid objects to the method!
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.public boolean sendUSSDRequest(USSDRequest request, java.lang.String gatewayId) throws GatewayException, TimeoutException, java.io.IOException, java.lang.InterruptedException
GatewayException
TimeoutException
java.io.IOException
java.lang.InterruptedException
public int readPhonebook(Phonebook phonebook, java.lang.String gatewayId) throws TimeoutException, GatewayException, java.io.IOException, java.lang.InterruptedException
phonebook
- An already instantiated, empty Phonebook class.gatewayId
- The gateway id for which the phonebook should be loaded
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.public int getInboundMessageCount(java.lang.String gatewayId)
gatewayId
- The id of the gateway to query.
public int getInboundMessageCount(AGateway gateway)
gateway
- The AGateway object to query.
public int getOutboundMessageCount(java.lang.String gatewayId)
gatewayId
- The id of the gateway to query.
public int getOutboundMessageCount(AGateway gateway)
gateway
- The AGateway object to query.
public int getInboundMessageCount()
public int getOutboundMessageCount()
public AGateway findGateway(java.lang.String gatewayId)
gatewayId
- The ID of gateway to find.
public java.util.Collection<AGateway> getGateways()
public AGateway[] getGatewaysNET()
public LoadBalancer getLoadBalancer()
LoadBalancer
public void setLoadBalancer(LoadBalancer loadBalancer)
loadBalancer
- The Load Balancer that will take effect.LoadBalancer
public Router getRouter()
Router
public void setRouter(Router router)
router
- The Router that will take effect.Router
public AGateway routeMessage(OutboundMessage msg)
msg
- Message to be routed
null
if no suitable gateway
is found.public IInboundMessageNotification getInboundMessageNotification()
setInboundMessageNotification(IInboundMessageNotification)
public void setInboundMessageNotification(IInboundMessageNotification inboundNotification)
inboundNotification
- The method to be called.getInboundMessageNotification()
,
IInboundMessageNotification
public IOutboundMessageNotification getOutboundMessageNotification()
setOutboundMessageNotification(IOutboundMessageNotification)
public void setOutboundMessageNotification(IOutboundMessageNotification outboundNotification)
outboundNotification
- getOutboundMessageNotification()
,
IOutboundMessageNotification
public ICallNotification getCallNotification()
setCallNotification(ICallNotification)
public void setCallNotification(ICallNotification callNotification)
callNotification
- getCallNotification()
,
ICallNotification
public IUSSDNotification getUSSDNotification()
setUSSDNotification(IUSSDNotification)
public void setUSSDNotification(IUSSDNotification ussdNotification)
ussdNotification
- getUSSDNotification()
,
IUSSDNotification
public IGatewayStatusNotification getGatewayStatusNotification()
setGatewayStatusNotification(IGatewayStatusNotification)
public void setGatewayStatusNotification(IGatewayStatusNotification gatewayStatusNotification)
gatewayStatusNotification
- getGatewayStatusNotification()
,
IGatewayStatusNotification
public IQueueSendingNotification getQueueSendingNotification()
setQueueSendingNotification(IQueueSendingNotification)
public void setQueueSendingNotification(IQueueSendingNotification queueSendingNotification)
queueSendingNotification
- getQueueSendingNotification()
,
IQueueSendingNotification
public IOrphanedMessageNotification getOrphanedMessageNotification()
setOrphanedMessageNotification(IOrphanedMessageNotification)
public void setOrphanedMessageNotification(IOrphanedMessageNotification orphanedMessageNotification)
orphanedMessageNotification
- getOrphanedMessageNotification()
public long getStartMillis()
public Service.ServiceStatus getServiceStatus()
public Settings getSettings()
Settings
public boolean createGroup(java.lang.String groupName)
groupName
- The group name.
removeGroup(String)
public boolean removeGroup(java.lang.String groupName)
groupName
- The name of the group to be removed.
createGroup(String)
public java.util.ArrayList<java.lang.String> expandGroup(java.lang.String groupName)
groupName
- The group name to be expanded.
addToGroup(String, String)
,
removeFromGroup(String, String)
public boolean addToGroup(java.lang.String groupName, java.lang.String number)
groupName
- The group to which the number is to be added.number
- The number to add.
createGroup(String)
,
removeFromGroup(String, String)
public boolean removeFromGroup(java.lang.String groupName, java.lang.String number)
groupName
- The group from which the number is to be removed.number
- The number to remove.
removeGroup(String)
,
addToGroup(String, String)
public boolean checkInGroup(java.lang.String groupName, java.lang.String number)
groupName
- The group in which the number is to be searched.number
- The number to search.
public boolean setQueueManager(AbstractQueueManager myQueueManager)
public AbstractQueueManager getQueueManager()
public org.smslib.notify.NotifyQueueManager getNotifyQueueManager()
public KeyManager getKeyManager()
public static void main(java.lang.String[] args)
|
SMSLib 3.5.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |