Remote Systems
v6.4.1

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

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

public class XMLparser
extends Object

This class is used to deserialize data received from a file or a socket.

When tags indicate that data is being received, the byte stream is deserialized as a DataStore tree. When deserialized data maps to existing DataElements in the DataStore, those elements are updated directly. Any deserialized data that maps to within an existing DataElement, that does not already exist, gets created under the existing DataElement. When parsing DataElement XML, there is no intermediate DOM - rather the DOM is the DataStore itself.

When tags indicate that a byte stream or file is being received, bytes are sent the the current DataStore ByteStreamHandler to be saved on disk.


Nested Class Summary
 class XMLparser.KeepAliveRequestThread
           
 
Field Summary
static String Copyright
           
static int IO_SOCKET_READ_TIMEOUT
           
static long KEEPALIVE_RESPONSE_TIMEOUT
           
 
Constructor Summary
XMLparser(DataStore dataStore)
          Constructor
 
Method Summary
static String convertStringFromXML(String input)
          Converts XML special character representations to the appropriate characters
 Throwable getPanicException()
          Returns the communications exception if one occurred
 DataElement parseDocument(BufferedInputStream reader, Socket socket)
          This method gets called to receive data from the pipe.
protected  DataElement parseTag(String fullTag, DataElement parent)
          Deserializes a single DataElement from the XML stream.
 void readFile(BufferedInputStream reader, int size, String path, String byteStreamHandlerId)
          Read a file from the pipe
 String readLine(BufferedInputStream reader, Socket socket)
          Reads a line from the pipe
 
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

IO_SOCKET_READ_TIMEOUT

public static final int IO_SOCKET_READ_TIMEOUT
See Also:
Constant Field Values

KEEPALIVE_RESPONSE_TIMEOUT

public static final long KEEPALIVE_RESPONSE_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

XMLparser

public XMLparser(DataStore dataStore)
Constructor

Parameters:
dataStore - the associated DataStore
Method Detail

readFile

public void readFile(BufferedInputStream reader,
                     int size,
                     String path,
                     String byteStreamHandlerId)
Read a file from the pipe

Parameters:
reader - the pipe reader
size - the number of bytes to read
path - the path of the file where the received bytes should be inserted

readLine

public String readLine(BufferedInputStream reader,
                       Socket socket)
Reads a line from the pipe

Parameters:
reader - the pipe reader
Returns:
the line received

getPanicException

public Throwable getPanicException()
Returns the communications exception if one occurred

Returns:
a exception

parseDocument

public DataElement parseDocument(BufferedInputStream reader,
                                 Socket socket)
                          throws IOException
This method gets called to receive data from the pipe. It deserializes DataStore XML documents, creating the appropriate DataElements in appropriate places in the DataStore tree. If files are being transmitted it creates the appropriate files using the DataStore ByteStreamHandler.

Parameters:
reader - the pipe reader
Returns:
the root DataElement of the parsed document
Throws:
IOException

parseTag

protected DataElement parseTag(String fullTag,
                               DataElement parent)
Deserializes a single DataElement from the XML stream.

Parameters:
fullTag - the DataElement XML tag
parent - the DataElement that container for the deserialized DataElement
Returns:
the parsed DataElement

convertStringFromXML

public static String convertStringFromXML(String input)
Converts XML special character representations to the appropriate characters

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

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.