org.mmbase.util.xml.applicationdata
Class NodeWriter

java.lang.Object
  extended by org.mmbase.util.xml.applicationdata.NodeWriter

public class NodeWriter
extends Object

Utility class for writing xml files for data- and relation sources, suppied by an application export class. Does not support or export dtd information.

Version:
$Id: NodeWriter.java 34900 2009-05-01 16:29:42Z michiel $
Author:
Daniel Ockeleon, Jaco de Groot, Pierre van Rooden

Constructor Summary
NodeWriter(MMBase mmb, Logger logger, String directory, String builderName, boolean isRelationNode)
          Constructor, opens the initial xml file and writes a header.
 
Method Summary
 void done()
          Writes a footer to the xml file, and closes the file.
(package private) static boolean saveFile(String filename, byte[] value)
          Stores binary data in a file
 void write(MMObjectNode node)
          Writes a node (object) to the datasource file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeWriter

NodeWriter(MMBase mmb,
           Logger logger,
           String directory,
           String builderName,
           boolean isRelationNode)
Constructor, opens the initial xml file and writes a header. The file opened for writing is [directory]/[buildername].xml.

Parameters:
mmb - MMBase object for retrieving type information
logger - place to log results.
directory - the directory to write the files to (including the trailing slash).
buildername - name of the builder to export
isRelationNode - if true, the source to write is a relationsource. Otherwise, a datasource is written.
Method Detail

write

public void write(MMObjectNode node)
Writes a node (object) to the datasource file. Relationsources are stored in a slightly different format from data sources.

Parameters:
node - The object to store.

done

public void done()
Writes a footer to the xml file, and closes the file.


saveFile

static boolean saveFile(String filename,
                        byte[] value)
Stores binary data in a file

Parameters:
filename - path of the file to store the data
value - binary data to store (byte array)
Returns:
true if the write was succesful, false if an exception occurred


MMBase 2.0-SNAPSHOT - null