java.lang.Object
org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
org.odpi.openmetadata.adapters.connectors.integration.basicfiles.DirectoryToMonitor
All Implemented Interfaces:
FileDirectoryListenerInterface, FileListenerInterface
Direct Known Subclasses:
DataFilesMonitorForTarget, DataFolderMonitorForTarget

public abstract class DirectoryToMonitor extends AuditLoggingBase implements FileDirectoryListenerInterface
Directory to monitor caches information about a specific directory that is at the root of the monitoring.
  • Field Details

    • propertyHelper

      protected final PropertyHelper propertyHelper
    • integrationConnector

      protected final BasicFilesMonitorIntegrationConnectorBase integrationConnector
    • connectorName

      protected final String connectorName
    • sourceName

      protected String sourceName
      Where did information about this directory come from?
    • directoryName

      protected String directoryName
      What is the short name for this directory?
    • fileSystemName

      protected String fileSystemName
      Default values for the file system name and mount point.
    • localMountPoint

      protected String localMountPoint
    • canonicalMountPoint

      protected String canonicalMountPoint
    • directoryFile

      protected File directoryFile
      This is the Java File object that is accessing the directory.
    • isListening

      protected boolean isListening
      This boolean indicates that the connector is registered to listen for changes in the directory.
    • catalogTargetGUID

      protected final String catalogTargetGUID
      This is the unique identifier of the CatalogTarget relationship that this directory matches. Null means the value was supplied in the endpoint.
    • dataFolderGUID

      protected String dataFolderGUID
    • fileSystemProperties

      protected final FileSystemProperties fileSystemProperties
    • configurationProperties

      protected final Map<String,Object> configurationProperties
    • templates

      protected final Map<String,String> templates
      Templates for cataloguing files and folders
    • toDoTemplateQualifiedName

      protected String toDoTemplateQualifiedName
      Template for creating todos
    • toDoTemplateGUID

      protected String toDoTemplateGUID
    • incidentReportTemplateQualifiedName

      protected String incidentReportTemplateQualifiedName
      Template for creating incident reports
    • incidentReportTemplateGUID

      protected String incidentReportTemplateGUID
    • newFileProcessName

      protected String newFileProcessName
    • allowCatalogDelete

      protected boolean allowCatalogDelete
      Policy for deleting
    • waitForDirectory

      protected boolean waitForDirectory
      Does the physical directory have to exist or will it wait?
    • catalogClassifiedFiles

      protected boolean catalogClassifiedFiles
      Should only file types that are recognized by the classifier be catalogued.
    • fallbackZones

      protected List<String> fallbackZones
      Governance zones for a new file that has no catalogued parent folder with zones.
    • parentFolders

      protected final Map<String,ParentFolder> parentFolders
      The nearest catalogued folder for each directory, keyed by the directory's canonical path name. It is emptied at the start of each refresh, and each file event, so that a change to a folder's zones is picked up.
    • metadataSourceGUID

      protected String metadataSourceGUID
    • metadataSourceName

      protected String metadataSourceName
  • Constructor Details

    • DirectoryToMonitor

      public DirectoryToMonitor(String connectorName, String sourceName, String pathName, String catalogTargetGUID, String dataFolderGUID, DeleteMethod deleteMethod, Map<String,String> templates, FileSystemProperties fileSystemProperties, Map<String,Object> configurationProperties, BasicFilesMonitorIntegrationConnectorBase integrationConnector, AuditLog auditLog)
      Construct the monitor for a specific catalog target.
      Parameters:
      connectorName - name of associated connector
      sourceName - source of the pathname
      pathName - pathname to the directory
      catalogTargetGUID - optional catalog target GUID
      dataFolderGUID - optional GUID of the data folder element
      deleteMethod - should the connector use delete or archive?
      templates - names and GUIDs of templates
      fileSystemProperties - properties of the file system
      configurationProperties - parameters to further modify the behaviour of the connector
      integrationConnector - associated connector
      auditLog - logging destination
  • Method Details

    • getDataFolderElement

      protected OpenMetadataRootElement getDataFolderElement() throws ConnectorCheckedException
      Return the data folder element for this directory.
      Returns:
      root element for the data folder
      Throws:
      ConnectorCheckedException - problem accessing information
    • getLocalFile

      protected File getLocalFile(String cataloguedPathName) throws IOException
      Return the file on this machine for a path name from the catalog. Path names in the catalog start at the canonical mount point, which is not necessarily where the file system is mounted on this machine.
      Parameters:
      cataloguedPathName - path name from a catalogued file or folder
      Returns:
      file to use on this machine
      Throws:
      IOException - unable to resolve the local mount point
    • getParentFolder

      Find the nearest catalogued folder above a file. The folder that is this monitor's catalog target is the folder for the directory being monitored, whatever path name it was catalogued with. Other folders are found by their path name.
      Parameters:
      file - file that is about to be catalogued
      fileClassifier - used to convert a local path name into the canonical path name used in the catalog
      Returns:
      description of the parent folder or null if there is no catalogued folder above the file
      Throws:
      InvalidParameterException - invalid parameter
      PropertyServerException - unable to communicate with the repository
      UserNotAuthorizedException - access problem for userId
      IOException - unable to work with the directory
      ConnectorCheckedException - unable to retrieve the catalog target
    • refresh

      public abstract void refresh() throws ConnectorCheckedException
      Requests that the connector does a comparison of the metadata in the third party technology and open metadata repositories. Refresh is called when the integration connector first starts and then at intervals defined in the connector's configuration as well as any external REST API calls to explicitly refresh the connector.
      Throws:
      ConnectorCheckedException - a problem with the connector. It is not able to refresh the metadata.