/usr/share/tcltk/xotcl1.6.7-registry/Registry.xotcl is in xotcl 1.6.7-2.
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 | package provide xotcl::registry::registry 0.8
package require xotcl::trace
package require xotcl::rdf::triple
package require xotcl::rdf::tripleRecreator
package require xotcl::actiweb::agent
package require XOTcl
namespace eval ::xotcl::registry::registry {
namespace import ::xotcl::*
Class Registry -superclass Agent
Registry instproc init args {
next
my exportProcs register query queryProperty
RDFParser [self]::parser
TripleVisitor [self]::tripleVisitor -parser [self]::parser
[self]::tripleVisitor descriptionAsBag 0
my array set services {}
}
Registry instproc register {rdfScript} {
#my showCall
[[self]::tripleVisitor set parser] parse $rdfScript
[self]::tripleVisitor interpretNodeTree [self]::parser::topNode
[self]::tripleVisitor resetWithoutDB
foreach serviceTriple [[self]::tripleVisitor::db queryPredicate \
"http://nestroy.wi-inf.uni-essen.de/schema/service#name"] {
set service [$serviceTriple object]
if {[info exists services($service)]} {
puts stderr "we have already such a service '$service'"
# hier koennte man ueberlegen, den service zu loeschen oder nicht
# zZT: loesche altes service
}
puts stderr "REGISTRY: registering $service with [$serviceTriple subject]"
my set services($service) [$serviceTriple subject];
}
}
Registry instproc query {service} {
my showCall
if {[info exists services($service)]} {
set s [my set services($service)]
return [[Place getInstance]::rdfCreator createFromTriples [[self]::tripleVisitor::db querySubject $s]]
}
}
Registry instproc queryProperty {args} {
# returns first service with matching properties
my showCall
foreach s [my array names services] {
set success 1
foreach {att value} $args {
set t [[self]::tripleVisitor::db queryPredicateOnSubject $att [my set services($s)]]
if {$t eq "" || [$t object] != $value} {
set success 0
break
}
}
if {$success} {
set r [my query $s]
return $r
} else {
return ""
}
}
}
namespace export Registry
}
namespace import ::xotcl::registry::registry::*
|