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

Open Mash Cross Reference
mash/tcl/indiva/imgr/imgr-ascp.tcl

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

  1 # imgr-ascp.tcl --
  2 #
  3 #   Implementation of the ASCP protocol on Indiva manager.
  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 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/indiva/imgr/imgr-ascp.tcl,v 1.6 2002/07/18 22:49:32 weitsang Exp $
 32 
 33 import ASCP/Client
 34 
 35 #--------------------------------------------------------------------------
 36 # Class:
 37 #   IMgrASCP
 38 #--------------------------------------------------------------------------
 39 
 40 Class IMgrASCP -superclass ASCP/Client
 41 
 42 IMgrASCP instproc init { flow from to service_location precond argv } {
 43 
 44     $self instvar flow_ from_ to_
 45     set flow_ $flow
 46     set from_ $from
 47     set to_ $to
 48 
 49     set as_spec [$self get_option as_spec]
 50     set as_bw [$self get_option as_bw]
 51     $self next $as_spec $as_bw $service_location $precond
 52 
 53     $self instvar agent_data_ 
 54     set agent_data_ $argv
 55 }
 56 
 57 
 58 IMgrASCP public args {args}  {
 59     $self instvar agent_data_
 60     if {$args == ""} {
 61         return $agent_data_
 62     } else {
 63         set agent_data_ [lindex $args 0]
 64     }
 65 }
 66 
 67 
 68 IMgrASCP public service_type {}  {
 69     return "Indiva"
 70 }
 71 
 72 
 73 IMgrASCP public from {args}  {
 74     $self instvar from_
 75     if {$args == "" } {
 76         return $from_ 
 77     } else {
 78         set from_ $args
 79     }
 80 }
 81 
 82 IMgrASCP public to {args}  {
 83     $self instvar to_
 84     if {$args == "" } {
 85         return $to_ 
 86     } else {
 87         set to_ $args
 88     }
 89 }
 90 
 91 #----------------------------------------------------------------------
 92 # Class:
 93 #   IMgrASCP/RunAlways
 94 # Description:
 95 #   Encapsulation of ASCP protocol that run a service process whose 
 96 #   service is required all the time (such as encoder).
 97 # See Also:
 98 #   IMgrASCP/RunOnce
 99 #----------------------------------------------------------------------
100 
101 Class IMgrASCP/RunAlways -superclass IMgrASCP
102 IMgrASCP/RunAlways instproc init {mgr location precond argv} {
103     $self next "" "" "" $location $precond $argv
104     $self on_timeout append "delete $self"
105 }
106 
107 #----------------------------------------------------------------------
108 # Class:
109 #   IMgrASCP/RunOnce
110 # Description:
111 #   Encapsulation of ASCP protocol that run a service process whose 
112 #   service is required only once. (such as light switch).
113 # See Also:
114 #   IMgrASCP/RunAlways
115 #----------------------------------------------------------------------
116 Class IMgrASCP/RunOnce -superclass IMgrASCP
117 
118 #----------------------------------------------------------------------
119 # Method:
120 #   IMgrASCP/RunOnce init
121 # Description:
122 #   Create an ASCP object.  By default, ASCP restarts services when
123 #   service expires.  Since we do not need to run the service 
124 #   continuously, we simply unregister the service when service expires.
125 #----------------------------------------------------------------------
126 IMgrASCP/RunOnce instproc init {mgr location precond argv} {
127     $self next "" "" "" $location $precond $argv
128     $self on_destroy append "$mgr servent unregister [$self service_instance]" 
129     $self on_service_expire append "$mgr servent unregister [$self service_instance]" 
130     $self on_timeout append "delete $self"
131 }
132 
133 # vim:ts=8:sw=4:expandtab
134 

~ [ 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.