com.cysols.iodef
Class IodefXMLFileWriter

java.lang.Object
  extended by com.cysols.iodef.XMLFileWriter
      extended by com.cysols.iodef.IodefXMLFileWriter
All Implemented Interfaces:
DocumentWriter, IodefDocumentWriter

public class IodefXMLFileWriter
extends XMLFileWriter
implements DocumentWriter, IodefDocumentWriter

Write the XML docuemnt to file.

Author:
cysol

Constructor Summary
IodefXMLFileWriter()
          Default constructor.
IodefXMLFileWriter(String file)
          Sets the specified file name.
 
Method Summary
 void setFile(String file)
          Sets the specified file name.
 void validWrite(IODEFDocument iodef)
          Validates the iodef document and writes with XML document included iodef document to a file if validation is passed.
 void validWrite(String key, IODEFDocument iodef)
          Validates the iodef document and writes with XML document included iodef document to a file if validation is passed.
 void write(Document doc)
          Writes the specified iodef document to file.
 void write(IODEFDocument iodef)
          Writes the specified iodef document to file.
 void write(String key, Document doc)
          Writes the specified iodef document to file.
 void write(String key, IODEFDocument iodef)
          Writes the specified iodef document to file.
 
Methods inherited from class com.cysols.iodef.XMLFileWriter
createDirs, write, write, write, writeToFile, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IodefXMLFileWriter

public IodefXMLFileWriter(String file)
Sets the specified file name.

Parameters:
file - file name to store.

IodefXMLFileWriter

public IodefXMLFileWriter()
Default constructor.

Method Detail

setFile

public void setFile(String file)
Sets the specified file name.

Parameters:
file - file name to store.

write

public void write(Document doc)
           throws XMLWriteException
Writes the specified iodef document to file.

Specified by:
write in interface DocumentWriter
Parameters:
doc - iodef document
Throws:
XMLWriteException - if writing goes wrong

write

public void write(String key,
                  Document doc)
           throws XMLWriteException
Writes the specified iodef document to file.

Specified by:
write in interface DocumentWriter
Parameters:
doc - an iodef document
key - this value isn't used by this method.
Throws:
XMLWriteException - if writing goes wrong

write

public void write(IODEFDocument iodef)
           throws XMLWriteException
Writes the specified iodef document to file.

Specified by:
write in interface IodefDocumentWriter
Parameters:
iodef - an iodef document
Throws:
XMLWriteException - if writing goes wrong

write

public void write(String key,
                  IODEFDocument iodef)
           throws XMLWriteException
Writes the specified iodef document to file. The key is ignored even if it is specified. This methos is an implementation of IodefDocumentWriter.write method.

Specified by:
write in interface IodefDocumentWriter
Parameters:
key - Not used.
iodef - an iodef document
Throws:
XMLWriteException - if writing goes wrong

validWrite

public void validWrite(String key,
                       IODEFDocument iodef)
                throws XMLValidationError,
                       XMLWriteException
Validates the iodef document and writes with XML document included iodef document to a file if validation is passed.

Specified by:
validWrite in interface IodefDocumentWriter
Parameters:
key - Not used
iodef - an iodef docuemnt
Throws:
XMLValidationError - if validation is not passed
XMLWriteException - if writing goes wrong

validWrite

public void validWrite(IODEFDocument iodef)
                throws XMLValidationError,
                       XMLWriteException
Validates the iodef document and writes with XML document included iodef document to a file if validation is passed.

Specified by:
validWrite in interface IodefDocumentWriter
Parameters:
iodef - an iodef docuemnt
Throws:
XMLValidationError - if validation is not passed
XMLWriteException - if writing goes wrong