OpenNMS API 1.2.3

org.opennms.web.parsers
Class XMLWriter

java.lang.Object
  extended byorg.opennms.web.parsers.XMLWriter
Direct Known Subclasses:
EventConfWriter, GroupsWriter, NotificationsWriter, UsersWriter, ViewsWriter

public abstract class XMLWriter
extends java.lang.Object

This class is used to parse data from and save data to the users.xml file.

Version:
1.1.1.1
Author:
Jason Johns , OpenNMS

Field Summary
protected static java.lang.String DTD_EXTENSION
           
protected  java.lang.String m_baseName
           
protected  javax.xml.parsers.DocumentBuilder m_docBuilder
           
protected  org.w3c.dom.Document m_document
           
protected  java.lang.String m_dtd
           
protected  java.lang.String m_dtdPath
           
protected  java.lang.String m_fileName
           
protected static XMLHeader m_headerInfo
          The header information parsed from the file
protected  java.lang.String m_xmlPath
           
protected static java.lang.String XML_EXTENSION
           
 
Constructor Summary
XMLWriter(java.lang.String fileName)
          Default constructor, intializes the member variables
 
Method Summary
 org.w3c.dom.Element addCDataElement(org.w3c.dom.Element parent, java.lang.String elementName, java.lang.String data)
           
 org.w3c.dom.Element addDataElement(org.w3c.dom.Element parent, java.lang.String elementName, java.lang.String data)
           
 org.w3c.dom.Element addEmptyElement(org.w3c.dom.Element parent, java.lang.String elementName)
           
 void backup()
          This method attempts to make a backup of the xml file.
 java.lang.String getDTD(java.lang.String dtdFileName)
           
 java.lang.String getVersion()
           
protected  void loadDTD(java.lang.String dtdFileName)
           
 void save(java.util.Collection list)
           
protected abstract  void saveDocument(java.util.Collection list)
           
protected  void serializeToFile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_headerInfo

protected static XMLHeader m_headerInfo
The header information parsed from the file


m_document

protected org.w3c.dom.Document m_document

m_docBuilder

protected javax.xml.parsers.DocumentBuilder m_docBuilder

m_fileName

protected java.lang.String m_fileName

m_baseName

protected java.lang.String m_baseName

m_xmlPath

protected java.lang.String m_xmlPath

m_dtdPath

protected java.lang.String m_dtdPath

m_dtd

protected java.lang.String m_dtd

XML_EXTENSION

protected static final java.lang.String XML_EXTENSION
See Also:
Constant Field Values

DTD_EXTENSION

protected static final java.lang.String DTD_EXTENSION
See Also:
Constant Field Values
Constructor Detail

XMLWriter

public XMLWriter(java.lang.String fileName)
          throws XMLWriteException
Default constructor, intializes the member variables

Method Detail

loadDTD

protected void loadDTD(java.lang.String dtdFileName)
                throws java.io.FileNotFoundException,
                       java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getDTD

public java.lang.String getDTD(java.lang.String dtdFileName)
                        throws java.io.FileNotFoundException,
                               java.io.IOException
Throws:
java.io.FileNotFoundException
java.io.IOException

getVersion

public java.lang.String getVersion()

backup

public void backup()
            throws XMLWriteException
This method attempts to make a backup of the xml file. It is recommended that this method is called prior to making the call to save(), so that the original config file will be recoverable if the writting of the new config file fails.

Throws:
XMLWriteException

serializeToFile

protected void serializeToFile()
                        throws XMLWriteException
Throws:
XMLWriteException

addEmptyElement

public org.w3c.dom.Element addEmptyElement(org.w3c.dom.Element parent,
                                           java.lang.String elementName)

addDataElement

public org.w3c.dom.Element addDataElement(org.w3c.dom.Element parent,
                                          java.lang.String elementName,
                                          java.lang.String data)

addCDataElement

public org.w3c.dom.Element addCDataElement(org.w3c.dom.Element parent,
                                           java.lang.String elementName,
                                           java.lang.String data)
                                    throws XMLWriteException
Throws:
XMLWriteException

save

public void save(java.util.Collection list)
          throws XMLWriteException
Throws:
XMLWriteException

saveDocument

protected abstract void saveDocument(java.util.Collection list)
                              throws XMLWriteException
Throws:
XMLWriteException

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.