Hi Tennis,
There are no plans in the near future to provide this capability, so yes
it would be great if you want to provide a patch to provide this
capability. See http://staf.sourceforge.net/contributions.php for more
information on how to contribute patches to the STAF project (this web
page is accessible via the STAF home page at http://staf.sourceforge.net
under the "Development" category on the navigation panel on the left.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Tennis Smith <tennis_sm...@yahoo.com>
To: Sharon Lucas/Austin/IBM@IBMUS,
Cc: staf-users@lists.sourceforge.net
Date: 01/06/2013 02:41 PM
Subject: Re: [staf-users] Getting Key/Values From Results Data
Sent by: tennis.n.sm...@gmail.com
Hi Sharon,
Thanks for the quick reply. Got a couple follow-up questions re STAF Ant.
- Are there any plans to update the STAF Ant service to optionally return
marshalled data?
- If not, can I submit changes for review and inclusion into the service?
Thanks,
-T
On Sat, Jan 5, 2013 at 4:56 PM, Sharon Lucas <luc...@us.ibm.com> wrote:
See my answer inline (in blue) below.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Tennis Smith <tennis_sm...@yahoo.com>
To: Sharon Lucas/Austin/IBM@IBMUS,
Cc: staf-users@lists.sourceforge.net
Date: 01/05/2013 01:00 PM
Subject: Re: [staf-users] Getting Key/Values From Results Data
Sent by: tennis.n.sm...@gmail.com
Hi Sharon,
Follow-up question. See inline below.
-T
PS -- Ever thought of writing one of those O'Reilly "Definitive Guide"
books for STAF/STAX? :) AFAIK, there really isn't anything out there
right now.
$0.02.
On Wed, Jan 2, 2013 at 10:06 AM, Sharon Lucas <luc...@us.ibm.com> wrote:
Hi Tennis,
Yes, you can do this if you submit this STAF service request via a program
using a STAF API for Java, C/C++, Python, Perl, or Tcl instead of using
the STAF command line executable which just returns a string
Is this correct for the Staf Ant Task as well? It seems to return
unmarshalled data only. Or, can the individual fields be accessed there
as they are via Python,Perl, Java, etc. ?
The STAF Ant Task only provides the result as a string.
containing the result because then you can access the individual fields
(such as jobID and status) in the unmarshalled result object directly.
For examples, see the following documents accessible via the STAF
Documentation web page at http://staf.sourceforge.net/docs.php for the
programming language of your choice:
- STAFJava User's Guide - This document describes STAF's V3 support for
the Java language. It includes information on the core STAF Java APIs.
- STAF Python User's Guide - This document describes STAF's V3 support for
the Python language. It includes information on the core STAF Python
APIs.
- STAF Perl User's Guide - This document describes STAF's V3 support for
the Perl language. It includes information on the core STAF Perl APIs.
- STAF Tcl User's Guide - This document describes STAF's V3 support for
the Tcl language. It includes information on the core STAF Tcl APIs.
- STAF User's Guide sections "6.2 C" and "6.3 C++" - These sections
document STAF's support for C/C++.
The STAX Users's Guide describes the result format returned by a STAX
"EXECUTE FILE <FileName> WAIT RETURNRESULT" request in section "EXECUTE",
sub-section "Results" at
http://staf.sourceforge.net/current/STAX/staxug.html#Header_Execute. See
where it talks about when this request is successful and the WAIT option
and RETURNRESULT option are specified (but not the DETAILS option) and
says the result will contain a marshalled
<Map:STAF/Service/STAX/JobResult> representing the job result and it
defines this map and its fields (including "jobID" and "status").
For example, here's a Java program that submits an "EXECUTE FILE
<FileName> WAIT RETURNRESULT" request to the STAX service on the local
machine and accesses the fields named "jobID" and "status" in the result:
import com.ibm.staf.*;
import java.util.Map;
public class RunSTAXJob
{
public static void main (String[] args)
{
new RunSTAXJob();
}
public RunSTAXJob()
{
STAFHandle stafHandle = null;
try
{
stafHandle = new STAFHandle("MyTest");
String machine = "local";
String service = "STAX";
String xmlFileName = "C:/stax/test1.xml"; // XXX: Change this
to your STAX xml job name
STAFResult result = null;
// You should use helper method STAFUtil.wrapData() for any
values
// that may contain spaces
String request = "EXECUTE FILE " +
STAFUtil.wrapData(xmlFileName) +
" WAIT RETURNRESULT";
result = stafHandle.submit2(machine, service, request);
if (result.rc != STAFResult.Ok)
{
System.out.println(
"Error submitting request STAF " + machine + " " +
service + " " + request + "\nRC: " + result.rc +
" Result: " + result.result);
System.exit(1);
}
// Pretty print the result (if desired)
System.out.println(result.resultContext);
// The result from the STAX EXECUTE WAIT RETURNRESULT is a
// marshalled map. Access the data from the map (e.g. jobID,
// status, result) in the root object of the result.
Map jobResultMap = (Map)result.resultObj;
String jobID = (String)jobResultMap.get("jobID");
String jobStatus = (String)jobResultMap.get("status");
if (!jobStatus.equals("Normal"))
{
System.out.println(
"STAX Job ID " + jobID + " failed with a " +
jobStatus + " status.");
System.exit(1);
}
String jobResult = (String)jobResultMap.get("result");
System.out.println(
"STAX Job ID " + jobID +
" completed successfully returning: " + jobResult);
stafHandle.unRegister();
}
catch (STAFException e)
{
System.out.println("STAFException creating handle: " +
e.getMessage());
}
}
}
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
From: Tennis Smith <tennis_sm...@yahoo.com>
To: staf-users@lists.sourceforge.net,
Date: 12/26/2012 09:26 PM
Subject: [staf-users] Getting Key/Values From Results Data
Hi,
I'm confused about the best way to access the contents of results when I
run a stax job. For example, when this is the output:
{
Job ID : 3
Start Date-Time: 20101028-14:35:01
Stop Date-Time : 20101028-14:39:19
Status : Normal
Job Log Errors : []
Result : None
Testcase Totals: {
Tests : 1
Passes: 1
Fails : 0
}
}
How can i get the value for "Job ID" without grep or some other utility?
Is there a "native" way to access the jobid key/value pairs?
Hope this makes sense.
--
Tks,
-Tennis
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
--
Tks,
-Tennis
--
Tks,
-Tennis
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users