# ASITlib.ctl: Defines Common Macros for Oracle Fusion Middleware 11g # $Id: ASITlib.ctl,v 1.3 2013/10/30 07:18:32 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/ASITlib.ctl,v 1.3 2013/10/30 07:18:32 RDA Exp $ # # Change History # 20130421 MSC Improve the validation. =head1 NAME OFM:ASITlib - Defines Common Macros for Oracle Fusion Middleware 11g =head1 DESCRIPTION This persistent submodule regroups macros that are common to several Oracle Fusion Middleware 11g related-modules. The following macros are available: =cut # Make the module persistent and share macros keep $KEEP_BLOCK,@SHARE_MACROS var @SHARE_MACROS = ('get_components') =head2 S This macro retrieves the instance components that have a type matching the specified pattern and returns the instance name. =cut macro get_components {var (\%cmp,$dir,$ins,$pat) = @arg var %cmp = () var ($opmnctl) = grepDir(catDir($dir,'bin'),'^opmnctl(\.(bat|exe))?$','fip') if loadCommand(concat(quote($opmnctl),' status -fmt %cmp%prt%uid 2>&1')) {loop $lin (getLines()) {next match($lin,'^(-+|\s*$|ias-component)',true) if match($lin,'Processes in Instance:\s*(.*?)$',true) var ($dsc) = (last) else {var ($cmp,$typ,$uid) = split('\s*\|\s*',$lin,3) if and($cmp,$typ,match($typ,$pat,true)) var $cmp{join('|',$typ,$cmp)} = check($uid,'^\d+$',$uid,0) } } } if !?$dsc {var ($fil) = grepDir(catDir($dir,'config','OPMN'),'^opmn\.xml$','fr') if ?testFile('r',$fil) {var $top = xmlLoadFile($fil,xmlDisable(xmlParser(),'DR')) if xmlFind($top,'opmn/process-manager/ias-instance') {var ($obj) = last var $dsc = xmlValue($obj,'name') loop $xml (xmlFind($obj,'ias-component')) {var $nam = xmlValue($xml,'id') var $typ = xmlValue($xml,'type') if $typ {if match($typ,$pat,true) var $cmp{join('|',$typ,$nam)} = 0 } else {loop $prc (xmlFind($xml,'process-type')) {var $typ = xmlValue($prc,'id') if match($typ,$pat,true) var $cmp{join('|',$typ,$nam)} = 0 } } } } } } return nvl($dsc,$ins) } =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, 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