Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove OpenMetadataAPIMapper #7996

Merged
merged 2 commits into from
Jan 4, 2024
Merged

Conversation

mandy-chessell
Copy link
Contributor

Description

This PR is the next step in the internal restructure aimed to have only one definition of the GUID->name mapping for the open metadata types. Before this work started, there were 4 implementations of this mapping:

  • in the official type definitions found in the OpenMetadataTypesArchive.
  • in the file OpenMetadataAPIMapper of the generic handlers. This is used by the generic handlers and server-side implementation of the access services
  • in the archive helpers
  • in the governance action framework (part of the OpenMetadataStore) used by connectors, access service clients, integration services, view services and engine services.

The plan is to use the governance action framework definitions as the root definitions. The OpenMetadataTypesArchive will then use them to build up the full definitions of the types. It will still be the definitive source of the type definitions.

The archive helpers have already been updated to use the governance action framework definitions. This PR removes the the OpenMetadataAPIMapper versions. The generic handlers and access services now use the governance action framework versions.

The PR also includes the initial implementation of the final stage where the type definitions pull values from the governance action framework. It covers the types for models 0010 and 0011. For these types, the guid, name, description, link to the model wiki page and a guid for a companion valid value are encoded in a Enum (in class OpenMetadataType). The properties are encoded in an Enum (OpenMetadataProperty).

It is time consuming to create these Enums and so it will be done as a series of PRs.

Related Issue(s)

None

Testing

Standard UT and FVT

Release Notes & Documentation

None - this is just internal

Additional notes

The Data Engine OMAS used static imports for the type definitions. These will not work when the values are converted to enum. Therefore the static imports have been changed to explicit references to the values in OpenMetadataType and OpenMetadataProperty. This will make the conversion easier as the types are moved to the enum.

Signed-off-by: Mandy Chessell <[email protected]>
@mandy-chessell mandy-chessell merged commit e162833 into odpi:main Jan 4, 2024
4 checks passed
dataEngineSchemaTypeHandler.removeSchemaType(userId, schemaTypeGUID, externalSourceName, deleteSemantic);
log.debug(DEBUG_DELETE_MESSAGE, schemaTypeGUID, SCHEMA_TYPE_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, schemaTypeGUID, OpenMetadataType.SCHEMA_TYPE_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
Optional<EntityDetail> schemaType = dataEnginePortHandler.findSchemaTypeForPort(userId, portGUID);
if (schemaType.isPresent()) {
deleteSchemaType(userId, serverName, externalSourceName, schemaType.get().getGUID(), null, deleteSemantic);
}
}

dataEnginePortHandler.removePort(userId, portGUID, externalSourceName, deleteSemantic);
log.debug(DEBUG_DELETE_MESSAGE, portGUID, PORT_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, portGUID, OpenMetadataType.PORT_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
}

processHandler.removeProcess(userId, processGUID, externalSourceName, deleteSemantic);
log.debug(DEBUG_DELETE_MESSAGE, processGUID, PROCESS_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, processGUID, OpenMetadataType.PROCESS.typeName);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
relationalDataHandler.removeDatabase(userId, databaseGUID, externalSourceName, deleteSemantic);
log.debug(DEBUG_DELETE_MESSAGE, databaseGUID, DATABASE_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, databaseGUID, OpenMetadataType.DATABASE_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
relationalDataHandler.removeDatabaseSchema(userId, databaseSchemaGUID, externalSourceName, deleteSemantic);

log.debug(DEBUG_DELETE_MESSAGE, databaseSchemaGUID, DEPLOYED_DATABASE_SCHEMA_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, databaseSchemaGUID, OpenMetadataType.DEPLOYED_DATABASE_SCHEMA_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.

DataEngineFolderHierarchyHandler folderHierarchyHandler = instanceHandler.getFolderHierarchyHandler(userId, serverName, methodName);
folderHierarchyHandler.removeFolder(userId, folderGUID, deleteSemantic, externalSourceName);

log.debug(DEBUG_DELETE_MESSAGE, folderGUID, FILE_FOLDER_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, folderGUID, OpenMetadataType.FILE_FOLDER_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
@@ -1382,7 +1361,7 @@
String externalSourceGuid = registrationHandler.getExternalDataEngine(userId, externalSourceName);
connectionAndEndpointHandler.removeConnection(userId, connectionGUID, deleteSemantic, externalSourceName, externalSourceGuid);

log.debug(DEBUG_DELETE_MESSAGE, connectionGUID, CONNECTION_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, connectionGUID, OpenMetadataType.CONNECTION_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.

DataEngineConnectionAndEndpointHandler connectionAndEndpointHandler = instanceHandler.getConnectionAndEndpointHandler(userId, serverName,
methodName);
DataEngineRegistrationHandler registrationHandler = instanceHandler.getRegistrationHandler(userId, serverName, methodName);
String externalSourceGuid = registrationHandler.getExternalDataEngine(userId, externalSourceName);
connectionAndEndpointHandler.removeEndpoint(userId, endpointGUID, deleteSemantic, externalSourceName, externalSourceGuid);

log.debug(DEBUG_DELETE_MESSAGE, endpointGUID, ENDPOINT_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, endpointGUID, OpenMetadataType.ENDPOINT_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
dataEngineTopicHandler.removeTopic(userId, topicGUID, externalSourceName, deleteSemantic);
log.debug(DEBUG_DELETE_MESSAGE, topicGUID, TOPIC_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, topicGUID, OpenMetadataType.TOPIC_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
dataEngineEventTypeHandler.removeEventType(userId, eventTypeGUID, qualifiedName, externalSourceName, deleteSemantic);
log.debug(DEBUG_DELETE_MESSAGE, eventTypeGUID, TOPIC_TYPE_NAME);
log.debug(DEBUG_DELETE_MESSAGE, eventTypeGUID, OpenMetadataType.TOPIC_TYPE_NAME);

Check failure

Code scanning / CodeQL

Log Injection High

This log entry depends on a
user-provided value
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant