grs.pds
Class BasePdsRecord

java.lang.Object
  |
  +--grs.pds.BasePdsRecord
All Implemented Interfaces:
PdsRecord
Direct Known Subclasses:
SpatialSeriesRecord, TimeSeriesRecord

public abstract class BasePdsRecord
extends Object
implements PdsRecord

Abstract base class for all PDS record classes. Defines method stubs that subclasses must override.

Author:
guym

Field Summary
 SimpleDateFormat PdsTimeFormat
          Java Date format corresponding to PDS's
 
Fields inherited from interface grs.pds.PdsRecord
GAMMA_CHANNELS, int10, int12, int2, int3, logger, MESSAGE_LENGTH, NS_MAX_EVENTS, PEF_COMMANDS, prec10, prec12, prec13, prec14, prec15, prec16, prec17, prec5, prec6, prec7, PROFILE_LENGTH, PROFILE_SIZE, PULSER_CHANNELS, QUERY_DATE_FMT, SC_ID
 
Constructor Summary
BasePdsRecord()
          Instantiate a new BasePdsRecord
BasePdsRecord(ResultSet rs)
          ResultSet constructor.
 
Method Summary
static void endianSwapShort(byte[] data)
          Perform an in-place endian swap on a byte array.
abstract  int prepareInsert(PreparedStatement pstmt)
          Bind the values to a prepared statement, for inserting into schema.
abstract  String[] toStringArray()
          Subclasses will override this to display records as text, suitable for display.
abstract  void writeTo(DataOutputStream out)
          Subclasses will override this method to write data to a binary or text stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PdsTimeFormat

public SimpleDateFormat PdsTimeFormat
Java Date format corresponding to PDS's

Constructor Detail

BasePdsRecord

public BasePdsRecord()
Instantiate a new BasePdsRecord


BasePdsRecord

public BasePdsRecord(ResultSet rs)
ResultSet constructor. Given a ResultSet, creates a new instance of a record.

Parameters:
rs - ResultSet that contains 1 or more rows of data specific to the Edr subclass. Only one row will be read per class instance.
Method Detail

prepareInsert

public abstract int prepareInsert(PreparedStatement pstmt)
                           throws IOException,
                                  SQLException
Bind the values to a prepared statement, for inserting into schema. Should return the number of values bound.

Parameters:
pstmt -
Returns:
number of values bound
Throws:
IOException
SQLException

toStringArray

public abstract String[] toStringArray()
Subclasses will override this to display records as text, suitable for display.

Returns:
Array of column values.

writeTo

public abstract void writeTo(DataOutputStream out)
                      throws IOException
Subclasses will override this method to write data to a binary or text stream.

Parameters:
out - OutputStream to write data to.
Throws:
IOException - Error writing to stream.

endianSwapShort

public static final void endianSwapShort(byte[] data)
Perform an in-place endian swap on a byte array. There should be an even number of bytes in the array. THIS ROUTINE IS ONLY FOR SHORTs!

Parameters:
data - Any even-length array of bytes.


2001 Mars Odyssey Gamma Ray Spectrometer Team