The Version Reader System is designed to read various versions of formatted input data without prior knowledge of the specific version of the Data. In the case of output from the Data Collector, that is, testdaq .zip files, the system uses version numbers encoded in the Run Header to determine the format of the data sequences, including the Run Header itself. Because of this structure, the possible format changes to the Run Header are somewhat restricted. We require that every format of the Run Header contain a version tag for the run header itself as its first element. By setting this requirement, it becomes possible to use SAX to parse the beginning of the Run Header and extract the needed information about its version, allowing us to call a versioned-reader for the Run Header. This is the only part of the system that requires a new reader for every new version of the data it reads, because it relies on JAXB to read and validate XML data.
The remainder of the system relies on XML sequence descriptors to extract fields from the data stream in the correct sequence. This means that for every new format version, another XML sequence descriptor must be written and the correct version tag appended to its filename. It is also necessary to create new data element classes whenever the new version is not simply a re-arrangement of the existing data elements. This will be the case if entirely new data elements are added to the data structure or if the meaning of and existing data element is changed. However, this requires significantly less programmer time than writing a new reader class for every new data format. It is also much simpler, and can be done by the developer of the new version rather than by the original writer of the reader software. Thus, we have the additional advantage that the developers of the reading software need not provide constant software upgrades and may spend their time on other, more useful tasks. For a full description of how to write a version upgrade, please visit the Version Upgrade page.
An XML sequence descriptor is a list of data elements, whose names are the
fully-qualified names of data element classes. For example, there is a class
called FlashData in the versionSystem subpackage of testdaqio, where all the
data element classes are located. The XML sequence descriptor file that has
this data element would contain the following listing:
"
The XML sequence descriptor also has a descriptive name. For example, the name of the XML sequence descriptor for a DomHitRecord, version 1 release 0, is "DomHitRecordV1R0.xml".
The most important part of the entire system is a collection of data element classes, located in icecube.testdaq.testdaqio.versionSystem. These classes have constructors that accept a reference to their parent reader, and then extract the data they need from the ByteBuffer in their parent reader. Some of these classes then call private read() methods that interpret the data the constructor extracts from the ByteBuffer before reporting the results to the parent reader, while other classes simply return their results directly. For an example of a data element class, click here . If a new piece of information is added to the data stream, or the format of an existing piece of information is added, a new data element with an entirely different name must be created, so that the data element to read old data still exists and functions properly. Once they are created, data element classes may never be deleted or altered in any way.
The reader classes in the system parse their associated XML sequence descriptor and store the data in a Vector that tells the reader in which order to call data element constructors. The reader also has a set of fields necessary to construct a data storage object associated with its data type. Each of these fields is currently filled by a data element during reading. However, when a new field is added to the Java data-storage object, older versions of the data sequence will be unable to fill that field. Consequently, a default value for that field must be provided, and must be encoded in the reader class so that it may continue to treat all input in the same way.
When reading occurs, the reader class "walks" over the Vector of data elements and calls the constructor of each one in turn. The reader then constructs the data storage object for its data type and returns it in the manner specified by the infrastructure of testdaqio. For information about specifying return types, please see the package documentation for testdaqio.
All classes described here are found within the package
icecube.testdaq.testdaqio unless a subpackage is indicated. Though these
classes are public because they must be accessable from withing subpackages of
testdaqio, software designers are strongly discouraged from using these classes
directly, and should instead rely on the infrastructure within testdaqio to
produce data.
There are currently five format bytes that need to be decoded by the Version
Reader System. They are the Flash ADC format byte, the ATWD 0 and 1 format
byte, the ATWD 2 and 3 format byte, the miscellaneous byte, and the trigger
byte. Each of these bytes is decoded in a data element class with a
descriptive name. An excellent example of one of these classes can be found by
viewing AtwdFormat0_1.java. Since each of these classes use a similar method to decode their respective
bytes, I will explain how the process works here. Using this operator and a knowledge of the binary number system, the
decoding process individually tests each bit for a value of 1 or 0, and using
this information, the reader class can determine the information encoded in the
given bit sequence.
Note on Format Encoding and Decoding
Each byte contains 8 bits, and the bit encoding of each byte is defined by
LBNL. It is possible to compare individual bits by using the bitwise-and
operator found in Java. Its character is "&".