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
Manages the cataloguing of data files for a specific catalog target.
-
Field Summary
Fields inherited from class org.odpi.openmetadata.adapters.connectors.integration.basicfiles.DirectoryToMonitor
allowCatalogDelete, auditLog, catalogClassifiedFiles, catalogTargetGUID, configurationProperties, connectorName, dataFolderElement, directoryFile, directoryName, directoryTemplateGUID, directoryTemplateQualifiedName, fileTemplateGUID, fileTemplateQualifiedName, incidentReportTemplateGUID, incidentReportTemplateQualifiedName, integrationConnector, isListening, metadataSourceGUID, metadataSourceName, newFileProcessName, propertyHelper, sourceName, toDoTemplateGUID, toDoTemplateQualifiedName, waitForDirectory
-
Constructor Summary
ConstructorDescriptionDataFilesMonitorForTarget
(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
addDataFileToCatalog
(DataFileProperties properties) Return the unique identifier of a new metadata element describing the file.protected String
addDataFileViaTemplate
(String assetTypeName, String fileTemplateGUID, ElementProperties replacementProperties, Map<String, String> placeholderProperties) Return the unique identifier of a new metadata element describing the file created using the supplied template.void
onDirectoryChange
(File directory) Directory changed Event.void
onDirectoryCreate
(File directory) Directory created Event.void
onDirectoryDelete
(File directory) Directory deleted Event.void
onFileChange
(File file) File changed Event.void
onFileCreate
(File file) File created Event.void
onFileDelete
(File file) File deleted Event.void
refresh()
Requests that the connector does a comparison of the metadata in the third party technology and open metadata repositories.
-
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 connectorsourceName
- source of the pathnamepathName
- pathname to the directorycatalogTargetGUID
- optional catalog target GUIDdeleteMethod
- should the connector use delete or archive?templates
- names and GUIDs of templatesconfigurationProperties
- parameters to further modify the behaviour of the connectorintegrationConnector
- associated connectordataFolderElement
- Egeria element for this directoryauditLog
- logging destination
-
-
Method Details
-
refresh
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 classDirectoryToMonitor
- Throws:
ConnectorCheckedException
- there is a problem with the connector. It is not able to refresh the metadata.
-
onFileCreate
File created Event.- Parameters:
file
- The file that was created
-
onFileDelete
Description copied from interface:FileListenerInterface
File deleted Event.- Parameters:
file
- The file that was deleted
-
onFileChange
File changed Event.- Parameters:
file
- The file that changed
-
onDirectoryCreate
Directory created Event.- Parameters:
directory
- The directory that was created
-
onDirectoryChange
Directory changed Event.- Parameters:
directory
- The directory that changed
-
onDirectoryDelete
Directory deleted Event.- Parameters:
directory
- The directory that was deleted
-
addDataFileToCatalog
protected String addDataFileToCatalog(DataFileProperties properties) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException 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 shutdownInvalidParameterException
- invalid parameterPropertyServerException
- unable to communicate with the repositoryUserNotAuthorizedException
- access problem for userId
-
addDataFileViaTemplate
protected String addDataFileViaTemplate(String assetTypeName, String fileTemplateGUID, ElementProperties replacementProperties, Map<String, String> placeholderProperties) throws ConnectorCheckedException, InvalidParameterException, PropertyServerException, UserNotAuthorizedExceptionReturn the unique identifier of a new metadata element describing the file created using the supplied template.- Parameters:
assetTypeName
- type of asset to createfileTemplateGUID
- template to usereplacementProperties
- properties from the template to replaceplaceholderProperties
- values to use to replace placeholders in the template- Returns:
- unique identifier (guid)
- Throws:
ConnectorCheckedException
- connector has been shutdownInvalidParameterException
- invalid parameterPropertyServerException
- unable to communicate with the repositoryUserNotAuthorizedException
- access problem for userId
-