2.17.2: 2011-06-17

net.sf.basedb.util
Class AutoDetectFileFormat

java.lang.Object
  extended by net.sf.basedb.util.AutoDetectFileFormat

public class AutoDetectFileFormat
extends Object

This class has methods for autodetecting file formats.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2011-03-15 14:53:10 +0100 (Tue, 15 Mar 2011) $

Nested Class Summary
static class AutoDetectFileFormat.IsImportableFilter
          Filter implementation that filters a collection of ContextUtil.ContextResult:s by checking each plug-ins ability to import a given file.
 
Constructor Summary
AutoDetectFileFormat()
           
 
Method Summary
private 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, PluginDefinition pluginDef)
          Deprecated.  
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoDetectFileFormat

public AutoDetectFileFormat()
Method Detail

findPlugins

public static Map<PluginDefinition,List<PluginConfiguration>> findPlugins(DbControl dc,
                                                                          GuiContext context,
                                                                          File file,
                                                                          PluginDefinition pluginDef)
                                                                   throws InvalidDataException,
                                                                          BaseException
Deprecated. 

Same as findPlugins(DbControl, GuiContext, File, String, PluginDefinition) with no value for the charset parameter.

Throws:
InvalidDataException
BaseException

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 the AutoDetectingImporter interface if they can import the specified file.

Parameters:
dc - The DbControl object to use for database access
context - A required context for the plugins (ie. what items to import)
file - The file to import
charset - If given, overrides the character set specified by the file File.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 in Location.PRIMARY storage
BaseException - 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)

2.17.2: 2011-06-17