Class GovernanceEngineMap
java.lang.Object
org.odpi.openmetadata.governanceservers.enginehostservices.enginemap.GovernanceEngineMap
GovernanceEngineMap provides a thread safe mapping of governance engine names to governance engine handlers.
This class allows the governance engine handler to be added after the engine host has started processing requests.
It is not possible to create the governance handler until the governance engine definition has been retrieved from
the metadata access server. So, unless the engine definition is linked explicitly to an engine service,
the type of the governance engine handler is unknown. Retrieval of a governance engine definition may be
triggered by an event, or by a refresh sweep of the metadata. Therefore, it is possible that two threads
are responding to the creation of a new governance engine definition. Hence, the synchronized methods
on this class are needed to protect the maps from concurrent update.
-
Constructor Summary
ConstructorsConstructorDescriptionGovernanceEngineMap(String localServerName, String localServerUserId, AuditLog auditLog, int maxPageSize) Create a client-side object for calling a survey action engine. -
Method Summary
Modifier and TypeMethodDescriptiongetGovernanceEngineHandler(String governanceEngineName) Return the governance engine handler for a specific governance engine name if one has already been created.getGovernanceEngineHandler(EngineConfig governanceEngine) Return the governance engine handler for a specific governance engine name if known.Return the list of active governance engine handlers.Return the list of the configured engines.getGovernanceEngineNames(String serviceURLMarker) Return the list of the configured engines for a particular engine service.refreshGovernanceEngineHandler(String governanceEngineName) Return the governance engine handler for a configured governance engine, retrieving the engine's definition and building the handler if that has not happened yet.voidsetGovernanceEngineProperties(EngineConfig engineConfig, OpenMetadataEventClient eventClient, EngineConfigurationRefreshThread configurationRefreshThread) Set up a placeholder entry in the governance handler map for a governance engine.voidshutdown()Shutdown all engines ...
-
Constructor Details
-
GovernanceEngineMap
public GovernanceEngineMap(String localServerName, String localServerUserId, AuditLog auditLog, int maxPageSize) Create a client-side object for calling a survey action engine.- Parameters:
localServerName- the name of the engine host server where the survey action engine is runninglocalServerUserId- user id for the engine host server to useauditLog- logging destinationmaxPageSize- maximum number of results that can be returned in a single request
-
-
Method Details
-
getGovernanceEngineHandler
Return the governance engine handler for a specific governance engine name if one has already been created.
This is a lookup and nothing more. A configured engine whose definition has not been retrieved yet has a placeholder in the map but no handler, so null is returned for it just as it is for an engine name this server knows nothing about - the two are indistinguishable through this method. Callers that want to give such an engine a chance to load should userefreshGovernanceEngineHandler(String), which retries the retrieval, or thegetGovernanceEngineHandler(EngineConfig)overload.- Parameters:
governanceEngineName- engine to lookup- Returns:
- handler, or null if the engine is unknown or has no handler yet
-
refreshGovernanceEngineHandler
Return the governance engine handler for a configured governance engine, retrieving the engine's definition and building the handler if that has not happened yet.
This is what makes anASSIGNEDengine - one configured into this server whose definition was not in the metadata store when the server started - able to come into service without a restart. Asking for it again re-runs the retrieval, which is the whole point of refreshing a named engine: the definition may have been created since the last attempt.
Returns null in two different situations, which the caller is expected to tell apart itself usinggetGovernanceEngineNames(): the engine is not configured in this server at all, or it is configured and its definition still could not be retrieved.
Deliberately not synchronized - it takes the lock only to read the engine's configuration, then hands off to the overload below, which performs an outbound REST call outside the lock.- Parameters:
governanceEngineName- engine to look up or bring into service- Returns:
- handler, or null if the engine is unknown or its definition is still unavailable
-
getGovernanceEngineHandler
Return the governance engine handler for a specific governance engine name if known. If the handler does not yet exist, an attempt is made to create it. If this fails, null is returned. The lookup/creation of the handler is deliberately performed outside of the object's synchronized lock: creating a handler involves an outbound REST call to retrieve the governance engine definition, and holding the lock across that call would block every other caller of this map (including event processing) for the duration of the call.- Parameters:
governanceEngine- engine to lookup- Returns:
- handler or null
-
getGovernanceEngineHandlers
Return the list of active governance engine handlers.- Returns:
- list of governance engine handlers or an empty list
-
getGovernanceEngineNames
Return the list of the configured engines.- Returns:
- list of engine names
-
getGovernanceEngineNames
Return the list of the configured engines for a particular engine service.- Parameters:
serviceURLMarker- marker that determines which engine service is calling.- Returns:
- list of engine names
-
setGovernanceEngineProperties
public void setGovernanceEngineProperties(EngineConfig engineConfig, OpenMetadataEventClient eventClient, EngineConfigurationRefreshThread configurationRefreshThread) throws InvalidParameterException Set up a placeholder entry in the governance handler map for a governance engine.- Parameters:
engineConfig- description of the engineeventClient- client for receiving eventsconfigurationRefreshThread- thread for controlling the receipt of events.- Throws:
InvalidParameterException- Problem create the client
-
shutdown
public void shutdown()Shutdown all engines ...
-