]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.fileimport/src/org/simantics/fileimport/IGenericFileImport.java
Some fileimport enhancements - Add support for Excel import
[simantics/platform.git] / bundles / org.simantics.fileimport / src / org / simantics / fileimport / IGenericFileImport.java
1 package org.simantics.fileimport;
2
3 import java.nio.file.Path;
4 import java.util.Map;
5 import java.util.Optional;
6
7 import org.simantics.db.Resource;
8
9 /**
10  * Base interface for performing file imports. 
11  * 
12  * Usually with Simantics products every file that will be imported will become 
13  * a resource in the Simantics database. For these cases see {@link SimanticsResourceFileImport}
14  * 
15  * @author Jani Simomaa
16  *
17  */
18 public interface IGenericFileImport {
19
20     /**
21      * Performs the import for the given file
22      * 
23      * @param file Path to file to import
24      * @return Optional string which will be the identifier of the imported file which can later be used for removing the imported entity
25      * @throws Exception
26      */
27     Optional<String> perform(Path file) throws Exception;
28
29     Optional<Resource> perform(Resource parent, Path file) throws Exception;
30     
31     /**
32      * Remove the entity
33      * 
34      * @param identifier String identifier which can be used to remove the imported entity
35      */
36     void remove(String identifier) throws Exception;
37     
38     /**
39      * Returns a key-value map for file extensions this importer can handle
40      * 
41      * @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
42      */
43     Map<String, String> allowedExtensionsWithFilters();
44
45 }