home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 October / PCWorld_1998-10_cd.bin / software / prehled / komix / DATA.Z / csservicen.tcl < prev    next >
Text File  |  1997-11-05  |  4KB  |  142 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)csservicen.tcl    /main/titanic/7
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)csservicen.tcl    /main/titanic/7   5 Nov 1997 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require "csentrydia.tcl"
  13. # End user added include file section
  14.  
  15. require "csnode.tcl"
  16.  
  17. Class CSServiceNode : {CSNode} {
  18.     method destructor
  19.     constructor
  20.     method changeEntry
  21.     method removeEntry
  22.     method shutdown
  23.     method doRemove
  24.     method doUpdateFromEntry
  25.     method doUpdate
  26.     attribute serverName
  27.     attribute serverId
  28.     attribute entryDialog
  29. }
  30.  
  31. method CSServiceNode::destructor {this} {
  32.     # Start destructor user section
  33.     # End destructor user section
  34.     $this CSNode::destructor
  35. }
  36.  
  37. constructor CSServiceNode {class this name entry} {
  38.     set this [CSNode::constructor $class $this $name]
  39.  
  40.     $this serverName    [lindex $entry 0]
  41.     $this serverId    [lindex $entry 1]
  42.  
  43.     $this label [$this serverName]
  44.     $this icon rep_service_16
  45.     $this activeIcon rep_service_16
  46.     $this hasChildren 0
  47.  
  48.     $this canDelete 1
  49.     $this canChangeEntry 1
  50.     $this canShutdown 1
  51.  
  52.     return $this
  53. }
  54.  
  55. method CSServiceNode::changeEntry {this} {
  56.     if {[$this entryDialog] == ""} {
  57.     set name entrydlg-[$this serverName]
  58.         $this entryDialog [CSEntryDialog new [$this view].$name \
  59.                 [$this view] \
  60.                 [$this serverId] \
  61.                                 $this]
  62.     }
  63.     [$this entryDialog] popUp
  64. }
  65.  
  66. method CSServiceNode::removeEntry {this} {
  67.     set dlg [YesNoWarningDialog new [$this view].removeentryconfirm \
  68.         -title "Confirm Server Definition Delete" \
  69.         -message "Are you sure you want to delete the definition of server\
  70.          '[$this serverName]'?" \
  71.         -yesPressed "$this doRemove" \
  72.         -helpPressed "[$this view] helpOnName deleteServerEntry"]
  73.  
  74.     $dlg delCancelButton
  75.     $dlg popUp
  76. }
  77.  
  78. method CSServiceNode::shutdown {this {confirm 1}} {
  79.     if $confirm {
  80.         set name [$this name]
  81.         $this confirmShutdown "All Servers Of '$name'" \
  82.             "Are you sure you want to shutdown all servers\
  83.              of implementation '$name'?" shutdownService
  84.         return
  85.     }
  86.  
  87.     [[$this view] rep] shutdownDbServers [$this serverName] shutdownCount
  88.     if {$shutdownCount > 0} {
  89.         set brokers [[$this parent] parent].brokers
  90.         $brokers update 0
  91.     }
  92. }
  93.  
  94. method CSServiceNode::doRemove {this} {
  95.     set view [$this view]
  96.     [$view rep] removeServerDefinition [$this serverId]
  97.     [$this parent] update 1
  98.     $view selectionChanged
  99. }
  100.  
  101. method CSServiceNode::doUpdateFromEntry {this entry} {
  102.     set info [$this info]
  103.     ORB::splitImplemId [$this serverId] implemId implemVersion
  104.  
  105.     $info addHeader "Server Definition"
  106.     $info addItem "Name"        [$this serverName]
  107.     $info addItem "Id"             ${implemId}.${implemVersion}
  108.     $info addItem "Policy"        [lindex $entry 4]
  109.     $info addItem "Protocol"         [lindex $entry 5]
  110.     if {[lindex $entry 6] != ""} {
  111.     $info addItem "Executable Path" [lindex $entry 6]
  112.     }
  113.     if {[lindex $entry 7] != ""} {
  114.     $info addItem "Command Line"    [lindex $entry 7]
  115.     }
  116.     $info addItem "Host"        [lindex $entry 8]
  117. }
  118.  
  119. method CSServiceNode::doUpdate {this {rebuild 1}} {
  120.     $this CSNode::doUpdate $rebuild
  121.  
  122.     if [[[$this view] rep] getServerById [$this serverId] serverDef] {
  123.         $this doUpdateFromEntry [list \
  124.         [$this serverName] \
  125.             [$this serverId] \
  126.         0 \
  127.             0 \
  128.         $serverDef(policy) \
  129.         $serverDef(protocol) \
  130.         $serverDef(executable) \
  131.         $serverDef(cmdline) \
  132.         $serverDef(host)]
  133.  
  134.     } else {
  135.         [$this info] addHeader "ERROR: Definition with id [$this serverId]\
  136.                                        is not known at nameserver."
  137.     }
  138. }
  139.  
  140. # Do not delete this line -- regeneration end marker
  141.  
  142.