Skip to content

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.

  • ContentPackDefinition is an enum with an entry for each content pack. It provides the archive's GUID, name, description and file name (for example CORE_CONTENT_PACK and DUCKDB_CONTENT_PACK).
  • Further enums, such as IntegrationGroupDefinition, IntegrationConnectorDefinition, GovernanceEngineDefinition, GovernanceServiceDefinition, RequestTypeDefinition and the template definitions, describe the elements to add. Each entry names the ContentPackDefinition it belongs to.
  • ContentPackBaseArchiveWriter (in the base package) extends EgeriaBaseArchiveWriter from content-pack-helpers . It has methods such as addIntegrationGroups(), addIntegrationConnectors(), createGovernanceEngines(), createGovernanceServices() and createRequestTypes() 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, PostgresPackArchiveWriter and DuckDBPackArchiveWriter. Each passes the ContentPackDefinition values to its superclass constructor, along with the archives it depends on (typically the archive produced by CorePackArchiveWriter), and implements getArchiveContent().
  • CorePacksArchivesWriter has the main() method that runs each of the archive writers in turn, writing to the content-packs folder.

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
public class MyContentPackArchiveWriter extends EgeriaBaseArchiveWriter
{
    private static final String archiveGUID        = "...";   // fixed GUID for this archive
    private static final String archiveName        = "MyContentPack";
    private static final String archiveDescription = "Reference data and templates for my organization.";
    private static final String archiveFileName    = "MyContentPack.omarchive";
    private static final Date   creationDate       = new Date(1700000000000L);   // fixed - it becomes the createTime of each element

    public MyContentPackArchiveWriter()
    {
        super(archiveGUID, archiveName, archiveDescription, creationDate, archiveFileName);
    }

    @Override
    public void getArchiveContent()
    {
        // use archiveHelper (GovernanceArchiveHelper) to add elements, for example
        // archiveHelper.addGovernanceZone(...), archiveHelper.addConnectorType(...), archiveHelper.addGlossary(...)
    }

    public static void main(String[] args)
    {
        new MyContentPackArchiveWriter().writeOpenMetadataArchive();
    }
}

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