home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / csservices.tcl < prev    next >
Text File  |  1997-06-04  |  2KB  |  95 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)csservices.tcl    /main/hindenburg/10
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)csservices.tcl    /main/hindenburg/10   4 Jun 1997 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require csservicen.tcl
  13. # End user added include file section
  14.  
  15. require "csnode.tcl"
  16.  
  17. Class CSServicesNode : {CSNode} {
  18.     constructor
  19.     method destructor
  20.     method childName
  21.     method childObjects
  22.     method createChild
  23.     method reload
  24.     method doUpdate
  25. }
  26.  
  27. constructor CSServicesNode {class this name} {
  28.     set this [CSNode::constructor $class $this $name]
  29.     # Start constructor user section
  30.  
  31.         $this label "<object servers>"
  32.         $this icon rep_services_16
  33.         $this foldState 0
  34.  
  35.         $this canReload 1
  36.  
  37.     # End constructor user section
  38.     return $this
  39. }
  40.  
  41. method CSServicesNode::destructor {this} {
  42.     # Start destructor user section
  43.     # End destructor user section
  44.     $this CSNode::destructor
  45. }
  46.  
  47. method CSServicesNode::childName {this object} {
  48.     return [lindex $object 0]
  49. }
  50.  
  51. method CSServicesNode::childObjects {this} {
  52.     set ns [ORB::nameServer]
  53.     return [$ns serverDefinitions]
  54. }
  55.  
  56. method CSServicesNode::createChild {this object} {
  57.     return [CSServiceNode new $this.[$this childName $object] $object]
  58. }
  59.  
  60. method CSServicesNode::reload {this} {
  61.     set ns [ORB::nameServer]
  62.     $ns reloadServerDefinitions
  63.     $this update 1
  64. }
  65.  
  66. method CSServicesNode::doUpdate {this {rebuild 1}} {
  67.     $this CSNode::doUpdate $rebuild
  68.  
  69.     set ns [ORB::nameServer]
  70.     set file [$ns serversFile]
  71.     set info [$this info]
  72.  
  73.     $info addHeader "Server Definition File"
  74.     $info addItem "Location" $file
  75.  
  76.     if ![BasicFS::exists $file] {
  77.         $info addLine "    File cannot be accessed from this system."
  78.     } else {
  79.     if [catch {set owner [BasicFS::owner $file]} error] {
  80.         set owner "<unknown>"
  81.     } else {
  82.         set error ""
  83.     }
  84.     $info addItem "Owned by" $owner
  85.     if {$error != ""} {
  86.         foreach error [split $error \n] {
  87.         $info addLine "    $error"
  88.         }
  89.     }
  90.     }
  91. }
  92.  
  93. # Do not delete this line -- regeneration end marker
  94.  
  95.