Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## context.arch.widget
Class WContactPresence

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

public class WContactPresence
extends Widget

This class is a context widget that provides information on the presence of a person in a particular location. The information is in the form of a location, user id and user contact information. It has the following callbacks: UPDATE. It supports polling and subscriptions. Currently it only uses the IButton as a means of providing presence. It handles only a single IButton instance.

See Also:
  `Widget`, `PositionIButton`

Field Summary
`static java.lang.String` | `CLASSNAME` Name of widget
`static java.lang.String` | `CONTACT_INFO` Tag for contact info
`static int` | `DEFAULT_PORT` The default port this widget runs on is 5400
`static java.lang.String` | `EMAIL` Tag for contact info - email
`protected PositionIButton` | `ibutton`
`static java.lang.String` | `LOCATION` Tag for user location
`static java.lang.String` | `NAME` Tag for contact info - name
`static java.lang.String` | `USERID` Tag for user id
`java.lang.String` | `VERSION_NUMBER` Widget 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
`WContactPresence(java.lang.String location)` Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT and creates an instance of the IButton position generator.
`WContactPresence(java.lang.String location, boolean storageFlag)` Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT and creates an instance of the IButton position generator.
`WContactPresence(java.lang.String location, int port)` Constructor that creates the widget at the given location and monitors communications on the given port and creates an instance of the IButton position generator.
`WContactPresence(java.lang.String location, int port, boolean storageFlag)` Constructor that creates the widget at the given location and monitors communications on the given port and creates an instance of the IButton position generator.
`WContactPresence(java.lang.String location, int port, java.lang.String id, boolean storageFlag)` Constructor that creates the widget at the given location and monitors communications on the given port and creates an instance of the IButton position generator.

Method Summary
`protected AttributeNameValues` | `IButtonData2Attributes(IButtonData data)` This method converts the IButtonData object to an AttributeNameValues object, adds the user contact information and returns it
`static void` | `main(java.lang.String[] argv)` Temporary main method to create a widget with location and port specified by command line arguments
`void` | `notify(java.lang.String event, java.lang.Object data)` Called by the generator class when a significant event has occurred.
`protected AttributeNameValues` | `queryGenerator()` This method returns an AttributeNameValues object with the latest iButton data.
`protected Attributes` | `setAttributes()` This method implements the abstract method Widget.setAttributes().
`protected Callbacks` | `setCallbacks()` This method implements the abstract method Widget.setCallbacks().
`protected Services` | `setServices()` This method implements the abstract method Widget.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

### USERID

    public static final java.lang.String USERID

  Tag for user id

### LOCATION

    public static final java.lang.String LOCATION

  Tag for user location

### CONTACT_INFO

    public static final java.lang.String CONTACT_INFO

  Tag for contact info

### NAME

    public static final java.lang.String NAME

  Tag for contact info - name

### EMAIL

    public static final java.lang.String EMAIL

  Tag for contact info - email

### CLASSNAME

    public static final java.lang.String CLASSNAME

  Name of widget

### DEFAULT_PORT

    public static final int DEFAULT_PORT

  The default port this widget runs on is 5400

### ibutton

    protected PositionIButton ibutton

Constructor Detail

### WContactPresence

    public WContactPresence(java.lang.String location)

  Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT and creates an instance of the IButton position generator. It also sets the id of this widget to CLASSNAME_ and enables storage functionality.
  Parameters:
    `location` - Location the widget is "monitoring"
  See Also:
    `PositionIButton`

### WContactPresence

    public WContactPresence(java.lang.String location,
                            boolean storageFlag)

  Constructor that creates the widget at the given location and monitors communications on the DEFAULT_PORT and creates an instance of the IButton position generator. It also sets the id of this widget to CLASSNAME_ and sets the storage functionality to storageFlag.
  Parameters:
    `location` - Location the widget is "monitoring"
    `storageFlag` - Flag to set whether storage is used or not
  See Also:
    `PositionIButton`

### WContactPresence

    public WContactPresence(java.lang.String location,
                            int port)

  Constructor that creates the widget at the given location and monitors communications on the given port and creates an instance of the IButton position generator. It also sets the id of this widget to CLASSNAME_ and enables storage functionality.
  Parameters:
    `location` - Location the widget is "monitoring"
    `port` - Port to run the widget on
  See Also:
    `PositionIButton`

### WContactPresence

    public WContactPresence(java.lang.String location,
                            int port,
                            boolean storageFlag)

  Constructor that creates the widget at the given location and monitors communications on the given port and creates an instance of the IButton position generator. It also sets the id of this widget to CLASSNAME_ and sets the storage functionality to storageFlag.
  Parameters:
    `location` - Location the widget is "monitoring"
    `port` - Port to run the widget on
    `storageFlag` - Flag to set whether storage functionality is enabled or not
  See Also:
    `PositionIButton`

### WContactPresence

    public WContactPresence(java.lang.String location,
                            int port,
                            java.lang.String id,
                            boolean storageFlag)

  Constructor that creates the widget at the given location and monitors communications on the given port and creates an instance of the IButton position generator. It also sets the id of this widget to the given id and sets the storage functionality to storageFlag.
  Parameters:
    `location` - Location the widget is "monitoring"
    `port` - Port to run the widget on
    `id` - Widget id
    `storageFlag` - Flag to set whether storage functionality is enabled or not
  See Also:
    `PositionIButton`

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 CONTACT_INFO(NAME,EMAIL)
  Overrides:
    setAttributes in class Widget
  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, USERNAME, LOCATION, CONTACT_INFO (NAME,EMAIL)
  Overrides:
    setCallbacks in class Widget
  Returns:
    the Callbacks used by this widget

### setServices

    protected Services setServices()

  This method implements the abstract method Widget.setServices(). It currently has no services and returns an empty Services object.
  Overrides:
    setServices in class Widget
  Returns:
    the Services provided by this widget

### notify

    public void notify(java.lang.String event,
                       java.lang.Object data)

  Called by the generator class when a significant event has occurred. It creates a DataObject, sends it to its subscribers and stores the data.
  Overrides:
    notify in class Widget
  Parameters:
    `event` - Name of the event that has occurred
    `data` - Object containing relevant event data
  See Also:
    `Widget.sendToSubscribers(String, AttributeNameValues)`, `Widget.store(AttributeNameValues)`

### IButtonData2Attributes

    protected AttributeNameValues IButtonData2Attributes(IButtonData data)

  This method converts the IButtonData object to an AttributeNameValues object, adds the user contact information and returns it
  Parameters:
    `data` - IButtonData object to be converted
  Returns:
    AttributeNameValues object containing the data in the IButtonData object and user contact info

### queryGenerator

    protected AttributeNameValues queryGenerator()

  This method returns an AttributeNameValues object with the latest iButton data.
  Overrides:
    queryGenerator in class Widget
  Returns:
    AttributeNameValues containing the latest data

### main

    public static void main(java.lang.String[] argv)

  Temporary main method to create a widget with location and port specified by command line arguments

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD