X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.export.core%2Fsrc%2Forg%2Fsimantics%2Fexport%2Fcore%2Fmanager%2FTransferableGraphWriter.java;fp=bundles%2Forg.simantics.export.core%2Fsrc%2Forg%2Fsimantics%2Fexport%2Fcore%2Fmanager%2FTransferableGraphWriter.java;h=91372ec2135198ab33bc2320806dee7f1dcfcf81;hp=209b455cb353717256ccf592fb161b0809986f4d;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.export.core/src/org/simantics/export/core/manager/TransferableGraphWriter.java b/bundles/org.simantics.export.core/src/org/simantics/export/core/manager/TransferableGraphWriter.java index 209b455cb..91372ec21 100644 --- a/bundles/org.simantics.export.core/src/org/simantics/export/core/manager/TransferableGraphWriter.java +++ b/bundles/org.simantics.export.core/src/org/simantics/export/core/manager/TransferableGraphWriter.java @@ -1,79 +1,79 @@ -package org.simantics.export.core.manager; - -import java.io.File; -import java.io.IOException; -import java.util.TreeMap; - -import org.simantics.databoard.binding.Binding; -import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.databoard.container.DataContainer; -import org.simantics.databoard.container.DataContainers; -import org.simantics.db.RequestProcessor; -import org.simantics.export.core.error.ExportException; -import org.simantics.graph.db.TransferableGraphSource; -import org.simantics.graph.db.TransferableGraphs; - -public class TransferableGraphWriter { - - public final File file; - public final String format; - public final int version; - - public TransferableGraphWriter(File file, String format, int version) { - this.file = file; - this.format = format; - this.version = version; - } - - /** - * Write TG to the file that is associated with this writer. - * - * @param tgBinding - * @param tg - * @throws ExportException - */ - public void writeFile(Binding tgBinding, Object tg) throws ExportException { - try { - Variant variant = new Variant(tgBinding, tg); - DataContainer dataContainer = new DataContainer(format, version, variant); - DataContainers.writeFile(file, dataContainer); - } catch (IOException e) { - throw new ExportException( "I/O Error occured: "+e.getMessage() ); - } - } - - /** - * Write from TG Source to the file that is associated with this writer. - * - * @param session request processor to be used for reading the source - * @param source TG source - * @throws ExportException - */ - public void writeFile(RequestProcessor session, TransferableGraphSource source) throws ExportException - { - writeFile(session, source, new TreeMap()); - } - - /** - * Write from TG Source to the file that is associated with this writer. - * - * @param session request processor to be used for reading the source - * @param source TG source - * @throws ExportException - */ - public void writeFile(RequestProcessor session, TransferableGraphSource source, TreeMap metadata) throws ExportException - { - try { - TransferableGraphs.writeTransferableGraph( - session, - format, - version, - metadata, - source, - file); - } catch (Exception e) { - throw new ExportException(e); - } - } - -} +package org.simantics.export.core.manager; + +import java.io.File; +import java.io.IOException; +import java.util.TreeMap; + +import org.simantics.databoard.binding.Binding; +import org.simantics.databoard.binding.mutable.Variant; +import org.simantics.databoard.container.DataContainer; +import org.simantics.databoard.container.DataContainers; +import org.simantics.db.RequestProcessor; +import org.simantics.export.core.error.ExportException; +import org.simantics.graph.db.TransferableGraphSource; +import org.simantics.graph.db.TransferableGraphs; + +public class TransferableGraphWriter { + + public final File file; + public final String format; + public final int version; + + public TransferableGraphWriter(File file, String format, int version) { + this.file = file; + this.format = format; + this.version = version; + } + + /** + * Write TG to the file that is associated with this writer. + * + * @param tgBinding + * @param tg + * @throws ExportException + */ + public void writeFile(Binding tgBinding, Object tg) throws ExportException { + try { + Variant variant = new Variant(tgBinding, tg); + DataContainer dataContainer = new DataContainer(format, version, variant); + DataContainers.writeFile(file, dataContainer); + } catch (IOException e) { + throw new ExportException( "I/O Error occured: "+e.getMessage() ); + } + } + + /** + * Write from TG Source to the file that is associated with this writer. + * + * @param session request processor to be used for reading the source + * @param source TG source + * @throws ExportException + */ + public void writeFile(RequestProcessor session, TransferableGraphSource source) throws ExportException + { + writeFile(session, source, new TreeMap()); + } + + /** + * Write from TG Source to the file that is associated with this writer. + * + * @param session request processor to be used for reading the source + * @param source TG source + * @throws ExportException + */ + public void writeFile(RequestProcessor session, TransferableGraphSource source, TreeMap metadata) throws ExportException + { + try { + TransferableGraphs.writeTransferableGraph( + session, + format, + version, + metadata, + source, + file); + } catch (Exception e) { + throw new ExportException(e); + } + } + +}