# OFAsetup.def: Assists Oracle Fusion Applications Collection Setup # $Id: OFAsetup.def,v 1.4 2012/05/31 09:44:56 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/OFAsetup.def,v 1.4 2012/05/31 09:44:56 mschenke Exp $ # # Change History # 20120531 MSC Improve the previous request analysis. =head1 NAME OFAsetup - Assists Oracle Fusion Applications Collection Setup =head1 DESCRIPTION This module provides associated logic for the setup of the Oracle Fusion Applications collections. =cut keep %nod #------------------------------------------------------------------------------ # Section init: Module initialization #------------------------------------------------------------------------------ section init #------------------------------------------------------------------------------ # Section chk_domains: Check which domains are present #------------------------------------------------------------------------------ section chk_domains # Determine the associate setup prefix var $pre = ${AUX.PREFIX} # Determine the associate setup node counter var $N_CNT = ${TMP_NOD_CNT} # Detect the domains var ($top,@dom) = (getSetting(concat($pre,'_NOD',$N_CNT,'_WLS_NODE'))) loop $dom (grepDir($top,'^\.+$','nv')) {if or(testFile('f',catFile($top,$dom,'bin','setDomainEnv.cmd')),\ testFile('f',catFile($top,$dom,'bin','setDomainEnv.sh'))) call push(@dom,$dom) } # Customize the setup if @dom {var ${AUX.dft} = 1 var ($cnt,$flg,@all,@dft,@itm,@rsp) = (0,true) # Analyze the previous request if $nod{$N_CNT,'all'} var ($flg,@dft) = (false,'*') var $sel = $nod{$N_CNT,'sel'} # Generate temporary setting loop $dom (@dom) {call push(@all,incr($cnt)) call push(@itm,$cnt,$dom) call push(@rsp,$cnt,$cnt) if exists($sel->{$dom}) {var $nod{$N_CNT,'dom',$cnt,'srv'} = nvl($sel->{$dom,'srv'},'*') if $flg call push(@dft,$cnt) } else var $nod{$N_CNT,'dom',$cnt,'srv'} = '*' call setTempSetting(concat($pre,'_NOD',$N_CNT,'_DOM',$cnt,'_REQ_DOMAIN'),\ catDir($top,$dom)) call setTempSetting(concat($pre,'_NOD',$N_CNT,'_DOM',$cnt),$dom) } call setTempSetting('TMP_ALL_DOMAINS',join('|',@all)) call setTempSetting('TMP_DFT_DOMAINS',join('|',@dft)) call setTempSetting('TMP_ITM_DOMAINS',join('|',@itm)) call setTempSetting('TMP_RSP_DOMAINS',join('|',@rsp)) } #------------------------------------------------------------------------------ # Section chk_nodes: Check which nodes are present #------------------------------------------------------------------------------ section chk_nodes # Determine the associate setup prefix var $pre = ${AUX.PREFIX} # Detect the nodes var $top = catDir(getSetting(concat($pre,'_ROOT')),'instance','domains') loop $nod (grepDir($top,'^\.+$','nv')) {loop $dom (grepDir(catDir($top,$nod),'^[^\.]+$','n')) {if or(testFile('f',catFile($top,$nod,$dom,'bin','setDomainEnv.cmd')),\ testFile('f',catFile($top,$nod,$dom,'bin','setDomainEnv.sh'))) {call push(@nod,$nod) break } } } # Customize the setup if @nod {var ${AUX.dft} = 1 var ($cnt,$flg,@all,@dft,@itm,@rsp,%sel) = (0,true) # Analyze the previous request if compare('eq',setSetting(concat($pre,'_NODES')),'*') var ($flg,@dft) = (false,'*') loop $key (grepSetting(concat('^',$pre,'_NOD\d+_WLS_NODE$'))) {var $nod = substr($key,0,-9) var $pth = catDir(setSetting($key)) var $sel{basename($pth)} = {\ all => compare('eq',setSetting(concat($nod,'_DOMAINS')),'*'),\ pth => $pth,\ sel => $rec = {}} loop $key (grepSetting(concat('^',$nod,'_DOM\d+_REQ_DOMAIN$'))) {var $dom = substr($key,0,-11) var $pth = catDir(setSetting($key)) var $rec->{basename($pth)} = {\ pth => $pth,\ srv => setSetting(concat($dom,'_WLS_SERVERS'))} } } # Generate temporary setting loop $nod (@nod) {call push(@all,incr($cnt)) call push(@itm,$cnt,$nod) call push(@rsp,$cnt,$cnt) if exists($sel{$nod}) {var $nod{$cnt} = $sel{$nod} if $flg call push(@dft,$cnt) } else var $nod{$cnt} = {all => true, sel => {}} call setTempSetting(concat($pre,'_NOD',$cnt,'_WLS_NODE'),catDir($top,$nod)) call setTempSetting(concat($pre,'_NOD',$cnt),$nod) } call setTempSetting('TMP_ALL_NODES',join('|',@all)) call setTempSetting('TMP_DFT_NODES',join('|',@dft)) call setTempSetting('TMP_ITM_NODES',join('|',@itm)) call setTempSetting('TMP_RSP_NODES',join('|',@rsp)) } #------------------------------------------------------------------------------ # Section chk_servers: Check which servers are present #------------------------------------------------------------------------------ section chk_servers # Determine the associate setup prefix var $pre = ${AUX.PREFIX} # Determine the associate setup node counter var $N_CNT = ${TMP_NOD_CNT} # Determine the associate setup domain counter var $D_CNT = ${TMP_CNT} # Detect the servers var @srv = () var $top = getSetting(concat($pre,'_NOD',$N_CNT,'_DOM',$D_CNT,'_REQ_DOMAIN')) loop $srv (grepDir(catDir($top,'servers'),'^\.+$','nv')) {if testDir('d',catDir($top,'servers',$srv,'logs')) call push(@srv,$srv) } # Customize the setup if @srv {var ${AUX.dft} = 1 var ($cnt,$flg,@all,@dft,@itm,@rsp,%sel) = (0,true) # Analyze the previous request var $val = $nod{$N_CNT,'dom',$D_CNT,'srv'} if compare('eq',$val,'*') var ($flg,@dft) = (false,'*') else {loop $srv (split('\|',$val)) var $sel{$srv} = 1 } # Generate temporary setting loop $srv (@srv) {call push(@all,$srv) call push(@itm,incr($cnt),$srv) if and($flg,exists($sel{$srv})) call push(@dft,$srv) } call setTempSetting('TMP_ALL_SERVERS',join('|',@all)) call setTempSetting('TMP_DFT_SERVERS',join('|',@dft)) call setTempSetting('TMP_ITM_SERVERS',join('|',@itm)) } =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut