Coverage details for umich.cac.pbs.QueueRecord

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  *
11  * Process the QUEUE record, "Q" record in PBS
12  *
13  * <pre>
14  * 12/17/2002 10:20:06;Q;15046.head;queue=cac
15  * </pre>
16  *
17  * @author rmach@umich.edu
18  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/QueueRecord.java,v 1.2 2003/10/21 19:07:59 rodmach Exp $
19  */
20  
216public class QueueRecord implements PbsRecordParser {
22  
23  
24     /** Logger instance */
259    private Logger logger = Logger.getLogger(QueueRecord.class.getName());
26  
27     /**
28      * Return the XML representation of an W record, inside &ltwait_record&gt
29      * tags.
30      * <p>
31      *
32      * @param rawfields
33      * Array from PBS containing the wait record (S record)
34      * @return The startrecord converted to XML
35      */
36     public String processRecord(String[] rawfields) {
37  
38         //Split space seperated string into an array.
396        String[] fields = rawfields[RecordPosition.MESSAGE_AREA].split(" ");
40  
41         //PBS encodes in FIELD=VALUE pairs
426        int FIELD_NAME = 0;
436        int FIELD_VALUE = 1;
44  
456        String fieldName = "";
466        String fieldValue = "";
47  
486        Field queueField =
49             new Field(FieldName.QUEUE_FIELD, "queue_field", FieldType.GENERIC);
50  
516        Field jobIdField =
52             FieldFactory.getInstance().getField(
53                 FieldName.JOBID,
54                 rawfields[RecordPosition.JOB_ID]);
556        queueField.addChild(jobIdField);
56  
576        Field dateField =
58             FieldFactory.getInstance().getField(
59                 FieldName.DATE,
60                 rawfields[RecordPosition.DATE_TIME]);
616        queueField.addChild(dateField);
62  
63         //Go through all the fields, modifying them to be appropriate XML
64         // representation
6512        for (int i = 0; i < fields.length; i++) {
666            String[] hashPair = fields[i].split("=");
67  
686            fieldName = hashPair[FIELD_NAME];
696            fieldValue = hashPair[FIELD_VALUE];
70  
716            Field theField =
72                 FieldFactory.getInstance().getField(fieldName, fieldValue);
73  
746            if (theField.getFieldType() == FieldType.GENERIC) {
756                queueField.addChild(theField);
76             }
77  
78         }
79  
806        return queueField.toXML();
81  
82     }
83  
84 }

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.