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%2Fintf%2FFormatClass.java;h=6be5dc6c38485fcf312b60b1c2ccee8878e76088;hp=f0376cffb9392fd108c958aeb930fded2df216d1;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.export.core/src/org/simantics/export/core/intf/FormatClass.java b/bundles/org.simantics.export.core/src/org/simantics/export/core/intf/FormatClass.java index f0376cffb..6be5dc6c3 100644 --- a/bundles/org.simantics.export.core/src/org/simantics/export/core/intf/FormatClass.java +++ b/bundles/org.simantics.export.core/src/org/simantics/export/core/intf/FormatClass.java @@ -1,112 +1,112 @@ -package org.simantics.export.core.intf; - -import java.io.File; -import java.util.List; - -import org.osgi.service.prefs.Preferences; -import org.simantics.databoard.binding.mutable.Variant; -import org.simantics.databoard.type.RecordType; -import org.simantics.export.core.ExportContext; -import org.simantics.export.core.error.ExportException; -import org.simantics.export.core.manager.Content; - -/** - * Format class contains format related code. - * - * @author toni.kalajainen@semantum.fi - */ -public interface FormatClass { - - /** - * Create a new file. Return a format specific writer object. - * - * @param context contextual data - * @param outputFile - * @param options - * @return writer - * @throws ExportException - */ - Object createFile( ExportContext context, File outputFile, Variant options ) throws ExportException; - - /** - * Open a file for reading. - * - * @param context - * @param inputFile - * @param options - * @throws ExportException - */ - Object openFile( ExportContext context, File inputFile, Variant options ) throws ExportException; - - /** - * Close a reader or writer object. - * - * ExportException is thrown if flushing of the file fails. This is a signal that - * the file is corrupted. The file is closed in all cases how ever. - * - * @param context - * @param handle - * @throws ExportException - */ - void closeFile( ExportContext context, Object handle ) throws ExportException; - - /** - * Add attachments to an open file handle. This method applies only to - * container files. - * - * @param context - * @param handle - * @param attachements - * @throws ExportException - */ - void addAttachment( ExportContext context, Object handle, List attachments ) throws ExportException; - - /** - * Get file format specific options. - * - * @param context - * @return a record type describing options - */ - RecordType options( ExportContext context ) throws ExportException; - - /** - * Validate that the options are usable for export. - * - * @param context - * @param options - * @return a list of errors - * @throws ExportException - */ - List validate( ExportContext context, Variant options ) throws ExportException; - - /** - * Fill options with default values. - * - * @param options - * @throws ExportException - */ - void fillDefaultPrefs( ExportContext context, Variant options ) throws ExportException; - - /** - * Save format options to preferences node(s). - * - * A preference value may or may not exist in the options object. - * - * @param options - * @param contentScopeNode - * @param workbenchScopeNode - * @throws ExportException - */ - void savePref( Variant options, Preferences contentScopeNode, Preferences workbenchScopeNode ) throws ExportException; - - /** - * Load format options from preferences node(s). - * - * @param options - * @param contentScopeNode - * @param workbenchScopeNode - * @throws ExportException - */ - void loadPref( Variant options, Preferences contentScopeNode, Preferences workbenchScopeNode ) throws ExportException; - -} +package org.simantics.export.core.intf; + +import java.io.File; +import java.util.List; + +import org.osgi.service.prefs.Preferences; +import org.simantics.databoard.binding.mutable.Variant; +import org.simantics.databoard.type.RecordType; +import org.simantics.export.core.ExportContext; +import org.simantics.export.core.error.ExportException; +import org.simantics.export.core.manager.Content; + +/** + * Format class contains format related code. + * + * @author toni.kalajainen@semantum.fi + */ +public interface FormatClass { + + /** + * Create a new file. Return a format specific writer object. + * + * @param context contextual data + * @param outputFile + * @param options + * @return writer + * @throws ExportException + */ + Object createFile( ExportContext context, File outputFile, Variant options ) throws ExportException; + + /** + * Open a file for reading. + * + * @param context + * @param inputFile + * @param options + * @throws ExportException + */ + Object openFile( ExportContext context, File inputFile, Variant options ) throws ExportException; + + /** + * Close a reader or writer object. + * + * ExportException is thrown if flushing of the file fails. This is a signal that + * the file is corrupted. The file is closed in all cases how ever. + * + * @param context + * @param handle + * @throws ExportException + */ + void closeFile( ExportContext context, Object handle ) throws ExportException; + + /** + * Add attachments to an open file handle. This method applies only to + * container files. + * + * @param context + * @param handle + * @param attachements + * @throws ExportException + */ + void addAttachment( ExportContext context, Object handle, List attachments ) throws ExportException; + + /** + * Get file format specific options. + * + * @param context + * @return a record type describing options + */ + RecordType options( ExportContext context ) throws ExportException; + + /** + * Validate that the options are usable for export. + * + * @param context + * @param options + * @return a list of errors + * @throws ExportException + */ + List validate( ExportContext context, Variant options ) throws ExportException; + + /** + * Fill options with default values. + * + * @param options + * @throws ExportException + */ + void fillDefaultPrefs( ExportContext context, Variant options ) throws ExportException; + + /** + * Save format options to preferences node(s). + * + * A preference value may or may not exist in the options object. + * + * @param options + * @param contentScopeNode + * @param workbenchScopeNode + * @throws ExportException + */ + void savePref( Variant options, Preferences contentScopeNode, Preferences workbenchScopeNode ) throws ExportException; + + /** + * Load format options from preferences node(s). + * + * @param options + * @param contentScopeNode + * @param workbenchScopeNode + * @throws ExportException + */ + void loadPref( Variant options, Preferences contentScopeNode, Preferences workbenchScopeNode ) throws ExportException; + +}