Author: dmeyer
Date: Wed Jan 25 17:43:44 2006
New Revision: 7873
Modified:
trunk/core/src/ipc/mbus_wrapper.py
Log:
remove RPCServer class and put the logic into Instance
Modified: trunk/core/src/ipc/mbus_wrapper.py
==============================================================================
--- trunk/core/src/ipc/mbus_wrapper.py (original)
+++ trunk/core/src/ipc/mbus_wrapper.py Wed Jan 25 17:43:44 2006
@@ -41,7 +41,7 @@
#
# -----------------------------------------------------------------------------
-__all__ = [ 'Instance', 'RPCServer', 'expose' ]
+__all__ = [ 'Instance', 'expose' ]
# python imports
import os
@@ -199,23 +199,6 @@
return decorator
-class RPCServer(object):
- """
- A class holding RPC commands.
- """
- def __init__(self, name='default'):
- # get instance for the given name
- instance = Instance(name)
- # use instance signals
- self.signals = { 'new-entity': instance.signals['new-entity'],
- 'lost-entity': instance.signals['lost-entity'] }
- # connect exposed functions to the mbus
- for func in [ getattr(self, func) for func in dir(self) ]:
- if callable(func) and hasattr(func, '_mbus_rpc'):
- command, ac, as = func._mbus_rpc
- instance.connect_rpc(func, command, add_command=ac,
add_source=as)
-
-
class RemoteEntity(object):
"""
A remote mbus entity.
@@ -405,6 +388,18 @@
self.addRPCCallback(command, r)
+ def connect(self, obj):
+ """
+ Connect exposed functions of an object to this instance.
+ """
+ for func in [ getattr(obj, func) for func in dir(obj) ]:
+ if callable(func) and hasattr(func, '_mbus_rpc'):
+ command, ac, as = func._mbus_rpc
+ self.connect_rpc(func, command, add_command=ac, add_source=as)
+
+
+
+
# Check for mbus configuration file. It is either ~/.mbus or defined
# in the environment variable MBUS.
mbus_config = os.path.expanduser('~/.mbus')
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog