com._17od.meteorwebsms.api
Class Meteor

java.lang.Object
  extended by com._17od.meteorwebsms.api.Meteor
All Implemented Interfaces:
Operator

public class Meteor
extends java.lang.Object
implements Operator

This class provides a programmatic API to Meteor's (http://www.mymeteor.ie) web based SMS application.

At the time of writing, every Meteor subscriber receives 300 free web based texts a month.

Example usage with no HTTP proxy:

      Meteor meteor = new Meteor();
      MSISDN recipient = new MSISDN("0867654321");
      meteor.login("0851234567", "1234");
      meteor.sendMessage("hi u k?", recipient);
      meteor.logout();
 

Example usage with HTTP proxy, no username or password required:

      Meteor meteor = new Meteor("www-proxy.domain.com", 8080);
      MSISDN recipient = new MSISDN("0867654321");
      meteor.login("0851234567", "1234");
      meteor.sendMessage("hi u k?", recipient);
      meteor.logout();
 

Example usage with HTTP proxy requiring username or password:

      Meteor meteor = new Meteor("www-proxy.domain.com", 8080, "myuser", "mypass");
      MSISDN recipient = new MSISDN("0867654321");
      meteor.login("0851234567", "1234");
      meteor.sendMessage("hi u k?", recipient);
      meteor.logout();
 

Author:
Adrian Smith

Constructor Summary
Meteor()
           
Meteor(java.lang.String proxyHostname, int proxyPort)
           
Meteor(java.lang.String proxyHostname, int proxyPort, java.lang.String proxyUsername, java.lang.String proxyPassword)
          This constructor initialises the proxy if necessary
 
Method Summary
 java.lang.String getControllerURL()
           
 java.lang.String getInfoURL()
           
 java.lang.String getLogoutURL()
           
 int getNumFreeMessagesLeft()
          Get the number of free text messages left
 void login(java.lang.String username, java.lang.String password)
          Login to the Meteor website using the given username and password
 void logout()
          Logout of the Meteor website.
 void sendMessage(java.lang.String message, MSISDN recipient)
          Send the given message to the given msisdn.
 void setControllerURL(java.lang.String controllerURL)
           
 void setInfoURL(java.lang.String infoURL)
           
 void setLogoutURL(java.lang.String logoutURL)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Meteor

public Meteor()

Meteor

public Meteor(java.lang.String proxyHostname,
              int proxyPort)
Parameters:
proxyHostname -
proxyPort -

Meteor

public Meteor(java.lang.String proxyHostname,
              int proxyPort,
              java.lang.String proxyUsername,
              java.lang.String proxyPassword)
This constructor initialises the proxy if necessary

Parameters:
proxyHostname -
proxyPort -
proxyUsername -
proxyPassword -
Method Detail

login

public void login(java.lang.String username,
                  java.lang.String password)
           throws OperatorException
Login to the Meteor website using the given username and password

Parameters:
username -
password -
Throws:
OperatorException

sendMessage

public void sendMessage(java.lang.String message,
                        MSISDN recipient)
                 throws OperatorException
Send the given message to the given msisdn.

Specified by:
sendMessage in interface Operator
Parameters:
message - The message you want to send
recipient - The recipient of the message
Throws:
OperatorException

getNumFreeMessagesLeft

public int getNumFreeMessagesLeft()
                           throws OperatorException
Get the number of free text messages left

This method works by retrieving the page that contains the number of texts you have left and using a regular expression to pull out the number

Returns:
Throws:
OperatorException

logout

public void logout()
            throws OperatorException
Logout of the Meteor website. It's probably not absolutely necessary to do this but it's no harm and it may help tidy up session stuff on Meteor's side.

Throws:
OperatorException

getControllerURL

public java.lang.String getControllerURL()

setControllerURL

public void setControllerURL(java.lang.String controllerURL)

getInfoURL

public java.lang.String getInfoURL()

setInfoURL

public void setInfoURL(java.lang.String infoURL)

getLogoutURL

public java.lang.String getLogoutURL()

setLogoutURL

public void setLogoutURL(java.lang.String logoutURL)


Copyright © 2007. All Rights Reserved.