Remote Systems
v6.4.1

com.ibm.etools.systems.dstore.core.util
Class XMLgenerator

java.lang.Object
  extended bycom.ibm.etools.systems.dstore.core.util.XMLgenerator

public class XMLgenerator
extends Object

This class is used to serialize data and send it either to a file or a socket.

When a DataStore tree needs to be transmitted, it's DataElements are converted to XML before sending. Only those elements which have changed and are thus out of synch with the DataStore on the other end of the socket are actually transferred.

When a byte stream or file needs to be transmitted, bytes are either send as is if binary transfer is requested or as unicode if binary transfer is not requested.


Field Summary
static int BODY
           
static int CLOSE
           
static String Copyright
           
static int EMPTY
           
static int OPEN
           
 
Constructor Summary
XMLgenerator(DataStore dataStore)
          Constructor
 
Method Summary
 StringBuffer document()
          Returns the current serialized document
 void empty()
          Clears the current serlized document
 void flushData()
          Send all buffered data through the pipe.
 void generate(DataElement object, byte[] bytes, int size, boolean isAppend, boolean binary)
          Generate an tags for a file transfer and send bytes over the pipe.
 void generate(DataElement object, int depth)
          Serializes and sends a DataStore tree through the pipe
static StringBuffer prepareStringForXML(String input)
          Converts special characters to appropriate representation in XML
static StringBuffer prepareStringForXML(StringBuffer input)
          Converts special characters to appropriate representation in XML
 void setBufferSize(int size)
          Set the buffer size
 void setDataWriter(BufferedWriter writer)
          Sets the data writer used for XML transfer
 void setFileWriter(PrintStream writer)
          Sets the file writer used for file transfer
 void setGenerateBuffer(boolean flag)
          Indicate whether the buffer attribute of each DataElement should be transferred
 void setIgnoreDeleted(boolean flag)
          Indicate whether DataElements marked as deleted should be sent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

EMPTY

public static final int EMPTY
See Also:
Constant Field Values

OPEN

public static final int OPEN
See Also:
Constant Field Values

CLOSE

public static final int CLOSE
See Also:
Constant Field Values

BODY

public static final int BODY
See Also:
Constant Field Values
Constructor Detail

XMLgenerator

public XMLgenerator(DataStore dataStore)
Constructor

Parameters:
dataStore - the associated DataStore
Method Detail

setIgnoreDeleted

public void setIgnoreDeleted(boolean flag)
Indicate whether DataElements marked as deleted should be sent.

Parameters:
flag - whether deleted elements should be sent

setFileWriter

public void setFileWriter(PrintStream writer)
Sets the file writer used for file transfer

Parameters:
writer - the file writer used for file transfer

setDataWriter

public void setDataWriter(BufferedWriter writer)
Sets the data writer used for XML transfer

Parameters:
writer - the data writer used for XML transfer

setBufferSize

public void setBufferSize(int size)
Set the buffer size

Parameters:
size - of the buffer used for transmitting packets

setGenerateBuffer

public void setGenerateBuffer(boolean flag)
Indicate whether the buffer attribute of each DataElement should be transferred

Parameters:
flag - whether the buffer should be transferred

flushData

public void flushData()
Send all buffered data through the pipe.


document

public StringBuffer document()
Returns the current serialized document

Returns:
the current document

empty

public void empty()
Clears the current serlized document


prepareStringForXML

public static StringBuffer prepareStringForXML(StringBuffer input)
Converts special characters to appropriate representation in XML

Parameters:
input - buffer to convert
Returns:
the converted buffer

prepareStringForXML

public static StringBuffer prepareStringForXML(String input)
Converts special characters to appropriate representation in XML

Parameters:
input - buffer to convert
Returns:
the converted buffer

generate

public void generate(DataElement object,
                     byte[] bytes,
                     int size,
                     boolean isAppend,
                     boolean binary)
Generate an tags for a file transfer and send bytes over the pipe.

Parameters:
object - the element representing the file transfer
bytes - the bytes to send
size - the number of bytes to send
isAppend - indicates whether bytes should be appended or not to a file on the other end of the pipe
binary - indicates whether the bytes should be sent as binary or text

generate

public void generate(DataElement object,
                     int depth)
Serializes and sends a DataStore tree through the pipe

Parameters:
object - the root of the DataStore tree to send
depth - the depth of the tree to send

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.