From f0d2d5b3099557afa4de26ddb4cb610248f7207d Mon Sep 17 00:00:00 2001 From: Mandy Chessell Date: Mon, 12 Jun 2023 14:14:26 +0100 Subject: [PATCH 1/3] Move server-chassis to platform-chassis Signed-off-by: Mandy Chessell --- CODEOWNERS | 4 +- Content-Organization.md | 2 +- developer-resources/Dependency-Management.md | 4 +- .../open-metadata-assemblies/build.gradle | 11 +- open-metadata-implementation/README.md | 2 +- .../encryptedfile/DocStoreErrorCode.java | 2 +- .../docs/README.md | 2 +- .../CommonServicesDescription.java | 8 +- .../properties/OMAGServerServiceStatus.java | 1 + .../properties/ServerActiveStatus.java | 1 + .../properties/ServerServicesStatus.java | 1 + .../client/AdminServicesRESTClient.java | 6 +- .../client/OMAGServerOperationsClient.java | 3 + ...OMAGServerPlatformConfigurationClient.java | 4 +- .../admin-services-server/build.gradle | 19 +- .../OMAGConformanceSuiteConfigServices.java | 2 +- .../OMAGServerAdminForAccessServices.java | 2 +- .../OMAGServerAdminForEngineServices.java | 2 +- .../OMAGServerAdminForIntegrationGroups.java | 2 +- ...OMAGServerAdminForIntegrationServices.java | 2 +- .../OMAGServerAdminForViewServices.java | 2 +- .../OMAGServerAdminSecurityServices.java | 10 +- .../server/OMAGServerAdminServices.java | 2 +- .../server/OMAGServerAdminStoreServices.java | 22 +- .../server/OMAGServerErrorHandler.java | 26 +- .../server/OMAGServerExceptionHandler.java | 6 +- .../server/OMAGServerOriginServices.java | 23 - .../OpenMetadataPlatformSecurity.java | 2 +- ...OpenMetadataPlatformSecurityConnector.java | 2 +- .../ffdc/EngineHostServicesAuditCode.java | 6 +- .../ffdc/EngineHostServicesErrorCode.java | 6 +- .../engine-host-services-server/build.gradle | 1 + .../server/EngineHostOperationalServices.java | 6 +- .../build.gradle | 1 + .../handlers/IntegrationConnectorHandler.java | 5 +- .../IntegrationDaemonOperationalServices.java | 4 +- .../docs/configuration/README.md | 2 +- .../README.md | 12 +- .../platform-chassis-spring}/README.md | 12 +- .../SwaggerGeneration.md | 2 +- .../platform-chassis-spring}/build.gradle | 5 +- .../springboot/OMAGServerPlatform.java | 61 +- .../springboot/StartupFailEvent.java | 0 .../src/main/resources/banner.txt | 0 ...-platform-services.postman_collection.json | 572 +++++++++++++++++- .../platform-services/README.md | 2 +- .../properties/OMAGServerServiceStatus.java | 130 ++++ .../properties/ServerActiveStatus.java | 100 +++ .../properties/ServerServicesStatus.java | 196 ++++++ .../rest/OMAGServerStatusResponse.java | 137 +++++ .../rest/SuccessMessageResponse.java | 95 +++ .../platform-services-client/build.gradle | 1 + .../client/PlatformServicesClient.java | 402 +++++++++++- .../client/PlatformServicesRESTClient.java | 146 +++++ .../platform-services-server/build.gradle | 17 + .../OMAGOperationalServicesInstance.java | 14 +- .../OMAGServerOperationalInstanceHandler.java | 2 +- .../server/OMAGServerOperationalServices.java | 228 +++++-- .../OMAGServerPlatformSecurityServices.java | 158 +++++ .../platform-services-spring/build.gradle | 2 + .../spring/OMAGServerOperationResource.java | 317 ++++++++++ .../OMAGServerPlatformActiveResource.java | 33 +- ... => OMAGServerPlatformOriginResource.java} | 35 +- .../OMAGServerPlatformSecurityResource.java | 98 +++ .../OldOperationalServicesResource.java} | 20 +- .../spring/OldPlatformSecurityResource.java} | 14 +- .../spring/OldServerOriginResource.java} | 26 +- .../docker/egeria/Dockerfile | 8 +- .../docker/egeria/Dockerfile.selfbuild | 8 +- .../docker/egeria/README.md | 26 +- .../CocoPharmaPlatformSecurityConnector.java | 2 +- ...maPlatformSecurityConnectorTokenBased.java | 43 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- .../test/script/configureStartServer.groovy | 2 +- settings.gradle | 2 +- 86 files changed, 2815 insertions(+), 343 deletions(-) delete mode 100644 open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOriginServices.java rename open-metadata-implementation/{server-chassis => platform-chassis}/README.md (53%) rename open-metadata-implementation/{server-chassis/server-chassis-spring => platform-chassis/platform-chassis-spring}/README.md (93%) rename open-metadata-implementation/{server-chassis/server-chassis-spring => platform-chassis/platform-chassis-spring}/SwaggerGeneration.md (97%) rename open-metadata-implementation/{server-chassis/server-chassis-spring => platform-chassis/platform-chassis-spring}/build.gradle (95%) rename open-metadata-implementation/{server-chassis/server-chassis-spring => platform-chassis/platform-chassis-spring}/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java (78%) rename open-metadata-implementation/{server-chassis/server-chassis-spring => platform-chassis/platform-chassis-spring}/src/main/java/org/odpi/openmetadata/serverchassis/springboot/StartupFailEvent.java (100%) rename open-metadata-implementation/{server-chassis/server-chassis-spring => platform-chassis/platform-chassis-spring}/src/main/resources/banner.txt (100%) create mode 100644 open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/OMAGServerServiceStatus.java create mode 100644 open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerActiveStatus.java create mode 100644 open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerServicesStatus.java create mode 100644 open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/OMAGServerStatusResponse.java create mode 100644 open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/SuccessMessageResponse.java rename open-metadata-implementation/{admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices => platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices}/server/OMAGOperationalServicesInstance.java (97%) rename open-metadata-implementation/{admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices => platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices}/server/OMAGServerOperationalInstanceHandler.java (97%) rename open-metadata-implementation/{admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices => platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices}/server/OMAGServerOperationalServices.java (93%) create mode 100644 open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerPlatformSecurityServices.java create mode 100644 open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java rename open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/{ServerPlatformOriginResource.java => OMAGServerPlatformOriginResource.java} (55%) create mode 100644 open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformSecurityResource.java rename open-metadata-implementation/{admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/OperationalServicesResource.java => platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldOperationalServicesResource.java} (94%) rename open-metadata-implementation/{admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigOpenMetadataPlatformSecurityResource.java => platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldPlatformSecurityResource.java} (81%) rename open-metadata-implementation/{admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ServerOriginResource.java => platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldServerOriginResource.java} (58%) diff --git a/CODEOWNERS b/CODEOWNERS index 894e955395a..653b1c5e5ed 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -55,8 +55,8 @@ open-metadata-implementation/governance-servers/ @mandy-chessell open-metadata-implementation/governance-servers/data-engine-proxy-services/ @cmgrote @popa-raluca open-metadata-implementation/governance-servers/open-lineage-services/ @marius-patrascu @popa-raluca open-metadata-implementation/platform-services/ @mandy-chessell -open-metadata-implementation/server-chassis/ @mandy-chessell -open-metadata-implementation/server-chassis/server-chassis-spring/ @bogdan-sava @lpalashevski +open-metadata-implementation/platform-chassis/ @mandy-chessell +open-metadata-implementation/platform-chassis/platform-chassis-spring/ @bogdan-sava @lpalashevski open-metadata-implementation/user-interface/ui-chassis/ @bogdan-sava @marius-patrascu open-metadata-implementation/view-services/ @davidradl diff --git a/Content-Organization.md b/Content-Organization.md index 85354789743..413a6566edc 100644 --- a/Content-Organization.md +++ b/Content-Organization.md @@ -114,7 +114,7 @@ The Egeria core repository contains the core Egeria functionality, and is organi * **[repository-services](open-metadata-implementation/repository-services)** - metadata exchange and federation - aka the Open Metadata Repository Services (OMRS). - * **[server-chassis](open-metadata-implementation/server-chassis)** - the server chassis provides the server framework for the OMAG Server Platform. + * **[platform-chassis](open-metadata-implementation/platform-chassis)** - the platform chassis provides the runtime framework for the OMAG Server Platform. * **[user-interfaces](open-metadata-implementation/user-interfaces)** - browser based user interfaces. diff --git a/developer-resources/Dependency-Management.md b/developer-resources/Dependency-Management.md index 6e962c34def..ab1596ed081 100644 --- a/developer-resources/Dependency-Management.md +++ b/developer-resources/Dependency-Management.md @@ -22,9 +22,9 @@ This page covers the way dependencies are managed in Egeria. ### Logging dependencies for slf4j -* Any utility, sample, tool - or our server chassis, are 'applications' in that they have an entry point - typically main(). These should include a binding for slf4j. See http://www.slf4j.org/faq.html +* Any utility, sample, tool - or our OMAG Server Platform, are 'Java applications' in that they have an entry point - typically main(). These should include a binding for slf4j. See http://www.slf4j.org/faq.html * We generally use logback (ch.qos.logback:logback-classic for example) - * Generally A configuration file should not be provided - default formatting will be used & can be overriden by logback configuration at deployment time. + * Generally A configuration file should not be provided - default formatting will be used & can be overridden by logback configuration at deployment time. * Test code automatically includes slf4j-simple - a simple logging implementations * Other code that forms libraries (most of our code) MUST NOT include a slf4j logging implementation. Otherwise the application loses control of the logging implementation, hidden config files can change behaviour, and a multiple_bindings issue will be raised by slf4j diff --git a/open-metadata-distribution/open-metadata-assemblies/build.gradle b/open-metadata-distribution/open-metadata-assemblies/build.gradle index ab61f70f933..9fe5ca4039b 100644 --- a/open-metadata-distribution/open-metadata-assemblies/build.gradle +++ b/open-metadata-distribution/open-metadata-assemblies/build.gradle @@ -18,7 +18,7 @@ dependencies { // Dependencies for the main server assembly - this is modeled on the pom.xml // In future we may be able to select by type or label - implementation project(':open-metadata-implementation:server-chassis:server-chassis-spring') + implementation project(':open-metadata-implementation:platform-chassis:platform-chassis-spring') implementation project(':open-metadata-implementation:adapters:open-connectors:repository-services-connectors:audit-log-connectors:audit-log-console-connector') implementation project(':open-metadata-implementation:adapters:open-connectors:repository-services-connectors:audit-log-connectors:audit-log-event-topic-connector') implementation project(':open-metadata-implementation:adapters:open-connectors:repository-services-connectors:audit-log-connectors:audit-log-file-connector') @@ -111,7 +111,10 @@ distributions { contents { into('server') { // Just the chassis - for backward compatibility - from { project(':open-metadata-implementation:server-chassis:server-chassis-spring').bootJar } + from { project(':open-metadata-implementation:platform-chassis:platform-chassis-spring').bootJar } + rename { String fileName -> + fileName.replace("platform-chassis-spring", "server-chassis-spring") + } fileMode = 0755 } into('server/lib') { @@ -150,9 +153,9 @@ distributions { } into('platform') { // OMAG Server Platform - new name consistent with documentation - from { project(':open-metadata-implementation:server-chassis:server-chassis-spring').bootJar } + from { project(':open-metadata-implementation:platform-chassis:platform-chassis-spring').bootJar } rename { String fileName -> - fileName.replace("server-chassis-spring", "omag-server-platform") + fileName.replace("platform-chassis-spring", "omag-server-platform") } fileMode = 0755 } diff --git a/open-metadata-implementation/README.md b/open-metadata-implementation/README.md index e8197ad67ca..43d74d3c94d 100644 --- a/open-metadata-implementation/README.md +++ b/open-metadata-implementation/README.md @@ -70,7 +70,7 @@ OMAG Servers that it is hosting. implementation of the metadata exchange and federation capabilities for a metadata repository that supports the open metadata standards. -* **[server-chassis](server-chassis)** - the server chassis is the base component for the OMAG Server Platform. +* **[platform-chassis](platform-chassis)** - the platform chassis is the base component for the OMAG Server Platform. It includes the web server that receives the REST API requests for both the OMAG Server Platform and the servers that run on it. diff --git a/open-metadata-implementation/adapters/open-connectors/configuration-store-connectors/configuration-encrypted-file-store-connector/src/main/java/org/odpi/openmetadata/adapters/adminservices/configurationstore/encryptedfile/DocStoreErrorCode.java b/open-metadata-implementation/adapters/open-connectors/configuration-store-connectors/configuration-encrypted-file-store-connector/src/main/java/org/odpi/openmetadata/adapters/adminservices/configurationstore/encryptedfile/DocStoreErrorCode.java index 14e5c5ac7fd..31a7e0ea4e2 100644 --- a/open-metadata-implementation/adapters/open-connectors/configuration-store-connectors/configuration-encrypted-file-store-connector/src/main/java/org/odpi/openmetadata/adapters/adminservices/configurationstore/encryptedfile/DocStoreErrorCode.java +++ b/open-metadata-implementation/adapters/open-connectors/configuration-store-connectors/configuration-encrypted-file-store-connector/src/main/java/org/odpi/openmetadata/adapters/adminservices/configurationstore/encryptedfile/DocStoreErrorCode.java @@ -57,7 +57,7 @@ public enum DocStoreErrorCode implements ExceptionMessageSet INVALID_DIRECTORY(400, "ENCRYPTED-DOC-STORE-400-008 ", "Unable to create secure location for storing encryption key.", "The system was unable to generate a secure, random directory in which to store the encryption keys.", - "Check the path where the OMAG platform is started to ensure there are sufficient permissions to create files and directories. Review the logs for other potential I/O issues."), + "Check the path where the OMAG Server Platform is started to ensure there are sufficient permissions to create files and directories. Review the logs for other potential I/O issues."), INVALID_FILE(400, "ENCRYPTED-DOC-STORE-400-009 ", "Unable to create secure file for storing encryption key.", "The system was unable to generate a secure, random file in which to store the encryption keys.", diff --git a/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/docs/README.md b/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/docs/README.md index 5c13bd4ad0c..9998126a1ed 100644 --- a/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/docs/README.md +++ b/open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/docs/README.md @@ -87,7 +87,7 @@ Within this `adapter` module, in a package like `...repositoryconnector`, implem 1. then implement be the `getEntityDetail()` method that retrieves an entity by its GUID. Once these minimal starting points are implemented, you should be able to configure the -[OMAG server chassis](../../../../../server-chassis/server-chassis-spring) +[OMAG Server Platform](../../../../../platform-chassis/platform-chassis-spring) as a proxy to your repository connector by following the instructions in [using the admin services](https://egeria-project.org/guides/admin). **Important**: this will *not* necessarily be the diff --git a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/CommonServicesDescription.java b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/CommonServicesDescription.java index 38b894ffe37..5c0cd308be8 100644 --- a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/CommonServicesDescription.java +++ b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/CommonServicesDescription.java @@ -20,9 +20,9 @@ public enum CommonServicesDescription implements Serializable "Manages the synchronization, retrieval and maintenance of metadata stored in open metadata repositories", "https://egeria-project.org/services/omrs"), - ADMIN_OPERATIONAL_SERVICES (181, + ADMINISTRATION_SERVICES (181, ComponentDevelopmentStatus.STABLE, - "OMAG Server Operational Services", + "Administration Services", "admin-services", "Management of services active in an Open Metadata and governance server (OMAG Server)", "https://egeria-project.org/services/admin-services/overview"), @@ -52,7 +52,7 @@ public enum CommonServicesDescription implements Serializable ComponentDevelopmentStatus.STABLE, "Platform Services", "platform-services", - "Provides information about the registered services and connectors available in an OMAG Server Platform.", + "Provides information about the registered services and connectors available in an OMAG Server Platform along with services to control and query information about the OMAG Servers running on the platform.", "https://egeria-project.org/services/platform-services/overview"), OIF_METADATA_MANAGEMENT (186, @@ -85,7 +85,7 @@ public static List getGovernanceServersDescriptionLis List serviceDescriptionList = new ArrayList<>(); serviceDescriptionList.add(CommonServicesDescription.REPOSITORY_SERVICES); - serviceDescriptionList.add(CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES); + serviceDescriptionList.add(CommonServicesDescription.ADMINISTRATION_SERVICES); serviceDescriptionList.add(CommonServicesDescription.OCF_METADATA_MANAGEMENT); serviceDescriptionList.add(CommonServicesDescription.GAF_METADATA_MANAGEMENT); serviceDescriptionList.add(CommonServicesDescription.OPEN_METADATA_SECURITY); diff --git a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/OMAGServerServiceStatus.java b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/OMAGServerServiceStatus.java index ca44b0f64c4..55cb11ccc7c 100644 --- a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/OMAGServerServiceStatus.java +++ b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/OMAGServerServiceStatus.java @@ -19,6 +19,7 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) +@Deprecated public class OMAGServerServiceStatus implements Serializable { private static final long serialVersionUID = 1L; diff --git a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerActiveStatus.java b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerActiveStatus.java index eb81b58f6aa..878d6b5379a 100644 --- a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerActiveStatus.java +++ b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerActiveStatus.java @@ -17,6 +17,7 @@ @JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) +@Deprecated public enum ServerActiveStatus implements Serializable { UNKNOWN (0, "Unknown", "The state of the server is unknown. This is equivalent to a null value"), diff --git a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerServicesStatus.java b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerServicesStatus.java index d310dca4457..7d28101f70a 100644 --- a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerServicesStatus.java +++ b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/properties/ServerServicesStatus.java @@ -19,6 +19,7 @@ @JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) +@Deprecated public class ServerServicesStatus implements Serializable { private static final long serialVersionUID = 1L; diff --git a/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/AdminServicesRESTClient.java b/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/AdminServicesRESTClient.java index 6e133b26e55..32111a190e2 100644 --- a/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/AdminServicesRESTClient.java +++ b/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/AdminServicesRESTClient.java @@ -18,10 +18,10 @@ */ class AdminServicesRESTClient { - private String serverPlatformURLRoot; /* Initialized in constructor */ - private AdminClientRESTExceptionHandler exceptionHandler = new AdminClientRESTExceptionHandler(); + private final String serverPlatformURLRoot; /* Initialized in constructor */ + private final AdminClientRESTExceptionHandler exceptionHandler = new AdminClientRESTExceptionHandler(); - private RESTClientConnector clientConnector; /* Initialized in constructor */ + private final RESTClientConnector clientConnector; /* Initialized in constructor */ /** diff --git a/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerOperationsClient.java b/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerOperationsClient.java index da574ed3858..e9242bcca34 100644 --- a/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerOperationsClient.java +++ b/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerOperationsClient.java @@ -18,7 +18,10 @@ /** * OMAGServerOperationsClient provides services to start and stop an OMAG Server. + * This client is deprecated and will be removed soon. Use the Platform Services Client to control OMAG Servers + * in the OMAG Server Platform. It supports the same methods. */ +@Deprecated public class OMAGServerOperationsClient { protected String adminUserId; /* Initialized in constructor */ diff --git a/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerPlatformConfigurationClient.java b/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerPlatformConfigurationClient.java index 73ecfbd19bc..5a644937bb5 100644 --- a/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerPlatformConfigurationClient.java +++ b/open-metadata-implementation/admin-services/admin-services-client/src/main/java/org/odpi/openmetadata/adminservices/client/OMAGServerPlatformConfigurationClient.java @@ -182,6 +182,7 @@ public Connection getConfigurationStoreConnection() throws OMAGNotAuthorizedExce * @throws OMAGInvalidParameterException invalid parameter. * @throws OMAGConfigurationErrorException unusual state in the admin server. */ + @Deprecated public void setPlatformSecurityConnection(Connection connection) throws OMAGNotAuthorizedException, OMAGInvalidParameterException, OMAGConfigurationErrorException @@ -214,13 +215,13 @@ public void setPlatformSecurityConnection(Connection connection) throws OMAGNotA * Clear the connection object for platform security. This means there is no platform security set up * and there will be no authorization checks within the platform. All security will have to * come from the surrounding deployment environment. - * * This is the default state. * * @throws OMAGNotAuthorizedException the supplied userId is not authorized to issue this command. * @throws OMAGInvalidParameterException invalid parameter. * @throws OMAGConfigurationErrorException unusual state in the admin server. */ + @Deprecated public void clearPlatformSecurityConnection() throws OMAGNotAuthorizedException, OMAGInvalidParameterException, OMAGConfigurationErrorException @@ -243,6 +244,7 @@ public void clearPlatformSecurityConnection() throws OMAGNotAuthorizedException, * @throws OMAGInvalidParameterException invalid parameter. * @throws OMAGConfigurationErrorException unusual state in the admin server. */ + @Deprecated public Connection getPlatformSecurityConnection() throws OMAGNotAuthorizedException, OMAGInvalidParameterException, OMAGConfigurationErrorException diff --git a/open-metadata-implementation/admin-services/admin-services-server/build.gradle b/open-metadata-implementation/admin-services/admin-services-server/build.gradle index cbea9b44d25..d147c6e3425 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/build.gradle +++ b/open-metadata-implementation/admin-services/admin-services-server/build.gradle @@ -10,24 +10,15 @@ dependencies { implementation 'org.slf4j:slf4j-api' implementation project(':open-metadata-implementation:admin-services:admin-services-api') implementation project(':open-metadata-implementation:admin-services:admin-services-registration') - implementation project(':open-metadata-implementation:common-services:multi-tenant') - implementation project(':open-metadata-implementation:common-services:ffdc-services') - implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-apis') - implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') + implementation project(':open-metadata-implementation:admin-services:admin-services-client') implementation project(':open-metadata-implementation:repository-services:repository-services-apis') - implementation project(':open-metadata-implementation:adapters:open-connectors:connector-configuration-factory') implementation project(':open-metadata-implementation:repository-services:repository-services-implementation') - implementation project(':open-metadata-implementation:framework-services:ocf-metadata-management:ocf-metadata-server') - implementation project(':open-metadata-implementation:framework-services:oif-metadata-management:oif-metadata-server') - implementation project(':open-metadata-implementation:framework-services:gaf-metadata-management:gaf-metadata-server') - implementation project(':open-metadata-conformance-suite:open-metadata-conformance-suite-server') + implementation project(':open-metadata-implementation:common-services:ffdc-services') implementation project(':open-metadata-implementation:governance-servers:integration-daemon-services:integration-daemon-services-registration') - implementation project(':open-metadata-implementation:governance-servers:integration-daemon-services:integration-daemon-services-server') implementation project(':open-metadata-implementation:governance-servers:engine-host-services:engine-host-services-registration') - implementation project(':open-metadata-implementation:governance-servers:engine-host-services:engine-host-services-server') - implementation project(':open-metadata-implementation:governance-servers:open-lineage-services:open-lineage-services-server') - implementation project(':open-metadata-implementation:governance-servers:data-engine-proxy-services:data-engine-proxy-services-server') - implementation project(':open-metadata-implementation:admin-services:admin-services-client') + implementation project(':open-metadata-implementation:adapters:open-connectors:connector-configuration-factory') + implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-apis') + implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') compileOnly 'com.fasterxml.jackson.core:jackson-annotations' testCompileOnly 'com.fasterxml.jackson.core:jackson-annotations' testImplementation 'org.junit.jupiter:junit-jupiter-api' diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGConformanceSuiteConfigServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGConformanceSuiteConfigServices.java index d47b92c7f4c..1eb1946afce 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGConformanceSuiteConfigServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGConformanceSuiteConfigServices.java @@ -28,7 +28,7 @@ public class OMAGConformanceSuiteConfigServices static private final int maxPageSize = 50; private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGConformanceSuiteConfigServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForAccessServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForAccessServices.java index 3b56cc33408..ff7213cb64d 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForAccessServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForAccessServices.java @@ -34,7 +34,7 @@ public class OMAGServerAdminForAccessServices { private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForAccessServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private static final String defaultInTopicName = "InTopic"; private static final String defaultOutTopicName = "OutTopic"; diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForEngineServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForEngineServices.java index 3c8ef6d2313..b013202f80b 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForEngineServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForEngineServices.java @@ -35,7 +35,7 @@ public class OMAGServerAdminForEngineServices private static final String accessService = AccessServiceDescription.GOVERNANCE_ENGINE_OMAS.getAccessServiceName(); private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForEngineServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationGroups.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationGroups.java index ebbf1c5823b..ed075013c70 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationGroups.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationGroups.java @@ -25,7 +25,7 @@ public class OMAGServerAdminForIntegrationGroups { private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForIntegrationGroups.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationServices.java index 3a710badf19..3f227cb395c 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForIntegrationServices.java @@ -28,7 +28,7 @@ public class OMAGServerAdminForIntegrationServices { private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForIntegrationServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForViewServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForViewServices.java index a97778e5d5c..c6b4a83ca87 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForViewServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminForViewServices.java @@ -34,7 +34,7 @@ public class OMAGServerAdminForViewServices { private static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminForViewServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); private OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminSecurityServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminSecurityServices.java index f721f76b988..68dfbd7eea1 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminSecurityServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminSecurityServices.java @@ -38,12 +38,12 @@ */ public class OMAGServerAdminSecurityServices { - private static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminSecurityServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminSecurityServices.class), + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); - private OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); - private OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); - private OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); + private final OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); + private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); + private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); /** * Override the default platform security connector. diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminServices.java index 04e1308c18f..19c0e19e6fa 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminServices.java @@ -38,7 +38,7 @@ public class OMAGServerAdminServices { private final static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminStoreServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminStoreServices.java index 91490654523..6a460535c0d 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminStoreServices.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerAdminStoreServices.java @@ -48,11 +48,11 @@ public class OMAGServerAdminStoreServices { private static Connection configurationStoreConnection = null; - private static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminStoreServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerAdminStoreServices.class), + CommonServicesDescription.ADMINISTRATION_SERVICES.getServiceName()); - private OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); - private OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); + private final OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); + private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); /** * Override the default location of the configuration documents. @@ -341,10 +341,10 @@ OMAGServerConfig getServerConfig(String userId, * @throws OMAGInvalidParameterException problem with the configuration file * @throws OMAGNotAuthorizedException user not authorized to make these changes */ - OMAGServerConfig getServerConfig(String userId, - String serverName, - boolean adminCall, - String methodName) throws OMAGInvalidParameterException, + public OMAGServerConfig getServerConfig(String userId, + String serverName, + boolean adminCall, + String methodName) throws OMAGInvalidParameterException, OMAGNotAuthorizedException { OMAGServerConfigStore serverConfigStore = getServerConfigStore(serverName, methodName); @@ -543,9 +543,9 @@ OMAGServerConfig getServerConfig(String userId, * @param serverConfig properties to save * @throws OMAGInvalidParameterException problem with the config file */ - void saveServerConfig(String serverName, - String methodName, - OMAGServerConfig serverConfig) throws OMAGInvalidParameterException + public void saveServerConfig(String serverName, + String methodName, + OMAGServerConfig serverConfig) throws OMAGInvalidParameterException { OMAGServerConfigStore serverConfigStore = getServerConfigStore(serverName, methodName); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerErrorHandler.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerErrorHandler.java index 0092bbedf2d..1d65c1195ba 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerErrorHandler.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerErrorHandler.java @@ -40,9 +40,9 @@ public OMAGServerErrorHandler() * @param methodName method receiving the call * @throws OMAGNotAuthorizedException no userId provided */ - void validateUserId(String userId, - String serverName, - String methodName) throws OMAGNotAuthorizedException + public void validateUserId(String userId, + String serverName, + String methodName) throws OMAGNotAuthorizedException { if ((userId == null) || (userId.length() == 0)) { @@ -60,8 +60,8 @@ void validateUserId(String userId, * @param methodName method being called * @throws OMAGInvalidParameterException null server name */ - void validateServerName(String serverName, - String methodName) throws OMAGInvalidParameterException + public void validateServerName(String serverName, + String methodName) throws OMAGInvalidParameterException { /* * If the local server name is still null then save the server name in the configuration. @@ -412,9 +412,9 @@ void logNoCohortTopicChange(String cohortName, * @param methodName method called * @throws OMAGInvalidParameterException the cohort name is null */ - void validateFileName(String fileName, - String serverName, - String methodName) throws OMAGInvalidParameterException + public void validateFileName(String fileName, + String serverName, + String methodName) throws OMAGInvalidParameterException { if ((fileName == null) || (fileName.length() == 0)) { @@ -454,9 +454,9 @@ void validateMetadataCollectionName(String name, * @param methodName method called * @throws OMAGInvalidParameterException the connection is null */ - void validateServerConnection(Connection connection, - String serverName, - String methodName) throws OMAGInvalidParameterException + public void validateServerConnection(Connection connection, + String serverName, + String methodName) throws OMAGInvalidParameterException { if (connection == null) { @@ -476,8 +476,8 @@ void validateServerConnection(Connection connection, * @param methodName method called * @throws OMAGInvalidParameterException the connection is null */ - void validatePlatformConnection(Connection connection, - String methodName) throws OMAGInvalidParameterException + public void validatePlatformConnection(Connection connection, + String methodName) throws OMAGInvalidParameterException { if (connection == null) { diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerExceptionHandler.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerExceptionHandler.java index 561efb4eb71..334f52acd85 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerExceptionHandler.java +++ b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerExceptionHandler.java @@ -88,7 +88,7 @@ public void capturePlatformRuntimeException(String methodName, * @param response REST Response * @param error returned response. */ - void captureConfigurationErrorException(FFDCResponseBase response, OMAGConfigurationErrorException error) + public void captureConfigurationErrorException(FFDCResponseBase response, OMAGConfigurationErrorException error) { log.error("Configuration error returned", error); @@ -102,7 +102,7 @@ void captureConfigurationErrorException(FFDCResponseBase response, OMAGConfigura * @param response REST Response * @param error returned response. */ - void captureInvalidParameterException(FFDCResponseBase response, OMAGInvalidParameterException error) + public void captureInvalidParameterException(FFDCResponseBase response, OMAGInvalidParameterException error) { log.error("Invalid parameter error returned", error); @@ -130,7 +130,7 @@ public void captureNotAuthorizedException(FFDCResponseBase response, OMAGNotAuth * @param response REST Response * @param error returned response. */ - void captureNotAuthorizedException(FFDCResponseBase response, UserNotAuthorizedException error) + public void captureNotAuthorizedException(FFDCResponseBase response, UserNotAuthorizedException error) { log.error("User not authorized error returned", error); diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOriginServices.java b/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOriginServices.java deleted file mode 100644 index 166ab7ea344..00000000000 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOriginServices.java +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.server; - -/** - * OMAGServerPlatformOriginServices support the origin services for Egeria's OMAG Server. It is overridden in - * other server implementations. - */ -public class OMAGServerOriginServices -{ - final String implementationOrigin = "Egeria OMAG Server Platform (version 4.2-SNAPSHOT)\n"; - - /** - * Return the origin of this server implementation. - * - * @param userId name of the user making the request - * @return String description - */ - public String getServerOrigin(String userId) - { - return implementationOrigin; - } -} diff --git a/open-metadata-implementation/common-services/metadata-security/metadata-security-apis/src/main/java/org/odpi/openmetadata/metadatasecurity/OpenMetadataPlatformSecurity.java b/open-metadata-implementation/common-services/metadata-security/metadata-security-apis/src/main/java/org/odpi/openmetadata/metadatasecurity/OpenMetadataPlatformSecurity.java index 54193a01993..5cd23a7d56d 100644 --- a/open-metadata-implementation/common-services/metadata-security/metadata-security-apis/src/main/java/org/odpi/openmetadata/metadatasecurity/OpenMetadataPlatformSecurity.java +++ b/open-metadata-implementation/common-services/metadata-security/metadata-security-apis/src/main/java/org/odpi/openmetadata/metadatasecurity/OpenMetadataPlatformSecurity.java @@ -36,7 +36,7 @@ public interface OpenMetadataPlatformSecurity /** - * Check that the calling user is authorized to issue operator requests to the OMAG Server Platform. + * Check that the calling user is authorized to issue diagnostic requests to the OMAG Server Platform. * * @param userId calling user * diff --git a/open-metadata-implementation/common-services/metadata-security/metadata-security-connectors/src/main/java/org/odpi/openmetadata/metadatasecurity/connectors/OpenMetadataPlatformSecurityConnector.java b/open-metadata-implementation/common-services/metadata-security/metadata-security-connectors/src/main/java/org/odpi/openmetadata/metadatasecurity/connectors/OpenMetadataPlatformSecurityConnector.java index 9b303f09d0c..451a5d308be 100644 --- a/open-metadata-implementation/common-services/metadata-security/metadata-security-connectors/src/main/java/org/odpi/openmetadata/metadatasecurity/connectors/OpenMetadataPlatformSecurityConnector.java +++ b/open-metadata-implementation/common-services/metadata-security/metadata-security-connectors/src/main/java/org/odpi/openmetadata/metadatasecurity/connectors/OpenMetadataPlatformSecurityConnector.java @@ -153,7 +153,7 @@ public void validateUserAsOperatorForPlatform(String userId) throws UserNotAu /** - * Check that the calling user is authorized to issue operator requests to the OMAG Server Platform. + * Check that the calling user is authorized to issue diagnostic requests to the OMAG Server Platform. * * @param userId calling user * diff --git a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesAuditCode.java b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesAuditCode.java index 60cb2a71ed8..a2acfd9b633 100644 --- a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesAuditCode.java +++ b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesAuditCode.java @@ -100,9 +100,9 @@ public enum EngineHostServicesAuditCode implements AuditLogMessageSet "Each engine service registers itself using a static method call with the engine host as" + "their classes are loaded into " + "the platform. This is driven by the component scan for REST APIs implemented by the spring modules by " + - "the Server Chassis module. " + - "Ensure the engine service registers itself and " + - "the server chassis module has access to the engine service's spring module."), + "the platform-chassis-spring module. " + + "Ensure the engine service registers itself with the engine-host-services module and " + + "the platform-chassis-spring module has access to the engine service's spring module."), BAD_ENGINE_SERVICE_ADMIN_CLASS("ENGINE-HOST-SERVICES-0011", OMRSAuditLogRecordSeverity.EXCEPTION, diff --git a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesErrorCode.java b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesErrorCode.java index 0367fca1be3..54d046471e0 100644 --- a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesErrorCode.java +++ b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-api/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/ffdc/EngineHostServicesErrorCode.java @@ -141,9 +141,9 @@ public enum EngineHostServicesErrorCode implements ExceptionMessageSet "Each engine service registers itself using a static method call with the engine host as" + "their classes are loaded into " + "the platform. This is driven by the component scan for REST APIs implemented by the spring modules by " + - "the Server Chassis module. " + - "Ensure the engine service registers itself and " + - "the server chassis module has access to the engine service's spring module."), + "the platform-chassis-spring module. " + + "Ensure the engine service registers itself with the engine-host-services module and " + + "the platform-chassis-spring module has access to the engine service's spring module."), BAD_ENGINE_SERVICE_ADMIN_CLASS(400, "ENGINE-HOST-SERVICES-400-014", "The engine service {0} has been configured with an admin class of {1} which can not be " + diff --git a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/build.gradle b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/build.gradle index b7c9f5add49..f0462df3b68 100644 --- a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/build.gradle +++ b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/build.gradle @@ -13,6 +13,7 @@ dependencies { implementation project(':open-metadata-implementation:framework-services:ocf-metadata-management:ocf-metadata-client') implementation project(':open-metadata-implementation:access-services:governance-engine:governance-engine-api') implementation project(':open-metadata-implementation:access-services:governance-engine:governance-engine-client') + implementation project(':open-metadata-implementation:platform-services:platform-services-api') implementation project(':open-metadata-implementation:admin-services:admin-services-api') implementation 'org.slf4j:slf4j-api' implementation project(':open-metadata-implementation:governance-servers:engine-host-services:engine-host-services-api') diff --git a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/server/EngineHostOperationalServices.java b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/server/EngineHostOperationalServices.java index 36887382690..1a81410eb3d 100644 --- a/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/server/EngineHostOperationalServices.java +++ b/open-metadata-implementation/governance-servers/engine-host-services/engine-host-services-server/src/main/java/org/odpi/openmetadata/governanceservers/enginehostservices/server/EngineHostOperationalServices.java @@ -13,8 +13,8 @@ import org.odpi.openmetadata.adminservices.configuration.registration.GovernanceServicesDescription; import org.odpi.openmetadata.adminservices.configuration.registration.ServiceOperationalStatus; import org.odpi.openmetadata.adminservices.ffdc.exception.OMAGConfigurationErrorException; -import org.odpi.openmetadata.adminservices.properties.OMAGServerServiceStatus; -import org.odpi.openmetadata.adminservices.properties.ServerActiveStatus; +import org.odpi.openmetadata.platformservices.properties.OMAGServerServiceStatus; +import org.odpi.openmetadata.platformservices.properties.ServerActiveStatus; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; @@ -45,7 +45,7 @@ public class EngineHostOperationalServices private final int maxPageSize; /* Initialized in constructor */ private AuditLog auditLog = null; - private EngineHostInstance engineHostInstance = null; + private EngineHostInstance engineHostInstance = null; private final Map serviceStatusMap = new HashMap<>(); private final InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); diff --git a/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/build.gradle b/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/build.gradle index 747af9c2d85..e0a85f1578f 100644 --- a/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/build.gradle +++ b/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/build.gradle @@ -5,6 +5,7 @@ dependencies { + implementation project(':open-metadata-implementation:platform-services:platform-services-api') implementation project(':open-metadata-implementation:admin-services:admin-services-api') implementation project(':open-metadata-implementation:access-services:governance-engine:governance-engine-api') implementation project(':open-metadata-implementation:access-services:governance-engine:governance-engine-client') diff --git a/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/handlers/IntegrationConnectorHandler.java b/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/handlers/IntegrationConnectorHandler.java index 4a6c3a52e72..b8e96905abe 100644 --- a/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/handlers/IntegrationConnectorHandler.java +++ b/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/handlers/IntegrationConnectorHandler.java @@ -19,7 +19,6 @@ import org.odpi.openmetadata.governanceservers.integrationdaemonservices.properties.IntegrationConnectorStatus; import org.odpi.openmetadata.governanceservers.integrationdaemonservices.threads.IntegrationConnectorDedicatedThread; -import java.io.Serializable; import java.util.Date; import java.util.Map; @@ -28,10 +27,8 @@ * IntegrationConnectorReport provides information on the operation of a single connector within an integration * service. */ -public class IntegrationConnectorHandler implements Serializable +public class IntegrationConnectorHandler { - private static final long serialVersionUID = 1L; - /* * These values are set in the constructor and do not change. */ diff --git a/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/server/IntegrationDaemonOperationalServices.java b/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/server/IntegrationDaemonOperationalServices.java index e0c6eb31db8..6121b809385 100644 --- a/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/server/IntegrationDaemonOperationalServices.java +++ b/open-metadata-implementation/governance-servers/integration-daemon-services/integration-daemon-services-server/src/main/java/org/odpi/openmetadata/governanceservers/integrationdaemonservices/server/IntegrationDaemonOperationalServices.java @@ -10,8 +10,8 @@ import org.odpi.openmetadata.adminservices.configuration.properties.IntegrationServiceConfig; import org.odpi.openmetadata.adminservices.configuration.registration.GovernanceServicesDescription; import org.odpi.openmetadata.adminservices.ffdc.exception.OMAGConfigurationErrorException; -import org.odpi.openmetadata.adminservices.properties.OMAGServerServiceStatus; -import org.odpi.openmetadata.adminservices.properties.ServerActiveStatus; +import org.odpi.openmetadata.platformservices.properties.OMAGServerServiceStatus; +import org.odpi.openmetadata.platformservices.properties.ServerActiveStatus; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.integration.contextmanager.IntegrationContextManager; diff --git a/open-metadata-implementation/governance-servers/open-lineage-services/docs/configuration/README.md b/open-metadata-implementation/governance-servers/open-lineage-services/docs/configuration/README.md index 5bc61ccedc0..cccdc7d534f 100644 --- a/open-metadata-implementation/governance-servers/open-lineage-services/docs/configuration/README.md +++ b/open-metadata-implementation/governance-servers/open-lineage-services/docs/configuration/README.md @@ -18,7 +18,7 @@ For example payloads and endpoints, see the [Postman samples](../samples/OLS.pos /open-metadata-implementation/adapters/open-connectors/governance-daemon-connectors/open-lineage-connectors/open-lineage-janus-connector/target/ ``` - Add the jar to the classpath of the server-chassis-spring module. + Add the jar to the classpath of the platform-chassis-spring module. 2. Start the [OMAG Server Platform](https://egeria-project.org/education/tutorials/omag-server-tutorial/overview/) and run the default calls for setting the server URL, eventbus and the cohort. diff --git a/open-metadata-implementation/server-chassis/README.md b/open-metadata-implementation/platform-chassis/README.md similarity index 53% rename from open-metadata-implementation/server-chassis/README.md rename to open-metadata-implementation/platform-chassis/README.md index 7ff947acfbb..203a7cc32cd 100644 --- a/open-metadata-implementation/server-chassis/README.md +++ b/open-metadata-implementation/platform-chassis/README.md @@ -3,17 +3,17 @@ ![Released](../../images/egeria-content-status-released.png#pagewidth) -# OMAG Server Chassis +# OMAG Server Platform Chassis -The **Server Chassis** provides the base server framework, such as the web server and +The **Platform Chassis** provides the base runtime framework, such as the web server and the REST API endpoint support for the [Open Metadata and Governance (OMAG) Server Platform](https://egeria-project.org/concepts/omag-server-platform). -Calls to the server chassis are then routed to the appropriate Egeria subsystem. +Calls to the platform chassis are then routed to the appropriate Egeria subsystem. -* [Documentation](https://egeria-project.org/services/server-chassis) +* [Documentation](https://egeria-project.org/services/platform-chassis) -Today, Egeria has one server chassis implementation: -* **[server-chassis-spring](server-chassis-spring)** - using [Spring Boot](https://spring.io/projects/spring-boot). +Today, Egeria has one platform chassis implementation: +* **[platform-chassis-spring](platform-chassis-spring)** - using [Spring Boot](https://spring.io/projects/spring-boot). ---- Return to [open-metadata-implementation](..). diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/README.md b/open-metadata-implementation/platform-chassis/platform-chassis-spring/README.md similarity index 93% rename from open-metadata-implementation/server-chassis/server-chassis-spring/README.md rename to open-metadata-implementation/platform-chassis/platform-chassis-spring/README.md index 91dfcaf0c45..42e3c2405a4 100644 --- a/open-metadata-implementation/server-chassis/server-chassis-spring/README.md +++ b/open-metadata-implementation/platform-chassis/platform-chassis-spring/README.md @@ -1,15 +1,15 @@ -# Spring-based Server Chassis +# Spring-based Platform Chassis -The [Server Chassis](..) +The [Platform Chassis](..) provides the base server framework to host the Open Metadata and Governance (OMAG) Servers in the [OMAG Server Platform](https://egeria-project.org/concepts/omag-server). -The **server-chassis-spring** module is an implementation of the -server chassis written using [Spring Boot](../../../developer-resources/Spring.md). +The **platform-chassis-spring** module is an implementation of the +platform chassis written using [Spring Boot](../../../developer-resources/Spring.md). Its **main()** method is located in a Java class called **OMAGServerPlatform**. When the OMAGServerPlatform is first started, all of its REST APIs @@ -44,7 +44,7 @@ By running ``` mvn clean install -DadminChassisOnly ``` - the server-chassis-spring will contain only the following services: + the platform-chassis-spring will contain only the following services: * Administration Services - Operational * Administration Services - Platform Configuration * Administration Services - Server Configuration @@ -91,7 +91,7 @@ services that are in Java packages stemming from `org.odpi.openmetadata.*` and that are visible to this module. To make a new Java package visible to **OMAGServerPlatform**, add its **spring** package -to the **pom.xml** file for **server-chassis-spring** and it will be picked up in the component scan. +to the **pom.xml** file for **platform-chassis-spring** and it will be picked up in the component scan. For example, this is the snippet of XML in the pom.xml file that adds the [Asset Owner OMAS](https://egeria-project.org/services/omas/asset-owner/overview/) services diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/SwaggerGeneration.md b/open-metadata-implementation/platform-chassis/platform-chassis-spring/SwaggerGeneration.md similarity index 97% rename from open-metadata-implementation/server-chassis/server-chassis-spring/SwaggerGeneration.md rename to open-metadata-implementation/platform-chassis/platform-chassis-spring/SwaggerGeneration.md index 071d8cee451..b6d142aeb44 100644 --- a/open-metadata-implementation/server-chassis/server-chassis-spring/SwaggerGeneration.md +++ b/open-metadata-implementation/platform-chassis/platform-chassis-spring/SwaggerGeneration.md @@ -66,7 +66,7 @@ You can customize the endpoints/paths that are to be described by following the ## Endpoints produced -The following endpoints are produced in the server chassis. +The following endpoints are produced in the OMAG Server Platform. | Endpoint | Module Dependency | Description | |-------------------------------------------|----------------------|----------------------------------------------------------------------------| diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle b/open-metadata-implementation/platform-chassis/platform-chassis-spring/build.gradle similarity index 95% rename from open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle rename to open-metadata-implementation/platform-chassis/platform-chassis-spring/build.gradle index e3cf847e7dd..3efa84c1967 100644 --- a/open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle +++ b/open-metadata-implementation/platform-chassis/platform-chassis-spring/build.gradle @@ -22,9 +22,12 @@ dependencies { implementation 'org.springframework:spring-beans' implementation 'org.springframework:spring-core' implementation 'org.springframework:spring-context' + implementation project(':open-metadata-implementation:frameworks:open-connector-framework') + implementation project(':open-metadata-implementation:platform-services:platform-services-api') + implementation project(':open-metadata-implementation:platform-services:platform-services-server') implementation project(':open-metadata-implementation:admin-services:admin-services-server') + implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') compileOnly project(':open-metadata-implementation:common-services:ffdc-services') - implementation project(':open-metadata-implementation:admin-services:admin-services-api') runtimeOnly 'ch.qos.logback:logback-classic' implementation project(':open-metadata-implementation:adapters:authentication-plugins:http-helper') implementation 'org.slf4j:slf4j-api' diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java b/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java similarity index 78% rename from open-metadata-implementation/server-chassis/server-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java rename to open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java index c90c88acf09..0faeb72bde6 100644 --- a/open-metadata-implementation/server-chassis/server-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java +++ b/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java @@ -7,10 +7,14 @@ import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.info.License; -import org.odpi.openmetadata.adminservices.server.OMAGServerOperationalServices; -import org.odpi.openmetadata.adminservices.rest.SuccessMessageResponse; +import org.odpi.openmetadata.adminservices.server.OMAGServerAdminStoreServices; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.Endpoint; +import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataPlatformSecurityVerifier; +import org.odpi.openmetadata.platformservices.rest.SuccessMessageResponse; import org.odpi.openmetadata.http.HttpHelper; import org.odpi.openmetadata.http.HttpRequestHeadersFilter; +import org.odpi.openmetadata.platformservices.server.OMAGServerOperationalServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; @@ -23,11 +27,11 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationListener; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import org.springframework.context.event.ContextClosedEvent; import org.springframework.context.event.EventListener; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.Connection; import java.util.*; @@ -83,6 +87,17 @@ public class OMAGServerPlatform @Value("${header.name.list:}") // Default value is zero length string List headerNames; + @Value("${platform.configstore.provider:}") // Default value is zero length string + String configStoreProvider; + + @Value("${platform.configstore.endpoint:}") // Default value is zero length string + String configStoreEndpoint; + + @Value("${platform.security.provider:}") // Default value is zero length string + String platformSecurityProvider; + @Value("${platform.security.name:}") // Default value is zero length string + String platformSecurityName; + @Autowired private Environment env; @@ -92,6 +107,7 @@ public class OMAGServerPlatform private boolean triggeredRuntimeHalt = false; private String startupMessage = ""; private final OMAGServerOperationalServices operationalServices = new OMAGServerOperationalServices(); + private final OMAGServerAdminStoreServices configStoreServices = new OMAGServerAdminStoreServices(); private static final Logger log = LoggerFactory.getLogger(OMAGServerPlatform.class); @@ -229,6 +245,45 @@ public class ApplicationContextListener @EventListener(ApplicationReadyEvent.class) public void applicationReady() { + try + { + if ((configStoreProvider != null) && (! "".equals(configStoreProvider))) + { + Connection configStoreConnection = new Connection(); + ConnectorType connectorType = new ConnectorType(); + connectorType.setConnectorProviderClassName(configStoreProvider); + + if (configStoreEndpoint != null) + { + Endpoint endpoint = new Endpoint(); + endpoint.setAddress(configStoreEndpoint); + } + + configStoreServices.setConfigurationStoreConnection(sysUser, configStoreConnection); + } + + if ((platformSecurityProvider != null) && (! "".equals(platformSecurityProvider))) + { + Connection securityConnection = new Connection(); + ConnectorType connectorType = new ConnectorType(); + connectorType.setConnectorProviderClassName(platformSecurityProvider); + + String platformName = platformSecurityName; + if ((platformName == null) || ("".equals(platformName))) + { + platformName = Long.valueOf(ProcessHandle.current().pid()).toString(); + } + + OpenMetadataPlatformSecurityVerifier.setPlatformSecurityConnection(sysUser, + platformName, + securityConnection); + } + } + catch (Exception error) + { + log.error("Unable to set up platform connectors", error); + } + autoStartConfig(); System.out.println(OMAGServerPlatform.this.startupMessage); diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/StartupFailEvent.java b/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/StartupFailEvent.java similarity index 100% rename from open-metadata-implementation/server-chassis/server-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/StartupFailEvent.java rename to open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/StartupFailEvent.java diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/src/main/resources/banner.txt b/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/resources/banner.txt similarity index 100% rename from open-metadata-implementation/server-chassis/server-chassis-spring/src/main/resources/banner.txt rename to open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/resources/banner.txt diff --git a/open-metadata-implementation/platform-services/Egeria-platform-services.postman_collection.json b/open-metadata-implementation/platform-services/Egeria-platform-services.postman_collection.json index cdc81e0f866..2022943abaf 100644 --- a/open-metadata-implementation/platform-services/Egeria-platform-services.postman_collection.json +++ b/open-metadata-implementation/platform-services/Egeria-platform-services.postman_collection.json @@ -1,18 +1,18 @@ { "info": { - "_postman_id": "4d5c0ea0-1d23-43cb-8435-d943c1fc411f", + "_postman_id": "333e3bb2-c089-47eb-8b30-153de05189ba", "name": "Egeria-platform-services", "description": "This collection supports the REST API operations from the platform services.", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { - "name": "Get Server Origin", + "name": "Get OMAG Server Platform Origin", "request": { "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/origin", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/origin", "host": [ "{{baseURL}}" ], @@ -20,7 +20,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "origin" ] @@ -29,13 +29,98 @@ }, "response": [] }, + { + "name": "Get Platform Security Connection", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/platform/security/connection", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "platform", + "security", + "connection" + ] + }, + "description": "Retrieve the Connection object used to create the connector that verifies the authorization of users calling the platform and admin services." + }, + "response": [] + }, + { + "name": "Set Platform Security Connection", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"class\": \"PlatformSecurityRequestBody\",\n \"urlRoot\": \"{{baseURL}}\",\n \"platformSecurityConnection\" : {\n\t \"class\": \"Connection\",\n\t \"connectorType\": {\n\t \"class\": \"ConnectorType\",\n\t \"connectorProviderClassName\": \"org.odpi.openmetadata.metadatasecurity.samples.CocoPharmaPlatformSecurityProvider\"\n\t }\n }\n}" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/platform/security/connection", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "platform", + "security", + "connection" + ] + }, + "description": "Set up the connection for the platform security connector. This connector verifies the authorization of any user calling the platform or admin services. This call is preconfigured to set up the sample platform security connector. This allows only the Coco Pharmaceuticals IT administrator, `garygeeke`, to issue platform calls.\n\n\nOnce you have set up this security connector in your OMAG Server Platform, the default user `me` in the `Egeria` environment will no longer be authorized to issue REST calls to the server (try some of the requests that were \"working\" earlier to verify this). To switch the user to one that the OMAG Server Platform will accept, click on the eye symbol (top right), then click on `edit` and change the current value of `user` to `garygeeke`." + }, + "response": [] + }, + { + "name": "Delete Platform Security Connection", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/platform/security/connection", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "platform", + "security", + "connection" + ] + }, + "description": "Remove the currently configured Platform Security Connection. This means that no security checks will be performed by the OMAG Server Platform." + }, + "response": [] + }, { "name": "Get registered access services", "request": { "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/registered-services/access-services", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services/access-services", "host": [ "{{baseURL}}" ], @@ -43,7 +128,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "registered-services", "access-services" @@ -59,7 +144,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/registered-services/view-services", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services/view-services", "host": [ "{{baseURL}}" ], @@ -67,7 +152,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "registered-services", "view-services" @@ -77,13 +162,61 @@ }, "response": [] }, + { + "name": "Get registered integration services", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services/integration-services", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "registered-services", + "integration-services" + ] + }, + "description": "Retrieve the list of Open Metadata View Services (OMVSs) that are supported by this OMAG Server Platform." + }, + "response": [] + }, + { + "name": "Get registered engine services", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services/engine-services", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "registered-services", + "engine-services" + ] + }, + "description": "Retrieve the list of Open Metadata View Services (OMVSs) that are supported by this OMAG Server Platform." + }, + "response": [] + }, { "name": "Get registered governance services", "request": { "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/registered-services/governance-services", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services/governance-services", "host": [ "{{baseURL}}" ], @@ -91,7 +224,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "registered-services", "governance-services" @@ -107,7 +240,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/registered-services/common-services", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services/common-services", "host": [ "{{baseURL}}" ], @@ -115,7 +248,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "registered-services", "common-services" @@ -131,7 +264,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/registered-services", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/registered-services", "host": [ "{{baseURL}}" ], @@ -139,7 +272,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "registered-services" ] @@ -154,7 +287,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/servers", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers", "host": [ "{{baseURL}}" ], @@ -162,7 +295,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "servers" ] @@ -171,13 +304,38 @@ }, "response": [] }, + { + "name": "Query if a specific server is known", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/is-known", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "is-known" + ] + }, + "description": "Retrieve a boolean that indicates whether a specific servers is known to this OMAG Server Platform." + }, + "response": [] + }, { "name": "Get all active servers", "request": { "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/servers/active", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/active", "host": [ "{{baseURL}}" ], @@ -185,7 +343,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "servers", "active" @@ -196,12 +354,12 @@ "response": [] }, { - "name": "Query if a specific server is known", + "name": "Query the status of a specific server", "request": { "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/servers/{{server}}/is-known", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/status", "host": [ "{{baseURL}}" ], @@ -209,24 +367,94 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "servers", "{{server}}", - "is-known" + "status" ] }, - "description": "Retrieve a boolean that indicates whether a specific servers is known to this OMAG Server Platform." + "description": "Retrieve the status of a specific server for this OMAG Server Platform." }, "response": [] }, { - "name": "Query the status of a specific server", + "name": "Start server - using stored configuration", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "instance" + ] + }, + "description": "Activate a server on the OMAG Server Platform. Use the configuration document found in the configuration document store." + }, + "response": [] + }, + { + "name": "Start server - using supplied configuration", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"class\": \"OMAGServerConfigResponse\",\n \"relatedHTTPCode\": 200,\n \"omagserverConfig\": {\n \"class\": \"OMAGServerConfig\",\n \"versionId\": \"V2.0\",\n \"localServerId\": \"863ae16f-46eb-4f9a-a619-76917e8fa950\",\n \"localServerName\": \"myserver\",\n \"localServerType\": \"Open Metadata and Governance Server\",\n \"localServerURL\": \"https://localhost:9443\",\n \"localServerUserId\": \"OMAGServer\",\n \"maxPageSize\": 1000\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "instance" + ] + }, + "description": "Activate a server on the OMAG Server Platform. Use the configuration document passed on the request. This configuration document is saved to the configuration document store and then the server is started." + }, + "response": [] + }, + { + "name": "Get active server instance status", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, "request": { "method": "GET", "header": [], + "body": { + "mode": "raw", + "raw": "" + }, "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/servers/{{server}}/status", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance/status", "host": [ "{{baseURL}}" ], @@ -234,14 +462,15 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "servers", "{{server}}", + "instance", "status" ] }, - "description": "Retrieve the status of a specific server for this OMAG Server Platform." + "description": "Retrieve the configuration document used to start the named server." }, "response": [] }, @@ -251,7 +480,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/servers/{{server}}/services", + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/services", "host": [ "{{baseURL}}" ], @@ -259,7 +488,7 @@ "open-metadata", "platform-services", "users", - "{{user}}", + "{{adminUserId}}", "server-platform", "servers", "{{server}}", @@ -269,7 +498,288 @@ "description": "Retrieve the list of services that have been requested inside of a specific server running on this OMAG Server Platform." }, "response": [] + }, + { + "name": "Get active server configuration", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance/configuration", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "instance", + "configuration" + ] + }, + "description": "Retrieve the configuration document used to start the named server." + }, + "response": [] + }, + { + "name": "Load open metadata archive file", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "text/plain" + } + ], + "body": { + "mode": "raw", + "raw": "content-packs/CocoComboArchive.json", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance/open-metadata-archives/file", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "instance", + "open-metadata-archives", + "file" + ] + }, + "description": "Load a file that contains open metadata types and instances." + }, + "response": [] + }, + { + "name": "Load open metadata archive connection", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "type": "text", + "value": "text/plain" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"class\": \"Connection\",\n \"connectorType\": {\n \"class\": \"ConnectorType\",\n \"connectorProviderClassName\": \"class name of connector provider here\"\n },\n \"endpoint\" : {\n \"class\" : \"Endpoint\",\n \"address\" : \"Add location of the archive here\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseURL}}/open-metadata/admin-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance/open-metadata-archives/connection", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "admin-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "instance", + "open-metadata-archives", + "connection" + ] + }, + "description": "Load a file that contains open metadata types and instances." + }, + "response": [] + }, + { + "name": "Query a connector", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{user}}/server-platform/connector-types/org.odpi.openmetadata.adapters.connectors.integration.basicfiles.DataFilesMonitorIntegrationProvider", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{user}}", + "server-platform", + "connector-types", + "org.odpi.openmetadata.adapters.connectors.integration.basicfiles.DataFilesMonitorIntegrationProvider" + ] + }, + "description": "Retrieve the list of services that have been requested inside of a specific server running on this OMAG Server Platform." + }, + "response": [] + }, + { + "name": "Shutdown server", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}/instance", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}", + "instance" + ] + }, + "description": "Stop the server running on the OMAG Server Platform." + }, + "response": [] + }, + { + "name": "Shutdown and unregister server from cohorts", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/{{server}}", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "{{server}}" + ] + }, + "description": "Unregister server and remove its configuration" + }, + "response": [] + }, + { + "name": "Shutdown all active servers", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers/instance", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers", + "instance" + ] + }, + "description": "Stop the server running on the OMAG Server Platform." + }, + "response": [] + }, + { + "name": "Shutdown and unregister all active servers", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/servers", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "servers" + ] + }, + "description": "Stop the server running on the OMAG Server Platform." + }, + "response": [] + }, + { + "name": "Shutdown server platform", + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{baseURL}}/open-metadata/platform-services/users/{{adminUserId}}/server-platform/instance", + "host": [ + "{{baseURL}}" + ], + "path": [ + "open-metadata", + "platform-services", + "users", + "{{adminUserId}}", + "server-platform", + "instance" + ] + }, + "description": "Stop the server running on the OMAG Server Platform." + }, + "response": [] } - ], - "protocolProfileBehavior": {} + ] } \ No newline at end of file diff --git a/open-metadata-implementation/platform-services/README.md b/open-metadata-implementation/platform-services/README.md index 9f6d21e9fee..56643f20f78 100644 --- a/open-metadata-implementation/platform-services/README.md +++ b/open-metadata-implementation/platform-services/README.md @@ -7,7 +7,7 @@ The platform services provides the APIs for querying the [Open Metadata and Governance (OMAG) Server Platform](https://egeria-project.org/concepts/omag-server-platform/) -and discovering information about the OMAG Servers that it is hosting. +and discovering information about the OMAG Servers that it is hosting, starting and stopping them. * [Documentation](https://egeria-project.org/services/platform-services/overview) diff --git a/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/OMAGServerServiceStatus.java b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/OMAGServerServiceStatus.java new file mode 100644 index 00000000000..fc5dde66fdd --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/OMAGServerServiceStatus.java @@ -0,0 +1,130 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; +import java.util.Objects; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * OMAGServerServiceStatus contains the status of each of the services running in the server. + * It is useful in determining which services are active and which service is causing a server to be stuck starting or stopping. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class OMAGServerServiceStatus implements Serializable +{ + private static final long serialVersionUID = 1L; + + private String serviceName = null; + private ServerActiveStatus serviceStatus = ServerActiveStatus.UNKNOWN; + + + /** + * Default constructor for Jackson + */ + public OMAGServerServiceStatus() + { + } + + + /** + * Return the name of the service + * + * @return string name + */ + public String getServiceName() + { + return serviceName; + } + + + /** + * Set up the name of the service. + * + * @param serviceName string name + */ + public void setServiceName(String serviceName) + { + this.serviceName = serviceName; + } + + + /** + * Return the current status. + * + * @return server instance status enum value + */ + public ServerActiveStatus getServiceStatus() + { + return serviceStatus; + } + + + /** + * Set up the current status. + * + * @param serviceStatus server instance status enum value + */ + public void setServiceStatus(ServerActiveStatus serviceStatus) + { + this.serviceStatus = serviceStatus; + } + + + /** + * JSON like toString method + * + * @return string representing the local variables + */ + @Override + public String toString() + { + return "OMAGServerServiceStatus{" + + "serviceName='" + serviceName + '\'' + + ", serviceStatus=" + serviceStatus + + '}'; + } + + + /** + * Return comparison result based on the content of the properties. + * + * @param objectToCompare test object + * @return result of comparison + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (objectToCompare == null || getClass() != objectToCompare.getClass()) + { + return false; + } + OMAGServerServiceStatus that = (OMAGServerServiceStatus) objectToCompare; + return Objects.equals(serviceName, that.serviceName) && + serviceStatus == that.serviceStatus; + } + + + /** + * Return hash code for this object + * + * @return int hash code + */ + @Override + public int hashCode() + { + return Objects.hash(serviceName, serviceStatus); + } +} diff --git a/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerActiveStatus.java b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerActiveStatus.java new file mode 100644 index 00000000000..1b9b3422210 --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerActiveStatus.java @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * Server active status defines the state of the server (or a service) on a single platform. + */ +@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public enum ServerActiveStatus implements Serializable +{ + UNKNOWN (0, "Unknown", "The state of the server is unknown. This is equivalent to a null value"), + STARTING (1, "Starting", "The server is starting."), + RUNNING (2, "Running", "The server has completed start up and is running."), + STOPPING (3, "Stopping", "The server has received a request to shutdown."), + INACTIVE (99, "Inactive", "The server is not running."); + + private static final long serialVersionUID = 1L; + + private int ordinal; + private String name; + private String description; + + + /** + * Constructor to set up the instance of this enum. + * + * @param ordinal code number + * @param name default name + * @param description default description + */ + ServerActiveStatus(int ordinal, + String name, + String description) + { + this.ordinal = ordinal; + this.name = name; + this.description = description; + } + + + /** + * Return the code for this enum used for indexing based on the enum value. + * + * @return int code number + */ + public int getOrdinal() + { + return ordinal; + } + + + /** + * Return the default name for this enum type. + * + * @return String name + */ + public String getName() + { + return name; + } + + + /** + * Return the default description for this enum. + * + * @return String description + */ + public String getDescription() + { + return description; + } + + + /** + * Standard toString method. + * + * @return print out of variables in a JSON-style + */ + @Override + public String toString() + { + return "ServerActiveStatus{" + + "ordinal=" + ordinal + + ", name='" + name + '\'' + + ", description='" + description + '\'' + + '}'; + } +} + diff --git a/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerServicesStatus.java b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerServicesStatus.java new file mode 100644 index 00000000000..e9811209636 --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/properties/ServerServicesStatus.java @@ -0,0 +1,196 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.properties; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.io.Serializable; +import java.util.List; +import java.util.Objects; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * ServerServicesStatus documents the status of a server and the services within it. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class ServerServicesStatus implements Serializable +{ + private static final long serialVersionUID = 1L; + + private String serverName = null; + private String serverType = null; + private ServerActiveStatus serverActiveStatus = ServerActiveStatus.UNKNOWN; + private List services = null; + + /** + * Default constructor for Jackson + */ + public ServerServicesStatus() + { + } + + /** + * Copy/clone constructor + * + * @param template object to copy + */ + public ServerServicesStatus(ServerServicesStatus template) + { + + if (template != null) + { + serverName = template.getServerName(); + serverType = template.getServerType(); + serverActiveStatus = template.getServerActiveStatus(); + services = template.getServices(); + } + } + + + /** + * Return the server name + * + * @return String + */ + public String getServerName() + { + return serverName; + } + + + /** + * Set the name of the server + * + * @param serverName the name of the server + */ + public void setServerName(String serverName) + { + this.serverName = serverName; + } + + + + /** + * Return the type of server that is hosting these services. + * + * @return string name + */ + public String getServerType() + { + return serverType; + } + + + /** + * Set up the type of server that is hosting these services. + * + * @param serverType string name + */ + public void setServerType(String serverType) + { + this.serverType = serverType; + } + + + /** + * Set up the current status of the server. + * + * @param serverActiveStatus new status + */ + public void setServerActiveStatus(ServerActiveStatus serverActiveStatus) + { + this.serverActiveStatus = serverActiveStatus; + } + + /** + * Return the current status of the server. + * + * @return server instance status enum + */ + public ServerActiveStatus getServerActiveStatus() + { + return serverActiveStatus; + } + + + /** + * Return the services and their status. + * + * @return services list + */ + public List getServices() + { + return services; + } + + + /** + * Set up the services and their status. + * + * @param services services list + */ + public void setServices(List services) + { + this.services = services; + } + + + /** + * JSON like toString method + * + * @return string representing the local variables + */ + @Override + public String toString() + { + return "ServerServicesStatus{" + + "serverName='" + serverName + '\'' + + ", serverType='" + serverType + '\'' + + ", serverActiveStatus=" + serverActiveStatus + + ", services=" + services + + '}'; + } + + + /** + * Return comparison result based on the content of the properties. + * + * @param objectToCompare test object + * @return result of comparison + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (objectToCompare == null || getClass() != objectToCompare.getClass()) + { + return false; + } + ServerServicesStatus that = (ServerServicesStatus) objectToCompare; + return Objects.equals(serverName, that.serverName) && + Objects.equals(serverType, that.serverType) && + serverActiveStatus == that.serverActiveStatus && + Objects.equals(services, that.services); + } + + + /** + * Return hash code for this object + * + * @return int hash code + */ + @Override + public int hashCode() + { + return Objects.hash(serverName, serverType, serverActiveStatus, services); + } +} diff --git a/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/OMAGServerStatusResponse.java b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/OMAGServerStatusResponse.java new file mode 100644 index 00000000000..72b7757184f --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/OMAGServerStatusResponse.java @@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.rest; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCResponseBase; +import org.odpi.openmetadata.platformservices.properties.ServerServicesStatus; + +import java.util.Arrays; +import java.util.Objects; + +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; +import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; + +/** + * ServerListResponse returns the list of servers running in a platform. + */ +@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown=true) +public class OMAGServerStatusResponse extends FFDCResponseBase +{ + private static final long serialVersionUID = 1L; + + private ServerServicesStatus serverServicesStatus = null; + + + /** + * Default constructor + */ + public OMAGServerStatusResponse() + { + super(); + } + + + /** + * Copy/clone constructor + * + * @param template object to copy + */ + public OMAGServerStatusResponse(OMAGServerStatusResponse template) + { + super(template); + + if (template != null) + { + serverServicesStatus = template.getServerStatus(); + } + } + + + /** + * Return the server status structure. + * + * @return server status + */ + public ServerServicesStatus getServerStatus() + { + return serverServicesStatus; + } + + + /** + * Set up the server status structure. + * + * @param serverServicesStatus server status + */ + public void setServerStatus(ServerServicesStatus serverServicesStatus) + { + this.serverServicesStatus = serverServicesStatus; + } + + + /** + * JSON-like toString + * + * @return string containing the property names and values + */ + @Override + public String toString() + { + return "OMAGServerStatusResponse{" + + "serverServicesStatus=" + serverServicesStatus + + ", exceptionClassName='" + getExceptionClassName() + '\'' + + ", exceptionCausedBy='" + getExceptionCausedBy() + '\'' + + ", actionDescription='" + getActionDescription() + '\'' + + ", relatedHTTPCode=" + getRelatedHTTPCode() + + ", exceptionErrorMessage='" + getExceptionErrorMessage() + '\'' + + ", exceptionErrorMessageId='" + getExceptionErrorMessageId() + '\'' + + ", exceptionErrorMessageParameters=" + Arrays.toString(getExceptionErrorMessageParameters()) + + ", exceptionSystemAction='" + getExceptionSystemAction() + '\'' + + ", exceptionUserAction='" + getExceptionUserAction() + '\'' + + ", exceptionProperties=" + getExceptionProperties() + + '}'; + } + + + /** + * Return comparison result based on the content of the properties. + * + * @param objectToCompare test object + * @return result of comparison + */ + @Override + public boolean equals(Object objectToCompare) + { + if (this == objectToCompare) + { + return true; + } + if (objectToCompare == null || getClass() != objectToCompare.getClass()) + { + return false; + } + if (! super.equals(objectToCompare)) + { + return false; + } + OMAGServerStatusResponse that = (OMAGServerStatusResponse) objectToCompare; + return Objects.equals(serverServicesStatus, that.serverServicesStatus); + } + + + /** + * Return hash code for this object + * + * @return int hash code + */ + @Override + public int hashCode() + { + return Objects.hash(super.hashCode(), serverServicesStatus); + } +} diff --git a/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/SuccessMessageResponse.java b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/SuccessMessageResponse.java new file mode 100644 index 00000000000..ed06571dec1 --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-api/src/main/java/org/odpi/openmetadata/platformservices/rest/SuccessMessageResponse.java @@ -0,0 +1,95 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.rest; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCResponseBase; + +import java.util.Arrays; + +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) +public class SuccessMessageResponse extends FFDCResponseBase +{ + private static final long serialVersionUID = 1L; + + private String successMessage = null; + + + /** + * Default constructor + */ + public SuccessMessageResponse() + { + super(); + } + + + /** + * Copy/clone constructor + * + * @param template object to copy + */ + public SuccessMessageResponse(SuccessMessageResponse template) + { + super(template); + + if (template != null) + { + this.successMessage = template.getSuccessMessage(); + } + } + + + /** + * Return the success message (if any). + * + * @return string or null + */ + public String getSuccessMessage() + { + return successMessage; + } + + + /** + * Set up the success message. This provides supplementary information about the services that + * have been changed. + * + * @param successMessage string or null + */ + public void setSuccessMessage(String successMessage) + { + this.successMessage = successMessage; + } + + + /** + * JSON-like toString + * + * @return string containing the property names and values + */ + @Override + public String toString() + { + return "SuccessMessageResponse{" + + "successMessage='" + successMessage + '\'' + + ", exceptionClassName='" + getExceptionClassName() + '\'' + + ", exceptionCausedBy='" + getExceptionCausedBy() + '\'' + + ", actionDescription='" + getActionDescription() + '\'' + + ", relatedHTTPCode=" + getRelatedHTTPCode() + + ", exceptionErrorMessage='" + getExceptionErrorMessage() + '\'' + + ", exceptionErrorMessageId='" + getExceptionErrorMessageId() + '\'' + + ", exceptionErrorMessageParameters=" + Arrays.toString(getExceptionErrorMessageParameters()) + + ", exceptionSystemAction='" + getExceptionSystemAction() + '\'' + + ", exceptionUserAction='" + getExceptionUserAction() + '\'' + + ", exceptionProperties=" + getExceptionProperties() + + '}'; + } +} diff --git a/open-metadata-implementation/platform-services/platform-services-client/build.gradle b/open-metadata-implementation/platform-services/platform-services-client/build.gradle index 6a3c8586e6e..2636a573894 100644 --- a/open-metadata-implementation/platform-services/platform-services-client/build.gradle +++ b/open-metadata-implementation/platform-services/platform-services-client/build.gradle @@ -7,6 +7,7 @@ dependencies { implementation 'org.slf4j:slf4j-api' implementation project(':open-metadata-implementation:platform-services:platform-services-api') + implementation project(':open-metadata-implementation:admin-services:admin-services-api') implementation project(':open-metadata-implementation:frameworks:audit-log-framework') implementation project(':open-metadata-implementation:frameworks:open-connector-framework') implementation project(':open-metadata-implementation:common-services:ffdc-services') diff --git a/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java b/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java index e089ef19b0c..a799082da3c 100644 --- a/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java +++ b/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesClient.java @@ -4,8 +4,11 @@ package org.odpi.openmetadata.platformservices.client; +import org.odpi.openmetadata.adminservices.configuration.properties.OMAGServerConfig; +import org.odpi.openmetadata.adminservices.rest.OMAGServerConfigResponse; +import org.odpi.openmetadata.adminservices.rest.PlatformSecurityRequestBody; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeListResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectionResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.RegisteredOMAGService; import org.odpi.openmetadata.commonservices.ffdc.rest.RegisteredOMAGServicesResponse; @@ -13,11 +16,16 @@ 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.frameworks.connectors.properties.beans.Connection; import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType; +import org.odpi.openmetadata.platformservices.properties.ServerServicesStatus; import org.odpi.openmetadata.platformservices.properties.ServerStatus; +import org.odpi.openmetadata.platformservices.rest.OMAGServerStatusResponse; import org.odpi.openmetadata.platformservices.rest.ServerListResponse; import org.odpi.openmetadata.platformservices.rest.ServerServicesListResponse; import org.odpi.openmetadata.platformservices.rest.ServerStatusResponse; +import org.odpi.openmetadata.platformservices.rest.SuccessMessageResponse; + import java.util.List; @@ -31,9 +39,9 @@ public class PlatformServicesClient private final String platformRootURL; /* Initialized in constructor */ protected AuditLog auditLog; /* Initialized in constructor */ - private final String retrieveURLTemplatePrefix = "/open-metadata/platform-services/users/{1}/server-platform"; + private final String retrieveURLTemplatePrefix = "/open-metadata/platform-services/users/{1}/server-platform"; - private final InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); + private final InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); /** * Create a new client with no authentication embedded in the HTTP request. @@ -135,12 +143,87 @@ public String getPlatformOrigin(String userId) throws InvalidParameterExceptio final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/origin"; - String restResult = restClient.callStringGetRESTCall(methodName, urlTemplate, userId); + return restClient.callStringGetRESTCall(methodName, urlTemplate, userId); + } + + + /** + * Set up a platform security connector. This connector provides additional authorization + * checks on API requests to the platform. + * + * @param userId calling user + * @param connection connection object that defines the platform security connector + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void setPlatformSecurityConnection(String userId, + Connection connection) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "setPlatformSecurityConnection"; + final String parameterName = "connection"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/security/connection"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateConnection(connection, parameterName, methodName); + + PlatformSecurityRequestBody requestBody = new PlatformSecurityRequestBody(); + + requestBody.setPlatformSecurityConnection(connection); - return restResult; // .getResultString(); + restClient.callVoidPostRESTCall(methodName, urlTemplate, requestBody, userId); } + /** + * Clear the connection object for platform security. This means there is no platform security set up + * and there will be no authorization checks within the platform. All security will have to + * come from the surrounding deployment environment. + * This is the default state. + * + * @param userId calling user + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void clearPlatformSecurityConnection(String userId) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "clearPlatformSecurityConnection"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/security/connection"; + + invalidParameterHandler.validateUserId(userId, methodName); + + restClient.callVoidDeleteRESTCall(methodName, urlTemplate, userId); + } + + + /** + * Return the connection object for platform security connector. Null is returned if no platform security + * has been set up. + * + * @param userId calling user + * @return Platform security connection + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public Connection getPlatformSecurityConnection(String userId) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "getPlatformSecurityConnection"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/security/connection"; + + ConnectionResponse restResult = restClient.callConnectionGetRESTCall(methodName, urlTemplate, userId); + + return restResult.getConnection(); + } + + /** * Return the connector type for the requested connector provider after validating that the * connector provider is available on the OMAGServerPlatform's class path. This method is for tools that are configuring @@ -165,7 +248,7 @@ public ConnectorType getConnectorType(String userId, invalidParameterHandler.validateUserId(userId, methodName); invalidParameterHandler.validateName(connectorProviderClassName, connectorProviderParameterName, methodName); - final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/connector-types/{1}" + connectorProviderClassName; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/connector-types/{1}"; ConnectorTypeResponse restResult = restClient.callConnectorTypeGetRESTCall(methodName, urlTemplate, userId, connectorProviderClassName); @@ -227,8 +310,10 @@ public List getActiveServices(String userId, PropertyServerException { final String methodName = "getActiveServices"; + final String serverNameParameter = "serverName"; invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/"+serverName+"/services"; @@ -451,4 +536,309 @@ public List getCommonServices(String userId) throws Inv return restResult.getServices(); } + + + + + /* + * ======================================================================================== + * Activate and deactivate the open metadata and governance capabilities in the OMAG Server + */ + + /** + * Activate the Open Metadata and Governance (OMAG) server using the configuration document stored for this server. + * + * @param userId calling user + * @param serverName server to start + * @return success message + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the server. + */ + public String activateWithStoredConfig(String userId, + String serverName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "activateWithStoredConfig"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + + SuccessMessageResponse restResult = restClient.callSuccessMessagePostRESTCall(methodName, urlTemplate, null, userId, serverName); + + return restResult.getSuccessMessage(); + } + + + /** + * Activate the open metadata and governance services using the supplied configuration + * document. + * + * @param userId calling user + * @param configuration properties used to initialize the services + * @return success message + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the server. + */ + public String activateWithSuppliedConfig(String userId, + OMAGServerConfig configuration) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "activateWithSuppliedConfig"; + final String parameterName = "configuration"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance/configuration"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateObject(configuration, parameterName, methodName); + + SuccessMessageResponse restResult = restClient.callSuccessMessagePostRESTCall(methodName, + urlTemplate, + configuration, + userId, + configuration.getLocalServerName()); + + return restResult.getSuccessMessage(); + } + + + /** + * Temporarily deactivate any open metadata and governance services. + * + * @param userId calling user + * @param serverName server to start + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void shutdownServer(String userId, + String serverName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "shutdownServer"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + + restClient.callVoidDeleteRESTCall(methodName, urlTemplate, userId, serverName); + } + + + /** + * Temporarily shutdown all running servers. + * + * @param userId user that is issuing the request + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void shutdownAllServers(String userId) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "shutdownAllServers"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/instance"; + + invalidParameterHandler.validateUserId(userId, methodName); + + restClient.callVoidDeleteRESTCall(methodName, urlTemplate, userId); + } + + + /** + * Permanently deactivate any open metadata and governance services and unregister from + * any cohorts. + * + * @param userId calling user + * @param serverName server to start + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + + public void shutdownAndUnregisterServer(String userId, + String serverName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "shutdownAndUnregisterServer"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + + restClient.callVoidDeleteRESTCall(methodName, urlTemplate, userId, serverName); + } + + + /** + * Shutdown any active servers and unregister them from + * any cohorts. + * + * @param userId user that is issuing the request + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void shutdownAndUnregisterAllServers(String userId) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "shutdownAndUnregisterAllServers"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers"; + + invalidParameterHandler.validateUserId(userId, methodName); + + restClient.callVoidDeleteRESTCall(methodName, urlTemplate, userId); + } + + + /** + * Shutdown any active servers and unregister them from + * any cohorts. + * + * @param userId user that is issuing the request + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void shutdownPlatform(String userId) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "shutdownPlatform"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/instance"; + + invalidParameterHandler.validateUserId(userId, methodName); + + restClient.callVoidDeleteRESTCall(methodName, urlTemplate, userId); + } + + + /* + * ============================================================= + * Operational status and control + */ + + /** + * Return the configuration used for the current active instance of the server. Null is returned if + * the server instance is not running. + * + * @param userId calling user + * @param serverName server to start + * @return configuration properties used to initialize the server or null if not running + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public OMAGServerConfig getActiveConfiguration(String userId, + String serverName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "getActiveConfiguration"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance/configuration"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + + OMAGServerConfigResponse restResult = restClient.callOMAGServerConfigGetRESTCall(methodName, urlTemplate, userId, serverName); + + return restResult.getOMAGServerConfig(); + } + + + /** + * Return the status of a running server (use platform services to find out if the server is running). + * + * @param userId calling user + * @param serverName server to start + * @return status of the server + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public ServerServicesStatus getServerServicesStatus(String userId, + String serverName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "getServerStatus"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance/status"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + + OMAGServerStatusResponse restResult = restClient.callOMAGServerStatusGetRESTCall(methodName, urlTemplate, userId, serverName); + + return restResult.getServerStatus(); + } + + + /** + * Add a new open metadata archive to running repository. + * + * @param userId calling user + * @param serverName server to start + * @param fileName name of the open metadata archive file. + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void addOpenMetadataArchiveFile(String userId, + String serverName, + String fileName) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "addOpenMetadataArchiveFile"; + final String parameterName = "fileName"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance/open-metadata-archives/file"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + invalidParameterHandler.validateName(fileName, parameterName, methodName); + + restClient.callVoidPostRESTCall(methodName, urlTemplate, fileName, userId, serverName); + } + + + /** + * Add a new open metadata archive to running repository. + * + * @param userId calling user + * @param serverName server to start + * @param connection connection for the open metadata archive. + * @throws UserNotAuthorizedException the supplied userId is not authorized to issue this command. + * @throws InvalidParameterException invalid parameter. + * @throws PropertyServerException unusual state in the platform. + */ + public void addOpenMetadataArchive(String userId, + String serverName, + Connection connection) throws UserNotAuthorizedException, + InvalidParameterException, + PropertyServerException + { + final String methodName = "addOpenMetadataArchiveFile"; + final String parameterName = "connection"; + final String serverNameParameter = "serverName"; + final String urlTemplate = platformRootURL + retrieveURLTemplatePrefix + "/servers/{1}/instance/open-metadata-archives/connection"; + + invalidParameterHandler.validateUserId(userId, methodName); + invalidParameterHandler.validateName(serverName, serverNameParameter, methodName); + invalidParameterHandler.validateConnection(connection, parameterName, methodName); + + restClient.callVoidPostRESTCall(methodName, urlTemplate, connection, userId, serverName); + } } diff --git a/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesRESTClient.java b/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesRESTClient.java index 0b3262c7bb0..e53dae8f8a5 100644 --- a/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesRESTClient.java +++ b/open-metadata-implementation/platform-services/platform-services-client/src/main/java/org/odpi/openmetadata/platformservices/client/PlatformServicesRESTClient.java @@ -3,17 +3,22 @@ package org.odpi.openmetadata.platformservices.client; +import org.odpi.openmetadata.adminservices.rest.OMAGServerConfigResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectionResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeListResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClient; import org.odpi.openmetadata.commonservices.ffdc.rest.RegisteredOMAGServicesResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; 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.platformservices.rest.OMAGServerStatusResponse; import org.odpi.openmetadata.platformservices.rest.ServerListResponse; import org.odpi.openmetadata.platformservices.rest.ServerServicesListResponse; import org.odpi.openmetadata.platformservices.rest.ServerStatusResponse; +import org.odpi.openmetadata.platformservices.rest.SuccessMessageResponse; /** @@ -277,4 +282,145 @@ RegisteredOMAGServicesResponse callRegisteredOMAGServicesGetRESTCall(String m return restResult; } + + + /** + * Issue a POST REST call that returns a SuccessMessageResponse object. This is typically a server start. + * + * @param methodName name of the method being called. + * @param urlTemplate template of the URL for the REST API call with place-holders for the parameters. + * @param requestBody request body for the request. + * @param params a list of parameters that are slotted into the url template. + * + * @return SuccessMessageResponse + * @throws InvalidParameterException one of the parameters is invalid. + * @throws UserNotAuthorizedException the user is not authorized to make this request. + * @throws PropertyServerException the repository is not available or not working properly. + */ + SuccessMessageResponse callSuccessMessagePostRESTCall(String methodName, + String urlTemplate, + Object requestBody, + Object... params) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + SuccessMessageResponse restResult = this.callPostRESTCall(methodName, + SuccessMessageResponse.class, + urlTemplate, + requestBody, + params); + + exceptionHandler.detectAndThrowStandardExceptions(methodName, restResult); + + return restResult; + } + + + /** + * Issue a GET REST call that returns a OMAGServerStatusResponse object. + * + * @param methodName name of the method being called. + * @param urlTemplate template of the URL for the REST API call with place-holders for the parameters. + * @param params a list of parameters that are slotted into the url template. + * + * @return OMAGServerStatusResponse + * @throws InvalidParameterException one of the parameters is invalid. + * @throws UserNotAuthorizedException the user is not authorized to make this request. + * @throws PropertyServerException the repository is not available or not working properly. + */ + OMAGServerStatusResponse callOMAGServerStatusGetRESTCall(String methodName, + String urlTemplate, + Object... params) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + OMAGServerStatusResponse restResult = this.callGetRESTCall(methodName, OMAGServerStatusResponse.class, urlTemplate, params); + + exceptionHandler.detectAndThrowStandardExceptions(methodName, restResult); + + return restResult; + } + + + /** + * Issue a DELETE REST call that returns a VoidResponse object. This is typically a delete + * + * @param methodName name of the method being called. + * @param urlTemplate template of the URL for the REST API call with place-holders for the parameters. + * @param params a list of parameters that are slotted into the url template. + * + * @return VoidResponse + * @throws InvalidParameterException one of the parameters is invalid. + * @throws UserNotAuthorizedException the user is not authorized to make this request. + * @throws PropertyServerException something went wrong with the REST call stack. + */ + VoidResponse callVoidDeleteRESTCall(String methodName, + String urlTemplate, + Object... params) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + VoidResponse restResult = this.callDeleteRESTCall(methodName, + VoidResponse.class, + urlTemplate, + null, + params); + + exceptionHandler.detectAndThrowStandardExceptions(methodName, restResult); + + return restResult; + } + + + /** + * Issue a GET REST call that returns a OMAGServerConfigResponse object. + * + * @param methodName name of the method being called. + * @param urlTemplate template of the URL for the REST API call with place-holders for the parameters. + * @param params a list of parameters that are slotted into the url template. + * + * @return OMAGServerConfigResponse + * @throws InvalidParameterException one of the parameters is invalid. + * @throws UserNotAuthorizedException the user is not authorized to make this request. + * @throws PropertyServerException something went wrong with the REST call stack. + */ + OMAGServerConfigResponse callOMAGServerConfigGetRESTCall(String methodName, + String urlTemplate, + Object... params) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + OMAGServerConfigResponse restResult = this.callGetRESTCall(methodName, OMAGServerConfigResponse.class, urlTemplate, params); + + exceptionHandler.detectAndThrowStandardExceptions(methodName, restResult); + + return restResult; + } + + + + /** + * Issue a GET REST call that returns a ConnectionResponse object. + * + * @param methodName name of the method being called. + * @param urlTemplate template of the URL for the REST API call with place-holders for the parameters. + * @param params a list of parameters that are slotted into the url template. + * + * @return ConnectionResponse + * @throws InvalidParameterException one of the parameters is invalid. + * @throws UserNotAuthorizedException the user is not authorized to make this request. + * @throws PropertyServerException something went wrong with the REST call stack. + */ + ConnectionResponse callConnectionGetRESTCall(String methodName, + String urlTemplate, + Object... params) throws InvalidParameterException, + UserNotAuthorizedException, + PropertyServerException + { + ConnectionResponse restResult = this.callGetRESTCall(methodName, ConnectionResponse.class, urlTemplate, params); + + exceptionHandler.detectAndThrowStandardExceptions(methodName, restResult); + + return restResult; + } } diff --git a/open-metadata-implementation/platform-services/platform-services-server/build.gradle b/open-metadata-implementation/platform-services/platform-services-server/build.gradle index 8203e803a47..ef36c1331ba 100644 --- a/open-metadata-implementation/platform-services/platform-services-server/build.gradle +++ b/open-metadata-implementation/platform-services/platform-services-server/build.gradle @@ -10,8 +10,25 @@ dependencies { implementation project(':open-metadata-implementation:common-services:multi-tenant') implementation project(':open-metadata-implementation:frameworks:open-connector-framework') implementation project(':open-metadata-implementation:frameworks:audit-log-framework') + implementation project(':open-metadata-implementation:adapters:open-connectors:connector-configuration-factory') implementation project(':open-metadata-implementation:common-services:ffdc-services') implementation project(':open-metadata-implementation:admin-services:admin-services-api') + implementation project(':open-metadata-implementation:admin-services:admin-services-server') + implementation project(':open-metadata-implementation:admin-services:admin-services-registration') + implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-apis') + implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') + implementation project(':open-metadata-implementation:repository-services:repository-services-apis') + implementation project(':open-metadata-implementation:repository-services:repository-services-implementation') + implementation project(':open-metadata-implementation:framework-services:ocf-metadata-management:ocf-metadata-server') + implementation project(':open-metadata-implementation:framework-services:oif-metadata-management:oif-metadata-server') + implementation project(':open-metadata-implementation:framework-services:gaf-metadata-management:gaf-metadata-server') + implementation project(':open-metadata-conformance-suite:open-metadata-conformance-suite-server') + implementation project(':open-metadata-implementation:governance-servers:integration-daemon-services:integration-daemon-services-registration') + implementation project(':open-metadata-implementation:governance-servers:integration-daemon-services:integration-daemon-services-server') + implementation project(':open-metadata-implementation:governance-servers:engine-host-services:engine-host-services-registration') + implementation project(':open-metadata-implementation:governance-servers:engine-host-services:engine-host-services-server') + implementation project(':open-metadata-implementation:governance-servers:open-lineage-services:open-lineage-services-server') + implementation project(':open-metadata-implementation:governance-servers:data-engine-proxy-services:data-engine-proxy-services-server') compileOnly 'com.fasterxml.jackson.core:jackson-annotations' } diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGOperationalServicesInstance.java b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGOperationalServicesInstance.java similarity index 97% rename from open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGOperationalServicesInstance.java rename to open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGOperationalServicesInstance.java index a2c19946ec2..a7ee41f3252 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGOperationalServicesInstance.java +++ b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGOperationalServicesInstance.java @@ -1,14 +1,11 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.server; +package org.odpi.openmetadata.platformservices.server; import org.odpi.openmetadata.adminservices.configuration.properties.OMAGServerConfig; import org.odpi.openmetadata.adminservices.registration.AccessServiceAdmin; import org.odpi.openmetadata.adminservices.configuration.registration.ServerTypeClassification; import org.odpi.openmetadata.adminservices.registration.ViewServiceAdmin; -import org.odpi.openmetadata.adminservices.properties.OMAGServerServiceStatus; -import org.odpi.openmetadata.adminservices.properties.ServerActiveStatus; -import org.odpi.openmetadata.adminservices.properties.ServerServicesStatus; import org.odpi.openmetadata.frameworkservices.gaf.admin.GAFMetadataOperationalServices; import org.odpi.openmetadata.commonservices.multitenant.OMAGServerServiceInstance; import org.odpi.openmetadata.frameworkservices.ocf.metadatamanagement.admin.OCFMetadataOperationalServices; @@ -18,6 +15,9 @@ import org.odpi.openmetadata.governanceservers.enginehostservices.server.EngineHostOperationalServices; import org.odpi.openmetadata.governanceservers.integrationdaemonservices.server.IntegrationDaemonOperationalServices; import org.odpi.openmetadata.governanceservers.openlineage.admin.OpenLineageServerOperationalServices; +import org.odpi.openmetadata.platformservices.properties.OMAGServerServiceStatus; +import org.odpi.openmetadata.platformservices.properties.ServerActiveStatus; +import org.odpi.openmetadata.platformservices.properties.ServerServicesStatus; import org.odpi.openmetadata.repositoryservices.admin.OMRSOperationalServices; import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLog; @@ -32,8 +32,8 @@ class OMAGOperationalServicesInstance extends OMAGServerServiceInstance { - private ServerActiveStatus serverActiveStatus = ServerActiveStatus.INACTIVE; - private final Map serviceStatusMap = new HashMap<>(); + private ServerActiveStatus serverActiveStatus = ServerActiveStatus.INACTIVE; + private final Map serviceStatusMap = new HashMap<>(); private final ServerTypeClassification serverTypeClassification; private OMAGServerConfig operationalConfiguration = null; @@ -105,7 +105,7 @@ public synchronized ServerServicesStatus getServerStatus() serverServicesStatus.setServerType(serverTypeClassification.getServerTypeName()); serverServicesStatus.setServerActiveStatus(serverActiveStatus); - List serviceStatuses = new ArrayList<>(); + List serviceStatuses = new ArrayList<>(); for (String serviceName : serviceStatusMap.keySet()) { diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOperationalInstanceHandler.java b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerOperationalInstanceHandler.java similarity index 97% rename from open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOperationalInstanceHandler.java rename to open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerOperationalInstanceHandler.java index 29f26204321..e4105a91490 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOperationalInstanceHandler.java +++ b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerOperationalInstanceHandler.java @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.server; +package org.odpi.openmetadata.platformservices.server; import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; import org.odpi.openmetadata.commonservices.ffdc.exceptions.PropertyServerException; diff --git a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOperationalServices.java b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerOperationalServices.java similarity index 93% rename from open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOperationalServices.java rename to open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerOperationalServices.java index dd7e4902d82..98905a48abf 100644 --- a/open-metadata-implementation/admin-services/admin-services-server/src/main/java/org/odpi/openmetadata/adminservices/server/OMAGServerOperationalServices.java +++ b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerOperationalServices.java @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.server; +package org.odpi.openmetadata.platformservices.server; import org.odpi.openmetadata.adapters.repositoryservices.ConnectorConfigurationFactory; @@ -12,12 +12,13 @@ import org.odpi.openmetadata.adminservices.ffdc.exception.OMAGConfigurationErrorException; import org.odpi.openmetadata.adminservices.ffdc.exception.OMAGInvalidParameterException; import org.odpi.openmetadata.adminservices.ffdc.exception.OMAGNotAuthorizedException; -import org.odpi.openmetadata.adminservices.properties.ServerActiveStatus; import org.odpi.openmetadata.adminservices.registration.AccessServiceAdmin; import org.odpi.openmetadata.adminservices.registration.ViewServiceAdmin; import org.odpi.openmetadata.adminservices.rest.OMAGServerConfigResponse; -import org.odpi.openmetadata.adminservices.rest.OMAGServerStatusResponse; -import org.odpi.openmetadata.adminservices.rest.SuccessMessageResponse; +import org.odpi.openmetadata.platformservices.rest.OMAGServerStatusResponse; +import org.odpi.openmetadata.adminservices.server.OMAGServerAdminStoreServices; +import org.odpi.openmetadata.adminservices.server.OMAGServerErrorHandler; +import org.odpi.openmetadata.adminservices.server.OMAGServerExceptionHandler; import org.odpi.openmetadata.commonservices.ffdc.RESTCallLogger; import org.odpi.openmetadata.commonservices.ffdc.RESTCallToken; import org.odpi.openmetadata.commonservices.ffdc.exceptions.PropertyServerException; @@ -35,6 +36,8 @@ import org.odpi.openmetadata.governanceservers.dataengineproxy.admin.DataEngineProxyOperationalServices; import org.odpi.openmetadata.governanceservers.openlineage.admin.OpenLineageServerOperationalServices; import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataServerSecurityVerifier; +import org.odpi.openmetadata.platformservices.properties.ServerActiveStatus; +import org.odpi.openmetadata.platformservices.rest.SuccessMessageResponse; import org.odpi.openmetadata.repositoryservices.admin.OMRSOperationalServices; import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLog; import org.odpi.openmetadata.repositoryservices.connectors.omrstopic.OMRSTopicConnector; @@ -50,16 +53,16 @@ */ public class OMAGServerOperationalServices { - private final OMAGServerOperationalInstanceHandler instanceHandler = new OMAGServerOperationalInstanceHandler(CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + private final OMAGServerOperationalInstanceHandler instanceHandler = new OMAGServerOperationalInstanceHandler(CommonServicesDescription.PLATFORM_SERVICES.getServiceName()); private final OMAGServerPlatformInstanceMap platformInstanceMap = new OMAGServerPlatformInstanceMap(); - private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); - private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); - private final OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); + private final OMAGServerAdminStoreServices configStore = new OMAGServerAdminStoreServices(); + private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); + private final OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); private final static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerOperationalServices.class), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName()); + CommonServicesDescription.PLATFORM_SERVICES.getServiceName()); /* * ============================================================= @@ -213,26 +216,12 @@ public SuccessMessageResponse activateWithSuppliedConfig(String userId ServerTypeClassifier serverTypeClassifier = new ServerTypeClassifier(serverName, configuration); ServerTypeClassification serverTypeClassification = serverTypeClassifier.getServerType(); - /* - * If the server type is not set then use the value from the classification. - */ - if (configuration.getLocalServerType() == null) - { - configuration.setLocalServerType(serverTypeClassification.getServerTypeName()); - } - - /* - * Save the configuration document to the config store. This ensures we have the latest version of the - * config document on file. - */ - configStore.saveServerConfig(serverName, methodName, configuration); - /* * Validate that the server is not running already. If it is running it should be shutdown. */ if (instanceHandler.isServerActive(userId, serverName)) { - this.deactivateTemporarily(userId, serverName); + this.shutdownServer(userId, serverName); } /* @@ -242,7 +231,7 @@ public SuccessMessageResponse activateWithSuppliedConfig(String userId */ instance = new OMAGOperationalServicesInstance(serverName, serverTypeClassification, - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName(), + CommonServicesDescription.PLATFORM_SERVICES.getServiceName(), configuration.getMaxPageSize()); instance.setServerActiveStatus(ServerActiveStatus.STARTING); @@ -285,11 +274,11 @@ public SuccessMessageResponse activateWithSuppliedConfig(String userId * immature subsystems that have not yet developed their logging and error handling. */ OMRSAuditLog auditLog = operationalRepositoryServices.getAuditLog( - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceCode(), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceDevelopmentStatus(), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceName(), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceDescription(), - CommonServicesDescription.ADMIN_OPERATIONAL_SERVICES.getServiceWiki()); + CommonServicesDescription.PLATFORM_SERVICES.getServiceCode(), + CommonServicesDescription.PLATFORM_SERVICES.getServiceDevelopmentStatus(), + CommonServicesDescription.PLATFORM_SERVICES.getServiceName(), + CommonServicesDescription.PLATFORM_SERVICES.getServiceDescription(), + CommonServicesDescription.PLATFORM_SERVICES.getServiceWiki()); instance.setAuditLog(auditLog); /* @@ -1416,7 +1405,7 @@ public void deactivateTemporarilyServerList(String userId, { if (serverName != null) { - deactivateTemporarily(userId, serverName); + shutdownServer(userId, serverName); } } } @@ -1432,10 +1421,10 @@ public void deactivateTemporarilyServerList(String userId, * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or * OMAGInvalidParameterException the serverName is invalid. */ - public VoidResponse deactivateTemporarily(String userId, - String serverName) + public VoidResponse shutdownServer(String userId, + String serverName) { - final String methodName = "deactivateTemporarily"; + final String methodName = "shutdownServer"; RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); @@ -1480,8 +1469,65 @@ public VoidResponse deactivateTemporarily(String userId, /** - * Terminate any running open metadata and governance services, remove the server from any open metadata cohorts - * and delete the server's configuration. + * Temporarily deactivate any open metadata and governance services for all running servers. + * + * @param userId user that is issuing the request + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + public VoidResponse shutdownAllServers(String userId) + { + final String methodName = "shutdownServer"; + final String serverName = ""; + + RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); + + VoidResponse response = new VoidResponse(); + + try + { + errorHandler.validateUserId(userId, serverName, methodName); + + List activeServers = platformInstanceMap.getActiveServerList(userId); + + if (activeServers != null) + { + for (String activeServerName : activeServers) + { + deactivateRunningServiceInstances(userId, + activeServerName, + methodName, + instanceHandler.getServerServiceInstance(userId, activeServerName, methodName), + false); + } + } + } + catch (InvalidParameterException error) + { + exceptionHandler.captureInvalidParameterException(response, error); + } + catch (UserNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (OMAGNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (Exception error) + { + exceptionHandler.capturePlatformRuntimeException(serverName, methodName, response, error); + } + + restCallLogger.logRESTCallReturn(token, response.toString()); + + return response; + } + + + /** + * Terminate any running open metadata and governance services, remove the server from any open metadata cohorts. * * @param userId user that is issuing the request * @param serverName local server name @@ -1489,10 +1535,10 @@ public VoidResponse deactivateTemporarily(String userId, * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or * OMAGInvalidParameterException the serverName is invalid. */ - public VoidResponse deactivatePermanently(String userId, - String serverName) + public VoidResponse shutdownAndUnregisterServer(String userId, + String serverName) { - final String methodName = "deactivatePermanently"; + final String methodName = "shutdownAndUnregisterServer"; RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); @@ -1508,11 +1554,6 @@ public VoidResponse deactivatePermanently(String userId, methodName, instanceHandler.getServerServiceInstance(userId, serverName, methodName), true); - - /* - * Delete the configuration for this server - */ - configStore.saveServerConfig(serverName, methodName, null); } catch (InvalidParameterException error) { @@ -1544,6 +1585,105 @@ public VoidResponse deactivatePermanently(String userId, } + /** + * Terminate any running open metadata and governance services, remove the server from any open metadata cohorts + * and delete the server's configuration. + * + * @param userId user that is issuing the request + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + public VoidResponse shutdownAndUnregisterAllServers(String userId) + { + final String methodName = "shutdownAndUnregisterAllServers"; + final String serverName = ""; + + RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); + + VoidResponse response = new VoidResponse(); + + try + { + errorHandler.validateUserId(userId, serverName, methodName); + + List activeServers = platformInstanceMap.getActiveServerList(userId); + + if (activeServers != null) + { + for (String activeServerName : activeServers) + { + deactivateRunningServiceInstances(userId, + activeServerName, + methodName, + instanceHandler.getServerServiceInstance(userId, activeServerName, methodName), + true); + } + } + } + catch (InvalidParameterException error) + { + exceptionHandler.captureInvalidParameterException(response, error); + } + catch (UserNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (OMAGNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (PropertyServerException error) + { + exceptionHandler.capturePropertyServerException(response, error); + } + catch (Exception error) + { + exceptionHandler.capturePlatformRuntimeException(serverName, methodName, response, error); + } + + restCallLogger.logRESTCallReturn(token, response.toString()); + return response; + } + + + /** + * Terminate this platform. + * + * @param userId user that is issuing the request + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + public VoidResponse shutdownPlatform(String userId) + { + final String methodName = "shutdownPlatform"; + final String serverName = ""; + + RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); + + VoidResponse response = new VoidResponse(); + + try + { + errorHandler.validateUserId(userId, serverName, methodName); + + Runtime.getRuntime().exit(1); + } + catch (OMAGNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (Exception error) + { + exceptionHandler.capturePlatformRuntimeException(serverName, methodName, response, error); + } + + restCallLogger.logRESTCallReturn(token, response.toString()); + return response; + } + + /* * ============================================================= * Services on running instances diff --git a/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerPlatformSecurityServices.java b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerPlatformSecurityServices.java new file mode 100644 index 00000000000..9186e672ca9 --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-server/src/main/java/org/odpi/openmetadata/platformservices/server/OMAGServerPlatformSecurityServices.java @@ -0,0 +1,158 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.server; + +import org.odpi.openmetadata.adminservices.configuration.registration.CommonServicesDescription; +import org.odpi.openmetadata.adminservices.rest.ConnectionResponse; +import org.odpi.openmetadata.adminservices.rest.PlatformSecurityRequestBody; +import org.odpi.openmetadata.adminservices.server.OMAGServerErrorHandler; +import org.odpi.openmetadata.adminservices.server.OMAGServerExceptionHandler; +import org.odpi.openmetadata.commonservices.ffdc.RESTCallLogger; +import org.odpi.openmetadata.commonservices.ffdc.RESTCallToken; +import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; +import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; +import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; +import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataPlatformSecurityVerifier; +import org.slf4j.LoggerFactory; + +/** + * OMAGServerPlatformSecurityServices provides the capability to set up open metadata security connectors. + * + * The open metadata security connectors validate the authorization of a user to access specific + * services and metadata in Egeria. There are 2 connectors: + * + * The Open Metadata Platform Security Connector verifies the authorization of calls to the OMAG + * Server Platform Services that are independent of a server. + * + * The Open Metadata Server Security Connector verifies the authorization of calls to a specific server. + * + * The connectors are configured with a Connection. The connection for the Open Metadata Server Security Connector + * is stored in the server's configuration document. The connection for the Open Metadata Platform Security Connector + * is added dynamically when the platform starts. + */ +public class OMAGServerPlatformSecurityServices +{ + private static final RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(OMAGServerPlatformSecurityServices.class), + CommonServicesDescription.PLATFORM_SERVICES.getServiceName()); + + private final OMAGServerExceptionHandler exceptionHandler = new OMAGServerExceptionHandler(); + private final OMAGServerErrorHandler errorHandler = new OMAGServerErrorHandler(); + + + /** + * Override the default platform security connector. + * + * @param userId calling user. + * @param requestBody containing serverPlatformURL (URL Root of the server platform) and + * connection used to create and configure the connector. + * @return void response + */ + public synchronized VoidResponse setPlatformSecurityConnection(String userId, + PlatformSecurityRequestBody requestBody) + { + final String methodName = "setPlatformSecurityConnection"; + + RESTCallToken token = restCallLogger.logRESTCall(null, userId, methodName); + + VoidResponse response = new VoidResponse(); + + try + { + if (requestBody == null) + { + exceptionHandler.handleNoRequestBody(userId, methodName, ""); + } + else + { + errorHandler.validatePlatformConnection(requestBody.getPlatformSecurityConnection(), methodName); + + OpenMetadataPlatformSecurityVerifier.setPlatformSecurityConnection(userId, + requestBody.getUrlRoot(), + requestBody.getPlatformSecurityConnection()); + } + } + catch (InvalidParameterException error) + { + exceptionHandler.captureInvalidParameterException(response, error); + } + catch (UserNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (Exception error) + { + exceptionHandler.capturePlatformRuntimeException(methodName, response, error); + } + + restCallLogger.logRESTCallReturn(token, response.toString()); + + return response; + } + + + /** + * Return the connection object for the platform security connector. + * + * @param userId calling user + * @return connection response + */ + public synchronized ConnectionResponse getPlatformSecurityConnection(String userId) + { + final String methodName = "getPlatformSecurityConnection"; + + RESTCallToken token = restCallLogger.logRESTCall(null, userId, methodName); + + ConnectionResponse response = new ConnectionResponse(); + + try + { + response.setConnection(OpenMetadataPlatformSecurityVerifier.getPlatformSecurityConnection(userId)); + } + catch (UserNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (Exception error) + { + exceptionHandler.capturePlatformRuntimeException(methodName, response, error); + } + + restCallLogger.logRESTCallReturn(token, response.toString()); + + return response; + } + + + /** + * Clear the connection object for the platform security connector. + * This sets the platform security back to default. + * + * @param userId calling user + * @return connection response + */ + public synchronized VoidResponse clearPlatformSecurityConnection(String userId) + { + final String methodName = "clearPlatformSecurityConnection"; + + RESTCallToken token = restCallLogger.logRESTCall(null, userId, methodName); + + VoidResponse response = new VoidResponse(); + + try + { + OpenMetadataPlatformSecurityVerifier.clearPlatformSecurityConnection(userId); + } + catch (UserNotAuthorizedException error) + { + exceptionHandler.captureNotAuthorizedException(response, error); + } + catch (Exception error) + { + exceptionHandler.capturePlatformRuntimeException(methodName, response, error); + } + + restCallLogger.logRESTCallReturn(token, response.toString()); + + return response; + } +} diff --git a/open-metadata-implementation/platform-services/platform-services-spring/build.gradle b/open-metadata-implementation/platform-services/platform-services-spring/build.gradle index c04968f230f..f1b98f58c66 100644 --- a/open-metadata-implementation/platform-services/platform-services-spring/build.gradle +++ b/open-metadata-implementation/platform-services/platform-services-spring/build.gradle @@ -8,6 +8,8 @@ dependencies { implementation project(':open-metadata-implementation:platform-services:platform-services-server') implementation project(':open-metadata-implementation:platform-services:platform-services-api') implementation project(':open-metadata-implementation:common-services:ffdc-services') + implementation project(':open-metadata-implementation:admin-services:admin-services-api') + implementation project(':open-metadata-implementation:frameworks:open-connector-framework') implementation 'org.springframework:spring-web' implementation 'io.swagger.core.v3:swagger-annotations' compileOnly 'com.fasterxml.jackson.core:jackson-annotations' diff --git a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java new file mode 100644 index 00000000000..7d17e9533cc --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java @@ -0,0 +1,317 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.server.spring; + +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.odpi.openmetadata.adminservices.configuration.properties.OMAGServerConfig; +import org.odpi.openmetadata.adminservices.rest.OMAGServerConfigResponse; +import org.odpi.openmetadata.platformservices.rest.OMAGServerStatusResponse; +import org.odpi.openmetadata.platformservices.rest.SuccessMessageResponse; +import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; +import org.odpi.openmetadata.frameworks.connectors.properties.beans.Connection; +import org.odpi.openmetadata.platformservices.server.OMAGServerOperationalServices; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +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.RestController; + +/** + * OMAGServerOperationResource provides the REST API for controlling the start up, management and + * shutdown of services in the OMAG Server. + */ +@RestController +@RequestMapping("/open-metadata/platform-services/users/{userId}/server-platform") + +@Tag(name="Platform Services", description="The platform services provides the APIs for querying the Open Metadata and Governance (OMAG) " + + "Server Platform. It is able to start an stop OMAG Servers and discovering information " + + "about the OMAG Servers that it is hosting.", + externalDocs=@ExternalDocumentation(description="Platform Services",url="https://egeria-project.org/services/platform-services/overview")) + + +public class OMAGServerOperationResource +{ + private final OMAGServerOperationalServices operationalServices = new OMAGServerOperationalServices(); + + /* + * ======================================================================================== + * Activate and deactivate the open metadata and governance capabilities in the OMAG Server + */ + + /** + * Activate the Open Metadata and Governance (OMAG) server using the configuration document stored for this server. + * + * @param userId user that is issuing the request + * @param serverName local server name + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the server name is invalid or + * OMAGConfigurationErrorException there is a problem using the supplied configuration. + */ + @PostMapping(path = "/servers/{serverName}/instance") + + @Operation(summary="activateWithStoredConfig", + description="Activate the named OMAG server using the appropriate configuration document found in the configuration store.", + externalDocs=@ExternalDocumentation(description="Configuration Documents", + url="https://egeria-project.org/concepts/configuration-document")) + + public SuccessMessageResponse activateWithStoredConfig(@PathVariable String userId, + @PathVariable String serverName) + { + return operationalServices.activateWithStoredConfig(userId, serverName); + } + + + /** + * Activate the open metadata and governance services using the supplied configuration + * document. + * + * @param userId user that is issuing the request + * @param configuration properties used to initialize the services + * @param serverName local server name + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the server name is invalid or + * OMAGConfigurationErrorException there is a problem using the supplied configuration. + */ + @PostMapping(path = "/servers/{serverName}/instance/configuration") + + @Operation(summary="activateWithSuppliedConfig", + description="Activate the named OMAG server using the supplied configuration document. This configuration " + + "document is added to the configuration store, over-writing any previous configuration for this server.", + externalDocs=@ExternalDocumentation(description="Configuration Documents", + url="https://egeria-project.org/concepts/configuration-document")) + + public SuccessMessageResponse activateWithSuppliedConfig(@PathVariable String userId, + @PathVariable String serverName, + @RequestBody OMAGServerConfig configuration) + { + return operationalServices.activateWithSuppliedConfig(userId, serverName, configuration); + } + + + /** + * Temporarily shutdown the named OMAG server. This server can be restarted as a later time. + * + * @param userId user that is issuing the request + * @param serverName local server name + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + @DeleteMapping(path = "/servers/{serverName}/instance") + + @Operation(summary="shutdownServer", + description="Temporarily shutdown the named OMAG server. This server can be restarted as a later time.") + + public VoidResponse shutdownServer(@PathVariable String userId, + @PathVariable String serverName) + { + return operationalServices.shutdownServer(userId, serverName); + } + + + /** + * Temporarily shutdown all running servers. + * + * @param userId user that is issuing the request + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + @DeleteMapping(path = "/servers/instance") + + @Operation(summary="shutdownAllServers", + description="Shutdown all active servers. They can be restarted as a later time.") + + public VoidResponse shutdownAllServers(@PathVariable String userId) + { + return operationalServices.shutdownAllServers(userId); + } + + + /** + * Permanently deactivate any active servers and unregister from + * any cohorts. + * + * @param userId user that is issuing the request + * @param serverName local server name + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + @DeleteMapping(path = "/servers/{serverName}") + + @Operation(summary="shutdownAndUnregisterServer", + description="Shutdown the named OMAG server. The server will also be removed " + + "from any open metadata repository cohorts it has registered with.") + + public VoidResponse shutdownAndUnregisterServer(@PathVariable String userId, + @PathVariable String serverName) + { + return operationalServices.shutdownAndUnregisterServer(userId, serverName); + } + + + /** + * Shutdown any active servers and unregister them from + * any cohorts. + * + * @param userId user that is issuing the request + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + @DeleteMapping(path = "/servers") + + @Operation(summary="shutdownAndUnregisterAllServers", + description="Shutdown all OMAG Servers that are active on the platform. The servers will also be removed " + + "from any open metadata repository cohorts they are registered with.") + + public VoidResponse shutdownAndUnregisterAllServers(@PathVariable String userId) + { + return operationalServices.shutdownAndUnregisterAllServers(userId); + } + + + /** + * Shutdown any active servers and unregister them from + * any cohorts. + * + * @param userId user that is issuing the request + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the serverName is invalid. + */ + @DeleteMapping(path = "/instance") + + @Operation(summary="shutdownPlatform", + description="Shutdown this OMAG Server Platform.") + + public VoidResponse shutdownPlatform(@PathVariable String userId) + { + return operationalServices.shutdownPlatform(userId); + } + + + /* + * ============================================================= + * Operational status and control + */ + + /** + * Return the configuration used for the current active instance of the server. Null is returned if + * the server instance is not running. + * + * @param userId user that is issuing the request + * @param serverName local server name + * @return configuration properties used to initialize the server or null if not running or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the server name is invalid or + * OMAGConfigurationErrorException there is a problem using the supplied configuration. + */ + @GetMapping(path = "/instance/configuration") + + @Operation(summary="getActiveConfiguration", + description="Retrieve the configuration document used to start a running instance of a server. The stored configuration " + + "document may have changed since the server was started. This operation makes it possible to verify the " + + "configuration values actually being used in the running server. \n" + + "\n" + + "An InvalidParameterException is returned if the server is not running.", + externalDocs=@ExternalDocumentation(description="Configuration Documents", + url="https://egeria-project.org/concepts/configuration-document")) + + public OMAGServerConfigResponse getActiveConfiguration(@PathVariable String userId, + @PathVariable String serverName) + { + return operationalServices.getActiveConfiguration(userId, serverName); + } + + + + /** + * Return the status for the current active instance of the server. Null is returned if + * the server instance is not running. + * + * @param userId user that is issuing the request + * @param serverName local server name + * @return status of the server or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException the server name is invalid or not running or + * OMAGConfigurationErrorException there is a problem using the supplied configuration. + */ + @GetMapping(path = "/instance/status") + + @Operation(summary="getActiveServerStatus", + description="Retrieve the status for a running instance of a server. The stored configuration " + + "document may have changed since the server was started. This operation makes it possible to verify that " + + "all the services. \n" + + "\n" + + "An InvalidParameterException is returned if the server is not running.", + externalDocs=@ExternalDocumentation(description="OMAG Server", + url="https://egeria-project.org/concepts/omag-server")) + + public OMAGServerStatusResponse getActiveServerStatus(@PathVariable String userId, + @PathVariable String serverName) + { + return operationalServices.getActiveServerStatus(userId, serverName); + } + + + /** + * Add a new open metadata archive to running repository. + * + * @param userId user that is issuing the request. + * @param serverName local server name. + * @param fileName name of the open metadata archive file. + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException invalid serverName or fileName parameter. + */ + @PostMapping(path = "/instance/open-metadata-archives/file") + + @Operation(summary="addOpenMetadataArchiveFile", + description="An open metadata archive contains metadata types and instances. This operation loads an open metadata " + + "archive that is readable through the connector identified by the connection. " + + "It can be used with OMAG servers that are of type Cohort Member.", + externalDocs=@ExternalDocumentation(description="Open Metadata Archives", + url="https://egeria-project.org/concepts/open-metadata-archives/")) + + public VoidResponse addOpenMetadataArchiveFile(@PathVariable String userId, + @PathVariable String serverName, + @RequestBody String fileName) + { + return operationalServices.addOpenMetadataArchiveFile(userId, serverName, fileName); + } + + + /** + * Add a new open metadata archive to running repository. + * + * @param userId user that is issuing the request. + * @param serverName local server name. + * @param connection connection for the open metadata archive. + * @return void response or + * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or + * OMAGInvalidParameterException invalid serverName or connection parameter. + */ + @PostMapping(path = "/instance/open-metadata-archives/connection") + + @Operation(summary="addOpenMetadataArchive", + description="An open metadata archive contains metadata types and instances. This operation loads an open metadata " + + "archive that is readable through the connector identified by the connection. " + + "It can be used with OMAG servers that are of type Cohort Member.", + externalDocs=@ExternalDocumentation(description="Open Metadata Archives", + url="https://egeria-project.org/concepts/open-metadata-archives/")) + + public VoidResponse addOpenMetadataArchive(@PathVariable String userId, + @PathVariable String serverName, + @RequestBody Connection connection) + { + return operationalServices.addOpenMetadataArchive(userId, serverName, connection); + } +} diff --git a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java index 37da0f23901..8b2b773737e 100644 --- a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformActiveResource.java @@ -11,7 +11,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import org.odpi.openmetadata.commonservices.ffdc.rest.BooleanResponse; -import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeListResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.ConnectorTypeResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.RegisteredOMAGServicesResponse; import org.odpi.openmetadata.platformservices.rest.ServerListResponse; @@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** @@ -30,8 +28,9 @@ */ @Tag(name="Platform Services", description="The platform services provides the APIs for querying the Open Metadata and Governance (OMAG) " + - "Server Platform and discovering information about the OMAG Servers that it is hosting.", - externalDocs=@ExternalDocumentation(description="Platform Services",url="https://egeria-project.org/services/platform-services/overview")) + "Server Platform. It is able to start an stop OMAG Servers and discovering information " + + "about the OMAG Servers that it is hosting.", + externalDocs=@ExternalDocumentation(description="Platform Services",url="https://egeria-project.org/services/platform-services/overview")) @RestController @RequestMapping("/open-metadata/platform-services/users/{userId}/server-platform") @@ -49,7 +48,7 @@ public class OMAGServerPlatformActiveResource * @return list of service descriptions */ @GetMapping(path = "/registered-services/access-services") - @Operation( summary = "Get registered access services", + @Operation( summary = "getRegisteredAccessServices", description="Retrieve a list of access services registered on this platform", responses = { @ApiResponse(responseCode = "200", description="list of service descriptions", @@ -75,7 +74,7 @@ public RegisteredOMAGServicesResponse getRegisteredAccessServices(@Parameter(des * @return list of service descriptions */ @GetMapping(path = "/registered-services/engine-services") - @Operation( summary = "Get registered engine services", + @Operation( summary = "getRegisteredEngineServices", description="Retrieve a list of engine services implemented in this platform", responses = { @ApiResponse(responseCode = "200", description="list of service descriptions", @@ -102,7 +101,7 @@ public RegisteredOMAGServicesResponse getRegisteredEngineServices(@Parameter(des * @return list of service descriptions */ @GetMapping(path = "/registered-services/integration-services") - @Operation( summary = "Get registered integration services", + @Operation( summary = "getRegisteredIntegrationServices", description="Retrieve a list of integration services implemented in this platform", responses = { @ApiResponse(responseCode = "200", description="list of service descriptions", @@ -129,7 +128,7 @@ public RegisteredOMAGServicesResponse getRegisteredIntegrationServices(@Paramete */ @GetMapping(path = "/registered-services/view-services") - @Operation( summary = "Get registered view services", + @Operation( summary = "getRegisteredViewServices", description="Retrieve a list of view services registered on this platform", responses = { @ApiResponse(responseCode = "200", description="list of service descriptions", @@ -154,7 +153,7 @@ public RegisteredOMAGServicesResponse getRegisteredViewServices(@Parameter(descr * @return list of service descriptions */ @GetMapping(path = "/registered-services/governance-services") - @Operation( summary = "Get registered governance services", + @Operation( summary = "getRegisteredGovernanceServices", description="Retrieve a list of governance services registered on this platform", responses = { @ApiResponse(responseCode = "200", description="list of service descriptions", @@ -179,7 +178,7 @@ public RegisteredOMAGServicesResponse getRegisteredGovernanceServices(@Parameter * @return list of service descriptions */ @GetMapping(path = "/registered-services/common-services") - @Operation( summary = "Get registered common services", + @Operation( summary = "getRegisteredCommonServices", description="Retrieve a list of common services registered on this platform", responses = { @ApiResponse(responseCode = "200",description="list of service descriptions", @@ -203,7 +202,7 @@ public RegisteredOMAGServicesResponse getRegisteredCommonServices(@Parameter(des * @return list of service descriptions */ @GetMapping(path = "/registered-services") - @Operation( summary = "Get all registered services", + @Operation( summary = "getAllRegisteredServices", description="Retrieve a list of all services registered on this platform", responses = { @ApiResponse(responseCode = "200",description="list of service descriptions", @@ -230,7 +229,7 @@ public RegisteredOMAGServicesResponse getAllRegisteredServices(@Parameter(descri * @return ConnectorType bean or exceptions that occur when trying to create the connector */ @GetMapping(path = "/connector-types/{connectorProviderClassName}") - @Operation( summary = "Return the connector type for the requested connector provider", + @Operation( summary = "getConnectorType", description="Return the connector type for the requested connector provider after validating that the" + " connector provider is available on the OMAGServerPlatform's class path. This method is for tools that are configuring" + " connectors into an Egeria server. It does not validate that the connector will load and initialize.", @@ -258,7 +257,7 @@ public ConnectorTypeResponse getConnectorType(@Parameter(description="calling us * @return flag */ @GetMapping(path = "/servers/{serverName}/is-known") - @Operation( summary = "Is server known", + @Operation( summary = "isServerKnown", description="Return a boolean indication if this server has ever run on this platform", responses = { @ApiResponse(responseCode = "200",description="boolean flag", @@ -283,7 +282,7 @@ public BooleanResponse isServerKnown(@Parameter(description="calling user") @Pat * @return list of OMAG server names */ @GetMapping(path = "/servers") - @Operation( summary = "Get list of known servers", + @Operation( summary = "getKnownServerList", description="Return the list of servers that have run or are running on this platform", responses = { @ApiResponse(responseCode = "200",description="list of servers", @@ -307,7 +306,7 @@ public ServerListResponse getKnownServerList(@Parameter(description="calling use * @return list of server names */ @GetMapping(path = "/servers/active") - @Operation( summary = "Get list of active servers", + @Operation( summary = "getActiveServerList", description="Return the list of servers that are active on this platform", responses = { @ApiResponse(responseCode = "200",description="list of servers", @@ -333,7 +332,7 @@ public ServerListResponse getActiveServerList(@Parameter(description="calling us */ @GetMapping(path = "/servers/{serverName}/status") - @Operation( summary = "Get server status", + @Operation( summary = "getServerStatus", description="Return information about when the server has been active", responses = { @ApiResponse(responseCode = "200",description="details of server status", @@ -358,7 +357,7 @@ public ServerStatusResponse getServerStatus(@Parameter(description="calling user * @return server name and list od services running within */ @GetMapping(path = "/servers/{serverName}/services") - @Operation( summary = "Get active services for server", + @Operation( summary = "getActiveServiceListForServer", description="Return the list of services that are active on the server on this platform", responses = { @ApiResponse(responseCode = "200",description="details of server status", diff --git a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/ServerPlatformOriginResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformOriginResource.java similarity index 55% rename from open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/ServerPlatformOriginResource.java rename to open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformOriginResource.java index 116d0dcc0dd..759b00be726 100644 --- a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/ServerPlatformOriginResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformOriginResource.java @@ -6,10 +6,8 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; -import org.odpi.openmetadata.commonservices.ffdc.rest.RegisteredOMAGServicesResponse; import org.odpi.openmetadata.platformservices.server.OMAGServerPlatformOriginServices; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -18,50 +16,37 @@ /** - * ServerPlatformOriginResource provides the Spring wrapper for the origin service that helps the client + * OMAGServerPlatformOriginResource provides the Spring wrapper for the origin service that helps the client * discover the type of the server platform. */ @RestController -@RequestMapping("/open-metadata/platform-services/users/{userId}") +@RequestMapping("/open-metadata/platform-services/users/{userId}/server-platform") -@Tag(name="Platform Services", - description="The platform services provides the APIs for querying the Open Metadata and Governance (OMAG) Server Platform and discovering information about the OMAG Servers that it is hosting.", - externalDocs=@ExternalDocumentation(description="Platform Services",url="https://egeria-project.org/services/platform-services/overview")) +@Tag(name="Platform Services", description="The platform services provides the APIs for querying the Open Metadata and Governance (OMAG) " + + "Server Platform. It is able to start an stop OMAG Servers and discovering information " + + "about the OMAG Servers that it is hosting.", + externalDocs=@ExternalDocumentation(description="Platform Services",url="https://egeria-project.org/services/platform-services/overview")) -public class ServerPlatformOriginResource +public class OMAGServerPlatformOriginResource { OMAGServerPlatformOriginServices originAPI = new OMAGServerPlatformOriginServices(); - /** - * Return the origin of this server implementation. - * - * @param userId name of the user making the request - * @return String description - */ - @Deprecated - @GetMapping(path = "/server-platform-origin") - public String getOldServerOrigin(@PathVariable String userId) - { - return originAPI.getServerPlatformOrigin(userId); - } - - /** * Return the origin of this server platform implementation. * * @param userId name of the user making the request * @return String description */ - @GetMapping(path = "/server-platform/origin") + @GetMapping(path = "/origin") - @Operation( summary = "Get origin description of this OMAG Server Platform", + @Operation( summary = "getServerPlatformOrigin", description="Retrieve a string that details the provider and version of this platform", responses = { @ApiResponse(responseCode = "200",description="server platform origin description", content = @Content(mediaType ="text/plain")) }) - public String getServerOrigin(@Parameter(description="calling user") @PathVariable String userId) + public String getServerPlatformOrigin(@Parameter(description="calling user") @PathVariable String userId) { return originAPI.getServerPlatformOrigin(userId); } diff --git a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformSecurityResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformSecurityResource.java new file mode 100644 index 00000000000..89e09e893fa --- /dev/null +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerPlatformSecurityResource.java @@ -0,0 +1,98 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright Contributors to the ODPi Egeria project. */ +package org.odpi.openmetadata.platformservices.server.spring; + + +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.odpi.openmetadata.adminservices.rest.ConnectionResponse; +import org.odpi.openmetadata.adminservices.rest.PlatformSecurityRequestBody; +import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; +import org.odpi.openmetadata.platformservices.server.OMAGServerPlatformSecurityServices; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +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.RestController; + +/** + * OMAGServerPlatformSecurityResource provides the API to configure the security connector that validates + * platform requests that do not reference an OMAG server. These requests are used by the + * team that run the platform as a service. + */ +@RestController +@RequestMapping("/open-metadata/platform-services/users/{userId}/server-platform/security") + +@Tag(name="Platform Services", description="The platform services provides the APIs for querying the Open Metadata and Governance (OMAG) " + + "Server Platform. It is able to start an stop OMAG Servers and discovering information " + + "about the OMAG Servers that it is hosting.", + externalDocs=@ExternalDocumentation(description="Platform Services",url="https://egeria-project.org/services/platform-services/overview")) + +public class OMAGServerPlatformSecurityResource +{ + private final OMAGServerPlatformSecurityServices adminSecurityAPI = new OMAGServerPlatformSecurityServices(); + + + /** + * Set up a platform security connector + * + * @param userId calling user. + * @param requestBody requestBody used to create and configure the connector that performs platform security + * @return void response + */ + @PostMapping(path = "/connection") + + @Operation(summary="setPlatformSecurityConnection", + description="Set up a platform security connector to control access to the platform and admin services.", + externalDocs=@ExternalDocumentation(description="Metadata Security", + url="https://egeria-project.org/features/metadata-security/overview/")) + + public VoidResponse setPlatformSecurityConnection(@PathVariable String userId, + @RequestBody PlatformSecurityRequestBody requestBody) + { + return adminSecurityAPI.setPlatformSecurityConnection(userId, requestBody); + } + + + /** + * Return the connection object for platform security connector. Null is returned if no platform security + * has been set up. + * + * @param userId calling user + * @return connection response + */ + @GetMapping(path = "/connection") + + @Operation(summary="getPlatformSecurityConnection", + description="Return the connection object for platform security connector. Null is returned if no platform security has been set up.", + externalDocs=@ExternalDocumentation(description="Metadata Security", + url="https://egeria-project.org/features/metadata-security/overview/")) + + + public ConnectionResponse getPlatformSecurityConnection(@PathVariable String userId) + { + return adminSecurityAPI.getPlatformSecurityConnection(userId); + } + + + /** + * Clear the connection object for platform security. This means there is no platform security set up. + * + * @param userId calling user + * @return void response + */ + @DeleteMapping(path = "/connection") + + @Operation(summary="clearPlatformSecurityConnection", + description="Clear the connection object for platform security. This means there is no platform security set up. Note that this command must be issued by a user that has permission to operate the OMAG Server Platform.", + externalDocs=@ExternalDocumentation(description="Metadata Security", + url="https://egeria-project.org/features/metadata-security/overview/")) + + public VoidResponse clearPlatformSecurityConnection(@PathVariable String userId) + { + return adminSecurityAPI.clearPlatformSecurityConnection(userId); + } +} diff --git a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/OperationalServicesResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldOperationalServicesResource.java similarity index 94% rename from open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/OperationalServicesResource.java rename to open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldOperationalServicesResource.java index dfe5c13dc22..23609e15d9c 100644 --- a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/OperationalServicesResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldOperationalServicesResource.java @@ -1,34 +1,34 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.spring; +package org.odpi.openmetadata.platformservices.server.spring; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import org.odpi.openmetadata.adminservices.server.OMAGServerOperationalServices; +import org.odpi.openmetadata.platformservices.rest.OMAGServerStatusResponse; +import org.odpi.openmetadata.platformservices.rest.SuccessMessageResponse; +import org.odpi.openmetadata.platformservices.server.OMAGServerOperationalServices; import org.odpi.openmetadata.adminservices.configuration.properties.OMAGServerConfig; import org.odpi.openmetadata.adminservices.rest.OMAGServerConfigResponse; -import org.odpi.openmetadata.adminservices.rest.OMAGServerStatusResponse; -import org.odpi.openmetadata.adminservices.rest.SuccessMessageResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; import org.odpi.openmetadata.frameworks.connectors.properties.beans.Connection; import org.springframework.web.bind.annotation.*; /** - * OperationalServicesResource provides the REST API for controlling the start up, management and + * OldOperationalServicesResource provides the REST API for controlling the start up, management and * shutdown of services in the OMAG Server. */ @RestController @RequestMapping("/open-metadata/admin-services/users/{userId}/servers/{serverName}") -@Tag(name="Administration Services - Operational", +@Tag(name="Administration Services - Operational - Deprecated", description="The operational administration services support the management " + "of OMAG Server instances. This includes starting and stopping the servers as well as querying and changing their operational state.", externalDocs=@ExternalDocumentation(description="Further information", url="https://egeria-project.org/guides/operations/overview/")) - -public class OperationalServicesResource +@Deprecated +public class OldOperationalServicesResource { private final OMAGServerOperationalServices operationalServices = new OMAGServerOperationalServices(); @@ -106,7 +106,7 @@ public SuccessMessageResponse activateWithSuppliedConfig(@PathVariable String public VoidResponse deactivateTemporarily(@PathVariable String userId, @PathVariable String serverName) { - return operationalServices.deactivateTemporarily(userId, serverName); + return operationalServices.shutdownServer(userId, serverName); } @@ -129,7 +129,7 @@ public VoidResponse deactivateTemporarily(@PathVariable String userId, public VoidResponse deactivatePermanently(@PathVariable String userId, @PathVariable String serverName) { - return operationalServices.deactivatePermanently(userId, serverName); + return operationalServices.shutdownAndUnregisterServer(userId, serverName); } diff --git a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigOpenMetadataPlatformSecurityResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldPlatformSecurityResource.java similarity index 81% rename from open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigOpenMetadataPlatformSecurityResource.java rename to open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldPlatformSecurityResource.java index bbdb41b820c..8a0e76a47ab 100644 --- a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ConfigOpenMetadataPlatformSecurityResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldPlatformSecurityResource.java @@ -1,32 +1,32 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.spring; +package org.odpi.openmetadata.platformservices.server.spring; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.tags.Tag; -import org.odpi.openmetadata.adminservices.server.OMAGServerAdminSecurityServices; import org.odpi.openmetadata.adminservices.rest.ConnectionResponse; import org.odpi.openmetadata.adminservices.rest.PlatformSecurityRequestBody; import org.odpi.openmetadata.commonservices.ffdc.rest.VoidResponse; +import org.odpi.openmetadata.platformservices.server.OMAGServerPlatformSecurityServices; import org.springframework.web.bind.annotation.*; /** - * ConfigOpenMetadataPlatformSecurityResource provides the API to configure the security connector that validates + * OldPlatformSecurityResource provides the API to configure the security connector that validates * platform requests that do not reference an OMAG server. These requests are used by the * team that run the platform as a service. */ @RestController @RequestMapping("/open-metadata/admin-services/users/{userId}/platform/security") -@Tag(name="Administration Services - Platform Configuration", description="The platform configuration administration services support the " + +@Tag(name="Administration Services - Platform Configuration - Deprecated", description="The platform configuration administration services support the " + "configuration of the security and configuration store connectors for an OMAG Server Platform.", externalDocs=@ExternalDocumentation(description="Further information", url="https://egeria-project.org/guides/admin/configuring-the-omag-server-platform/")) - -public class ConfigOpenMetadataPlatformSecurityResource +@Deprecated +public class OldPlatformSecurityResource { - private final OMAGServerAdminSecurityServices adminSecurityAPI = new OMAGServerAdminSecurityServices(); + private final OMAGServerPlatformSecurityServices adminSecurityAPI = new OMAGServerPlatformSecurityServices(); /** diff --git a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ServerOriginResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldServerOriginResource.java similarity index 58% rename from open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ServerOriginResource.java rename to open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldServerOriginResource.java index 9f541b54c21..b86a6d0858f 100644 --- a/open-metadata-implementation/admin-services/admin-services-spring/src/main/java/org/odpi/openmetadata/adminservices/spring/ServerOriginResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OldServerOriginResource.java @@ -1,10 +1,10 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.adminservices.spring; +package org.odpi.openmetadata.platformservices.server.spring; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.tags.Tag; -import org.odpi.openmetadata.adminservices.server.OMAGServerOriginServices; +import org.odpi.openmetadata.platformservices.server.OMAGServerPlatformOriginServices; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -12,21 +12,21 @@ /** - * ServerOriginResource provides the Spring wrapper for the origin service that helps the client + * OldServerOriginResource provides the Spring wrapper for the origin service that helps the client * discover the type of the server. */ @RestController @RequestMapping("/open-metadata/admin-services/users/{userId}") -@Tag(name="Administration Services - Operational", - description="The operational administration services support the management " + - "of OMAG Server instances. This includes starting and stopping the servers as well as querying and changing their operational state.", - externalDocs=@ExternalDocumentation(description="Further information", - url="https://egeria-project.org/guides/operations/overview/")) - -public class ServerOriginResource +@Tag(name="Administration Services - Operational - Deprecated", + description="The operational administration services support the management " + + "of OMAG Server instances. This includes starting and stopping the servers as well as querying and changing their operational state.", + externalDocs=@ExternalDocumentation(description="Further information", + url="https://egeria-project.org/guides/operations/overview/")) +@Deprecated +public class OldServerOriginResource { - private final OMAGServerOriginServices originAPI = new OMAGServerOriginServices(); + OMAGServerPlatformOriginServices originAPI = new OMAGServerPlatformOriginServices(); /** * Return the origin of this server implementation. @@ -41,7 +41,7 @@ public class ServerOriginResource public String getServerOrigin(@PathVariable String userId, @PathVariable String serverName) { - return originAPI.getServerOrigin(userId); + return originAPI.getServerPlatformOrigin(userId); } /** @@ -54,6 +54,6 @@ public String getServerOrigin(@PathVariable String userId, @Deprecated public String getServerOrigin(@PathVariable String userId) { - return originAPI.getServerOrigin(userId); + return originAPI.getServerPlatformOrigin(userId); } } diff --git a/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile b/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile index 09caea139e4..80d940c56a2 100644 --- a/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile +++ b/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile @@ -49,15 +49,15 @@ COPY build/assembly /deployments # Expose port 8080 (default) for client access, and allow for 5005 being used for remote java debug EXPOSE 9443 5005 -# By default, we run the server chassis -ENV JAVA_APP_JAR=server/server-chassis-spring-${version}.jar +# By default, we run the OMAG Server Platform +ENV JAVA_APP_JAR=platform/omag-server-platform-${version}.jar # This is used with regular class loader, ie any client code etc # ENV JAVA_LIBDIR=/deployments/lib -# This is used when running a spring app such as the server chassis (default) +# This is used when running a spring app such as the OMAG Server PLatform (default) # Extend this accordingly via the environment, or within a new Dockerfile as needed -ENV LOADER_PATH=/deployments/server/lib +ENV LOADER_PATH=/deployments/platform/lib # Joloka will be removed shortly. For now disable to avoid errors ENV AB_JOLOKIA_OFF=true diff --git a/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile.selfbuild b/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile.selfbuild index 4d5ff3bf914..7c2d3e29052 100644 --- a/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile.selfbuild +++ b/open-metadata-resources/open-metadata-deployment/docker/egeria/Dockerfile.selfbuild @@ -96,15 +96,15 @@ COPY --from=build /root/egeria/open-metadata-distribution/open-metadata-assembli # Expose port 8080 (default) for client access, and allow for 5005 being used for remote java debug EXPOSE 9443 5005 -# By default, we run the server chassis -ENV JAVA_APP_JAR=server/server-chassis-spring-${version}.jar +# By default, we run the OMAG Server Platform +ENV JAVA_APP_JAR=platform/omag-server-platform-${version}.jar # This is used with regular class loader, ie any client code etc # ENV JAVA_LIBDIR=/deployments/lib -# This is used when running a spring app such as the server chassis (default) +# This is used when running a spring app such as the OMAG Server Platform (default) # Extend this accordingly via the environment, or within a new Dockerfile as needed -ENV LOADER_PATH=/deployments/server/lib +ENV LOADER_PATH=/deployments/platform/lib # Joloka will be removed shortly. For now disable to avoid errors ENV AB_JOLOKIA_OFF=true diff --git a/open-metadata-resources/open-metadata-deployment/docker/egeria/README.md b/open-metadata-resources/open-metadata-deployment/docker/egeria/README.md index ee0b643c688..74de0462a1e 100644 --- a/open-metadata-resources/open-metadata-deployment/docker/egeria/README.md +++ b/open-metadata-resources/open-metadata-deployment/docker/egeria/README.md @@ -19,7 +19,7 @@ value from data whilst ensuring it is properly governed. ## About the egeria image -This *nix based image contains all the required runtime artifacts for egeria - for example the main server chassis, the user interface, required dependencies etc. +This *nix based image contains all the required runtime artifacts for egeria - for example the main OMAG Server Platform, the Egeria UI Application, required dependencies etc. Specifically it contains the full [egeria assembly](https://github.com/odpi/egeria/blob/main/open-metadata-distribution/open-metadata-assemblies/src/main/assemblies/egeria-omag.xml) @@ -167,7 +167,7 @@ With that in place we can now run our docker image, this time making use of the $ docker run -p 9443:9443 -v source=egeria-data,target=/deployments/data odpi/egeria:latest /usr/local/s2i/run: line 15: /opt/jboss/container/maven/default//scl-enable-maven: No such file or directory Starting the Java application using /opt/jboss/container/java/run/run-java.sh ... -INFO exec java -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError -XX:MaxMetaspaceSize=1g -cp "." -jar /deployments/server/server-chassis-spring-4.2-SNAPSHOT.jar +INFO exec java -XX:+UseParallelOldGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:MaxMetaspaceSize=100m -XX:+ExitOnOutOfMemoryError -XX:MaxMetaspaceSize=1g -cp "." -jar /deployments/platform/omag-server-platform-4.2-SNAPSHOT.jar ODPi Egeria ____ __ ___ ___ ______ _____ ____ _ _ ___ / __ \ / |/ // | / ____/ / ___/ ___ ____ _ __ ___ ____ / _ \ / / __ / / / _ /__ ____ _ _ @@ -194,13 +194,13 @@ Additional parameters can be specified at runtime by setting in the environment | -- |-------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------| | JAVA_OPTS | | Passes only these options to the java command used to launch egeria | | JAVA_OPTS_APPEND | -XX:MaxMetaspaceSize=1g | Similar to JAVA_OPTS but appends to any options already set in image | -| JAVA_APP_JAR | server/server-chassis-spring-${version}.jar | Launches a different jar file -- use with caution as this must exist in the egeria assembly | -| LOADER_PATH | /deployments/server/lib | Specifies a comma seperated list of directories to load additional libraries from ie adding to CLASSPATH used by spring classloader | +| JAVA_APP_JAR | platform/omag-server-platform-${version}.jar | Launches a different jar file -- use with caution as this must exist in the egeria assembly | +| LOADER_PATH | /deployments/platform/lib | Specifies a comma seperated list of directories to load additional libraries from ie adding to CLASSPATH used by spring classloader | ### Extending the image to include additional libraries, such as connectors -By default the docker image is setup to install the egeria server chassis jar into `/deployments/server`/ -The `/deployments/server/lib` directly is also set up in the classpath via Spring's loader.path property - set via LOADER_PATH in Docker +By default, the docker image is setup to install the OMAG Server Platform jar into `/deployments/platform`/ +The `/deployments/platform/lib` directly is also set up in the classpath via Spring's loader.path property - set via LOADER_PATH in Docker Egeria's capability can be extended through connectors. These will take the form of a java jar which needs to be dynamically loaded at runtime. As such follow one of the following methods @@ -208,9 +208,9 @@ to deploy any additional connectors #### Adding to the image using a volume -In docker, or kubernetes mount an additional volume in the image - for example at `/deployments/server/extlib` -Then ensure the variable 'LOADER.PATH' is set to include this directory in addition to '/deployments/server/lib' which is -required for the egeria server chassis to work +In docker, or kubernetes mount an additional volume in the image - for example at `/deployments/platform/extlib` +Then ensure the variable 'LOADER.PATH' is set to include this directory in addition to '/deployments/platform/lib' which is +required for the OMAG Server Platform to work. This example will: * Create a new docker volume to store the library @@ -218,7 +218,7 @@ This example will: * Copy a local library into the volume * Ensure the permissions are correct for the egeria image * Shut down the utility container - * Launch the egeria container with the classpath used by the server chassis spring app set to include the new volume - where our custom connector is located + * Launch the egeria container with the classpath used by the OMAG Server Platform to include the new volume - where our custom connector is located ```shell extralibs $ docker run -d --rm --name copyutil -v extralibs:/mnt alpine tail -f /dev/null [14:49:29] @@ -227,7 +227,7 @@ $ docker cp ~/src/egeria-database-connectors/postgres-connector/build/libs/postg $ docker exec copyutil chown -R 185 /mnt [14:50:25] $ docker stop copyutil [14:50:44] copyutil -$ docker run --env LOADER_PATH=/deployments/extralibs:/deployments/server/lib -v extralibs:/deployments/extralibs -p 9443:9443 egeria:latest +$ docker run --env LOADER_PATH=/deployments/extralibs:/deployments/platform/lib -v extralibs:/deployments/extralibs -p 9443:9443 egeria:latest ``` There are many ways of achieving the same result. If working locally you may wish to use a docker 'bind-mount', whilst in kubernetes @@ -239,9 +239,9 @@ Use the egeria image as a base, for example begin your custom Dockerfile with `FROM odpi/egeria:4.2-SNAPSHOT` Then add in the files you need, as well as customize the LOADER_PATH variable ie -`COPY myextralib.jar /deployments/server/lib` +`COPY myextralib.jar /deployments/platform/lib` -If you use the server/lib directory you do not need to change the value of the LOADER_PATH variable as this directory +If you use the platform/lib directory you do not need to change the value of the LOADER_PATH variable as this directory is already included. --- diff --git a/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnector.java b/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnector.java index fca8520f552..b4ea6efceb8 100644 --- a/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnector.java +++ b/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnector.java @@ -47,7 +47,7 @@ public void validateUserAsOperatorForPlatform(String userId) throws UserNotAu /** - * Check that the calling user is authorized to issue operator requests to the OMAG Server Platform. + * Check that the calling user is authorized to issue diagnostic requests to the OMAG Server Platform. * * @param userId calling user * diff --git a/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnectorTokenBased.java b/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnectorTokenBased.java index 4172b7fa9c0..5c333899a1f 100644 --- a/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnectorTokenBased.java +++ b/open-metadata-resources/open-metadata-samples/open-metadata-security-samples/src/main/java/org/odpi/openmetadata/metadatasecurity/samples/CocoPharmaPlatformSecurityConnectorTokenBased.java @@ -26,8 +26,10 @@ * "exp": {Epoch timestamp} * } */ -public class CocoPharmaPlatformSecurityConnectorTokenBased extends OpenMetadataPlatformSecurityConnector { - private enum PlatformRoles { +public class CocoPharmaPlatformSecurityConnectorTokenBased extends OpenMetadataPlatformSecurityConnector +{ + private enum PlatformRoles + { PLATFORM_ADMINISTRATOR, PLATFORM_OPERATOR, PLATFORM_INVESTIGATOR; @@ -50,10 +52,12 @@ private String getName() { * @throws UserNotAuthorizedException the user is not authorized to access this platform */ @Override - public void validateUserForNewServer(String userId) throws UserNotAuthorizedException { + public void validateUserForNewServer(String userId) throws UserNotAuthorizedException + { final String methodName = "validateUserForNewServer"; - if (!isAllowedToPerformAction(userId, PlatformRoles.PLATFORM_ADMINISTRATOR)) { + if (!isAllowedToPerformAction(userId, PlatformRoles.PLATFORM_ADMINISTRATOR)) + { super.throwUnauthorizedPlatformAccess(userId, methodName); } } @@ -66,53 +70,64 @@ public void validateUserForNewServer(String userId) throws UserNotAuthorizedExce * @throws UserNotAuthorizedException the user is not authorized to issue operator commands to this platform */ @Override - public void validateUserAsOperatorForPlatform(String userId) throws UserNotAuthorizedException { + public void validateUserAsOperatorForPlatform(String userId) throws UserNotAuthorizedException + { final String methodName = "validateUserAsOperatorForPlatform"; - if (!isAllowedToPerformAction(userId, PlatformRoles.PLATFORM_OPERATOR)) { + if (!isAllowedToPerformAction(userId, PlatformRoles.PLATFORM_OPERATOR)) + { super.throwUnauthorizedPlatformAccess(userId, methodName); } } /** - * Check that the calling user is authorized to issue operator requests to the OMAG Server Platform. + * Check that the calling user is authorized to issue diagnostic requests to the OMAG Server Platform. * * @param userId calling user * @throws UserNotAuthorizedException the user is not authorized to issue diagnostic commands to this platform */ @Override - public void validateUserAsInvestigatorForPlatform(String userId) throws UserNotAuthorizedException { + public void validateUserAsInvestigatorForPlatform(String userId) throws UserNotAuthorizedException + { final String methodName = "validateUserAsInvestigatorForPlatform"; - if (!isAllowedToPerformAction(userId, PlatformRoles.PLATFORM_INVESTIGATOR)) { + if (!isAllowedToPerformAction(userId, PlatformRoles.PLATFORM_INVESTIGATOR)) + { super.throwUnauthorizedPlatformAccess(userId, methodName); } } - private List getUserActionsFromToken(String userId) { + private List getUserActionsFromToken(String userId) + { Map headersMap = HttpHeadersThreadLocal.getHeadersThreadLocal().get(); - if (headersMap != null && !headersMap.isEmpty()) { + if (headersMap != null && !headersMap.isEmpty()) + { // Jws jwtClaims = Jwts.parserBuilder() // .setSigningKey(Keys.hmacShaKeyFor(secret)) // .build().parseClaimsJws(headersMap.get("authorization")); // // String username = jwtClaims.getBody().getSubject(); // List actions = jwtClaims.getBody().get("actions", List.class); -// if (username.equals(userId) && actions != null && !actions.isEmpty()) { +// if (username.equals(userId) && actions != null && !actions.isEmpty()) +// { // log.info("User {} validated for issuing requests.", username); // return actions; // } } + return null; } - private Boolean isAllowedToPerformAction(String userId, PlatformRoles role) { + private Boolean isAllowedToPerformAction(String userId, PlatformRoles role) + { List userActions = getUserActionsFromToken(userId); - if (userActions != null && !userActions.isEmpty() && userActions.contains(role.getName())) { + if (userActions != null && !userActions.isEmpty() && userActions.contains(role.getName())) + { return true; } + return false; } } diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy index 5b86a51d661..9ac011063fb 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/src/test/script/configureStartServer.groovy @@ -8,7 +8,7 @@ import java.security.cert.CertificateException // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy index d4ac820053f..36a62e6687e 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy index 1deb6355a6d..555f195f4fe 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-owner-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy index 9cf9cd9ae93..95b9763da6a 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/community-profile-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/script/configureStartServer.groovy index 1709a4e125d..0194ae75805 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/src/test/script/configureStartServer.groovy @@ -7,7 +7,7 @@ import javax.net.ssl.SSLContext // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.TrustManager import javax.net.ssl.X509TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy index 1d534fb4802..64e81aaf6ae 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/data-manager-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy index ff5eb19ac95..14941903b0f 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/digital-architecture-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy index 4f2cea0d849..8f98c1ee689 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/discovery-engine-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy index 162d1fa7714..6d27c66e665 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-engine-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy index 34493f67945..b60de1fda87 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/governance-program-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy index 20116f4c2fd..93ef03c9711 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/stewardship-action-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy index eeae63d64ba..9a1bd15da57 100755 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/subject-area-fvt/src/test/script/configureStartServer.groovy @@ -6,7 +6,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy index 48240765c4d..498e6516102 100755 --- a/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy +++ b/open-metadata-test/open-metadata-fvt/view-services-fvt/glossary-author-fvt/src/test/script/configureStartServer.groovy @@ -10,7 +10,7 @@ import javax.net.ssl.HttpsURLConnection // Function to convert array to String -// Will configure a server chassis - which should already be running - for FVT testing +// Will configure an OMAG Server Platform - which should already be running - for FVT testing import javax.net.ssl.SSLContext import javax.net.ssl.TrustManager diff --git a/settings.gradle b/settings.gradle index 78d6e66cfd5..2982bc4d7a9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -316,7 +316,7 @@ include(':open-metadata-implementation:integration-services:topic-integrator:top include(':open-metadata-implementation:integration-services:topic-integrator:topic-integrator-client') include(':open-metadata-implementation:integration-services:topic-integrator:topic-integrator-server') include(':open-metadata-implementation:integration-services:topic-integrator:topic-integrator-spring') -include(':open-metadata-implementation:server-chassis:server-chassis-spring') +include(':open-metadata-implementation:platform-chassis:platform-chassis-spring') include(':open-metadata-implementation:user-interfaces:ui-chassis:ui-chassis-spring') include(':open-metadata-conformance-suite:open-metadata-conformance-suite-api') include(':open-metadata-conformance-suite:open-metadata-conformance-suite-client') From bbafde138a720626c5afffccfe0e825c80a1873f Mon Sep 17 00:00:00 2001 From: Mandy Chessell Date: Mon, 12 Jun 2023 15:18:37 +0100 Subject: [PATCH 2/3] Add server back into URL Signed-off-by: Mandy Chessell --- .../server/spring/OMAGServerOperationResource.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java index 7d17e9533cc..e647eab402f 100644 --- a/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java +++ b/open-metadata-implementation/platform-services/platform-services-spring/src/main/java/org/odpi/openmetadata/platformservices/server/spring/OMAGServerOperationResource.java @@ -214,7 +214,7 @@ public VoidResponse shutdownPlatform(@PathVariable String userId) * OMAGInvalidParameterException the server name is invalid or * OMAGConfigurationErrorException there is a problem using the supplied configuration. */ - @GetMapping(path = "/instance/configuration") + @GetMapping(path = "/servers/{serverName}/instance/configuration") @Operation(summary="getActiveConfiguration", description="Retrieve the configuration document used to start a running instance of a server. The stored configuration " + @@ -244,7 +244,7 @@ public OMAGServerConfigResponse getActiveConfiguration(@PathVariable String * OMAGInvalidParameterException the server name is invalid or not running or * OMAGConfigurationErrorException there is a problem using the supplied configuration. */ - @GetMapping(path = "/instance/status") + @GetMapping(path = "/servers/{serverName}/instance/status") @Operation(summary="getActiveServerStatus", description="Retrieve the status for a running instance of a server. The stored configuration " + @@ -272,7 +272,7 @@ public OMAGServerStatusResponse getActiveServerStatus(@PathVariable String userI * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or * OMAGInvalidParameterException invalid serverName or fileName parameter. */ - @PostMapping(path = "/instance/open-metadata-archives/file") + @PostMapping(path = "/servers/{serverName}/instance/open-metadata-archives/file") @Operation(summary="addOpenMetadataArchiveFile", description="An open metadata archive contains metadata types and instances. This operation loads an open metadata " + @@ -299,7 +299,7 @@ public VoidResponse addOpenMetadataArchiveFile(@PathVariable String userId, * OMAGNotAuthorizedException the supplied userId is not authorized to issue this command or * OMAGInvalidParameterException invalid serverName or connection parameter. */ - @PostMapping(path = "/instance/open-metadata-archives/connection") + @PostMapping(path = "/servers/{serverName}/instance/open-metadata-archives/connection") @Operation(summary="addOpenMetadataArchive", description="An open metadata archive contains metadata types and instances. This operation loads an open metadata " + From 1663fb5a16a4c74574906651dbcb74e2cb4b5918 Mon Sep 17 00:00:00 2001 From: Mandy Chessell Date: Mon, 12 Jun 2023 15:32:07 +0100 Subject: [PATCH 3/3] Improve null String tests Signed-off-by: Mandy Chessell --- .../serverchassis/springboot/OMAGServerPlatform.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java b/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java index 0faeb72bde6..1259f0c6c29 100644 --- a/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java +++ b/open-metadata-implementation/platform-chassis/platform-chassis-spring/src/main/java/org/odpi/openmetadata/serverchassis/springboot/OMAGServerPlatform.java @@ -247,7 +247,7 @@ public void applicationReady() { try { - if ((configStoreProvider != null) && (! "".equals(configStoreProvider))) + if ((configStoreProvider != null) && (! configStoreProvider.isEmpty())) { Connection configStoreConnection = new Connection(); ConnectorType connectorType = new ConnectorType(); @@ -262,14 +262,14 @@ public void applicationReady() configStoreServices.setConfigurationStoreConnection(sysUser, configStoreConnection); } - if ((platformSecurityProvider != null) && (! "".equals(platformSecurityProvider))) + if ((platformSecurityProvider != null) && (! platformSecurityProvider.isEmpty())) { Connection securityConnection = new Connection(); ConnectorType connectorType = new ConnectorType(); connectorType.setConnectorProviderClassName(platformSecurityProvider); String platformName = platformSecurityName; - if ((platformName == null) || ("".equals(platformName))) + if ((platformName == null) || (platformName.isEmpty())) { platformName = Long.valueOf(ProcessHandle.current().pid()).toString(); }