Package com.sodius.mdw.server.storage
Class NodeContentProducer
- java.lang.Object
-
- com.sodius.mdw.server.storage.NodeContentProducer
-
- All Implemented Interfaces:
ContentProducer
public abstract class NodeContentProducer extends Object implements ContentProducer
A content producer that supports both XML and JSON as content format.Clients may subclass this class.
- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description NodeContentProducer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description InputStreamgetContents(Map<?,?> options)Returns the underlying content as a stream, either in XML or JSON format.protected abstract voidwrite(NodeWriter writer, Map<?,?> options)Implementation must call methods on the specifiedNodeWriterto build a node tree that is later serialized either as JSON or XML format.
-
-
-
Method Detail
-
getContents
public InputStream getContents(Map<?,?> options) throws IOException, UnsupportedOperationException
Returns the underlying content as a stream, either in XML or JSON format.The options configures the content to retrieve. Options must include a
"Content-Type"property to determine the format of data to retrieve, which is either one of the following:"application/json","application/xml"or"text/xml".- Specified by:
getContentsin interfaceContentProducer- Parameters:
options- properties describing the content to retrieve.- Returns:
- the underlying content as a stream.
- Throws:
IOException- if the content cannot be read.UnsupportedOperationException- if the"Content-Type"property is missing or is neither one of the following:"application/json","application/xml"or"text/xml".
-
write
protected abstract void write(NodeWriter writer, Map<?,?> options) throws IOException
Implementation must call methods on the specifiedNodeWriterto build a node tree that is later serialized either as JSON or XML format.- Parameters:
writer- the node writer on which nodes creation is requested.options- properties describing the content to retrieve.- Throws:
IOException- if the nodes cannot be produced.
-
-