# EPMlib.def: Defines Common Macros for Enterprise Performance Management # $Id: EPMlib.def,v 1.3 2012/08/10 12:23:05 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/EPMlib.def,v 1.3 2012/08/10 12:23:05 mschenke Exp $ # # Change History # 20120810 KRA Fix create_epm_script macro. =head1 NAME EPMlib - Defines Common Macros for Enterprise Performance Management =head1 DESCRIPTION This persistent submodule regroups macros that are common to several Oracle Enterprise Performance Management System related-modules. The following macros are available: =cut # Make the module persistent and share macros keep $KEEP_BLOCK,@SHARE_MACROS var @SHARE_MACROS = ('collect_cssconfig','create_epm_script','get_epm_version') =head2 S This macro exports the CSS configuration using the F or F script. =cut macro collect_cssconfig {var ($lvl,$dir,$pwd) = @arg var $MOD = cond(isWindows(),'f',\ isCygwin(), 'f',\ 'fx') if testFile($MOD,catFile($dir,${AS.BAT:'epmsys_registry'})) {var ($cmd,$tmp) = (lastCommand(),'EPMSYS_REG') if ?create_epm_script($tmp,lastFile(),$pwd) var $cmd = quote(last,'x') else var $tmp = undef if testFile($MOD,catFile($dir,${AS.BAT:'setEnv'})) call source(getNativePath(lastFile()),true) if grepCommand(concat($cmd,' view SYSTEM9'),'FOUNDATION_SERVICES_PRODUCT','f') {var $box = cleanBox() var $exe = concat($cmd,' view \ SYSTEM9/FOUNDATION_SERVICES_PRODUCT/SHARED_SERVICES_PRODUCT/@CSSConfig') debug ' Inside EPM module, gathering CSS Configuration' report cssconfig prefix {write '---+ CSS Configuration' write '---## Using: ',encode($exe) } if or(isWindows(),isCygwin()) {var $job = createTemp('CSS','.bat',true) call writeTemp('CSS','@echo off') call writeTemp('CSS','cd /d "',getNativePath($box),'"') call writeTemp('CSS',$exe) call closeTemp('CSS') call command(quote($job,'x')) call unlinkTemp('CSS') } elsif isUnix() {var $job = createTemp('CSS','.sh',true) call writeTemp('CSS','cd "',$box,'"') call writeTemp('CSS',$exe) call closeTemp('CSS') call command(quote($job,'x')) call unlinkTemp('CSS') } loop $fil (grepDir($box,'CSSConfig','p')) call writeFile($fil) call cleanBox() if isCreated(true) toc $lvl,':[[',getFile(),'][rda_report][CSS Configuration]]' } # Unlink the temporary file if ?$tmp call unlinkTemp($tmp) } } =head2 S This macro generates a new script to provide the required password. =cut macro create_epm_script {var ($tmp,$fil,$pwd) = @arg # Create a local copy of epmsys_registry if ?$pwd {if loadFile($fil) {var $job = createTemp($tmp,\ cond(isUnix(),'.sh',isWindows(),'.bat',isCygwin(),'.bat'),true) loop $lin (getLines()) call writeTemp($tmp,replace($lin,'\s+\-DEPM_ORACLE_HOME=',\ concat(' -DpasswordFile=',\ cond(isUnix(),quote($pwd,'x'),getShortPath($pwd)),\ ' -DEPM_ORACLE_HOME='))) call closeTemp($tmp) return $job } } return undef } =head2 S This macro gets the Enterprise Peformance Management System version. =cut macro get_epm_version {var ($hom) = @arg if testFile('fr',catFile($hom,'.oracle.products')) {var $obj = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'BCDEPR')) loop $xml (xmlFind($obj,'softwareRegistry/hyperionHome')) {var $pth = catDir(xmlData(xmlFind($xml,'installLocation'))) if or(isCygwin(),isWindows()) var $pth = getNativePath($pth) next !sameDir($hom,$pth) if xmlFind($xml,'products/installableItem \ uid="^productCommonComponents$"/version') return xmlData(last) } } return '' } =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