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