Class DirectoryToMonitor
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 Summary
FieldsModifier and TypeFieldDescriptionprotected booleanPolicy for deletingprotected Stringprotected booleanShould only file types that are recognized by the classifier be catalogued.protected final StringThis is the unique identifier of the CatalogTarget relationship that this directory matches.protected final Stringprotected Stringprotected FileThis is the Java File object that is accessing the directory.protected StringWhat is the short name for this directory?Governance zones for a new file that has no catalogued parent folder with zones.protected StringDefault values for the file system name and mount point.protected final FileSystemPropertiesprotected Stringprotected StringTemplate for creating incident reportsprotected final BasicFilesMonitorIntegrationConnectorBaseprotected booleanThis boolean indicates that the connector is registered to listen for changes in the directory.protected Stringprotected Stringprotected Stringprotected Stringprotected final Map<String, ParentFolder> The nearest catalogued folder for each directory, keyed by the directory's canonical path name.protected final PropertyHelperprotected StringWhere did information about this directory come from?Templates for cataloguing files and foldersprotected Stringprotected StringTemplate for creating todosprotected booleanDoes the physical directory have to exist or will it wait?Fields inherited from class org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
auditLog -
Constructor Summary
ConstructorsConstructorDescriptionDirectoryToMonitor(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected OpenMetadataRootElementReturn the data folder element for this directory.protected FilegetLocalFile(String cataloguedPathName) Return the file on this machine for a path name from the catalog.protected ParentFoldergetParentFolder(File file, FileClassifier fileClassifier) Find the nearest catalogued folder above a file.abstract voidrefresh()Requests that the connector does a comparison of the metadata in the third party technology and open metadata repositories.Methods inherited from class org.odpi.openmetadata.frameworks.auditlog.AuditLoggingBase
logExceptionRecord, logExceptionRecord, logRecord, logRecordMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.odpi.openmetadata.frameworks.openmetadata.filelistener.FileDirectoryListenerInterface
onDirectoryChange, onDirectoryCreate, onDirectoryDeleteMethods inherited from interface org.odpi.openmetadata.frameworks.openmetadata.filelistener.FileListenerInterface
onFileChange, onFileCreate, onFileDelete
-
Field Details
-
propertyHelper
-
integrationConnector
-
connectorName
-
sourceName
Where did information about this directory come from? -
directoryName
What is the short name for this directory? -
fileSystemName
Default values for the file system name and mount point. -
localMountPoint
-
canonicalMountPoint
-
directoryFile
This is the Java File object that is accessing the directory. -
isListening
protected boolean isListeningThis boolean indicates that the connector is registered to listen for changes in the directory. -
catalogTargetGUID
This is the unique identifier of the CatalogTarget relationship that this directory matches. Null means the value was supplied in the endpoint. -
dataFolderGUID
-
fileSystemProperties
-
configurationProperties
-
templates
Templates for cataloguing files and folders -
toDoTemplateQualifiedName
Template for creating todos -
toDoTemplateGUID
-
incidentReportTemplateQualifiedName
Template for creating incident reports -
incidentReportTemplateGUID
-
newFileProcessName
-
allowCatalogDelete
protected boolean allowCatalogDeletePolicy for deleting -
waitForDirectory
protected boolean waitForDirectoryDoes the physical directory have to exist or will it wait? -
catalogClassifiedFiles
protected boolean catalogClassifiedFilesShould only file types that are recognized by the classifier be catalogued. -
fallbackZones
Governance zones for a new file that has no catalogued parent folder with zones. -
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
-
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 connectorsourceName- source of the pathnamepathName- pathname to the directorycatalogTargetGUID- optional catalog target GUIDdataFolderGUID- optional GUID of the data folder elementdeleteMethod- should the connector use delete or archive?templates- names and GUIDs of templatesfileSystemProperties- properties of the file systemconfigurationProperties- parameters to further modify the behaviour of the connectorintegrationConnector- associated connectorauditLog- logging destination
-
-
Method Details
-
getDataFolderElement
Return the data folder element for this directory.- Returns:
- root element for the data folder
- Throws:
ConnectorCheckedException- problem accessing information
-
getLocalFile
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
protected ParentFolder getParentFolder(File file, FileClassifier fileClassifier) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, IOException, ConnectorCheckedException 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 cataloguedfileClassifier- 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 parameterPropertyServerException- unable to communicate with the repositoryUserNotAuthorizedException- access problem for userIdIOException- unable to work with the directoryConnectorCheckedException- unable to retrieve the catalog target
-
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.- Throws:
ConnectorCheckedException- a problem with the connector. It is not able to refresh the metadata.
-