diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventHeader.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventHeader.java index 7b131b730c1..8535975897a 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventHeader.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventHeader.java @@ -43,7 +43,8 @@ @JsonSubTypes.Type(value = RelationalTableEvent.class, name = "RelationalTableEvent"), @JsonSubTypes.Type(value = DataFileEvent.class, name = "DataFileEvent"), @JsonSubTypes.Type(value = TopicEvent.class, name = "TopicEvent"), - @JsonSubTypes.Type(value = EventTypeEvent.class, name = "EventTypeEvent") + @JsonSubTypes.Type(value = EventTypeEvent.class, name = "EventTypeEvent"), + @JsonSubTypes.Type(value = ProcessingStateEvent.class, name = "ProcessingStateEvent") }) @Getter @Setter @@ -53,15 +54,15 @@ public abstract class DataEngineEventHeader implements Serializable { /** - * Event version ID + * Serial version UID * -- GETTER -- - * Gets the event version ID - * @return the event version ID + * Gets the serial version UID + * @return the serial version UID * -- SETTER -- - * Sets the event version ID - * @param eventVersionId the event version ID + * Sets the serial version UID + * @param serialVersionUID the serial version UID */ - private long eventVersionId = 1L; + private static final long serialVersionUID = 1L; /* different data engine event types */ /** diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventType.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventType.java index 098ba5de964..8b55edf8bf4 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventType.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineEventType.java @@ -32,17 +32,17 @@ public enum DataEngineEventType implements Serializable { DATA_ENGINE_REGISTRATION_EVENT (1, "DataEngineRegistrationEvent", "An event that register a data engine as external source."), LINEAGE_MAPPINGS_EVENT (2, "LineageMappingsEvent", "An event that add or update lineage mappings."), PORT_ALIAS_EVENT (3, "PortAliasEvent", "An event that add or update port alias"), - PORT_IMPLEMENTATION_EVENT (4, "PortImplementationEvent", "An event that create or update port implementations."), - SCHEMA_TYPE_EVENT (5, "SchemaTypeEvent", "An event that create or update schema types."), + PORT_IMPLEMENTATION_EVENT (4, "PortImplementationEvent", "An event that creates or updates port implementations."), + SCHEMA_TYPE_EVENT (5, "SchemaTypeEvent", "An event that creates or updates schema types."), PROCESS_HIERARCHY_EVENT (6, "ProcessHierarchyEvent", "An event to setup a process hierarchy."), DELETE_DATA_ENGINE_EVENT (7, "DeleteDataEngineEvent", "An event that deletes an external data engine."), DELETE_SCHEMA_TYPE_EVENT (8, "DeleteSchemaTypeEvent", "An event that deletes a schema type."), DELETE_PORT_IMPLEMENTATION_EVENT (9, "DeletePortImplementationEvent", "An event that deletes a port implementation."), DELETE_PORT_ALIAS_EVENT (10, "DeletePortAliasesEvent", "An event that deletes a port alias."), - DATABASE_EVENT (11, "DatabaseEvent", "An event that create or update databases."), - DATABASE_SCHEMA_EVENT (12, "DatabaseSchemaEvent", "An event that create or update database schemas."), - RELATIONAL_TABLE_EVENT (13, "RelationalTableEvent", "An event that create or update relational tables."), - DATA_FILE_EVENT (14, "DataFileEvent", "An event that create or update data files."), + DATABASE_EVENT (11, "DatabaseEvent", "An event that creates or updates databases."), + DATABASE_SCHEMA_EVENT (12, "DatabaseSchemaEvent", "An event that creates or updates database schemas."), + RELATIONAL_TABLE_EVENT (13, "RelationalTableEvent", "An event that creates or updates relational tables."), + DATA_FILE_EVENT (14, "DataFileEvent", "An event that creates or updates data files."), DELETE_DATABASE_EVENT (15, "DeleteDatabaseEvent", "An event that deletes a database."), DELETE_DATABASE_SCHEMA_EVENT (16, "DeleteDatabaseSchemaEvent", "An event that deletes a database schema."), DELETE_RELATIONAL_TABLE_EVENT (17, "DeleteRelationalTableEvent", "An event that deletes a relational table."), @@ -50,12 +50,13 @@ public enum DataEngineEventType implements Serializable { DELETE_FOLDER_EVENT (19, "DeleteFolderEvent", "An event that deletes a folder."), DELETE_CONNECTION_EVENT (20, "DeleteConnectionEvent", "An event that deletes a connection."), DELETE_ENDPOINT_EVENT (21, "DeleteEndpointEvent", "An event that deletes an endpoint."), - PROCESS_EVENT (22, "ProcessEvent", "An event that create or update a process."), + PROCESS_EVENT (22, "ProcessEvent", "An event that creates or updates a process."), DELETE_PROCESS_EVENT (23, "DeleteProcessEvent", "An event that deletes a process."), - TOPIC_EVENT (24, "TopicEvent", "An event that create or update topics."), - EVENT_TYPE_EVENT (25, "EventTypeEvent", "An event that create or update event types."), + TOPIC_EVENT (24, "TopicEvent", "An event that creates or updates topics."), + EVENT_TYPE_EVENT (25, "EventTypeEvent", "An event that creates or updates event types."), DELETE_TOPIC_EVENT (26, "DeleteTopicEvent", "An event that deletes a topic."), - DELETE_EVENT_TYPE_EVENT (27, "DeleteEventTypeEvent", "An event that deletes an event type."); + DELETE_EVENT_TYPE_EVENT (27, "DeleteEventTypeEvent", "An event that deletes an event type."), + PROCESSING_STATE_TYPE_EVENT (28, "ProcessingStateEvent", "An event that creates or updates the processing state classification of an engine."); @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineRegistrationEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineRegistrationEvent.java index 0351800aa04..57be0d3dc69 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineRegistrationEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataEngineRegistrationEvent.java @@ -9,13 +9,13 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; /** - * The Data engine registration event for registering external source as software server capability. + * The Data engine registration event for registering external source as engine. */ @JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @@ -27,14 +27,25 @@ public class DataEngineRegistrationEvent extends DataEngineEventHeader { /** - * Software server capability + * Serial version UID * -- GETTER -- - * Gets the software server capability - * @return the software server capability + * Gets the serial version UID + * @return the serial version UID * -- SETTER -- - * Sets the software server capability - * @param softwareServerCapability the software server capability + * Sets the serial version UID + * @param serialVersionUID the serial version UID */ - private SoftwareServerCapability softwareServerCapability; + private static final long serialVersionUID = 1L; + + /** + * Engine + * -- GETTER -- + * Gets the engine + * @return the engine + * -- SETTER -- + * Sets the engine + * @param engine the engine + */ + private Engine engine; } diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataFileEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataFileEvent.java index 05ff645a1ba..27cfa40320d 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataFileEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DataFileEvent.java @@ -26,6 +26,18 @@ @EqualsAndHashCode(callSuper = true) @ToString public class DataFileEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The data file to be created * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseEvent.java index 800ea82b2e9..730e5e271d3 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseEvent.java @@ -25,6 +25,19 @@ @EqualsAndHashCode(callSuper = true) @ToString public class DatabaseEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + + /** * The database to be created * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseSchemaEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseSchemaEvent.java index 825ef59e70f..bf1d0887b32 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseSchemaEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DatabaseSchemaEvent.java @@ -25,6 +25,18 @@ @EqualsAndHashCode(callSuper = true) @ToString public class DatabaseSchemaEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The database schema to be created * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DeleteEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DeleteEvent.java index 7f9832020a6..c0e8d3394a9 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DeleteEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/DeleteEvent.java @@ -26,6 +26,17 @@ @ToString public class DeleteEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The qualified name of the entity * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/EventTypeEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/EventTypeEvent.java index b030ee8543c..8027d7f6860 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/EventTypeEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/EventTypeEvent.java @@ -25,6 +25,18 @@ @EqualsAndHashCode(callSuper = true) @ToString public class EventTypeEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The event type to be created * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/FindEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/FindEvent.java index 2e4b6abee00..a558d0d88bf 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/FindEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/FindEvent.java @@ -26,6 +26,18 @@ @EqualsAndHashCode(callSuper = true) @ToString public class FindEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The find request body * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/LineageMappingsEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/LineageMappingsEvent.java index 6b6dd21316a..18171b83515 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/LineageMappingsEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/LineageMappingsEvent.java @@ -28,6 +28,17 @@ @ToString(callSuper = true) public class LineageMappingsEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The lineage mappings * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortAliasEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortAliasEvent.java index 74c7dffb6b7..df82c6d5969 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortAliasEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortAliasEvent.java @@ -26,6 +26,17 @@ @ToString(callSuper = true) public class PortAliasEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The process qualified name * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortImplementationEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortImplementationEvent.java index 1ae52e903d9..8668f1c2fec 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortImplementationEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/PortImplementationEvent.java @@ -26,6 +26,17 @@ @ToString(callSuper = true) public class PortImplementationEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The process qualified name * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessEvent.java index a72014dc998..ac4be65a58e 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessEvent.java @@ -26,6 +26,17 @@ @ToString(callSuper = true) public class ProcessEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The process * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessHierarchyEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessHierarchyEvent.java index 66123bcb2a2..8cc152c5547 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessHierarchyEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessHierarchyEvent.java @@ -24,7 +24,18 @@ @Setter @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class ProcessHierarchyEvent extends DataEngineEventHeader{ +public class ProcessHierarchyEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; /** * The process hierarchy diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessListEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessListEvent.java index da24dd046f7..84d04b564c8 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessListEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessListEvent.java @@ -27,6 +27,17 @@ @ToString(callSuper = true) public class ProcessListEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The failed GUIDs * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessingStateEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessingStateEvent.java new file mode 100644 index 00000000000..9f3258668c1 --- /dev/null +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/ProcessingStateEvent.java @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.accessservices.dataengine.event; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@Getter +@Setter +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ProcessingStateEvent extends DataEngineEventHeader { + + /** + * Serial version ID + * -- GETTER -- + * Gets the serial version ID + * @return the serial version ID + * -- SETTER -- + * Sets the serial version ID + * @param serialVersionUID the serial version ID + */ + private static final long serialVersionUID = 1L; + + /** + * The processing state. + * + * -- GETTER -- + * Return the processing state + * + * @return processing state + * -- SETTER -- + * Set up the processing state + * @param processingState processing state + */ + private ProcessingState processingState; +} diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/RelationalTableEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/RelationalTableEvent.java index 610f757d1cb..ce3f9a95faa 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/RelationalTableEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/RelationalTableEvent.java @@ -26,6 +26,18 @@ @EqualsAndHashCode(callSuper = true) @ToString public class RelationalTableEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The relational table to be created * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/SchemaTypeEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/SchemaTypeEvent.java index c382ac9242c..8967a8d19c6 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/SchemaTypeEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/SchemaTypeEvent.java @@ -27,6 +27,17 @@ @ToString(callSuper = true) public class SchemaTypeEvent extends DataEngineEventHeader { + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The port qualified name * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/TopicEvent.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/TopicEvent.java index 4ff66cb6cd2..a470c47fa23 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/TopicEvent.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/event/TopicEvent.java @@ -9,7 +9,6 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; -import org.odpi.openmetadata.accessservices.dataengine.model.Database; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; @@ -26,6 +25,18 @@ @EqualsAndHashCode(callSuper = true) @ToString public class TopicEvent extends DataEngineEventHeader { + + /** + * Serial version UID + * -- GETTER -- + * Gets the serial version UID + * @return the serial version UID + * -- SETTER -- + * Sets the serial version UID + * @param serialVersionUID the serial version UID + */ + private static final long serialVersionUID = 1L; + /** * The topic to be created * -- GETTER -- diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/ffdc/DataEngineErrorCode.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/ffdc/DataEngineErrorCode.java index 706e99fd03c..d7dcb80a4d1 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/ffdc/DataEngineErrorCode.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/ffdc/DataEngineErrorCode.java @@ -85,10 +85,10 @@ public enum DataEngineErrorCode implements ExceptionMessageSet { "Topic with qualifiedName {0} was not found", "The system is unable to create a new event type attached to a topic", "Correct the code in the caller to provide the correct topic qualified name."), - SOFTWARE_SERVER_CAPABILITY_NOT_FOUND(400, "OMAS-DATA-ENGINE-400-012", - "Software Server Capability with qualifiedName {0} was not found", - "The system is unable to find the searched Software Server Capability", - "Correct the code in the caller to provide the correct Software Server Capability qualified name."); + ENGINE_NOT_FOUND(400, "OMAS-DATA-ENGINE-400-012", + "Engine with qualifiedName {0} was not found", + "The system is unable to find the searched Engine", + "Correct the code in the caller to provide the correct Engine qualified name."); private static final long serialVersionUID = 1L; diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/SoftwareServerCapability.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/Engine.java similarity index 96% rename from open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/SoftwareServerCapability.java rename to open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/Engine.java index 3610a486f87..cba67e22527 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/SoftwareServerCapability.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/Engine.java @@ -19,7 +19,7 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; /** - * The type Software server capability. + * The type Engine. */ @JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @@ -28,7 +28,7 @@ @ToString @Getter @Setter -public class SoftwareServerCapability implements Serializable { +public class Engine implements Serializable { @Getter(AccessLevel.NONE) @Setter(AccessLevel.NONE) diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/ProcessingState.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/ProcessingState.java index fac72fcae7f..ce5511a0c6f 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/ProcessingState.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/model/ProcessingState.java @@ -7,8 +7,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AccessLevel; +import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; @@ -27,6 +29,8 @@ @ToString(callSuper = true) @Getter @Setter +@AllArgsConstructor +@NoArgsConstructor public class ProcessingState extends Referenceable { @Getter(AccessLevel.NONE) diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/DataEngineRegistrationRequestBody.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/DataEngineRegistrationRequestBody.java index 8908e3563d3..22b76f950fd 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/DataEngineRegistrationRequestBody.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/DataEngineRegistrationRequestBody.java @@ -10,7 +10,7 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; @@ -25,15 +25,15 @@ public class DataEngineRegistrationRequestBody extends DataEngineOMASAPIRequestBody { /** - * Software server capability + * Engine * -- GETTER -- - * Gets the software server capability - * @return the software server capability + * Gets the engine + * @return the engine * -- SETTER -- - * Sets the software server capability - * @param softwareServerCapability the software server capability + * Sets the engine + * @param engine the engine */ @JsonProperty("dataEngine") - private SoftwareServerCapability softwareServerCapability; + private Engine engine; } \ No newline at end of file diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessingStateRequestBody.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessingStateRequestBody.java index 9fb9c08a5c6..289e25c858b 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessingStateRequestBody.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessingStateRequestBody.java @@ -6,8 +6,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; @@ -22,6 +24,8 @@ @Setter @EqualsAndHashCode(callSuper = true) @ToString +@NoArgsConstructor +@AllArgsConstructor public class ProcessingStateRequestBody extends DataEngineOMASAPIRequestBody { private static final long serialVersionUID = 1L; diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-client/pom.xml b/open-metadata-implementation/access-services/data-engine/data-engine-client/pom.xml index 0cfa7c686b2..dae7eba0162 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-client/pom.xml +++ b/open-metadata-implementation/access-services/data-engine/data-engine-client/pom.xml @@ -65,6 +65,11 @@ rest-client-connectors-api + + org.apache.commons + commons-collections4 + + org.springframework spring-core diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineClient.java b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineClient.java index 087a978ec15..50f5e1ba82e 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineClient.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineClient.java @@ -13,7 +13,7 @@ import org.odpi.openmetadata.accessservices.dataengine.model.ProcessHierarchy; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import org.odpi.openmetadata.accessservices.dataengine.rest.FindRequestBody; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; @@ -24,6 +24,7 @@ import org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException; import java.util.List; +import java.util.Map; /** * DataEngineClient provides the client-side interface for a data engine tool to create processes with ports, @@ -68,10 +69,10 @@ void deleteProcess(String userId, String qualifiedName, String guid) throws Inva /** - * Create or update the software server capability entity + * Create or update the engine entity * - * @param userId the name of the calling user - * @param softwareServerCapability the software server capability bean + * @param userId the name of the calling user + * @param engine the engine bean * * @return unique identifier of the server in the repository * @@ -80,7 +81,7 @@ void deleteProcess(String userId, String qualifiedName, String guid) throws Inva * @throws PropertyServerException problem accessing the property server * @throws ConnectorCheckedException problem with the underlying connector (if used) */ - String createExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, + String createExternalDataEngine(String userId, Engine engine) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException, ConnectorCheckedException; @@ -540,4 +541,19 @@ void deleteEventType(String userId, String qualifiedName, String guid) throws In PropertyServerException, UserNotAuthorizedException, ConnectorCheckedException; + + /** + * Create or update the engine's processing state classification with the provided properties + * @param userId the name of the calling user + * @param properties properties of the processing state + */ + void upsertProcessingState(String userId, Map properties) throws PropertyServerException, + InvalidParameterException, UserNotAuthorizedException, ConnectorCheckedException; + + /** + * Get the engine's processing state classification's properties + * + * @param userId the name of the calling user + */ + public Map getProcessingState(String userId) throws PropertyServerException; } diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineEventClient.java b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineEventClient.java index 3c7d1ccc728..f61869d9430 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineEventClient.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineEventClient.java @@ -15,6 +15,7 @@ import org.odpi.openmetadata.accessservices.dataengine.event.PortImplementationEvent; import org.odpi.openmetadata.accessservices.dataengine.event.ProcessEvent; import org.odpi.openmetadata.accessservices.dataengine.event.ProcessHierarchyEvent; +import org.odpi.openmetadata.accessservices.dataengine.event.ProcessingStateEvent; import org.odpi.openmetadata.accessservices.dataengine.event.RelationalTableEvent; import org.odpi.openmetadata.accessservices.dataengine.event.SchemaTypeEvent; import org.odpi.openmetadata.accessservices.dataengine.event.TopicEvent; @@ -29,9 +30,10 @@ import org.odpi.openmetadata.accessservices.dataengine.model.PortImplementation; import org.odpi.openmetadata.accessservices.dataengine.model.Process; import org.odpi.openmetadata.accessservices.dataengine.model.ProcessHierarchy; +import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import org.odpi.openmetadata.accessservices.dataengine.rest.FindRequestBody; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; @@ -40,6 +42,7 @@ import org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException; import java.util.List; +import java.util.Map; /*** @@ -103,13 +106,13 @@ public void deleteProcess(String userId, String qualifiedName, String guid) thro * @throws ConnectorCheckedException problem with the underlying connector (if used) */ @Override - public String createExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, + public String createExternalDataEngine(String userId, Engine engine) throws InvalidParameterException, ConnectorCheckedException { DataEngineRegistrationEvent event = new DataEngineRegistrationEvent(); event.setUserId(userId); event.setExternalSourceName(externalSource); event.setDataEngineEventType(DataEngineEventType.DATA_ENGINE_REGISTRATION_EVENT); - event.setSoftwareServerCapability(softwareServerCapability); + event.setEngine(engine); topicConnector.sendEvent(event); @@ -507,6 +510,27 @@ public void deleteEventType(String userId, String qualifiedName, String guid) th topicConnector.sendEvent(event); } + @Override + public void upsertProcessingState(String userId, Map properties) throws InvalidParameterException, ConnectorCheckedException { + + ProcessingState processingState = new ProcessingState(properties); + + ProcessingStateEvent event = new ProcessingStateEvent(); + + event.setUserId(userId); + event.setExternalSourceName(externalSource); + event.setDataEngineEventType(DataEngineEventType.PROCESSING_STATE_TYPE_EVENT); + event.setProcessingState(processingState); + + topicConnector.sendEvent(event); + } + + @Override + public Map getProcessingState(String userId) { + //async interaction + return null; + } + private DeleteEvent getDeleteEvent(String userId, String qualifiedName, String guid) { DeleteEvent event = new DeleteEvent(); event.setUserId(userId); diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClient.java b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClient.java index c31ed290eef..cf3df17b382 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClient.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/main/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClient.java @@ -2,6 +2,7 @@ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.accessservices.dataengine.client; +import org.apache.commons.collections4.MapUtils; import org.odpi.openmetadata.accessservices.dataengine.model.DataFile; import org.odpi.openmetadata.accessservices.dataengine.model.Database; import org.odpi.openmetadata.accessservices.dataengine.model.DatabaseSchema; @@ -12,9 +13,10 @@ import org.odpi.openmetadata.accessservices.dataengine.model.PortImplementation; import org.odpi.openmetadata.accessservices.dataengine.model.Process; import org.odpi.openmetadata.accessservices.dataengine.model.ProcessHierarchy; +import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import org.odpi.openmetadata.accessservices.dataengine.rest.DataEngineOMASAPIRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.DataEngineRegistrationRequestBody; @@ -29,12 +31,14 @@ import org.odpi.openmetadata.accessservices.dataengine.rest.PortImplementationRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessHierarchyRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessRequestBody; +import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessingStateRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.RelationalTableRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.SchemaTypeRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.TopicRequestBody; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.PropertiesResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.client.OCFRESTClient; import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; @@ -42,7 +46,10 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import java.util.Collections; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * The Data Engine Open Metadata Access Service (OMAS) provides an interface for data engine tools to create @@ -67,6 +74,7 @@ public class DataEngineRESTClient extends OCFRESTClient implements DataEngineCli private static final String FIND_URL_TEMPLATE = DATA_ENGINE_PATH + "find"; private static final String TOPIC_URL_TEMPLATE = DATA_ENGINE_PATH + "topics"; private static final String EVENT_TYPE_URL_TEMPLATE = DATA_ENGINE_PATH + "event-types"; + private static final String PROCESSING_STATE_URL_TEMPLATE = DATA_ENGINE_PATH + "processing-state"; private static final String PROCESS_METHOD_NAME = "createOrUpdateProcess"; private static final String PROCESS_DELETE_METHOD_NAME = "deleteProcess"; @@ -180,7 +188,7 @@ public void deleteProcess(String userId, String qualifiedName, String guid) thro * {@inheritDoc} */ @Override - public String createExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws + public String createExternalDataEngine(String userId, Engine engine) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { @@ -188,7 +196,7 @@ public String createExternalDataEngine(String userId, SoftwareServerCapability s invalidParameterHandler.validateUserId(userId, EXTERNAL_DATA_ENGINE_METHOD_NAME); DataEngineRegistrationRequestBody requestBody = new DataEngineRegistrationRequestBody(); - requestBody.setSoftwareServerCapability(softwareServerCapability); + requestBody.setEngine(engine); return callGUIDPostRESTCall(userId, EXTERNAL_DATA_ENGINE_METHOD_NAME, DATA_ENGINE_REGISTRATION_URL_TEMPLATE, requestBody); } @@ -559,6 +567,34 @@ public void deleteEventType(String userId, String qualifiedName, String guid) th callVoidDeleteRESTCall(userId, EVENT_TYPE_DELETE_METHOD_NAME, EVENT_TYPE_URL_TEMPLATE, requestBody); } + @Override + public void upsertProcessingState(String userId, Map properties) throws PropertyServerException, + InvalidParameterException, UserNotAuthorizedException { + String methodName = "upsertProcessingState"; + + ProcessingState processingState = new ProcessingState(properties); + + ProcessingStateRequestBody requestBody = new ProcessingStateRequestBody(processingState); + requestBody.setExternalSourceName(externalSourceName); + + callVoidPostRESTCall(userId, methodName, PROCESSING_STATE_URL_TEMPLATE, requestBody); + } + + @Override + public Map getProcessingState(String userId) throws PropertyServerException { + String methodName = "getProcessingState"; + + PropertiesResponse restResult = this.callGetRESTCall(methodName, PropertiesResponse.class, + serverPlatformRootURL + PROCESSING_STATE_URL_TEMPLATE, serverName, userId, externalSourceName); + + if(restResult == null || MapUtils.isEmpty(restResult.getProperties())) { + return Collections.emptyMap(); + } + return restResult.getProperties().entrySet() + .stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> (Long) e.getValue())); + } + private void callVoidPostRESTCall(String userId, String methodName, String urlTemplate, DataEngineOMASAPIRequestBody requestBody, Object... params) throws PropertyServerException, InvalidParameterException, UserNotAuthorizedException { super.callVoidPostRESTCall(methodName, serverPlatformRootURL + urlTemplate, requestBody, serverName, userId, params); diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/test/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClientTest.java b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/test/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClientTest.java index 152e50f3376..1f99c42c369 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-client/src/test/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClientTest.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-client/src/test/java/org/odpi/openmetadata/accessservices/dataengine/client/DataEngineRESTClientTest.java @@ -13,6 +13,7 @@ import org.odpi.openmetadata.adapters.connectors.restclients.RESTClientConnector; import org.odpi.openmetadata.adapters.connectors.restclients.ffdc.exceptions.RESTServerException; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.PropertiesResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; @@ -20,6 +21,8 @@ import org.springframework.util.ReflectionUtils; import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; @@ -181,6 +184,33 @@ public void deleteEndpoint() throws RESTServerException, InvalidParameterExcepti verify(connector, times(1)).callDeleteRESTCall(eq("deleteEndpoint"), eq(VoidResponse.class), anyString(), any(), any()); } + @Test + public void upsertProcessingState() throws RESTServerException, InvalidParameterException, PropertyServerException, UserNotAuthorizedException { + VoidResponse response = mockVoidResponse(); + + when(connector.callPostRESTCall(eq("upsertProcessingState"), eq(VoidResponse.class), anyString(), any(), any())) + .thenReturn(response); + dataEngineRESTClient.upsertProcessingState(USER_ID, new HashMap<>()); + + verify(connector, times(1)).callPostRESTCall(eq("upsertProcessingState"), eq(VoidResponse.class), anyString(), any(), any()); + } + + + @Test + public void getProcessingState() throws RESTServerException, PropertyServerException { + Map properties = new HashMap<>(); + properties.put("key", 100L); + PropertiesResponse response = new PropertiesResponse(); + response.setProperties(properties); + + when(connector.callGetRESTCall(eq("getProcessingState"), eq(PropertiesResponse.class), anyString(), any(), any(), + any())).thenReturn(response); + dataEngineRESTClient.getProcessingState(USER_ID); + + verify(connector, times(1)).callGetRESTCall(eq("getProcessingState"), + eq(PropertiesResponse.class), anyString(), any(), any(), any()); + } + private GUIDResponse mockGUIDResponse() { GUIDResponse response = new GUIDResponse(); response.setGUID(GUID); diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/admin/DataEngineServicesInstance.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/admin/DataEngineServicesInstance.java index 34c97a870fc..d3346bb0734 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/admin/DataEngineServicesInstance.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/admin/DataEngineServicesInstance.java @@ -12,6 +12,7 @@ import org.odpi.openmetadata.accessservices.dataengine.model.Database; import org.odpi.openmetadata.accessservices.dataengine.model.DatabaseSchema; import org.odpi.openmetadata.accessservices.dataengine.model.Endpoint; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.EventType; import org.odpi.openmetadata.accessservices.dataengine.model.FileFolder; import org.odpi.openmetadata.accessservices.dataengine.model.Port; @@ -20,7 +21,6 @@ import org.odpi.openmetadata.accessservices.dataengine.model.RelationalColumn; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import org.odpi.openmetadata.accessservices.dataengine.server.converters.CollectionCoverter; import org.odpi.openmetadata.accessservices.dataengine.server.converters.ConnectionConverter; @@ -294,9 +294,9 @@ public class DataEngineServicesInstance extends OMASServiceInstance { serviceName, serverName, invalidParameterHandler, repositoryHandler, repositoryHelper, localServerUserId, securityVerifier, supportedZones, defaultZones, publishZones, auditLog); - final SoftwareCapabilityHandler softwareServerCapabilityHandler = + final SoftwareCapabilityHandler softwareServerCapabilityHandler = new SoftwareCapabilityHandler<>(new DatabaseTableConverter<>(repositoryHelper, serviceName, serverName), - SoftwareServerCapability.class, serviceName, serverName, invalidParameterHandler, repositoryHandler, + Engine.class, serviceName, serverName, invalidParameterHandler, repositoryHandler, repositoryHelper, localServerUserId, securityVerifier, supportedZones, defaultZones, publishZones, auditLog); final AssetHandler topicHandler = new AssetHandler<>(new TopicConverter<>(repositoryHelper, serviceName, serverName), diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineEventTypeHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineEventTypeHandler.java index c3c58ab8417..fed09dd37ad 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineEventTypeHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineEventTypeHandler.java @@ -44,7 +44,7 @@ public class DataEngineEventTypeHandler { * @param invalidParameterHandler handler for managing parameter errors * @param eventTypeHandler provides utilities specific for manipulating event type entities * @param dataEngineCommonHandler provides utilities for manipulating entities - * @param dataEngineRegistrationHandler provides utilities for software server capability entities + * @param dataEngineRegistrationHandler provides utilities for engine entities * @param dataEngineSchemaAttributeHandler provides utilities specific for schema attribute entities */ public DataEngineEventTypeHandler(InvalidParameterHandler invalidParameterHandler, EventTypeHandler eventTypeHandler, diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineFolderHierarchyHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineFolderHierarchyHandler.java index 52ab9fc9164..7073b055e0a 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineFolderHierarchyHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineFolderHierarchyHandler.java @@ -69,7 +69,7 @@ public DataEngineFolderHierarchyHandler(InvalidParameterHandler invalidParameter } /** - * Construct the folder structure in which a data file is stored all the way to the SoftwareServerCapability. Care is + * Construct the folder structure in which a data file is stored all the way to the Engine. Care is * taken to maintain uniqueness of the relationship NestedFile that is between the file and the first folder. * * @param fileGuid data file guid @@ -177,10 +177,10 @@ private String upsertFolder(String externalSourceGuid, String externalSourceName /** * Extracts each folder path and builds FileFolders, with the qualified name of the form * '::'. The order is important, meaning the first folder is the one containing the file - * and the last one the root, and used in creating the folder hierarchy structure al the way to the SoftwareServerCapability + * and the last one the root, and used in creating the folder hierarchy structure al the way to the Engine * * @param pathName file path - * @param externalSourceName name of SoftwareServerCapability + * @param externalSourceName name of Engine * @param methodName method name * * @return list of FileFolders diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEnginePortHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEnginePortHandler.java index 921485a0b9d..ade635f6a62 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEnginePortHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEnginePortHandler.java @@ -61,7 +61,7 @@ public class DataEnginePortHandler { * @param repositoryHelper provides utilities for manipulating the repository services objects * @param dataEngineCommonHandler provides utilities for manipulating entities * @param portHandler provides utilities for manipulating the repository services ports - * @param registrationHandler provides utilities for manipulating software server capability entities + * @param registrationHandler provides utilities for manipulating engine entities */ public DataEnginePortHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, OMRSRepositoryHelper repositoryHelper, DataEngineCommonHandler dataEngineCommonHandler, diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineProcessHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineProcessHandler.java index c413fd3570a..1de9c26587f 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineProcessHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineProcessHandler.java @@ -61,7 +61,7 @@ public class DataEngineProcessHandler { * @param repositoryHelper provides utilities for manipulating the repository services objects * @param assetHandler provides utilities for manipulating the repository services assets * @param dataEngineCommonHandler provides utilities for manipulating entities - * @param registrationHandler provides utilities for manipulating software server capability entities + * @param registrationHandler provides utilities for manipulating engine entities **/ public DataEngineProcessHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, OMRSRepositoryHelper repositoryHelper, AssetHandler assetHandler, diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandler.java index d7e300a5439..dbccdc92f5b 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandler.java @@ -5,7 +5,7 @@ import org.odpi.openmetadata.accessservices.dataengine.ffdc.DataEngineErrorCode; import org.odpi.openmetadata.accessservices.dataengine.model.DeleteSemantic; import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.server.builders.ExternalDataEnginePropertiesBuilder; import org.odpi.openmetadata.accessservices.dataengine.server.mappers.CommonMapper; import org.odpi.openmetadata.accessservices.dataengine.server.service.ClockService; @@ -36,8 +36,8 @@ import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PROCESSING_STATE_CLASSIFICATION_TYPE_NAME; /** - * DataEngineRegistrationHandler manages SoftwareServerCapability objects from external data engines. It runs - * server-side in the DataEngine OMAS and creates software server capability entities through the + * DataEngineRegistrationHandler manages Engine objects from external data engines. It runs + * server-side in the DataEngine OMAS and creates engine entities through the * SoftwareCapabilityHandler. */ public class DataEngineRegistrationHandler { @@ -47,23 +47,23 @@ public class DataEngineRegistrationHandler { private final String serviceName; private final String serverName; private final OMRSRepositoryHelper repositoryHelper; - private final SoftwareCapabilityHandler softwareServerCapabilityHandler; + private final SoftwareCapabilityHandler softwareServerCapabilityHandler; private final InvalidParameterHandler invalidParameterHandler; private final ClockService clockService; /** * Construct the handler information needed to interact with the repository services * - * @param serviceName name of this service - * @param serverName name of the local server - * @param invalidParameterHandler handler for managing parameter errors - * @param repositoryHelper provides utilities for manipulating the repository services objects - * @param softwareServerCapabilityHandler handler for the creation of SoftwareServerCapability objects + * @param serviceName name of this service + * @param serverName name of the local server + * @param invalidParameterHandler handler for managing parameter errors + * @param repositoryHelper provides utilities for manipulating the repository services objects + * @param softwareServerCapabilityHandler handler for the creation of engine objects */ public DataEngineRegistrationHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, OMRSRepositoryHelper repositoryHelper, - SoftwareCapabilityHandler softwareServerCapabilityHandler, + SoftwareCapabilityHandler softwareServerCapabilityHandler, ClockService clockService) { this.serviceName = serviceName; this.serverName = serverName; @@ -74,25 +74,23 @@ public DataEngineRegistrationHandler(String serviceName, String serverName, } /** - * Create the software server capability entity from an external data engine - * - * @param userId the name of the calling user - * @param softwareServerCapability the entity of external data engine + * Create the engine entity from an external data engine * + * @param userId the name of the calling user + * @param engine the entity of external data engine * @return unique identifier of the external data engine in the repository - * * @throws InvalidParameterException the bean properties are invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ - public String upsertExternalDataEngine(String userId, SoftwareServerCapability softwareServerCapability) throws InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException { + public String upsertExternalDataEngine(String userId, Engine engine) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException { final String methodName = "upsertExternalDataEngine"; invalidParameterHandler.validateUserId(userId, methodName); - String externalEngineName = softwareServerCapability.getQualifiedName(); + String externalEngineName = engine.getQualifiedName(); invalidParameterHandler.validateName(externalEngineName, QUALIFIED_NAME_PROPERTY_NAME, methodName); @@ -101,13 +99,13 @@ public String upsertExternalDataEngine(String userId, SoftwareServerCapability s String externalEngineGUID = getExternalDataEngine(userId, externalEngineName); if (externalEngineGUID == null) { externalEngineGUID = softwareServerCapabilityHandler.createSoftwareCapability(userId, null, - null, entityTypeDef.getName(), null, externalEngineName, - softwareServerCapability.getName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), - softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), - softwareServerCapability.getAdditionalProperties(), null, null, null, + null, entityTypeDef.getName(), null, externalEngineName, + engine.getName(), engine.getDescription(), engine.getEngineType(), + engine.getEngineVersion(), engine.getPatchLevel(), engine.getSource(), + engine.getAdditionalProperties(), null, null, null, null, false, false, clockService.getNow(), methodName); } else { - ExternalDataEnginePropertiesBuilder builder = getExternalDataEnginePropertiesBuilder(softwareServerCapability); + ExternalDataEnginePropertiesBuilder builder = getExternalDataEnginePropertiesBuilder(engine); InstanceProperties properties = builder.getInstanceProperties(methodName); softwareServerCapabilityHandler.updateBeanInRepository(userId, externalEngineGUID, externalEngineName, externalEngineGUID, @@ -118,19 +116,17 @@ public String upsertExternalDataEngine(String userId, SoftwareServerCapability s } /** - * Return the guid of a software server capability entity from an external data engine + * Return the guid of an engine entity from an external data engine * * @param userId identifier of calling user * @param qualifiedName qualified name of the external data engine - * * @return the guid of the external data engine - * * @throws InvalidParameterException one of the parameters is null or invalid * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem retrieving the discovery engine definition */ public String getExternalDataEngine(String userId, String qualifiedName) throws InvalidParameterException, UserNotAuthorizedException, - PropertyServerException { + PropertyServerException { final String methodName = "getExternalDataEngineByQualifiedName"; invalidParameterHandler.validateUserId(userId, methodName); @@ -149,43 +145,78 @@ public String getExternalDataEngine(String userId, String qualifiedName) throws } public void removeExternalDataEngine(String userId, String qualifiedName, String externalSourceName, DeleteSemantic deleteSemantic) throws - FunctionNotSupportedException { + FunctionNotSupportedException { final String methodName = "removeExternalDataEngine"; throw new FunctionNotSupportedException(OMRSErrorCode.METHOD_NOT_IMPLEMENTED.getMessageDefinition(methodName, this.getClass().getName(), serverName), this.getClass().getName(), methodName); } - ExternalDataEnginePropertiesBuilder getExternalDataEnginePropertiesBuilder(SoftwareServerCapability softwareServerCapability) { - return new ExternalDataEnginePropertiesBuilder(softwareServerCapability.getQualifiedName(), - softwareServerCapability.getName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), - softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), - softwareServerCapability.getAdditionalProperties(), repositoryHelper, serviceName, serverName); + ExternalDataEnginePropertiesBuilder getExternalDataEnginePropertiesBuilder(Engine engine) { + return new ExternalDataEnginePropertiesBuilder(engine.getQualifiedName(), + engine.getName(), engine.getDescription(), engine.getEngineType(), + engine.getEngineVersion(), engine.getPatchLevel(), engine.getSource(), + engine.getAdditionalProperties(), repositoryHelper, serviceName, serverName); } - public void createDataEngineClassification(String userId, ProcessingState processingState, String externalSourceName) throws - InvalidParameterException, - UserNotAuthorizedException, - PropertyServerException { - final String methodName = "createDataEngineClassification"; + public void upsertProcessingStateClassification(String userId, ProcessingState processingState, String externalSourceName) + throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { + final String methodName = "upsertProcessingStateClassification"; invalidParameterHandler.validateUserId(userId, methodName); String externalSourceGUID = this.getExternalDataEngine(userId, externalSourceName); - if (externalSourceGUID == null) { - ExceptionMessageDefinition messageDefinition = DataEngineErrorCode.SOFTWARE_SERVER_CAPABILITY_NOT_FOUND.getMessageDefinition(externalSourceName); - throw new InvalidParameterException(messageDefinition, this.getClass().getName(), methodName, EXTERNAL_ENGINE_PARAMETER_NAME); - } + validateExternalDataEngine(externalSourceName, methodName, externalSourceGUID); + + EntityDetail retrievedEntity = getDataEngineEntity(userId, externalSourceName, methodName); //Check if the entity has this classification and if it does then merge the syncDatesByKey + Map newSyncDatesByKey = updateSyncDatesByKey(processingState, retrievedEntity); + + if (newSyncDatesByKey.isEmpty()) { + newSyncDatesByKey = processingState.getSyncDatesByKey(); + } + + InstanceProperties instanceProperties = new InstanceProperties(); + instanceProperties = repositoryHelper.addLongMapPropertyToInstance(null, instanceProperties, SYNC_DATES_BY_KEY, + newSyncDatesByKey, methodName); + + softwareServerCapabilityHandler.setClassificationInRepository(userId, null, null, + externalSourceGUID, EXTERNAL_ENGINE_PARAMETER_NAME, ENGINE_TYPE_NAME, PROCESSING_STATE_CLASSIFICATION_TYPE_GUID, + PROCESSING_STATE_CLASSIFICATION_TYPE_NAME, instanceProperties, true, false, + false, clockService.getNow(), methodName); + } + + public ProcessingState getProcessingStateClassification(String userId, String externalSourceName) + throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { + final String methodName = "getProcessingStateClassification"; + invalidParameterHandler.validateUserId(userId, methodName); + + String externalSourceGUID = this.getExternalDataEngine(userId, externalSourceName); + validateExternalDataEngine(externalSourceName, methodName, externalSourceGUID); + + EntityDetail engineEntity = getDataEngineEntity(userId, externalSourceName, methodName); + + Map syncDatesByKey = getSyncDatesByKey(engineEntity); + return new ProcessingState(syncDatesByKey); + } + private EntityDetail getDataEngineEntity(String userId, String externalSourceName, String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { TypeDef entityTypeDef = repositoryHelper.getTypeDefByName(userId, ENGINE_TYPE_NAME); - EntityDetail retrievedEntity = softwareServerCapabilityHandler.getEntityByValue(userId, externalSourceName, CommonMapper.QUALIFIED_NAME_PROPERTY_NAME, + return softwareServerCapabilityHandler.getEntityByValue(userId, externalSourceName, CommonMapper.QUALIFIED_NAME_PROPERTY_NAME, entityTypeDef.getGUID(), entityTypeDef.getName(), Collections.singletonList(CommonMapper.QUALIFIED_NAME_PROPERTY_NAME), - false, false, null, methodName); + false, false, clockService.getNow(), methodName); + } - Map newSyncDatesByKey = new HashMap<>(); + private void validateExternalDataEngine(String externalSourceName, String methodName, String externalSourceGUID) throws InvalidParameterException { + if (externalSourceGUID == null) { + ExceptionMessageDefinition messageDefinition = DataEngineErrorCode.ENGINE_NOT_FOUND.getMessageDefinition(externalSourceName); + throw new InvalidParameterException(messageDefinition, this.getClass().getName(), methodName, EXTERNAL_ENGINE_PARAMETER_NAME); + } + } + private Map updateSyncDatesByKey(ProcessingState processingState, EntityDetail retrievedEntity) { + Map newSyncDatesByKey = new HashMap<>(); if (retrievedEntity.getClassifications() != null) { for (Classification classification : retrievedEntity.getClassifications()) { if (classification != null && classification.getName().equals(PROCESSING_STATE_CLASSIFICATION_TYPE_NAME)) { @@ -198,28 +229,23 @@ public void createDataEngineClassification(String userId, ProcessingState proces } } } + return newSyncDatesByKey; + } - if (newSyncDatesByKey.isEmpty()) { - newSyncDatesByKey = processingState.getSyncDatesByKey(); + private Map getSyncDatesByKey(EntityDetail retrievedEntity) { + Map newSyncDatesByKey = new HashMap<>(); + if (retrievedEntity.getClassifications() != null) { + for (Classification classification : retrievedEntity.getClassifications()) { + if (classification != null && classification.getName().equals(PROCESSING_STATE_CLASSIFICATION_TYPE_NAME)) { + MapPropertyValue syncDatesByKey = (MapPropertyValue) classification.getProperties().getPropertyValue(SYNC_DATES_BY_KEY); + for (Map.Entry entry : syncDatesByKey.getMapValues().getInstanceProperties().entrySet()) { + newSyncDatesByKey.put(entry.getKey().toString(), + ((Long) ((PrimitivePropertyValue) entry.getValue()).getPrimitiveValue()).longValue()); + } + } + } } - - InstanceProperties instanceProperties = new InstanceProperties(); - instanceProperties = repositoryHelper.addLongMapPropertyToInstance(null, instanceProperties, SYNC_DATES_BY_KEY, - newSyncDatesByKey, methodName); - - softwareServerCapabilityHandler.setClassificationInRepository(userId, - null, - null, - externalSourceGUID, - EXTERNAL_ENGINE_PARAMETER_NAME, - ENGINE_TYPE_NAME, - PROCESSING_STATE_CLASSIFICATION_TYPE_GUID, - PROCESSING_STATE_CLASSIFICATION_TYPE_NAME, - instanceProperties, - true, - false, - false, - null, - methodName); + return newSyncDatesByKey; } + } \ No newline at end of file diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRelationalDataHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRelationalDataHandler.java index ab0ecac5f79..c0823695abc 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRelationalDataHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRelationalDataHandler.java @@ -64,7 +64,7 @@ public class DataEngineRelationalDataHandler { * @param relationalDataHandler provides utilities for manipulating the repository services assets * @param databaseSchemaAssetHandler provides utilities for manipulating database schema assets * @param dataEngineCommonHandler provides utilities for manipulating entities - * @param registrationHandler creates software server capability entities + * @param registrationHandler creates engine entities * @param dataEngineConnectionAndEndpointHandler provides utilities specific for manipulating Connections and Endpoints **/ public DataEngineRelationalDataHandler(String serviceName, String serverName, InvalidParameterHandler invalidParameterHandler, diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineTopicHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineTopicHandler.java index 4239e90b087..9bacb51eee3 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineTopicHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineTopicHandler.java @@ -43,7 +43,7 @@ public class DataEngineTopicHandler { * @param invalidParameterHandler handler for managing parameter errors * @param topicHandler provides utilities specific for manipulating topic entities * @param dataEngineCommonHandler provides utilities for manipulating entities - * @param dataEngineRegistrationHandler provides utilities for software server capability entities + * @param dataEngineRegistrationHandler provides utilities for engine entities */ public DataEngineTopicHandler(InvalidParameterHandler invalidParameterHandler, AssetHandler topicHandler, DataEngineRegistrationHandler dataEngineRegistrationHandler, diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/listeners/DataEngineInTopicListener.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/listeners/DataEngineInTopicListener.java index 82a6cb9f0cc..8d33dc205f2 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/listeners/DataEngineInTopicListener.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/listeners/DataEngineInTopicListener.java @@ -135,6 +135,9 @@ public void processEvent(String dataEngineEvent) { case DELETE_EVENT_TYPE_EVENT: dataEngineEventProcessor.processDeleteEventTypeEvent(dataEngineEvent); break; + case PROCESSING_STATE_TYPE_EVENT: + dataEngineEventProcessor.processProcessingStateEvent(dataEngineEvent); + break; default: log.debug("Ignored instance event - unknown event type"); break; diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/processors/DataEngineEventProcessor.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/processors/DataEngineEventProcessor.java index dd2b18d1d43..27b9911d280 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/processors/DataEngineEventProcessor.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/processors/DataEngineEventProcessor.java @@ -17,6 +17,7 @@ import org.odpi.openmetadata.accessservices.dataengine.event.PortImplementationEvent; import org.odpi.openmetadata.accessservices.dataengine.event.ProcessEvent; import org.odpi.openmetadata.accessservices.dataengine.event.ProcessHierarchyEvent; +import org.odpi.openmetadata.accessservices.dataengine.event.ProcessingStateEvent; import org.odpi.openmetadata.accessservices.dataengine.event.RelationalTableEvent; import org.odpi.openmetadata.accessservices.dataengine.event.SchemaTypeEvent; import org.odpi.openmetadata.accessservices.dataengine.event.TopicEvent; @@ -82,7 +83,7 @@ public void processDataEngineRegistrationEvent(String dataEngineEvent) { try { DataEngineRegistrationEvent dataEngineRegistrationEvent = OBJECT_MAPPER.readValue(dataEngineEvent, DataEngineRegistrationEvent.class); dataEngineRESTServices.createExternalDataEngine(dataEngineRegistrationEvent.getUserId(), serverName, - dataEngineRegistrationEvent.getSoftwareServerCapability()); + dataEngineRegistrationEvent.getEngine()); } catch (JsonProcessingException | UserNotAuthorizedException | PropertyServerException | InvalidParameterException e) { logException(dataEngineEvent, methodName, e); @@ -580,6 +581,24 @@ public void processDeleteEventTypeEvent(String dataEngineEvent) { } } + /** + * Process a {@link ProcessingStateEvent} for deleting an event type + * + * @param dataEngineEvent the event to be processed + */ + public void processProcessingStateEvent(String dataEngineEvent) { + final String methodName = "processProcessingStateEvent"; + log.trace(DEBUG_MESSAGE_METHOD, methodName); + try { + ProcessingStateEvent event = OBJECT_MAPPER.readValue(dataEngineEvent, ProcessingStateEvent.class); + + dataEngineRESTServices.upsertProcessingState(event.getUserId(), serverName, event.getProcessingState(), + event.getExternalSourceName()); + } catch (JsonProcessingException e) { + logException(dataEngineEvent, methodName, e); + } + } + private void deletePort(String dataEngineEvent, String methodName, String portType) { log.trace(DEBUG_MESSAGE_METHOD, methodName); try { diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServices.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServices.java index efa9392e0d1..b63b5a6d623 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServices.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServices.java @@ -12,6 +12,7 @@ import org.odpi.openmetadata.accessservices.dataengine.model.Database; import org.odpi.openmetadata.accessservices.dataengine.model.DatabaseSchema; import org.odpi.openmetadata.accessservices.dataengine.model.DeleteSemantic; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.EventType; import org.odpi.openmetadata.accessservices.dataengine.model.LineageMapping; import org.odpi.openmetadata.accessservices.dataengine.model.ParentProcess; @@ -24,7 +25,6 @@ import org.odpi.openmetadata.accessservices.dataengine.model.Referenceable; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import org.odpi.openmetadata.accessservices.dataengine.model.UpdateSemantic; import org.odpi.openmetadata.accessservices.dataengine.rest.DataEngineOMASAPIRequestBody; @@ -62,6 +62,7 @@ import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCResponseBase; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.PropertiesResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.rest.ConnectionResponse; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; @@ -99,7 +100,6 @@ import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PORT_ALIAS_TYPE_NAME; import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PORT_IMPLEMENTATION_TYPE_NAME; import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PORT_TYPE_NAME; -import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PROCESSING_STATE_CLASSIFICATION_TYPE_NAME; import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PROCESS_TYPE_NAME; import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME; import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.QUOTE_CHARACTER_PROPERTY_NAME; @@ -140,6 +140,7 @@ public class DataEngineRESTServices { public static final String EXTERNAL_SOURCE_NAME_PARAMETER_NAME = "externalSourceName"; public static final String UPSERT_METHOD_CALLS_FOR = "Method {} will take longer. Inside it, upsert method will be called for: {} and/or {}"; public static final String TOPIC_PARAMETER_NAME = "topic"; + public static final String PROCESSING_STATE = "processingState"; private static final String EVENT_TYPE_PARAMETER_NAME = "eventType"; private static final String TOPIC_QUALIFIED_NAME_PARAMETER_NAME = "topicQualifiedName"; @@ -147,7 +148,7 @@ public class DataEngineRESTServices { private final DataEngineInstanceHandler instanceHandler = new DataEngineInstanceHandler(); /** - * Create the external data engine as software server capability entity + * Create the external data engine as engine entity * * @param serverName name of server instance to call * @param userId the name of the calling user @@ -166,7 +167,7 @@ public GUIDResponse createExternalDataEngine(String serverName, String userId, restExceptionHandler.handleNoRequestBody(userId, methodName, serverName); return response; } - response.setGUID(createExternalDataEngine(userId, serverName, requestBody.getSoftwareServerCapability())); + response.setGUID(createExternalDataEngine(userId, serverName, requestBody.getEngine())); } catch (Exception error) { restExceptionHandler.captureExceptions(response, error, methodName); } @@ -182,7 +183,7 @@ public GUIDResponse createExternalDataEngine(String serverName, String userId, * @param userId identifier of calling user * @param qualifiedName qualified name of the external data engine * - * @return the unique identifier from a software server capability definition for an external data engine + * @return the unique identifier from an engine definition for an external data engine */ public GUIDResponse getExternalDataEngine(String serverName, String userId, String qualifiedName) { final String methodName = "getExternalDataEngineByQualifiedName"; @@ -758,11 +759,11 @@ public String upsertPortImplementation(String userId, String serverName, PortImp } /** - * Create the external data engine as software server capability entity + * Create the external data engine as engine entity * - * @param userId the name of the calling user - * @param serverName name of server instance to call - * @param softwareServerCapability the software server values + * @param userId the name of the calling user + * @param serverName name of server instance to call + * @param engine the engine values * * @return he unique identifier (guid) of the created external data engine * @@ -770,24 +771,24 @@ public String upsertPortImplementation(String userId, String serverName, PortImp * @throws UserNotAuthorizedException user not authorized to issue this request * @throws PropertyServerException problem accessing the property server */ - public String createExternalDataEngine(String userId, String serverName, SoftwareServerCapability softwareServerCapability) throws + public String createExternalDataEngine(String userId, String serverName, Engine engine) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { final String methodName = "createExternalDataEngine"; - log.debug(DEBUG_MESSAGE_METHOD_DETAILS, methodName, softwareServerCapability); + log.debug(DEBUG_MESSAGE_METHOD_DETAILS, methodName, engine); - if (softwareServerCapability == null) { + if (engine == null) { return null; } DataEngineRegistrationHandler handler = instanceHandler.getRegistrationHandler(userId, serverName, methodName); - String softwareServerCapabilityGUID = handler.upsertExternalDataEngine(userId, softwareServerCapability); + String externalDataEngineGUID = handler.upsertExternalDataEngine(userId, engine); - log.info(EXTERNAL_ENGINE_WAS_REGISTERED, softwareServerCapability.getQualifiedName(), softwareServerCapabilityGUID); - return softwareServerCapabilityGUID; + log.info(EXTERNAL_ENGINE_WAS_REGISTERED, engine.getQualifiedName(), externalDataEngineGUID); + return externalDataEngineGUID; } /** @@ -2192,7 +2193,7 @@ public VoidResponse upsertProcessingState(String userId, String serverName, Proc ProcessingState processingState = processingStateRequestBody.getProcessingState(); if (processingState == null) { - restExceptionHandler.handleMissingValue("processingState", methodName); + restExceptionHandler.handleMissingValue(PROCESSING_STATE, methodName); return response; } return upsertProcessingState(userId, serverName, processingState, processingStateRequestBody.getExternalSourceName()); @@ -2202,6 +2203,21 @@ public VoidResponse upsertProcessingState(String userId, String serverName, Proc return response; } + public PropertiesResponse getProcessingState(String userId, String serverName, String externalSourceName) { + final String methodName = "getProcessingState"; + + PropertiesResponse response = new PropertiesResponse(); + try { + DataEngineRegistrationHandler handler = instanceHandler.getRegistrationHandler(userId, serverName, methodName); + ProcessingState processingState = handler.getProcessingStateClassification(userId, externalSourceName); + Map properties = new HashMap<>(processingState.getSyncDatesByKey()); + response.setProperties(properties); + } catch (Exception error) { + restExceptionHandler.captureExceptions(response, error, methodName); + } + return response; + } + /** * Create or update the ProcessingState with provided map of critical elements and sync states * @@ -2217,7 +2233,7 @@ public VoidResponse upsertProcessingState(String userId, String serverName, Proc VoidResponse response = new VoidResponse(); try { DataEngineRegistrationHandler handler = instanceHandler.getRegistrationHandler(userId, serverName, methodName); - handler.createDataEngineClassification(userId, processingState, externalSourceName); + handler.upsertProcessingStateClassification(userId, processingState, externalSourceName); } catch (Exception error) { restExceptionHandler.captureExceptions(response, error, methodName); } diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandlerTest.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandlerTest.java index 785b32fe3ce..36d49151755 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandlerTest.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineRegistrationHandlerTest.java @@ -13,8 +13,8 @@ import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; import org.odpi.openmetadata.accessservices.dataengine.model.DeleteSemantic; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; import org.odpi.openmetadata.accessservices.dataengine.server.builders.ExternalDataEnginePropertiesBuilder; import org.odpi.openmetadata.accessservices.dataengine.server.mappers.CommonMapper; import org.odpi.openmetadata.accessservices.dataengine.server.service.ClockService; @@ -23,8 +23,12 @@ import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.PrimitivePropertyValue; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.PrimitiveDefCategory; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException; @@ -32,6 +36,8 @@ import java.lang.reflect.InvocationTargetException; import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -72,7 +78,7 @@ class DataEngineRegistrationHandlerTest { private OMRSRepositoryHelper repositoryHelper; @Mock - private SoftwareCapabilityHandler softwareServerCapabilityHandler; + private SoftwareCapabilityHandler softwareServerCapabilityHandler; @Mock private InvalidParameterHandler invalidParameterHandler; @@ -93,18 +99,18 @@ void before() { void upsertExternalDataEngine_createEntity() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { String methodName = "upsertExternalDataEngine"; - SoftwareServerCapability softwareServerCapability = getSoftwareServerCapability(); + Engine engine = getEngine(); when(softwareServerCapabilityHandler.createSoftwareCapability(USER, null, null, ENGINE_TYPE_NAME, null, - softwareServerCapability.getQualifiedName(), - softwareServerCapability.getName(), softwareServerCapability.getDescription(), softwareServerCapability.getEngineType(), - softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), softwareServerCapability.getSource(), - softwareServerCapability.getAdditionalProperties(), null, + engine.getQualifiedName(), + engine.getName(), engine.getDescription(), engine.getEngineType(), + engine.getEngineVersion(), engine.getPatchLevel(), engine.getSource(), + engine.getAdditionalProperties(), null, null, null, null, false, false, null, methodName)).thenReturn(GUID); - String response = registrationHandler.upsertExternalDataEngine(USER, softwareServerCapability); + String response = registrationHandler.upsertExternalDataEngine(USER, engine); assertEquals(GUID, response); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); @@ -115,7 +121,7 @@ void upsertExternalDataEngine_createEntity() throws InvalidParameterException, P void upsertExternalDataEngine_updateEntity() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { String methodName = "upsertExternalDataEngine"; - SoftwareServerCapability softwareServerCapability = getSoftwareServerCapability(); + Engine engine = getEngine(); EntityDetail entityDetail = Mockito.mock(EntityDetail.class); @@ -132,7 +138,7 @@ void upsertExternalDataEngine_updateEntity() throws InvalidParameterException, P SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, ENGINE_TYPE_NAME, null, true, methodName); - String response = registrationHandler.upsertExternalDataEngine(USER, softwareServerCapability); + String response = registrationHandler.upsertExternalDataEngine(USER, engine); assertEquals(GUID, response); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); @@ -153,18 +159,18 @@ void upsertExternalDataEngine_throwsUserNotAuthorizedException() throws Invocati ExternalDataEnginePropertiesBuilder builder = new ExternalDataEnginePropertiesBuilder(QUALIFIED_NAME, NAME, DESCRIPTION, TYPE, VERSION, PATCH_LEVEL, SOURCE, null, repositoryHelper, "serviceName", "serverName"); - SoftwareServerCapability softwareServerCapability = getSoftwareServerCapability(); + Engine engine = getEngine(); when(softwareServerCapabilityHandler.createSoftwareCapability(USER, null, null, ENGINE_TYPE_NAME, null, - softwareServerCapability.getQualifiedName(), softwareServerCapability.getName(), softwareServerCapability.getDescription(), - softwareServerCapability.getEngineType(), softwareServerCapability.getEngineVersion(), softwareServerCapability.getPatchLevel(), - softwareServerCapability.getSource(), softwareServerCapability.getAdditionalProperties(), + engine.getQualifiedName(), engine.getName(), engine.getDescription(), + engine.getEngineType(), engine.getEngineVersion(), engine.getPatchLevel(), + engine.getSource(), engine.getAdditionalProperties(), null, null, null, null, false, false, null, methodName)).thenThrow(mockedException); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> - registrationHandler.upsertExternalDataEngine(USER, softwareServerCapability)); + registrationHandler.upsertExternalDataEngine(USER, engine)); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); } @@ -224,16 +230,16 @@ private void mockEntityTypeDef() { } @Test - void createDataEngineClassification() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, EntityNotKnownException { - String methodName = "createDataEngineClassification"; + void upsertProcessingStateClassification() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, EntityNotKnownException { + String methodName = "upsertProcessingStateClassification"; ProcessingState processingState = getProcessingState(); InstanceProperties properties = new InstanceProperties(); EntityDetail entityDetail = mock(EntityDetail.class); - SoftwareServerCapability softwareServerCapability = getSoftwareServerCapability(); + Engine engine = getEngine(); doReturn(GUID).when(registrationHandler).getExternalDataEngine(USER, - softwareServerCapability.getQualifiedName()); + engine.getQualifiedName()); when(repositoryHelper.addLongMapPropertyToInstance(null, properties, SYNC_DATES_BY_KEY, processingState.getSyncDatesByKey(), methodName)).thenReturn(properties); @@ -250,7 +256,7 @@ void createDataEngineClassification() throws InvalidParameterException, Property PROCESSING_STATE_CLASSIFICATION_TYPE_NAME, properties, true, false, false, null, methodName); - registrationHandler.createDataEngineClassification(USER, processingState, softwareServerCapability.getQualifiedName()); + registrationHandler.upsertProcessingStateClassification(USER, processingState, engine.getQualifiedName()); verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); verify(repositoryHelper, times(1)).addLongMapPropertyToInstance(null, properties, @@ -262,21 +268,21 @@ void createDataEngineClassification() throws InvalidParameterException, Property } @Test - void createDataEngineClassification_throwsUserNotAuthorizedException() throws UserNotAuthorizedException, + void upsertProcessingStateClassification_throwsUserNotAuthorizedException() throws UserNotAuthorizedException, PropertyServerException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvalidParameterException { - String methodName = "createDataEngineClassification"; + String methodName = "upsertProcessingStateClassification"; ProcessingState processingState = getProcessingState(); InstanceProperties properties = new InstanceProperties(); EntityDetail entityDetail = mock(EntityDetail.class); - SoftwareServerCapability softwareServerCapability = getSoftwareServerCapability(); + Engine engine = getEngine(); doReturn(GUID).when(registrationHandler).getExternalDataEngine(USER, - softwareServerCapability.getQualifiedName()); + engine.getQualifiedName()); when(softwareServerCapabilityHandler.getEntityByValue(USER, QUALIFIED_NAME, CommonMapper.QUALIFIED_NAME_PROPERTY_NAME, SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, ENGINE_TYPE_NAME, @@ -295,30 +301,85 @@ void createDataEngineClassification_throwsUserNotAuthorizedException() throws Us null, methodName); UserNotAuthorizedException thrown = assertThrows(UserNotAuthorizedException.class, () -> - registrationHandler.createDataEngineClassification(USER, processingState, softwareServerCapability.getQualifiedName())); + registrationHandler.upsertProcessingStateClassification(USER, processingState, engine.getQualifiedName())); assertTrue(thrown.getMessage().contains("OMAS-DATA-ENGINE-404-001 ")); } + @Test + void getProcessingStateClassification() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, EntityNotKnownException { + String methodName = "getProcessingStateClassification"; + EntityDetail entityDetail = mock(EntityDetail.class); + + ProcessingState processingState = getProcessingState(); + Map newSyncDatesByKey = processingState.getSyncDatesByKey(); + Classification classification = getClassification(newSyncDatesByKey); + + Engine engine = getEngine(); + + doReturn(GUID).when(registrationHandler).getExternalDataEngine(USER, engine.getQualifiedName()); + + when(softwareServerCapabilityHandler.getEntityByValue(USER, QUALIFIED_NAME, CommonMapper.QUALIFIED_NAME_PROPERTY_NAME, + SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, ENGINE_TYPE_NAME, + Collections.singletonList(CommonMapper.QUALIFIED_NAME_PROPERTY_NAME), false, + false, null, methodName)).thenReturn(entityDetail); + + when(entityDetail.getClassifications()).thenReturn(Collections.singletonList(classification)); + + ProcessingState result = registrationHandler.getProcessingStateClassification(USER, QUALIFIED_NAME); + assertEquals(result, processingState); + + verify(invalidParameterHandler, times(1)).validateUserId(USER, methodName); + } + + private Classification getClassification(Map newSyncDatesByKey) { + InstanceProperties resultingProperties = new InstanceProperties(); + for (String mapPropertyName : newSyncDatesByKey.keySet()) + { + Long mapPropertyValue = newSyncDatesByKey.get(mapPropertyName); + + if (mapPropertyValue != null) + { + PrimitivePropertyValue primitivePropertyValue = new PrimitivePropertyValue(); + primitivePropertyValue.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG); + primitivePropertyValue.setPrimitiveValue(mapPropertyValue); + primitivePropertyValue.setTypeName(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG.getName()); + primitivePropertyValue.setTypeGUID(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_LONG.getGUID()); + resultingProperties.setProperty(mapPropertyName, primitivePropertyValue); + } + } + + MapPropertyValue mapPropertyValue = new MapPropertyValue(); + mapPropertyValue.setMapValues(resultingProperties); + InstanceProperties properties = new InstanceProperties(); + properties.setProperty(SYNC_DATES_BY_KEY, mapPropertyValue); + + Classification classification = new Classification(); + classification.setName(PROCESSING_STATE_CLASSIFICATION_TYPE_NAME); + classification.setProperties(properties); + return classification; + } - private SoftwareServerCapability getSoftwareServerCapability() { + private Engine getEngine() { - SoftwareServerCapability softwareServerCapability = new SoftwareServerCapability(); + Engine engine = new Engine(); - softwareServerCapability.setQualifiedName(QUALIFIED_NAME); - softwareServerCapability.setName(NAME); - softwareServerCapability.setDescription(DESCRIPTION); - softwareServerCapability.setEngineType(TYPE); - softwareServerCapability.setEngineVersion(VERSION); - softwareServerCapability.setPatchLevel(PATCH_LEVEL); - softwareServerCapability.setSource(SOURCE); + engine.setQualifiedName(QUALIFIED_NAME); + engine.setName(NAME); + engine.setDescription(DESCRIPTION); + engine.setEngineType(TYPE); + engine.setEngineVersion(VERSION); + engine.setPatchLevel(PATCH_LEVEL); + engine.setSource(SOURCE); - return softwareServerCapability; + return engine; } private ProcessingState getProcessingState() { ProcessingState processingState = new ProcessingState(); - processingState.setSyncDatesByKey(Collections.EMPTY_MAP); + Map syncKeys = new HashMap<>(); + syncKeys.put("key", 100L); + processingState.setSyncDatesByKey(syncKeys); return processingState; } } \ No newline at end of file diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServicesTest.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServicesTest.java index 141708f5e32..d9dc9e6a40a 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServicesTest.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/service/DataEngineRESTServicesTest.java @@ -28,9 +28,10 @@ import org.odpi.openmetadata.accessservices.dataengine.model.PortImplementation; import org.odpi.openmetadata.accessservices.dataengine.model.PortType; import org.odpi.openmetadata.accessservices.dataengine.model.Process; +import org.odpi.openmetadata.accessservices.dataengine.model.ProcessingState; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.accessservices.dataengine.model.Topic; import org.odpi.openmetadata.accessservices.dataengine.model.UpdateSemantic; import org.odpi.openmetadata.accessservices.dataengine.rest.DataEngineRegistrationRequestBody; @@ -43,6 +44,7 @@ import org.odpi.openmetadata.accessservices.dataengine.rest.PortAliasRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.PortImplementationRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessRequestBody; +import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessingStateRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.RelationalTableRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.SchemaTypeRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.TopicRequestBody; @@ -61,6 +63,7 @@ import org.odpi.openmetadata.accessservices.dataengine.server.handlers.DataEngineTopicHandler; import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.PropertiesResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; @@ -87,6 +90,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; @@ -229,7 +233,7 @@ void createExternalDataEngine() throws InvalidParameterException, PropertyServer UserNotAuthorizedException { mockRegistrationHandler("createExternalDataEngine"); - when(dataEngineRegistrationHandler.upsertExternalDataEngine(USER, getSoftwareServerCapability())).thenReturn(EXTERNAL_SOURCE_DE_GUID); + when(dataEngineRegistrationHandler.upsertExternalDataEngine(USER, getEngine())).thenReturn(EXTERNAL_SOURCE_DE_GUID); DataEngineRegistrationRequestBody requestBody = mockDataEngineRegistrationRequestBody(); @@ -251,7 +255,7 @@ void createExternalDataEngine_ResponseWithCapturedInvalidParameterException() th mockRegistrationHandler(methodName); InvalidParameterException mockedException = mockException(InvalidParameterException.class, methodName); - when(dataEngineRegistrationHandler.upsertExternalDataEngine(USER, getSoftwareServerCapability())).thenThrow(mockedException); + when(dataEngineRegistrationHandler.upsertExternalDataEngine(USER, getEngine())).thenThrow(mockedException); DataEngineRegistrationRequestBody requestBody = mockDataEngineRegistrationRequestBody(); @@ -273,7 +277,7 @@ void createExternalDataEngine_ResponseWithCapturedUserNotAuthorizedException() t mockRegistrationHandler(methodName); UserNotAuthorizedException mockedException = mockException(UserNotAuthorizedException.class, methodName); - when(dataEngineRegistrationHandler.upsertExternalDataEngine(USER, getSoftwareServerCapability())).thenThrow(mockedException); + when(dataEngineRegistrationHandler.upsertExternalDataEngine(USER, getEngine())).thenThrow(mockedException); DataEngineRegistrationRequestBody requestBody = mockDataEngineRegistrationRequestBody(); @@ -1343,6 +1347,47 @@ void deleteEventType_withGuid() throws InvalidParameterException, PropertyServer GUID, QUALIFIED_NAME, EXTERNAL_SOURCE_DE_QUALIFIED_NAME, DeleteSemantic.SOFT); } + @Test + void upsertProcessingState() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { + mockRegistrationHandler("upsertProcessingState"); + + ProcessingState processingState = new ProcessingState(); + ProcessingStateRequestBody requestBody = mockProcessingStateRequestBody(processingState); + + doNothing().when(dataEngineRegistrationHandler).upsertProcessingStateClassification(USER, processingState, + EXTERNAL_SOURCE_DE_QUALIFIED_NAME); + + dataEngineRESTServices.upsertProcessingState(USER, SERVER_NAME, requestBody); + + verify(dataEngineRegistrationHandler, times(1)).upsertProcessingStateClassification(USER, + processingState, EXTERNAL_SOURCE_DE_QUALIFIED_NAME); + } + + @Test + void getProcessingState() throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException { + mockRegistrationHandler("getProcessingState"); + Map responseProperties = new HashMap<>(); + responseProperties.put("key", 100L); + PropertiesResponse propertiesResponse = new PropertiesResponse(); + propertiesResponse.setProperties(responseProperties); + + Map classificationProperties = new HashMap<>(); + classificationProperties.put("key", 100L); + ProcessingState processingState = new ProcessingState(); + processingState.setSyncDatesByKey(classificationProperties); + + when(dataEngineRegistrationHandler.getProcessingStateClassification(USER, + EXTERNAL_SOURCE_DE_QUALIFIED_NAME)).thenReturn(processingState); + + PropertiesResponse result = dataEngineRESTServices.getProcessingState(USER, SERVER_NAME, + EXTERNAL_SOURCE_DE_QUALIFIED_NAME); + + assertEquals(result, propertiesResponse); + + verify(dataEngineRegistrationHandler, times(1)).getProcessingStateClassification(USER, + EXTERNAL_SOURCE_DE_QUALIFIED_NAME); + } + private DeleteRequestBody getDeleteRequestBody() { DeleteRequestBody deleteRequestBody = new DeleteRequestBody(); deleteRequestBody.setQualifiedName(QUALIFIED_NAME); @@ -1409,7 +1454,7 @@ private void mockEventTypeHandler(String methodName) throws InvalidParameterExce private DataEngineRegistrationRequestBody mockDataEngineRegistrationRequestBody() { DataEngineRegistrationRequestBody requestBody = new DataEngineRegistrationRequestBody(); - requestBody.setSoftwareServerCapability(getSoftwareServerCapability()); + requestBody.setEngine(getEngine()); return requestBody; } @@ -1420,6 +1465,13 @@ private SchemaTypeRequestBody mockSchemaTypeRequestBody() { return requestBody; } + private ProcessingStateRequestBody mockProcessingStateRequestBody(ProcessingState processingState) { + ProcessingStateRequestBody requestBody = new ProcessingStateRequestBody(); + requestBody.setProcessingState(processingState); + requestBody.setExternalSourceName(EXTERNAL_SOURCE_DE_QUALIFIED_NAME); + return requestBody; + } + private PortImplementationRequestBody mockPortImplementationRequestBody() { PortImplementationRequestBody requestBody = new PortImplementationRequestBody(); requestBody.setPortImplementation(portImplementation); @@ -1451,18 +1503,18 @@ private DataFileRequestBody mockDataFileRequestBody(DataFile dataFile) { return dataFileRequestBody; } - private SoftwareServerCapability getSoftwareServerCapability() { - SoftwareServerCapability softwareServerCapability = new SoftwareServerCapability(); + private Engine getEngine() { + Engine engine = new Engine(); - softwareServerCapability.setQualifiedName(EXTERNAL_SOURCE_DE_QUALIFIED_NAME); - softwareServerCapability.setName(NAME); - softwareServerCapability.setDescription(DESCRIPTION); - softwareServerCapability.setEngineType(TYPE); - softwareServerCapability.setEngineVersion(VERSION); - softwareServerCapability.setPatchLevel(PATCH_LEVEL); - softwareServerCapability.setSource(SOURCE); + engine.setQualifiedName(EXTERNAL_SOURCE_DE_QUALIFIED_NAME); + engine.setName(NAME); + engine.setDescription(DESCRIPTION); + engine.setEngineType(TYPE); + engine.setEngineVersion(VERSION); + engine.setPatchLevel(PATCH_LEVEL); + engine.setSource(SOURCE); - return softwareServerCapability; + return engine; } private DatabaseRequestBody mockDatabaseRequestBody() { diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResource.java b/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResource.java index 03e25faf2b1..fa273d413c3 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResource.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResource.java @@ -23,6 +23,7 @@ import org.odpi.openmetadata.accessservices.dataengine.server.service.DataEngineRESTServices; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.PropertiesResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.rest.ConnectionResponse; import org.springframework.web.bind.annotation.DeleteMapping; @@ -31,6 +32,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import static org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper.PORT_ALIAS_TYPE_NAME; @@ -59,13 +61,13 @@ public DataEngineResource() { } /** - * Register external data engine as source of metadata by creating a software server capability entity + * Register external data engine as source of metadata by creating an engine entity * * @param serverName name of server instance to call * @param userId the name of the calling user * @param requestBody properties of the entity * - * @return unique identifier of the software server capability + * @return unique identifier of the engine */ @PostMapping(path = "/registration") public GUIDResponse createExternalDataEngine(@PathVariable("serverName") String serverName, @@ -75,13 +77,13 @@ public GUIDResponse createExternalDataEngine(@PathVariable("serverName") String } /** - * Return the unique identifier of an external data engine from a software server capability definition. + * Return the unique identifier of an external data engine from an engine definition. * * @param serverName name of server instance to call * @param userId identifier of calling user - * @param qualifiedName qualified name of the software server capability + * @param qualifiedName qualified name of the engine * - * @return unique identified of the software server capability + * @return unique identified of the engine */ @GetMapping(path = "/registration/{qualifiedName}") public GUIDResponse getExternalDataEngineByQualifiedName(@PathVariable String serverName, @@ -558,4 +560,18 @@ public VoidResponse upsertProcessingState(@PathVariable("userId") String userId, return restAPI.upsertProcessingState(userId, serverName, requestBody); } + /** + * Get the data engine's processing state classification properties + * + * @param serverName name of server instance to call + * @param userId the name of the calling user + * @return PropertiesResponse response + */ + @GetMapping(path = "/processing-state") + public PropertiesResponse getProcessingState(@PathVariable("userId") String userId, + @PathVariable("serverName") String serverName, + @RequestParam("dataEngine") String externalSourceName) { + return restAPI.getProcessingState(userId, serverName, externalSourceName); + } + } diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResourceTest.java b/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResourceTest.java index 1c693299861..1804f8965fb 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResourceTest.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-spring/src/test/java/org/odpi/openmetadata/accessservices/dataengine/server/spring/DataEngineResourceTest.java @@ -17,6 +17,7 @@ import org.odpi.openmetadata.accessservices.dataengine.rest.PortImplementationRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessHierarchyRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessRequestBody; +import org.odpi.openmetadata.accessservices.dataengine.rest.ProcessingStateRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.SchemaTypeRequestBody; import org.odpi.openmetadata.accessservices.dataengine.rest.TopicRequestBody; import org.odpi.openmetadata.accessservices.dataengine.server.service.DataEngineRESTServices; @@ -30,6 +31,7 @@ class DataEngineResourceTest { private static final String USER = "user"; private static final String SERVER_NAME = "serverName"; + private static final String DATA_ENGINE = "DataEngine"; @Mock private DataEngineRESTServices dataEngineRestServices; @@ -132,4 +134,19 @@ void testDeleteEventTypes() { verify(dataEngineRestServices, times(1)).deleteEventType(USER, SERVER_NAME, requestBody); } + + @Test + void testUpsertProcessingState() { + ProcessingStateRequestBody requestBody = new ProcessingStateRequestBody(); + dataEngineResource.upsertProcessingState(USER, SERVER_NAME, requestBody); + + verify(dataEngineRestServices, times(1)).upsertProcessingState(USER, SERVER_NAME, requestBody); + } + + @Test + void testGetProcessingState() { + dataEngineResource.getProcessingState(USER, SERVER_NAME, DATA_ENGINE); + + verify(dataEngineRestServices, times(1)).getProcessingState(USER, SERVER_NAME, DATA_ENGINE); + } } \ No newline at end of file diff --git a/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-asset_endpoints.postman_collection.json b/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-asset_endpoints.postman_collection.json index 7ad041fbf0d..380aa81923d 100644 --- a/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-asset_endpoints.postman_collection.json +++ b/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-asset_endpoints.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "8099fb01-9085-42ff-8560-049eb7c9a8d4", + "_postman_id": "09b88582-5fe0-4192-886d-3234ba2b936d", "name": "DataEngine - asset endpoints", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, @@ -3282,6 +3282,63 @@ } }, "response": [] + }, + { + "name": "10.2 Get Processing State Classification", + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "demo", + "type": "string" + }, + { + "key": "password", + "value": "demo", + "type": "string" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "GET", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "application/json" + } + ], + "url": { + "raw": "{{base-url}}/servers/{{server-id}}/open-metadata/access-services/data-engine/users/{{user-id}}/processing-state?dataEngine=(organization)=Company::(project)=ExternalDataPlatform", + "host": [ + "{{base-url}}" + ], + "path": [ + "servers", + "{{server-id}}", + "open-metadata", + "access-services", + "data-engine", + "users", + "{{user-id}}", + "processing-state" + ], + "query": [ + { + "key": "dataEngine", + "value": "(organization)=Company::(project)=ExternalDataPlatform" + } + ] + } + }, + "response": [] } ] } \ No newline at end of file diff --git a/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-topics-lienage_examples.postman_collection.json b/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-topics-lineage_examples.postman_collection.json similarity index 98% rename from open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-topics-lienage_examples.postman_collection.json rename to open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-topics-lineage_examples.postman_collection.json index 4e32b1f61b0..3434b953074 100644 --- a/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-topics-lienage_examples.postman_collection.json +++ b/open-metadata-implementation/access-services/data-engine/docs/samples/collections/DataEngine-topics-lineage_examples.postman_collection.json @@ -1,7 +1,7 @@ { "info": { "_postman_id": "489e39b7-720b-4c6e-9a0d-0dcbfebde4ad", - "name": "Data Engine - Topics lienage examples", + "name": "Data Engine - Topics lineage examples", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ @@ -256,8 +256,7 @@ "{{user-id}}", "processes" ] - }, - "description": "Create a SoftwareServerCapability entity to represent the Asset Manager." + } }, "response": [] }, @@ -297,8 +296,7 @@ "{{user-id}}", "lineage-mappings" ] - }, - "description": "Create a SoftwareServerCapability entity to represent the Asset Manager." + } }, "response": [] }, @@ -393,8 +391,7 @@ "{{user-id}}", "lineage-mappings" ] - }, - "description": "Create a SoftwareServerCapability entity to represent the Asset Manager." + } }, "response": [] }, diff --git a/open-metadata-implementation/access-services/data-engine/docs/samples/events/DataEngine_upsert_events.txt b/open-metadata-implementation/access-services/data-engine/docs/samples/events/DataEngine_upsert_events.txt index 44aa48b847b..17689d2fc29 100644 --- a/open-metadata-implementation/access-services/data-engine/docs/samples/events/DataEngine_upsert_events.txt +++ b/open-metadata-implementation/access-services/data-engine/docs/samples/events/DataEngine_upsert_events.txt @@ -1,4 +1,4 @@ -{"class":"DataEngineRegistrationEvent","eventVersionId":1,"dataEngineEventType":"DATA_ENGINE_REGISTRATION_EVENT","userId":"OMAGServer","softwareServerCapability":{"qualifiedName":"(organization)=Company::(project)=ExternalDataPlatform","displayName":"ExternalDataEngine","description":"Requesting to register external data engine capability","engineType":"DataEngine","engineVersion":"1","enginePatchLevel":"1","vendor":"Company","version":"1","source":"source"}} +{"class":"DataEngineRegistrationEvent","eventVersionId":1,"dataEngineEventType":"DATA_ENGINE_REGISTRATION_EVENT","userId":"OMAGServer","engine":{"qualifiedName":"(organization)=Company::(project)=ExternalDataPlatform","displayName":"ExternalDataEngine","description":"Requesting to register external data engine capability","engineType":"DataEngine","engineVersion":"1","enginePatchLevel":"1","vendor":"Company","version":"1","source":"source"}} {"class":"SchemaTypeEvent","eventVersionId":1,"dataEngineEventType":"SCHEMA_TYPE_EVENT","userId":"OMAGServer","externalSourceName":"(organization)=Company::(project)=ExternalDataPlatform","schema":{"qualifiedName":"extern:virtual:asset","displayName":"EMPLOYEE","columns":[{"qualifiedName":"extern:virtual:asset:schema-attribute-1","displayName":"DEPT","elementPosition":0},{"qualifiedName":"extern:virtual:asset:schema-attribute-2","displayName":"EMPSTATUS","elementPosition":0}]}} {"class":"DataFileEvent","eventVersionId":1,"dataEngineEventType":"DATA_FILE_EVENT","userId":"OMAGServer","externalSourceName":"(organization)=Company::(project)=ExternalDataPlatform","file":{"fileType":"CSVFile","qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=names.csv","displayName":"names.csv","pathName":"/data/files/minimal/names.csv","networkAddress":"localhost","additionalProperties":{"include_for_business_lineage":true,"path":"/data/files/minimal","store_type":"Local"},"columns":[{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=names.csv::(data_file_record)=names::(data_file_field)=Id","displayName":"Id","additionalProperties":{"odbc_type":"BIGINT"},"allowDuplicates":true,"deprecated":false,"nullable":false,"position":1,"minCardinality":1,"maxCardinality":1},{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=names.csv::(data_file_record)=names::(data_file_field)=First","displayName":"First","additionalProperties":{"odbc_type":"VARCHAR"},"allowDuplicates":true,"deprecated":false,"nullable":true,"position":2,"minCardinality":0,"maxCardinality":1},{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=names.csv::(data_file_record)=names::(data_file_field)=Last","displayName":"Last","additionalProperties":{"odbc_type":"VARCHAR"},"allowDuplicates":true,"deprecated":false,"nullable":true,"position":3,"minCardinality":0,"maxCardinality":1},{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=names.csv::(data_file_record)=names::(data_file_field)=Location","displayName":"Location","additionalProperties":{"odbc_type":"VARCHAR"},"allowDuplicates":true,"deprecated":false,"nullable":false,"position":4,"minCardinality":1,"maxCardinality":1}]}} {"class":"DataFileEvent","eventVersionId":1,"dataEngineEventType":"DATA_FILE_EVENT","userId":"OMAGServer","externalSourceName":"(organization)=Company::(project)=ExternalDataPlatform","file":{"fileType":"CSVFile","qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=emplname.csv","displayName":"emplname.csv","pathName":"/data/files/minimal/emplname.csv","networkAddress":"localhost","additionalProperties":{"include_for_business_lineage":true,"path":"/data/files/minimal","store_type":"Local"},"columns":[{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=emplname.csv::(data_file_record)=emplname::(data_file_field)=EMPID","displayName":"EMPID","additionalProperties":{"odbc_type":"BIGINT"},"allowDuplicates":true,"deprecated":false,"nullable":false,"position":1,"minCardinality":1,"maxCardinality":1},{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=emplname.csv::(data_file_record)=emplname::(data_file_field)=FNAME","displayName":"FNAME","additionalProperties":{"odbc_type":"VARCHAR"},"allowDuplicates":true,"deprecated":false,"nullable":true,"position":2,"minCardinality":0,"maxCardinality":1},{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=emplname.csv::(data_file_record)=emplname::(data_file_field)=LNAME","displayName":"LNAME","additionalProperties":{"odbc_type":"VARCHAR"},"allowDuplicates":true,"deprecated":false,"nullable":true,"position":3,"minCardinality":0,"maxCardinality":1},{"qualifiedName":"(host)=HOST::(data_file_folder)=/::(data_file_folder)=data::(data_file_folder)=files::(data_file_folder)=minimal::(data_file)=emplname.csv::(data_file_record)=emplname::(data_file_field)=LOCID","displayName":"LOCID","additionalProperties":{"odbc_type":"VARCHAR"},"allowDuplicates":true,"deprecated":false,"nullable":false,"position":4,"minCardinality":1,"maxCardinality":1}]}} diff --git a/open-metadata-implementation/access-services/data-engine/docs/scenarios/README.md b/open-metadata-implementation/access-services/data-engine/docs/scenarios/README.md index 3fa1afebd0d..907a197fa81 100644 --- a/open-metadata-implementation/access-services/data-engine/docs/scenarios/README.md +++ b/open-metadata-implementation/access-services/data-engine/docs/scenarios/README.md @@ -8,8 +8,8 @@ Below is the list of tasks supported by Data Engine OMAS. #### External Tool registration -Typically the first action to take for an external tool is to [register](register-external-tool.md) as a -[software-server-capability](../../../docs/concepts/server-capabilities). +Typically, the first action to take for an external tool is to [register](register-external-tool.md) as an +[engine](../../../docs/concepts/server-capabilities). #### External Tool lookup diff --git a/open-metadata-implementation/access-services/data-engine/docs/scenarios/lookup-registration-tool.md b/open-metadata-implementation/access-services/data-engine/docs/scenarios/lookup-registration-tool.md index d9c0db9bc78..a3fbd9dcdbd 100644 --- a/open-metadata-implementation/access-services/data-engine/docs/scenarios/lookup-registration-tool.md +++ b/open-metadata-implementation/access-services/data-engine/docs/scenarios/lookup-registration-tool.md @@ -3,7 +3,7 @@ # Lookup an external tool -An external tool can lookup for the software server capability entity created at registration step. +An external tool can lookup for the engine entity created at registration step. Request to use is: [lookup-external-tool](../../data-engine-server/docs/scenarios/lookup-registration.md) diff --git a/open-metadata-implementation/access-services/data-engine/docs/scenarios/register-external-tool.md b/open-metadata-implementation/access-services/data-engine/docs/scenarios/register-external-tool.md index 75a4f30f5da..534946c4c0f 100644 --- a/open-metadata-implementation/access-services/data-engine/docs/scenarios/register-external-tool.md +++ b/open-metadata-implementation/access-services/data-engine/docs/scenarios/register-external-tool.md @@ -5,7 +5,7 @@ For an external tool to submit metadata to Data Engine OMAS it needs to first register. -This implies creating a SoftwareServerCapability entity with the properties defining the external tool. +This implies creating an Engine entity with the properties defining the external tool. Request to use is: [register-external-tool](../../data-engine-server/docs/scenarios/register-data-engine-tool.md) diff --git a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineConnectorBase.java b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineConnectorBase.java index 9ce00de1afc..7bdbe30d7f4 100644 --- a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineConnectorBase.java +++ b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineConnectorBase.java @@ -38,6 +38,12 @@ public abstract class DataEngineConnectorBase extends ConnectorBase implements D @Override public boolean requiresPolling() { return true; } + @Override + public String getProcessingStateSyncKey() { + log.warn("DataEngineConnectorBase::getProcessingStateSyncKey() is not overridden (unimplemented)."); + return null; + } + /** * Retrieve the date and time at which changes were last synchronized. * diff --git a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineInterface.java b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineInterface.java index b304fe9e1da..446d20d93a4 100644 --- a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineInterface.java +++ b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-connector/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/connectors/DataEngineInterface.java @@ -5,11 +5,13 @@ */ package org.odpi.openmetadata.governanceservers.dataengineproxy.connectors; -import org.odpi.openmetadata.accessservices.dataengine.model.*; +import org.odpi.openmetadata.accessservices.dataengine.model.LineageMapping; import org.odpi.openmetadata.accessservices.dataengine.model.Process; -import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectionCheckedException; +import org.odpi.openmetadata.accessservices.dataengine.model.ProcessHierarchy; +import org.odpi.openmetadata.accessservices.dataengine.model.Referenceable; +import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import java.util.Date; @@ -25,7 +27,7 @@ public interface DataEngineInterface { * * @return SoftwareCapability */ - SoftwareServerCapability getDataEngineDetails(); + Engine getDataEngineDetails(); /** * Indicates whether the data engine requires polling (true) or is capable of notifying of changes on its own @@ -35,6 +37,13 @@ public interface DataEngineInterface { */ boolean requiresPolling(); + /** + * Gets processing state sync key. + * + * @return the processing state sync key + */ + String getProcessingStateSyncKey(); + /** * Retrieve the date and time at which changes were last synchronized. * diff --git a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/README.md b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/README.md index 360169c4e0c..6624cacdccc 100644 --- a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/README.md +++ b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/README.md @@ -13,7 +13,7 @@ In essence, this is to carry out the following: 1. Setup connectivity to a [Data Engine OMAS](../../../access-services/data-engine). (See below section [Configuring interface type for Data Engine OMAS](#configuring-interface-type-for-data-engine-omas)) 1. Setup connectivity to a data engine, through the configured data engine connection of a [Data Engine Proxy Connector](../data-engine-proxy-connector). -1. Ensure a `SoftwareServerCapability` exists to represent this data engine via the Data Engine OMAS. +1. Ensure an `Engine` exists to represent this data engine via the Data Engine OMAS. 1. Poll the data engine every defined interval (60 seconds by default) for any changes: 1. First send any changed `SchemaType`s via the Data Engine OMAS. 1. Then send any changed `PortImplementation`s via the Data Engine OMAS. diff --git a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/processor/DataEngineProxyService.java b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/processor/DataEngineProxyService.java index 937070a056b..86ea0823360 100644 --- a/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/processor/DataEngineProxyService.java +++ b/open-metadata-implementation/governance-servers/data-engine-proxy-services/data-engine-proxy-services-server/src/main/java/org/odpi/openmetadata/governanceservers/dataengineproxy/processor/DataEngineProxyService.java @@ -3,6 +3,7 @@ package org.odpi.openmetadata.governanceservers.dataengineproxy.processor; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; import org.odpi.openmetadata.accessservices.dataengine.client.DataEngineClient; import org.odpi.openmetadata.accessservices.dataengine.model.DataFile; import org.odpi.openmetadata.accessservices.dataengine.model.Database; @@ -11,7 +12,7 @@ import org.odpi.openmetadata.accessservices.dataengine.model.ProcessHierarchy; import org.odpi.openmetadata.accessservices.dataengine.model.Referenceable; import org.odpi.openmetadata.accessservices.dataengine.model.SchemaType; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.adminservices.configuration.properties.DataEngineProxyConfig; import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; @@ -27,6 +28,7 @@ import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; /** @@ -35,11 +37,11 @@ */ public class DataEngineProxyService implements Runnable { - private OMRSAuditLog auditLog; - private DataEngineProxyConfig dataEngineProxyConfig; - private DataEngineClient dataEngineOMASClient; - private DataEngineConnectorBase connector; - private String userId; + private final OMRSAuditLog auditLog; + private final DataEngineProxyConfig dataEngineProxyConfig; + private final DataEngineClient dataEngineOMASClient; + private final DataEngineConnectorBase connector; + private final String userId; private final AtomicBoolean running = new AtomicBoolean(false); @@ -50,7 +52,7 @@ public void initialize() throws ConnectorCheckedException, UserNotAuthorizedExce // Retrieve the base information from the connector if (connector != null) { - SoftwareServerCapability dataEngineDetails = connector.getDataEngineDetails(); + Engine dataEngineDetails = connector.getDataEngineDetails(); dataEngineOMASClient.createExternalDataEngine(userId, dataEngineDetails); dataEngineOMASClient.setExternalSourceName(dataEngineDetails.getQualifiedName()); if (connector.requiresPolling()) { @@ -98,7 +100,6 @@ public void run() { running.set(true); while (running.get()) { try { - // Start with the last change synchronization date and time Date changesLastSynced = connector.getChangesLastSynced(); @@ -162,6 +163,8 @@ public void load() { upsertProcessHierarchies(now, now); upsertLineageMappings(now, now); + upsertProcessingState(now); + } catch (PropertyServerException | UserNotAuthorizedException | InvalidParameterException | ConnectorCheckedException e) { this.auditLog.logException(methodName, DataEngineProxyAuditCode.RUNTIME_EXCEPTION.getMessageDefinition(), e); } @@ -173,6 +176,23 @@ public void pollProcessChanges(String processId) { * */ } + private void upsertProcessingState(Date changesCutoff) throws PropertyServerException, InvalidParameterException, UserNotAuthorizedException, ConnectorCheckedException { + String processingStateKey = connector.getProcessingStateSyncKey(); + Map properties = Collections.singletonMap(processingStateKey, changesCutoff.getTime()); + dataEngineOMASClient.upsertProcessingState(userId, properties); + } + + private Date getProcessingState() throws PropertyServerException { + String processingStateKey = connector.getProcessingStateSyncKey(); + + Map processingState = dataEngineOMASClient.getProcessingState(userId); + if(MapUtils.isNotEmpty(processingState)) { + Long lastSync = processingState.get(processingStateKey); + return new Date(lastSync); + } + return null; + } + /** * Sleep until the next polling interval comes. */ diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/SoftwareServerCapabilitySetupService.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/EngineSetupService.java similarity index 60% rename from open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/SoftwareServerCapabilitySetupService.java rename to open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/EngineSetupService.java index 9cf20f78b81..963d4429803 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/SoftwareServerCapabilitySetupService.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/EngineSetupService.java @@ -3,7 +3,7 @@ package org.odpi.openmetadata.accessservices.dataengine; import org.odpi.openmetadata.accessservices.dataengine.client.DataEngineClient; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; @@ -12,32 +12,32 @@ /** * Generates test data of type SoftwareCapability, and triggers requests via client for aforementioned type */ -public class SoftwareServerCapabilitySetupService { +public class EngineSetupService { - public SoftwareServerCapabilitySetupService() { } + public EngineSetupService() { } /** * Registers an external data engine source. * * @param userId the user which creates the data engine * @param dataEngineOMASClient the data engine client that is used to create the external data engine - * @param softwareServerCapability capability to create. If null, a default will be used + * @param engine capability to create. If null, a default will be used * - * @return software server capability containing sent values + * @return engine containing sent values * * @throws InvalidParameterException one of the parameters is null or invalid. * @throws ConnectorCheckedException there are errors in the initialization of the connector. * @throws PropertyServerException there is a problem retrieving information from the property server(s). * @throws UserNotAuthorizedException the requesting user is not authorized to issue this request. */ - public SoftwareServerCapability createExternalDataEngine(String userId, DataEngineClient dataEngineOMASClient, - SoftwareServerCapability softwareServerCapability) + public Engine createExternalDataEngine(String userId, DataEngineClient dataEngineOMASClient, + Engine engine) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException, ConnectorCheckedException { - if(softwareServerCapability == null){ - softwareServerCapability = getDefaultSoftwareServerCapability(); + if(engine == null){ + engine = getDefaultEngine(); } - dataEngineOMASClient.createExternalDataEngine(userId, softwareServerCapability); - return softwareServerCapability; + dataEngineOMASClient.createExternalDataEngine(userId, engine); + return engine; } /** @@ -56,16 +56,16 @@ public void deleteExternalDataEngine(String userId, DataEngineClient dataEngineC dataEngineClient.deleteExternalDataEngine(userId, qualifiedName, guid); } - private SoftwareServerCapability getDefaultSoftwareServerCapability(){ - SoftwareServerCapability softwareServerCapability = new SoftwareServerCapability(); - softwareServerCapability.setName("Data Engine Display Name"); - softwareServerCapability.setQualifiedName("DataEngine"); - softwareServerCapability.setDescription("Data Engine Description"); - softwareServerCapability.setEngineType("DataEngine"); - softwareServerCapability.setEngineVersion("1"); - softwareServerCapability.setPatchLevel("2"); - softwareServerCapability.setSource("source"); - return softwareServerCapability; + private Engine getDefaultEngine(){ + Engine engine = new Engine(); + engine.setName("Data Engine Display Name"); + engine.setQualifiedName("DataEngine"); + engine.setDescription("Data Engine Description"); + engine.setEngineType("DataEngine"); + engine.setEngineVersion("1"); + engine.setPatchLevel("2"); + engine.setSource("source"); + return engine; } } diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/RepositoryService.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/RepositoryService.java index 8741f77a1b7..f2cf052e818 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/RepositoryService.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/RepositoryService.java @@ -20,7 +20,6 @@ import org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException; import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; import org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.rest.properties.EntityPropertyFindRequest; import java.util.HashMap; import java.util.List; @@ -120,9 +119,9 @@ public EntityDetail findEntityByQualifiedName(String entityValue, String typeGUI * Find an entity by using the search criteria given as parameter in a call to the LocalRepositoryServicesClient * * @param typeGuid guid of expected type - * @param searchCriteria the property value used to search and identify the software server capability + * @param searchCriteria the property value used to search and identify the engine * - * @return a list of EntityDetails that contain the found software server capability + * @return a list of EntityDetails that contain the found engine */ public List findEntityByPropertyValue(String typeGuid, String searchCriteria) throws UserNotAuthorizedException, FunctionNotSupportedException, InvalidParameterException, RepositoryErrorException, PropertyErrorException, diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/ConnectionAndEndpointFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/ConnectionAndEndpointFVT.java index 07cc7e253cf..0529b5e6ab6 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/ConnectionAndEndpointFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/ConnectionAndEndpointFVT.java @@ -44,7 +44,7 @@ public void deleteConnectionAndEndpoint(String userId, DataEngineClient dataEngi org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); DataFile dataFile = dataStoreAndRelationalTableSetupService.upsertDataFile(userId, dataEngineClient, getDataFile()); // assert Connection diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataEngineFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataEngineFVT.java index ca5e3a78fa6..5b4f76a3753 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataEngineFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataEngineFVT.java @@ -8,7 +8,7 @@ import org.odpi.openmetadata.accessservices.dataengine.LineageSetupService; import org.odpi.openmetadata.accessservices.dataengine.PortSetupService; import org.odpi.openmetadata.accessservices.dataengine.ProcessSetupService; -import org.odpi.openmetadata.accessservices.dataengine.SoftwareServerCapabilitySetupService; +import org.odpi.openmetadata.accessservices.dataengine.EngineSetupService; import org.odpi.openmetadata.accessservices.dataengine.TopicAndEventTypeSetupService; import org.odpi.openmetadata.accessservices.dataengine.model.Attribute; import org.odpi.openmetadata.accessservices.dataengine.model.DataFile; @@ -83,7 +83,7 @@ public DataEngineFVT() { } protected final LineageSetupService lineageSetupService = new LineageSetupService(); - protected final SoftwareServerCapabilitySetupService softwareServerCapabilitySetupServer = new SoftwareServerCapabilitySetupService(); + protected final EngineSetupService engineSetupService = new EngineSetupService(); protected final DataStoreAndRelationalTableSetupService dataStoreAndRelationalTableSetupService = new DataStoreAndRelationalTableSetupService(); protected final ProcessSetupService processSetupService = new ProcessSetupService(); protected final PortSetupService portSetupService = new PortSetupService(); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataStoreAndRelationalTableFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataStoreAndRelationalTableFVT.java index 762d22d60a0..947db2f5084 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataStoreAndRelationalTableFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/DataStoreAndRelationalTableFVT.java @@ -13,7 +13,7 @@ import org.odpi.openmetadata.accessservices.dataengine.model.DatabaseSchema; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalColumn; import org.odpi.openmetadata.accessservices.dataengine.model.RelationalTable; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; @@ -46,7 +46,7 @@ public void upsertDatabase(String userId, DataEngineClient dataEngineClient, Rep org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, null); // assert Database @@ -62,7 +62,7 @@ public void deleteDatabase(String userId, DataEngineClient dataEngineClient, Rep org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, getDatabaseToDelete()); // assert Database @@ -98,7 +98,7 @@ public void upsertDatabaseSchema(String userId, DataEngineClient dataEngineClien org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, null); DatabaseSchema databaseSchema = dataStoreAndRelationalTableSetupService.upsertDatabaseSchema(userId, dataEngineClient, null, database.getQualifiedName(), false); @@ -117,7 +117,7 @@ public void deleteDatabaseSchema(String userId, DataEngineClient dataEngineClien org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, getDatabaseToDelete()); DatabaseSchema databaseSchema = dataStoreAndRelationalTableSetupService.upsertDatabaseSchema(userId, dataEngineClient, getDatabaseSchemaToDelete(), database.getQualifiedName(), false); @@ -151,7 +151,7 @@ public void upsertRelationalTable(String userId, DataEngineClient dataEngineClie org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, null); DatabaseSchema databaseSchema = dataStoreAndRelationalTableSetupService.upsertDatabaseSchema(userId, dataEngineClient, null, database.getQualifiedName(), false); @@ -194,7 +194,7 @@ public void deleteRelationalTable(String userId, DataEngineClient dataEngineClie org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, null); DatabaseSchema databaseSchema = dataStoreAndRelationalTableSetupService.upsertDatabaseSchema(userId, dataEngineClient, null, database.getQualifiedName(), false); @@ -245,7 +245,7 @@ public void upsertDataFile(String userId, DataEngineClient dataEngineClient, Rep org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); DataFile dataFile = dataStoreAndRelationalTableSetupService.upsertDataFile(userId, dataEngineClient, null); // assert Data File @@ -285,7 +285,7 @@ public void deleteDataFileAndFileFolder(String userId, DataEngineClient dataEngi org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - SoftwareServerCapability softwareServerCapability = softwareServerCapabilitySetupServer + Engine engine = engineSetupService .createExternalDataEngine(userId, dataEngineClient, null); DataFile dataFile = dataStoreAndRelationalTableSetupService .upsertDataFile(userId, dataEngineClient, getDataFileToDelete()); @@ -303,7 +303,7 @@ public void deleteDataFileAndFileFolder(String userId, DataEngineClient dataEngi assertNull(dataFilesToDelete); // delete FileFolder - String fileFolderQualifiedName = softwareServerCapability.getQualifiedName() + "::/to-delete-data-file-pathname"; + String fileFolderQualifiedName = engine.getQualifiedName() + "::/to-delete-data-file-pathname"; List fileFolders = repositoryService.findEntityByPropertyValue(FILE_FOLDER_TYPE_GUID, fileFolderQualifiedName); assertNotNull(fileFolders); assertEquals(1, fileFolders.size()); @@ -349,7 +349,7 @@ public void deleteSchemaType(String userId, DataEngineClient dataEngineClient, R org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); DataFile dataFile = dataStoreAndRelationalTableSetupService .upsertDataFile(userId, dataEngineClient, getDataFileToDelete()); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/FindFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/FindFVT.java index db2445f525d..885b12f6006 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/FindFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/FindFVT.java @@ -38,7 +38,7 @@ public void find(String userId, DataEngineClient dataEngineClient, RepositorySer org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); DataFile dataFile = dataStoreAndRelationalTableSetupService.upsertDataFile(userId, dataEngineClient, null); GUIDListResponse guidListResponse = findSetupService.find(userId, dataEngineClient, dataFile.getQualifiedName(), diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/LineageFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/LineageFVT.java index ebb79ddba5e..6f5991f9de9 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/LineageFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/LineageFVT.java @@ -52,7 +52,7 @@ public void verifyLineageMappingsForAJobProcess(String userId, DataEngineClient FunctionNotSupportedException, org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); List processes = lineageSetupService.createJobProcessWithContent(userId, dataEngineClient); for(Process process : processes){ validate(process, repositoryService); @@ -199,7 +199,7 @@ public void verifyHighLevelLineage(String userId, DataEngineClient dataEngineCli org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Database database = dataStoreAndRelationalTableSetupService.upsertDatabase(userId, dataEngineClient, null); List databases = repositoryService.findEntityByPropertyValue(DATABASE_TYPE_GUID, database.getQualifiedName()); assertDatabase(database, databases); diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/SoftwareCapabilityFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/SoftwareCapabilityFVT.java index 812b0ade065..208b96a22da 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/SoftwareCapabilityFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/SoftwareCapabilityFVT.java @@ -7,7 +7,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.odpi.openmetadata.accessservices.dataengine.RepositoryService; import org.odpi.openmetadata.accessservices.dataengine.client.DataEngineClient; -import org.odpi.openmetadata.accessservices.dataengine.model.SoftwareServerCapability; +import org.odpi.openmetadata.accessservices.dataengine.model.Engine; import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; @@ -38,11 +38,11 @@ public void registerExternalTool(String userId, DataEngineClient dataEngineClien org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - SoftwareServerCapability softwareServerCapability = softwareServerCapabilitySetupServer + Engine engine = engineSetupService .createExternalDataEngine(userId, dataEngineClient, null); List entityDetails = repositoryService.findEntityByPropertyValue(SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, - softwareServerCapability.getQualifiedName()); + engine.getQualifiedName()); if (entityDetails == null || entityDetails.isEmpty()) { fail(); } @@ -50,13 +50,13 @@ public void registerExternalTool(String userId, DataEngineClient dataEngineClien assertEquals(1, entityDetails.size()); EntityDetail entity = entityDetails.get(0); - assertEquals(softwareServerCapability.getDescription(), entity.getProperties().getPropertyValue(DESCRIPTION).valueAsString()); - assertEquals(softwareServerCapability.getName(), entity.getProperties().getPropertyValue(NAME).valueAsString()); - assertEquals(softwareServerCapability.getEngineVersion(), entity.getProperties().getPropertyValue(CAPABILITY_VERSION).valueAsString()); - assertEquals(softwareServerCapability.getEngineType(), entity.getProperties().getPropertyValue(CAPABILITY_TYPE).valueAsString()); - assertEquals(softwareServerCapability.getPatchLevel(), entity.getProperties().getPropertyValue(PATCH_LEVEL).valueAsString()); - assertEquals(softwareServerCapability.getQualifiedName(), entity.getProperties().getPropertyValue(QUALIFIED_NAME).valueAsString()); - assertEquals(softwareServerCapability.getSource(), entity.getProperties().getPropertyValue(SOURCE).valueAsString()); + assertEquals(engine.getDescription(), entity.getProperties().getPropertyValue(DESCRIPTION).valueAsString()); + assertEquals(engine.getName(), entity.getProperties().getPropertyValue(NAME).valueAsString()); + assertEquals(engine.getEngineVersion(), entity.getProperties().getPropertyValue(CAPABILITY_VERSION).valueAsString()); + assertEquals(engine.getEngineType(), entity.getProperties().getPropertyValue(CAPABILITY_TYPE).valueAsString()); + assertEquals(engine.getPatchLevel(), entity.getProperties().getPropertyValue(PATCH_LEVEL).valueAsString()); + assertEquals(engine.getQualifiedName(), entity.getProperties().getPropertyValue(QUALIFIED_NAME).valueAsString()); + assertEquals(engine.getSource(), entity.getProperties().getPropertyValue(SOURCE).valueAsString()); } @ParameterizedTest @@ -67,39 +67,39 @@ public void deleteExternalTool(String userId, DataEngineClient dataEngineClient, org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException { - SoftwareServerCapability toDeleteSoftwareServerCapability = softwareServerCapabilitySetupServer - .createExternalDataEngine(userId, dataEngineClient, getToDeleteSoftwareServerCapability()); + Engine toDeleteEngine = engineSetupService + .createExternalDataEngine(userId, dataEngineClient, getToDeleteEngine()); List softwareServerCapabilities = repositoryService.findEntityByPropertyValue(SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, - toDeleteSoftwareServerCapability.getQualifiedName()); + toDeleteEngine.getQualifiedName()); if (softwareServerCapabilities == null || softwareServerCapabilities.isEmpty()) { fail(); } assertEquals(1, softwareServerCapabilities.size()); - EntityDetail softwareServerCapabilityAsEntityDetail = softwareServerCapabilities.get(0); - softwareServerCapabilitySetupServer.deleteExternalDataEngine(userId, dataEngineClient, - softwareServerCapabilityAsEntityDetail.getProperties().getPropertyValue(QUALIFIED_NAME).valueAsString(), - softwareServerCapabilityAsEntityDetail.getGUID()); + EntityDetail engineAsEntityDetail = softwareServerCapabilities.get(0); + engineSetupService.deleteExternalDataEngine(userId, dataEngineClient, + engineAsEntityDetail.getProperties().getPropertyValue(QUALIFIED_NAME).valueAsString(), + engineAsEntityDetail.getGUID()); List deletedSoftwareServerCapabilities = repositoryService.findEntityByPropertyValue(SOFTWARE_SERVER_CAPABILITY_TYPE_GUID, - toDeleteSoftwareServerCapability.getQualifiedName()); - // TODO: add verification for to be deleted softwareServerCapability once the method is implemented + toDeleteEngine.getQualifiedName()); + // TODO: add verification for to be deleted engine once the method is implemented // in this moment, a FunctionNotSupportedException is thrown // on searching the so called deleted capability, we still receive it as the result assertNotNull(deletedSoftwareServerCapabilities); } - private SoftwareServerCapability getToDeleteSoftwareServerCapability(){ - SoftwareServerCapability softwareServerCapability = new SoftwareServerCapability(); - softwareServerCapability.setName("To Delete Data Engine Display Name"); - softwareServerCapability.setQualifiedName("ToDeleteDataEngine"); - softwareServerCapability.setDescription("To Delete Data Engine Description"); - softwareServerCapability.setEngineType("ToDeleteDataEngine"); - softwareServerCapability.setEngineVersion("1"); - softwareServerCapability.setPatchLevel("2"); - softwareServerCapability.setSource("source"); - return softwareServerCapability; + private Engine getToDeleteEngine(){ + Engine engine = new Engine(); + engine.setName("To Delete Data Engine Display Name"); + engine.setQualifiedName("ToDeleteDataEngine"); + engine.setDescription("To Delete Data Engine Description"); + engine.setEngineType("ToDeleteDataEngine"); + engine.setEngineVersion("1"); + engine.setPatchLevel("2"); + engine.setSource("source"); + return engine; } } diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/TopicAndEventTypeFVT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/TopicAndEventTypeFVT.java index a787e3cba1a..980465885cb 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/TopicAndEventTypeFVT.java +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/java/org/odpi/openmetadata/accessservices/dataengine/fvt/TopicAndEventTypeFVT.java @@ -22,7 +22,6 @@ import org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException; import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; -import java.util.Collections; import java.util.List; import static org.junit.jupiter.api.Assertions.assertNull; @@ -40,7 +39,7 @@ public void upsertTopicWithEventType(String userId, DataEngineClient dataEngineC org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException, InterruptedException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Topic topic = topicAndEventTypeSetupService.upsertTopic(userId, dataEngineClient, topicAndEventTypeSetupService.getTopicWithEventType()); // assert Topic @@ -67,7 +66,7 @@ public void deleteTopic(String userId, DataEngineClient dataEngineClient, Reposi org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException, InterruptedException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Topic topic = topicAndEventTypeSetupService.upsertTopic(userId, dataEngineClient, topicAndEventTypeSetupService.getDeleteTopic()); // assert Topic @@ -88,7 +87,7 @@ public void upserEventType(String userId, DataEngineClient dataEngineClient, Rep org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException, InterruptedException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Topic topic = topicAndEventTypeSetupService.upsertTopic(userId, dataEngineClient, null); EventType eventType = topicAndEventTypeSetupService.upsertEventType(userId, dataEngineClient, null, topic.getQualifiedName()); @@ -111,7 +110,7 @@ public void upsertAndDeleteEventType(String userId, DataEngineClient dataEngineC org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, RepositoryErrorException, PropertyErrorException, TypeErrorException, PagingErrorException, EntityNotKnownException, InterruptedException { - softwareServerCapabilitySetupServer.createExternalDataEngine(userId, dataEngineClient, null); + engineSetupService.createExternalDataEngine(userId, dataEngineClient, null); Topic topic = topicAndEventTypeSetupService.upsertTopic(userId, dataEngineClient, null); EventType eventType = topicAndEventTypeSetupService.upsertEventType(userId, dataEngineClient, topicAndEventTypeSetupService.getDeleteEventType(), topic.getQualifiedName()); diff --git a/pom.xml b/pom.xml index 7a6049b142d..a90706e028b 100644 --- a/pom.xml +++ b/pom.xml @@ -208,6 +208,7 @@ 2.2.6 1.9.5 4.8.149 + 1.7.36 3.0.13 0.10.2 2.1.12 @@ -3231,7 +3232,7 @@ org.slf4j jcl-over-slf4j - ${slf4j.version} + ${jcl-over-slf4j.version}