org.optimizationservices.oscommon.representationparser
Class OSgLWriter

java.lang.Object
  extended by org.optimizationservices.oscommon.representationparser.OSgLWriter
Direct Known Subclasses:
OSaLWriter, OSbLWriter, OSeLWriter, OSfLWriter, OSiLWriter, OSoLWriter, OSParameterWriter, OSpLWriter, OSqLWriter, OSRegistryWriter, OSRepositoryWriter, OSrLWriter, OSsLWriter, OSuLWriter

public class OSgLWriter
extends java.lang.Object

The OSgLWriter class is a general and generic writer class for all the other OSxL writer classes to extend, which mostly writes a DOM tree of an OSxL instance and provide a set of "set" and "add" methods that can be used to construct different pieces of information of the OSxL instance.

Since:
OS 1.0
Version:
1.0, 03/14/2004
Author:
Robert Fourer, Jun Ma, Kipp Martin

Field Summary
 org.w3c.dom.Document m_document
          m_document holds the W3C DOM type document to create XML elements and attributes.
 
Constructor Summary
OSgLWriter()
          Constructor.
 
Method Summary
 org.w3c.dom.Document getDocument()
           
static void main(java.lang.String[] argv)
          main for test purposes.
 void setDocument(org.w3c.dom.Document document)
           
 boolean writeToFile(java.lang.String fileName)
          Write the xml file from the internally constructed DOM tree structure that contains the OSxL instance to a file.
 java.lang.String writeToSring()
          Write the xml file from the internally constructed DOM tree structure that contains the OSxL instance to a string to be returned.
 boolean writeToStandardOutput()
          Write the xml file from the internally constructed DOM tree structure that contains the OSxL instance to the standard output (e.g.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_document

public org.w3c.dom.Document m_document
m_document holds the W3C DOM type document to create XML elements and attributes. It is the parent of the root element, e.g. the <OSiL> element in OSiL. It is used to create all the nodes in the DOM tree.

Constructor Detail

OSgLWriter

public OSgLWriter()
Constructor.

Method Detail

writeToFile

public boolean writeToFile(java.lang.String fileName)
Write the xml file from the internally constructed DOM tree structure that contains the OSxL instance to a file.

Parameters:
fileName - holds the xml filename to write out the file to.
Returns:
whether the file is written successfully without any error.

writeToStandardOutput

public boolean writeToStandardOutput()
Write the xml file from the internally constructed DOM tree structure that contains the OSxL instance to the standard output (e.g. screen).

Returns:
whether the output is written successfully without any error.

writeToSring

public java.lang.String writeToSring()
Write the xml file from the internally constructed DOM tree structure that contains the OSxL instance to a string to be returned.

Returns:
a string that contains the OSiL optimization instance. If error is encountered in writing the string, null is returned.

setDocument

public void setDocument(org.w3c.dom.Document document)
Parameters:
document - holds the W3C DOM type document to create XML elements and attributes. It is the parent of the root element, e.g. the <OSiL> element in OSiL. It is used to create all the nodes in the DOM tree.

getDocument

public org.w3c.dom.Document getDocument()
Returns:
the document which holds the W3C DOM type document to create XML elements and attributes. It is the parent of the root element, e.g. the <OSiL> element in OSiL. It is used to create all the nodes in the DOM tree..

main

public static void main(java.lang.String[] argv)
main for test purposes.

Parameters:
argv - command line arguments.