From 9023627f7e7a16969199e5658ea113c3047d50e9 Mon Sep 17 00:00:00 2001 From: Jorrit Poelen Date: Fri, 8 Nov 2024 16:27:39 -0600 Subject: [PATCH] add new constructor arg for registry class --- .../elton/cmd/DatasetRegistryFactoryImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/globalbioticinteractions/elton/cmd/DatasetRegistryFactoryImpl.java b/src/main/java/org/globalbioticinteractions/elton/cmd/DatasetRegistryFactoryImpl.java index b8320b4..808ebd4 100644 --- a/src/main/java/org/globalbioticinteractions/elton/cmd/DatasetRegistryFactoryImpl.java +++ b/src/main/java/org/globalbioticinteractions/elton/cmd/DatasetRegistryFactoryImpl.java @@ -4,6 +4,8 @@ import org.eol.globi.service.ResourceService; import org.eol.globi.util.InputStreamFactory; import org.eol.globi.util.ResourceServiceLocalAndRemote; +import org.globalbioticinteractions.cache.ContentPathFactory; +import org.globalbioticinteractions.cache.ContentPathFactoryDepth0; import org.globalbioticinteractions.dataset.DatasetRegistryException; import org.globalbioticinteractions.dataset.DatasetRegistry; import org.globalbioticinteractions.dataset.DatasetRegistryException; @@ -46,20 +48,20 @@ public DatasetRegistry createRegistryByName(String name) throws DatasetRegistryE throw new DatasetRegistryException("failed to create registry for [" + name + "]: not supported"); } try { - Class[] paramTypes = {URI.class, String.class, ResourceService.class}; + Class[] paramTypes = {URI.class, String.class, ResourceService.class, ContentPathFactory.class}; Optional> constructor = constructorFor(registryClass, paramTypes); ResourceService resourceService = new ResourceServiceLocalAndRemote(inputStreamFactory, new File(cacheDir)); if (!constructor.isPresent()) { Class[] paramTypesShort = {ResourceService.class}; Optional> constructor2 = constructorFor(registryClass, paramTypesShort); return constructor2 - .orElseThrow(() -> new DatasetRegistryException("failed to create registry for [" + name + "]") + .orElseThrow(() -> new DatasetRegistryException("failed to create registry for [" + name + "] using [" + registryClass.getSimpleName() + "]") ).newInstance(resourceService); } else { - return constructor.get().newInstance(getWorkDir(), getCacheDir(), resourceService); + return constructor.get().newInstance(getWorkDir(), getCacheDir(), resourceService, new ContentPathFactoryDepth0()); } } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new DatasetRegistryException("failed to create registry for [" + name + "]", e); + throw new DatasetRegistryException("failed to create registry for [" + name + "] using [" + registryClass.getSimpleName() + "]", e); } }