# TGob.cfg: Manages Oracle Base Target Definitions # # $Id: TGob.cfg,v 1.4 2013/10/30 07:18:47 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/RDA/TGob.cfg,v 1.4 2013/10/30 07:18:47 RDA Exp $ # # Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. # # Change History # 20130422 MSC Improve the validation. #------------------------------------------------------------------------------ # Module definition #------------------------------------------------------------------------------ dsc='Manages Oracle Base Target Definitions' var=select_command exe=sdcl { "macro get_base "{if ?${RUN.CLASS.OB.D_ORACLE_HOME} " {var @dir = splitDir(last) " while ?pop(@dir) " {if ?testDir('d',catDir(@dir,'admin')) " return (cleanPath([@dir, ''])) " } " } " return () "} " "macro is_unique "{var ($cur,$ttl) = @arg " " loop $itm ($[COL]->get_items('OB')) " {if and(compare('eq',$ttl,$itm->get_first('T_TITLE')),\ " compare('ne',$cur,$itm->get_path)) " return false " } " return true "} } #------------------------------------------------------------------------------ # Setting definitions #------------------------------------------------------------------------------ [select_command] typ=T dft=${W_ADMIN_COMMAND} dsc='Select the administration action' nam=- var=define:do_define:\ edit: do_edit:\ select:do_select #------------------------------------------------------------------------------ # Define an Oracle base target #------------------------------------------------------------------------------ [do_define] typ=B dft=${T_ADMIN_VALUE} nam=- var=W_CLASS,B_DEDICATED,D_ORACLE_BASE,T_TITLE,T_OB_ABBR exe=sdcl { "var $cnt = undef } [W_CLASS] typ=T def=${T_ADMIN_VALUE} dft='OB' dsc='Target type' [B_DEDICATED] typ=B def=${T_ADMIN_VALUE} dft=${RUN.CLASS.OB.B_DEDICATED} dsc='Is it a dedicated target?' opt=true [D_ORACLE_BASE] typ=D def=${T_ADMIN_VALUE} dft=(${RUN.CLASS.OB.D_ORACLE_BASE/v},\ ${ENV.ORACLE_BASE:${ENV.ORA_ROOT:get_base()}}) dsc='Oracle base directory' err='Warning: The specified directory does not -yet- exist' inp='Enter the Oracle base' raw=true val=W [T_TITLE] typ=T def=${T_ADMIN_VALUE} dft=${RUN.CLASS.OB.T_TITLE:"Oracle base ${D_ORACLE_BASE/v}"} dsc='Oracle base target description' err='Duplicate description' inp='Enter the Oracle base target description' ref=is_unique(${CUR.K_MODULE},last) val=E [T_OB_ABBR] typ=T def=${T_ADMIN_VALUE} dft=${RUN.CLASS.OB.T_OB_ABBR:${CTX.T_OB_ABBR}} dsc='Target abbreviation to use' opt=true #------------------------------------------------------------------------------ # Edit an Oracle base target #------------------------------------------------------------------------------ [do_edit] typ=M add=('R|Return to the previous menu|-|-') aft='\040' bef='Edit an Oracle base target:' cas=false dft=(@{T_ADMIN_VALUE}) dsc='Edit an Oracle base target' err='Invalid entry' inp='Enter the item number or the action letter.' nam=-T_ADMIN_VALUE val=E var=-::do_define exe=sdcl { "# Get the target list "if !?$cnt "{keep $cnt,@itm,@rsp " var ($cnt,@itm,@rsp) = (0) " loop $itm ($[COL]->get_items('OB')) " {var $pth = concat('COL/',$itm->get_path) " call push(@itm,incr($cnt),$itm->get_first('T_TITLE',$pth)) " call push(@rsp,$cnt,$pth) " } "} " "# Determine the menu items and responses "var ${AUX.itm} = [@itm] "var ${AUX.rsp} = [@rsp] } #------------------------------------------------------------------------------ # Select an Oracle base target #------------------------------------------------------------------------------ [do_select] typ=M aft='\040' alt=add_target,do_define,do_select ask=true cas=false dft=${T_ADMIN_VALUE} dsc='Select an Oracle base target' nam=-T_ADMIN_VALUE val=E var=+:add_target,do_define,do_select:\ -:do_edit,do_select:\ *:all_targets:\ .:no_targets exe=sdcl { "# Get the target list "if !?$cnt "{keep $cnt,@add,@all,@itm,@mnu,@rsp " " var ($cnt,@all,@itm,@mnu,@rsp) = (0) " if ${B_ADMIN_END} " {loop $itm ($[COL]->get_items('OB')) " {next $itm->get_first('B_DEDICATED') " var $pth = concat('COL/',$itm->get_path) " call push(@itm,incr($cnt),$itm->get_first('T_TITLE',$pth)) " call push(@rsp,$cnt,$pth) " call push(@all,$pth) " call push(@mnu,$cnt) " } " } " else " {loop $itm ($[COL]->get_items('OB')) " {var $pth = concat('COL/',$itm->get_path) " call push(@itm,incr($cnt),$itm->get_first('T_TITLE',$pth)) " call push(@rsp,$cnt,$pth) " next $itm->get_first('B_DEDICATED') " call push(@mnu,$cnt) " } " } "} " "# Determine the menu items and responses "var @add = ('D|Define a new Oracle base target|+|-') "if $cnt " call push(@add,'E|Edit an Oracle base target|-|-') "if ${B_ADMIN_END} "{if $cnt " call unshift(@add,'A|All Oracle base targets|*|-') " call push(@add,'N|No Oracle base targets|.|-') " var ${AUX.bef} = ${T_ADMIN_BEFORE:'Select an Oracle base target list:'} " var ${AUX.opt} = false " var ${AUX.pck} = true "} "else "{var ${AUX.bef} = ${T_ADMIN_BEFORE:'Select an Oracle base target:'} " var ${AUX.err} = 'Invalid entry' " var ${AUX.inp} = 'Enter the item number or the action letter.' " var ${AUX.opt} = cond($cnt,false,true) "} "var ${AUX.add} = [@add] "var ${AUX.itm} = [@itm] "var ${AUX.rsp} = [@rsp] } [add_target] typ=T dft="COL/${NXT.OB:${K_ADMIN_PARENT}}" dsc='Determine the identifier for a new target' nam=-T_ADMIN_VALUE [all_targets] typ=T dft=(@all) dsc='Select all targets' end='' nam=-T_ADMIN_VALUE [no_targets] typ=T dft=() dsc='Select no targets' end='' nam=-T_ADMIN_VALUE