Retrieving Project statistics

Retrieving Project statistics

Postby Marko » 2014-02-25 11:04:44

Performance statistics of previously completed Projects can be retrieved from the Techila Server in a programmatic manner by using the Techila Java API. The basic idea is to link the 'printStatistics' method call with your Project ID number.The below code snippet shows the most relevant lines of a program that can be used to display the Project statistic of a previously completed Project.

Code: Select all
 TechilaManager tm = TechilaManagerFactory.getTechilaManager();  // Create the tm object
 tm.initFile();                                                  // Initialize connection
 ProjectManager pm = tm.projectManager();                        // Create the pm oblject
 int handle = tm.open();                                 // Create a handle
 pm.setProjectId(handle, pid);                                   // Link to a previously created Project ID number
 pm.printStatistics(handle);                                     // Print the performance statistics
 tm.unload(true, true);                                          // Cleanup temporary files


The attached PrintStatistics.java file contains the entire source code for an example application that can be used to retrieve performance statistics and either display the results in the console or store the output in a file. Please note that in order to compile and run the code, you will need 'techila.jar' (and current working directory) in your CLASSPATH environment variable.

Usage:

Code: Select all
Usage: java PrintStatistics <pid> [<file>]


Screenshot 'usage.jpg' shows a screenshot about how to compile/run the code.
Attachments
usage.jpg
Compiling and running the example
usage.jpg (127.27 KiB) Viewed 6343 times
PrintStatistics.java
Example source code that shows how to download project performance statistics
(1.75 KiB) Downloaded 578 times
Marko
Techila Staff
Techila Staff
 
Posts: 8
Joined: 2013-09-11 11:19:10

Return to Java

cron