[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7975 - trunk/gnue-common/src/rpc/drivers/pyro
From: |
johannes |
Subject: |
[gnue] r7975 - trunk/gnue-common/src/rpc/drivers/pyro |
Date: |
Wed, 28 Sep 2005 12:35:36 -0500 (CDT) |
Author: johannes
Date: 2005-09-22 22:58:56 -0500 (Thu, 22 Sep 2005)
New Revision: 7975
Modified:
trunk/gnue-common/src/rpc/drivers/pyro/ClientAdapter.py
trunk/gnue-common/src/rpc/drivers/pyro/ServerAdapter.py
Log:
Improved pyro driver
Modified: trunk/gnue-common/src/rpc/drivers/pyro/ClientAdapter.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/pyro/ClientAdapter.py 2005-09-22
15:17:07 UTC (rev 7974)
+++ trunk/gnue-common/src/rpc/drivers/pyro/ClientAdapter.py 2005-09-23
03:58:56 UTC (rev 7975)
@@ -23,9 +23,7 @@
from gnue.common.rpc import client
from gnue.common.rpc.drivers import Base
-from gnue.common.apps import errors
-import Pyro.core
# =============================================================================
# Plugin initialization
@@ -46,6 +44,9 @@
# =============================================================================
class ClientAdapter (Base.Client):
+ """
+ Implementation of a RPC client using the Pyro framework.
+ """
# ---------------------------------------------------------------------------
# Constructor
@@ -56,6 +57,7 @@
@param params: parameter dictionary for adapter initialization
"""
+ import Pyro.core
Base.Client.__init__ (self, params)
# initialize the client and set the default namespace group
@@ -64,13 +66,18 @@
Pyro.core.initClient ()
Pyro.config.PYRO_NS_DEFAULTGROUP = self._pyroGroup
+ self.__getProxyForURI = Pyro.core.getProxyForURI
+
# ---------------------------------------------------------------------------
- #
+ # Return a proxy object to the service at the remote site
# ---------------------------------------------------------------------------
def _getServerProxy_ (self):
"""
+ Return a proxy object to the hosted service at the RPC server.
+
+ @returns: Proxy object
"""
- return Pyro.core.getProxyForURI ("PYRONAME://GNUeRPCService")
+ return self.__getProxyForURI ("PYRONAME://GNUeRPCService")
Modified: trunk/gnue-common/src/rpc/drivers/pyro/ServerAdapter.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/pyro/ServerAdapter.py 2005-09-22
15:17:07 UTC (rev 7974)
+++ trunk/gnue-common/src/rpc/drivers/pyro/ServerAdapter.py 2005-09-23
03:58:56 UTC (rev 7975)
@@ -23,7 +23,6 @@
from gnue.common.rpc import server
from gnue.common.rpc.drivers import Base
-from gnue.common.apps import errors
# =============================================================================
@@ -48,7 +47,17 @@
# =============================================================================
class ServerAdapter (Base.Server):
+ """
+ Implementation of an RPC server using the Pyro (Python Remote Objects)
+ framework.
+ @ivar _ns: the used NameServer to publish services
+ @ivar _daemon: the Pyro daemon controlling all incoming requests and doing
+ all the dispatching
+ @ivar _pyroService: Pyro.core.ObjBase instance acting as proxy to the served
+ python object
+ """
+
# ---------------------------------------------------------------------------
# Constructor
# ---------------------------------------------------------------------------
@@ -68,9 +77,9 @@
self._pyroGroup = ':GNUeRPC'
# initialize pyro server
- Pyro.core.initServer ()
+ Pyro.core.initServer (banner = False)
Pyro.config.PYRO_NS_DEFAULTGROUP = self._pyroGroup
- self._daemon = Pyro.core.Daemon()
+ self._daemon = Pyro.core.Daemon ('PYRO', self._bindto, self._port, True)
# locate the name server
locator = Pyro.naming.NameServerLocator ()
@@ -95,7 +104,6 @@
uri = self._daemon.connect (self._pyroService, 'GNUeRPCService')
-
# ---------------------------------------------------------------------------
# Start the server
@@ -107,16 +115,21 @@
self._daemon.requestLoop ()
finally:
- self._daemon.shutdown ()
+ self._shutdown_ ()
# ---------------------------------------------------------------------------
- #
+ # Shutdown the adapter
# ---------------------------------------------------------------------------
def _shutdown_ (self):
+ """
+ Disconnect the registered object from the NameServer and shutdown the
+ daemon.
+ """
print "Shutting down pyro daemon"
+ self._daemon.disconnect (self._pyroService)
self._daemon.shutdown ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7975 - trunk/gnue-common/src/rpc/drivers/pyro,
johannes <=