org.objectweb.proactive.benchmarks.timit.util
Class XMLHelper

java.lang.Object
  extended by org.objectweb.proactive.benchmarks.timit.util.XMLHelper

public class XMLHelper
extends java.lang.Object

An helper class for reading and writing XML files

Author:
Brian Amedro, Vladimir Bodnartchouk

Constructor Summary
XMLHelper()
           
 
Method Summary
static java.io.File createFileWithDirs(java.lang.String filename)
           
static void errorLog(java.lang.String filename, java.lang.String message)
          This method allow to append a message to an error file
static void generateDescriptor(java.lang.String inFilename, java.util.HashMap<java.lang.String,java.lang.String> gvars, java.util.HashMap<java.lang.String,java.lang.String> lvars, java.lang.String outFilename)
          Generate a ProActive descriptor file thanks to a pad base file.
static void printOut(org.jdom.Document doc)
          Print document on stdout.
static org.jdom.Document readFile(java.lang.String filename)
          Get XML Document thanks to its filename
static void replaceAll(org.jdom.Element elt, java.lang.String old, java.lang.String value)
          Replace all occurences of old by value in all attributes of elt
static void replaceVariables(java.util.List serieList, java.util.HashMap<java.lang.String,java.lang.String> vars)
          Replace all variable occurences in serie's list by their value in vars
static void tagFiltering(org.jdom.Element eTag, java.lang.String[] values)
          Filter elements from value of name attribute
Remove all elements which are not in values.
static void writeFile(org.jdom.Document document, java.lang.String filename)
          Save document into XML file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHelper

public XMLHelper()
Method Detail

readFile

public static org.jdom.Document readFile(java.lang.String filename)
Get XML Document thanks to its filename

Parameters:
filename - the XML file name
Returns:
the XML Document

writeFile

public static void writeFile(org.jdom.Document document,
                             java.lang.String filename)
Save document into XML file

Parameters:
document - the Document to save
filename - the XML file name to save

createFileWithDirs

public static java.io.File createFileWithDirs(java.lang.String filename)

errorLog

public static void errorLog(java.lang.String filename,
                            java.lang.String message)
This method allow to append a message to an error file

Parameters:
filename - the error file to write
message - the message to append to file

generateDescriptor

public static void generateDescriptor(java.lang.String inFilename,
                                      java.util.HashMap<java.lang.String,java.lang.String> gvars,
                                      java.util.HashMap<java.lang.String,java.lang.String> lvars,
                                      java.lang.String outFilename)
Generate a ProActive descriptor file thanks to a pad base file. Variables in this pad will be reassigned. Note: local variables mask global variable

Parameters:
inFilename - the ProActive descriptor base file
gvars - the global variables
lvars - the local variables
outFilename - the generated pad file name

replaceAll

public static void replaceAll(org.jdom.Element elt,
                              java.lang.String old,
                              java.lang.String value)
Replace all occurences of old by value in all attributes of elt

Parameters:
elt - the Element to parse
old - the old value to replace
value - the new value

replaceVariables

public static void replaceVariables(java.util.List serieList,
                                    java.util.HashMap<java.lang.String,java.lang.String> vars)
Replace all variable occurences in serie's list by their value in vars

Parameters:
serieList - the list of series to parse
vars - the variables to set

tagFiltering

public static void tagFiltering(org.jdom.Element eTag,
                                java.lang.String[] values)
Filter elements from value of name attribute
Remove all elements which are not in values. If a parent is not in accepted values, its children will not be accepted.

Parameters:
timit - the Element to modify
values - names to accept

printOut

public static void printOut(org.jdom.Document doc)
Print document on stdout. For debug purpose

Parameters:
doc -


Copyright 2001-2007 INRIA All Rights Reserved.