Package com :: Module Mediator :: Class Mediator
[hide private]
[frames] | no frames]

Class Mediator

object --+
         |
        Mediator

Base class for mediator objects. These are objects receiving and emitting messages.

Do not derive from this class directly. Derive from Component or one of its subclasses instead.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
_attach_to_message_bus(self)
 
__repr__(self)
Returns a string representation of this component.
 
set_pass_type(self, ptype)
 
get_pass_type(self)
 
handle_message(self, msg, *args)
Gets invoked when a message arrives on the message bus.
 
drop_event(self)
 
pass_on_event(self)
 
emit_event(self, event, *args)
Emits the given message.
 
emit_message(self, msg, *args)
Emits the given message.
 
call_service(self, svc, *args)
Calls the given service and returns the return value of the service.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables [hide private]
  PASS_TYPE_INVALID = 0
  PASS_TYPE_DROP = 1
  PASS_TYPE_PASS_ON = 2
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

 

Returns a string representation of this component. This is the class name.

Returns:
string representation
Overrides: object.__repr__

handle_message(self, msg, *args)

 

Gets invoked when a message arrives on the message bus. Override this method in subclasses to listen for messages.

Parameters:
  • msg - message
  • args - variable list of arguments

emit_event(self, event, *args)

 

Emits the given message.

Parameters:
  • event - message
  • args - variable list of arguments

Deprecated: use emit_message instead

emit_message(self, msg, *args)

 

Emits the given message.

Parameters:
  • msg - message
  • args - variable list of arguments

call_service(self, svc, *args)

 

Calls the given service and returns the return value of the service. Returns None if the service was not found.

Parameters:
  • svc - service message
  • args - variable list of arguments
Returns:
return value of service