java.lang.Object
org.odpi.openmetadata.adapters.connectors.integration.bitol.BitolDirectoryScanner

public class BitolDirectoryScanner extends Object
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.
  • Constructor Details

    • BitolDirectoryScanner

      public BitolDirectoryScanner(File directory, String sourceName)
      Constructor.
      Parameters:
      directory - directory to scan
      sourceName - where the directory name came from (for messages)
  • Method Details

    • getDirectory

      public File getDirectory()
      Return the directory being scanned.
      Returns:
      file
    • getSourceName

      public String getSourceName()
      Return where the directory name came from.
      Returns:
      string description
    • scan

      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 documents
      auditLog - logging destination
      connectorName - name of the calling connector (for messages)