SMSLib 3.5.3

org.smslib.http
Class KannelHTTPGateway

java.lang.Object
  extended by org.smslib.AGateway
      extended by org.smslib.http.KannelHTTPGateway

public class KannelHTTPGateway
extends AGateway

Gateway for Kannel (http://www.kannel.org) Outbound only.

Author:
Bassam Al-Sarori

Nested Class Summary
static class KannelHTTPGateway.KannelSMSCStatuses
           
 
Nested classes/interfaces inherited from class org.smslib.AGateway
AGateway.AsyncEvents, AGateway.GatewayAttributes, AGateway.GatewayStatuses, AGateway.Protocols
 
Constructor Summary
KannelHTTPGateway(java.lang.String smscId, java.lang.String sendUrl, java.lang.String username, java.lang.String password)
          Constructs a new instance object of this class.
 
Method Summary
 java.lang.String getAdminPassword()
           
 java.lang.String getAdminUrl()
           
 KannelHTTPGateway.KannelSMSCStatuses getKannelSMSCStatus()
          Gets SMSC Status from Kannel.
 java.lang.String getPassword()
           
 int getQueueSchedulingInterval()
          Returns the Gateway Queue sending internal (in milliseconds).
 java.lang.String getSendUrl()
           
 java.lang.String getStatusPassword()
           
 java.lang.String getUsername()
           
 boolean isAutoStartSmsc()
           
 boolean isAutoStopSmsc()
           
 boolean sendMessage(OutboundMessage msg)
           
 void setAdminPassword(java.lang.String adminPassword)
           
 void setAdminUrl(java.lang.String adminUrl)
           
 void setAutoStartSmsc(boolean autoStartSmsc)
          Set to true in order to start SMSC whenever startGateway is called.
 void setAutoStopSmsc(boolean autoStopSmsc)
          Set to true in order to stop SMSC whenever stopGateway is called.
 void setPassword(java.lang.String password)
           
 void setSendUrl(java.lang.String sendUrl)
           
 void setStatusPassword(java.lang.String statusPassword)
           
 void setUsername(java.lang.String username)
           
 void startGateway()
           
 boolean startSmsc()
          Sends a start-smsc command to Kannel in order to start SMSC.
 void stopGateway()
           
 boolean stopSmsc()
          Sends a stop-smsc command to Kannel in order to stop SMSC.
 
Methods inherited from class org.smslib.AGateway
deleteMessage, getAttributes, getDeliveryErrorCode, getFrom, getGatewayId, getInboundMessageCount, getMyself, getOutboundMessageCount, getProtocol, getRestartCount, getStatus, incInboundMessageCount, incOutboundMessageCount, isInbound, isOutbound, queryBalance, queryCoverage, queryMessage, queryMessage, readMessage, readMessages, readPhonebook, sendMessages, sendUSSDCommand, sendUSSDCommand, sendUSSDRequest, setAttributes, setDeliveryErrorCode, setFrom, setInbound, setOutbound, setProtocol, setStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KannelHTTPGateway

public KannelHTTPGateway(java.lang.String smscId,
                         java.lang.String sendUrl,
                         java.lang.String username,
                         java.lang.String password)
Constructs a new instance object of this class.

Parameters:
smscId - this gateway's Id. Should be the same as the id used Kannel's SMSC (smsc-id).
sendUrl - URL used to send SMS through Kannel.
username - Kannel's send-sms Username.
password - Kannel's send-sms Password.
Method Detail

sendMessage

public boolean sendMessage(OutboundMessage msg)
                    throws TimeoutException,
                           GatewayException,
                           java.io.IOException,
                           java.lang.InterruptedException
Overrides:
sendMessage in class AGateway
Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

getSendUrl

public java.lang.String getSendUrl()

setSendUrl

public void setSendUrl(java.lang.String sendUrl)

getUsername

public java.lang.String getUsername()

setUsername

public void setUsername(java.lang.String username)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

getAdminUrl

public java.lang.String getAdminUrl()

setAdminUrl

public void setAdminUrl(java.lang.String adminUrl)

getAdminPassword

public java.lang.String getAdminPassword()

setAdminPassword

public void setAdminPassword(java.lang.String adminPassword)

startGateway

public void startGateway()
                  throws TimeoutException,
                         GatewayException,
                         java.io.IOException,
                         java.lang.InterruptedException
Overrides:
startGateway in class AGateway
Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

stopGateway

public void stopGateway()
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Overrides:
stopGateway in class AGateway
Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

startSmsc

public boolean startSmsc()
                  throws TimeoutException,
                         GatewayException,
                         java.io.IOException,
                         java.lang.InterruptedException
Sends a start-smsc command to Kannel in order to start SMSC.

Returns:
true if command was send successfully, false otherwise.
Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

stopSmsc

public boolean stopSmsc()
                 throws TimeoutException,
                        GatewayException,
                        java.io.IOException,
                        java.lang.InterruptedException
Sends a stop-smsc command to Kannel in order to stop SMSC.

Returns:
true if command was send successfully, false otherwise.
Throws:
TimeoutException
GatewayException
java.io.IOException
java.lang.InterruptedException

getKannelSMSCStatus

public KannelHTTPGateway.KannelSMSCStatuses getKannelSMSCStatus()
Gets SMSC Status from Kannel.

Returns:
KannelSMSCStatuses that represents SMSC status. KannelSMSCStatuses.UNKOWN in case status is unknown.

getStatusPassword

public java.lang.String getStatusPassword()

setStatusPassword

public void setStatusPassword(java.lang.String statusPassword)

isAutoStartSmsc

public boolean isAutoStartSmsc()

setAutoStartSmsc

public void setAutoStartSmsc(boolean autoStartSmsc)
Set to true in order to start SMSC whenever startGateway is called.


isAutoStopSmsc

public boolean isAutoStopSmsc()

setAutoStopSmsc

public void setAutoStopSmsc(boolean autoStopSmsc)
Set to true in order to stop SMSC whenever stopGateway is called.


getQueueSchedulingInterval

public int getQueueSchedulingInterval()
Description copied from class: AGateway
Returns the Gateway Queue sending internal (in milliseconds). Should be defined in every actual Gateway implementation.

Specified by:
getQueueSchedulingInterval in class AGateway
Returns:
The scheduling interval (in milliseconds).

SMSLib 3.5.3

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