stafcmd.xml revision 5978
2788N/A<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2788N/A<!DOCTYPE stax SYSTEM "/stax.dtd">
2788N/A<!--
2788N/A ! CDDL HEADER START
2788N/A !
2788N/A ! The contents of this file are subject to the terms of the
2788N/A ! Common Development and Distribution License, Version 1.0 only
2788N/A ! (the "License"). You may not use this file except in compliance
2788N/A ! with the License.
2788N/A !
2788N/A ! You can obtain a copy of the license at
2788N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
2788N/A ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2788N/A ! See the License for the specific language governing permissions
2788N/A ! and limitations under the License.
2788N/A !
2788N/A ! When distributing Covered Code, include this CDDL HEADER in each
2788N/A ! file and include the License file at
2788N/A ! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2788N/A ! add the following below this CDDL HEADER, with the fields enclosed
2788N/A ! by brackets "[]" replaced with your own identifying information:
2788N/A ! Portions Copyright [yyyy] [name of copyright owner]
2788N/A !
2788N/A ! CDDL HEADER END
2788N/A !
5061N/A ! Copyright 2007-2009 Sun Microsystems, Inc.
2788N/A ! Portions Copyright 2011-2012 ForgeRock AS.
2788N/A ! -->
2788N/A<stax>
2788N/A <function name="copyFile">
2788N/A <function-prolog>
2788N/A This function copies a source file to destination file to host
2788N/A </function-prolog>
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="remotehost" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A The name of remote host (default localhost)
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="srcfile" type="required">
2788N/A <function-arg-description>
2788N/A The name of the source fule
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filename"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="destfile" type="required">
2788N/A <function-arg-description>
2788N/A The name of the destination fule
3194N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filename"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A <sequence>
2788N/A <message>
2788N/A 'Copy file %s:%s to %s:%s.' \
2788N/A % (location,srcfile,remotehost,destfile)
2788N/A </message>
2788N/A
2788N/A <script>
2788N/A destfolder = os.path.dirname(destfile)
2788N/A </script>
2788N/A
2788N/A <message>
2788N/A 'Checking for folder %s.' % destfolder
2788N/A </message>
2788N/A
2788N/A <call function="'createFolder'">
2788N/A { 'location' : remotehost,
2788N/A 'foldername' : '%s' % destfolder
2788N/A }
2788N/A </call>
2788N/A
2788N/A <stafcmd name="'STAF Command: Copy File'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcfile,destfile,remotehost) </request>
2788N/A </stafcmd>
2788N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
2788N/A <call function="'checkRC'">
2788N/A { 'returncode' : cmdRC ,
2788N/A 'result' : cmdResult }
2788N/A </call>
2788N/A <return>[cmdRC,cmdResult]</return>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <function name="CopyFolderByExtension">
2788N/A <function-prolog>
2788N/A Copies files by extension from a source to destination folder on host
2788N/A </function-prolog>
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
3951N/A <function-arg-property name="type" value="hostname"/>
3951N/A </function-arg-def>
3951N/A <function-arg-def name="remotehost" type="optional" default="location">
3951N/A <function-arg-description>
3951N/A The name of remote host (default same as location)
2788N/A </function-arg-description>
3951N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
3194N/A <function-arg-def name="srcfolder" type="required">
2788N/A <function-arg-description>
2788N/A The name of the source folder
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="foldername"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="destfolder" type="required">
3951N/A <function-arg-description>
2788N/A The name of the destination file
3600N/A </function-arg-description>
4495N/A <function-arg-property name="type" value="foldername"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="extension" type="optional" default="'txt'">
3600N/A <function-arg-description>
3600N/A The name of the file extension (default txt)
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="file extension"/>
3600N/A </function-arg-def>
3600N/A </function-map-args>
3600N/A <sequence>
2788N/A <message>
2788N/A 'Copy all %s Files from %s:%s to %s:%s.' \
2788N/A % (extension,location,srcfolder,remotehost,destfolder)
2788N/A </message>
2788N/A <stafcmd name="'STAF Command: Copy all %s Files.' % (extension)">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>
3951N/A 'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s EXT %s RECURSE' \
3951N/A % (srcfolder,destfolder,remotehost,extension)
3951N/A </request>
3951N/A </stafcmd>
3951N/A <script>
3951N/A cmdRC=RC
3951N/A cmdResult=STAFResult
3951N/A </script>
3951N/A <call function="'checkRC'">
3951N/A { 'returncode' : cmdRC ,
3951N/A 'result' : cmdResult }
2788N/A </call>
2788N/A <return>cmdRC</return>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <function name="copyFolder">
2788N/A <function-prolog>
2788N/A Copies folder from a source to destination folder on host
2788N/A </function-prolog>
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
3951N/A <function-arg-description>
3951N/A Location of target host
3951N/A </function-arg-description>
3951N/A <function-arg-property name="type" value="hostname"/>
3951N/A </function-arg-def>
3951N/A <function-arg-def name="remotehost" type="optional" default="location">
3951N/A <function-arg-description>
3951N/A The name of remote host (default same as location)
3951N/A </function-arg-description>
3951N/A <function-arg-property name="type" value="hostname"/>
3951N/A </function-arg-def>
3951N/A <function-arg-def name="srcfolder" type="required">
3951N/A <function-arg-description>
3951N/A The name of the source folder
5064N/A </function-arg-description>
5064N/A <function-arg-property name="type" value="foldername"/>
5064N/A </function-arg-def>
5064N/A <function-arg-def name="destfolder" type="required">
5064N/A <function-arg-description>
5064N/A The name of the destination file
5064N/A </function-arg-description>
5064N/A <function-arg-property name="type" value="foldername"/>
5064N/A </function-arg-def>
5064N/A </function-map-args>
5064N/A <sequence>
5064N/A <message>
3951N/A 'Copy folder %s:%s to %s:%s.' \
3951N/A % (location,srcfolder,remotehost,destfolder)
5064N/A </message>
5064N/A <stafcmd name="'STAF Command: Copy %s folder to %s.' % (srcfolder,destfolder)">
5064N/A <location>'%s' % location</location>
5064N/A <service>'fs'</service>
5064N/A <request>'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE' % (srcfolder,destfolder,remotehost) </request>
5064N/A </stafcmd>
5064N/A <script>
3951N/A cmdRC=RC
3951N/A cmdResult=STAFResult
3951N/A </script>
3951N/A <call function="'checkRC'">
3951N/A { 'returncode' : cmdRC ,
3951N/A 'result' : cmdResult }
3951N/A </call>
3951N/A <return>cmdRC</return>
3951N/A </sequence>
5064N/A </function>
5064N/A
5064N/A <function name="zipUpFile">
5064N/A <function-prolog>
5064N/A This function zips up a folder
5064N/A </function-prolog>
5064N/A
5064N/A <function-map-args>
3951N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
3951N/A <function-arg-description>
3951N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="zipfile" type="required">
2788N/A <function-arg-description>
2788N/A Name of the file to place zip file contents
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filename"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="folder" type="required">
2788N/A <function-arg-description>
2788N/A Name of destination folder to place zip file contents
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="relativeto" type="required">
2788N/A <function-arg-description>
2788N/A Folder that the zip archive is relative to
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A
2788N/A <stafcmd name="'STAF Command: Zip Up Folder'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'zip'</service>
4238N/A <request>
4238N/A 'ADD ZIPFILE %s DIRECTORY %s RECURSE RELATIVETO %s' % (zipfile,folder,relativeto)
4238N/A </request>
4238N/A </stafcmd>
4238N/A
4238N/A <script>
4238N/A cmdRC=RC
4238N/A cmdResult=STAFResult
4238N/A </script>
4238N/A
4238N/A <call function="'checkRC'">
4238N/A { 'returncode' : cmdRC ,
4238N/A 'result' : cmdResult }
4238N/A </call>
4238N/A <return>cmdRC</return>
4238N/A </sequence>
4238N/A </function>
4238N/A
4238N/A <function name="unZipFile">
4238N/A <function-prolog>
4238N/A This function unzips a compressed zip archive
4724N/A </function-prolog>
4724N/A <function-map-args>
4724N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
4724N/A <function-arg-description>
4724N/A Location of target host
4724N/A </function-arg-description>
4724N/A <function-arg-property name="type" value="hostname"/>
4724N/A </function-arg-def>
4724N/A <function-arg-def name="zipfile" type="required">
4238N/A <function-arg-description>
4238N/A Name of the file to place zip file contents
4238N/A </function-arg-description>
4238N/A <function-arg-property name="type" value="filename"/>
4238N/A </function-arg-def>
4238N/A <function-arg-def name="file" type="optional" default="None">
4238N/A <function-arg-description>
4238N/A Name of file to unzip
4238N/A </function-arg-description>
4238N/A <function-arg-property name="type" value="filepath"/>
4238N/A </function-arg-def>
4238N/A <function-arg-def name="directory" type="optional" default="None">
4238N/A <function-arg-description>
4238N/A Name of directory to unzip
4238N/A </function-arg-description>
4238N/A <function-arg-property name="type" value="filepath"/>
4238N/A </function-arg-def>
4238N/A <function-arg-def name="unzipdir" type="required">
4238N/A <function-arg-description>
4238N/A Name of destination folder to place zip file contents
4238N/A </function-arg-description>
4238N/A <function-arg-property name="type" value="filepath"/>
4238N/A </function-arg-def>
4238N/A </function-map-args>
4238N/A
4238N/A <sequence>
4238N/A <script>
4238N/A if file:
4238N/A file='FILE %s' % file
4238N/A else:
4238N/A file=''
4238N/A
4238N/A if directory:
4238N/A dir='DIRECTORY %s' % directory
4238N/A else:
4238N/A dir=''
4238N/A </script>
4724N/A
4724N/A <stafcmd name="'STAF Command: Unzip File'">
4724N/A <location>'%s' % location</location>
4724N/A <service>'zip'</service>
4724N/A <request>
4724N/A 'UNZIP ZIPFILE %s TODIRECTORY %s %s %s RESTOREPERMISSION REPLACE' % (zipfile,unzipdir,file,dir)
4724N/A </request>
4724N/A </stafcmd>
4724N/A <script>
4238N/A cmdRC=RC
4238N/A cmdResult=STAFResult
4724N/A </script>
4238N/A <call function="'checkRC'">
4238N/A { 'returncode' : cmdRC ,
4724N/A 'result' : cmdResult }
4724N/A </call>
4238N/A <return>cmdRC</return>
4238N/A </sequence>
4238N/A </function>
4238N/A
4238N/A <function name="deleteFile">
4238N/A <function-prolog>
4238N/A This function deletes a file
4238N/A </function-prolog>
4616N/A
4724N/A <function-map-args>
4724N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
4238N/A <function-arg-description>
4238N/A Location of target host
4238N/A </function-arg-description>
4238N/A <function-arg-property name="type" value="hostname"/>
4238N/A </function-arg-def>
4238N/A <function-arg-def name="filename" type="required">
4238N/A <function-arg-description>
4238N/A Name of file to be deleted
4238N/A </function-arg-description>
4238N/A <function-arg-property name="type" value="filename"/>
4238N/A </function-arg-def>
4238N/A </function-map-args>
4616N/A
4616N/A <sequence>
4616N/A <stafcmd name="'STAF Command: Delete Existing File'">
4616N/A <location>'%s' % location</location>
4616N/A <service>'fs'</service>
4616N/A <request>
4238N/A 'GET ENTRY %s TYPE' % (filename)
4616N/A </request>
4616N/A </stafcmd>
4616N/A
4616N/A <if expr="RC == 48">
4616N/A <sequence>
4616N/A <message log="1">
4616N/A 'Success: File does not exist, dont delete it.'
4616N/A </message>
4616N/A <return>0</return>
4616N/A </sequence>
4616N/A <else>
4616N/A <sequence>
4616N/A <message log="1">
4238N/A 'Success: File does exists, will delete it'
4238N/A </message>
4238N/A </sequence>
4238N/A </else>
4238N/A </if>
4238N/A
4238N/A <stafcmd name="'STAF Command: Delete Existing File'">
4238N/A <location>'%s' % location</location>
4238N/A <service>'fs'</service>
2788N/A <request>
2788N/A 'DELETE ENTRY %s CONFIRM' % filename
2788N/A </request>
2788N/A </stafcmd>
2788N/A
2788N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
2788N/A
2788N/A <call function="'checkRC'">
2788N/A { 'returncode' : cmdRC ,
2788N/A 'result' : cmdResult }
2788N/A </call>
2788N/A <return>cmdRC</return>
2788N/A </sequence>
2788N/A </function>
3951N/A
3951N/A <function name="deleteFolder">
3951N/A <function-prolog>
3951N/A This function recursively deletes a folder
3951N/A </function-prolog>
3951N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
3973N/A <function-arg-def name="foldername" type="required">
3973N/A <function-arg-description>
3973N/A Name of folder to be deleted
3973N/A </function-arg-description>
3973N/A <function-arg-property name="type" value="filepath"/>
3973N/A </function-arg-def>
3973N/A </function-map-args>
3973N/A
3973N/A <sequence>
2788N/A
2788N/A <stafcmd name="'STAF Command: Get Folder Attributes'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>'GET ENTRY %s TYPE' % foldername</request>
2788N/A </stafcmd>
2788N/A
2788N/A <if expr="RC == 48">
2788N/A <sequence>
3951N/A <message log="1">
3951N/A 'Folder does not exist, do not delete it.'
3951N/A </message>
3951N/A <return>0</return>
3951N/A </sequence>
3951N/A <else>
3951N/A <sequence>
3951N/A <message log="1">
3951N/A 'Folder exists, will delete it'
3951N/A </message>
2788N/A </sequence>
2788N/A </else>
2788N/A </if>
2788N/A <stafcmd name="'STAF Command: Recursively Delete Folder'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>
2788N/A 'DELETE ENTRY %s RECURSE IGNOREERRORS CONFIRM' % (foldername)
2788N/A </request>
4238N/A </stafcmd>
2788N/A
2788N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
2788N/A
2788N/A <call function="'checkRC'">
2788N/A { 'returncode' : cmdRC ,
2788N/A 'result' : cmdResult }
2788N/A </call>
2788N/A
2788N/A <return>cmdRC</return>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
3951N/A <function name="createFolder">
3951N/A
3951N/A <function-prolog>
3951N/A This function creates a folder
3951N/A </function-prolog>
2788N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="foldername" type="required">
2788N/A <function-arg-description>
2788N/A Name of folder to be created
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
3951N/A
3951N/A <sequence>
3951N/A
3951N/A <message>
3951N/A 'Creating folder %s. on %s' % (foldername,location)
3951N/A </message>
3951N/A
3951N/A <stafcmd name="'STAF Command: Create Folder'">
3951N/A <location>'%s' % location</location>
3951N/A <service>'fs'</service>
2788N/A <request>
2788N/A 'CREATE DIRECTORY %s FULLPATH' % foldername
2788N/A </request>
2788N/A </stafcmd>
2788N/A
2788N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
4238N/A
2788N/A <call function="'checkRC'">
2788N/A { 'returncode' : cmdRC ,
2788N/A 'result' : cmdResult }
2788N/A </call>
2788N/A
2788N/A <return>cmdRC</return>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A <function name="createMultiFolders" scope="local">
2788N/A
2788N/A <function-prolog>
2788N/A This function creates multiple folders
2788N/A </function-prolog>
2788N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="folderslist" type="required">
2788N/A <function-arg-description>
2788N/A Name of folder to be created
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A
2788N/A <iterate var="folderToCreate" in="folderslist">
2788N/A
2788N/A <sequence>
2788N/A <message>'Check if folder exists already.'</message>
2788N/A
2788N/A <call function="'GetEntry'">
2788N/A {
2788N/A 'location' : location,
2788N/A 'entry' : folderToCreate,
2788N/A 'attribute' : 'TYPE'
2788N/A }
2788N/A </call>
2788N/A
2788N/A <if expr="RC == 48">
2788N/A <sequence>
2788N/A
2788N/A <message>
2788N/A 'Folder %s does not exists, create folder' % folderToCreate
2788N/A </message>
2788N/A
2788N/A <call function="'createFolder'">
2788N/A { 'location' : location,
2788N/A 'foldername' : folderToCreate
2788N/A }
2788N/A </call>
2788N/A </sequence>
2788N/A </if>
2788N/A </sequence>
2788N/A </iterate>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A <function name="queryLogs">
2788N/A
3847N/A <function-prolog>
2788N/A Queries the staf logs from startfrom point
2788N/A </function-prolog>
2788N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="logname" type="required">
2788N/A <function-arg-description>
2788N/A Name of file to be deleted
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="startfrom" type="required">
2788N/A <function-arg-description>
2788N/A Name of file to be deleted
3847N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="timestamp"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="endat" type="required">
2788N/A <function-arg-description>
2788N/A Name of file to be deleted
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="timestamp"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A
2788N/A <block name="'Query Logs'">
2788N/A <timer duration="'60s'">
2788N/A <stafcmd name="'STAF Command: Log Query for Test Case Log.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'log'</service>
2788N/A <request>'QUERY ALL MACHINE %s LOGNAME %s FROM %s TO %s' % (location,logname,startfrom,endat)</request>
2788N/A </stafcmd>
2788N/A </timer>
2788N/A </block>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
4153N/A <function name="SetVar">
2788N/A
2788N/A <function-prolog>
2788N/A Sets a variable in the staf var service
2788N/A </function-prolog>
2788N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="type" type="required">
2788N/A <function-arg-description>
2788N/A Name of file to be deleted
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="variable"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="variable" type="required">
2788N/A <function-arg-description>
2788N/A Name of file to be deleted
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="variable"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A
2788N/A <message>'Set %s Variable %s' % (type,variable)</message>
2788N/A
2788N/A <stafcmd name="'STAF Command: Set Var.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'var'</service>
2788N/A <request>'SET %s VAR %s' % (type,variable)</request>
2788N/A </stafcmd>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A <function name="GetVar">
2788N/A
2788N/A <function-prolog>
2788N/A Gets a variable in the staf var service
2788N/A </function-prolog>
2788N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="type" type="required">
4495N/A <function-arg-description>
4495N/A Type of variable
4495N/A </function-arg-description>
4495N/A <function-arg-property name="type" value="variable"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="variable" type="required">
4495N/A <function-arg-description>
4495N/A Name of variable
4495N/A </function-arg-description>
4495N/A <function-arg-property name="type" value="variable"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A
2788N/A <message>'Get %s Variable %s' % (type,variable)</message>
2788N/A
2788N/A <stafcmd name="'STAF Command: Get Var.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'var'</service>
2788N/A <request>'GET %s VAR %s' % (type,variable)</request>
2788N/A </stafcmd>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A <function name="ResolveVar">
4495N/A
4495N/A <function-prolog>
4495N/A Resolve a variable in the staf var service
4495N/A </function-prolog>
4495N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
4495N/A <function-arg-def name="type" type="required">
4495N/A <function-arg-description>
4495N/A Type of string to be resolved
4495N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="variable"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="name" type="required">
4865N/A <function-arg-description>
4865N/A Name of string to be resolved
4865N/A </function-arg-description>
4865N/A <function-arg-property name="type" value="string"/>
4865N/A </function-arg-def>
4865N/A </function-map-args>
4865N/A
4865N/A <sequence>
4865N/A
4865N/A <message>'Resolve %s Variable %s' % (type, name)</message>
4865N/A
4865N/A <stafcmd name="'STAF Command: Resolve Var.'">
4865N/A <location>'%s' % location</location>
4865N/A <service>'var'</service>
4865N/A <request>'RESOLVE %s {%s}' % (type, name)</request>
5061N/A </stafcmd>
4865N/A
4865N/A </sequence>
4865N/A
4865N/A </function>
4865N/A
4865N/A <function name="GetEntry">
4865N/A
4865N/A <function-prolog>
4865N/A Retrieves an attribute of a file system entry
4865N/A </function-prolog>
4865N/A
4865N/A <function-map-args>
4865N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
4865N/A <function-arg-description>
4865N/A Location of target host
4865N/A </function-arg-description>
4865N/A <function-arg-property name="type" value="hostname"/>
4865N/A </function-arg-def>
4865N/A <function-arg-def name="entry" type="required">
4865N/A <function-arg-description>
4865N/A Name of entry to retrieve attributes
4865N/A </function-arg-description>
4865N/A <function-arg-property name="type" value="variable"/>
4865N/A </function-arg-def>
4865N/A <function-arg-def name="attribute" type="required">
4865N/A <function-arg-description>
4865N/A Type of attributes to be retrieved
4865N/A </function-arg-description>
4865N/A <function-arg-property name="type" value="string"/>
4865N/A </function-arg-def>
4865N/A </function-map-args>
4865N/A
4865N/A <sequence>
4865N/A
4865N/A <message>'Retrieve attribute %s for %s.' % (attribute,entry)</message>
4865N/A
4865N/A <stafcmd name="'STAF Command: Get Entries Attributes'">
4865N/A <location>'%s' % location</location>
4865N/A <service>'fs'</service>
4865N/A <request>'GET ENTRY %s %s' % (entry,attribute)</request>
4865N/A </stafcmd>
4865N/A <script>
4865N/A cmdRC=RC
4865N/A cmdResult=STAFResult
4865N/A </script>
4865N/A <return>[cmdRC,cmdResult]</return>
4865N/A </sequence>
4865N/A
4865N/A </function>
4865N/A
4865N/A
4865N/A<!-- List a folder -->
4865N/A <function name="listFolder">
4865N/A <function-prolog>
4865N/A This function lists a folder
4865N/A </function-prolog>
4865N/A
4865N/A <function-map-args>
4865N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
4865N/A <function-arg-description>
4865N/A Location of target host
4865N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="foldername" type="required">
2788N/A <function-arg-description>
2788N/A Name of folder to be list
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="filename" type="required">
2788N/A <function-arg-description>
2788N/A Name of file to be list
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
4680N/A
2788N/A <sequence>
2788N/A <stafcmd name="'STAF Command: list Folder Attributes'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>' LIST DIRECTORY %s NAME %s LONG ' % (foldername,filename)</request>
2788N/A </stafcmd>
2788N/A <if expr="RC != 0">
2788N/A <sequence>
2788N/A <message log="1">
2788N/A 'Folder does not exist.'
2788N/A </message>
2788N/A <return>0</return>
2788N/A </sequence>
3194N/A </if>
2788N/A
3194N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
2788N/A
2788N/A <call function="'checkRC'">
2788N/A { 'returncode' : cmdRC ,
2788N/A 'result' : cmdResult }
2788N/A </call>
2788N/A
2788N/A <return>cmdRC</return>
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A<!-- List a folder by extension -->
2788N/A <function name="listFolderByExtension" scope="local">
2788N/A <function-prolog>
2788N/A This function lists a folder by extension
2788N/A </function-prolog>
2788N/A
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="foldername" type="required">
2788N/A <function-arg-description>
2788N/A Name of folder to be list
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filepath"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="extension" type="required">
2788N/A <function-arg-description>
2788N/A he name of the file extension (default txt)
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="file extension"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A <stafcmd name="'STAF Command: list folder by extension'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>' LIST DIRECTORY %s EXT %s RECURSE' % (foldername,extension)</request>
2788N/A </stafcmd>
2788N/A
2788N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
2788N/A
2788N/A <if expr="cmdRC != 0">
2788N/A <sequence>
2788N/A <script>
2788N/A cmdResult = 'Folder does not exist.'
2788N/A </script>
2788N/A </sequence>
5061N/A </if>
2788N/A
2788N/A <call function="'checkRC'">
2788N/A {
2788N/A 'returncode' : cmdRC ,
2788N/A 'result' : cmdResult
2788N/A }
2788N/A </call>
5064N/A
5064N/A <return>cmdResult</return>
5064N/A </sequence>
5064N/A </function>
5064N/A
5064N/A <function name="getFile">
5064N/A <function-prolog>
2788N/A This function get the contents of a file
2788N/A </function-prolog>
2788N/A <function-map-args>
2788N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="filename" type="required">
2788N/A <function-arg-description>
2788N/A The name of the file
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="filename"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="type" type="optional" default="'text'">
2788N/A <function-arg-description>
2788N/A The type of the file
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="string"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="format" type="optional" default="'native'">
2788N/A <function-arg-description>
2788N/A The format of the file
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="string"/>
5064N/A </function-arg-def>
5064N/A </function-map-args>
5064N/A <sequence>
5064N/A <stafcmd name="'STAF Command: Get File'">
5064N/A <location>'%s' % location</location>
5064N/A <service>'fs'</service>
5064N/A <request>
5064N/A 'GET FILE %s %s FORMAT %s' % (filename,type,format)
5064N/A </request>
5064N/A </stafcmd>
5064N/A <script>
5064N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
5064N/A <return>[cmdRC,cmdResult]</return>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <!-- Send event -->
2788N/A <function name="SendEvent" scope="local">
2788N/A <function-prolog>
2788N/A Send event.
2788N/A </function-prolog>
2788N/A <function-map-args>
2788N/A <function-arg-def name="location"
4777N/A type="optional"
4777N/A default="STAXServiceMachine">
4777N/A <function-arg-description>
4777N/A Location of target host
4777N/A </function-arg-description>
4777N/A <function-arg-property name="type" value="hostname"/>
4777N/A </function-arg-def>
4777N/A <function-arg-def name="name" type="required">
4777N/A <function-arg-description>
4777N/A Name of event to send
2788N/A </function-arg-description>
5061N/A <function-arg-property name="type" value="string"/>
5061N/A </function-arg-def>
5061N/A </function-map-args>
5064N/A
2788N/A <sequence>
2788N/A <message>'Send Event %s on %s' % (name, location)</message>
2788N/A
4865N/A <stafcmd name="'STAF Command: Send Event.'">
5061N/A <location>'%s' % location</location>
5061N/A <service>'sem'</service>
5061N/A <request>'PULSE EVENT %s' % name</request>
5061N/A </stafcmd>
2788N/A </sequence>
2788N/A </function>
4865N/A
5061N/A <!-- Wait event -->
5061N/A <function name="WaitEvent" scope="local">
2788N/A <function-prolog>
2788N/A Wait event.
2788N/A </function-prolog>
4865N/A <function-map-args>
5061N/A <function-arg-def name="location"
5061N/A type="optional"
5061N/A default="STAXServiceMachine">
5061N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
4865N/A <function-arg-property name="type" value="hostname"/>
5061N/A </function-arg-def>
5061N/A <function-arg-def name="name" type="required">
5061N/A <function-arg-description>
5061N/A Name of event to wait
5064N/A </function-arg-description>
5064N/A <function-arg-property name="type" value="string"/>
5064N/A </function-arg-def>
5064N/A </function-map-args>
2788N/A
4865N/A <sequence>
4865N/A <message>'Wait Event %s on %s' % (name, location)</message>
4865N/A
4865N/A <stafcmd name="'STAF Command: Wait Event.'">
4865N/A <location>'%s' % location</location>
2788N/A <service>'sem'</service>
2788N/A <request>'WAIT EVENT %s' % name</request>
2788N/A </stafcmd>
5061N/A </sequence>
4777N/A </function>
4777N/A
4777N/A <!-- Delete event -->
4777N/A <function name="DeleteEvent" scope="local">
4777N/A <function-prolog>
4777N/A Delete event.
4777N/A </function-prolog>
4777N/A <function-map-args>
4777N/A <function-arg-def name="location"
4865N/A type="optional"
4777N/A default="STAXServiceMachine">
4777N/A <function-arg-description>
4777N/A Location of target host
4777N/A </function-arg-description>
4777N/A <function-arg-property name="type" value="hostname"/>
4777N/A </function-arg-def>
4777N/A <function-arg-def name="name" type="required">
4865N/A <function-arg-description>
4865N/A Name of event to delete
4865N/A </function-arg-description>
4865N/A <function-arg-property name="type" value="string"/>
4865N/A </function-arg-def>
4865N/A </function-map-args>
4865N/A
4865N/A <sequence>
4865N/A <message>'Delete Event %s on %s' % (name, location)</message>
5105N/A <stafcmd name="'STAF Command: Delete Event.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'sem'</service>
2788N/A <request>'DELETE EVENT %s' % name</request>
2788N/A </stafcmd>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <!-- Add STAF Java Service -->
2788N/A <function name="addSTAFJavaService" scope="local">
5061N/A <function-prolog>
5061N/A Add STAF Java Service.
5061N/A </function-prolog>
5061N/A <function-map-args>
5061N/A <function-arg-def name="location"
5061N/A type="optional"
5061N/A default="STAXServiceMachine">
5061N/A <function-arg-description>
5061N/A Location of target host
5064N/A </function-arg-description>
5061N/A <function-arg-property name="type" value="hostname"/>
5061N/A </function-arg-def>
5065N/A <function-arg-def name="serviceName" type="required">
5061N/A <function-arg-description>
5061N/A Name of the service to add
5061N/A </function-arg-description>
5061N/A <function-arg-property name="type" value="string"/>
5061N/A </function-arg-def>
5061N/A <function-arg-def name="serviceJar" type="required">
5061N/A <function-arg-description>
5061N/A Jar of the service to add
5105N/A </function-arg-description>
5061N/A <function-arg-property name="type" value="string"/>
5061N/A </function-arg-def>
5061N/A <function-arg-def name="JVM" type="optional" default="True">
5061N/A <function-arg-description>
5064N/A JVM path
5061N/A </function-arg-description>
5105N/A <function-arg-property name="type" value="enum"/>
5061N/A </function-arg-def>
5061N/A <function-arg-def name="J2" type="optional">
5061N/A <function-arg-description>
2788N/A JVM options
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="string"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A
2788N/A <message>
2788N/A 'Check if STAF Java Service %s is already started on %s' \
2788N/A % (serviceName, location)
2788N/A </message>
2788N/A <stafcmd name="'STAF Command: Check STAF Java Service.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'service'</service>
2788N/A <request>'query service %s' % serviceName</request>
2788N/A </stafcmd>
2788N/A <if expr="RC == 48">
2788N/A <sequence>
2788N/A <script>
4777N/A cmdOptions = 'ADD SERVICE %s LIBRARY JSTAF' % serviceName
4777N/A cmdOptions += ' EXECUTE %s' % serviceJar
4777N/A
4777N/A if JVM:
4777N/A cmdOptions += ' OPTION JVMNAME=%sJVM-%s' % (serviceName,location)
4777N/A
4777N/A if location == STAXServiceMachine:
5105N/A cmdOptions += ' OPTION JVM=%s/bin/java' % LOCAL_JAVA_HOME
4777N/A else:
2788N/A cmdOptions += ' OPTION JVM=%s/bin/java' % JAVA_HOME
2788N/A
2788N/A if J2:
2788N/A cmdOptions += ' OPTION J2="%s"' % J2
5061N/A </script>
2788N/A
2788N/A <message>
2788N/A 'Add STAF Java Service %s on %s' % (serviceName, location)
2788N/A </message>
2788N/A <message>'service %s' % cmdOptions</message>
2788N/A <stafcmd name="'STAF Command: Add STAF Java Service.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'service'</service>
2788N/A <request>'%s' % cmdOptions</request>
2788N/A </stafcmd>
2788N/A </sequence>
2788N/A <else>
2788N/A <message>
2788N/A 'STAF Java Service %s is already started on %s' \
2788N/A % (serviceName, location)
2788N/A </message>
2788N/A </else>
2788N/A </if>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <!-- Remove STAF Java Service -->
2788N/A <function name="removeSTAFJavaService" scope="local">
2788N/A <function-prolog>
2788N/A Remove STAF Java Service.
2788N/A </function-prolog>
2788N/A <function-map-args>
2788N/A <function-arg-def name="location"
2788N/A type="optional"
2788N/A default="STAXServiceMachine">
2788N/A <function-arg-description>
2788N/A Location of target host
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
5061N/A <function-arg-def name="serviceName" type="required">
2788N/A <function-arg-description>
2788N/A Name of the service to add
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="string"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
3816N/A <script>
3855N/A cmdOptions = 'REMOVE SERVICE %s ' % serviceName
2788N/A </script>
2788N/A
2788N/A <message>
2788N/A 'Remove STAF Java Service %s on %s' % (serviceName, location)
2788N/A </message>
3855N/A <stafcmd name="'STAF Command: Remove STAF Java Service.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'service'</service>
2788N/A <request>'%s' % cmdOptions</request>
2788N/A </stafcmd>
2788N/A </sequence>
2788N/A </function>
2788N/A</stax>
2788N/A