Coverage details for umich.cac.pbs.URecord

LineHitsSource
1 package umich.cac.pbs;
2  
3 import java.util.logging.Logger;
4  
5 import umich.cac.data.Field;
6 import umich.cac.data.FieldName;
7 import umich.cac.data.FieldType;
8  
9 /**
10  * Process the U record, "U" record in PBSPro
11  * <p>
12  *
13  * This option is specific to PBSPro, on linux
14  *
15  * An example from PBS accounting file is below
16  *
17  * <pre>
18  * 04/01/2003 13:03:24;U;R1687.hypnos;requestor=msbritt@hypnos Interactive=100
19  * </pre>
20  *
21  * @author rmach@umich.edu
22  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/URecord.java,v 1.2 2003/10/21 19:07:59 rodmach Exp $
23  */
24  
253public class URecord implements PbsRecordParser {
26  
27     /**
28      * Logger instance
29      */
306    private Logger logger = Logger.getLogger(URecord.class.getName());
31  
32     /**
33      * Return the XML representation of an U record, inside &ltu_record&gt
34      * tags.
35      * <p>
36      *
37      * @param rawfields
38      * Array from PBS containing the abort record (U record)
39      * @return The U record converted to XML
40      */
41  
42     public String processRecord(String[] rawfields) {
43  
44         //This field
450        Field uField =
46             new Field(FieldName.U_FIELD, "u_record", FieldType.GENERIC);
47  
48         //The JOB ID
490        Field jobIdField =
50             FieldFactory.getInstance().getField(
51                 FieldName.JOBID,
52                 rawfields[RecordPosition.JOB_ID]);
530        uField.addChild(jobIdField);
54  
55         //The DATE
560        Field dateField =
57             FieldFactory.getInstance().getField(
58                 FieldName.DATE,
59                 rawfields[RecordPosition.DATE_TIME]);
600        uField.addChild(dateField);
61  
62         //Split message area that is space seperated string into an array.
630        String[] fields = rawfields[RecordPosition.MESSAGE_AREA].split(" ");
64  
65         //PBS encodes in FIELD=VALUE pairs
660        int FIELD_NAME = 0;
670        int FIELD_VALUE = 1;
68  
690        String fieldName = "";
700        String fieldValue = "";
71  
72         //Go through all the fields, querying FieldFactory for fields
73  
740        for (int i = 0; i < fields.length; i++) {
75  
760            String[] hashPair = fields[i].split("=");
77  
780            fieldName = hashPair[FIELD_NAME];
790            fieldValue = hashPair[FIELD_VALUE];
80  
810            Field theField =
82                 FieldFactory.getInstance().getField(fieldName, fieldValue);
83  
84             //This type only has GENERIC fields, only requestor field
85  
860            if (theField.getFieldType() == FieldType.GENERIC) {
870                uField.addChild(theField);
88             }
89         }
90  
910        return uField.toXML();
92  
93     }
94  
95 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.