Class DatabaseFolderImporter
- java.lang.Object
-
- com.biomatters.geneious.publicapi.plugin.DatabaseFolderImporter
-
public abstract class DatabaseFolderImporter extends java.lang.Object
An importer for folders containing files that must be imported as a set, and cannot be handled by the normalDocumentFileImporter
framework. If you need to import multiple files at once that may depend on one another, you should normally extendDocumentFileImporter
. The advantage of extendingDatabaseFolderImporter
is that it provides the ability to reproduce the structure of a database or file system in the imported result. A plugin may provide a set ofDatabaseFolderImporter
s viaGeneiousPlugin.getDatabaseFolderImporters()
.- Since:
- API 4.201920 (Geneious Prime 2019.2.0)
- See Also:
DocumentFileImporter
-
-
Constructor Summary
Constructors Constructor Description DatabaseFolderImporter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String
getDatabaseTypeDescription()
abstract Options
getOptions(java.io.File folder, WritableDatabaseService destination, jebl.util.ProgressListener progress)
Provides some options applicable to this database importer to the user, or null if no user-specified options are required.java.lang.String
getUniqueId()
Get a unique identifier for this DocumentFileImporter.abstract WritableDatabaseService
importFolder(java.io.File folder, WritableDatabaseService destination, Options options, jebl.util.ProgressListener progress)
Import the external database to a GeneiousWritableDatabaseService
and report back the containing the added documents.abstract DocumentFileImporter.AutoDetectStatus
tentativeAutoDetect(java.io.File folder)
Attempts to detect whether a folder has the right structure for this importer.
-
-
-
Method Detail
-
importFolder
public abstract WritableDatabaseService importFolder(java.io.File folder, WritableDatabaseService destination, Options options, jebl.util.ProgressListener progress) throws DocumentImportException, java.io.IOException
Import the external database to a GeneiousWritableDatabaseService
and report back the containing the added documents. The return value should normally be a newly-added folder.- Parameters:
folder
- The folder containing the external database in the file systemdestination
- parent folder where the folder will be imported- Returns:
- Geneious service containing the documents added to the Geneious database
- Throws:
DocumentImportException
java.io.IOException
- Since:
- API 4.201920 (Geneious Prime 2019.2.0)
-
getOptions
public abstract Options getOptions(java.io.File folder, WritableDatabaseService destination, jebl.util.ProgressListener progress) throws DocumentImportException
Provides some options applicable to this database importer to the user, or null if no user-specified options are required. This is guaranteed to be called beforeimportFolder(File, WritableDatabaseService, Options, ProgressListener)
. The same Options object will be passed toimportFolder(File, WritableDatabaseService, Options, ProgressListener)
if the user clicks "Ok". The necessary values can then be extracted from it.- Parameters:
folder
- The folder containing the external database in the file systemdestination
- parent folder where the folder will be importedprogress
-- Returns:
- Options to be used for importing the database folder
- Throws:
DocumentImportException
- Since:
- API 4.201920 (Geneious Prime 2019.2.0)
-
tentativeAutoDetect
public abstract DocumentFileImporter.AutoDetectStatus tentativeAutoDetect(java.io.File folder)
Attempts to detect whether a folder has the right structure for this importer. This method should return quickly, and in particular it shouldn't normally attempt to parse any files in the folder. The folder parameter is provided to make it possible to quickly examine the directory structure to determine whether it appears to be correct. Parsing a small file to determine e.g., version compatibility, is permissible. Because this method shouldn't normally parse any files, it is also permissible in rare cases to return ACCEPT here even if the import will fail later on. However this method should never return REJECT if there is a chance that the file might be valid. This method also should not default to MAYBE in all cases where it cannot rightly return ACCEPT. It would then become the default importer for all folders it would be the only MAYBE returned for those files.- Returns:
- Since:
- API 4.201920 (Geneious Prime 2019.2.0)
-
getUniqueId
public java.lang.String getUniqueId()
Get a unique identifier for this DocumentFileImporter. This is so thatPluginUtilities.getDatabaseFolderImporter(String)
can be used to find this DocumentFileImporter. A unique identifier may consist of any valid Java indentifier characters (seeCharacter.isJavaIdentifierPart(char)
as well as to the space character.- Returns:
- a unique identifier for this DocumentFileImporter. The default implementation returns the className.
- Since:
- API 4.201920 (Geneious Prime 2019.2.0)
-
getDatabaseTypeDescription
public abstract java.lang.String getDatabaseTypeDescription()
- Returns:
- The database type description. E.g.: "Some Application database"
- Since:
- API 4.201920 (Geneious Prime 2019.2.0)
-
-