diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbPersistentEnvironmentCreator.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbPersistentEnvironmentCreator.java index abfb6e43ba..aa128239fb 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbPersistentEnvironmentCreator.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbPersistentEnvironmentCreator.java @@ -12,6 +12,7 @@ import nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.BdbDbCreationException; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.IsCleanHandler; import nl.knaw.huygens.timbuctoo.v5.dataset.StoreProvider; +import nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb.BdbStoreProvider; import nl.knaw.huygens.timbuctoo.v5.filehelper.FileHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbBackedData.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbBackedData.java index 7fe398ee22..d1a1ee926b 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbBackedData.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbBackedData.java @@ -15,14 +15,14 @@ * A simple wrapper around serialized json so that we get the benefits of berkeley db for transactions * without having to change the code too much. */ -public class BdbBackedData implements DataStorage { +class BdbBackedData implements DataStorage { private static final Logger LOG = getLogger(BdbBackedData.class); private final BdbWrapper bdbWrapper; private String value; - public BdbBackedData(BdbWrapper bdbWrapper) + BdbBackedData(BdbWrapper bdbWrapper) throws DataStoreCreationException { this.bdbWrapper = bdbWrapper; diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbRmlDataSourceStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbRmlDataSourceStore.java index b8f3c1ae1d..b49d373760 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbRmlDataSourceStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbRmlDataSourceStore.java @@ -24,13 +24,13 @@ import static nl.knaw.huygens.timbuctoo.v5.util.RdfConstants.TIM_HAS_ROW; import static org.apache.commons.lang3.StringEscapeUtils.escapeJava; -public class BdbRmlDataSourceStore implements RmlDataSourceStore { +class BdbRmlDataSourceStore implements RmlDataSourceStore { private static final Logger LOG = LoggerFactory.getLogger(BdbRmlDataSourceStore.class); - protected final BdbWrapper bdbWrapper; + private final BdbWrapper bdbWrapper; private final Map> collectionProperties = new HashMap<>(); private ImportStatus importStatus; - public BdbRmlDataSourceStore(BdbWrapper bdbWrapper, ImportStatus importStatus) + BdbRmlDataSourceStore(BdbWrapper bdbWrapper, ImportStatus importStatus) throws DataStoreCreationException { this.bdbWrapper = bdbWrapper; this.importStatus = importStatus; diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbSchemaStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbSchemaStore.java index ae35cd705b..90c77ed1f2 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbSchemaStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbSchemaStore.java @@ -32,7 +32,7 @@ import static nl.knaw.huygens.timbuctoo.v5.util.RdfConstants.RDF_TYPE; import static nl.knaw.huygens.timbuctoo.v5.util.RdfConstants.UNKNOWN; -public class BdbSchemaStore implements SchemaStore, OptimizedPatchListener { +class BdbSchemaStore implements SchemaStore, OptimizedPatchListener { private static final Logger LOG = LoggerFactory.getLogger(BdbSchemaStore.class); private static final Function TYPE_MAKER = Type::new; @@ -48,7 +48,7 @@ public class BdbSchemaStore implements SchemaStore, OptimizedPatchListener { private Map stableTypes = new HashMap<>(); private ImportStatus importStatus; - public BdbSchemaStore(DataStorage dataStore, ImportStatus importStatus) throws IOException { + BdbSchemaStore(DataStorage dataStore, ImportStatus importStatus) throws IOException { this.dataStore = dataStore; final String storedValue = this.dataStore.getValue(); diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbStoreProvider.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbStoreProvider.java similarity index 97% rename from timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbStoreProvider.java rename to timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbStoreProvider.java index 06f6c07af2..b8b80808df 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/berkeleydb/BdbStoreProvider.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbStoreProvider.java @@ -1,6 +1,7 @@ -package nl.knaw.huygens.timbuctoo.v5.berkeleydb; +package nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb; import com.sleepycat.bind.tuple.TupleBinding; +import nl.knaw.huygens.timbuctoo.v5.berkeleydb.BdbEnvironmentCreator; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.BdbDbCreationException; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.IsCleanHandler; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.StringStringIsCleanHandler; diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStore.java index 4327d9fbd7..0fdc765cf1 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStore.java @@ -15,12 +15,12 @@ import static nl.knaw.huygens.timbuctoo.v5.berkeleydb.DatabaseGetter.Iterate.BACKWARDS; import static nl.knaw.huygens.timbuctoo.v5.berkeleydb.DatabaseGetter.Iterate.FORWARDS; -public class BdbTripleStore implements QuadStore { +class BdbTripleStore implements QuadStore { private static final Logger LOG = LoggerFactory.getLogger(BdbTripleStore.class); private final BdbWrapper bdbWrapper; - public BdbTripleStore(BdbWrapper rdfData) + BdbTripleStore(BdbWrapper rdfData) throws DataStoreCreationException { this.bdbWrapper = rdfData; } diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTruePatchStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTruePatchStore.java index 470fc903ba..03f594530b 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTruePatchStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTruePatchStore.java @@ -14,12 +14,12 @@ import static nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction.IN; import static nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction.OUT; -public class BdbTruePatchStore implements nl.knaw.huygens.timbuctoo.v5.datastores.truepatch.TruePatchStore { +class BdbTruePatchStore implements nl.knaw.huygens.timbuctoo.v5.datastores.truepatch.TruePatchStore { private static final Logger LOG = LoggerFactory.getLogger(BdbTruePatchStore.class); private final BdbWrapper bdbWrapper; - public BdbTruePatchStore(BdbWrapper bdbWrapper) + BdbTruePatchStore(BdbWrapper bdbWrapper) throws DataStoreCreationException { this.bdbWrapper = bdbWrapper; } diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTypeNameStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTypeNameStore.java index 59161fb209..874277a16b 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTypeNameStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTypeNameStore.java @@ -19,7 +19,7 @@ import java.util.Map; import java.util.Optional; -public class BdbTypeNameStore implements TypeNameStore { +class BdbTypeNameStore implements TypeNameStore { private static ObjectMapper objectMapper = new ObjectMapper() .registerModule(new Jdk8Module()) @@ -27,12 +27,12 @@ public class BdbTypeNameStore implements TypeNameStore { .registerModule(new TimbuctooCustomSerializers()) .enable(SerializationFeature.INDENT_OUTPUT); - protected final PrefixMapping prefixMapping; + private final PrefixMapping prefixMapping; protected final TypeNames data; private final DataStorage dataStore; private final String dataStoreRdfPrefix; - public BdbTypeNameStore(DataStorage dataStore, String dataStoreRdfPrefix) throws IOException { + BdbTypeNameStore(DataStorage dataStore, String dataStoreRdfPrefix) throws IOException { this.dataStoreRdfPrefix = dataStoreRdfPrefix; prefixMapping = new PrefixMappingImpl(); final String storedValue = dataStore.getValue(); diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbUpdatedPerPatchStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbUpdatedPerPatchStore.java index ac33ccf5e2..d1889bb79a 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbUpdatedPerPatchStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbUpdatedPerPatchStore.java @@ -9,12 +9,12 @@ import java.util.stream.Stream; -public class BdbUpdatedPerPatchStore implements UpdatedPerPatchStore { +class BdbUpdatedPerPatchStore implements UpdatedPerPatchStore { private static final Logger LOG = LoggerFactory.getLogger(BdbUpdatedPerPatchStore.class); private final BdbWrapper bdbWrapper; - public BdbUpdatedPerPatchStore(BdbWrapper bdbWrapper) + BdbUpdatedPerPatchStore(BdbWrapper bdbWrapper) throws DataStoreCreationException { this.bdbWrapper = bdbWrapper; diff --git a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbVersionStore.java b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbVersionStore.java index fa8d4a4c58..bf1310ccdf 100644 --- a/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbVersionStore.java +++ b/timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbVersionStore.java @@ -9,12 +9,12 @@ import java.util.stream.Stream; -public class BdbVersionStore implements VersionStore { +class BdbVersionStore implements VersionStore { private static final Logger LOG = LoggerFactory.getLogger(BdbVersionStore.class); private final BdbWrapper bdbWrapper; - public BdbVersionStore(BdbWrapper bdbWrapper) + BdbVersionStore(BdbWrapper bdbWrapper) throws DataStoreCreationException { this.bdbWrapper = bdbWrapper; diff --git a/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/graphql/datafetchers/berkeleydb/stores/BdbTripleStoreTest.java b/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStoreTest.java similarity index 96% rename from timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/graphql/datafetchers/berkeleydb/stores/BdbTripleStoreTest.java rename to timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStoreTest.java index e74a345a9d..675bbaa517 100644 --- a/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/graphql/datafetchers/berkeleydb/stores/BdbTripleStoreTest.java +++ b/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/implementations/bdb/BdbTripleStoreTest.java @@ -1,8 +1,8 @@ -package nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.berkeleydb.stores; +package nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb; import com.sleepycat.bind.tuple.TupleBinding; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.StringStringIsCleanHandler; -import nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb.BdbTripleStore; +import nl.knaw.huygens.timbuctoo.v5.dataset.StoreProvider; import nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad; import nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.Direction; import nl.knaw.huygens.timbuctoo.v5.dropwizard.BdbNonPersistentEnvironmentCreator; @@ -25,9 +25,9 @@ public class BdbTripleStoreTest { - public static final String EX = "http://example.org/"; - protected BdbNonPersistentEnvironmentCreator databaseCreator; - protected BdbTripleStore tripleStore; + private static final String EX = "http://example.org/"; + private BdbNonPersistentEnvironmentCreator databaseCreator; + private BdbTripleStore tripleStore; @Before public void makeCollection() throws Exception { diff --git a/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/storeupdater/ChangeFetcherImplTest.java b/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/storeupdater/ChangeFetcherImplTest.java index 2a2000cbf3..694302b3b7 100644 --- a/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/storeupdater/ChangeFetcherImplTest.java +++ b/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/datastores/storeupdater/ChangeFetcherImplTest.java @@ -1,11 +1,9 @@ package nl.knaw.huygens.timbuctoo.v5.datastores.storeupdater; -import com.sleepycat.bind.tuple.TupleBinding; -import nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.StringStringIsCleanHandler; -import nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb.BdbTripleStore; -import nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb.BdbTruePatchStore; +import nl.knaw.huygens.timbuctoo.v5.dataset.StoreProvider; +import nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.QuadStore; import nl.knaw.huygens.timbuctoo.v5.datastores.quadstore.dto.CursorQuad; -import nl.knaw.huygens.timbuctoo.v5.datastores.storeupdater.ChangeFetcherImpl; +import nl.knaw.huygens.timbuctoo.v5.datastores.truepatch.TruePatchStore; import nl.knaw.huygens.timbuctoo.v5.dropwizard.BdbNonPersistentEnvironmentCreator; import org.junit.Test; @@ -20,24 +18,9 @@ public class ChangeFetcherImplTest { @Test public void showsAdditions() throws Exception { final BdbNonPersistentEnvironmentCreator databaseCreator = new BdbNonPersistentEnvironmentCreator(); - final BdbTripleStore bdbTripleStore = new BdbTripleStore(databaseCreator.getDatabase( - "a", - "b", - "rdfData", - true, - TupleBinding.getPrimitiveBinding(String.class), - TupleBinding.getPrimitiveBinding(String.class), - new StringStringIsCleanHandler() - )); - final BdbTruePatchStore truePatchStore = new BdbTruePatchStore(databaseCreator.getDatabase( - "a", - "b", - "truePatch", - true, - TupleBinding.getPrimitiveBinding(String.class), - TupleBinding.getPrimitiveBinding(String.class), - new StringStringIsCleanHandler() - )); + StoreProvider storeProvider = databaseCreator.createStoreProvider("a", "b"); + final QuadStore bdbTripleStore = storeProvider.createTripleStore(); + final TruePatchStore truePatchStore = storeProvider.createTruePatchStore(); bdbTripleStore.putQuad("subj", "pred", OUT, "obj", null, null); truePatchStore.put("subj", 0, "pred", OUT, true, "obj", null, null); diff --git a/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/dropwizard/BdbNonPersistentEnvironmentCreator.java b/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/dropwizard/BdbNonPersistentEnvironmentCreator.java index 88c363cec0..eeb065067d 100644 --- a/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/dropwizard/BdbNonPersistentEnvironmentCreator.java +++ b/timbuctoo-instancev4/src/test/java/nl/knaw/huygens/timbuctoo/v5/dropwizard/BdbNonPersistentEnvironmentCreator.java @@ -9,7 +9,7 @@ import com.sleepycat.je.Environment; import com.sleepycat.je.EnvironmentConfig; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.BdbEnvironmentCreator; -import nl.knaw.huygens.timbuctoo.v5.berkeleydb.BdbStoreProvider; +import nl.knaw.huygens.timbuctoo.v5.datastores.implementations.bdb.BdbStoreProvider; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.BdbWrapper; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.exceptions.BdbDbCreationException; import nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.IsCleanHandler;