Class DataFilesMonitorForTarget

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

public class DataFilesMonitorForTarget extends DirectoryToMonitor
Manages the cataloguing of data files for a specific catalog target.
  • Constructor Details

    • DataFilesMonitorForTarget

      public DataFilesMonitorForTarget(String connectorName, String sourceName, String pathName, String catalogTargetGUID, DeleteMethod deleteMethod, Map<String,String> templates, Map<String,Object> configurationProperties, BasicFilesMonitorIntegrationConnectorBase integrationConnector, FileFolderElement dataFolderElement, 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
      deleteMethod - should the connector use delete or archive?
      templates - names and GUIDs of templates
      configurationProperties - parameters to further modify the behaviour of the connector
      integrationConnector - associated connector
      dataFolderElement - Egeria element for this directory
      auditLog - logging destination
  • Method Details

    • refresh

      public 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.
      This method performs two sweeps. It first retrieves the files in the directory and validates that are in the catalog - adding or updating them if necessary. The second sweep is to ensure that all the assets catalogued in this directory actually exist on the file system.
      Specified by:
      refresh in class DirectoryToMonitor
      Throws:
      ConnectorCheckedException - there is a problem with the connector. It is not able to refresh the metadata.
    • onFileCreate

      public void onFileCreate(File file)
      File created Event.
      Parameters:
      file - The file that was created
    • onFileDelete

      public void onFileDelete(File file)
      Description copied from interface: FileListenerInterface
      File deleted Event.
      Parameters:
      file - The file that was deleted
    • onFileChange

      public void onFileChange(File file)
      File changed Event.
      Parameters:
      file - The file that changed
    • onDirectoryCreate

      public void onDirectoryCreate(File directory)
      Directory created Event.
      Parameters:
      directory - The directory that was created
    • onDirectoryChange

      public void onDirectoryChange(File directory)
      Directory changed Event.
      Parameters:
      directory - The directory that changed
    • onDirectoryDelete

      public void onDirectoryDelete(File directory)
      Directory deleted Event.
      Parameters:
      directory - The directory that was deleted
    • addDataFileToCatalog

      Return the unique identifier of a new metadata element describing the file.
      Parameters:
      properties - basic properties to use
      Returns:
      unique identifier (guid)
      Throws:
      ConnectorCheckedException - connector has been shutdown
      InvalidParameterException - invalid parameter
      PropertyServerException - unable to communicate with the repository
      UserNotAuthorizedException - access problem for userId
    • addDataFileViaTemplate

      protected String addDataFileViaTemplate(String assetTypeName, String fileTemplateGUID, ElementProperties replacementProperties, Map<String,String> placeholderProperties) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException
      Return the unique identifier of a new metadata element describing the file created using the supplied template.
      Parameters:
      assetTypeName - type of asset to create
      fileTemplateGUID - template to use
      replacementProperties - properties from the template to replace
      placeholderProperties - values to use to replace placeholders in the template
      Returns:
      unique identifier (guid)
      Throws:
      ConnectorCheckedException - connector has been shutdown
      InvalidParameterException - invalid parameter
      PropertyServerException - unable to communicate with the repository
      UserNotAuthorizedException - access problem for userId