context.arch.subscriber
Class Subscriber

java.lang.Object
  |
  +--context.arch.subscriber.Subscriber

public class Subscriber
extends java.lang.Object

This class implements a subscriber object, encapsulating the information needed to create a subscriber and send information to it.

See Also:
Subscribers

Field Summary
static java.lang.String ADD_SUBSCRIBER
          Tag to indicate message is for adding a subscriber
static java.lang.String CALLBACK_NAME
          Tag for callback (on widget side)
static java.lang.String CALLBACK_TAG
          Tag for callback tag (on subscriber side)
static java.lang.String HOSTNAME
          Tag for host machine of component
static int MAX_ERRORS
          Maximum number of consecutive communication errors to be tolerated
static java.lang.String PORT
          Tag for port number of component
static java.lang.String REMOVE_SUBSCRIBER
          Tag to indicate message is for removing a subscriber
static java.lang.String SUBSCRIBER
          Tag for a subscriber
static java.lang.String SUBSCRIBER_ID
          Tag for subscription id
static java.lang.String SUBSCRIPTION_CALLBACK
          Tag to indicate message is a subscription callback
static java.lang.String SUBSCRIPTION_CALLBACK_REPLY
          Tag to indicate message is the reply to a subscription callback message
static java.lang.String SUBSCRIPTION_REPLY
          Tag to indicate message is a subscription reply
 
Constructor Summary
Subscriber(DataObject data)
          Basic constructor that creates a subscriber object from a DataObject.
Subscriber(java.lang.String id, java.lang.String hostname, int port, java.lang.String callback, java.lang.String tag, Conditions conditions, Attributes attributes)
          Basic constructor that creates a subscriber object.
Subscriber(java.lang.String id, java.lang.String hostname, java.lang.String port, java.lang.String callback, java.lang.String tag, Conditions conditions, Attributes attributes)
          Basic constructor that creates a subscriber object.
 
Method Summary
 void addError()
          Increment the error counter
 Attributes getAttributes()
          Returns the subscription attributes to be returned
 java.lang.String getCallback()
          Returns the subscriber callback that the subscriber registered
 Conditions getConditions()
          Returns the subscription conditions, under which the subscriber will be notified
 int getErrors()
          Returns the number of consecutive errors in trying to communicate with this subscriber
 java.lang.String getHostName()
          Returns the name of the subscriber's host computer
 java.lang.String getId()
          Returns the id of the subscriber
 int getPort()
          Returns the port number to send info to
 java.lang.String getTag()
          Returns the widget callback that the subscriber registered for
 void resetErrors()
          Reset the error counter
 void setAttributes(Attributes attributes)
          Sets the attributes to return to the subscriber
 void setCallback(java.lang.String callback)
          Sets the subscriber callback that the subscriber wants to register for
 void setConditions(Conditions conditions)
          Sets the subscription conditions, under which the subscriber will be notified
 void setHostName(java.lang.String hostname)
          Sets the name of the subscriber's host computer
 void setId(java.lang.String id)
          Sets the id of the subscriber
 void setPort(int port)
          Sets the port number to send info to
 void setTag(java.lang.String tag)
          Sets the widget callback that the subscriber wants to register for
 DataObject toDataObject()
          This method converts the subscriber info to a DataObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBSCRIBER

public static final java.lang.String SUBSCRIBER
Tag for a subscriber

HOSTNAME

public static final java.lang.String HOSTNAME
Tag for host machine of component

PORT

public static final java.lang.String PORT
Tag for port number of component

SUBSCRIBER_ID

public static final java.lang.String SUBSCRIBER_ID
Tag for subscription id

SUBSCRIPTION_REPLY

public static final java.lang.String SUBSCRIPTION_REPLY
Tag to indicate message is a subscription reply

CALLBACK_TAG

public static final java.lang.String CALLBACK_TAG
Tag for callback tag (on subscriber side)

CALLBACK_NAME

public static final java.lang.String CALLBACK_NAME
Tag for callback (on widget side)

SUBSCRIPTION_CALLBACK

public static final java.lang.String SUBSCRIPTION_CALLBACK
Tag to indicate message is a subscription callback

ADD_SUBSCRIBER

public static final java.lang.String ADD_SUBSCRIBER
Tag to indicate message is for adding a subscriber

REMOVE_SUBSCRIBER

public static final java.lang.String REMOVE_SUBSCRIBER
Tag to indicate message is for removing a subscriber

SUBSCRIPTION_CALLBACK_REPLY

public static final java.lang.String SUBSCRIPTION_CALLBACK_REPLY
Tag to indicate message is the reply to a subscription callback message

MAX_ERRORS

public static final int MAX_ERRORS
Maximum number of consecutive communication errors to be tolerated
Constructor Detail

Subscriber

public Subscriber(java.lang.String id,
                  java.lang.String hostname,
                  int port,
                  java.lang.String callback,
                  java.lang.String tag,
                  Conditions conditions,
                  Attributes attributes)
Basic constructor that creates a subscriber object.
Parameters:
id - ID of the subscriber
hostname - Name of the subscriber's host computer
port - Port number to send information to
callback - Callback the subscriber will implement
tag - Widget callback the subscriber is subscribing to
conditions - Any subscription conditions to use
attributes - Attributes to return to subscriber

Subscriber

public Subscriber(java.lang.String id,
                  java.lang.String hostname,
                  java.lang.String port,
                  java.lang.String callback,
                  java.lang.String tag,
                  Conditions conditions,
                  Attributes attributes)
Basic constructor that creates a subscriber object.
Parameters:
id - ID of the subscriber
hostname - Name of the subscriber's host computer
port - Port number to send information to
callback - Callback the subscriber will implement
tag - Widget callback the subscriber is subscribing to
conditions - Any subscription conditions to use
attributes - Attributes to return to subscriber

Subscriber

public Subscriber(DataObject data)
Basic constructor that creates a subscriber object from a DataObject. The DataObject must contain a tag
Parameters:
data - DataObject containing the subscriber info
Method Detail

toDataObject

public DataObject toDataObject()
This method converts the subscriber info to a DataObject
Returns:
Subscriber object converted to a DataObject

getId

public java.lang.String getId()
Returns the id of the subscriber
Returns:
the subscriber id

setId

public void setId(java.lang.String id)
Sets the id of the subscriber
Parameters:
id - ID of the subscriber

getHostName

public java.lang.String getHostName()
Returns the name of the subscriber's host computer
Returns:
the host name of the subscriber

setHostName

public void setHostName(java.lang.String hostname)
Sets the name of the subscriber's host computer
Parameters:
hostname - Name of the subscriber's host computer

getPort

public int getPort()
Returns the port number to send info to
Returns:
the port number of the subscriber

setPort

public void setPort(int port)
Sets the port number to send info to
Parameters:
port - Port number to send information to

getCallback

public java.lang.String getCallback()
Returns the subscriber callback that the subscriber registered
Returns:
the callback of the subscriber

setCallback

public void setCallback(java.lang.String callback)
Sets the subscriber callback that the subscriber wants to register for
Parameters:
String - Widget callback being registered for

getTag

public java.lang.String getTag()
Returns the widget callback that the subscriber registered for
Returns:
the widget callback

setTag

public void setTag(java.lang.String tag)
Sets the widget callback that the subscriber wants to register for

setConditions

public void setConditions(Conditions conditions)
Sets the subscription conditions, under which the subscriber will be notified
Parameters:
conditions - Subscription conditions used for notification

getConditions

public Conditions getConditions()
Returns the subscription conditions, under which the subscriber will be notified
Returns:
subscription conditions used for notification

setAttributes

public void setAttributes(Attributes attributes)
Sets the attributes to return to the subscriber
Parameters:
attributes - Attributes to return to the subscriber

getAttributes

public Attributes getAttributes()
Returns the subscription attributes to be returned
Returns:
subscription attributes to return to subscriber

addError

public void addError()
Increment the error counter

resetErrors

public void resetErrors()
Reset the error counter

getErrors

public int getErrors()
Returns the number of consecutive errors in trying to communicate with this subscriber
Returns:
number of consecutive communications errors for this subscriber