]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.export.core/src/org/simantics/export/core/intf/ExportClass.java
ImportPdfReader now implements Closeable
[simantics/platform.git] / bundles / org.simantics.export.core / src / org / simantics / export / core / intf / ExportClass.java
1 package org.simantics.export.core.intf;
2
3 import java.util.Collection;
4 import java.util.List;
5
6 import org.eclipse.core.runtime.IProgressMonitor;
7 import org.osgi.service.prefs.Preferences;
8 import org.simantics.databoard.binding.mutable.Variant;
9 import org.simantics.databoard.type.RecordType;
10 import org.simantics.export.core.ExportContext;
11 import org.simantics.export.core.error.ExportException;
12 import org.simantics.export.core.manager.Content;
13 import org.simantics.utils.datastructures.MapList;
14
15 public interface ExportClass {
16         
17         /**
18          * Get extension specific options.
19          * 
20          * @param ctx
21          * @param contentUris
22          * @return a record type describing options 
23          */
24         RecordType options( ExportContext ctx, Collection<String> contentUris ) throws ExportException;
25         
26         /**
27          * Validate that the content can be exported. If not, an exception is thrown. 
28          * 
29          * @param contentUri
30          * @param writer
31          * @param context
32          * @param monitor
33          * @param options
34          * @return list of errors  
35          */
36         List<String> validate(
37                         String contentUri, 
38                         ExportContext context,
39                         Variant options);
40         
41         /**
42          * Write format specific content to a content writer. 
43          * 
44          * @param contentUris a list of uris
45          * @param writer a writer object that is created with format extension
46          * @param ctx export context
47          * @param options all export options in a variant
48          * @param monitor
49          * @param attachmentMap (optional) attachments 
50          * @throws ExportException
51          */
52         void export(
53                         List<Content> contents, 
54                         Object writer, 
55                         ExportContext ctx,
56                         Variant options,
57                         IProgressMonitor monitor, 
58                         MapList<Content, Content> attachmentMap
59                         ) throws ExportException;
60
61         /**
62          * Fill the options object with default values.
63          * 
64          * @param ctx 
65          * @param options
66          */
67         void fillDefaultPrefs( ExportContext ctx, Variant options ) throws ExportException;
68
69         /**
70          * Save export options to preferences node(s).
71          * 
72          * @param options
73          * @param contentScopePrefs
74          * @param workspaceScopePrefs
75          * @throws ExportException
76          */
77         void savePref( Variant options, Preferences contentScopePrefs, Preferences workspaceScopePrefs ) throws ExportException;
78         
79         /**
80          * Load export options from preferences node(s).
81          * 
82          * @param options
83          * @param contentScopeNode
84          * @param workspaceScopePrefs
85          * @throws ExportException
86          */
87         void loadPref( Variant options, Preferences contentScopeNode, Preferences workspaceScopePrefs ) throws ExportException;
88         
89 }