home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
csbrokerno.tcl
< prev
next >
Wrap
Text File
|
1997-11-05
|
6KB
|
206 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)csbrokerno.tcl /main/titanic/11
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)csbrokerno.tcl /main/titanic/11 5 Nov 1997 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require csimplemno.tcl
require brokerlogd.tcl
# End user added include file section
require "csserverno.tcl"
Class CSBrokerNode : {CSServerNode} {
constructor
method destructor
method childObjects
method createChild
method changeableParameters
method getLog
method showLog
method logRegistrations
method logMessage
method shutdown
method doUpdate
}
constructor CSBrokerNode {class this name i_server} {
set this [CSServerNode::constructor $class $this $name $i_server]
# Start constructor user section
$this label [$i_server name]
$this icon rep_broker_16
$this activeIcon rep_broker_16
$this canShowLog 1
$this canLogRegistrations 1
$this canLogMessage 1
# End constructor user section
return $this
}
method CSBrokerNode::destructor {this} {
# Start destructor user section
# End destructor user section
$this CSServerNode::destructor
}
method CSBrokerNode::childObjects {this} {
set implems {}
set broker [$this server]
foreach implem [osort fullId -integer [$broker implementations]] {
# Skip lockcallbacks for now.
#
if {[$implem id] == 99} {
continue
}
lappend implems $implem
}
return $implems
}
method CSBrokerNode::createChild {this object} {
return [CSImplemNode new $this.[$this childName $object] $object]
}
method CSBrokerNode::changeableParameters {this} {
return [list orb_timeout]
}
method CSBrokerNode::getLog {this} {
set broker [$this server]
return [$broker logFileContents]
}
method CSBrokerNode::showLog {this} {
set broker [$this server]
set logFile [$broker logFile]
if {$logFile == "" || $logFile == "."} {
[$this view] error "This broker was not started using the -l option."
return
}
set brokerHost [$broker host]
set dlg [$this view].showlogdlg-$brokerHost
if ![isCommand $dlg] {
set thisHost [ORB::currentHost]
if {$thisHost == $brokerHost} {
set logTitle "Broker Log of ot_broker on local host '$brokerHost'"
if $win95 {
# otk crashes when doing this with readFile!
set logRefresh "text \[$this getLog]"
} else {
set logRefresh "readFile \[$broker logFile]"
}
} else {
set logTitle "Broker Log of ot_broker on host '$brokerHost'"
set logRefresh "text \[$this getLog]"
}
BrokerLogDialog new $dlg \
-title $logTitle \
-refreshScript $logRefresh \
-host $brokerHost \
-file $logFile
}
$dlg refresh
$dlg popUp
}
method CSBrokerNode::logRegistrations {this} {
[$this server] logRegistrations
set brokerHost [[$this server] host]
set dlg [$this view].showlogdlg-$brokerHost
if [isCommand $dlg] {
$dlg refresh
}
}
method CSBrokerNode::logMessage {this} {
set dlg [$this view].logmsgdlg
if ![isCommand $dlg] {
set brokerHost [[$this server] host]
set logDlg [$this view].showlogdlg-$brokerHost
EntryDialog new $dlg \
-modal 1 \
-message "Log message in log of broker on host '$brokerHost':" \
-okPressed "[$this server] logMessage \[%this entry]
if \[isCommand $logDlg] { $logDlg refresh }"
$dlg delHelpButton
}
$dlg popUp
}
method CSBrokerNode::shutdown {this {confirm 1}} {
set ns [ORB::nameServer]
set broker [$this server]
if $confirm {
set name [$this name]
set host [$broker host]
set includingNameServer ""
if {$host == [$ns host] && [$broker pid] == [$ns pid]} {
set includingNameServer ", including the nameserver"
}
$this confirmShutdown "Broker On '$host'" \
"Are you sure you want to shutdown the broker on host '$host'\
\nand all of its servers${includingNameServer}?" shutdownBroker
return
}
# Shutdown all servers started by this broker.
#
set shutdownCount 0
foreach implem [$broker implementations] {
foreach server [$implem servers] {
if [catch {$server shutdown} shutdownError] {
[$this view] error $shutdownError
} else {
incr shutdownCount
}
}
}
# Shutdown the broker itself.
#
if [catch {$broker shutdown} shutdownError] {
[$this view] error $shutdownError
} else {
incr shutdownCount
}
if {$shutdownCount > 0} {
set brokers [$this parent]
$brokers update 0
}
}
method CSBrokerNode::doUpdate {this {rebuild 1}} {
$this CSServerNode::doUpdate $rebuild
set broker [$this server]
set log [$broker logFile]
if {$log == "" || $log == "."} {
set log "<none>"
}
set info [$this info]
$info addHeader "Broker"
$info addItem "Log File" $log
}
# Do not delete this line -- regeneration end marker