# WLSsetup.def: Assists Oracle WebLogic Server Collection Setup # $Id: WLSsetup.def,v 1.11 2012/01/03 13:34:48 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/WLSsetup.def,v 1.11 2012/01/03 13:34:48 mschenke Exp $ # # Change History # 20120103 MSC Change the copyright notice. =head1 NAME WLSsetup - Assists Oracle WebLogic Server Collection Setup =head1 DESCRIPTION This module provided associated logic for the setup of the Oracle WebLogic Server collections. =cut #------------------------------------------------------------------------------ # 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} # Detect the domains var $top = getSetting(concat($pre,'_DOMAIN_ROOT')) loop $dom (grepDir($top,'^[^\.]+$','n')) {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,%sel) = (0,true) # Analyze the previous requests if compare('eq',getSetting(concat($pre,'_DOMAINS')),'*') var $flg = false else {loop $key (grepSetting(concat('^',$pre,'_DOM\d+_REQ_DOMAIN$'))) {var $tid = substr($key,0,-11) var $val = getSetting($key) var $sel{basename(catDir($val))} = getSetting(concat($tid,'_WLS_USER')) } } # Generate temporary setting loop $dom (@dom) {call push(@all,incr($cnt)) call push(@itm,$cnt,$dom) call push(@rsp,$cnt,$cnt) if and($flg,exists($sel{$dom})) call push(@dft,$cnt) call setTempSetting(concat($pre,'_DOM',$cnt,'_REQ_DOMAIN'),catDir($top,$dom)) call setTempSetting(concat($pre,'_DOM',$cnt),$dom) call setTempSetting(concat($pre,'_DOM',$cnt,'_WLS_USER'),$sel{$dom}) } call setTempSetting('TMP_ALL_DOMAINS',join('|',@all)) call setTempSetting('TMP_DFT_DOMAINS',cond($flg,join('|',@dft),'*')) call setTempSetting('TMP_ITM_DOMAINS',join('|',@itm)) call setTempSetting('TMP_RSP_DOMAINS',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 domain counter var $CNT = ${TMP_CNT} # Detect the servers var @srv = () var $top = getSetting(concat($pre,'_DOM',$CNT,'_REQ_DOMAIN')) loop $srv (grepDir(catDir($top,'servers'),'^[^\.]+$','n')) {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 requests var $val = getSetting(concat($pre,'_DOM',$CNT,'_WLS_SERVERS')) if compare('eq',$val,'*') var $flg = 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',cond($flg,join('|',@dft),'*')) call setTempSetting('TMP_ITM_SERVERS',join('|',@itm)) } #------------------------------------------------------------------------------ # Section get_wls_user: Get the Oracle WebLogic user #------------------------------------------------------------------------------ section get_wls_user # Determine the associate setup prefix var $pre = ${AUX.PREFIX} # Determine the associate setup domain counter var $CNT = ${TMP_CNT} # Extract the domain user var ($top,$usr) = (getSetting(concat($pre,'_DOM',$CNT,'_REQ_DOMAIN'))) if loadFile(catFile($top,'init-info','tokenValue.properties')) {var ($lin) = grepLastFile('^[^\043]*\bDOMAIN_USER=\s*\S','f') var ($usr) = match($lin,'^[^\043]*\bDOMAIN_USER=\s*(\S+)') } if length($usr) var ${AUX.dft} = $usr =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