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 !
4714N/A ! Copyright 2007-2009 Sun Microsystems, Inc.
5978N/A ! Portions Copyright 2011-2012 ForgeRock AS.
2788N/A ! -->
2788N/A<stax>
5979N/A <function name="copyFile" scope="local">
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>
5979N/A The name of the source 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="destfile" type="required">
2788N/A <function-arg-description>
5979N/A The name of the destination file
2788N/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>
5979N/A <script>
5979N/A myLocation=location
5979N/A </script>
5540N/A <message>
5540N/A 'Copy file %s:%s to %s:%s.' \
5979N/A % (myLocation,srcfile,remotehost,destfile)
5540N/A </message>
5540N/A
5540N/A <script>
5540N/A destfolder = os.path.dirname(destfile)
5540N/A </script>
5978N/A
5978N/A <message>
5979N/A 'Checking for parent folder %s on host %s.' % (destfolder,remotehost)
5978N/A </message>
5978N/A
5540N/A <call function="'createFolder'">
5978N/A { 'location' : remotehost,
5540N/A 'foldername' : '%s' % destfolder
5540N/A }
5979N/A </call>
5540N/A
2788N/A <stafcmd name="'STAF Command: Copy File'">
5979N/A <location>'%s' % myLocation</location>
2788N/A <service>'fs'</service>
5979N/A <request>
5979N/A 'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcfile,destfile,remotehost)
5979N/A </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>
4714N/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>
2788N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/A <function-arg-def name="remotehost" type="optional" default="location">
2788N/A <function-arg-description>
2788N/A The name of remote host (default same as location)
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="hostname"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="srcfolder" type="required">
4714N/A <function-arg-description>
4714N/A The name of the source folder
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="foldername"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="destfolder" type="required">
4714N/A <function-arg-description>
4714N/A The name of the destination file
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="foldername"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="extension" type="optional" default="'txt'">
4714N/A <function-arg-description>
4714N/A The name of the file extension (default txt)
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="file extension"/>
4714N/A </function-arg-def>
4714N/A </function-map-args>
4714N/A <sequence>
5540N/A <message>
5540N/A 'Copy all %s Files from %s:%s to %s:%s.' \
5540N/A % (extension,location,srcfolder,remotehost,destfolder)
5540N/A </message>
4714N/A <stafcmd name="'STAF Command: Copy all %s Files.' % (extension)">
4714N/A <location>'%s' % location</location>
4714N/A <service>'fs'</service>
5540N/A <request>
5540N/A 'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s EXT %s RECURSE' \
5540N/A % (srcfolder,destfolder,remotehost,extension)
5540N/A </request>
4714N/A </stafcmd>
4714N/A <script>
4714N/A cmdRC=RC
4714N/A cmdResult=STAFResult
4714N/A </script>
4714N/A <call function="'checkRC'">
4714N/A { 'returncode' : cmdRC ,
4714N/A 'result' : cmdResult }
4714N/A </call>
4714N/A <return>cmdRC</return>
4714N/A </sequence>
4714N/A </function>
4714N/A
4714N/A <function name="copyFolder">
4714N/A <function-prolog>
4714N/A Copies folder from a source to destination folder on host
4714N/A </function-prolog>
4714N/A <function-map-args>
4714N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
4714N/A <function-arg-description>
4714N/A Location of target host
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="hostname"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="remotehost" type="optional" default="location">
4714N/A <function-arg-description>
4714N/A The name of remote host (default same as location)
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="hostname"/>
2788N/A </function-arg-def>
2788N/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">
2788N/A <function-arg-description>
2788N/A The name of the destination file
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="foldername"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A <sequence>
5540N/A <message>
5540N/A 'Copy folder %s:%s to %s:%s.' \
5540N/A % (location,srcfolder,remotehost,destfolder)
5540N/A </message>
4714N/A <stafcmd name="'STAF Command: Copy %s folder to %s.' % (srcfolder,destfolder)">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
4714N/A <request>'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE' % (srcfolder,destfolder,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</return>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <function name="zipUpFile">
2788N/A <function-prolog>
2788N/A This function zips up a folder
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="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>
2788N/A <request>
2788N/A 'ADD ZIPFILE %s DIRECTORY %s RECURSE RELATIVETO %s' % (zipfile,folder,relativeto)
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>
2788N/A
2788N/A <function name="unZipFile">
2788N/A <function-prolog>
2788N/A This function unzips a compressed zip archive
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="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>
4714N/A <function-arg-def name="file" type="optional" default="None">
4714N/A <function-arg-description>
4714N/A Name of file to unzip
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="filepath"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="directory" type="optional" default="None">
4714N/A <function-arg-description>
4714N/A Name of directory to unzip
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="filepath"/>
4714N/A </function-arg-def>
2788N/A <function-arg-def name="unzipdir" 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-map-args>
2788N/A
2788N/A <sequence>
4714N/A <script>
4714N/A if file:
4714N/A file='FILE %s' % file
4714N/A else:
4714N/A file=''
4714N/A
4714N/A if directory:
4714N/A dir='DIRECTORY %s' % directory
4714N/A else:
4714N/A dir=''
4714N/A </script>
4714N/A
2788N/A <stafcmd name="'STAF Command: Unzip File'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'zip'</service>
2788N/A <request>
4714N/A 'UNZIP ZIPFILE %s TODIRECTORY %s %s %s RESTOREPERMISSION REPLACE' % (zipfile,unzipdir,file,dir)
2788N/A </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</return>
2788N/A </sequence>
2788N/A </function>
2788N/A
2788N/A <function name="deleteFile">
2788N/A <function-prolog>
2788N/A This function deletes a file
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="filename" 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="filename"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A
2788N/A <sequence>
2788N/A <stafcmd name="'STAF Command: Delete Existing File'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>
2788N/A 'GET ENTRY %s TYPE' % (filename)
2788N/A </request>
2788N/A </stafcmd>
2788N/A
2788N/A <if expr="RC == 48">
2788N/A <sequence>
2788N/A <message log="1">
2788N/A 'Success: File does not exist, dont delete it.'
2788N/A </message>
2788N/A <return>0</return>
2788N/A </sequence>
2788N/A <else>
2788N/A <sequence>
2788N/A <message log="1">
2788N/A 'Success: File does exists, will delete it'
2788N/A </message>
2788N/A </sequence>
2788N/A </else>
2788N/A </if>
2788N/A
2788N/A <stafcmd name="'STAF Command: Delete Existing File'">
2788N/A <location>'%s' % location</location>
2788N/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>
2788N/A
2788N/A <function name="deleteFolder">
2788N/A <function-prolog>
2788N/A This function recursively deletes a folder
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 deleted
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: 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>
2788N/A <message log="1">
5979N/A 'Folder %s does not exist, do not delete it.' % foldername
2788N/A </message>
2788N/A <return>0</return>
2788N/A </sequence>
2788N/A <else>
2788N/A <sequence>
2788N/A <message log="1">
5979N/A 'Folder %s exists, will delete it and all contents.' % foldername
2788N/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>
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
2788N/A <return>cmdRC</return>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A <function name="createFolder">
2788N/A
2788N/A <function-prolog>
2788N/A This function creates a folder
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>
4714N/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
5978N/A <message>
5979N/A 'Creating folder %s on %s' % (foldername,location)
5978N/A </message>
5978N/A
2788N/A <stafcmd name="'STAF Command: Create Folder'">
2788N/A <location>'%s' % location</location>
2788N/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>
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
5911N/A <function name="createMultiFolders" scope="local">
5911N/A
5911N/A <function-prolog>
5911N/A This function creates multiple folders
5911N/A </function-prolog>
5911N/A
5911N/A <function-map-args>
5911N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
5911N/A <function-arg-description>
5911N/A Location of target host
5911N/A </function-arg-description>
5911N/A <function-arg-property name="type" value="hostname"/>
5911N/A </function-arg-def>
5911N/A <function-arg-def name="folderslist" type="required">
5911N/A <function-arg-description>
5911N/A Name of folder to be created
5911N/A </function-arg-description>
5911N/A <function-arg-property name="type" value="filepath"/>
5911N/A </function-arg-def>
5911N/A </function-map-args>
5911N/A
5911N/A <sequence>
5911N/A
5911N/A <iterate var="folderToCreate" in="folderslist">
5911N/A
5911N/A <sequence>
5911N/A <message>'Check if folder exists already.'</message>
5911N/A
5911N/A <call function="'GetEntry'">
5911N/A {
5911N/A 'location' : location,
5911N/A 'entry' : folderToCreate,
5911N/A 'attribute' : 'TYPE'
5911N/A }
5911N/A </call>
5911N/A
5911N/A <if expr="RC == 48">
5911N/A <sequence>
5911N/A
5911N/A <message>
5911N/A 'Folder %s does not exists, create folder' % folderToCreate
5911N/A </message>
5911N/A
5911N/A <call function="'createFolder'">
5911N/A { 'location' : location,
5911N/A 'foldername' : folderToCreate
5911N/A }
5911N/A </call>
5911N/A </sequence>
5911N/A </if>
5911N/A </sequence>
5911N/A </iterate>
5911N/A
5911N/A </sequence>
5911N/A
5911N/A </function>
5911N/A
2788N/A <function name="queryLogs">
2788N/A
2788N/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
2788N/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
2788N/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">
2788N/A <function-arg-description>
3816N/A Type of variable
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>
3816N/A Name of variable
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>'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">
2788N/A
2788N/A <function-prolog>
2788N/A Resolve 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 Type of string to be resolved
2788N/A </function-arg-description>
2788N/A <function-arg-property name="type" value="variable"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="name" type="required">
2788N/A <function-arg-description>
2788N/A Name of string to be resolved
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
3600N/A <message>'Resolve %s Variable %s' % (type, name)</message>
2788N/A
2788N/A <stafcmd name="'STAF Command: Resolve Var.'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'var'</service>
3600N/A <request>'RESOLVE %s {%s}' % (type, name)</request>
2788N/A </stafcmd>
2788N/A
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A <function name="GetEntry">
2788N/A
2788N/A <function-prolog>
2788N/A Retrieves an attribute of a file system entry
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="entry" type="required">
2788N/A <function-arg-description>
2788N/A Name of entry to retrieve attributes
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="attribute" type="required">
2788N/A <function-arg-description>
2788N/A Type of attributes to be retrieved
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>'Retrieve attribute %s for %s.' % (attribute,entry)</message>
2788N/A
2788N/A <stafcmd name="'STAF Command: Get Entries Attributes'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>'GET ENTRY %s %s' % (entry,attribute)</request>
2788N/A </stafcmd>
4616N/A <script>
4616N/A cmdRC=RC
4616N/A cmdResult=STAFResult
4616N/A </script>
4616N/A <return>[cmdRC,cmdResult]</return>
2788N/A </sequence>
2788N/A
2788N/A </function>
2788N/A
2788N/A
2788N/A<!-- List a folder -->
2788N/A <function name="listFolder">
2788N/A <function-prolog>
2788N/A This function lists a folder
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="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>
2788N/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>
2788N/A </if>
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 </sequence>
2788N/A
2788N/A </function>
2788N/A
3600N/A<!-- List a folder by extension -->
3600N/A <function name="listFolderByExtension" scope="local">
3600N/A <function-prolog>
3600N/A This function lists a folder by extension
3600N/A </function-prolog>
3600N/A
3600N/A <function-map-args>
3600N/A <function-arg-def name="location" type="optional" default="STAXServiceMachine">
3600N/A <function-arg-description>
3600N/A Location of target host
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="hostname"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="foldername" type="required">
3600N/A <function-arg-description>
3600N/A Name of folder to be list
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="filepath"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="extension" type="required">
3600N/A <function-arg-description>
3600N/A he 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
3600N/A <sequence>
3600N/A <stafcmd name="'STAF Command: list folder by extension'">
3600N/A <location>'%s' % location</location>
3600N/A <service>'fs'</service>
4714N/A <request>' LIST DIRECTORY %s EXT %s RECURSE' % (foldername,extension)</request>
3600N/A </stafcmd>
3600N/A
3600N/A <script>
3600N/A cmdRC=RC
3600N/A cmdResult=STAFResult
3600N/A </script>
3600N/A
3600N/A <if expr="cmdRC != 0">
3600N/A <sequence>
3600N/A <script>
3600N/A cmdResult = 'Folder does not exist.'
3600N/A </script>
3600N/A </sequence>
3600N/A </if>
3600N/A
3600N/A <call function="'checkRC'">
3600N/A {
3600N/A 'returncode' : cmdRC ,
3600N/A 'result' : cmdResult
3600N/A }
3600N/A </call>
3600N/A
3600N/A <return>cmdResult</return>
3600N/A </sequence>
3600N/A </function>
3600N/A
2788N/A <function name="getFile">
2788N/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"/>
2788N/A </function-arg-def>
2788N/A </function-map-args>
2788N/A <sequence>
2788N/A <stafcmd name="'STAF Command: Get File'">
2788N/A <location>'%s' % location</location>
2788N/A <service>'fs'</service>
2788N/A <request>
2788N/A 'GET FILE %s %s FORMAT %s' % (filename,type,format)
2788N/A </request>
2788N/A </stafcmd>
2788N/A <script>
2788N/A cmdRC=RC
2788N/A cmdResult=STAFResult
2788N/A </script>
2788N/A <return>[cmdRC,cmdResult]</return>
2788N/A </sequence>
2788N/A </function>
3600N/A
3600N/A <!-- Send event -->
3605N/A <function name="SendEvent" scope="local">
3600N/A <function-prolog>
3600N/A Send event.
3600N/A </function-prolog>
3600N/A <function-map-args>
3600N/A <function-arg-def name="location"
3600N/A type="optional"
3600N/A default="STAXServiceMachine">
3600N/A <function-arg-description>
3600N/A Location of target host
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="hostname"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="name" type="required">
3600N/A <function-arg-description>
3600N/A Name of event to send
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="string"/>
3600N/A </function-arg-def>
3600N/A </function-map-args>
3600N/A
3600N/A <sequence>
3600N/A <message>'Send Event %s on %s' % (name, location)</message>
3600N/A
3600N/A <stafcmd name="'STAF Command: Send Event.'">
3600N/A <location>'%s' % location</location>
3600N/A <service>'sem'</service>
3600N/A <request>'PULSE EVENT %s' % name</request>
3600N/A </stafcmd>
3600N/A </sequence>
3600N/A </function>
3600N/A
3600N/A <!-- Wait event -->
3605N/A <function name="WaitEvent" scope="local">
3600N/A <function-prolog>
3600N/A Wait event.
3600N/A </function-prolog>
3600N/A <function-map-args>
3600N/A <function-arg-def name="location"
3600N/A type="optional"
3600N/A default="STAXServiceMachine">
3600N/A <function-arg-description>
3600N/A Location of target host
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="hostname"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="name" type="required">
3600N/A <function-arg-description>
3600N/A Name of event to wait
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="string"/>
3600N/A </function-arg-def>
3600N/A </function-map-args>
3600N/A
3600N/A <sequence>
3600N/A <message>'Wait Event %s on %s' % (name, location)</message>
3600N/A
3600N/A <stafcmd name="'STAF Command: Wait Event.'">
3600N/A <location>'%s' % location</location>
3600N/A <service>'sem'</service>
3600N/A <request>'WAIT EVENT %s' % name</request>
3600N/A </stafcmd>
3600N/A </sequence>
3600N/A </function>
3600N/A
3600N/A <!-- Delete event -->
3605N/A <function name="DeleteEvent" scope="local">
3600N/A <function-prolog>
3600N/A Delete event.
3600N/A </function-prolog>
3600N/A <function-map-args>
3600N/A <function-arg-def name="location"
3600N/A type="optional"
3600N/A default="STAXServiceMachine">
3600N/A <function-arg-description>
3600N/A Location of target host
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="hostname"/>
3600N/A </function-arg-def>
3600N/A <function-arg-def name="name" type="required">
3600N/A <function-arg-description>
3600N/A Name of event to delete
3600N/A </function-arg-description>
3600N/A <function-arg-property name="type" value="string"/>
3600N/A </function-arg-def>
3600N/A </function-map-args>
3600N/A
3600N/A <sequence>
3600N/A <message>'Delete Event %s on %s' % (name, location)</message>
3600N/A <stafcmd name="'STAF Command: Delete Event.'">
3600N/A <location>'%s' % location</location>
3600N/A <service>'sem'</service>
3600N/A <request>'DELETE EVENT %s' % name</request>
3600N/A </stafcmd>
3600N/A </sequence>
3600N/A </function>
4714N/A
4714N/A <!-- Add STAF Java Service -->
4714N/A <function name="addSTAFJavaService" scope="local">
4714N/A <function-prolog>
4714N/A Add STAF Java Service.
4714N/A </function-prolog>
4714N/A <function-map-args>
4714N/A <function-arg-def name="location"
4714N/A type="optional"
4714N/A default="STAXServiceMachine">
4714N/A <function-arg-description>
4714N/A Location of target host
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="hostname"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="serviceName" type="required">
4714N/A <function-arg-description>
4714N/A Name of the service to add
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="string"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="serviceJar" type="required">
4714N/A <function-arg-description>
4714N/A Jar of the service to add
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="string"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="JVM" type="optional" default="True">
4714N/A <function-arg-description>
4714N/A JVM path
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="enum"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="J2" type="optional">
4714N/A <function-arg-description>
4714N/A JVM options
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="string"/>
4714N/A </function-arg-def>
4714N/A </function-map-args>
4714N/A
4714N/A <sequence>
4714N/A
4714N/A <message>
4714N/A 'Check if STAF Java Service %s is already started on %s' \
4714N/A % (serviceName, location)
4714N/A </message>
4714N/A <stafcmd name="'STAF Command: Check STAF Java Service.'">
4714N/A <location>'%s' % location</location>
4714N/A <service>'service'</service>
4714N/A <request>'query service %s' % serviceName</request>
4714N/A </stafcmd>
4714N/A <if expr="RC == 48">
4714N/A <sequence>
4714N/A <script>
4714N/A cmdOptions = 'ADD SERVICE %s LIBRARY JSTAF' % serviceName
4714N/A cmdOptions += ' EXECUTE %s' % serviceJar
4714N/A
4714N/A if JVM:
4714N/A cmdOptions += ' OPTION JVMNAME=%sJVM-%s' % (serviceName,location)
4714N/A
4714N/A if location == STAXServiceMachine:
4714N/A cmdOptions += ' OPTION JVM=%s/bin/java' % LOCAL_JAVA_HOME
4714N/A else:
4714N/A cmdOptions += ' OPTION JVM=%s/bin/java' % JAVA_HOME
4714N/A
4714N/A if J2:
4714N/A cmdOptions += ' OPTION J2="%s"' % J2
4714N/A </script>
4714N/A
4714N/A <message>
4714N/A 'Add STAF Java Service %s on %s' % (serviceName, location)
4714N/A </message>
4714N/A <message>'service %s' % cmdOptions</message>
4714N/A <stafcmd name="'STAF Command: Add STAF Java Service.'">
4714N/A <location>'%s' % location</location>
4714N/A <service>'service'</service>
4714N/A <request>'%s' % cmdOptions</request>
4714N/A </stafcmd>
4714N/A </sequence>
4714N/A <else>
4714N/A <message>
4714N/A 'STAF Java Service %s is already started on %s' \
4714N/A % (serviceName, location)
4714N/A </message>
4714N/A </else>
4714N/A </if>
4714N/A </sequence>
4714N/A </function>
4714N/A
4714N/A <!-- Remove STAF Java Service -->
4714N/A <function name="removeSTAFJavaService" scope="local">
4714N/A <function-prolog>
4714N/A Remove STAF Java Service.
4714N/A </function-prolog>
4714N/A <function-map-args>
4714N/A <function-arg-def name="location"
4714N/A type="optional"
4714N/A default="STAXServiceMachine">
4714N/A <function-arg-description>
4714N/A Location of target host
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="hostname"/>
4714N/A </function-arg-def>
4714N/A <function-arg-def name="serviceName" type="required">
4714N/A <function-arg-description>
4714N/A Name of the service to add
4714N/A </function-arg-description>
4714N/A <function-arg-property name="type" value="string"/>
4714N/A </function-arg-def>
4714N/A </function-map-args>
4714N/A
4714N/A <sequence>
4714N/A <script>
4714N/A cmdOptions = 'REMOVE SERVICE %s ' % serviceName
4714N/A </script>
4714N/A
4714N/A <message>
4714N/A 'Remove STAF Java Service %s on %s' % (serviceName, location)
4714N/A </message>
4714N/A <stafcmd name="'STAF Command: Remove STAF Java Service.'">
4714N/A <location>'%s' % location</location>
4714N/A <service>'service'</service>
4714N/A <request>'%s' % cmdOptions</request>
4714N/A </stafcmd>
4714N/A </sequence>
4714N/A </function>
2788N/A</stax>