| java.lang.Object org.apache.derby.impl.drda.DDMReader
DDMReader | class DDMReader (Code) | | The DDMReader is used to read DRDA protocol. DRDA Protocol is divided into
three layers corresponding to the DDM three-tier architecture. For each layer,
their is a DSS (Data Stream Structure) defined.
Layer A Communications management services
Layer B Agent services
Layer C Data management services
At layer A are request, reply and data correlation, structure chaining,
continuation or termination of chains when errors are detected, interleaving
and multi-leaving request, reply, and data DSSs for multitasking environments.
For TCP/IP, the format of the DDM envelope is
2 bytes Length of the data
1 byte 'D0' - indicates DDM data
1 byte DDM format byte(DSSFMT) - type of DSS(RQSDSS,RPYDSS), whether it is
chained, information about the next chained DSS
2 bytes request correlation identifier
The correlation identifier ties together a request, the request data and the
reply. In a chained DSS, each request has a correlation identifier which
is higher than the previous request (all correlation identifiers must
be greater than 0).
At layer B are object mapping, object validation and command routing.
Layer B objects with data 5 bytes less than 32K bytes consist of
2 bytes Length
2 bytes Type of the object (code point)
Object data
Object data is either SCALAR or COLLECTION data. Scalar data consists of
a string of bytes formatted as the class description of the object required.
Collections consist of a set of objects in which the entries in the collection
are nested within the length/ code point of the collection.
Layer B objects with data >=32763 bytes long format is
2 bytes Length - length of class, length, and extended total length fields
(high order bit set, indicating >=32763)
2 bytes Type of the object (code point)
n bytes Extended total length - length of the object
(n = Length - 4)
Object data
At layer C are services each class of DDM object provides.
|-------------------------------------------|
Layer C | Specific | Specific | Specific |
| Commands | Replies | Scalars and |
| and their | and their | Collections |
|-------------------------------------------|----------------|
Layer B | Commands | Reply | Scalars and | Communications |
| | Messages | Collections | |
|-----------|---------------|---------------|----------------|
Layer A | RQSDSS | RPYDSS | OBJDSS | CMNDSS |
| | | | Mapped Data |
|-----------|---------------|---------------|----------------|
| DDM Data Stream Structures |
|------------------------------------------------------------|
DSS's may be chained so that more than one can be transmitted at a time
to improve performance.
For more details, see DRDA Volume 3 (Distributed Data Management(DDM)
Architecture (DDS definition)
|
DDMReader | DDMReader(CcsidManager ccsidManager, InputStream inputStream)(Code) | | This constructor is used for testing the protocol
It is used by TestProto to read the protocol returned by the
server
|
convertBytes | protected String convertBytes(byte[] buf)(Code) | | Convert EBCDIC byte array to unicode string
Parameters: buf - - byte array string |
getCodePoint | protected int getCodePoint() throws DRDAProtocolException(Code) | | Get the next CodePoint from a collection
NO_CODEPOINT if collection stack is empty or remaining length is0; otherwise, read length and code point exception: DRDProtocolException - |
getCodePoint | protected int getCodePoint(int codePointCheck) throws DRDAProtocolException(Code) | | Get the next CodePoint from a collection and check that it matches the specified
CodePoint
Parameters: codePointCheck - - codePoint to check against codePoint exception: DRDProtocolException - |
getCurrChainState | protected byte getCurrChainState()(Code) | | Return chaining bit for current DSS.
|
getDdmLength | protected long getDdmLength()(Code) | | Length of current DDM object
length of DDM object |
getEXTDTAReaderInputStream | EXTDTAReaderInputStream getEXTDTAReaderInputStream(boolean checkNullability) throws DRDAProtocolException(Code) | | Creates an InputStream which can stream EXTDTA objects.
The InputStream uses this DDMReader to read data from network. The
DDMReader should not be used before all data in the stream has been read.
Parameters: checkNullability - used to check if the stream is null. If it is null, this method returns null EXTDTAReaderInputStream object which can be passed to preparedstatement as a binary stream. exception: DRDAProtocolException - standard DRDA protocol exception |
initialize | protected void initialize(InputStream inputStream)(Code) | | This initializer is used for testing the protocol
It is used by TestProto for the reader it uses
|
initialize | protected void initialize(DRDAConnThread agent, DssTrace dssTrace)(Code) | | Initialize values for this session, the reader is reused so we need to
set null and 0 values
|
isChainedWithDiffID | protected boolean isChainedWithDiffID()(Code) | | Next DSS has different correlator than current DSS
true if next DSS has a different correlator than current DSS |
isChainedWithSameID | protected boolean isChainedWithSameID()(Code) | | Next DSS has same correlator as current DSS
true if next DSS has the same correlator as current DSS |
markCollection | protected void markCollection()(Code) | | Push DDM Length on to collection stack
|
moreData | protected boolean moreData()(Code) | | Is there more data in the buffer
true if there is more data in the buffer |
moreDdmData | protected boolean moreDdmData()(Code) | | Is there more in this DDM object
true if DDM length is > 0 |
moreDssData | protected boolean moreDssData()(Code) | | Is there more in this DDS object
true if DDS length is > 0 |
readBigDecimal | protected BigDecimal readBigDecimal(int precision, int scale) throws DRDAProtocolException(Code) | | Read a BigDecimal value
Parameters: precision - of the BigDecimal Parameters: scale - of the BigDecimal value exception: DRDProtocolException - |
readBoolean | protected boolean readBoolean() throws DRDAProtocolException(Code) | | Read boolean value
value exception: DRDProtocolException - |
readBytes | protected byte[] readBytes(int length) throws DRDAProtocolException(Code) | | Read byte string value
Parameters: length - - length of string to read byte array exception: DRDProtocolException - |
readBytes | protected byte[] readBytes() throws DRDAProtocolException(Code) | | Read byte string value
byte array exception: DRDProtocolException - |
readCodePoint | protected int readCodePoint()(Code) | | Read the CodePoint
- returns codepoint |
readDouble | protected double readDouble(int byteOrder) throws DRDAProtocolException(Code) | | Read platform double value
value exception: DRDProtocolException - |
readDssHeader | protected int readDssHeader() throws DRDAProtocolException(Code) | | Read DSS header
DSS Header format is
2 bytes - length
1 byte - 'D0' - indicates DDM data
1 byte - DSS format
|---|---------|----------|
| 0 | flags | type |
|---|---------|----------|
| 0 | 1 2 3 | 4 5 6 7 |
|---|---------|----------|
bit 0 - '0'
bit 1 - '0' - unchained, '1' - chained
bit 2 - '0' - do not continue on error, '1' - continue on error
bit 3 - '0' - next DSS has different correlator, '1' - next DSS has
same correlator
type - 1 - Request DSS
- 2 - Reply DSS
- 3 - Object DSS
- 4 - Communications DSS
- 5 - Request DSS where no reply is expected
2 bytes - request correlation id
exception: DRDProtocolException - |
readEncryptedString | protected String readEncryptedString(DecryptionManager decryptM, int securityMechanism, byte[] initVector, byte[] sourcePublicKey) throws DRDAProtocolException, java.sql.SQLException(Code) | | Read encrypted string
Parameters: decryptM - decryption manager Parameters: securityMechanism - security mechanism Parameters: initVector - initialization vector for cipher Parameters: sourcePublicKey - public key (as in Deffie-Hellman algorithm)from source (encryptor) decrypted string exception: DRDProtocolException - , SQLException(wrapping any exception in decryption) |
readFloat | protected float readFloat(int byteOrder) throws DRDAProtocolException(Code) | | Read platform float value
value exception: DRDProtocolException - |
readInt | protected int readInt(int byteOrder) throws DRDAProtocolException(Code) | | Read platform int value
value exception: DRDProtocolException - |
readLDStringData | protected String readLDStringData(String encoding) throws DRDAProtocolException(Code) | | Read length delimited string value in DDM data with default encoding
value exception: DRDProtocolException - |
readLOBContinuationStream | ByteArrayInputStream readLOBContinuationStream(long desiredLength) throws IOException(Code) | | This method is used by EXTDTAReaderInputStream to read the next chunk
of data.
Parameters: desiredLength - the desired length of chunk exception: IOException - IOException |
readLengthAndCodePoint | protected int readLengthAndCodePoint() throws DRDAProtocolException(Code) | | Read the DDM Length and CodePoint
- returns codepoint exception: DRDProtocolException - |
readLong | protected long readLong(int byteOrder) throws DRDAProtocolException(Code) | | Read platform long value
value exception: DRDProtocolException - |
readNetworkInt | protected int readNetworkInt() throws DRDAProtocolException(Code) | | Read network int value
value exception: DRDProtocolException - |
readNetworkLong | protected long readNetworkLong() throws DRDAProtocolException(Code) | | Read network long value
value exception: DRDProtocolException - |
readNetworkShort | protected int readNetworkShort() throws DRDAProtocolException(Code) | | Read network short value
value exception: DRDProtocolException - |
readNetworkSixByteLong | protected long readNetworkSixByteLong() throws DRDAProtocolException(Code) | | Read network six byte value and put it in a long v
value exception: DRDProtocolException - |
readReplyDss | protected void readReplyDss() throws DRDAProtocolException(Code) | | Read Reply DSS
This is used in testing the protocol. We shouldn't see a reply
DSS when we are servicing DRDA commands
exception: DRDProtocolException - |
readShort | protected short readShort(int byteOrder) throws DRDAProtocolException(Code) | | Read platform short value
value exception: DRDProtocolException - |
readSignedNetworkShort | protected int readSignedNetworkShort() throws DRDAProtocolException(Code) | | Read signed network short value
value exception: DRDProtocolException - |
readString | protected String readString(int length) throws DRDAProtocolException(Code) | | Read string value
Strings in DRDA protocol are encoded in EBCDIC by default so we
need to convert to UCS2
Parameters: length - - length of string to read value exception: DRDProtocolException - |
readString | protected void readString(DRDAString dst, int size, boolean unpad) throws DRDAProtocolException(Code) | | Read string value into a DRDAString object.
Parameters: dst - destination for the read string Parameters: size - size (in bytes) of string to read Parameters: unpad - if true, remove padding (trailing spaces) exception: DRDAProtocolException - |
readString | protected String readString(int length, String encoding) throws DRDAProtocolException(Code) | | Read encoded string value
Parameters: length - - length of string to read value exception: DRDProtocolException - |
readStringData | protected String readStringData() throws DRDAProtocolException(Code) | | Read string value in DDM data with default encoding
value exception: DRDProtocolException - |
readStringData | protected String readStringData(int length) throws DRDAProtocolException(Code) | | Read specified length of string value in DDM data with default encoding
Parameters: length - - length of string to read value exception: DRDProtocolException - |
readUnsignedByte | protected int readUnsignedByte() throws DRDAProtocolException(Code) | | Read byte value and mask out high order bytes before returning
value |
skipBytes | protected void skipBytes(int length) throws DRDAProtocolException(Code) | | Skip byte string value
Parameters: length - - length of string to skip exception: DRDProtocolException - |
terminateChainOnErr | protected boolean terminateChainOnErr()(Code) | | |
|
|