Class IntegrationContext
java.lang.Object
org.odpi.openmetadata.frameworks.integration.context.IntegrationContext
- Direct Known Subclasses:
AnalyticsIntegratorContext
,APIIntegratorContext
,CatalogIntegratorContext
,DatabaseIntegratorContext
,DisplayIntegratorContext
,FilesIntegratorContext
,InfrastructureIntegratorContext
,LineageIntegratorContext
,OrganizationIntegratorContext
,SearchIntegratorContext
,SecurityIntegratorContext
,TopicIntegratorContext
IntegrationContext is the base class for the integration context provided to the integration connector to provide access to open metadata
services. Each integration service specializes this class to provide the method appropriate for the particular type of technology it
is supporting.
This base class supports the common methods available to all types of integration connectors.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected String
protected boolean
protected String
protected final FileClassifier
protected final String
protected final IntegrationReportWriter
protected final int
protected final OpenIntegrationClient
protected final OpenMetadataClient
protected final PermittedSynchronization
protected final String
-
Constructor Summary
ConstructorDescriptionIntegrationContext
(String connectorId, String connectorName, String connectorUserId, String serverName, OpenIntegrationClient openIntegrationClient, OpenMetadataClient openMetadataStoreClient, boolean generateIntegrationReport, PermittedSynchronization permittedSynchronization, String externalSourceGUID, String externalSourceName, String integrationConnectorGUID, AuditLog auditLog, int maxPageSize) Constructor handles standard values for all integration contexts. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Disconnect the file listener.getAnchorGUID
(ElementHeader elementHeader) Retrieve the anchorGUID from the Anchors classification.getCatalogTargets
(int startingFrom, int maximumResults) Retrieve the identifiers of the metadata elements identified as catalog targets with an integration connector.Return the connected asset context that support an integration connector working with assets and their connectors.boolean
Return the flag indicating whether the external source name is to be used as the new element's metadata collection, or they belong to the local cohort.Return the file classifier that uses reference data to describe a file.Return the integration governance context that provides access to various Governance Action Framework (GAF) function.int
Returns the server configuration for the maximum number of elements that can be returned on a request.Return the qualified name of the software capability that represents an external source of metadata.Return the permitted synchronization direction.boolean
Return whether there is a refresh in progress.boolean
isTypeOf
(ElementHeader elementHeader, String typeName) Understand the type of element.boolean
isTypeOf
(ElementType elementType, String typeName) Understand the type of element.void
Assemble the data collected and write out a report (if configured).void
registerDirectoryListener
(FileDirectoryListenerInterface listener, File directoryToMonitor, FileFilter fileFilter) Register a listener object that will be called each time a file is created, changed or deleted in a specific root directory.void
registerDirectoryTreeListener
(FileDirectoryListenerInterface listener, File directoryToMonitor, FileFilter fileFilter) Register a listener object that will be called each time a file is created, changed or deleted in a specific root directory and any of its subdirectories.void
registerFileListener
(FileListenerInterface listener, File fileToMonitor) Register a listener object that will be called each time a specific file is created, changed or deleted.protected void
reportAnchorGUID
(String elementGUID, String anchorGUID) Save the relationship between an element and its anchor.protected void
reportAnchorGUID
(String elementGUID, String anchorGUID, String anchorTypeName) Save the relationship between an element and its anchor.protected void
reportElementCreation
(String elementGUID) Save information about a newly created element.protected void
reportElementDelete
(String elementGUID) Save information about a newly archived or deleted element.protected void
reportElementUpdate
(String elementGUID) Save information about a newly updated element.protected void
reportParentGUID
(String elementGUID, String parentGUID) Attempt to use the parent's GUID to discover the relationship between an element and its anchor.void
setActiveReportPublishing
(boolean flag) Set whether an integration report should be assembled and published.void
setExternalSourceIsHome
(boolean newValue) Set the flag indicating whether the external source name is to be used as the new element's metadata collection, or they belong to the local cohort.void
setMetadataSourceQualifiedName
(String metadataSourceQualifiedName) Change the metadata collection that is in use when working with open metadata.void
Clear the report properties ready for a new report.void
unregisterDirectoryListener
(FileDirectoryListenerInterface listener, File directoryToMonitor) Unregister a listener object for the directory.void
unregisterDirectoryTreeListener
(FileDirectoryListenerInterface listener, File directoryToMonitor) Unregister a listener object for the directory.void
unregisterFileListener
(FileListenerInterface listener, File fileToMonitor) Unregister a listener object that will be called each time a specific file is created, changed or deleted.
-
Field Details
-
openIntegrationClient
-
openMetadataStoreClient
-
userId
-
connectorName
-
integrationConnectorGUID
-
permittedSynchronization
-
externalSourceGUID
-
externalSourceName
-
externalSourceIsHome
protected boolean externalSourceIsHome -
fileClassifier
-
integrationReportWriter
-
maxPageSize
protected final int maxPageSize
-
-
Constructor Details
-
IntegrationContext
public IntegrationContext(String connectorId, String connectorName, String connectorUserId, String serverName, OpenIntegrationClient openIntegrationClient, OpenMetadataClient openMetadataStoreClient, boolean generateIntegrationReport, PermittedSynchronization permittedSynchronization, String externalSourceGUID, String externalSourceName, String integrationConnectorGUID, AuditLog auditLog, int maxPageSize) Constructor handles standard values for all integration contexts.- Parameters:
connectorId
- unique identifier of the connector (used to configure the event listener)connectorName
- name of connector from configconnectorUserId
- userId for the connectorserverName
- name of the integration daemonopenIntegrationClient
- client for calling the metadata serveropenMetadataStoreClient
- client for calling the metadata servergenerateIntegrationReport
- should the connector generate an integration reports?permittedSynchronization
- enumexternalSourceGUID
- unique identifier of the software server capability for the source of metadataexternalSourceName
- unique name of the software server capability for the source of metadataintegrationConnectorGUID
- unique identifier of the integration connector entity (maybe null)auditLog
- logging destinationmaxPageSize
- max number of elements that can be returned on a query
-
-
Method Details
-
getFileClassifier
Return the file classifier that uses reference data to describe a file.- Returns:
- file classifier utility
-
getCatalogTargets
public List<CatalogTarget> getCatalogTargets(int startingFrom, int maximumResults) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Retrieve the identifiers of the metadata elements identified as catalog targets with an integration connector. Each catalog target may be configured with an optional symbolic name to guide the integration connector on how to use the catalog targets.- Parameters:
startingFrom
- initial position in the stored list.maximumResults
- maximum number of definitions to return on this call.- Returns:
- list of named element headers
- Throws:
InvalidParameterException
- one of the parameters is null or invalid,UserNotAuthorizedException
- user not authorized to issue this request.PropertyServerException
- problem retrieving the integration connector definition.
-
getMetadataSourceQualifiedName
Return the qualified name of the software capability that represents an external source of metadata. Used to control external provenance and as a parent for some asset cataloguing. If null the provenance is LOCAL_COHORT.- Returns:
- string name
-
setMetadataSourceQualifiedName
public void setMetadataSourceQualifiedName(String metadataSourceQualifiedName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException Change the metadata collection that is in use when working with open metadata. It should be the qualified name of a software capability, The qualified name is supplied through open metadata values and may be incorrect which is why any exceptions from retrieving the software capability are passed through to the caller.- Parameters:
metadataSourceQualifiedName
- supplied qualified name for the metadata collection- Throws:
InvalidParameterException
- the unique name is null or not known.UserNotAuthorizedException
- the caller's userId is not able to access the elementPropertyServerException
- there is a problem accessing the metadata store
-
getExternalSourceIsHome
public boolean getExternalSourceIsHome()Return the flag indicating whether the external source name is to be used as the new element's metadata collection, or they belong to the local cohort.- Returns:
- flag
-
setExternalSourceIsHome
public void setExternalSourceIsHome(boolean newValue) Set the flag indicating whether the external source name is to be used as the new element's metadata collection, or they belong to the local cohort.- Parameters:
newValue
- flag
-
getPermittedSynchronization
Return the permitted synchronization direction. This setting may affect which method in the context are available to the integration connector.- Returns:
- permittedSynchronization enum
-
getIntegrationGovernanceContext
Return the integration governance context that provides access to various Governance Action Framework (GAF) function.- Returns:
- IntegrationGovernanceContext context object
-
getConnectedAssetContext
Return the connected asset context that support an integration connector working with assets and their connectors.- Returns:
- connected asset context
-
setActiveReportPublishing
public void setActiveReportPublishing(boolean flag) Set whether an integration report should be assembled and published. This allows the integration connector to turn off/on integration report writing. It only has an effect if the connector is configured to allow report writing- Parameters:
flag
- required behaviour
-
startRecording
public void startRecording()Clear the report properties ready for a new report. This is not normally needed by the integration connector since it is called by the connector handler just before refresh. It is also called by publish report. -
reportAnchorGUID
protected void reportAnchorGUID(String elementGUID, String anchorGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException Save the relationship between an element and its anchor. This is called by the methods of the context that create, update, archive or delete elements.- Parameters:
elementGUID
- unique identifier of the elementanchorGUID
- unique identifier of the associated anchor- Throws:
InvalidParameterException
- one of the parameters is invalidUserNotAuthorizedException
- the user is not authorized to issue this requestPropertyServerException
- there is a problem reported in the open metadata server(s)
-
reportAnchorGUID
Save the relationship between an element and its anchor. This is called by the methods of the context that create, update, archive or delete elements.- Parameters:
elementGUID
- unique identifier of the elementanchorGUID
- unique identifier of the associated anchoranchorTypeName
- type name of the associated anchor
-
reportParentGUID
Attempt to use the parent's GUID to discover the relationship between an element and its anchor. This is used to identify which report that the element should be reported under.- Parameters:
elementGUID
- unique identifier of the elementparentGUID
- unique identifier of the associated parent
-
reportElementCreation
Save information about a newly created element.- Parameters:
elementGUID
- unique identifier of the element
-
reportElementUpdate
Save information about a newly updated element.- Parameters:
elementGUID
- unique identifier of the element
-
reportElementDelete
Save information about a newly archived or deleted element.- Parameters:
elementGUID
- unique identifier of the element
-
publishReport
public void publishReport() throws InvalidParameterException, UserNotAuthorizedException, PropertyServerExceptionAssemble the data collected and write out a report (if configured).- Throws:
InvalidParameterException
- an invalid property has been passedUserNotAuthorizedException
- the user is not authorizedPropertyServerException
- there is a problem communicating with the metadata server (or it has a logic error).
-
isRefreshInProgress
public boolean isRefreshInProgress()Return whether there is a refresh in progress. This method is used in processEvent() to enable to connector to ignore events while it is running refresh() since many of the events are caused by the refresh process. Using this flag prevents the connector from processing the same elements multiple times.- Returns:
- boolean flag
-
getAnchorGUID
Retrieve the anchorGUID from the Anchors classification.- Parameters:
elementHeader
- element header where the classifications reside- Returns:
- anchorGUID or null
-
registerFileListener
public void registerFileListener(FileListenerInterface listener, File fileToMonitor) throws InvalidParameterException Register a listener object that will be called each time a specific file is created, changed or deleted.- Parameters:
listener
- listener objectfileToMonitor
- name of the file to monitor- Throws:
InvalidParameterException
- one of the parameters is null or invalid.
-
unregisterFileListener
public void unregisterFileListener(FileListenerInterface listener, File fileToMonitor) throws InvalidParameterException Unregister a listener object that will be called each time a specific file is created, changed or deleted.- Parameters:
listener
- listener objectfileToMonitor
- name of the file to unregister- Throws:
InvalidParameterException
- one of the parameters is null or invalid.
-
registerDirectoryListener
public void registerDirectoryListener(FileDirectoryListenerInterface listener, File directoryToMonitor, FileFilter fileFilter) throws InvalidParameterException Register a listener object that will be called each time a file is created, changed or deleted in a specific root directory. The file filter lets you request that only certain types of files are returned.- Parameters:
listener
- listener objectdirectoryToMonitor
- details of the file directory to monitorfileFilter
- a file filter implementation that restricts the files/directories that will be returned to the listener- Throws:
InvalidParameterException
- one of the parameters is null or invalid.
-
unregisterDirectoryListener
public void unregisterDirectoryListener(FileDirectoryListenerInterface listener, File directoryToMonitor) throws InvalidParameterException Unregister a listener object for the directory.- Parameters:
listener
- listener objectdirectoryToMonitor
- details of the file directory unregister- Throws:
InvalidParameterException
- one of the parameters is null or invalid.
-
registerDirectoryTreeListener
public void registerDirectoryTreeListener(FileDirectoryListenerInterface listener, File directoryToMonitor, FileFilter fileFilter) throws InvalidParameterException Register a listener object that will be called each time a file is created, changed or deleted in a specific root directory and any of its subdirectories. The file filter lets you request that only certain types of files and/or directories are returned.- Parameters:
listener
- listener objectdirectoryToMonitor
- details of the root file directory to monitor fromfileFilter
- a file filter implementation that restricts the files/directories that will be returned to the listener- Throws:
InvalidParameterException
- one of the parameters is null or invalid.
-
unregisterDirectoryTreeListener
public void unregisterDirectoryTreeListener(FileDirectoryListenerInterface listener, File directoryToMonitor) throws InvalidParameterException Unregister a listener object for the directory.- Parameters:
listener
- listener objectdirectoryToMonitor
- details of the root file directory to unregister- Throws:
InvalidParameterException
- one of the parameters is null or invalid.
-
getMaxPageSize
public int getMaxPageSize()Returns the server configuration for the maximum number of elements that can be returned on a request. It is used to control paging.- Returns:
- integer
-
isTypeOf
Understand the type of element. It checks the type and super types.- Parameters:
elementHeader
- element to validatetypeName
- type to test- Returns:
- boolean flag
-
isTypeOf
Understand the type of element. It checks the type and super types.- Parameters:
elementType
- element to validatetypeName
- type to test- Returns:
- boolean flag
-
disconnect
Disconnect the file listener.- Throws:
ConnectorCheckedException
- exception disconnecting
-