home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / csimplemno.tcl < prev    next >
Text File  |  1996-10-18  |  5KB  |  170 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1996
  4. #
  5. #      File:           @(#)csimplemno.tcl    /main/hindenburg/10
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)csimplemno.tcl    /main/hindenburg/10   18 Oct 1996 Copyright 1996 Cayenne Software Inc.
  10.  
  11. # Start user added include file section
  12. require "csbrokerno.tcl"
  13. require "csnameserv.tcl"
  14. require "csdbserver.tcl"
  15. require "cslockserv.tcl"
  16. require "csparamdia.tcl"
  17. # End user added include file section
  18.  
  19. require "csnode.tcl"
  20.  
  21. Class CSImplemNode : {CSNode} {
  22.     constructor
  23.     method destructor
  24.     method childName
  25.     method childObjects
  26.     method createChild
  27.     method changeParameters
  28.     method shutdown
  29.     method doUpdate
  30.     attribute implem
  31.     attribute paramDialog
  32. }
  33.  
  34. constructor CSImplemNode {class this name i_implem} {
  35.     set this [CSNode::constructor $class $this $name]
  36.     $this implem $i_implem
  37.     # Start constructor user section
  38.  
  39.         $this label [$i_implem name]
  40.         $this icon rep_implem_16
  41.  
  42.         $this canChangeParams 1
  43.         $this canShutdown 1
  44.     $this activated "$this changeParameters"
  45.  
  46.     # End constructor user section
  47.     return $this
  48. }
  49.  
  50. method CSImplemNode::destructor {this} {
  51.     # Start destructor user section
  52.     # End destructor user section
  53.     $this CSNode::destructor
  54. }
  55.  
  56. method CSImplemNode::childName {this object} {
  57.     set nodeName [$object identity]
  58.     regsub -all {\.} $nodeName {_} nodeName
  59.     return $nodeName
  60. }
  61.  
  62. method CSImplemNode::childObjects {this} {
  63.     return [osort pid -integer [[$this implem] servers]]
  64. }
  65.  
  66. method CSImplemNode::createChild {this object} {
  67.     set name $this.[$this childName $object]
  68.     set implem [$this implem]
  69.     set id [$implem id]
  70.  
  71.     switch $id {
  72.         1    { CSBrokerNode new $name $object }
  73.         2    { CSNameServerNode new $name $object }
  74.         100    { CSLockServerNode new $name $object }
  75.         default    { 
  76.             if {$id > 100 && $id < 1000} {
  77.         CSDbServerNode new $name $object
  78.             } else {
  79.                 # For lockcallback (99), BrokerProxy plus
  80.                 # BrokerImplemServer (> 1000) implementations.
  81.                 #
  82.         CSServerNode new $name $object
  83.             }
  84.         }
  85.     }
  86.     return $name
  87. }
  88.  
  89. method CSImplemNode::changeParameters {this} {
  90.     if {[$this paramDialog] == ""} {
  91.         set implem [$this implem]
  92.     set name paramdlg-[[$implem broker] name]-[$implem name]
  93.         $this paramDialog [CSParamDialog new .main.$name \
  94.                 [$this view] \
  95.                 $this \
  96.                 "concat [list $implem] \[$implem servers]" \
  97.                                 [list orb_timeout \
  98.                                       orb_linger \
  99.                                       orb_report \
  100.                                       orb_maxclients \
  101.                                       orb_maxinstances]]
  102.     }
  103.     [$this paramDialog] popUp
  104. }
  105.  
  106. method CSImplemNode::shutdown {this {confirm 1}} {
  107.     if $confirm {
  108.         set name [$this name]
  109.         set host [[[$this implem] broker] host]
  110.         $this confirmShutdown "Shutdown All Servers Of '$name' On '$host'" \
  111.             "Are you sure you want to shutdown all servers\
  112.              of implementation '$name' on host '$host'?" shutdownImplem
  113.         return
  114.     }
  115.  
  116.     set shutdownCount 0
  117.     set implem [$this implem]
  118.     foreach server [$implem servers] {
  119.     if [catch {$server shutdown} shutdownError] {
  120.         [$this view] error $shutdownError
  121.     } else {
  122.             incr shutdownCount
  123.         }
  124.     }
  125.  
  126.     if {$shutdownCount > 0} {
  127.         set broker [$this parent]
  128.     $broker update 1
  129.     }
  130. }
  131.  
  132. method CSImplemNode::doUpdate {this {rebuild 1}} {
  133.     $this CSNode::doUpdate $rebuild
  134.  
  135.     set implem [$this implem]
  136.     set info [$this info]
  137.  
  138.     $info addHeader "Implementation"
  139.     $info addItem "Name"        [$implem name]
  140.     $info addItem "Id"             [$implem id].[$implem version]
  141.     $info addItem "Policy"        [$implem policy]
  142.     $info addItem "Protocol"         [$implem protocol]
  143.  
  144.     if {[$implem executable] != ""} {
  145.     $info addItem "Executable Path" [$implem executable]
  146.     }
  147.     if {[$implem commandLine] != ""} {
  148.     $info addItem "Command Line"    [$implem commandLine]
  149.     }
  150.     if {[$implem host] != ""} {
  151.     $info addItem "Host"            [$implem host]
  152.     }
  153.     if {[$implem object] != [[ORB::nil] identity]} {
  154.     $info addItem "Object"            [$implem object]
  155.     }
  156.     if {[$implem method] != 0} {
  157.     $info addItem "Method"            [$implem method]
  158.     }
  159.  
  160.     $info addHeader "Parameters"
  161.     $info addParameter orb_timeout    [$implem getParameter orb_timeout]
  162.     $info addParameter orb_linger    [$implem getParameter orb_linger]
  163.     $info addParameter orb_report    [$implem getParameter orb_report]
  164.     $info addParameter orb_maxclients    [$implem getParameter orb_maxclients]
  165.     $info addParameter orb_maxinstances    [$implem getParameter orb_maxinstances]
  166. }
  167.  
  168. # Do not delete this line -- regeneration end marker
  169.  
  170.