Omega Catalog Identifier tools (Scala)
Note: There is also an alternative implementation in TypeScript available at: https://github.com/nationalarchives/oci-tools-ts
This project is split into two parts:
a library (
BaseCoder.scala) which can be used in other projects.
a command line tool (
Main.scala) which is useful in itself and also serves as an example of using the
Examples of Command Line tool use
Encoding to Base16 (e.g. hexadecimal):
❯ target/scala-2.13/oci-tools-scala-assembly-0.0.1.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.0.1.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.0.1.jar encode --round-trip 25 123456 OCIb25 Input: 123456 Encoded: '8WJ7' Round-trip decoded: '123456'
EXPERIMENTAL: There is also support for experimental URI encoding using a Base78 and Base68 alphabet, built-in as:
Compiling the Command Line tool
To build from source you will need the following pre-requisites:
- Git Command Line tools.
- Java 8+
- 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
Running the Command Line tool
Given the standalone application, you can execute it by running either:
java -jar oci-tools-scala-assembly-0.0.1.jar
or, even by just executing the
oci-tools-scala-assembly-0.0.1.jarfile directly, as we compile an executable header into the Jar file. e.g. (on Linux/Mac):