context.arch.server
Class SId

java.lang.Object
  |
  +--context.arch.BaseObject
        |
        +--context.arch.widget.Widget
              |
              +--context.arch.server.Server
                    |
                    +--context.arch.server.SId

public class SId
extends Server

This class implements an user id server. It should subscribe to all the widgets that could provide information about its user id.

See Also:
Server

Field Summary
static java.lang.String CLASSNAME
          Name of server
protected  java.lang.String userid
           
static java.lang.String USERID
          Tag to indicate user id (our key)
 java.lang.String VERSION_NUMBER
          Widget version number
 
Fields inherited from class context.arch.server.Server
DEFAULT_PORT, widgets
 
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
SId(int port, java.lang.String userid, boolean storageFlag, WidgetHandles widgets)
          Constructor that creates a user id server for the user id on the specified port.
SId(int port, java.lang.String userid, WidgetHandles widgets)
          Constructor that creates a user id server for the user id on the specified port.
SId(java.lang.String userid, boolean storageFlag, WidgetHandles widgets)
          Constructor that creates a user server for user id on the DEFAULT_PORT.
SId(java.lang.String userid, WidgetHandles widgets)
          Constructor that creates a user server for user id on the DEFAULT_PORT.
 
Method Summary
static void main(java.lang.String[] argv)
          Main method to create a server with userid, port and widgets specified by command line arguments.
protected  AttributeNameValues queryGenerator()
          This method is called when the widget wants to get the latest generator info.
protected  Conditions setConditions()
          This method sets the conditions to apply to the server's subscriptions.
protected  Attributes setServerAttributes()
          This method sets the attributes for the server - those that are specific to the server, and not contained in the widgets it subscribes to.
protected  Callbacks setServerCallbacks()
          This method set the callbacks for a server - those that are specific to the server, and not contained in the widgets it subscribes to.
protected  Services setServerServices()
          This method set the services for a server - those that are specific to the server, and not contained in the widgets it subscribes to.
 
Methods inherited from class context.arch.server.Server
handle, queryWidget, serverSetup, setAttributes, setCallbacks, setServices, setWidgets, startSubscriptions, storeAttributeNameValues
 
Methods inherited from class context.arch.widget.Widget
addSubscriber, canHandle, canHandle, canHandle, canHandle, executeService, getAttributeType, getCurrentTime, getNewOffset, getNewOffsetNoDelay, isAttribute, isCallback, notify, processCallbackReply, putData, queryAttributes, queryCallbacks, queryServices, 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 server

USERID

public static final java.lang.String USERID
Tag to indicate user id (our key)

userid

protected java.lang.String userid
Constructor Detail

SId

public SId(int port,
           java.lang.String userid,
           WidgetHandles widgets)
Constructor that creates a user id server for the user id on the specified port. This server monitors the set of widgets in widgets with storage enabled.
Parameters:
port - Port this server is listening on
userid - User id this server is attached to
widgets - Set of widgets this server monitors

SId

public SId(int port,
           java.lang.String userid,
           boolean storageFlag,
           WidgetHandles widgets)
Constructor that creates a user id server for the user id on the specified port. This server monitors the set of widgets in widgets with storage functionality set to storageFlag
Parameters:
port - Port this server is listening on
userid - User id this server is attached to
widgets - Set of widgets this server monitors
storageFlag - Flag to indicate whether storage is enabled or not

SId

public SId(java.lang.String userid,
           WidgetHandles widgets)
Constructor that creates a user server for user id on the DEFAULT_PORT. This server monitors the set of widgets in widgets with storage enabled.
Parameters:
userid - User id this server is attached to
widgets - Set of widgets this server monitors

SId

public SId(java.lang.String userid,
           boolean storageFlag,
           WidgetHandles widgets)
Constructor that creates a user server for user id on the DEFAULT_PORT. This server monitors the set of widgets in widgets with storage functionality set to storageFlag
Parameters:
userid - User id this server is attached to
widgets - Set of widgets this server monitors
storageFlag - Flag to indicate whether storage is enabled or not
Method Detail

queryGenerator

protected AttributeNameValues queryGenerator()
This method is called when the widget wants to get the latest generator info. Maybe we should query our widgets here?
Overrides:
queryGenerator in class Widget
Returns:
Attributes containing the latest generator information

setServerAttributes

protected Attributes setServerAttributes()
This method sets the attributes for the server - those that are specific to the server, and not contained in the widgets it subscribes to. Currently, there are none.
Overrides:
setServerAttributes in class Server
Returns:
Attributes object containing the server-specific attributes

setServerCallbacks

protected Callbacks setServerCallbacks()
This method set the callbacks for a server - those that are specific to the server, and not contained in the widgets it subscribes to. Currently, there are none.
Overrides:
setServerCallbacks in class Server
Returns:
Callbacks object containing the server-specific callbacks

setServerServices

protected Services setServerServices()
This method set the services for a server - those that are specific to the server, and not contained in the widgets it subscribes to. Currently, there are none.
Overrides:
setServerServices in class Server
Returns:
Services object containing the server-specific services

setConditions

protected Conditions setConditions()
This method sets the conditions to apply to the server's subscriptions. The condition for the User Server is USERID='userid'
Overrides:
setConditions in class Server
Returns:
Conditions containing condition info for server subscriptions

main

public static void main(java.lang.String[] argv)
Main method to create a server with userid, port and widgets specified by command line arguments. Each widget is specified by: host, port, id