https://github.com/nationalarchives/oci-tools-scala
Omega Catalog Identifier tools (Scala)
https://github.com/nationalarchives/oci-tools-scala
catalogue encoding identifier oci
Last synced: over 1 year ago
JSON representation
Omega Catalog Identifier tools (Scala)
- Host: GitHub
- URL: https://github.com/nationalarchives/oci-tools-scala
- Owner: nationalarchives
- License: mit
- Created: 2020-05-04T20:14:16.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T09:42:56.000Z (over 2 years ago)
- Last Synced: 2025-02-03T04:48:37.501Z (over 1 year ago)
- Topics: catalogue, encoding, identifier, oci
- Language: Scala
- Size: 63.5 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Omega Catalog Identifier tools (Scala)
[](https://travis-ci.com/nationalarchives/oci-tools-scala)
[](https://ci.appveyor.com/project/AdamRetter/oci-tools-scala/branch/master)
[](http://scala-lang.org)
[](https://opensource.org/licenses/MIT)
[](https://search.maven.org/search?q=g:uk.gov.nationalarchives.oci)
**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:
1. a library ([`BaseCoder.scala`](https://github.com/nationalarchives/oci-tools-scala/blob/master/src/main/scala/uk/gov/nationalarchives/oci/BaseCoder.scala))
which can be used in other projects.
2. a command line tool ([`Main.scala`](https://github.com/nationalarchives/oci-tools-scala/blob/master/src/main/scala/uk/gov/nationalarchives/oci/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):
```bash
❯ 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):
```bash
❯ 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):
```bash
❯ 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):
```bash
❯ 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 https://oss.sonatype.org/ then Close, and Release the Staging Repository