~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/applications/lhm/servent.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # servent.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1996-2002 The Regents of the University of California.
  6 # All rights reserved.
  7 #
  8 # Redistribution and use in source and binary forms, with or without
  9 # modification, are permitted provided that the following conditions are met:
 10 #
 11 # A. Redistributions of source code must retain the above copyright notice,
 12 #    this list of conditions and the following disclaimer.
 13 # B. Redistributions in binary form must reproduce the above copyright notice,
 14 #    this list of conditions and the following disclaimer in the documentation
 15 #    and/or other materials provided with the distribution.
 16 # C. Neither the names of the copyright holders nor the names of its
 17 #    contributors may be used to endorse or promote products derived from this
 18 #    software without specific prior written permission.
 19 #
 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 
 31 
 32 import Trace
 33 #Trace on ; Trace add Servent
 34 
 35 #
 36 # maintains data about a service (or servent in mash platform lingo)
 37 # that can be spawned
 38 #
 39 Class Servent
 40 
 41 # initialize the Servent based on the contents of `line', where
 42 # line is formatted as:<p>
 43 #
 44 # {announcement to describe srv} {srv_script_URL} {exec_cmd} {args}
 45 #
 46 #<p> only the first two lists are required. Anything with valid
 47 # mash-object=foo or WPI=bar entries in the announcement can be
 48 # allocated/ used by the UC client application)
 49 #
 50 Servent public init {line} {
 51     Trc $class "--> ${class}::$proc $line \[llen=[llength $line]\]"
 52     $self instvar pid_ rv_msg_ scripturl_ execcmd_ args_ \
 53             scriptfile_ uniqid_ exectime_
 54 
 55     set pid_ -666
 56     set execcmd_ "smash"
 57     set args_ ""
 58     set scriptfile_ ""
 59     set uniqid_ "[random]@[pid]@[localaddr]"
 60     if {[llength $line] < 2} {
 61         puts "Bad [$self info class]::init arg: `$line'"
 62         return
 63     }
 64     set rv_msg_ [lindex $line 0]
 65     set scripturl_ [lindex $line 1]
 66     if {[llength $line] > 2} {set execcmd_ [lindex $line 2]}
 67     if {[llength $line] > 3} {set args_ [lindex $line 3]}
 68 }
 69 
 70 #
 71 Servent public pid {} {
 72     Trc $class "--> ${class}::$proc"
 73     $self instvar pid_
 74     return $pid_
 75 }
 76 
 77 #
 78 Servent public set_pid {i} {
 79     Trc $class "--> ${class}::$proc"
 80     $self instvar pid_
 81     set pid_ $i
 82 }
 83 
 84 #
 85 Servent public rv_msg {} {
 86     Trc $class "--> ${class}::$proc"
 87     $self instvar rv_msg_
 88     Trc $class "`$rv_msg_'"
 89     return $rv_msg_
 90 }
 91 
 92 #
 93 Servent public execargs {} {
 94     Trc $class "--> ${class}::$proc"
 95     $self instvar args_
 96     return $args_
 97 }
 98 
 99 #
100 Servent public url {} {
101     Trc $class "--> ${class}::$proc"
102     $self instvar scripturl_
103     return $scripturl_
104 }
105 
106 #
107 Servent public scriptfile {} {
108     Trc $class "--> ${class}::$proc"
109     $self instvar scriptfile_
110     return $scriptfile_
111 }
112 
113 #
114 Servent public set_scriptfile {n} {
115     Trc $class "--> ${class}::$proc"
116     $self instvar scriptfile_
117     set scriptfile_ $n
118 }
119 
120 #
121 Servent public uniqid {} {
122     Trc $class "--> ${class}::$proc"
123     $self instvar uniqid_
124     return $uniqid_
125 }
126 
127 #
128 Servent public exectime {} {
129     Trc $class "--> ${class}::$proc"
130     $self instvar exectime_
131     return $exectime_
132 }
133 
134 #
135 Servent public set_exectime {n} {
136     Trc $class "--> ${class}::$proc"
137     $self instvar exectime_
138     set exectime_ $n
139 }
140 
141 #
142 Servent public execcmd {} {
143     Trc $class "--> ${class}::$proc"
144     $self instvar execcmd_
145     return $execcmd_
146 }
147 
148 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.