1 package org.simantics.fileimport;
3 import java.nio.file.Path;
5 import java.util.Optional;
7 import org.simantics.db.Resource;
10 * Base interface for performing file imports.
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}
15 * @author Jani Simomaa
18 public interface IGenericFileImport {
21 * Performs the import for the given file
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
27 Optional<String> perform(Path file) throws Exception;
29 Optional<Resource> perform(Resource parent, Path file) throws Exception;
34 * @param identifier String identifier which can be used to remove the imported entity
36 void remove(String identifier) throws Exception;
39 * Returns a key-value map for file extensions this importer can handle
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
43 Map<String, String> allowedExtensionsWithFilters();