|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--context.arch.BaseObject | +--context.arch.widget.Widget | +--context.arch.server.Server
This class is the basic context server, with attributes and methods that should apply to all context servers. A server is a widget with added gathering and storage facilities. Servers are attached to people (incl. groups), places and things. Basically, a server subscribes to a set of widgets, stores and updates the attribute values from the widgets. A server has a "key" attribute that identifies the entity it is attached to. For example, a user server's key may be USERNAME. The server will only request and store information that pertains to a give value of USERNAME.
Widget
Field Summary | |
static int |
DEFAULT_PORT
Default port to use for communications. |
protected WidgetHandles |
widgets
The set of widgets this server is monitoring. |
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 | |
Server(int port,
java.lang.String id,
boolean storageFlag,
WidgetHandles widgets)
Constructor that sets up internal variables for maintaining the list of server attributes and callbacks. |
|
Server(int port,
java.lang.String id,
WidgetHandles widgets)
Constructor that sets up internal variables for maintaining the list of server attributes and callbacks. |
|
Server(java.lang.String id,
boolean storageFlag,
WidgetHandles widgets)
Constructor that sets up internal variables for maintaining the list of server attributes and callbacks. |
|
Server(java.lang.String clientClass,
java.lang.String serverClass,
int serverPort,
java.lang.String encoderClass,
java.lang.String decoderClass,
boolean storageFlag,
java.lang.String id,
WidgetHandles widgets)
Constructor that sets up internal variables for maintaining the list of server attributes and callbacks, and setting up the Widget info. |
|
Server(java.lang.String clientClass,
java.lang.String serverClass,
int serverPort,
java.lang.String encoderClass,
java.lang.String decoderClass,
java.lang.String storageClass,
java.lang.String id,
WidgetHandles widgets)
Constructor that sets up internal variables for maintaining the list of server attributes and callbacks, and setting up the Widget info. |
|
Server(java.lang.String id,
WidgetHandles widgets)
Constructor that sets up internal variables for maintaining the list of server attributes and callbacks. |
Method Summary | |
DataObject |
handle(java.lang.String callback,
DataObject data)
This method implements the handle method in the Handler interface. |
protected DataObject |
queryWidget(DataObject query,
boolean update,
java.lang.String error)
This method runs a query on a widget, asking for either it's latest acquired data (QUERY) or asking for the widget to acquire and return new data (UPDATE_AND_QUERY). |
protected void |
serverSetup()
This method sets up the server for use. |
protected Attributes |
setAttributes()
This method is called to aggregate the list of attributes that the widgets relevant to this server provide. |
protected Callbacks |
setCallbacks()
This method is called to subscribe to the widgets this server is interested in. |
protected abstract Conditions |
setConditions()
This abstract method sets the conditions to apply to the server's subscriptions. |
protected abstract Attributes |
setServerAttributes()
This abstract method set the attributes for a server - those that are specific to the server, and not contained in the widgets it subscribes to. |
protected abstract Callbacks |
setServerCallbacks()
This abstract method set the callbacks for a server - those that are specific to the server, and not contained in the widgets it subscribes to. |
protected abstract Services |
setServerServices()
This abstract method set the services for a server - those that are specific to the server, and not contained in the widgets it subscribes to. |
protected Services |
setServices()
This method is called to aggregate the list of services that the widgets relevant to this widget provide. |
void |
setWidgets(WidgetHandles widgets)
This method sets the widgets that this server should subscribe to. |
void |
startSubscriptions()
This method is called to subscribe to the widgets this server is interested in. |
void |
storeAttributeNameValues(AttributeNameValues atts)
This method stores the attribute name values, both in persistent storage and in local storage. |
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,
queryGenerator,
queryServices,
removeSubscriber,
retrieveData,
runUserMethod,
runWidgetMethod,
sendToSubscribers,
setAttribute,
store,
store,
updateWidgetInformation |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int DEFAULT_PORT
protected WidgetHandles widgets
Constructor Detail |
public Server(java.lang.String clientClass, java.lang.String serverClass, int serverPort, java.lang.String encoderClass, java.lang.String decoderClass, java.lang.String storageClass, java.lang.String id, WidgetHandles widgets)
clientClass
- Class to use for client communicationsserverClass
- Class to use for server communicationsserverPort
- Port to use for server communicationsencoderClass
- Class to use for communications encodingdecoderClass
- Class to use for communications decodingstorageClass
- Class to use for storageid
- String to use for widget id and persistent storagewidgets
- The set of widgets this server will subscribe topublic Server(java.lang.String clientClass, java.lang.String serverClass, int serverPort, java.lang.String encoderClass, java.lang.String decoderClass, boolean storageFlag, java.lang.String id, WidgetHandles widgets)
clientClass
- Class to use for client communicationsserverClass
- Class to use for server communicationsserverPort
- Port to use for server communicationsencoderClass
- Class to use for communications encodingdecoderClass
- Class to use for communications decodingstorageFlag
- Flag to determine whether storage should be used or notid
- String to use for widget id and persistent storagewidgets
- The set of widgets this server will subscribe topublic Server(int port, java.lang.String id, WidgetHandles widgets)
port
- Port to listen to for incoming messagesid
- Widget idwidgets
- The set of widgets this server will subscribe topublic Server(int port, java.lang.String id, boolean storageFlag, WidgetHandles widgets)
port
- Port to listen to for incoming messagesid
- Widget idstorageFlag
- Flag to determine whether storage should be used or notwidgets
- The set of widgets this server will subscribe topublic Server(java.lang.String id, WidgetHandles widgets)
id
- ID of the widgetwidgets
- The set of widgets this server will subscribe topublic Server(java.lang.String id, boolean storageFlag, WidgetHandles widgets)
id
- ID of the widgetwidgets
- The set of widgets this server will subscribe tostorageFlag
- Flag to determine whether storage should be used or notMethod Detail |
protected void serverSetup()
setAttributes()
,
setServices()
public void setWidgets(WidgetHandles widgets)
widgets
- Handles of widgets to subscribe topublic void startSubscriptions()
setCallbacks()
protected Attributes setAttributes()
protected abstract Attributes setServerAttributes()
protected Services setServices()
protected abstract Services setServerServices()
protected Callbacks setCallbacks()
setCallbacks()
protected abstract Callbacks setServerCallbacks()
protected abstract Conditions setConditions()
public DataObject handle(java.lang.String callback, DataObject data) throws InvalidMethodException, MethodException
callback
- The name of the widget callback (on the subscriber side) triggereddata
- DataObject containing the data for the widget callbackprotected DataObject queryWidget(DataObject query, boolean update, java.lang.String error)
query
- DataObject containing the query requestupdate
- Whether or not to acquire new dataerror
- String containing the incoming error valuepublic void storeAttributeNameValues(AttributeNameValues atts)
atts
- AttributeNameValues to store
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |