Skip to content
Stable

This component is complete and can be used. The interfaces will be supported until the function is removed from the project via the deprecation process. There will be ongoing extensions to this function, but it will be done to ensure backward compatibility as far as possible. If there is a need to break backward compatibility, this will be discussed and reviewed in the community, with a documented timeline.

Summary
Description Value
Link to Implementation open-metadata-implementation/platform-services
Audit Log Component Id 185
Audit Log Message Prefix OMAG-PLATFORM
Service URL Marker platform-services
Javadoc Platform Service Clients
Debug logger logging.level.org.odpi.openmetadata.platformservices

Platform Services

The platform services provide the methods for:

  • Querying the origin and capabilities of the OMAG Server Platform.
  • Starting and stopping OMAG Servers on the platform and shutting down the platform itself.
  • Discovering information about the OMAG Servers that the platform is hosting.
  • Dynamically setting up the platform metadata security connector, and maintaining the user accounts and security access controls it uses.
  • Adding open metadata archives to a running server.
  • Shutting down the OMAG Server Platform.

These methods are available through a Java client, or directly by calling the REST API.

Platform services overview

Platform services client

The Platform Services client is called PlatformServicesClient. It is located in the platform-services-client module and uses definitions from the platform-services-api, server-operations-api and admin-services-api modules.

Each Java client has two constructors. The constructors set up the connection to the OMAG Server Platform and control how the client authenticates. The parameters are:

  • platformName or serverName - the descriptive name of the OMAG Server Platform (for platform-level clients such as PlatformServicesClient) or the name of the OMAG Server the client works with. Some platform-level clients, such as OMAGServerPlatformConfigurationClient, take neither.
  • platformRootURL - the platform url root of the OMAG Server Platform.
  • secretStoreProvider, secretStoreLocation and secretStoreCollection - the class name of the connector provider for a secrets store connector, the location of the secrets store and the name of the collection of secrets within it. The client uses these secrets to obtain a bearer token from the platform. The alternative constructor takes a map of already initialized secrets store connectors (secretsStoreConnectorMap) in place of these three parameters.
  • delegatingUserId - the optional user identifier of the external user that the client is making the request on behalf of.
  • auditLog - logging destination for audit log messages.

The constructor may throw InvalidParameterException if there is an issue setting up the client-side components based on the supplied parameters.

Below is an example of the code used to construct the PlatformServicesClient.

Example: Creating a platform services client
1
2
3
4
5
6
7
PlatformServicesClient platformServicesClient = new PlatformServicesClient("MyPlatform",
                                                                           platformURLRoot,
                                                                           secretStoreProvider,
                                                                           secretStoreLocation,
                                                                           secretStoreCollection,
                                                                           delegatingUserId,
                                                                           auditLog);

Once the client is created, use it to call the API it offers which is documented using Javadoc. The caller is identified by the bearer token that the client obtains using the secrets from its secrets store, so the methods do not take a userId. Methods that are specific to an OMAG server take the server name as a parameter.

Every REST call must carry that bearer token in its Authorization header. The REST paths all begin {{platformURLRoot}}/open-metadata/platform-services/server-platform and accept an optional delegatingUserId request parameter.

Querying the origin and capabilities of the platform

The OMAG Server Platform can be built in a variety of ways, both expanding and removing the services delivered by the Egeria community. Therefore it is useful to be able to query a particular OMAG Server Platform to discover what it can do.

Platform origin

The platform origin method is used to confirm that the platform is running, and the release of Egeria it is built from.

Example: Retrieving the platform origin
1
String platformOrigin = platformServicesClient.getPlatformOrigin();

getServerPlatformOrigin

GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/origin

The call returns a string value of:

Egeria OMAG Server Platform (version {release})
It is a simple check that the platform is running. The client also offers getPlatformStartTime(), getPlatformBuildProperties() and getPublicProperties().

Registered services

It is also possible to list the registered services that are available in the platform.

Example: Retrieving the registered services
1
2
3
4
5
6
List<RegisteredOMAGService> registeredOMASs = platformServicesClient.getAccessServices();
List<RegisteredOMAGService> registeredOMESs = platformServicesClient.getEngineServices();
List<RegisteredOMAGService> registeredOMVSs = platformServicesClient.getViewServices();
List<RegisteredOMAGService> governanceServices = platformServicesClient.getGovernanceServices();
List<RegisteredOMAGService> commonServices = platformServicesClient.getCommonServices();
List<RegisteredOMAGService> allServices = platformServicesClient.getAllServices();

getRegisteredServices

GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/registered-services/access-services
GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/registered-services/engine-services
GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/registered-services/view-services
GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/registered-services/governance-services
GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/registered-services/common-services
GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/registered-services

Each entry in RegisteredOMAGService details:

  • serviceId - the component identifier used by the service when it registers with the audit log.
  • serviceName - the name of the service.
  • serviceDevelopmentStatus - the status of the service.
  • serviceURLMarker - the unique string used in this service's REST API path names.
  • serviceDescription - the description of the service.
  • serviceWiki - the page in Egeria's documentation that provides more detail of the service.

Supported connectors

It is possible to validate whether a specific connector's implementation is included in the OMAG Server Platform's classpath by using the getConnectorType method. This takes the class name of the connector's provider class. It checks that the connector provider is on the platform's class path and returns the connector type it supports. It does not validate that the connector will load and initialize.

Example: Retrieving a connector type

The example retrieves the connector type for the Open Metadata Access Security Connector, which the quickstart uses as its platform metadata security connector. Its connector provider class is org.odpi.openmetadata.metadatasecurity.accessconnector.OpenMetadataAccessSecurityProvider.

1
ConnectorType connectorType = platformServicesClient.getConnectorType("org.odpi.openmetadata.metadatasecurity.accessconnector.OpenMetadataAccessSecurityProvider");
Javadoc for ConnectorType

getConnectorType

GET {{platformURLRoot}}/open-metadata/platform-services/server-platform/connector-types/org.odpi.openmetadata.metadatasecurity.accessconnector.OpenMetadataAccessSecurityProvider

Returns

{
    "class": "ConnectorTypeResponse",
    "relatedHTTPCode": 200,
    "connectorType": {
        "class": "ConnectorType",
        "headerVersion": 0,
        "type": {
            "typeId": "954421eb-33a6-462d-a8ca-b5709a1bd0d4",
            "typeName": "ConnectorType",
            "typeVersion": 1,
            "typeDescription": "A set of properties describing a type of connector."
        },
        "guid": "c7026446-8d9e-4149-8da0-5c800cf7fc23",
        "qualifiedName": "Egeria:Sample:PlatformSecurity:CocoPharmaceuticals",
        "displayName": "Coco Pharmaceuticals Platform Security Connector",
        "description": "Connector supports a hard-coded user registry and authorization rules for Coco Pharmaceuticals.",
        "connectorProviderClassName": "org.odpi.openmetadata.metadatasecurity.accessconnector.OpenMetadataAccessSecurityProvider",
        "connectorFrameworkName": "Open Connector Framework (OCF)",
        "connectorInterfaceLanguage": "Java",
        "connectorInterfaces": [
            "org.odpi.openmetadata.frameworks.connectors.SecureConnectorExtension",
            "org.odpi.openmetadata.metadatasecurity.OpenMetadataPlatformSecurity"
        ]
    }
}

Starting OMAG Servers and stopping OMAG Servers

A server is started either from the configuration document stored by the platform's configuration document store, or from a configuration document passed on the request. The code sample shows the method calls to start and stop named OMAG Servers.

Example: starting and stopping servers
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
/*
 * Start the named server using its stored configuration document.
 * The returned string lists the services that started.
 */
System.out.println(platformServicesClient.activateWithStoredConfig(serverName));

/*
 * Stop the named server.  It remains known to the platform.
 */
platformServicesClient.shutdownServer(serverName);
Java method REST API Purpose
activateWithStoredConfig POST .../servers/{serverName}/instance Start a server using its stored configuration document.
activateWithSuppliedConfig POST .../servers/{serverName}/instance/configuration Start a server using the configuration document in the request body.
shutdownServer DELETE .../servers/{serverName}/instance Stop a server.
shutdownAllServers DELETE .../servers/instance Stop all servers running on the platform.
shutdownAndUnregisterServer DELETE .../servers/{serverName} Stop a server and remove it from any cohorts it is registered with.
shutdownAndUnregisterAllServers DELETE .../servers Stop all servers and remove them from their cohorts.

Where ... is {{platformURLRoot}}/open-metadata/platform-services/server-platform.

Adding an open metadata archive to a running server

An open metadata archive can be loaded into a running server's repository with addOpenMetadataArchiveFile(serverName, fileName) (POST .../servers/{serverName}/instance/open-metadata-archives/file, with the file name as the request body) or addOpenMetadataArchive(serverName, connection) (POST .../servers/{serverName}/instance/open-metadata-archives/connection). See adding an archive to a running server.

Querying the status of the OMAG Servers on the platform

Known servers

The known servers are those servers that have run on the platform since it started. The getKnownServers method returns a list of server names which is useful for stepping through each of the servers in a for loop (GET .../servers). Use isServerKnown(serverName) to test for a single server.

Example: Retrieving the list of known servers
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
List<String> serverList = platformServicesClient.getKnownServers();

if (serverList != null)
{
    for (String serverName : serverList)
    {
        if (serverName != null)
        {
           /*
            * Add code here
            */
       }
    }
}

Active servers

The active servers are those servers running on the platform. The getActiveServers returns a list of names of the servers running when the request was made (GET .../servers/active).

Example: Retrieving the list of active servers
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
List<String> serverList = platformServicesClient.getActiveServers();

if (serverList != null)
{
    for (String serverName : serverList)
    {
        if (serverName != null)
        {
            /*
             * Add code here
             */
        }
    }
}

Once you have the serverName, you can query the status of an OMAG Server running on the platform:

Example: Retrieving a server's status
1
ServerStatus platformServerStatus = platformServicesClient.getServerStatus(serverName);

The platformServerStatus returned includes:

  • serverName - Name of the server.
  • serverType - The type of the server.
  • isActive - Boolean flag indicating whether it is active (running) on the platform.
  • serverStartTime - The most recent date/time that the server started.
  • serverEndTime - The most recent date/time that the server stopped.
  • serverHistory - The list of start and stop times for the previous restarts of the server.

This helps to ascertain when the server was available.

Querying the active server status

It is also possible to retrieve the status of the services running within an active server (GET .../servers/{serverName}/instance/status). The getActiveConfiguration(serverName) method returns the configuration document the running server was started with, and getActiveServicesForServer(serverName) returns the names of its active services.

Example: retrieving the status of the services in an active server
1
2
3
4
5
6
7
8
ServerServicesStatus serverServicesStatus = platformServicesClient.getActiveServerStatus(serverName);

if (serverServicesStatus != null)
{
    System.out.println(serverServicesStatus.getServerActiveStatus());
    System.out.println(serverServicesStatus.getServerType());
    System.out.println(serverServicesStatus.getServices());
}

The status of the server (and its nested services) is one of 5 values from the ServerActiveStatus enum:

  • Unknown - The state of the server is unknown. This is equivalent to a null value.
  • Starting - The server is starting.
  • Running - The server has completed start up and is running.
  • Stopping - The server has received a request to shut down.
  • Inactive - The server is not running.

The server type is derived by the platform services when it starts the server. It is based on an assessment of the capabilities requested in the configuration document.

Further information

  • The administration guide describes how to use the administration services to configure OMAG Server Platforms and OMAG Servers.
  • The operations guide describes how to use the platform services to start/stop OMAG Servers on OMAG Server Platforms and retrieve diagnostics.

Dynamically configuring the platform metadata security connector

The OMAG Server Platform provides both configuration and diagnostic services for OMAG Servers which in themselves provide access to a wide variety of information and control points. Therefore, it is necessary to provide authorization services relating to the dynamic management of the platform.

Egeria provides a platform security authorization capability. It is implemented in a platform metadata security connector that is called whenever requests are made to the server platform services.

Security is configured for a specific platform once it is running by using the following command. The Java equivalents are setPlatformSecurityConnection(connection), getPlatformSecurityConnection() and clearPlatformSecurityConnection().

Configure security

POST - configure platform metadata security connector

{{platformURLRoot}}/open-metadata/platform-services/server-platform/security/connection

The request body is a PlatformSecurityRequestBody containing the connection object used to create the platform security connector.

Example: sample platform security connector

For example, this is the request body that would set up the platform security connector :

{
    "class": "PlatformSecurityRequestBody",
    "platformSecurityConnection" : 
    {
        "class": "Connection",
        "connectorType": 
        {
            "class": "ConnectorType",
            "connectorProviderClassName": "org.odpi.openmetadata.metadatasecurity.accessconnector.OpenMetadataAccessSecurityProvider"
        }
    }
}

Determine configured security

It is possible to query the setting of the platform security connector using the following command:

GET - retrieve configured platform security

{{platformURLRoot}}/open-metadata/platform-services/server-platform/security/connection
Response indicating no security
{
    "class": "ConnectionResponse",
    "relatedHTTPCode": 200
}
Response indicating a specific security connector

If the response looks more like the JSON below, a connector is configured. The connectorProviderClassName tells you which connector is being used.

{
    "class": "ConnectionResponse",
    "relatedHTTPCode": 200,
    "connection": {
        "class": "Connection",
        "connectorType": {
            "class": "ConnectorType",
            "connectorProviderClassName": "org.odpi.openmetadata.metadatasecurity.accessconnector.OpenMetadataAccessSecurityProvider"
        }
    }
}

Remove configured security

It is possible to remove the configuration for the connector using the following command:

DELETE - remove configured platform security

{{platformURLRoot}}/open-metadata/platform-services/server-platform/security/connection

This removes all authorization checking from the platform services.

User accounts and security access controls

The platform metadata security connector may maintain its own user accounts and security access controls. These are managed through the following methods (under .../security):

Java method REST API
setUserAccount(OpenMetadataUserAccount) POST .../security/user-accounts
getUserAccount(accountUserId) GET .../security/user-accounts/{accountUserId}
deleteUserAccount(accountUserId) DELETE .../security/user-accounts/{accountUserId}
getUserList(UserAccountStatus, UserAccountType) GET .../security/user-list
setSecurityAccessControl(OpenMetadataSecurityAccessControl) POST .../security/security-access-controls
getSecurityAccessControl(controlName) GET .../security/security-access-controls/{controlName}
deleteSecurityAccessControl(controlName) DELETE .../security/security-access-controls/{controlName}

Shutting down the OMAG Server Platform

The shutdownPlatform() method allows a remote client to terminate the OMAG Server Platform. When this method is called, the platform terminates immediately and a "connection closed" error response is returned to the caller.

Example: Shutting down an OMAG Server Platform
1
2
3
4
5
6
7
try
{
    platformServicesClient.shutdownPlatform();
}
catch (Exception platformGone)
{
}

shutdownPlatform

DELETE {{platformURLRoot}}/open-metadata/platform-services/server-platform/instance

Raise an issue or comment below