RGM은 다른 콜백 메소드와 달리 여러 인자 집합을 Validate 메소드에 전달하므로 Validate는 다른 메소드에는 없는 인자를 구문 분석하기 위한 함수를 필요로 합니다. Validate 및 다른 콜백 메소드에 전달되는 인자에 대한 자세한 내용은 rt_callbacks(1HA) 설명서 페이지를 참조하십시오. 다음은 Validate parse_args() 함수를 보여주는 코드 샘플입니다.
#########################################################################
# Parse Validate arguments.
#
function parse_args # [args...]
{
typeset opt
while getopts 'cur:x:g:R:T:G:' opt
do
case "$opt" in
R)
# Name of the DNS resource.
RESOURCE_NAME=$OPTARG
;;
G)
# Name of the resource group in which the resource is
# configured.
RESOURCEGROUP_NAME=$OPTARG
;;
T)
# Name of the resource type.
RESOURCETYPE_NAME=$OPTARG
;;
r)
# The method is not accessing any system defined
# properties so this is a no-op
;;
g)
# The method is not accessing any resource group
# properties, so this is a no-op
;;
c)
# Indicates the Validate method is being called while
# creating the resource, so this flag is a no-op.
;;
u)
# Indicates the updating of a property when the
# resource already exists. If the update is to the
# Confdir property then Confdir should appear in the
# command-line arguments. If it does not, the method must
# look for it specifically using scha_resource_get.
UPDATE_PROPERTY=1
;;
x)
# Extension property list. Separate the property and
# value pairs using "=" as the separator.
PROPERTY=`echo $OPTARG | awk -F= '{print $1}'`
VAL=`echo $OPTARG | awk -F= '{print $2}'`
# If the Confdir extension property is found on the
# command line, note its value.
if [ $PROPERTY == "Confdir" ]; then
CONFDIR=$VAL
CONFDIR_FOUND=1
fi
;;
*)
logger -p ${SYSLOG_FACILITY}.err \
-t [$SYSLOG_TAG] \
"ERROR: Option $OPTARG unknown"
exit 1
;;
esac
done
}
다른 메소드의 parse_args() 함수와 마찬가지로 이 함수는 자원 이름을 캡처하는 R 플래그, 자원 그룹 이름을 캡처하는 G 플래그 및 RGM이 전달한 자원 유형을 캡처하는 T 플래그를 제공합니다.
자원을 업데이트하는 동안 확장 등록 정보를 검증하기 위해 이 메소드가 호출되므로 시스템 정의 등록 정보를 나타내는 r 플래그, 자원 그룹 등록 정보를 나타내는 g 플래그 및 자원 작성 도중 수행되는 검증을 나타내는 c 플래그는 무시됩니다.
u 플래그는 UPDATE_PROPERTY 쉘 변수의 값을 1(TRUE)로 설정하며 x 플래그는 업데이트할 등록 정보의 이름과 값을 캡처합니다. 업데이트되는 등록 정보 중 하나가 Confdir인 경우 CONFDIR 쉘 변수에 해당 값이 저장되며 CONFDIR_FOUND 변수가 1(TRUE)로 설정됩니다.