Search in sources :

Example 6 with ProcessingException

use of org.opensextant.processing.ProcessingException in project Xponents by OpenSextant.

the class FormatterFactory method getInstance.

/**
     * Supported formats are CSV, WKT, HTML, KML, Shapefile, GDB, JSON
     *
     * @param fmt format name
     * @return Implentation of ResultsFormatter
     * @throws ProcessingException if Java class for formatter is not found
     */
public static ResultsFormatter getInstance(String fmt) throws ProcessingException {
    String formatterClass = OUTPUT_FORMATS_LOOKUP.get(fmt.toLowerCase());
    if (formatterClass == null) {
        throw new ProcessingException("Unsupported Formatter: " + fmt);
    }
    formatterClass = PKG + "." + formatterClass + "Formatter";
    try {
        return (ResultsFormatter) (Class.forName(formatterClass)).newInstance();
    } catch (ClassNotFoundException e) {
        throw new ProcessingException("Formatter not found for " + fmt, e);
    } catch (InstantiationException e) {
        throw new ProcessingException("Formatter could not start for " + fmt, e);
    } catch (IllegalAccessException e) {
        throw new ProcessingException("Formatter could not start for " + fmt, e);
    }
}
Also used : ProcessingException(org.opensextant.processing.ProcessingException)

Aggregations

ProcessingException (org.opensextant.processing.ProcessingException)6 ConfigException (org.opensextant.ConfigException)3 AbstractFormatter (org.opensextant.output.AbstractFormatter)2 IOException (java.io.IOException)1 PlaceGeocoder (org.opensextant.extractors.geo.PlaceGeocoder)1 XTemporal (org.opensextant.extractors.xtemporal.XTemporal)1 ContainerStart (org.opensextant.giscore.events.ContainerStart)1 DocumentStart (org.opensextant.giscore.events.DocumentStart)1 GISDataFormatter (org.opensextant.output.GISDataFormatter)1 XText (org.opensextant.xtext.XText)1 CsvMapWriter (org.supercsv.io.CsvMapWriter)1