Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/daemon.global.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2228 by niro, Fri Jan 10 23:51:35 2014 UTC revision 2271 by niro, Tue Jan 14 10:50:06 2014 UTC
# Line 8  load_client_classes() Line 8  load_client_classes()
8   # client specific   # client specific
9   for i in $(find ${MCORE_LIBDIR}/include -type f -name \*.client.class)   for i in $(find ${MCORE_LIBDIR}/include -type f -name \*.client.class)
10   do   do
11   source ${i} || eecho "error loading ${i}"   include ${i} || eecho "error loading ${i}"
12   done   done
13  }  }
14    
# Line 54  stop_service() Line 54  stop_service()
54  # run_class $method $caller $argv1 $argv2 ... $argvN  # run_class $method $caller $argv1 $argv2 ... $argvN
55  run_class()  run_class()
56  {  {
57   local method="$1"   local method="${GLOBAL_ARGV[0]}"
58   local caller="$2"   local caller="${GLOBAL_ARGV[1]}"
59   local class   local class
60   local cmd   local cmd
61   local argv   local i
62     local count
63    
64   if valid_session   if valid_session
65   then   then
66   class="${caller%.*}"   class="${caller%.*}"
67   cmd="${caller#*.}"   cmd="${caller#*.}"
  argv="${@/${caller}/}" # remove caller  
  argv="${argv/${method}/}" # remove method  
68    
69  # echo "method=${method}"   # copy GLOBAL_ARGV to CLASS_ARGV array without method and caller.class
70  # echo "caller=${caller}"   unset CLASS_ARGV
71  # echo "class=${class}"   count="${#GLOBAL_ARGV[*]}"
72  # echo "cmd=${cmd}"   for (( i=2; i<count; i++ ))
73  # echo "argv=${argv}"   do
74     CLASS_ARGV[${i}-2]="${GLOBAL_ARGV[${i}]}"
75     done
76    
77    # decho "method=${method}"
78    # decho "caller=${caller}"
79    # decho "class=${class}"
80    # decho "cmd=${cmd}"
81    # decho "class argv=$(printf '\"%s\" ' ${CLASS_ARGV[*]}; printf '\n')"
82    
83   # check if class.cmd exist   # check if class.cmd exist
84   if [[ ! -z $(typeset -f "${method}"_"${class}"_"${cmd}") ]]   if [[ ! -z $(typeset -f "${method}"_"${class}"_"${cmd}") ]]
85   then   then
86   "${method}"_"${class}"_"${cmd}" ${argv}   "${method}"_"${class}"_"${cmd}"
87   else   else
88   eecho "unkown method '${method}' . class '${class}' . cmd '${cmd}'"   eecho "unknown method '${method}' . class '${class}' . cmd '${cmd}'"
89   fi   fi
90   else   else
91   invalid_session   invalid_session

Legend:
Removed from v.2228  
changed lines
  Added in v.2271