commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/appserver INSTALL src/geasRpcClient.py src...


From: Jan Ischebeck
Subject: gnue/appserver INSTALL src/geasRpcClient.py src...
Date: Mon, 06 May 2002 18:33:00 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jan Ischebeck <address@hidden>  02/05/06 18:32:59

Modified files:
        appserver      : INSTALL 
        appserver/src  : geasRpcClient.py geasRpcServer.py test.py 

Log message:
        update RPC client/server to make the first db connection

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/INSTALL.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/geasRpcClient.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/geasRpcServer.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/appserver/src/test.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gnue/appserver/INSTALL
diff -c gnue/appserver/INSTALL:1.5 gnue/appserver/INSTALL:1.6
*** gnue/appserver/INSTALL:1.5  Wed May  1 20:23:33 2002
--- gnue/appserver/INSTALL      Mon May  6 18:32:59 2002
***************
*** 1,46 ****
  
  
! This is a preview release. There is no special installation 
! process; everything can be run from the source directory.
  
  
  Based on a simple example, there are three programms you can test:
  
! 1. python test.py
! =================
  
  A simple test of the application server.
  
  
! 2. python geasRpcServer.py
! ============================
  
  The same example, just using GNURPC. (server part)
! Attention: You have to setup GNURPC first (see below).
  
! 3. python geasRpcClient.py
  ============================
  
  The same example, just using GNURPC. (client part)
! Attention: You have to setup GNURPC first (see below).
! 
! 
! How to setup GNURPC:
! --------------------
! 
! 
! 1. install the newest version of GNUE/common from CVS
! 
! 2. get all python librarys for the protocols you want to test.
!    (have a look at common/doc/RPC-Status.txt for the supported
!     protocolls)
!    
! 3. setup your PYTHONPATH to include GNUE/common in it
!    (if you are running GNU Forms from your local cvs copy
!     just get the path settings from ~/bin/gfcvs )
! 
! 4. setup your INSTALL_PREFIX to point to your GNUE/common installation.
!    (if you are running GNU Forms from your local cvs copy
!     just get the path settings from ~/bin/gfcvs )
! 
! 5. now you can call the RPC appserver test
--- 1,27 ----
  
  
! This is a preview release. There is no special installation for 
! normal users. You just have to run ./setup-cvs.py in the main
! gnue cvs directory to set everything up.
  
  
  Based on a simple example, there are three programms you can test:
  
! 1. test.py
! ===========
  
  A simple test of the application server.
+ call "gtestcvs" and press "3"
  
  
! 2. geasRpcServer.py
! ====================
  
  The same example, just using GNURPC. (server part)
! call "gacvs"
  
! 3. geasRpcClient.py
  ============================
  
  The same example, just using GNURPC. (client part)
! call "gtestcvs" and press "2"
Index: gnue/appserver/src/geasRpcClient.py
diff -c gnue/appserver/src/geasRpcClient.py:1.2 
gnue/appserver/src/geasRpcClient.py:1.3
*** gnue/appserver/src/geasRpcClient.py:1.2     Sun May  5 19:38:27 2002
--- gnue/appserver/src/geasRpcClient.py Mon May  6 18:32:59 2002
***************
*** 19,25 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasRpcClient.py,v 1.2 2002/05/05 23:38:27 siesel Exp $
  
  
  
--- 19,25 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasRpcClient.py,v 1.3 2002/05/06 22:32:59 siesel Exp $
  
  
  
***************
*** 53,107 ****
  #   sessMan = requestSessionManager()
  #   print sessMan.Status
  
  
! def run():
!   from geasSession import *
!   from geasList import *
!   from geasInstance import *
! 
!   print "Opening RPC connection ..."
!   params = { 'host': 'localhost',
!              'port': 8765,
!              'transport': 'http' }
!   rpcClient = geasRpcClient('xmlrpc',params)
!   
!   print "Setup an link to the session manager"
!   sessionManager = rpcClient.requestSessionManager()
!   
!   print "Get the status of the session manager"
!   print "Status: ",sessionManager.Status()
! 
!   print "Creating session object ..."
!   #session = geasSession ()
!   session = sessionManager.getNewSession()
!   
!   print "Logging into the session ..."
!   session.login ("hacker", "secret")
!   
!   print "Creating list object ..."
!   list = session.createList ("addressbook::person")
! 
!   print "Setting up list object ..."
!   list.setPrefetch(["name", "street", "city"])
!   list.setConditions([])
!   list.setSort(["zip"])
!   
!   print "Populating list ..."
!   list.populate
!   
!   print "Retrieving first instance ..."
!   instance = list.firstInstance ()
! 
!   print "These are the values of the first instance:"
!   print instance.get ("name")
!   print instance.get ("street")
!   print instance.get ("city")
!   
!   print "Get the status of the session manager again"
!   print "Status: ",sessionManager.Status()
!   
!   print "Thank you for playing!"
  
  
  if __name__ == "__main__":
    run()
--- 53,84 ----
  #   sessMan = requestSessionManager()
  #   print sessMan.Status
  
+ #
+ #  The RPC test
+ #
+ 
+ import test 
+ class rpcTestApp(test.testApp):
+ 
+   def getSession(self):
+     print "Opening RPC connection ..."
+     params = { 'host': 'localhost',
+                'port': 8765,
+                'transport': 'http' }
+     rpcClient = geasRpcClient('xmlrpc',params)
  
!     
!     print "Setup an link to the session manager"
!     sessionManager = rpcClient.requestSessionManager()
!     
!     print "Get the status of the session manager"
!     print "Status: ",sessionManager.Status()
!     
!     print "Creating session object ..."  
!     return sessionManager.getNewSession()    
  
+ def run():
+   rpcTestApp().run()
  
  if __name__ == "__main__":
    run()
Index: gnue/appserver/src/geasRpcServer.py
diff -c gnue/appserver/src/geasRpcServer.py:1.2 
gnue/appserver/src/geasRpcServer.py:1.3
*** gnue/appserver/src/geasRpcServer.py:1.2     Fri May  3 22:52:48 2002
--- gnue/appserver/src/geasRpcServer.py Mon May  6 18:32:59 2002
***************
*** 19,37 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasRpcServer.py,v 1.2 2002/05/04 02:52:48 siesel Exp $
  
  from geasList import *
  from geasSession import *
  
- 
  class geasSessionManager:
    def __init__(self):
      self._sessNo=0
      
    def getNewSession(self):    
      self._sessNo=self._sessNo+1
!     return geasSession ()    
  
    def Shutdown(self):
      pass
--- 19,39 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: geasRpcServer.py,v 1.3 2002/05/06 22:32:59 siesel Exp $
  
  from geasList import *
  from geasSession import *
  
  class geasSessionManager:
    def __init__(self):
      self._sessNo=0
      
    def getNewSession(self):    
      self._sessNo=self._sessNo+1
!     return geasSession (self._connections)
!   
!   def setConnections(self,connections):
!     self._connections=connections
  
    def Shutdown(self):
      pass
***************
*** 45,53 ****
      else:
        return "Running (%s session created)" % self._sessNo
  
! from gnue.common import GComm, openResource
  from gnue.common.GServerApp import GServerApp,GConfig
! import time
  
  # 
=============================================================================
  # RPC application class
--- 47,55 ----
      else:
        return "Running (%s session created)" % self._sessNo
  
! from gnue.common import GComm, openResource, GLoginHandler
  from gnue.common.GServerApp import GServerApp,GConfig
! import time,os
  
  # 
=============================================================================
  # RPC application class
***************
*** 86,92 ****
  
    def requestSessionManager(self):
      #print "SessionManager has started up."
!     return geasSessionManager()
  
  #
  # main
--- 88,108 ----
  
    def requestSessionManager(self):
      #print "SessionManager has started up."
!     sm=geasSessionManager()
!     self.connections.setLoginHandler (testLoginHandler ())
!     sm.setConnections(self.connections)
!     return sm
! 
! # 
=============================================================================
! # Login Handler
! # 
=============================================================================
! 
! class testLoginHandler (GLoginHandler.LoginHandler):
!   def getLogin (self, *arguments):
!     # for this test program, try to log into the database as the current user
!     username = os.environ ["LOGNAME"]
!     return {"_username": username, "_password": "(none)"}
! 
  
  #
  # main
***************
*** 97,102 ****
--- 113,121 ----
    
    print "Exporting our services via xmlrpc (port 8765) ..."
    geas1.setTransports({'xmlrpc':{ 'port': 8765 }})
+ 
+   #print "Exporting our services via pw_xmlrpc (port 8765) ..."
+   #geas1.setTransports({'pw_xmlrpc':{ 'port': 8765 }})
  
    # Sockets not working yet
    #print "Exporting our services via sockets (port 8765) ..."
Index: gnue/appserver/src/test.py
diff -c gnue/appserver/src/test.py:1.6 gnue/appserver/src/test.py:1.7
*** gnue/appserver/src/test.py:1.6      Mon May  6 16:27:57 2002
--- gnue/appserver/src/test.py  Mon May  6 18:32:59 2002
***************
*** 19,25 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: test.py,v 1.6 2002/05/06 20:27:57 reinhard Exp $
  
  import os
  from gnue.common import GClientApp
--- 19,25 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: test.py,v 1.7 2002/05/06 22:32:59 siesel Exp $
  
  import os
  from gnue.common import GClientApp
***************
*** 35,48 ****
    # 
---------------------------------------------------------------------------
    # Main program
    # 
---------------------------------------------------------------------------
! 
!   def run (self):
      # set up login handler
      self.connections.setLoginHandler (testLoginHandler ())
  
      print "Creating session object ..."
!     session = geasSession.geasSession (self.connections)
! 
      print "Logging into the session ..."
      session.login ("hacker", "secret")
  
--- 35,53 ----
    # 
---------------------------------------------------------------------------
    # Main program
    # 
---------------------------------------------------------------------------
!   
!   def getSession(self):
      # set up login handler
      self.connections.setLoginHandler (testLoginHandler ())
  
      print "Creating session object ..."
!     return geasSession.geasSession (self.connections)
!     
!   def run (self):
!     # created extra method to get the session, which can be overwritten
!     # by testRpcApp
!     session = self.getSession()
!     
      print "Logging into the session ..."
      session.login ("hacker", "secret")
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]