Coverage details for umich.cac.pbs.RecordFactory

LineHitsSource
1 package umich.cac.pbs;
2  
3 import java.util.logging.Level;
4 import java.util.logging.Logger;
5  
6 /**
7  * RecordFactory to return the right kind of PbsRecord processor based on the
8  * RecordType.
9  * <P>
10  *
11  * Processors are available for the following RecordTypes Types available for
12  * OpenPBS
13  * <UL>
14  * <LI>EXECUTION_RECORD</LI>
15  * <LI>START_RECORD</LI>
16  * <LI>QUEUE_RECORD</LI>
17  * <LI>DELETE_RECORD</LI>
18  * <LI>RERUN_RECORD</LI>
19  * <LI>CHECKPOINT_RESTART_RECORD</LI>
20  * <LI>ABORT_RECORD</LI>
21  * </UL>
22  *
23  * This is the list of PbsPro extended records supported
24  * <UL>
25  * <LI>K_RECORD</LI>
26  * <LI>U_RECORD</LI>
27  * <LI>Y_RECORD</LI>
28  * </UL>
29  * This is ignored for PbsPro
30  * <UL>
31  * <LI>L_RECORD</LI>
32  * </UL>
33  *
34  * Parsers for C records (checkpoint), are not yet created as I didn't have
35  * examples to work off of for these records. If you have an example entry
36  * please email me the examples and I can add those record types to the next
37  * release.
38  *
39  * @author rmach@umich.edu
40  * @version $Header: /cvsroot/pbsaccounting/pbsaccounting/src/umich/cac/pbs/RecordFactory.java,v 1.4 2003/10/21 19:07:59 rodmach Exp $
41  */
42  
43 public class RecordFactory {
44  
45     /**
46      * Logger
47      */
48  
496    private Logger logger = Logger.getLogger(RecordFactory.class.getName());
50  
51     /**
52      * Parser to parse execution records
53      */
54  
553    private ExecutionRecord executionRecordParser = new ExecutionRecord();
56  
57     /**
58      * Parser to parse start records
59      */
60  
613    private StartRecord startRecordParser = new StartRecord();
62  
63     /**
64      * Parser to parse Queue records
65      */
66  
673    private QueueRecord queueRecordParser = new QueueRecord();
68  
69     /**
70      * Parser to parse Delete records
71      */
72  
733    private DeleteRecord deleteRecordParser = new DeleteRecord();
74  
75     /**
76      * Parser to parse Rerun records
77      */
78  
793    private RerunRecord rerunRecordParser = new RerunRecord();
80  
81     /**
82      * Parser to parse Abort records
83      */
84  
853    private AbortRecord abortRecordParser = new AbortRecord();
86  
87     /**
88      * Parser to parse K records (PbsPro specific)
89      */
903    private KRecord kRecordParser = new KRecord();
91  
92     /**
93      * Parser to parse U records (PbsPro specific)
94      */
953    private URecord uRecordParser = new URecord();
96  
97     /**
98      * Parser specific to Y records (PbsPro specific)
99      *
100      */
1013    private YRecord yRecordParser = new YRecord();
102  
103     /**
104      * Parser specific to L (license) records (PbsPro specific, Ignored)
105      *
106      */
1073    private LRecord lRecordParser = new LRecord();
108  
109     /**
110      * Parser specific to B records (PbsPro specific)
111      *
112      */
1133    private BRecord bRecordParser = new BRecord();
114  
115     /**
116      * Parser to parse Checkpoint Restart records
117      */
118  
1193    private CheckpointRestartRecord checkpointRestartParser =
120         new CheckpointRestartRecord();
121  
122     //The singleton instance
1233    private static RecordFactory thisInstance = null;
124  
125     /**
126      * Get singleton instance
127      *
128      * @return The instance value
129      */
130  
131     public static synchronized RecordFactory getInstance() {
132  
13321        if (thisInstance == null) {
1343            thisInstance = new RecordFactory();
135         }
136  
13721        return thisInstance;
138     }
139  
140     /**
141      * private constructor
142      */
143  
1443    private RecordFactory() {
145         //Empty constructor, no overriding
1463    }
147  
148     /**
149      * Return a PbsRecord processor based on the record type, or NULL if the
150      * recordType is not known. The check is not case sensitive because it
151      * appears PbsPro returns lower and upper case for record types.
152      *
153      * @param recordType
154      * type of record
155      * @return PbsRecord that can process the given recordType
156      */
157  
158     public PbsRecordParser getRecordParser(RecordType recordType) {
159  
16021        if (recordType.equals(RecordType.EXECUTION_RECORD)) {
161  
1623            return executionRecordParser;
16318        } else if (recordType.equals(RecordType.START_RECORD)) {
164  
1653            return startRecordParser;
16615        } else if (recordType.equals(RecordType.QUEUE_RECORD)) {
167  
1686            return queueRecordParser;
1699        } else if (recordType.equals(RecordType.DELETE_RECORD)) {
170  
1713            return deleteRecordParser;
1726        } else if (recordType.equals(RecordType.RERUN_RECORD)) {
173  
1740            return rerunRecordParser;
1756        } else if (recordType.equals(RecordType.ABORT_RECORD)) {
176  
1770            return abortRecordParser;
1786        } else if (recordType.equals(RecordType.CHECKPOINT_RESTART_RECORD)) {
179  
1800            return checkpointRestartParser;
1816        } else if (recordType.equals(RecordType.K_RECORD)) {
1820            return kRecordParser;
1836        } else if (recordType.equals(RecordType.U_RECORD)) {
1840            return uRecordParser;
1856        } else if (recordType.equals(RecordType.Y_RECORD)) {
1860            return yRecordParser;
1876        } else if (recordType.equals(RecordType.B_RECORD)) {
1880            return bRecordParser;
1896        } else if (recordType.equals(RecordType.L_RECORD)) {
1900            return lRecordParser;
191         } else {
1926            if (logger.isLoggable(Level.WARNING)) {
1936                logger.log(Level.WARNING, "Unknown Record Type" + recordType);
194             }
195  
1966            return null;
197         }
198  
199     }
200  
201 }

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.