Creating content packs¶
A content pack is a packaging of one or more metadata elements into an open metadata archive so that they can be loaded and reused in different organizations. The archive has an archiveType of CONTENT_PACK and, by convention, a file name ending in .omarchive.
A content pack is built using a Java program called an archive writer. The structure of an archive writer is described in building open metadata archives.
Egeria's content packs¶
Egeria's own content packs are listed in the content pack catalog. They are built by the archive writers in the core-content-pack module and written to the content-packs directory at the top of egeria.git, where they are committed and included in the distribution.
ContentPackDefinitionis an enum with an entry for each content pack. It provides the archive's GUID, name, description and file name (for exampleCORE_CONTENT_PACKandDUCKDB_CONTENT_PACK).- Further enums, such as
IntegrationGroupDefinition,IntegrationConnectorDefinition,GovernanceEngineDefinition,GovernanceServiceDefinition,RequestTypeDefinitionand the template definitions, describe the elements to add. Each entry names theContentPackDefinitionit belongs to. ContentPackBaseArchiveWriter(in thebasepackage) extendsEgeriaBaseArchiveWriterfrom content-pack-helpers . It has methods such asaddIntegrationGroups(),addIntegrationConnectors(),createGovernanceEngines(),createGovernanceServices()andcreateRequestTypes()that add the entries of these enums that belong to the requested content pack.- There is one archive writer per content pack, for example
CorePackArchiveWriter,PostgresPackArchiveWriterandDuckDBPackArchiveWriter. Each passes theContentPackDefinitionvalues to its superclass constructor, along with the archives it depends on (typically the archive produced byCorePackArchiveWriter), and implementsgetArchiveContent(). CorePacksArchivesWriterhas themain()method that runs each of the archive writers in turn, writing to thecontent-packsfolder.
Running the writers requires the GUID map files (EgeriaContentPacksGUIDMap.json and UsedEgeriaContentPacksGUIDMap.json) from the top of egeria.git to be in the working directory, so that existing elements keep their GUIDs.
Writing your own content pack¶
The simplest way to write your own content pack is to extend EgeriaBaseArchiveWriter. Its constructor creates an OMRSArchiveBuilder that depends on the open metadata types (plus any additional archives you pass) and a GovernanceArchiveHelper (available as archiveHelper) for creating the elements. You implement getArchiveContent() and call writeOpenMetadataArchive() to build and write the archive.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
The creationDate must not change between builds because it becomes the createTime of every element in the archive, and repositories use it to match an incoming element with the one they already store before comparing version numbers. The version number of the elements is set by EgeriaBaseArchiveWriter, and the ArchiveVersionStabilizer keeps the previous version of elements that have not changed since the last time the archive was written. writeOpenMetadataArchive() saves the GUID map after writing the archive.
Fixed values in EgeriaBaseArchiveWriter
EgeriaBaseArchiveWriter sets the originator (Egeria Project), the license (Apache 2.0), the version name used in the elements and the GUID map file name (EgeriaContentPacksGUIDMap.json) to fixed values. If you need different values, build your writer directly on OMRSArchiveWriter, OMRSArchiveBuilder and SimpleCatalogArchiveHelper (or GovernanceArchiveHelper), whose constructors take these values as parameters.
The Coco Pharmaceuticals sample archives are further examples of archive writers built on EgeriaBaseArchiveWriter.
Loading a content pack¶
A content pack is loaded into a metadata access store either by adding it to the server's configuration so it is loaded each time the server starts (see configuring the open metadata archives to load on server startup), or by adding it to a running server. Loading the same content pack more than once does not create duplicates.
Raise an issue or comment below