context.arch.widget
Class WPresenceGroup

java.lang.Object
  |
  +--context.arch.BaseObject
        |
        +--context.arch.widget.Widget
              |
              +--context.arch.widget.WPersonPresence
                    |
                    +--context.arch.widget.WPresenceGroup

public class WPresenceGroup
extends WPersonPresence

This class is a context widget that provides information on the preferences of a person whose presence has been detected at a specified location. In particular, this information is the user id (IButton id), location, and group. It has the following callbacks: UPDATE. It supports polling and subscriptions. It subscribes to a WPersonPresence at the the specified location and uses the IIButton2Group.

See Also:
Widget, WPersonPresence, IIButton2Group

Field Summary
static java.lang.String CLASSNAME
          Name of widget
static int DEFAULT_PORT
          Default port to run this widget on is 5500
static java.lang.String GROUP
          Tag for url of user's homepage
 java.lang.String VERSION_NUMBER
          Widget version number
 
Fields inherited from class context.arch.widget.WPersonPresence
ANIND_OFFICE, CLASSNAME, COMMON_AREA, DANIEL_OFFICE, DEFAULT_PORT, FCL, GREGORY_OFFICE, ibutton, LOCATION, USERID, VERSION_NUMBER
 
Fields inherited from class context.arch.widget.Widget
attributes, attributeTypes, callbacks, CLASS, CurrentOffset, DEFAULT_PORT, id, PUT_DATA, PUT_DATA_REPLY, QUERY, QUERY_ATTRIBUTES, QUERY_ATTRIBUTES_REPLY, QUERY_CALLBACKS, QUERY_CALLBACKS_REPLY, QUERY_REPLY, QUERY_SERVICES, QUERY_SERVICES_REPLY, QUERY_VERSION, QUERY_VERSION_REPLY, services, SPACER, storage, subscribers, TIMESTAMP, UPDATE, UPDATE_AND_QUERY, UPDATE_AND_QUERY_REPLY, VERSION, VERSION_NUMBER
 
Fields inherited from class context.arch.BaseObject
communications, EXIT_OK, handlers, ID, parser, PING, PING_REPLY, serviceHandlers
 
Constructor Summary
WPresenceGroup(java.lang.String location, int localport, java.lang.String ihost, int iport)
          Constructor that creates the widget at the given location and monitors communications on the given port.
WPresenceGroup(java.lang.String location, int localport, java.lang.String ihost, int iport, boolean storageFlag)
          Constructor that creates the widget at the given location and monitors communications on the given port.
WPresenceGroup(java.lang.String location, java.lang.String ihost, int iport)
          Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT.
WPresenceGroup(java.lang.String location, java.lang.String ihost, int iport, boolean storageFlag)
          Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT.
 
Method Summary
protected  AttributeNameValues IButtonData2Attributes(IButtonData data)
          This method converts the IButtonData object to an Attributes object.
static void main(java.lang.String[] argv)
          Temporary main method to create a widget with id and port and connection to other low level widgets specified by command line arguments
protected  Attributes setAttributes()
          This method implements the abstract method Widget.setAttributes().
protected  Callbacks setCallbacks()
          This method implements the abstract method Widget.setCallbacks().
 
Methods inherited from class context.arch.widget.WPersonPresence
notify, queryGenerator, setServices
 
Methods inherited from class context.arch.widget.Widget
addSubscriber, canHandle, canHandle, canHandle, canHandle, executeService, getAttributeType, getCurrentTime, getNewOffset, getNewOffsetNoDelay, isAttribute, isCallback, processCallbackReply, putData, queryAttributes, queryCallbacks, queryServices, queryWidget, removeSubscriber, retrieveData, runUserMethod, runWidgetMethod, sendToSubscribers, setAttribute, store, store, updateWidgetInformation
 
Methods inherited from class context.arch.BaseObject
askInterpreter, decodeData, encodeData, executeAsynchronousWidgetService, executeSynchronousWidgetService, getHostAddress, getId, getVersion, getVersion, getWidgetAttributes, getWidgetCallbacks, getWidgetServices, pingComponent, pollWidget, putDataInWidget, queryVersion, quit, retrieveDataFrom, retrieveDataFrom, retrieveDataFrom, retrieveDataFrom, retrieveDataFrom, retrieveDataFrom, retrieveDataFrom, returnPing, runComponentMethod, runMethod, serviceResult, setId, setVersion, subscribeTo, subscribeTo, subscribeTo, subscribeTo, unsubscribeFrom, updateAndPollWidget, userCallback, userRequest, userRequest, userRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_NUMBER

public java.lang.String VERSION_NUMBER
Widget version number

CLASSNAME

public static final java.lang.String CLASSNAME
Name of widget

GROUP

public static final java.lang.String GROUP
Tag for url of user's homepage

DEFAULT_PORT

public static final int DEFAULT_PORT
Default port to run this widget on is 5500
Constructor Detail

WPresenceGroup

public WPresenceGroup(java.lang.String location,
                      java.lang.String ihost,
                      int iport)
Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT. It sets the id of this widget to CLASSNAME_ and enables storage.
Parameters:
location - Location the widget is "monitoring"
ihost - Name of the machine the IButton2Group interpreter is running on
iport - Port number the IButton2Group interpreter is running on
See Also:
WPersonPresence

WPresenceGroup

public WPresenceGroup(java.lang.String location,
                      java.lang.String ihost,
                      int iport,
                      boolean storageFlag)
Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT. It sets the id of this widget to CLASSNAME_ and sets storage to storageFlag.
Parameters:
location - Location the widget is "monitoring"
ihost - Name of the machine the IButton2Group interpreter is running on
iport - Port number the IButton2Group interpreter is running on
storageFlag - Flag to set storage functionality to
See Also:
WPersonPresence

WPresenceGroup

public WPresenceGroup(java.lang.String location,
                      int localport,
                      java.lang.String ihost,
                      int iport)
Constructor that creates the widget at the given location and monitors communications on the given port. It sets the id of this widget to CLASSNAME_ and enables storage.
Parameters:
location - Location the widget is "monitoring"
localport - Port number this widget is running on
ihost - Name of the machine the IIButton2Group is running on
iport - Port number the IIButton2Group is running on
See Also:
WPersonPresence

WPresenceGroup

public WPresenceGroup(java.lang.String location,
                      int localport,
                      java.lang.String ihost,
                      int iport,
                      boolean storageFlag)
Constructor that creates the widget at the given location and monitors communications on the given port. It sets the id of this widget to CLASSNAME_ and sets storage functionality to storageFlag.
Parameters:
location - Location the widget is "monitoring"
localport - Port number this widget is running on
ihost - Name of the machine the IIButton2Group is running on
iport - Port number the IIButton2Group is running on
storageFlag - Flag to indicate whether or not to enable storage
See Also:
WPersonPresence
Method Detail

setAttributes

protected Attributes setAttributes()
This method implements the abstract method Widget.setAttributes(). It defines the attributes for the widget as: TIMESTAMP, USERID, LOCATION, and GROUP
Overrides:
setAttributes in class WPersonPresence
Returns:
the Attributes used by this widget

setCallbacks

protected Callbacks setCallbacks()
This method implements the abstract method Widget.setCallbacks(). It defines the callbacks for the widget as: UPDATE with the attributes TIMESTAMP, USERID, LOCATION, GROUP
Overrides:
setCallbacks in class WPersonPresence
Returns:
the Callbacks used by this widget

IButtonData2Attributes

protected AttributeNameValues IButtonData2Attributes(IButtonData data)
This method converts the IButtonData object to an Attributes object. It overrides the method in WPersonPresence, basically doing the same thing, except it also uses an interpreter to convert the USERID to a GROUP
Overrides:
IButtonData2Attributes in class WPersonPresence
Parameters:
data - IButtonData object to be converted
Returns:
Attributes object containing the data in the IButtonData object

main

public static void main(java.lang.String[] argv)
Temporary main method to create a widget with id and port and connection to other low level widgets specified by command line arguments