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 | * 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 | ||
25 | 3 | public class URecord implements PbsRecordParser { |
26 | ||
27 | /** | |
28 | * Logger instance | |
29 | */ | |
30 | 6 | private Logger logger = Logger.getLogger(URecord.class.getName()); |
31 | ||
32 | /** | |
33 | * Return the XML representation of an U record, inside <u_record> | |
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 | |
45 | 0 | Field uField = |
46 | new Field(FieldName.U_FIELD, "u_record", FieldType.GENERIC); | |
47 | ||
48 | //The JOB ID | |
49 | 0 | Field jobIdField = |
50 | FieldFactory.getInstance().getField( | |
51 | FieldName.JOBID, | |
52 | rawfields[RecordPosition.JOB_ID]); | |
53 | 0 | uField.addChild(jobIdField); |
54 | ||
55 | //The DATE | |
56 | 0 | Field dateField = |
57 | FieldFactory.getInstance().getField( | |
58 | FieldName.DATE, | |
59 | rawfields[RecordPosition.DATE_TIME]); | |
60 | 0 | uField.addChild(dateField); |
61 | ||
62 | //Split message area that is space seperated string into an array. | |
63 | 0 | String[] fields = rawfields[RecordPosition.MESSAGE_AREA].split(" "); |
64 | ||
65 | //PBS encodes in FIELD=VALUE pairs | |
66 | 0 | int FIELD_NAME = 0; |
67 | 0 | int FIELD_VALUE = 1; |
68 | ||
69 | 0 | String fieldName = ""; |
70 | 0 | String fieldValue = ""; |
71 | ||
72 | //Go through all the fields, querying FieldFactory for fields | |
73 | ||
74 | 0 | for (int i = 0; i < fields.length; i++) { |
75 | ||
76 | 0 | String[] hashPair = fields[i].split("="); |
77 | ||
78 | 0 | fieldName = hashPair[FIELD_NAME]; |
79 | 0 | fieldValue = hashPair[FIELD_VALUE]; |
80 | ||
81 | 0 | Field theField = |
82 | FieldFactory.getInstance().getField(fieldName, fieldValue); | |
83 | ||
84 | //This type only has GENERIC fields, only requestor field | |
85 | ||
86 | 0 | if (theField.getFieldType() == FieldType.GENERIC) { |
87 | 0 | uField.addChild(theField); |
88 | } | |
89 | } | |
90 | ||
91 | 0 | return uField.toXML(); |
92 | ||
93 | } | |
94 | ||
95 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |