From b65cd89989ead7082089bf6f333e56b03f619606 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Thu, 13 Jul 2017 20:21:01 +0200 Subject: HONEYCOMB-360 - Restconf Northbound Intefaces provider separation - Restconf configuration included under restconf.json Change-Id: I45f503d3ef383bd6e3d356308d3212c7314b7a28 Signed-off-by: Jan Srnicek --- .../java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java') diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java index c851dab1b..60aaaae6b 100644 --- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java +++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java @@ -17,6 +17,7 @@ package io.fd.honeycomb.infra.distro.schema; import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; import static java.lang.String.format; import com.google.common.base.Charsets; @@ -38,11 +39,14 @@ import java.util.jar.JarFile; import java.util.stream.Collectors; import org.apache.commons.io.IOUtils; -interface ResourceLoader { +/** + * Allows loading content of X amount of files from filesystem or archive + */ +public interface ResourceLoader { default Set loadResourceContentsOnPath(final String path) { final URL folderUrl = getClass().getClassLoader().getResource(path); - checkNotNull(folderUrl, "Resources %s not found", path); + checkState(folderUrl != null, "Resources %s not found", path); if (ResourceLoaderIml.urlToUri(folderUrl).getScheme().equals("jar")) { return ResourceLoaderIml.readFromJar(path, folderUrl); -- cgit 1.2.3-korg