| Line | Hits | Source |
|---|---|---|
| 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 | ||
| 21 | 6 | public class QueueRecord implements PbsRecordParser { |
| 22 | ||
| 23 | ||
| 24 | /** Logger instance */ | |
| 25 | 9 | private Logger logger = Logger.getLogger(QueueRecord.class.getName()); |
| 26 | ||
| 27 | /** | |
| 28 | * Return the XML representation of an W record, inside <wait_record> | |
| 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. | |
| 39 | 6 | String[] fields = rawfields[RecordPosition.MESSAGE_AREA].split(" "); |
| 40 | ||
| 41 | //PBS encodes in FIELD=VALUE pairs | |
| 42 | 6 | int FIELD_NAME = 0; |
| 43 | 6 | int FIELD_VALUE = 1; |
| 44 | ||
| 45 | 6 | String fieldName = ""; |
| 46 | 6 | String fieldValue = ""; |
| 47 | ||
| 48 | 6 | Field queueField = |
| 49 | new Field(FieldName.QUEUE_FIELD, "queue_field", FieldType.GENERIC); | |
| 50 | ||
| 51 | 6 | Field jobIdField = |
| 52 | FieldFactory.getInstance().getField( | |
| 53 | FieldName.JOBID, | |
| 54 | rawfields[RecordPosition.JOB_ID]); | |
| 55 | 6 | queueField.addChild(jobIdField); |
| 56 | ||
| 57 | 6 | Field dateField = |
| 58 | FieldFactory.getInstance().getField( | |
| 59 | FieldName.DATE, | |
| 60 | rawfields[RecordPosition.DATE_TIME]); | |
| 61 | 6 | queueField.addChild(dateField); |
| 62 | ||
| 63 | //Go through all the fields, modifying them to be appropriate XML | |
| 64 | // representation | |
| 65 | 12 | for (int i = 0; i < fields.length; i++) { |
| 66 | 6 | String[] hashPair = fields[i].split("="); |
| 67 | ||
| 68 | 6 | fieldName = hashPair[FIELD_NAME]; |
| 69 | 6 | fieldValue = hashPair[FIELD_VALUE]; |
| 70 | ||
| 71 | 6 | Field theField = |
| 72 | FieldFactory.getInstance().getField(fieldName, fieldValue); | |
| 73 | ||
| 74 | 6 | if (theField.getFieldType() == FieldType.GENERIC) { |
| 75 | 6 | queueField.addChild(theField); |
| 76 | } | |
| 77 | ||
| 78 | } | |
| 79 | ||
| 80 | 6 | return queueField.toXML(); |
| 81 | ||
| 82 | } | |
| 83 | ||
| 84 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |