Package net.sf.basedb.util
Class AutoDetectFileFormat
java.lang.Object
net.sf.basedb.util.AutoDetectFileFormat
This class has methods for autodetecting file formats.
- Version:
- 2.0
- Author:
- Nicklas
- Last modified
- $Date: 2022-12-20 14:16:51 +0100 (Tue, 20 Dec 2022) $
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Filter implementation that filters a collection ofContextUtil.ContextResult
:s by checking each plug-ins ability to import a given file. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
checkImportable
(SessionControl sc, PluginDefinition plugin, PluginConfiguration config, File file, String charset, GuiContext context, Object currentItem) static Map<PluginDefinition,
List<PluginConfiguration>> findPlugins
(DbControl dc, GuiContext context, File file, String charset, PluginDefinition pluginDef) Find all plugins with configurations which can import the specified file.
-
Constructor Details
-
AutoDetectFileFormat
public AutoDetectFileFormat()
-
-
Method Details
-
findPlugins
public static Map<PluginDefinition,List<PluginConfiguration>> findPlugins(DbControl dc, GuiContext context, File file, String charset, PluginDefinition pluginDef) throws InvalidDataException, BaseException Find all plugins with configurations which can import the specified file. This method will check all plugins implementing theAutoDetectingImporter
interface if they can import the specified file.- Parameters:
dc
- TheDbControl
object to use for database accesscontext
- A required context for the plugins (ie. what items to import)file
- The file to importcharset
- If given, overrides the character set specified by the fileFile.getCharacterSet()
pluginDef
- Check only the configurations of this plugin definition, or null if all plugin definitions should be checked- Returns:
- A map which for each plugin definition contains a list of mathching configurations
- Throws:
InvalidDataException
- If the file parameter is null or if the file isn't located inLocation.PRIMARY
storageBaseException
- If there is another error- Since:
- 2.9
-
checkImportable
private static boolean checkImportable(SessionControl sc, PluginDefinition plugin, PluginConfiguration config, File file, String charset, GuiContext context, Object currentItem)
-