|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.util.xml.applicationdata.ContextDepthDataWriter
public class ContextDepthDataWriter
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.
| Constructor Summary | |
|---|---|
ContextDepthDataWriter()
|
|
| Method Summary | |
|---|---|
(package private) static HashSet<Integer> |
getFilterBuilders(List<Map<String,String>> filter,
TypeDef bul)
Retrieves the builders used for filtering the nodes for this application |
(package private) static int |
getRelatedNode(int nodeNumber,
MMObjectNode relationNode)
Determines the number of the node referenced by another node. |
(package private) static int |
getStartNode(ContextDepthDataReader capp,
MMBase mmb)
Retrieves the number of the startnode referenced by the context configuration file.. |
(package private) static void |
getSubNodes(int startnodenr,
int maxdepth,
HashSet<Integer> fb,
HashSet<Integer> nodesdoneSet,
HashSet<Integer> relationnodesSet,
MMBase mmb)
Searches the MMBase cloud, colelcting all nodes (and corresponmding relation nodes) that belong to a specific type, and which can be traced up to a certain depth of nodes to a starting node. |
(package private) static boolean |
saveFile(String filename,
byte[] value)
Saves an array of byte to a file. |
(package private) static boolean |
saveFile(String filename,
String value)
Saves a string value to a file. |
static boolean |
writeContext(ApplicationReader app,
ContextDepthDataReader capp,
String targetpath,
MMBase mmb,
Logger logger)
Writes an application's nodes, according to that application's contexts, to a path. |
static boolean |
writeContextXML(ContextDepthDataReader capp,
String filename)
Writes the context file, based on what was supplied by the application |
(package private) static void |
writeDataSources(ApplicationReader app,
HashSet<Integer> nodes,
String targetpath,
MMBase mmb,
Logger logger)
Writes the required datasources to their corresponding xml files by calling writeNodes() |
(package private) static void |
writeNodes(ApplicationReader app,
HashSet<Integer> nodes,
String targetpath,
MMBase mmb,
Logger logger,
boolean isRelation)
Writes the nodes to their corresponding xml files |
(package private) static void |
writeRelationSources(ApplicationReader app,
HashSet<Integer> nodes,
String targetpath,
MMBase mmb,
Logger logger)
Writes the required relation sources to their corresponding xml files by calling writeNodes() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ContextDepthDataWriter()
| Method Detail |
|---|
public static boolean writeContext(ApplicationReader app,
ContextDepthDataReader capp,
String targetpath,
MMBase mmb,
Logger logger)
app - A ApplicationReader 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 ContextDepthDataReader 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 applicationmmb - Reference to the MMbase processormodule. Used to retrieve the nodes to write.logger - Storage for messages which can be displayed to the user.
IOException - if one or more files could not be written
static void writeDataSources(ApplicationReader app,
HashSet<Integer> nodes,
String targetpath,
MMBase mmb,
Logger logger)
app - The ApplicationReader object, which is used to retrieve what datasources to write (and to what file).nodes - The nodes that are part of the application. Those that are of a type compatible with the datasources are exported.targetpath - Path where the xml files are writtenmmb - MMBase object used to retrieve builder informationlogger - Used to store messages that can be showmn to the user
static void writeRelationSources(ApplicationReader app,
HashSet<Integer> nodes,
String targetpath,
MMBase mmb,
Logger logger)
app - The ApplicationReader object, which is used to retrieve what relationsources to write (and to what file).nodes - The relation nodes that are part of the application. Those that are of a type compatible with the relationsources are exported.targetpath - Path where the xml files are writtenmmb - MMBase object used to retrieve builder informationlogger - Used to store messages that can be showmn to the user
static void writeNodes(ApplicationReader app,
HashSet<Integer> nodes,
String targetpath,
MMBase mmb,
Logger logger,
boolean isRelation)
app - The ApplicationReader object, which is used to retrieve what sources to write (and to what file).nodes - The nodes that are part of the application. Those that are of a type compatible with the sources are exported.targetpath - Path where the xml files are writtenmmb - MMBase object used to retrieve builder informationlogger - Used to store messages that can be showmn to the userisRelation - Indicates whether the nodes to write are data (false) or relation (true) nodes
static int getRelatedNode(int nodeNumber,
MMObjectNode relationNode)
nodeNumber - number of the referencing noderelationNode - node from the relationtable containing the relation data
static void getSubNodes(int startnodenr,
int maxdepth,
HashSet<Integer> fb,
HashSet<Integer> nodesdoneSet,
HashSet<Integer> relationnodesSet,
MMBase mmb)
startnodenr - the number of the node to start withmaxdeoth - the maximum depth a tree is traversed. A depth of 0 or less means only the sdtartnode is added.
A depth of one includes all teh nodes refernced by the startnode, etc.
Relation nodes are not counted when determining 'depth'.fb - a HashSet containing the set of types that are allowed for exportnodesdoneSet - A HashSet which holds all nodes that are already 'done' or 'almost done'. this set is expanded in the method
nodes already in this set are skipped (optimization). After return, the set has been expanded
with all nodes found while traversing the cloudmmb - MMBase object used to retrieve builder information
static HashSet<Integer> getFilterBuilders(List<Map<String,String>> filter,
TypeDef bul)
filter - Vector containign all the buildernames that are part of this application
Note that being part of an application does not mean that they are exported!bul - reference to the TypeDef builder, used for rertrieving builder types
HashSet, containing the types (Integer) of all builders part of this application.
static int getStartNode(ContextDepthDataReader capp,
MMBase mmb)
capp - ContextDepthDataReader object for retrieving data from the contextmmb - reference to the MMBase object, used for retrieving aliases and builders
integer, the number of the startnode if succesful, -1 otherwise.
static boolean saveFile(String filename,
String value)
filename - Name of the file to save.value - string to store in the file
static boolean saveFile(String filename,
byte[] value)
filename - Name of the file to save.value - array to stiore in the file
public static boolean writeContextXML(ContextDepthDataReader capp,
String filename)
capp - ContextDepthDataReader providing original context datafilename - Name of the xml file to save.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||