org.plasma.sdo.xml
Class StreamUnmarshaller

java.lang.Object
  extended by org.plasma.sdo.xml.XMLProcessor
      extended by org.plasma.sdo.xml.Unmarshaller
          extended by org.plasma.sdo.xml.StreamUnmarshaller

public class StreamUnmarshaller
extends Unmarshaller

A Streaming API for XML (StAX) parser based XML unmarshaller which converts various (stream-based) XML input source types into an SDO data graph. The resulting data graph is ready to be used, e.g. modified or committed using a Data Access Service (DAS). This unmarshaller coalesces or merges XML nodes associated with SDO types which have external key properties, creating both containment and non-containment reference (property) associations between data objects. Since the final coalesced data graph structure is not known until the entire stream is parsed, lightweight "scaffolding" structures are first used to collect objects and property values into an initial node graph. This graph is then walked and the nodes coalesced into the final data-object graph. The scaffolding nodes are then discarded.


Field Summary
 
Fields inherited from class org.plasma.sdo.xml.Unmarshaller
flavor, result
 
Constructor Summary
StreamUnmarshaller(XMLOptions options, String locationURI)
           
 
Method Summary
static String getEventTypeString(int eventType)
          Returns the String representation of the given integer constant.
 XMLDocument getResult()
           
 void unmarshal(InputStream stream)
          Reads the given input stream in its entirety, and closes the stream when complete.
 void unmarshal(Reader reader)
          Reads the given reader as a stream in its entirety, and closes the stream when complete.
 void unmarshal(Source source)
          Reads the given source as a stream in its entirety, and closes the stream when complete.
 
Methods inherited from class org.plasma.sdo.xml.XMLProcessor
getOptions, setOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamUnmarshaller

public StreamUnmarshaller(XMLOptions options,
                          String locationURI)
Method Detail

getResult

public XMLDocument getResult()

unmarshal

public void unmarshal(InputStream stream)
               throws XMLStreamException,
                      UnmarshallerException
Reads the given input stream in its entirety, and closes the stream when complete. The data graph result is retrieved using the getResult method.

Parameters:
stream - the XML stream to read
Throws:
XMLStreamException - if the given document is found to be malformed
UnmarshallerException - if undefined properties, or classes are found in the XML stream.

unmarshal

public void unmarshal(Source source)
               throws XMLStreamException,
                      UnmarshallerException
Reads the given source as a stream in its entirety, and closes the stream when complete. The data graph result is retrieved using the getResult method.

Parameters:
source - the XML source to read
Throws:
XMLStreamException - if the given document is found to be malformed
UnmarshallerException - if undefined properties, or classes are found in the XML stream.

unmarshal

public void unmarshal(Reader reader)
               throws XMLStreamException,
                      UnmarshallerException
Reads the given reader as a stream in its entirety, and closes the stream when complete. The data graph result is retrieved using the getResult method.

Parameters:
reader - the XML reader to read
Throws:
XMLStreamException - if the given document is found to be malformed
UnmarshallerException - if undefined properties, or classes are found in the XML stream.

getEventTypeString

public static final String getEventTypeString(int eventType)
Returns the String representation of the given integer constant.

Parameters:
eventType - Type of event.
Returns:
String representation of the event


Copyright © 2014. All rights reserved.