commit-gnue
[Top][All Lists]
Advanced

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

gnue/common doc/RPC-abstraction.txt src/GComm.p...


From: Jason Cater
Subject: gnue/common doc/RPC-abstraction.txt src/GComm.p...
Date: Thu, 06 Dec 2001 01:26:37 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/12/06 01:26:36

Modified files:
        common/doc     : RPC-abstraction.txt 
        common/src     : GComm.py 
        common/src/commdrivers/_parser: Parser.py 
        common/src/commdrivers/_test: donuts.grpc server.py 
        common/src/commdrivers/xmlrpc: CommDriver.py 

Log message:
        more work on gnurpc/gcomm; syncing machines

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/doc/RPC-abstraction.txt.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/GComm.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/commdrivers/_parser/Parser.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/commdrivers/_test/donuts.grpc.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/commdrivers/_test/server.py.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/commdrivers/xmlrpc/CommDriver.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: gnue/common/doc/RPC-abstraction.txt
diff -c gnue/common/doc/RPC-abstraction.txt:1.2 
gnue/common/doc/RPC-abstraction.txt:1.3
*** gnue/common/doc/RPC-abstraction.txt:1.2     Mon Dec  3 00:03:40 2001
--- gnue/common/doc/RPC-abstraction.txt Thu Dec  6 01:26:35 2001
***************
*** 196,202 ****
    server = GComm.attach('xmlrpc', params)
  
  
!   print "Donut Plant Operational Status:"
    print server.DonutProvider.Management.Status()
  
  
--- 196,202 ----
    server = GComm.attach('xmlrpc', params)
  
  
!   print "Donut Plant Operational Status: ", 
    print server.DonutProvider.Management.Status()
  
  
Index: gnue/common/src/GComm.py
diff -c gnue/common/src/GComm.py:1.8 gnue/common/src/GComm.py:1.9
*** gnue/common/src/GComm.py:1.8        Wed Nov 28 10:56:25 2001
--- gnue/common/src/GComm.py    Thu Dec  6 01:26:35 2001
***************
*** 29,34 ****
--- 29,35 ----
  
  import GDebug
  
+ ##############################################################################
  #
  # Attach to a client driver
  #
***************
*** 49,61 ****
    return adapter
  
  
  #
! # Export our services
  #
! def export(driver, schema, params):
!   pass
  
  
  #
  # Exception hierarchy:
  #
--- 50,100 ----
    return adapter
  
  
+ ##############################################################################
  #
! # Bind/export our services
  #
! # Attributes:
! #
! # drivers    A tuple that defines all the transports to be used. The tuple
! #            contains tuples of:
! #              1) driver: A string containing the name of the commdriver
! #                 (e.g., 'xmlrpc' or 'corba')
! #              2) params: A dictionary containing parameters specific to
! #                 the commdriver (e.g., {'port':'8888'} )
! #
! # bindings   A tuple containing binding definitions where a binding definition
! #            is a tuple of:
! #
! #              1) exported service name: Name of the service being bound
! #              2) handler: Method that when called returns a class instance
! #              3) rpcdef: The RPC definition loaded from an XML file
! #
! def bind(drivers, bindings):
!   servers = {}
!   for interface, params in drivers:
!     for binding in bindings:
!       service, handler, rpcdef = binding
! 
!       try:
!         driver = dyn_import('gnue.common.commdrivers.%s' % interface)
!       except ImportError, mesg:
!         GDebug.printMesg(1, \
!            "Unable to import GComm Adapter '%s': \n%s" % (driver,mesg))
!         raise InvalidAdapter, mesg
! 
!       if not (hasattr(driver,'SERVER') and driver.SERVER):
!         raise NoServerAdapter, \
!                "GComm adapter '%s' does not support clients" % interface
! 
!       adapter = driver.Server(params)
!       servers[interface] = adapter
! 
!   return servers
! 
  
  
+ ##############################################################################
  #
  # Exception hierarchy:
  #
Index: gnue/common/src/commdrivers/_parser/Parser.py
diff -c gnue/common/src/commdrivers/_parser/Parser.py:1.1 
gnue/common/src/commdrivers/_parser/Parser.py:1.2
*** gnue/common/src/commdrivers/_parser/Parser.py:1.1   Wed Dec  5 18:15:58 2001
--- gnue/common/src/commdrivers/_parser/Parser.py       Thu Dec  6 01:26:35 2001
***************
*** 57,66 ****
  #  not want the loaded form to connect to databases, etc)
  #######################################################
  
! def loadDefinition(URL, app, initialize=0):
!   return GParser.loadXMLObject (URL, xmlHandler, 'GFForm', 'form',
!            initialize, attributes={"_app": app,
!                                "_connections": app.connections })
  
  
  xmlElements = None
--- 57,65 ----
  #  not want the loaded form to connect to databases, etc)
  #######################################################
  
! def loadDefinition(URL, initialize=0):
!   return GParser.loadXMLObject (URL, xmlHandler, "RpGnuRpc", 'gnurpc',
!            initialize, attributes={})
  
  
  xmlElements = None
Index: gnue/common/src/commdrivers/_test/donuts.grpc
diff -c gnue/common/src/commdrivers/_test/donuts.grpc:1.1 
gnue/common/src/commdrivers/_test/donuts.grpc:1.2
*** gnue/common/src/commdrivers/_test/donuts.grpc:1.1   Wed Dec  5 18:15:58 2001
--- gnue/common/src/commdrivers/_test/donuts.grpc       Thu Dec  6 01:26:35 2001
***************
*** 25,31 ****
          </method>
        </object>
  
!       <method name="getBakery" return="BakingUnit"/>
          <argument name="flavor" type="string"/>
        </method>
  
--- 25,31 ----
          </method>
        </object>
  
!       <method name="getBakingUnit" return="BakingUnit"/>
          <argument name="flavor" type="string"/>
        </method>
  
Index: gnue/common/src/commdrivers/_test/server.py
diff -c gnue/common/src/commdrivers/_test/server.py:1.1 
gnue/common/src/commdrivers/_test/server.py:1.2
*** gnue/common/src/commdrivers/_test/server.py:1.1     Wed Dec  5 18:15:58 2001
--- gnue/common/src/commdrivers/_test/server.py Thu Dec  6 01:26:35 2001
***************
*** 1,5 ****
  
  
  
! from gnue.common import GComm
  
--- 1,89 ----
  
  
+ ################################################
+ # Define our Donut stuff
+ ################################################
  
! class DonutPlace:
!   Bakery = BakingUnit()
!   Management = Management()
! 
! 
! class Management:
! 
!   def Restart(self):
!     print "Restart()"
! 
!   def Shutdown(self, secondsToWait=0):
!     print "Shutdown()"
! 
!   def Status(self):
!     print "Status()"
!     return "A-Ok!"
! 
! 
! class BakingUnit:
!   flavor = "glazed"
!   unitLocation = "Memphis, TN Bakery #1"
! 
!   def __init__(self, flavor, unitLocation):
!     self.flavor = flavor
!     self.unitLocation = unitLocation
! 
!   def get_flavor(self):
!     return flavor
! 
!   def set_flavor(self, flavor):
!     self.flavor = flavor
! 
!   def get_unitLocation(self):
!     return flavor
! 
! #  def set_unitLocation(self, unitLocation):
! #    self.unitLocation = unitLocation
! 
! 
! 
! class Bakery:
!   def getBakingUnit(self, flavor):
!     return BakingUnit(flavor, "Memphis, TN Bakery #1")
! 
! 
! 
! ################################################
! # Expose our stuff via GNUe RPC
! ################################################
! 
! from gnue.common import GComm, openResource
! from gnue.common.GServerApp import GServerApp
! from gnue.common.commdrivers._parser import Parser
! 
! class DonutServery(GServerApp):
! 
!   def run(self):
! 
!     fin = openResource("donuts.grpc","r")
!     rpcdef = Parser.loadDefinition(fin,1)
!     fin.close()
! 
! 
!     # Expose our services to the world
!     params = { 'port': 8765 }
!     GComm.export( [ ('xmlrpc', params) ],
!                   [ ('DonutPlace', self.requestDonutPlace, rpcdef) ] )
! 
!     # Daemonize (if appropriate)
!     GServerApp.run(self)
! 
!   def requestDonutPlace(self):
!     # In real applications, this would probably either
!     #  1) Maintain a single DonutPlace that was always used, or
!     #  2) Maintain a pool of DonutPlaces that got recycled.
!     return DonutPlace()
! 
! 
! 
! if __name__ == '__main__':
!   DonutServery().run()
! 
  
Index: gnue/common/src/commdrivers/xmlrpc/CommDriver.py
diff -c gnue/common/src/commdrivers/xmlrpc/CommDriver.py:1.8 
gnue/common/src/commdrivers/xmlrpc/CommDriver.py:1.9
*** gnue/common/src/commdrivers/xmlrpc/CommDriver.py:1.8        Wed Dec  5 
18:15:58 2001
--- gnue/common/src/commdrivers/xmlrpc/CommDriver.py    Thu Dec  6 01:26:36 2001
***************
*** 27,33 ****
  # NOTES:
  # Requires xmlrpclib from http://www.pythonware.com/products/xmlrpc/
  #
! # Client parameters:
  #
  #    url         The complete URI address of the XML-RPC service.
  #                e.g, url="https://www.domain.com:8888/service.php";
--- 27,33 ----
  # NOTES:
  # Requires xmlrpclib from http://www.pythonware.com/products/xmlrpc/
  #
! # Client Parameters:
  #
  #    url         The complete URI address of the XML-RPC service.
  #                e.g, url="https://www.domain.com:8888/service.php";
***************
*** 36,41 ****
--- 36,45 ----
  #    host        The hostname or IP address of the service
  #    port        The port that the service is located on
  #
+ # Server Parameters:
+ #
+ #    port        The port that the service is located on
+ #
  
  
  
***************
*** 64,69 ****
--- 68,74 ----
    sys.exit()
  
  
+ ##############################################################################
  #
  # ClientAdapter
  #
***************
*** 118,124 ****
--- 123,131 ----
    def setAttribute(self, attribute):
      pass
  
+     
  
+ ##############################################################################
  #
  # ServerAdapter
  #
***************
*** 128,133 ****
--- 135,144 ----
      xmlrpclib.dumps(xmlrpclib.Fault(34543, '%s: %s' % (exception, message)))
  
  
+ 
+ 
+ 
+ ##############################################################################
  #
  # ProxyObject
  #



reply via email to

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