Package com.norconex.importer
Class Importer
java.lang.Object
com.norconex.importer.Importer
- All Implemented Interfaces:
Closeable,AutoCloseable
Principal class responsible for importing documents.
Refer to
ImporterConfig for configuration options.
Thread-safe, and reusing the same instance is highly recommended.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImporter()Creates a new importer with default configuration.Importer(ImporterConfig importerConfig) Creates a new importer with the given configuration.Importer(ImporterConfig importerConfig, EventManager eventManager) Creates a new importer with the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidclose()Closes the importer and its resources.booleanstatic Importerget()Gets the event manager.inthashCode()importDocument(Doc document) Imports a document according to the importer configuration.Imports a document according to the importer configuration.voidinit()Initializes the importer.static voidInvokes the importer from the command line.voidsetCache(DocHandlerCache cache) Sets the cache document handlers use for results expensive to obtain more than once for the same input (e.g., a call to a paid external API).toString()
-
Constructor Details
-
Importer
public Importer()Creates a new importer with default configuration. -
Importer
Creates a new importer with the given configuration.- Parameters:
importerConfig- Importer configuration
-
Importer
Creates a new importer with the given configuration.- Parameters:
importerConfig- Importer configurationeventManager- event manager
-
-
Method Details
-
get
-
main
Invokes the importer from the command line.- Parameters:
args- Invoke it once without any arguments to get a list of command-line options.
-
getEventManager
Gets the event manager.- Returns:
- event manager
-
setCache
Sets the cache document handlers use for results expensive to obtain more than once for the same input (e.g., a call to a paid external API). PassingnullrestoresDocHandlerCache.NOOP.- Parameters:
cache- the cache to supply to handlers
-
importDocument
Imports a document according to the importer configuration.- Parameters:
req- request instructions for importing- Returns:
- importer response
-
importDocument
Imports a document according to the importer configuration.- Parameters:
document- the document to import- Returns:
- importer response
-
init
public void init()Initializes the importer. Invokesiniton all handlers. If not explicitly called first, it is called implicitly by one of the import method, only once per importer instance. -
close
public void close()Closes the importer and its resources. Has to be invoked explicitly when the importer is no longer in use.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getConfiguration
-