[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7928 - in trunk/gnue-common/src: . datasources/drivers/other rpc
From: |
johannes |
Subject: |
[gnue] r7928 - in trunk/gnue-common/src: . datasources/drivers/other rpc rpc/drivers rpc/drivers/xmlrpc |
Date: |
Wed, 28 Sep 2005 12:35:25 -0500 (CDT) |
Author: johannes
Date: 2005-09-20 04:18:44 -0500 (Tue, 20 Sep 2005)
New Revision: 7928
Modified:
trunk/gnue-common/src/
trunk/gnue-common/src/datasources/drivers/other/appserver.py
trunk/gnue-common/src/rpc/client.py
trunk/gnue-common/src/rpc/drivers/Base.py
trunk/gnue-common/src/rpc/drivers/xmlrpc/ClientAdapter.py
trunk/gnue-common/src/rpc/drivers/xmlrpc/ServerAdapter.py
Log:
Added _destroy () to the Proxies
Property changes on: trunk/gnue-common/src
___________________________________________________________________
Name: svn:ignore
- *.lo
*.bak
*.pyc
.deps
.libs
_libs
Makefile
Makefile.in
aclocal.m4
config.cache
config.guess
config.h
config.h.in
config.h.win32
config.log
config.status
config.sub
configure
configure.scan
libtool
ltconfig
ltmain.sh
stamp-h
stamp-h.in
stamp.h
version.h
config.h.in
.exrc
install-sh
missing
mkinstalldirs
ABOUT-NLS
build
+ *.lo
*.bak
*.pyc
*.pyo
.deps
.libs
_libs
Makefile
Makefile.in
aclocal.m4
config.cache
config.guess
config.h
config.h.in
config.h.win32
config.log
config.status
config.sub
configure
configure.scan
libtool
ltconfig
ltmain.sh
stamp-h
stamp-h.in
stamp.h
version.h
config.h.in
.exrc
install-sh
missing
mkinstalldirs
ABOUT-NLS
build
Modified: trunk/gnue-common/src/datasources/drivers/other/appserver.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/other/appserver.py
2005-09-20 08:13:21 UTC (rev 7927)
+++ trunk/gnue-common/src/datasources/drivers/other/appserver.py
2005-09-20 09:18:44 UTC (rev 7928)
@@ -492,6 +492,8 @@
def _close_ (self):
if self._sm is not None:
self._sm.close (self._sess_id, False)
+ self._sm._destroy ()
+ self._sm = None
# ---------------------------------------------------------------------------
Modified: trunk/gnue-common/src/rpc/client.py
===================================================================
--- trunk/gnue-common/src/rpc/client.py 2005-09-20 08:13:21 UTC (rev 7927)
+++ trunk/gnue-common/src/rpc/client.py 2005-09-20 09:18:44 UTC (rev 7928)
@@ -117,9 +117,12 @@
import datetime
import mx.DateTime
- if len (sys.argv) == 2 and \
+ if len (sys.argv) >= 2 and \
sys.argv [1] in ['pyro', 'xmlrpc', 'socket', 'soap']:
- obj = attach (sys.argv [1], {'port': 8765})
+ host = len (sys.argv) > 2 and sys.argv [2] or 'localhost'
+ port = len (sys.argv) > 3 and sys.argv [3] or 8765
+
+ obj = attach (sys.argv [1], {'host': host, 'port': port})
else:
print "GNUe RPC test client\n\nUsage: gcvs client.py <transport>"
sys.exit (1)
@@ -195,8 +198,8 @@
res = subobj.dictcheck (other, {'buddy': other})
print "Result-Object (buddy)=", res.printIt ()
- subobj.close ()
- other.close ()
+ subobj._destroy ()
+ other._destroy ()
print 'shutting down server ...'
try:
Modified: trunk/gnue-common/src/rpc/drivers/Base.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/Base.py 2005-09-20 08:13:21 UTC (rev
7927)
+++ trunk/gnue-common/src/rpc/drivers/Base.py 2005-09-20 09:18:44 UTC (rev
7928)
@@ -69,6 +69,9 @@
@param name: (method)-name to be wrapped within a ProxyMethod
"""
+ if name [0] == '_':
+ raise AttributeError, name
+
result = ProxyMethod (self._adapter, name)
self.__dict__ [name] = result
@@ -86,6 +89,15 @@
return "ServerProxy for %s" % self._adapter._url
+ # ---------------------------------------------------------------------------
+ # Close the connection to the remote service
+ # ---------------------------------------------------------------------------
+
+ def _destroy (self):
+
+ self._adapter.destroy ()
+
+
# =============================================================================
# Client adapter
# =============================================================================
@@ -181,6 +193,15 @@
return gLeave (8, self._getServerProxy_ ())
+ # ---------------------------------------------------------------------------
+ # Destroy a client adapter's connection
+ # ---------------------------------------------------------------------------
+
+ def destroy (self):
+
+ pass
+
+
# ===========================================================================
# Virtual functions
# ===========================================================================
Modified: trunk/gnue-common/src/rpc/drivers/xmlrpc/ClientAdapter.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/xmlrpc/ClientAdapter.py 2005-09-20
08:13:21 UTC (rev 7927)
+++ trunk/gnue-common/src/rpc/drivers/xmlrpc/ClientAdapter.py 2005-09-20
09:18:44 UTC (rev 7928)
@@ -107,7 +107,21 @@
return result
+ # ---------------------------------------------------------------------------
+ # Close the HTTP connection
+ # ---------------------------------------------------------------------------
+ def close (self):
+ """
+ Close the transport connection (if still open).
+ """
+
+ if self.__connection:
+ self.__connection.close ()
+ self.__connection = None
+
+
+
# =============================================================================
# XML-RPC client adapter
# =============================================================================
@@ -213,7 +227,18 @@
return proxy._storedItem
+ # ---------------------------------------------------------------------------
+ # Close the underlying transport connection
+ # ---------------------------------------------------------------------------
+ def destroy (self):
+ """
+ Close the transport connection
+ """
+
+ self._transport.close ()
+
+
# =============================================================================
# Proxy class for objects living on the server
# =============================================================================
@@ -237,13 +262,13 @@
# Remove the object from the server's object store
# ---------------------------------------------------------------------------
- def close (self):
+ def _destroy (self):
"""
Remove the object from the server's object store. Further access to this
object will lead to an exception
"""
- self._adapter._callMethod_ ('_remove_object', self._storedItem)
+ self._adapter._callMethod_ ('_destroy', self._storedItem)
# ---------------------------------------------------------------------------
@@ -266,7 +291,7 @@
class ObjectProxyMethod (Base.ProxyMethod):
"""
Provide a callable environment for an L{ObjectProxy}. This will call the
- "_object_call" method at the remote server, giving the id-dictionary and the
+ "_call" method at the remote server, giving the id-dictionary and the
method-name as first and second argument.
"""
@@ -288,7 +313,7 @@
# Add the id-dictionary and the methodname to the rpc-call
nargs = tuple ([self._storeItem, self._methodname] + list (args))
- return self._adapter._callMethod_ ('_object_call', *nargs, **params)
+ return self._adapter._callMethod_ ('_call', *nargs, **params)
def __str__ (self):
return "ObjectProxyMethod '%s' of %s" % (self._methodname, self._storeItem)
Modified: trunk/gnue-common/src/rpc/drivers/xmlrpc/ServerAdapter.py
===================================================================
--- trunk/gnue-common/src/rpc/drivers/xmlrpc/ServerAdapter.py 2005-09-20
08:13:21 UTC (rev 7927)
+++ trunk/gnue-common/src/rpc/drivers/xmlrpc/ServerAdapter.py 2005-09-20
09:18:44 UTC (rev 7928)
@@ -94,8 +94,8 @@
self._tcpServer.register_introspection_functions ()
# Register functions for object support: calling and removing
- self._tcpServer.register_function (self._object_call)
- self._tcpServer.register_function (self._remove_object)
+ self._tcpServer.register_function (self._call)
+ self._tcpServer.register_function (self._destroy)
# ---------------------------------------------------------------------------
@@ -129,7 +129,7 @@
# Call a procedure of a given stored object
# ---------------------------------------------------------------------------
- def _object_call (self, storedObject, method, *parameters):
+ def _call (self, storedObject, method, *parameters):
assert gEnter (9)
return gLeave (9, getattr (storedObject, method) (*parameters))
@@ -139,7 +139,7 @@
# Remove an object from the object store
# ---------------------------------------------------------------------------
- def _remove_object (self, item):
+ def _destroy (self, item):
assert gEnter (9)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7928 - in trunk/gnue-common/src: . datasources/drivers/other rpc rpc/drivers rpc/drivers/xmlrpc,
johannes <=