Commit 5eebe91b authored by R.W.Majeed's avatar R.W.Majeed
Browse files

static function for API use of XMLExport

parent 6c23d342
package de.sekmi.histream.etl; package de.sekmi.histream.etl;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.nio.file.Paths; import java.nio.file.Paths;
import javax.xml.stream.XMLStreamException;
import de.sekmi.histream.impl.Meta; import de.sekmi.histream.impl.Meta;
import de.sekmi.histream.io.GroupedXMLWriter; import de.sekmi.histream.io.GroupedXMLWriter;
...@@ -26,11 +30,15 @@ public class XMLExport { ...@@ -26,11 +30,15 @@ public class XMLExport {
System.err.println("Usage: XMLExport <import-descriptor-file>"); System.err.println("Usage: XMLExport <import-descriptor-file>");
System.exit(-1); System.exit(-1);
} }
ETLObservationSupplier suppl = ETLObservationSupplier.load(Paths.get(args[0]).toUri().toURL()); descriptorToXML(Paths.get(args[0]).toUri().toURL(), System.out);
GroupedXMLWriter writer = new GroupedXMLWriter(System.out); }
public static void descriptorToXML(URL importDescriptor, OutputStream out) throws IOException, ParseException, XMLStreamException {
ETLObservationSupplier suppl = ETLObservationSupplier.load(importDescriptor);
GroupedXMLWriter writer = new GroupedXMLWriter(out);
Meta.transfer(suppl, writer); Meta.transfer(suppl, writer);
Streams.transfer(suppl, writer); Streams.transfer(suppl, writer);
suppl.close(); suppl.close();
writer.close(); writer.close();
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment