|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | 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. |
static java.lang.String |
SERVER_TYPE
The tag for the type of this object |
protected WidgetHandles |
widgets
The set of widgets this server is monitoring. |
Fields inherited from class context.arch.BaseObject |
BASEOBJECT_TYPE, communications, DISABLE_PORT, discoverer, EXIT_OK, gFrame, handlers, ID, parser, PING, PING_REPLY, QUERY_DESCRIPTION, QUERY_DESCRIPTION_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 | |
protected void |
addCallback(WidgetHandle handle)
This method allows to subscribe to a new widget |
DataObject |
getServerDescription()
Returns the server description that should be overloaded |
java.lang.String |
getType()
Returns the type of the object This method should be overridden |
DataObject |
getWidgetDescription()
This method overloads the widget method It returns the server specific description |
DataObject |
handle(java.lang.String callback,
DataObject data)
This method implements the handle method in the Handler interface. |
protected Attributes |
initAttributes()
This method is called to aggregate the list of non cosntant attributes that the widgets relevant to this server provide. |
protected Callbacks |
initCallbacks()
This method is called to subscribe to the widgets this server is interested in. |
protected Attributes |
initConstantAttributes()
This method is called to aggregate the list of constant attributes that the widgets relevant to this server provide. |
protected Services |
initServices()
This method is called to aggregate the list of services that the widgets relevant to this widget provide. |
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 abstract Attributes |
setServerAttributes()
This abstract method set the non constant 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 Attributes |
setServerConstantAttributes()
This abstract method set the constant attributes 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. |
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(Attributes atts)
This method stores the attribute name values, both in persistent storage and in local storage. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface context.arch.handler.Handler |
handleIndependentReply |
Field Detail |
public static final java.lang.String SERVER_TYPE
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 |
public java.lang.String getType()
getType
in class Widget
protected void serverSetup()
#setAttributes()
,
#setServices()
public void setWidgets(WidgetHandles widgets)
widgets
- Handles of widgets to subscribe topublic void startSubscriptions()
#setCallbacks()
protected Attributes initAttributes()
initAttributes
in class Widget
protected Attributes initConstantAttributes()
initConstantAttributes
in class Widget
protected abstract Attributes setServerAttributes()
protected abstract Attributes setServerConstantAttributes()
protected Services initServices()
initServices
in class Widget
protected abstract Services setServerServices()
protected Callbacks initCallbacks()
initCallbacks
in class Widget
#setCallbacks()
protected void addCallback(WidgetHandle handle)
handle
- The widget to subscribe toprotected abstract Callbacks setServerCallbacks()
public DataObject handle(java.lang.String callback, DataObject data) throws InvalidMethodException, MethodException
handle
in interface Handler
callback
- The name of the widget callback (on the subscriber side) triggereddata
- DataObject containing the data for the widget callback
InvalidMethodException
- if the callback specified isn't recognized
MethodException
- if the callback specified can't be handled successfullyprotected DataObject queryWidget(DataObject query, boolean update, java.lang.String error)
queryWidget
in class Widget
query
- DataObject containing the query requestupdate
- Whether or not to acquire new dataerror
- String containing the incoming error value
public void storeAttributeNameValues(Attributes atts)
atts
- AttributeNameValues to storepublic DataObject getWidgetDescription()
getWidgetDescription
in class Widget
Widget.getUserDescription()
public DataObject getServerDescription()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |