Pears Record Handling Classes

Specific classes called record handlers are used by the Bartlett utility to read and convert input data that is in various formats.

Record Handlers

The following table lists the record handlers currently available in the Pears software.

Record Handler Description
RecordHandler

RecordHandler is an abstract class that contains the main method for data conversion. It is extended by other record handling classes to enable them to read records from an input data file and convert them to BER records. RecordHandler does this in two steps: First, it reads the record into a byte array; second, it converts the record to BER format. RecordHandler also provides null methods for producing records, which can be overridden if actual record production is desired; that is, if you want to export records back into their original format.

Note: Since it contains the main method for converting data, you can use RecordHandler to test other conversion programs.

HandleUSMARC

HandleUSMARC extends RecordHandler and functions by reading a stream of MARC records that are optionally separated by non-digits (garbage). This loader can also be used to convert USMARC records obtained through other means such as Z39.50.

HandleUSMARC also overrides the fromDataDir() method of the RecordHandler class to produce USMARC records. Fields with tags >999 are ignored. Fields with subfields and no indicator field, get an indicator of two blanks. Fields with indicators of less or more than two characters cause a MalformedRecordException to be thrown. If ignoreRecoverableErrors is set, then illegal subfield tags are converted to subfield tags of '9'. The ignoreRecoverableErrors flag is also passed along to the LocalByteConverter.

Note: The HandleUSMARC class does not support USMARC Tape format. Use the HandleUSMARCTape class to do this.

HandleChinaMarc HandleChinaMarc extends the record handling classes, HandleUSMARC and RecordHandler. The extension of HandleUSMARC involves adding the GB2312 ByteToChar and CharToByte converters to the class to accommodate a different character set.
HandleUnimarc HandleUnimarc extends HandleUSMARC by allowing you to specify different record, field, and subfield delimiters for the input data.
HandleSGML

HandleSGML extends the RecordHandler class that is used to read records and convert them to BER records. HandleSGML reads a stream of SGML records, optionally separated by text. Records are delimited by their begin and end tags. Any text found outside of those tags is ignored.

Warning! Do not use the No_PCData_Tags flag in the tags file! It throws away any attributes that a tag might have and child promotion will not work correctly. Every pair of tags within an SGML record must have an explicit end tag. Tags must also have both data and subtags.

HandleBER

HandleBER extends the RecordHandler class. It reads BER records in an input data file and commits them to a Pears database.

Note: No byte to char conversion is done in this record loader. HandleBER assumes that the records have already been converted to BER format.

HandleDB

HandleDB extends the RecordHandler class. It reads BER records in a Newton header file and commits them to a Pears database.

Note: No byte to char conversion is done in this record loader. HandleBER assumes that the records have already been converted to BER format.

HandlePDB

HandlePDB extends the RecordHandler class. It reads records from one Pears database (.pdb) file and commits them to another Pears database (.pdb) file.

Notes:

No byte to char conversion is done in this record loader. HandleBER assumes that the records have already been converted to BER format.

You should use this record handler to do a dump and reload of a Pears database.


See Also

Pears Contact

Content Last Modified: March 28, 2001

We are a worldwide library cooperative, owned, governed and sustained by members since 1967. Our public purpose is a statement of commitment to each other—that we will work together to improve access to the information held in libraries around the globe, and find ways to reduce costs for libraries through collaboration.