org.mmbase.util
Class XMLContextDepthWriterII

java.lang.Object
  extended byorg.mmbase.util.XMLContextDepthWriterII
Direct Known Subclasses:
XMLFullBackupWriter

public class XMLContextDepthWriterII
extends java.lang.Object

This class is used to write (export) a selection of nodes to xml format. The nodes to export are read from a XML context file, which specifies the startnode and depth to which to parse. The current version of this class combines a number of methods which we want to split - or at least share - with a seperate class for handling contexts. Note that because of it's static nature, no object instance need be made (in fact, none CAN be made) of this class.
To use this class in stead of the old XMLContextDepthWriter, replace the following lines in util/XMLApplicationWriter.java:

XMLContextDepthWriter.writeContext(app,capp,targetpath,mmb,resultmsgs); XMLContextDepthWriter.writeContextXML(capp,targetpath+"/"+(String)bset.get("path"));
with:
in writeDateSources : XMLContextDepthWriterII.writeContext(app,capp,targetpath,mmb,resultmsgs); in writeContextSources : XMLContextDepthWriterII.writeContextXML(capp,targetpath+"/"+(String)bset.get("path"));

Version:
$Id: XMLContextDepthWriterII.java,v 1.8 2003/03/10 11:51:14 pierre Exp $
Author:
Daniel Ockeloen, Jacco de Groot, Pierre van Rooden
Warning: Will be renamed to:
ContextDepthWriter

Constructor Summary
XMLContextDepthWriterII()
           
 
Method Summary
static boolean writeContext(XMLApplicationReader app, XMLContextDepthReader capp, java.lang.String targetpath, MMBase mmb, java.util.Vector resultmsgs)
          Writes an application's nodes, according to that application's contexts, to a path.
static boolean writeContextXML(XMLContextDepthReader capp, java.lang.String filename)
          Writes the context file, based on what was supplied by the application
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLContextDepthWriterII

public XMLContextDepthWriterII()
Method Detail

writeContext

public static boolean writeContext(XMLApplicationReader app,
                                   XMLContextDepthReader capp,
                                   java.lang.String targetpath,
                                   MMBase mmb,
                                   java.util.Vector resultmsgs)
Writes an application's nodes, according to that application's contexts, to a path. The files written are stored in a subdirectory (named after the application), and contain the datasource (xml) files for both datanodes and relation nodes.

Parameters:
app - A XMLApplicationReader initialised to read the application's description (xml) file This object is used to retrieve what builder and relations are needed, and in which files data should be stored.
capp - A XMLContextDepthReader initialised to read the application's context file This object is used to retrieve information regarding search depth and starting nodes for the search tree whoch determines what nodes are part of this application.
targetpath - The path where to save the application
mmb - Reference to the MMbase processormodule. Used to retrieve the nodes to write.
resultmsgs - Storage for messages which can be displayed to the user.
Returns:
Returns true if succesful, false if no valid depth or startnode could be found Failure of the export itself is not detected, though may be visible in the messages returned.

writeContextXML

public static boolean writeContextXML(XMLContextDepthReader capp,
                                      java.lang.String filename)
Writes the context file, based on what was supplied by the application

Parameters:
capp - XMLContextDepthReader providing original context data
filename - Name of the xml file to save.
Returns:
always true


MMBase build 1.7.1.20041002