Java Doc for DDMReader.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » drda » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.drda 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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)




Constructor Summary
 DDMReader(DRDAConnThread agent, DssTrace dssTrace)
    
 DDMReader(CcsidManager ccsidManager, InputStream inputStream)
    

Method Summary
protected  voidclearBuffer()
    
protected  StringconvertBytes(byte[] buf)
    
protected  intgetCodePoint()
    
protected  intgetCodePoint(int codePointCheck)
    
protected  bytegetCurrChainState()
     Return chaining bit for current DSS.
protected  longgetDdmLength()
    
 EXTDTAReaderInputStreamgetEXTDTAReaderInputStream(boolean checkNullability)
     Creates an InputStream which can stream EXTDTA objects. The InputStream uses this DDMReader to read data from network.
 byte[]getExtData(boolean checkNullability)
    
 byte[]getExtData(long desiredLength, boolean checkNullability)
    
protected  voidinitialize(InputStream inputStream)
    
protected  voidinitialize(DRDAConnThread agent, DssTrace dssTrace)
    
protected  booleanisChainedWithDiffID()
    
protected  booleanisChainedWithSameID()
    
protected  booleanisCmd()
    
protected  voidmarkCollection()
    
protected  booleanmoreData()
    
protected  booleanmoreDdmData()
    
protected  booleanmoreDssData()
    
protected  BigDecimalreadBigDecimal(int precision, int scale)
    
protected  booleanreadBoolean()
    
protected  bytereadByte()
    
protected  byte[]readBytes(int length)
    
protected  byte[]readBytes()
    
protected  StringreadCmdString(int length)
    
protected  StringreadCmdString()
    
protected  intreadCodePoint()
    
protected  doublereadDouble(int byteOrder)
    
protected  intreadDssHeader()
    
protected  StringreadEncryptedString(DecryptionManager decryptM, int securityMechanism, byte[] initVector, byte[] sourcePublicKey)
    
protected  floatreadFloat(int byteOrder)
    
protected  intreadInt(int byteOrder)
    
protected  StringreadLDStringData(String encoding)
    
 ByteArrayInputStreamreadLOBContinuationStream(long desiredLength)
     This method is used by EXTDTAReaderInputStream to read the next chunk of data.
 ByteArrayInputStreamreadLOBInitStream(long desiredLength)
     This method is used by EXTDTAReaderInputStream to read the first chunk of data.
protected  intreadLengthAndCodePoint()
    
protected  longreadLong(int byteOrder)
    
protected  intreadNetworkInt()
    
protected  longreadNetworkLong()
    
protected  intreadNetworkShort()
    
protected  longreadNetworkSixByteLong()
    
protected  voidreadReplyDss()
     Read Reply DSS This is used in testing the protocol.
protected  shortreadShort(int byteOrder)
    
protected  intreadSignedNetworkShort()
    
protected  StringreadString(int length)
    
protected  voidreadString(DRDAString dst, int size, boolean unpad)
     Read string value into a DRDAString object.
protected  StringreadString(int length, String encoding)
    
protected  StringreadString()
    
protected  StringreadStringData()
    
protected  StringreadStringData(int length)
    
protected  intreadUnsignedByte()
    
protected  voidskipBytes(int length)
    
protected  voidskipBytes()
    
protected  voidskipDss()
    
protected  booleanterminateChainOnErr()
    
protected  StringtoDebugString(String indent)
    


Constructor Detail
DDMReader
DDMReader(DRDAConnThread agent, DssTrace dssTrace)(Code)



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




Method Detail
clearBuffer
protected void clearBuffer() throws DRDAProtocolException(Code)



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



getExtData
byte[] getExtData(boolean checkNullability) throws DRDAProtocolException(Code)



getExtData
byte[] getExtData(long desiredLength, boolean checkNullability) throws DRDAProtocolException(Code)



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



isCmd
protected boolean isCmd() throws DRDAProtocolException, java.io.UnsupportedEncodingException(Code)
Check for the command protocol true if this is a command; false otherwise
exception:
  DRDProtocolException -



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 -



readByte
protected byte readByte() throws DRDAProtocolException(Code)
Read byte 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 -



readCmdString
protected String readCmdString(int length) throws DRDAProtocolException, java.io.UnsupportedEncodingException(Code)
Read string value
Parameters:
  length - - length of string to read value
exception:
  DRDProtocolException -



readCmdString
protected String readCmdString() throws DRDAProtocolException, java.io.UnsupportedEncodingException(Code)
Read string value value
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



readLOBInitStream
ByteArrayInputStream readLOBInitStream(long desiredLength) throws DRDAProtocolException(Code)
This method is used by EXTDTAReaderInputStream to read the first chunk of data.
Parameters:
  desiredLength - the desired length of chunk
exception:
  DRDAProtocolException - standard DRDA protocol exception



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 -



readString
protected String readString() throws DRDAProtocolException(Code)
Read string 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 -



skipBytes
protected void skipBytes() throws DRDAProtocolException(Code)
Skip byte string value
exception:
  DRDAProtocolException -



skipDss
protected void skipDss() throws DRDAProtocolException(Code)
Skip remaining DSS
exception:
  DRDAProtocolException -



terminateChainOnErr
protected boolean terminateChainOnErr()(Code)



toDebugString
protected String toDebugString(String indent)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.