2788N/A<?
xml version="1.0" encoding="UTF-8" standalone="no"?>
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 ! You can obtain a copy of the license at 2788N/A ! See the License for the specific language governing permissions 2788N/A ! and limitations under the License. 2788N/A ! When distributing Covered Code, include this CDDL HEADER in each 2788N/A ! file and include the License file at 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] 4458N/A ! Copyright 2007-2009 Sun Microsystems, Inc. 2788N/A This function copies a source file to destination file to host
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="remotehost" type="optional" default="STAXServiceMachine">
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 name="srcfile" type="required">
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 name="destfile" type="required">
2788N/A The name of the destination fule
2788N/A </
function-
arg-
description>
3194N/A <
function-
arg-
property name="type" value="filename"/>
2788N/A <
stafcmd name="'STAF Command: Copy File'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'COPY FILE %s TOFILE %s TOMACHINE %s' % (srcfile,destfile,remotehost) </
request>
2788N/A <
call function="'checkRC'">
2788N/A <
return>[cmdRC,cmdResult]</
return>
2788N/A <
function name="CopyFolderByExtension">
2788N/A Copies files by extension from a source to destination folder on host
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="remotehost" type="optional" default="location">
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"/>
2788N/A <
function-
arg-
def name="srcfolder" type="required">
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 name="destfolder" type="required">
2788N/A The name of the destination file
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="foldername"/>
3951N/A <
function-
arg-
def name="extension" type="optional" default="'txt'">
3951N/A The name of the file extension (default txt)
3951N/A </
function-
arg-
description>
3951N/A <
function-
arg-
property name="type" value="file extension"/>
2788N/A <
stafcmd name="'STAF Command: Copy all %s Files.' % (extension)">
3194N/A <
location>'%s' % location</
location>
2788N/A <
request>'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s EXT %s RECURSE' % (srcfolder,destfolder,remotehost,extension) </
request>
2788N/A <
call function="'checkRC'">
3600N/A <
function name="copyFolder">
3600N/A Copies folder from a source to destination folder on host
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="remotehost" type="optional" default="location">
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 name="srcfolder" type="required">
3951N/A The name of the source folder
3951N/A </
function-
arg-
description>
3951N/A <
function-
arg-
property name="type" value="foldername"/>
2788N/A <
function-
arg-
def name="destfolder" type="required">
2788N/A The name of the destination file
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="foldername"/>
2788N/A <
stafcmd name="'STAF Command: Copy %s folder to %s.' % (srcfolder,destfolder)">
2788N/A <
location>'%s' % location</
location>
3951N/A <
request>'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE' % (srcfolder,destfolder,remotehost) </
request>
3951N/A <
call function="'checkRC'">
3951N/A <
function name="zipUpFile">
3951N/A This function zips up a folder
3951N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
3951N/A </
function-
arg-
description>
3951N/A <
function-
arg-
property name="type" value="hostname"/>
3951N/A <
function-
arg-
def name="zipfile" type="required">
3951N/A Name of the file to place zip file contents
3951N/A </
function-
arg-
description>
3951N/A <
function-
arg-
property name="type" value="filename"/>
2788N/A <
function-
arg-
def name="folder" type="required">
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 name="relativeto" type="required">
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 <
stafcmd name="'STAF Command: Zip Up Folder'">
2788N/A <
location>'%s' % location</
location>
2788N/A 'ADD ZIPFILE %s DIRECTORY %s RECURSE RELATIVETO %s' % (zipfile,folder,relativeto)
4238N/A <
call function="'checkRC'">
4238N/A <
function name="unZipFile">
4238N/A This function unzips a compressed zip archive
4238N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
4238N/A </
function-
arg-
description>
4238N/A <
function-
arg-
property name="type" value="hostname"/>
4238N/A <
function-
arg-
def name="zipfile" type="required">
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 name="file" type="optional" default="None">
4238N/A </
function-
arg-
description>
4238N/A <
function-
arg-
property name="type" value="filepath"/>
4238N/A <
function-
arg-
def name="directory" type="optional" default="None">
4238N/A </
function-
arg-
description>
4238N/A <
function-
arg-
property name="type" value="filepath"/>
4238N/A <
function-
arg-
def name="unzipdir" type="required">
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 dir='DIRECTORY %s' % directory
4238N/A <
stafcmd name="'STAF Command: Unzip File'">
4238N/A <
location>'%s' % location</
location>
4238N/A 'UNZIP ZIPFILE %s TODIRECTORY %s %s %s RESTOREPERMISSION REPLACE' % (zipfile,unzipdir,file,dir)
4238N/A <
call function="'checkRC'">
4238N/A <
function name="deleteFile">
4238N/A This function deletes a file
4238N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
4616N/A </
function-
arg-
description>
4616N/A <
function-
arg-
property name="type" value="hostname"/>
4616N/A <
function-
arg-
def name="filename" type="required">
4238N/A </
function-
arg-
description>
4616N/A <
function-
arg-
property name="type" value="filename"/>
4616N/A <
stafcmd name="'STAF Command: Delete Existing File'">
4616N/A <
location>'%s' % location</
location>
4616N/A 'GET ENTRY %s TYPE' % (filename)
4238N/A 'Success: File does not exist, dont delete it.'
2788N/A 'Success: File does exists, will delete it'
2788N/A <
stafcmd name="'STAF Command: Delete Existing File'">
2788N/A <
location>'%s' % location</
location>
2788N/A 'DELETE ENTRY %s CONFIRM' % filename
3951N/A <
call function="'checkRC'">
2788N/A <
function name="deleteFolder">
2788N/A This function recursively deletes a folder
3973N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
3973N/A </
function-
arg-
description>
3973N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="foldername" type="required">
2788N/A Name of folder to be deleted
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="filepath"/>
3951N/A <
stafcmd name="'STAF Command: Get Folder Attributes'">
3951N/A <
location>'%s' % location</
location>
3951N/A <
request>'GET ENTRY %s TYPE' % foldername</
request>
2788N/A 'Folder does not exist, do not delete it.'
2788N/A 'Folder exists, will delete it'
2788N/A <
stafcmd name="'STAF Command: Recursively Delete Folder'">
2788N/A <
location>'%s' % location</
location>
2788N/A 'DELETE ENTRY %s RECURSE IGNOREERRORS CONFIRM' % (foldername)
2788N/A <
call function="'checkRC'">
2788N/A <
function name="createFolder">
2788N/A This function creates a folder
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
3951N/A <
function-
arg-
def name="foldername" type="required">
3951N/A Name of folder to be created
3951N/A </
function-
arg-
description>
3951N/A <
function-
arg-
property name="type" value="filepath"/>
2788N/A <
stafcmd name="'STAF Command: Create Folder'">
2788N/A <
location>'%s' % location</
location>
2788N/A 'CREATE DIRECTORY %s FULLPATH' % foldername
2788N/A <
call function="'checkRC'">
2788N/A <
function name="queryLogs">
2788N/A Queries the staf logs from startfrom point
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="logname" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="filepath"/>
2788N/A <
function-
arg-
def name="startfrom" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="timestamp"/>
2788N/A <
function-
arg-
def name="endat" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="timestamp"/>
2788N/A <
block name="'Query Logs'">
2788N/A <
stafcmd name="'STAF Command: Log Query for Test Case Log.'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'QUERY ALL MACHINE %s LOGNAME %s FROM %s TO %s' % (location,logname,startfrom,endat)</
request>
2788N/A Sets a variable in the staf var service
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="type" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="variable"/>
2788N/A <
function-
arg-
def name="variable" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="variable"/>
2788N/A <
message>'Set %s Variable %s' % (type,variable)</
message>
2788N/A <
stafcmd name="'STAF Command: Set Var.'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'SET %s VAR %s' % (type,variable)</
request>
2788N/A Gets a variable in the staf var service
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="type" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="variable"/>
2788N/A <
function-
arg-
def name="variable" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="variable"/>
2788N/A <
message>'Get %s Variable %s' % (type,variable)</
message>
2788N/A <
stafcmd name="'STAF Command: Get Var.'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'GET %s VAR %s' % (type,variable)</
request>
2788N/A <
function name="ResolveVar">
2788N/A Resolve a variable in the staf var service
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="type" type="required">
2788N/A Type of string to be resolved
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="variable"/>
2788N/A <
function-
arg-
def name="name" type="required">
2788N/A Name of string to be resolved
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
4495N/A <
message>'Resolve %s Variable %s' % (type, name)</
message>
2788N/A <
stafcmd name="'STAF Command: Resolve Var.'">
4495N/A <
location>'%s' % location</
location>
4495N/A <
request>'RESOLVE %s {%s}' % (type, name)</
request>
2788N/A Retrieves an attribute of a file system entry
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
4495N/A <
function-
arg-
def name="entry" type="required">
4495N/A Name of entry to retrieve attributes
4495N/A </
function-
arg-
description>
4495N/A <
function-
arg-
property name="type" value="variable"/>
2788N/A <
function-
arg-
def name="attribute" type="required">
2788N/A Type of attributes to be retrieved
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
message>'Retrieve attribute %s for %s.' % (attribute,entry)</
message>
2788N/A <
stafcmd name="'STAF Command: Get Entries Attributes'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'GET ENTRY %s %s' % (entry,attribute)</
request>
2788N/A <
return>[cmdRC,cmdResult]</
return>
4680N/A <
function name="listFolder">
2788N/A This function lists a folder
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="foldername" type="required">
2788N/A </
function-
arg-
description>
3194N/A <
function-
arg-
property name="type" value="filepath"/>
2788N/A <
function-
arg-
def name="filename" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="filepath"/>
2788N/A <
stafcmd name="'STAF Command: list Folder Attributes'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>' LIST DIRECTORY %s NAME %s LONG ' % (foldername,filename)</
request>
2788N/A <
call function="'checkRC'">
2788N/A<!-- List a folder by extension --> 2788N/A <
function name="listFolderByExtension" scope="local">
2788N/A This function lists a folder by extension
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="foldername" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="filepath"/>
2788N/A <
function-
arg-
def name="extension" type="required">
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 <
stafcmd name="'STAF Command: list folder by extension'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>' LIST DIRECTORY %s EXT %s RECURSE' % (foldername,extension)</
request>
2788N/A cmdResult = 'Folder does not exist.'
2788N/A <
call function="'checkRC'">
2788N/A This function get the contents of a file
2788N/A <
function-
arg-
def name="location" type="optional" default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="filename" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="filename"/>
2788N/A <
function-
arg-
def name="type" type="optional" default="'text'">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
function-
arg-
def name="format" type="optional" default="'native'">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
stafcmd name="'STAF Command: Get File'">
2788N/A <
location>'%s' % location</
location>
2788N/A 'GET FILE %s %s FORMAT %s' % (filename,type,format)
3816N/A <
return>[cmdRC,cmdResult]</
return>
2788N/A <
function name="SendEvent" scope="local">
2788N/A <
function-
arg-
def name="location" 2788N/A default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="name" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
message>'Send Event %s on %s' % (name, location)</
message>
2788N/A <
stafcmd name="'STAF Command: Send Event.'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'PULSE EVENT %s' % name</
request>
2788N/A <
function name="WaitEvent" scope="local">
2788N/A <
function-
arg-
def name="location" 2788N/A default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="name" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
message>'Wait Event %s on %s' % (name, location)</
message>
2788N/A <
stafcmd name="'STAF Command: Wait Event.'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'WAIT EVENT %s' % name</
request>
2788N/A <
function name="DeleteEvent" scope="local">
2788N/A <
function-
arg-
def name="location" 2788N/A default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="name" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
message>'Delete Event %s on %s' % (name, location)</
message>
2788N/A <
stafcmd name="'STAF Command: Delete Event.'">
2788N/A <
location>'%s' % location</
location>
2788N/A <
request>'DELETE EVENT %s' % name</
request>
2788N/A <!-- Add STAF Java Service --> 2788N/A <
function name="addSTAFJavaService" scope="local">
2788N/A <
function-
arg-
def name="location" 2788N/A default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="serviceName" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
function-
arg-
def name="serviceJar" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A <
function-
arg-
def name="JVM" type="optional" default="True">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="enum"/>
2788N/A <
function-
arg-
def name="J2" type="optional">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A 'Check if STAF Java Service %s is already started on %s' \
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 cmdOptions = 'ADD SERVICE %s LIBRARY JSTAF' % serviceName
2788N/A cmdOptions += ' EXECUTE %s' % serviceJar
2788N/A cmdOptions += ' OPTION JVMNAME=%sJVM-%s' % (serviceName,location)
2788N/A if location == STAXServiceMachine:
2788N/A cmdOptions += ' OPTION J2="%s"' % J2
2788N/A 'Add STAF Java Service %s on %s' % (serviceName, location)
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 'STAF Java Service %s is already started on %s' \
2788N/A <!-- Remove STAF Java Service --> 2788N/A <
function name="removeSTAFJavaService" scope="local">
2788N/A <
function-
arg-
def name="location" 2788N/A default="STAXServiceMachine">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="hostname"/>
2788N/A <
function-
arg-
def name="serviceName" type="required">
2788N/A </
function-
arg-
description>
2788N/A <
function-
arg-
property name="type" value="string"/>
2788N/A cmdOptions = 'REMOVE SERVICE %s ' % serviceName
2788N/A 'Remove STAF Java Service %s on %s' % (serviceName, location)
2788N/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>