nationalarchives / oci-tools-scala   0.4.0

MIT License GitHub

Omega Catalog Identifier tools (Scala)

Scala versions: 2.13

Omega Catalog Identifier tools (Scala)

Build Status Build status Scala 2.13 License Maven Central

Note: There is also an alternative implementation in TypeScript available at:

This project is split into two parts:

  1. a library (BaseCoder.scala) which can be used in other projects.

  2. a command line tool (Main.scala) which is useful in itself and also serves as an example of using the BaseCoder.scala library.

Examples of Command Line tool use

Encoding to Base16 (e.g. hexadecimal):

❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 16 123456 HEX
Input: 123456
Encoded: '1E240'
Round-trip decoded: '123456'

Encoding to GCR b25 (e.g. as used by DRI for digital records):

❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 25 123456 GCRb25
Input: 123456
Encoded: 'K5RJ'
Round-trip decoded: '123456'

Encoding to OCI b25 (e.g. as used by Project Omega):

❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 25 123456 OCIb25
Input: 123456
Encoded: '8WJ7'
Round-trip decoded: '123456'

Encoding to CTD b25 (e.g. as used by Project TDR):

❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 25 123456 CTDb25
Input: 123456
Encoded: '9TH8'
Round-trip decoded: '123456'

EXPERIMENTAL: There is also support for experimental URI encoding using a Base78 and Base68 alphabet, built-in as: OCIb78 and OCIb68.

Compiling the Command Line tool

To build from source you will need the following pre-requisites:

  1. Git Command Line tools.
  2. Java 8+
  3. SBT (Simple Build Tool) 1.1.2+

If you wish to create a standalone application (also known as an Uber Jar, Assembly, etc.) you can run sbt assembly, which will generate target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar.

Running the Command Line tool

Given the standalone application, you can execute it by running either:

  1. java -jar oci-tools-scala-assembly-0.4.0.jar

  2. or, even by just executing the oci-tools-scala-assembly-0.4.0.jar file directly, as we compile an executable header into the Jar file. e.g. (on Linux/Mac): ./oci-tools-scala-assembly-0.4.0.jar.

Publishing a Release to Maven Central

  1. Run sbt clean release
  2. Answer the questions
  3. Login to then Close, and Release the Staging Repository