home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / fnb101.zip / Lib / site-packages / Fnorb / orb / DSI.py < prev    next >
Text File  |  1999-06-28  |  4KB  |  124 lines

  1. #!/usr/bin/env python
  2. #############################################################################
  3. # Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 1997, 1998, 1999
  4. # All Rights Reserved.
  5. #
  6. # The software contained on this media is the property of the DSTC Pty
  7. # Ltd.  Use of this software is strictly in accordance with the
  8. # license agreement in the accompanying LICENSE.HTML file.  If your
  9. # distribution of this software does not contain a LICENSE.HTML file
  10. # then you have no rights to use this software in any manner and
  11. # should contact DSTC at the address below to determine an appropriate
  12. # licensing arrangement.
  13. #      DSTC Pty Ltd
  14. #      Level 7, GP South
  15. #      Staff House Road
  16. #      University of Queensland
  17. #      St Lucia, 4072
  18. #      Australia
  19. #      Tel: +61 7 3365 4310
  20. #      Fax: +61 7 3365 4311
  21. #      Email: enquiries@dstc.edu.au
  22. # This software is being provided "AS IS" without warranty of any
  23. # kind.  In no event shall DSTC Pty Ltd be liable for damage of any
  24. # kind arising out of or in connection with the use or performance of
  25. # this software.
  26. #
  27. # Project:      Fnorb
  28. # File:         $Source: /units/arch/src/Fnorb/orb/RCS/DSI.py,v $
  29. # Version:      @(#)$RCSfile: DSI.py,v $ $Revision: 1.12 $
  30. #
  31. #############################################################################
  32. """ Implementation of the Dynamic Skeleton Interface (DSI). """
  33.  
  34.  
  35. class ServerRequest:
  36.     """ Implementation of the PIDL ServerRequest interface. """
  37.  
  38.     def __init__(self, request_header, cursor):
  39.     """ Constructor. """
  40.  
  41.     self.__request_header = request_header
  42.     self.__cursor = cursor
  43.  
  44.     return
  45.  
  46.     #########################################################################
  47.     # CORBA interface.
  48.     #########################################################################
  49.     
  50.     def initialise(self, inputs, outputs, exceptions):
  51.     """ Initialise the server request. """
  52.  
  53.     self.__inputs = inputs
  54.     self.__outputs = outputs
  55.     self.__exceptions = exceptions
  56.  
  57.     # The unmarshalled arguments for the request (they are unmarshalled
  58.     # 'on demand' when the 'arguments' method is called).
  59.     self.__arguments = None
  60.  
  61.     return
  62.  
  63.     def operation(self):
  64.     """ Return the operation name. """
  65.  
  66.     return self.__request_header.operation
  67.  
  68.     def inputs(self):
  69.     """ Return the input typecodes. """
  70.  
  71.     return self.__inputs
  72.  
  73.     def outputs(self):
  74.     """ Return the output typecodes. """
  75.  
  76.     return self.__outputs
  77.  
  78.     def exceptions(self):
  79.     """ Return the exception typecodes. """
  80.  
  81.     return self.__exceptions
  82.  
  83.     def arguments(self):
  84.     """ Return the request arguments (as a tuple). """
  85.  
  86.     if self.__arguments is None:
  87.         # Unmarshal each parameter according to its typecode.
  88.         arguments = []
  89.         for tc in self.__inputs:
  90.         arguments.append(tc._fnorb_unmarshal_value(self.__cursor))
  91.  
  92.         self.__arguments = tuple(arguments)
  93.  
  94.     return self.__arguments
  95.  
  96.     def results(self, results):
  97.     """ Set the results of the request. """
  98.  
  99.     self.__results = results
  100.     return
  101.  
  102.     def exception(self, ex):
  103.      """ Set the exception raised by the request. """
  104.  
  105.      self.__ex = ex
  106.      return
  107.  
  108.     #########################################################################
  109.     # Fnorb-specific interface.
  110.     #########################################################################
  111.  
  112.     def _fnorb_exception(self):
  113.     """ Get the exception raised by the request. """
  114.  
  115.     return self.__ex
  116.  
  117.     def _fnorb_results(self):
  118.     """ Get the results of the request. """
  119.     return self.__results
  120.  
  121. #############################################################################
  122.