home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / fnb101.zip / fnmkior.cmd < prev    next >
OS/2 REXX Batch file  |  1999-06-28  |  3KB  |  88 lines

  1. extproc python -x %PYTHONHOME%\fnmkior.cmd
  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:      Distributed Environment
  28. # File:         $Source: /units/arch/src/Fnorb/script/RCS/fnmkior,v $
  29. # Version:      @(#)$RCSfile: fnmkior,v $ $Revision: 1.4 $
  30. #
  31. #############################################################################
  32. """ Make a CORBA IOR with a single IIOP profile. """
  33.  
  34.  
  35. # Standard/built-in modules.
  36. import sys
  37.  
  38. # Fnorb modules.
  39. from Fnorb.orb import CORBA, IIOP, IOP
  40.  
  41.  
  42. def usage():
  43.     """ Print the usage! """
  44.  
  45.     print 'Usage: fnmkior Hostname Port TypeId ObjectKey'
  46.     print
  47.     print 'e.g.'
  48.     print
  49.     print '% fnmkior sundial.dstc.edu.au 1234 IDL:dstc.edu.au/Foo:1.0 fred' 
  50.  
  51.     sys.exit(1)
  52.  
  53.  
  54. def main(argv):
  55.     """ Do it! """
  56.  
  57.     if len(argv) < 5:
  58.     usage()
  59.  
  60.     # fixme: This should do some error checking!
  61.     host = argv[1]
  62.     port = eval(argv[2])
  63.     type = argv[3]
  64.     key  = argv[4]
  65.  
  66.     # Create an IOR.
  67.     version = IIOP.Version(chr(1), chr(0))
  68.     profile_body = IIOP.ProfileBody(version, host, port, key)
  69.     profile = IOP.TaggedProfile(IOP.TAG_INTERNET_IOP, profile_body)
  70.     ior = IOP.IOR(type, [profile])
  71.  
  72.     # Stringify it.
  73.     sys.stdout.write(ior._fnorb_to_string())
  74.     sys.stdout.write('\n')
  75.     sys.stdout.flush()
  76.  
  77.     return 0
  78.  
  79. #############################################################################
  80.  
  81. if __name__ == '__main__':
  82.     # Do it!
  83.     sys.exit(main(sys.argv[1:]))
  84.  
  85. #############################################################################
  86.