Java Doc for DDMWriter.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.DDMWriter

DDMWriter
class DDMWriter (Code)
The DDMWriter is used to write DRDA protocol. The DRDA Protocol is described in the DDMReader class. For more details, see DRDA Volume 3 (Distributed Data Management(DDM) Architecture (DDS definition)


Field Summary
final static  BigDecimalZERO
    

Constructor Summary
 DDMWriter(int minSize, CcsidManager ccsidManager, DRDAConnThread agent, DssTrace dssTrace)
    
 DDMWriter(CcsidManager ccsidManager, DRDAConnThread agent, DssTrace dssTrace)
    

Method Summary
protected  voidclearBuffer()
    
protected  voidclearDSSesBackToMark(int mark)
     Does a logical "clear" of everything written to the buffer after the received mark.
protected  voidclearDdm()
    
protected  byte[]copyDSSDataToEnd(int start)
     Copy Data to End Create a buffer and copy from the position given to the end of data Note that the position given is treated as relative to the current DSS, for there may be other DSS blocks (chained, presumably) which are sitting unwritten in the buffer.
protected  voidcreateDssObject()
    
protected  voidcreateDssReply()
    
protected  voidcreateDssRequest()
     Create DSS request object NOTE: This is _ONLY_ used for testing the protocol (via the TestProto.java file in this package)! We should never create a DSS request in normal DRDA processing (we should only create DSS replies and DSS objects).
protected  booleandoesRequestContainData()
    
protected  voidendDdm()
    
protected  voidendDdmAndDss()
    
protected  voidendDss(byte chainByte)
     End DSS header by writing the length in the length location and setting the chain bit.
protected  voidendDss()
     End DSS header by writing the length in the length location and setting the chain bit.
protected  voidfinalizeChain(byte currChainByte, OutputStream socketOutputStream)
     Finalize the current DSS chain and send it if needed. Updates the chaining state of the most recently-written- to-buffer DSS to correspond to the most recently-read- from-client request.
protected  voidflush()
    
protected  voidflush(OutputStream socketOutputStream)
    
protected  intgetDSSLength()
     Get the length of the current DSS block we're working on.
protected  intmarkDSSClearPoint()
     Takes note of the location of the most recently completed DSS in the buffer, and then returns the current offset.
protected  voidpadBytes(byte val, int length)
    
protected  voidreset(DssTrace dssTrace)
    
protected  voidresetChainState()
    
protected  voidsetCMDProtocol()
    
protected  voidstartDdm(int codePoint)
    
protected  voidstartDdm(int length, int codePoint)
    
protected  StringtoDebugString(String indent)
    
protected  voidtruncateDSS(int value)
     Truncate the current DSS.
protected  voidwriteBigDecimal(java.math.BigDecimal v, int precision, int scale)
    
protected  voidwriteBoolean(boolean v)
    
protected  voidwriteByte(int value)
    
protected  voidwriteBytes(byte[] buf, int length)
    
protected  voidwriteBytes(byte[] buf, int start, int length)
    
protected  voidwriteBytes(byte[] buf)
    
 voidwriteCodePoint4Bytes(int codePoint, int value)
    
protected  voidwriteDouble(double v)
    
protected  voidwriteExtendedLength(long size)
    
protected  voidwriteFloat(float v)
    
protected  voidwriteInt(int v)
    
protected  voidwriteLDBytes(byte[] buf)
    
protected  voidwriteLDBytes(byte[] buf, int index)
    
protected  voidwriteLDString(String s)
    
protected  voidwriteLDString(String s, int index)
    
 voidwriteLengthCodePoint(int length, int codePoint)
    
protected  voidwriteLong(long v)
    
protected  voidwriteNetworkInt(int value)
    
protected  voidwriteNetworkShort(int value)
    
 voidwriteScalar1Byte(int codePoint, int value)
    
protected  voidwriteScalar2Bytes(int codePoint, int value)
    
protected  voidwriteScalar2Bytes(int value)
    
protected  voidwriteScalarBytes(int codePoint, byte[] buf, int length)
    
protected  voidwriteScalarBytes(int codePoint, byte[] buf)
    
protected  voidwriteScalarBytes(int codePoint, byte[] buf, int start, int length)
    
protected  voidwriteScalarHeader(int codePoint, int dataLength)
    
protected  voidwriteScalarPaddedBytes(int codePoint, byte[] buf, int paddedLength, byte padByte)
    
protected  voidwriteScalarPaddedBytes(byte[] buf, int paddedLength, byte padByte)
    
 voidwriteScalarPaddedString(int codePoint, String string, int paddedLength)
    
protected  voidwriteScalarPaddedString(String string, int paddedLength)
    
protected  voidwriteScalarPaddedString(DRDAString drdaString, int paddedLength)
     Write padded scalar DRDAString object value.
protected  voidwriteScalarStream(boolean chainedWithSameCorrelator, int codePoint, EXTDTAInputStream in, boolean writeNullByte)
    
 voidwriteScalarString(int codePoint, String string)
    
protected  voidwriteShort(int v)
    
protected  voidwriteShort(boolean b)
    
protected  voidwriteString(String s)
    
protected  voidwriteString(String s, int length)
    
public static  StringzeroPadString(String s, int precision)
    

Field Detail
ZERO
final static BigDecimal ZERO(Code)




Constructor Detail
DDMWriter
DDMWriter(int minSize, CcsidManager ccsidManager, DRDAConnThread agent, DssTrace dssTrace)(Code)



DDMWriter
DDMWriter(CcsidManager ccsidManager, DRDAConnThread agent, DssTrace dssTrace)(Code)




Method Detail
clearBuffer
protected void clearBuffer()(Code)
Clear the entire send buffer



clearDSSesBackToMark
protected void clearDSSesBackToMark(int mark)(Code)
Does a logical "clear" of everything written to the buffer after the received mark. It's assumed that this method will be used in error cases when we've started writing one or more DSSes, but then hit an error and need to back out. After backing out, we'll always need to write _something_ back to the client to indicate an error (typically, we just write an SQLCARD) but what exactly gets written is handled in DRDAConnThread. Here, we just do the necessary prep so that whatever comes next will succeed.



clearDdm
protected void clearDdm()(Code)
Erase all writes for the current ddm and reset the top



copyDSSDataToEnd
protected byte[] copyDSSDataToEnd(int start)(Code)
Copy Data to End Create a buffer and copy from the position given to the end of data Note that the position given is treated as relative to the current DSS, for there may be other DSS blocks (chained, presumably) which are sitting unwritten in the buffer. The caller doesn't know this, though, and works only with the current DSS. getDSSLength, copyDSSDataToEnd, and truncateDSS work together to provide a sub-protocol for DRDAConnThread to use in its implementation of the LMTBLKPRC protocol. They enable the caller to determine when it has written too much data into the current DSS, to reclaim the extra data that won't fit, and to truncate that extra data once it has been reclaimed and stored elsewhere. Note that this support only works for the current DSS. Earlier, chained DSS blocks cannot be accessed using these methods. For additional background information, the interested reader should investigate bugs DERBY-491 and 492 at: http://issues.apache.org/jira/browse/DERBY-491 and http://issues.apache.org/jira/browse/DERBY-492
Parameters:
  start -



createDssObject
protected void createDssObject()(Code)
Create DSS data object



createDssReply
protected void createDssReply()(Code)
Create DSS reply object



createDssRequest
protected void createDssRequest()(Code)
Create DSS request object NOTE: This is _ONLY_ used for testing the protocol (via the TestProto.java file in this package)! We should never create a DSS request in normal DRDA processing (we should only create DSS replies and DSS objects).



doesRequestContainData
protected boolean doesRequestContainData()(Code)



endDdm
protected void endDdm()(Code)
End the current DDM



endDdmAndDss
protected void endDdmAndDss()(Code)
End final DDM and DSS header by writing the length in the length location



endDss
protected void endDss(byte chainByte)(Code)
End DSS header by writing the length in the length location and setting the chain bit. Unlike the other two endDss methods, this one overrides the default chaining byte (which is set in beginDss) with the chaining byte that is passed in. NOTE: This method is only used in association with createDssRequest, and thus is for TESTING purposes only (via TestProto.java). No calls should be made to this method in normal DRDA processing (because for normal processing, chaining must be determined automatically based on DSS requests).



endDss
protected void endDss()(Code)
End DSS header by writing the length in the length location and setting the chain bit.



finalizeChain
protected void finalizeChain(byte currChainByte, OutputStream socketOutputStream) throws DRDAProtocolException(Code)
Finalize the current DSS chain and send it if needed. Updates the chaining state of the most recently-written- to-buffer DSS to correspond to the most recently-read- from-client request. If that chaining state indicates we've reached the end of a chain, then we go ahead and send the buffer across the wire.
Parameters:
  socketOutputStream - Output stream to which we're flushing.



flush
protected void flush() throws java.io.IOException(Code)
Flush buffer to outputstream
exception:
  IOException -



flush
protected void flush(OutputStream socketOutputStream) throws java.io.IOException(Code)
Flush buffer to specified stream
Parameters:
  socketOutputStream -
exception:
  IOException -



getDSSLength
protected int getDSSLength()(Code)
Get the length of the current DSS block we're working on. This is used by the LMTBLKPRC protocol, which does its own conversational blocking protocol above the layer of the DRDA blocking. The LMTBLKPRC implementation (in DRDAConnThread) needs to be able to truncate a DSS block when splitting a QRYDTA response. current DSS block length



markDSSClearPoint
protected int markDSSClearPoint()(Code)
Takes note of the location of the most recently completed DSS in the buffer, and then returns the current offset. This method is used in conjunction with "clearDSSesBackToMark" to allow for DRDAConnThread to "back-out" DSSes in the event of errors.



padBytes
protected void padBytes(byte val, int length)(Code)
Write pad bytes using spaceChar
Parameters:
  val - value to be written
Parameters:
  length - length to be written



reset
protected void reset(DssTrace dssTrace)(Code)
reset values for sending next message



resetChainState
protected void resetChainState()(Code)
Reset any chaining state that needs to be reset at time of the send



setCMDProtocol
protected void setCMDProtocol()(Code)
set protocol to CMD protocol



startDdm
protected void startDdm(int codePoint)(Code)
Mark the location of the length bytes for the collection so they can be updated later



startDdm
protected void startDdm(int length, int codePoint)(Code)
Write length and codepoint
Parameters:
  length - - length of object
Parameters:
  codePoint - - code point to write



toDebugString
protected String toDebugString(String indent)(Code)



truncateDSS
protected void truncateDSS(int value)(Code)
Truncate the current DSS. Before making this call, you should ensure that you have copied the data to be truncated somewhere else, by calling copyDSSDataToEnd
Parameters:
  value - DSS length



writeBigDecimal
protected void writeBigDecimal(java.math.BigDecimal v, int precision, int scale) throws SQLException(Code)
Write big decimal to buffer
Parameters:
  v - value to write
Parameters:
  precision - Precison of decimal or numeric type
Parameters:
  scale - declared scale
exception:
  SQLException - thrown if number of digits > 31



writeBoolean
protected void writeBoolean(boolean v)(Code)
Write platform boolean
Parameters:
  v - value to be written



writeByte
protected void writeByte(int value)(Code)
Write byte
Parameters:
  value - byte to be written



writeBytes
protected void writeBytes(byte[] buf, int length)(Code)
Write byte array
Parameters:
  buf - byte array to be written
Parameters:
  length - - length to write



writeBytes
protected void writeBytes(byte[] buf, int start, int length)(Code)
Write byte array
Parameters:
  buf - byte array to be written
Parameters:
  start - - starting position
Parameters:
  length - - length to write



writeBytes
protected void writeBytes(byte[] buf)(Code)
Write byte array
Parameters:
  buf - byte array to be written



writeCodePoint4Bytes
void writeCodePoint4Bytes(int codePoint, int value)(Code)
Write code point and 4 bytes
Parameters:
  codePoint - - code point to write
Parameters:
  value - - value to write after code point



writeDouble
protected void writeDouble(double v)(Code)
Write platform double
Parameters:
  v - value to be written



writeExtendedLength
protected void writeExtendedLength(long size)(Code)



writeFloat
protected void writeFloat(float v)(Code)
Write platform float
Parameters:
  v - value to be written



writeInt
protected void writeInt(int v)(Code)
Write platform int
Parameters:
  v - value to be written



writeLDBytes
protected void writeLDBytes(byte[] buf)(Code)



writeLDBytes
protected void writeLDBytes(byte[] buf, int index)(Code)



writeLDString
protected void writeLDString(String s) throws DRDAProtocolException(Code)
Write length delimited string
Parameters:
  s - value to be written with integer
exception:
  DRDAProtocolException -



writeLDString
protected void writeLDString(String s, int index) throws DRDAProtocolException(Code)
Write length delimited string
Parameters:
  s - value to be written with integer
Parameters:
  index - column index to put in warning
exception:
  DRDAProtocolException -



writeLengthCodePoint
void writeLengthCodePoint(int length, int codePoint)(Code)



writeLong
protected void writeLong(long v)(Code)
Write platform long
Parameters:
  v - value to be written



writeNetworkInt
protected void writeNetworkInt(int value)(Code)
Write network int
Parameters:
  value - value to be written



writeNetworkShort
protected void writeNetworkShort(int value)(Code)
Write network short
Parameters:
  value - value to be written



writeScalar1Byte
void writeScalar1Byte(int codePoint, int value)(Code)
Write scalar 1 byte object includes length, codepoint and value
Parameters:
  codePoint - - code point to write
Parameters:
  value - - value to write after code point



writeScalar2Bytes
protected void writeScalar2Bytes(int codePoint, int value)(Code)
Write scalar 2 byte object includes length, codepoint and value
Parameters:
  codePoint - - code point to write
Parameters:
  value - - value to write after code point



writeScalar2Bytes
protected void writeScalar2Bytes(int value)(Code)



writeScalarBytes
protected void writeScalarBytes(int codePoint, byte[] buf, int length)(Code)
Write scalar byte array object includes length, codepoint and value
Parameters:
  codePoint - - code point to write
Parameters:
  buf - - value to write after code point
Parameters:
  length - - number of bytes to write



writeScalarBytes
protected void writeScalarBytes(int codePoint, byte[] buf)(Code)
Write scalar byte array object includes length, codepoint and value
Parameters:
  codePoint - - code point to write
Parameters:
  buf - - byte array to be written



writeScalarBytes
protected void writeScalarBytes(int codePoint, byte[] buf, int start, int length)(Code)
Write scalar byte array object includes length, codepoint and value
Parameters:
  codePoint - - code point to write
Parameters:
  buf - - byte array to be written
Parameters:
  start - - starting point
Parameters:
  length - - length to write



writeScalarHeader
protected void writeScalarHeader(int codePoint, int dataLength)(Code)
Write scalar object header includes length and codepoint
Parameters:
  codePoint - - code point to write
Parameters:
  dataLength - - length of object data



writeScalarPaddedBytes
protected void writeScalarPaddedBytes(int codePoint, byte[] buf, int paddedLength, byte padByte)(Code)
Write padded scalar byte array object includes length, codepoint and value
Parameters:
  codePoint - - code point to write
Parameters:
  buf - - byte array to be written
Parameters:
  paddedLength - - length to pad string to
Parameters:
  padByte - - byte to be used for padding



writeScalarPaddedBytes
protected void writeScalarPaddedBytes(byte[] buf, int paddedLength, byte padByte)(Code)
Write padded scalar byte array object value
Parameters:
  buf - - byte array to be written
Parameters:
  paddedLength - - length to pad string to
Parameters:
  padByte - - byte to be used for padding



writeScalarPaddedString
void writeScalarPaddedString(int codePoint, String string, int paddedLength)(Code)
Write padded scalar string object includes length, codepoint and value the string is converted into the appropriate codeset (EBCDIC)
Parameters:
  codePoint - - code point to write
Parameters:
  string - - string to be written
Parameters:
  paddedLength - - length to pad string to



writeScalarPaddedString
protected void writeScalarPaddedString(String string, int paddedLength)(Code)
Write padded scalar string object value the string is converted into the appropriate codeset (EBCDIC)
Parameters:
  string - - string to be written
Parameters:
  paddedLength - - length to pad string to



writeScalarPaddedString
protected void writeScalarPaddedString(DRDAString drdaString, int paddedLength)(Code)
Write padded scalar DRDAString object value. The string is converted into the appropriate codeset.
Parameters:
  drdaString - string to be written
Parameters:
  paddedLength - length to pad string to



writeScalarStream
protected void writeScalarStream(boolean chainedWithSameCorrelator, int codePoint, EXTDTAInputStream in, boolean writeNullByte) throws DRDAProtocolException(Code)



writeScalarString
void writeScalarString(int codePoint, String string)(Code)
Write scalar string object includes length, codepoint and value the string is converted into the appropriate codeset (EBCDIC)
Parameters:
  codePoint - - code point to write
Parameters:
  string - - string to be written



writeShort
protected void writeShort(int v)(Code)
Write platform short
Parameters:
  v - value to be written



writeShort
protected void writeShort(boolean b)(Code)
Write boolean as short
Parameters:
  b - boolean value true = 1 false = 0



writeString
protected void writeString(String s) throws DRDAProtocolException(Code)
Write string with default encoding
Parameters:
  s - value to be written
exception:
  DRDAProtocolException -



writeString
protected void writeString(String s, int length) throws DRDAProtocolException(Code)
Write string with default encoding and specified length
Parameters:
  s - value to be written
Parameters:
  length - number of bytes to be written
exception:
  DRDAProtocolException -



zeroPadString
public static String zeroPadString(String s, int precision)(Code)
Prepend zeros to numeric string
Parameters:
  s - string
Parameters:
  precision - - length of padded string zero padded string



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.