Class BitolDirectoryScanner
java.lang.Object
org.odpi.openmetadata.adapters.connectors.integration.bitol.BitolDirectoryScanner
BitolDirectoryScanner watches a directory tree (for example a git checkout or a drop folder) for Bitol documents.
On each scan it looks for YAML and JSON files whose "kind" is DataContract or DataProduct and publishes those that
are new, or have changed since they were last published. Hidden directories (such as .git) are skipped.
The scanner remembers the last modified time of each file it has processed so that a document is only published
once per change. A file that is not a Bitol document (for example a build configuration in YAML) is remembered too,
so it is only re-examined when it changes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback used to publish a document found by the scanner.static final recordDescription of a document published during a scan. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the directory being scanned.Return where the directory name came from.scan(BitolDirectoryScanner.DocumentPublisher publisher) Scan the directory tree and publish the new and changed Bitol documents.voidscanAndPublish(IntegrationContext integrationContext, AuditLog auditLog, String connectorName) Scan the directory tree, publish the new and changed documents through the integration context and write the outcome to the audit log.
-
Constructor Details
-
BitolDirectoryScanner
Constructor.- Parameters:
directory- directory to scansourceName- where the directory name came from (for messages)
-
-
Method Details
-
getDirectory
Return the directory being scanned.- Returns:
- file
-
getSourceName
Return where the directory name came from.- Returns:
- string description
-
scan
public List<BitolDirectoryScanner.PublishedDocument> scan(BitolDirectoryScanner.DocumentPublisher publisher) throws IOException Scan the directory tree and publish the new and changed Bitol documents.- Parameters:
publisher- callback that receives each document- Returns:
- the documents published by this scan
- Throws:
IOException- the directory can not be read
-
scanAndPublish
public void scanAndPublish(IntegrationContext integrationContext, AuditLog auditLog, String connectorName) Scan the directory tree, publish the new and changed documents through the integration context and write the outcome to the audit log. Problems reading the directory are logged rather than thrown so that the connector carries on with its other directories and retries on the next refresh.- Parameters:
integrationContext- context used to publish the documentsauditLog- logging destinationconnectorName- name of the calling connector (for messages)
-