Writing Configuration Document Store Connectors¶
The admin-services-api module provides the interface definition for a configuration document store connector in the org.odpi.openmetadata.adminservices.store Java package. Its interface is simple - consisting of save, retrieve and remove operations, along with a method to set the name of the server and a method to retrieve every configuration document in the store:
/**
* OMAGServerConfigStore provides the interface to the configuration for an OMAG Server. This is accessed
* through a connector.
*/
public interface OMAGServerConfigStore
{
/**
* Set up the name of the server for this configuration document.
*
* @param serverName name of the server
*/
void setServerName(String serverName);
/**
* Save the server configuration.
*
* @param configuration configuration properties to save
*/
void saveServerConfig(OMAGServerConfig configuration);
/**
* Retrieve the configuration saved from a previous run of the server.
*
* @return server configuration
*/
OMAGServerConfig retrieveServerConfig();
/**
* Remove the server configuration.
*/
void removeServerConfig();
/**
* Retrieve all the stored server configurations
*
* @return the set of server configurations present in this OMAG Server Config store
*/
Set<OMAGServerConfig> retrieveAllServerConfigs();
}
The configuration document is represented by the OMAGServerConfig structure. The name of the server is stored in the localServerName property in OMAGServerConfig.
The same package provides two base classes:
OMAGServerConfigStoreConnectorBase- extendsConnectorBaseand implementssetServerName, saving the server name in the protectedserverNamevariable. It also provides the protectedgetStoreName(template, params...)method that usesjava.text.MessageFormatto insert values, such as the server name, into a template for the name of the store. For example, the templatedata/servers/{0}/config/{0}.configbecomesdata/servers/cocoMDS1/config/cocoMDS1.configfor a server calledcocoMDS1.OMAGServerConfigStoreProviderBase- extendsOpenConnectorProviderBaseand is the base class for the connector provider.
Sample implementation¶
The implementation of this connector provided by Egeria is found in the configuration-store-connectors module:
- configuration-file-store-connector supports managing the open metadata configuration as a clear text JSON file. Its connector provider is
FileBasedServerConfigStoreProviderand its connector isFileBasedServerConfigStoreConnector. The file name template is taken from the network address of the endpoint in its connection. If no endpoint is supplied, the template./data/servers/{0}/config/{0}.configis used. Its implementation ofretrieveAllServerConfigsscans the file system for files that match the template.
Configuring the connector¶
The configuration document store connector is a platform connector. It is typically configured in the OMAG Server Platform's application.properties file using the platform.configstore.provider property (the class name of the connector provider) and the platform.configstore.endpoint property (the template for the name of the store). It can also be set dynamically with a POST request to /open-metadata/admin-services/stores/connection, passing the connection for the connector in the request body.
Further information
- Open Connector Framework (OCF) defines open connectors and connections since many of the sections in the configuration document take connection objects for connectors.
- Configuring the configuration document store connector for the properties that install a particular configuration document store connector into the OMAG Server Platform.
Raise an issue or comment below