]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.fileimport/src/org/simantics/fileimport/IGenericFileImport.java
Sync git svn branch with SVN repository r33189.
[simantics/platform.git] / bundles / org.simantics.fileimport / src / org / simantics / fileimport / IGenericFileImport.java
1 package org.simantics.fileimport;\r
2 \r
3 import java.nio.file.Path;\r
4 import java.util.Map;\r
5 import java.util.Optional;\r
6 \r
7 /**\r
8  * Base interface for performing file imports. \r
9  * \r
10  * Usually with Simantics products every file that will be imported will become \r
11  * a resource in the Simantics database. For these cases see {@link SimanticsResourceFileImport}\r
12  * \r
13  * @author Jani Simomaa\r
14  *\r
15  */\r
16 public interface IGenericFileImport {\r
17 \r
18     /**\r
19      * Performs the import for the given file\r
20      * \r
21      * @param file Path to file to import\r
22      * @return Optional string which will be the identifier of the imported file which can later be used for removing the imported entity\r
23      * @throws Exception\r
24      */\r
25     Optional<String> perform(Path file) throws Exception;\r
26 \r
27     /**\r
28      * Remove the entity\r
29      * \r
30      * @param identifier String identifier which can be used to remove the imported entity\r
31      */\r
32     void remove(String identifier) throws Exception;\r
33     \r
34     /**\r
35      * Returns a key-value map for file extensions this importer can handle\r
36      * \r
37      * @return Map<String, String> allowed extensions this service can handle. Key is the extension e.g. <code>.sharedLibrary</code> and the value is the description of the extension\r
38      */\r
39     Map<String, String> allowedExtensionsWithFilters();\r
40 \r
41 }\r