/usr/share/tcltk/combat0.8/object.tcl is in tcl-combat 0.8.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | #
# ======================================================================
# This file is part of Combat/Tcl, a Tcl CORBA Object Request Broker
#
# Please visit the Combat Web site at http://www.fpx.de/Combat/ for
# more information.
#
# Copyright (c) Frank Pilhofer, combat@fpx.de
#
# ======================================================================
#
# CVS Version Tag: $Id: object.tcl,v 1.13 2008-11-14 02:06:58 Owner Exp $
#
# ----------------------------------------------------------------------
# CORBA::Object class
# ----------------------------------------------------------------------
#
namespace eval Combat {
namespace eval CORBA {
itcl::class Object {
public variable ior
public variable fwd_ior
public variable conn
public variable object_key
public variable profile_index
public variable orig_profile_index
public variable AddressingDisposition
public variable CodeSetInfo
public variable type_id
public variable reset_profile
public variable timeout
constructor {} {
set fwd_ior ""
set ior ""
set conn ""
set type_id ""
set CodeSetInfo ""
set profile_index 0
set orig_profile_index 0
set reset_profile 0
set timeout 0
}
destructor {
if {$conn != ""} {
$conn deref
}
if {$fwd_ior != ""} {
itcl::delete object $fwd_ior
}
itcl::delete object $ior
}
public method get_ior {} {
return $ior
}
public method get_fwd_ior {} {
if {$fwd_ior != ""} {
return $fwd_ior
}
return $ior
}
public method forward {newior {permanent {}}} {
if {$permanent != ""} {
if {$fwd_ior != ""} {
itcl::delete object $fwd_ior
}
itcl::delete object $ior
set ior $newior
set fwd_ior ""
} else {
if {$fwd_ior != ""} {
itcl::delete object $fwd_ior
}
set fwd_ior $newior
set orig_profile_index $profile_index
}
set profile_index 0
disconnect
}
public method unforward {} {
if {$fwd_ior != ""} {
itcl::delete object $fwd_ior
set fwd_ior ""
}
set profile_index [expr {$orig_profile_index + 1}]
set orig_profile_index 0
disconnect
}
#
# switch to the next profile, unforwarding if none is left
#
public method next_profile {} {
incr profile_index
if {$fwd_ior != ""} {
if {$profile >= [llength [$fwd_ior cget -profiles]]} {
unforward
}
}
disconnect
}
public method connect {} {
if {$conn != ""} {
if {[$conn cget -broken] == 0} {
return $conn
}
disconnect
}
if {$reset_profile} {
set profile_index 0
set orig_profile_index 0
set reset_profile 0
}
set first_tested_index $profile_index
set conn ""
set theior [get_fwd_ior]
set profiles [$theior cget -profiles]
while {$profile_index < [llength $profiles]} {
set profile [lindex $profiles $profile_index]
if {![catch {set data [$profile connect]}]} {
set conn [lindex $data 0]
set object_key [lindex $data 1]
set CodeSetInfo [lindex $data 2]
set AddressingDisposition 0
#
# find CodeSetInfo in "top level" MuCompProf
#
if {$CodeSetInfo == ""} {
set CodeSetInfo [$theior getCodesetInfo]
}
return $conn
}
incr profile_index
}
#
# if we were forwarded, and all profiles in fwd_ior have
# failed, unforward to the original address and retry
#
if {$fwd_ior != ""} {
unforward
return [connect]
}
set reset_profile 1
#
# If we have just tested all profiles, then this is a
# hard failure. Otherwise, be a little more optimistic.
#
if {$first_tested_index == 0} {
::corba::throw [list IDL:omg.org/CORBA/COMM_FAILURE:1.0 \
[list minor 0 completion_status COMPLETED_NO]]
}
::corba::throw [list IDL:omg.org/CORBA/TRANSIENT:1.0 \
[list minor 0 completion_status COMPLETED_NO]]
}
public method disconnect {} {
if {$conn != ""} {
$conn deref
set conn ""
}
}
public method _is_a {repoid} {
set repoid [::Combat::SimpleTypeRepository::getRepoid $repoid]
set res [::Combat::CORBA::ORB::invoke_sync 1 $this \
_is_a boolean 0 {{in string}} [list $repoid]]
if {$res == 1 && $type_id == ""} {
set type_id $repoid
} elseif {$res == 1 && \
![::Combat::SimpleTypeRepository::_is_a \
$type_id $repoid]} {
set type_id $repoid
}
return $res
}
public method _get_interface {} {
set res [::Combat::CORBA::ORB::invoke_sync 1 $this \
_interface Object 0 {} {}]
return $res
}
public method _non_existent {} {
set res [::Combat::CORBA::ORB::invoke_sync 1 $this \
_non_existent boolean 0 {} {}]
return $res
}
public method _is_equivalent {other} {
if {$other == "0"} {
return 0
}
if {$other == $this} {
return 1
}
#
# test IIOP profiles for equality
#
set other_ior [$other get_ior]
if {$ior != "" && $other_ior != ""} {
set p1 ""
set p2 ""
foreach profile [$ior cget -profiles] {
if {[$profile cget -tag] == 0} {
set p1 $profile
break
}
}
foreach profile [$other_ior cget -profiles] {
if {[$profile cget -tag] == 0} {
set p2 $profile
break
}
}
if {$p1 != "" && $p2 != ""} {
if {[$p1 cget -host] == [$p2 cget -host] && \
[$p1 cget -port] == [$p2 cget -port] && \
[string compare [$p1 cget -object_key] \
[$p2 cget -object_key]] == 0} {
return 1
}
}
}
::corba::throw [list IDL:omg.org/CORBA/TRANSIENT:1.0 \
[list minor 0 completion_status COMPLETED_NO]]
}
public method UpdateType {} {
set theior [get_fwd_ior]
if {$theior == ""} {
return 0
}
if {$type_id == ""} {
set type_id [$theior cget -type_id]
}
if {$type_id == ""} {
return 0
}
return 1
}
}
}
}
|