org.apache.torque.betwixt
Class Exporter

java.lang.Object
  extended by org.apache.torque.betwixt.XMLEventNotifier
      extended by org.apache.torque.betwixt.Exporter

public class Exporter
extends XMLEventNotifier

Support for converting Torque (and other Betwixted mapped objects) in a Dataset object into XML format. It extends XMLEventNotifier, but does not make any notification calls.

Author:
Greg Monroe

Field Summary
 
Fields inherited from class org.apache.torque.betwixt.XMLEventNotifier
ACTION_ADD, ACTION_DELETE, ACTION_ERROR, ACTION_INFO, ACTION_TYPE, ACTION_UPDATE, EXPORT_END, EXPORT_RECORD, EXPORT_START, IMPORT_END, IMPORT_START
 
Constructor Summary
Exporter()
           
 
Method Summary
 org.apache.commons.betwixt.io.BeanWriter createBeanWriter(java.io.Writer outputWriter, Resolver resolver)
          Create the BeanWriter object to use to write data out.
 void exportData(Dataset dataset, java.io.Writer outputWriter, Resolver resolver)
          Write the records in a dataset to XML
 void writeData(Dataset dataset, org.apache.commons.betwixt.io.BeanWriter beanWriter)
          Write the records in this dataset to XML
 void writeHeaderInfo(org.apache.commons.betwixt.io.BeanWriter beanWriter, Resolver resolver)
          Calls the full writeHeaderInfo method with "dataset" as the default element and uses the resolver information to create a SYSTEM Doctype heading.
 void writeHeaderInfo(org.apache.commons.betwixt.io.BeanWriter beanWriter, Resolver resolver, java.lang.String rootElement, boolean isSystem, java.lang.String publicId, java.lang.String uri)
          Writes the standard xml version processing info and a custom DOCTYPE header to the XML output file.
 
Methods inherited from class org.apache.torque.betwixt.XMLEventNotifier
deregisterListener, getListeners, notifyListeners, registerListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exporter

public Exporter()
Method Detail

exportData

public void exportData(Dataset dataset,
                       java.io.Writer outputWriter,
                       Resolver resolver)
                throws java.io.IOException,
                       java.beans.IntrospectionException,
                       org.xml.sax.SAXException,
                       java.lang.Exception
Write the records in a dataset to XML

Parameters:
dataset - The records to export.
outputWriter - The writer that will get the XML.
resolver - Resolve various information requirements.
Throws:
java.io.IOException
java.beans.IntrospectionException
org.xml.sax.SAXException
java.lang.Exception

writeHeaderInfo

public void writeHeaderInfo(org.apache.commons.betwixt.io.BeanWriter beanWriter,
                            Resolver resolver)
                     throws java.io.IOException,
                            java.lang.IllegalStateException
Calls the full writeHeaderInfo method with "dataset" as the default element and uses the resolver information to create a SYSTEM Doctype heading.

Throws:
java.io.IOException
java.lang.IllegalStateException

writeHeaderInfo

public void writeHeaderInfo(org.apache.commons.betwixt.io.BeanWriter beanWriter,
                            Resolver resolver,
                            java.lang.String rootElement,
                            boolean isSystem,
                            java.lang.String publicId,
                            java.lang.String uri)
                     throws java.io.IOException,
                            java.lang.IllegalStateException
Writes the standard xml version processing info and a custom DOCTYPE header to the XML output file. Must be called prior to writeData for valid XML to be created.

Parameters:
beanWriter - The output writer
resolver - The resolver object with DTD info set.
rootElement - The root element of the data that will be output, e.g. dataset.
isSystem - If true, the DOCTYPE will be a "System" format and not a public ID format.
publicId - The public ID to use if needed. Can be null if isSystem is true.
uri - The URI to the DTD file to use for validation. If null, the Resolver will be used.
Throws:
java.io.IOException
java.lang.IllegalStateException

writeData

public void writeData(Dataset dataset,
                      org.apache.commons.betwixt.io.BeanWriter beanWriter)
               throws java.io.IOException,
                      java.beans.IntrospectionException,
                      org.xml.sax.SAXException
Write the records in this dataset to XML

Throws:
java.io.IOException
org.xml.sax.SAXException
java.beans.IntrospectionException

createBeanWriter

public org.apache.commons.betwixt.io.BeanWriter createBeanWriter(java.io.Writer outputWriter,
                                                                 Resolver resolver)
                                                          throws java.io.IOException,
                                                                 java.beans.IntrospectionException,
                                                                 org.xml.sax.SAXException,
                                                                 java.lang.Exception
Create the BeanWriter object to use to write data out.

Parameters:
outputWriter - The writer that get the XML output.
resolver - A resolver object to locate needed information.
Returns:
A Betwixt BeanWriter to use in writing the XML data.
Throws:
java.io.IOException
java.beans.IntrospectionException
org.xml.sax.SAXException
java.lang.Exception


Copyright © 2006 Torque Add-ons Project. All Rights Reserved.