Module plugin :: Class Co2Plugin
[show private | hide private]
[frames | no frames]

Class Co2Plugin


base class for co2 plugins.
Method Summary
  __init__(self, var_dict)
__init__(var_dict): var_dict: dictionary passed on from loader.py, contains: 'relay_method': method to use for relaying (plugin to co2); 'debug_method': method to use for debugging; 'log_method': method to use for logging; 'dotted_name': name of this module (package_name.module_name); 'config_filename': name of the config file to load (<module_name>_config).
  __exit__(self)
__exit__(): called by the satellite on exit.
  __repr__(self)
__str__(): returns: string representation of this instance (as it appears in the log etc).
  __str__(self)
__str__(): returns: string representation of this instance (as it appears in the log etc).
  receive(self, data_dict)
receive(data_dict): called by the server's registry.
  send(self, data)
send(data): send data to the relay.
  _load_config(self, path, modulename)
_load_config(path, modulename): import the specified module and set variables specified there as instance attributes.

Method Details

__init__(self, var_dict)
(Constructor)

__init__(var_dict): var_dict: dictionary passed on from loader.py, contains: 'relay_method': method to use for relaying (plugin to co2); 'debug_method': method to use for debugging; 'log_method': method to use for logging; 'dotted_name': name of this module (package_name.module_name); 'config_filename': name of the config file to load (<module_name>_config).

__exit__(self)

__exit__(): called by the satellite on exit. should be overwritten in case the plugin needs to clean up. the server waits until this method returns. (return values are ignored.)

__repr__(self)
(Representation operator)

__str__(): returns: string representation of this instance (as it appears in the log etc). may be overridden.

__str__(self)
(Informal representation operator)

__str__(): returns: string representation of this instance (as it appears in the log etc). may be overridden.

receive(self, data_dict)

receive(data_dict): called by the server's registry. should be overwritten in order for the plugin to access incoming data. this is your ear listening to co2. data_dict: relayed data in a dictionary. (return values are ignored.) NOTE: this method is called by a thread spawned by the satellite. so, while there is basically no need to override it with a threaded method, it is probably a good idea to do so in case processing done by your receive() takes a long time (longer than the intervall between incomming calls), which would result in many threads hanging around on the satellite side waiting for your method to return.

send(self, data)

send(data): send data to the relay. wraps the argument in a dictionary with key "data". data: any type that can be marshalled to xml. NOTE: the satellite's method, that is called in turn to actually send the request to the relay, is threaded. so, there's no need to call this method in a thread since it will return immediately.

_load_config(self, path, modulename)

_load_config(path, modulename): import the specified module and set variables specified there as instance attributes. path: absolute path of directory containing the module to load; modulename: name of the module (no .py? suffix).

Generated by Epydoc 1.1 on Thu Oct 16 16:37:23 2003 http://epydoc.sf.net