From 62761f9d8f92418cd85b3cc2b62c948b868414d4 Mon Sep 17 00:00:00 2001 From: Dominic Reed Date: Wed, 20 Nov 2024 13:44:36 -0800 Subject: [PATCH] Add NoOpCollectionStore Summary: Test Plan: --- .../main/java/io/opentdf/platform/sdk/NanoTDF.java | 2 +- .../platform/sdk/nanotdf/CollectionStore.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sdk/src/main/java/io/opentdf/platform/sdk/NanoTDF.java b/sdk/src/main/java/io/opentdf/platform/sdk/NanoTDF.java index a4d5f359..f893762a 100644 --- a/sdk/src/main/java/io/opentdf/platform/sdk/NanoTDF.java +++ b/sdk/src/main/java/io/opentdf/platform/sdk/NanoTDF.java @@ -35,7 +35,7 @@ public class NanoTDF { private final CollectionStore collectionStore; public NanoTDF() { - this(null); + this(new CollectionStore.NoOpCollectionStore()); } public NanoTDF(boolean collectionStoreEnabled) { diff --git a/sdk/src/main/java/io/opentdf/platform/sdk/nanotdf/CollectionStore.java b/sdk/src/main/java/io/opentdf/platform/sdk/nanotdf/CollectionStore.java index fd87a37e..69a0be8c 100644 --- a/sdk/src/main/java/io/opentdf/platform/sdk/nanotdf/CollectionStore.java +++ b/sdk/src/main/java/io/opentdf/platform/sdk/nanotdf/CollectionStore.java @@ -3,7 +3,19 @@ import io.opentdf.platform.sdk.NanoTDF; public interface CollectionStore { - public static final NanoTDF.CollectionKey NO_PRIVATE_KEY = new NanoTDF.CollectionKey(null); + NanoTDF.CollectionKey NO_PRIVATE_KEY = new NanoTDF.CollectionKey(null); void store(Header header, NanoTDF.CollectionKey key); NanoTDF.CollectionKey getKey(Header header); + + class NoOpCollectionStore implements CollectionStore { + public NoOpCollectionStore() {} + + @Override + public void store(Header header, NanoTDF.CollectionKey key) {} + + @Override + public NanoTDF.CollectionKey getKey(Header header) { + return NO_PRIVATE_KEY; + } + } }