org.deacon
Class DeaconService

java.lang.Object
  extended by org.deacon.DeaconObservable
      extended by org.deacon.DeaconService
Direct Known Subclasses:
Deacon

public class DeaconService
extends DeaconObservable

Implements the core operation of the Deacon Meteor client.


Constructor Summary
DeaconService(java.lang.String host, java.lang.Integer port)
          Creates a new DeaconService
 
Method Summary
 int catchUpTimeOut()
          Get the timeout after which Deacon will no longer try to retrieve pushes missed while shut down (This applies to all subscriptions) Will return "0" if no timeout.
 void catchUpTimeOut(java.lang.Integer seconds)
          Set the timeout after which Deacon will no longer try to retrieve pushes missed while shut down (This applies to all subscriptions)
 java.lang.Boolean checkChannel(java.lang.String chan)
          Checks to see if the DeaconService is subscribed to the specified channel
 boolean isRunning()
          Checks the status of the DeaconService
 void joinChannel(java.lang.String chan, java.lang.Integer backtrack)
          Adds a subscription in the DeaconService to the specified Meteor server channel
 void leaveChannel(java.lang.String chan)
          Unsubscribes this DeaconService from the specified Meteor channel; Takes effect after the present polling interval terminates.
 void start()
          Initiates or re-opens the connection with the Meteor server
 void stop()
          Closes the connection to the Meteor server; Takes effect after the present polling interval terminates.
 java.lang.String toString()
          Returns a description of the DeaconService
 
Methods inherited from class org.deacon.DeaconObservable
register, unregister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeaconService

public DeaconService(java.lang.String host,
                     java.lang.Integer port)
              throws java.net.UnknownHostException,
                     java.io.IOException,
                     java.lang.Exception
Creates a new DeaconService

Parameters:
host - Meteor server to which this client should connect
port - TCP port on Meteor server that is awaiting connections
Throws:
java.net.UnknownHostException - if host is unreachable
java.io.IOException - if connection cannot be established
java.lang.Exception - if port value is invalid
Method Detail

catchUpTimeOut

public void catchUpTimeOut(java.lang.Integer seconds)
Set the timeout after which Deacon will no longer try to retrieve pushes missed while shut down (This applies to all subscriptions)

Parameters:
seconds - The timeout in seconds (0 = no timeout)

catchUpTimeOut

public int catchUpTimeOut()
Get the timeout after which Deacon will no longer try to retrieve pushes missed while shut down (This applies to all subscriptions) Will return "0" if no timeout.

Returns:
the currently-configured timeout in seconds, or 0 if catchup is disabled

joinChannel

public void joinChannel(java.lang.String chan,
                        java.lang.Integer backtrack)
Adds a subscription in the DeaconService to the specified Meteor server channel

Parameters:
chan - The channel name on the Meteor server
backtrack - The number of previously-pushed messages to retrieve upon subscribing

checkChannel

public java.lang.Boolean checkChannel(java.lang.String chan)
Checks to see if the DeaconService is subscribed to the specified channel

Parameters:
chan - The channel to check
Returns:
a Boolean, true if the specified channel is subscribed

leaveChannel

public void leaveChannel(java.lang.String chan)
Unsubscribes this DeaconService from the specified Meteor channel; Takes effect after the present polling interval terminates.

Parameters:
chan - The channel name on the Meteor server

start

public void start()
           throws java.lang.Exception
Initiates or re-opens the connection with the Meteor server

Throws:
java.lang.Exception - if Deacon is already running when the start() method is called

stop

public void stop()
Closes the connection to the Meteor server; Takes effect after the present polling interval terminates.


toString

public java.lang.String toString()
Returns a description of the DeaconService

Overrides:
toString in class java.lang.Object

isRunning

public boolean isRunning()
Checks the status of the DeaconService

Returns:
true if DeaconService is running; false if DeaconService is stopped