]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.export.core/src/org/simantics/export/core/intf/PublisherClass.java
ImportPdfReader now implements Closeable
[simantics/platform.git] / bundles / org.simantics.export.core / src / org / simantics / export / core / intf / PublisherClass.java
1 package org.simantics.export.core.intf;
2
3 import java.util.List;
4
5 import org.eclipse.core.runtime.IProgressMonitor;
6 import org.osgi.service.prefs.Preferences;
7 import org.simantics.databoard.binding.mutable.Variant;
8 import org.simantics.databoard.type.RecordType;
9 import org.simantics.export.core.ExportContext;
10 import org.simantics.export.core.error.ExportException;
11 import org.simantics.export.core.manager.Content;
12
13 /**
14  * Interface for publisher implementations.
15  *
16  * @author toni.kalajainen@semantum.fi
17  */
18 public interface PublisherClass {
19         
20         /**
21          * Publish content
22          * 
23          * @param ctx
24          * @param contents
25          * @param options all options 
26          * @param location location settings
27          * @param progress (Optional) progress monitor
28          * @throws ExportException 
29          */
30         void publish( ExportContext ctx, List<Content> contents, Variant options, Variant location, IProgressMonitor progress ) throws ExportException;
31         
32         /**
33          * Validate before publish 
34          * 
35          * @param ctx
36          * @param contents
37          * @param options overall all options
38          * @param location location settings
39          * @return
40          * @throws ExportException 
41          */
42         List<String> validate( ExportContext ctx, List<Content> contents, Variant options, Variant location ) throws ExportException;
43         
44         //// Location Management ////
45         
46         /**
47          * Get all location options (even the ones that are hidden from the end-user)  
48          * 
49          * @param ctx
50          * @param contents contents to publish
51          * @param options all options
52          * @return
53          * @throws ExportException
54          */
55         RecordType locationOptions( ExportContext ctx, List<Content> contents ) throws ExportException;
56         
57         /**
58          * Create or edit location. This may cause blocking UI operation.
59          * 
60          * @param ctx
61          * @param location Some location settings
62          * @return new or modified location
63          * @throws ExportException
64          */
65         Variant createLocation( ExportContext ctx, Variant location ) throws ExportException;
66         
67         /**
68          * Checks if location exists.
69          * 
70          * @param ctx
71          * @param location
72          * @return true if location exists
73          * @throws ExportException
74          */
75         boolean locationExists( ExportContext ctx, Variant location ) throws ExportException;
76         
77         /**
78          * Fill default location values to location
79          * 
80          * @param ctx
81          * @param contents
82          * @param options
83          * @param locationOptions
84          * @throws ExportException
85          */
86         void fillDefaultPrefs( ExportContext ctx, List<Content> contents, Variant options, Variant locationOptions ) throws ExportException;
87         
88         /**
89          * Save location options to preferences node(s).
90          * 
91          * @param locationOptions
92          * @param contentScopePrefs
93          * @param workspaceScopePrefs
94          * @throws ExportException
95          */
96         void savePref( Variant locationOptions, Preferences contentScopePrefs, Preferences workspaceScopePrefs ) throws ExportException;
97         
98         /**
99          * Load location options from preferences node(s).
100          * 
101          * @param locationOptions
102          * @param contentScopePrefs
103          * @param workspaceScopePrefs
104          * @throws ExportException
105          */
106         void loadPref( Variant locationOptions, Preferences contentScopePrefs, Preferences workspaceScopePrefs ) throws ExportException;
107
108 }