Package AccessGrid :: Module SharedAppClient :: Class SharedAppClient
[show private | hide private]
[frames | no frames]

Class SharedAppClient


The SharedAppClient may be used when building shared applications. This class encapsulates a handler to the application service and the event service associated with the application. The SharedAppClient provides an interface to the Shared Application.
Method Summary
  __init__(self, appName)
Creates the client.
  GetApplicationID(self)
Access method for application service specific ID.
  GetApplicationState(self)
Access method for application state.
  GetComponents(self)
Access method for all instances connected to the application service.
  GetData(self, dataKey)
Get data from application service
  GetDataKeys(self)
Access method for data keys.
  GetParticipants(self)
Access method for participants.
  GetPublicId(self)
Access method for public ID.
  GetVenueURL(self)
Access method for venue URL where the application service is running.
  HandleEvent(self, event)
This method is called when an event is distributed in the application service.
  InitLogging(self, debug, log)
This method sets up logging that prints debug and error messages.
  Join(self, appServiceUrl, clientProfile)
Connect registers this client with the SharedApplication at specified URL.
  RegisterEventCallback(self, eventType, callback)
Register callback for event.
  SendEvent(self, eventType, data)
Post an event to all applications connected to the service.
  SetData(self, dataKey, dataValue)
Add data to application service.
  SetParticipantProfile(self, profile)
Set your profile.
  SetParticipantStatus(self, status)
Set your status.
  Shutdown(self)
Exit from application service and shut down event client.

Method Details

__init__(self, appName)
(Constructor)

Creates the client.

**Arguments**

*appName* The name of the application. Log file is by default named <appName>.log.

GetApplicationID(self)

Access method for application service specific ID.

**Returns**

*appId* ID associated with the application service we are connected to.

GetApplicationState(self)

Access method for application state.

**Returns**

*state* Application state.

GetComponents(self)

Access method for all instances connected to the application service.

**Returns**

*components* List of public IDs for each instance connected to the application service.

GetData(self, dataKey)

Get data from application service

**Arguments**

*dataKey* Unique id of data available in the service

**Returns**

*dataValue* The value associated with the specified dataKey

GetDataKeys(self)

Access method for data keys.

**Returns**

*keys* List of data keys.

GetParticipants(self)

Access method for participants.

**Returns**

*participants* List of AppParticipantDescriptions.

GetPublicId(self)

Access method for public ID.

**Returns**

*publicId* Id associated with this client.

GetVenueURL(self)

Access method for venue URL where the application service is running.

**Returns**

*url* URL to venue where the application service is running.

HandleEvent(self, event)

This method is called when an event is distributed in the application service. NOTE: Used internally.

InitLogging(self, debug=0, log=None)

This method sets up logging that prints debug and error messages. If you want to see more logging information use the appName 'AG', then you'll see logging information from the Access Grid Module.

For more information about the logging module, check out: http://www.red-dove.com/python_logging.html

**Arguments**

*debug* If debug is set to 1, log messages will be printed to file and command window

*log* Name of log file. If set to None, <appName>.log is used

Join(self, appServiceUrl, clientProfile=None)

Connect registers this client with the SharedApplication at specified URL. The registration gives access to the EventService used for data communication among applications connected to this service.

**Arguments**

*appServiceUrl* location of application service.

RegisterEventCallback(self, eventType, callback)

Register callback for event. Several callbacks can be registered for each event.

**Arguments**

*eventType* Event to listen for.

*callback* Method called when receiving event of type eventType.

SendEvent(self, eventType, data)

Post an event to all applications connected to the service.

Note: This client will receive its own events.

**Arguments**

*eventType* Event to send

*data* Data associated with this event

SetData(self, dataKey, dataValue)

Add data to application service.

Note: If data with same dataKey is already present in the application service, the old dataValue will be overwritten.

**Arguments**

*dataKey* Unique id for this data

*dataValue* The actual data

SetParticipantProfile(self, profile)

Set your profile.

**Arguments**

*profile* Your ClientProfile.

SetParticipantStatus(self, status)

Set your status.

**Arguments**

*status* Status string

Shutdown(self)

Exit from application service and shut down event client.

Generated by Epydoc 2.1 on Thu May 6 15:40:35 2004 http://epydoc.sf.net