context.arch.subscriber
Class Subscribers

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--context.arch.subscriber.Subscribers

public class Subscribers
extends java.util.Vector

This class maintains a list of subscribers, allows additions, removals and updates to individual subscribers.

See Also:
Subscriber, Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Subscribers(MessageHandler mh, java.lang.String id)
          Basic constructor that takes an object that implements the MessageHandler interface and an id to create a logfile name from.
 
Method Summary
 void addSubscriber(java.lang.String id, java.lang.String hostname, int port, java.lang.String callback, java.lang.String tag, Conditions conditions, Attributes attributes)
          Adds a subscriber to the subscriber list
 void addSubscriber(java.lang.String id, java.lang.String hostname, java.lang.String port, java.lang.String callback, java.lang.String tag, Conditions conditions, Attributes attributes)
          Adds a subscriber to the subscriber list
 void addSubscriber(Subscriber sub)
          Adds a subscriber to the subscriber list
 void addSubscriber(Subscriber sub, boolean log)
          Adds a subscriber to the subscriber list
 Subscriber getSubscriber(java.lang.String id, java.lang.String hostname, int port, java.lang.String callback, java.lang.String tag)
          Returns the subscriber with the given name.
 Subscriber getSubscriber(java.lang.String id, java.lang.String hostname, java.lang.String port, java.lang.String callback, java.lang.String tag)
          Returns the subscriber with the given name.
 Subscriber getSubscriberAt(int index)
          Returns the subscriber at the given index.
 java.util.Enumeration getSubscriberNames()
          Returns an enumeration containing all the subscriber names in the list
 java.util.Enumeration getSubscribers()
          Returns an enumeration containing all the subscribers in the list
 int numSubscribers()
          Returns the number of subscribers in the list
 boolean removeSubscriber(java.lang.String id, java.lang.String host, int port, java.lang.String callback, java.lang.String tag)
          Removes a subscriber from the subscriber list
 boolean removeSubscriber(java.lang.String id, java.lang.String host, java.lang.String port, java.lang.String callback, java.lang.String tag)
          Removes a subscriber from the subscriber list
 boolean removeSubscriber(Subscriber sub)
          Removes a subscriber from the subscriber list
 boolean removeSubscriber(Subscriber sub, boolean log)
          Removes a subscriber from the subscriber list
 void updateSubscriber(java.lang.String name, java.lang.String hostname, int port, java.lang.String callback, java.lang.String tag, Conditions conditions, Attributes attributes)
          Updates a subscriber in the subscriber list.
 void updateSubscriber(java.lang.String name, java.lang.String hostname, java.lang.String port, java.lang.String callback, java.lang.String tag, Conditions conditions, Attributes attributes)
          Updates a subscriber in the subscriber list.
 void updateSubscriber(Subscriber sub)
          Updates a subscriber in the subscriber list.
 void updateSubscriber(Subscriber sub, boolean log)
          Updates a subscriber in the subscriber list.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Subscribers

public Subscribers(MessageHandler mh,
                   java.lang.String id)
Basic constructor that takes an object that implements the MessageHandler interface and an id to create a logfile name from.
Method Detail

addSubscriber

public void addSubscriber(java.lang.String id,
                          java.lang.String hostname,
                          int port,
                          java.lang.String callback,
                          java.lang.String tag,
                          Conditions conditions,
                          Attributes attributes)
Adds a subscriber to the subscriber list
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 - Conditions under which subscriber will receive data
attributes - Attributes to return to subscriber

addSubscriber

public void addSubscriber(java.lang.String id,
                          java.lang.String hostname,
                          java.lang.String port,
                          java.lang.String callback,
                          java.lang.String tag,
                          Conditions conditions,
                          Attributes attributes)
Adds a subscriber to the subscriber list
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 - Conditions under which subscriber will receive data
attributes - Attributes to return to subscriber

addSubscriber

public void addSubscriber(Subscriber sub,
                          boolean log)
Adds a subscriber to the subscriber list
Parameters:
sub - Subscriber object to add
log - Whether to log the subscribe or not

addSubscriber

public void addSubscriber(Subscriber sub)
Adds a subscriber to the subscriber list
Parameters:
sub - Subscriber object to add

removeSubscriber

public boolean removeSubscriber(java.lang.String id,
                                java.lang.String host,
                                int port,
                                java.lang.String callback,
                                java.lang.String tag)
Removes a subscriber from the subscriber list
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
Returns:
whether the removal was successful or not

removeSubscriber

public boolean removeSubscriber(java.lang.String id,
                                java.lang.String host,
                                java.lang.String port,
                                java.lang.String callback,
                                java.lang.String tag)
Removes a subscriber from the subscriber list
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
Returns:
whether the removal was successful or not

removeSubscriber

public boolean removeSubscriber(Subscriber sub)
Removes a subscriber from the subscriber list
Parameters:
sub - Subscriber object to remove
Returns:
whether the removal was successful or not

removeSubscriber

public boolean removeSubscriber(Subscriber sub,
                                boolean log)
Removes a subscriber from the subscriber list
Parameters:
sub - Subscriber object to remove
log - Whether to log the subscribe or not
Returns:
whether the removal was successful or not

updateSubscriber

public void updateSubscriber(Subscriber sub)
Updates a subscriber in the subscriber list. The subscriber name is retrieved from the subscriber object and the old subscriber entry with this name is replaced by the given one.
Parameters:
sub - Subscriber object to update

updateSubscriber

public void updateSubscriber(Subscriber sub,
                             boolean log)
Updates a subscriber in the subscriber list. The subscriber name is retrieved from the subscriber object and the old subscriber entry with this name is replaced by the given one.
Parameters:
sub - Subscriber object to update
log - Whether to log the subscribe or not

updateSubscriber

public void updateSubscriber(java.lang.String name,
                             java.lang.String hostname,
                             int port,
                             java.lang.String callback,
                             java.lang.String tag,
                             Conditions conditions,
                             Attributes attributes)
Updates a subscriber in the subscriber list. The old subscriber entry with the given name is replaced by a new subscriber with the given info.
Parameters:
name - Name 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 - Conditions under which subscriber will receive data
attributes - Attributes to return to subscriber

updateSubscriber

public void updateSubscriber(java.lang.String name,
                             java.lang.String hostname,
                             java.lang.String port,
                             java.lang.String callback,
                             java.lang.String tag,
                             Conditions conditions,
                             Attributes attributes)
Updates a subscriber in the subscriber list. The old subscriber entry with the given name is replaced by a new subscriber with the given info.
Parameters:
name - Name 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 - Conditions under which subscriber will receive data
attributes - Attributes to return to subscriber

getSubscriberAt

public Subscriber getSubscriberAt(int index)
Returns the subscriber at the given index. Do not assume that a given subscriber's index will stay constant throughout its lifetime. When other subscribers are added and removed, a given subscriber's index may change.
Parameters:
index - index value of the Subscriber object to retrieve

getSubscriber

public Subscriber getSubscriber(java.lang.String id,
                                java.lang.String hostname,
                                int port,
                                java.lang.String callback,
                                java.lang.String tag)
Returns the subscriber with the given name.
Parameters:
id - ID of the Subscriber object to retrieve
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

getSubscriber

public Subscriber getSubscriber(java.lang.String id,
                                java.lang.String hostname,
                                java.lang.String port,
                                java.lang.String callback,
                                java.lang.String tag)
Returns the subscriber with the given name.
Parameters:
id - ID of the Subscriber object to retrieve
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

getSubscribers

public java.util.Enumeration getSubscribers()
Returns an enumeration containing all the subscribers in the list

getSubscriberNames

public java.util.Enumeration getSubscriberNames()
Returns an enumeration containing all the subscriber names in the list

numSubscribers

public int numSubscribers()
Returns the number of subscribers in the list