From 4f0d17deed19bb7d803d74615ac83d333864adb3 Mon Sep 17 00:00:00 2001 From: Aaron Coburn Date: Wed, 11 Dec 2019 11:35:37 -0500 Subject: [PATCH] Normalize configuration Resolves #606 --- .../auth/basic/BasicAuthFilter.java | 2 +- .../trellisldp/auth/jwt/JwtAuthFilter.java | 2 +- .../trellisldp/auth/oauth/OAuthFilter.java | 12 ++--- .../META-INF/microprofile-config.properties | 9 ++-- .../AbstractTrellisApplication.java | 2 +- .../META-INF/microprofile-config.properties | 9 ++-- .../trellisldp/file/FileBinaryService.java | 8 +-- .../trellisldp/file/FileMementoService.java | 4 +- .../file/FileBinaryServiceTest.java | 4 +- .../file/FileMementoServiceTest.java | 16 +++--- .../META-INF/microprofile-config.properties | 4 +- .../java/org/trellisldp/io/JenaIOService.java | 4 +- components/namespaces/build.gradle | 2 +- .../namespaces/SimpleNamespaceService.java | 4 +- .../TriplestoreResourceService.java | 4 +- .../org/trellisldp/webac/WebAcFilter.java | 12 ++--- .../org/trellisldp/webac/WebAcService.java | 2 +- .../org/trellisldp/webac/WebAcFilterTest.java | 12 ++--- .../META-INF/microprofile-config.properties | 2 +- .../trellisldp/http/CacheControlFilter.java | 8 +-- .../trellisldp/http/WebSubHeaderFilter.java | 2 +- .../trellisldp/http/core/HttpConstants.java | 16 +++--- .../META-INF/microprofile-config.properties | 3 +- .../org/trellisldp/amqp/AmqpEventService.java | 4 +- .../META-INF/microprofile-config.properties | 4 +- .../org/trellisldp/jms/JmsEventService.java | 4 +- .../META-INF/microprofile-config.properties | 2 +- platform/openliberty/build.gradle | 8 ++- platform/quarkus/build.gradle | 8 +-- .../quarkus/AuthorizationCache.java | 9 ++-- .../org/trellisldp/quarkus/ProfileCache.java | 8 +-- .../src/main/resources/application.properties | 49 +++++++++---------- .../src/test/resources/namespaces.json | 18 ------- 33 files changed, 117 insertions(+), 140 deletions(-) delete mode 100644 platform/quarkus/src/test/resources/namespaces.json diff --git a/auth/basic/src/main/java/org/trellisldp/auth/basic/BasicAuthFilter.java b/auth/basic/src/main/java/org/trellisldp/auth/basic/BasicAuthFilter.java index d96ec4582..fa07b0f25 100644 --- a/auth/basic/src/main/java/org/trellisldp/auth/basic/BasicAuthFilter.java +++ b/auth/basic/src/main/java/org/trellisldp/auth/basic/BasicAuthFilter.java @@ -50,7 +50,7 @@ public class BasicAuthFilter implements ContainerRequestFilter { public static final String CONFIG_AUTH_REALM = "trellis.auth.realm"; /** The configuration key controlling the list of of admin WebID values. */ - public static final String CONFIG_AUTH_ADMIN_USERS = "trellis.auth.adminusers"; + public static final String CONFIG_AUTH_ADMIN_USERS = "trellis.auth.admin-users"; /** The admin role. */ public static final String ADMIN_ROLE = "admin"; diff --git a/auth/jwt/src/main/java/org/trellisldp/auth/jwt/JwtAuthFilter.java b/auth/jwt/src/main/java/org/trellisldp/auth/jwt/JwtAuthFilter.java index 4afdde919..b9739daef 100644 --- a/auth/jwt/src/main/java/org/trellisldp/auth/jwt/JwtAuthFilter.java +++ b/auth/jwt/src/main/java/org/trellisldp/auth/jwt/JwtAuthFilter.java @@ -39,7 +39,7 @@ public class JwtAuthFilter implements ContainerRequestFilter { private static final Logger LOGGER = getLogger(JwtAuthFilter.class); /** The configuration key controlling the list of of admin WebID values. */ - public static final String CONFIG_AUTH_ADMIN_USERS = "trellis.auth.adminusers"; + public static final String CONFIG_AUTH_ADMIN_USERS = "trellis.auth.admin-users"; private final Set admins; diff --git a/auth/oauth/src/main/java/org/trellisldp/auth/oauth/OAuthFilter.java b/auth/oauth/src/main/java/org/trellisldp/auth/oauth/OAuthFilter.java index 293dcdb34..de1d8c782 100644 --- a/auth/oauth/src/main/java/org/trellisldp/auth/oauth/OAuthFilter.java +++ b/auth/oauth/src/main/java/org/trellisldp/auth/oauth/OAuthFilter.java @@ -48,22 +48,22 @@ @Priority(AUTHENTICATION) public class OAuthFilter implements ContainerRequestFilter { + /** The configuration key controlling the list of of admin WebID values. */ + public static final String CONFIG_AUTH_ADMIN_USERS = "trellis.auth.admin-users"; /** The configuration key controlling the realm used in a WWW-Authenticate header, or 'trellis' by default. */ public static final String CONFIG_AUTH_REALM = "trellis.auth.realm"; /** The configuration key controlling the OAuth Keystore path. */ - public static final String CONFIG_AUTH_OAUTH_KEYSTORE_PATH = "trellis.auth.oauth.keystore.path"; + public static final String CONFIG_AUTH_OAUTH_KEYSTORE_PATH = "trellis.auth.oauth.keystore-path"; /** The configuration key controlling the OAuth Keystore credentials. */ - public static final String CONFIG_AUTH_OAUTH_KEYSTORE_CREDENTIALS = "trellis.auth.oauth.keystore.credentials"; + public static final String CONFIG_AUTH_OAUTH_KEYSTORE_CREDENTIALS = "trellis.auth.oauth.keystore-credentials"; /** The configuration key controlling the OAuth Keystore ids. */ - public static final String CONFIG_AUTH_OAUTH_KEYSTORE_IDS = "trellis.auth.oauth.keystore.ids"; + public static final String CONFIG_AUTH_OAUTH_KEYSTORE_IDS = "trellis.auth.oauth.keystore-ids"; /** The configuration key controlling the OAuth HMAC shared secret. */ - public static final String CONFIG_AUTH_OAUTH_SHARED_SECRET = "trellis.auth.oauth.sharedsecret"; + public static final String CONFIG_AUTH_OAUTH_SHARED_SECRET = "trellis.auth.oauth.shared-secret"; /** The configuration key controlling the OAuth JWK URL. */ public static final String CONFIG_AUTH_OAUTH_JWK_URL = "trellis.auth.oauth.jwk"; /** The authentication scheme used by this module. */ public static final String SCHEME = "Bearer"; - /** The configuration key controlling the list of of admin WebID values. */ - public static final String CONFIG_AUTH_ADMIN_USERS = "trellis.auth.adminusers"; /** The admin role. */ public static final String ADMIN_ROLE = "admin"; diff --git a/components/app/src/test/resources/META-INF/microprofile-config.properties b/components/app/src/test/resources/META-INF/microprofile-config.properties index c68639ef8..15f4760b2 100644 --- a/components/app/src/test/resources/META-INF/microprofile-config.properties +++ b/components/app/src/test/resources/META-INF/microprofile-config.properties @@ -1,5 +1,4 @@ -trellis.triplestore.ldp.type=true -trellis.triplestore.rdf.location=resources -trellis.file.memento.basepath=mementos -trellis.file.binary.basepath=binary -trellis.namespaces.path=namespaces.json +trellis.triplestore.ldp-type=true +trellis.triplestore.rdf-location=resources +trellis.file.memento-path=mementos +trellis.file.binary-path=binary diff --git a/components/dropwizard/src/main/java/org/trellisldp/dropwizard/AbstractTrellisApplication.java b/components/dropwizard/src/main/java/org/trellisldp/dropwizard/AbstractTrellisApplication.java index ee7e9562a..0161530df 100644 --- a/components/dropwizard/src/main/java/org/trellisldp/dropwizard/AbstractTrellisApplication.java +++ b/components/dropwizard/src/main/java/org/trellisldp/dropwizard/AbstractTrellisApplication.java @@ -52,7 +52,7 @@ public abstract class AbstractTrellisApplication private static final Logger LOGGER = getLogger(AbstractTrellisApplication.class); /** The configuration key controlling whether an application should initialize its own root resource. */ - public static final String CONFIG_DROPWIZARD_INITIALIZE_ROOT = "trellis.dropwizard.initialize.root"; + public static final String CONFIG_DROPWIZARD_INITIALIZE_ROOT = "trellis.dropwizard.initialize-root"; /** * Get the Trellis {@link ServiceBundler}. This object collects the various diff --git a/components/dropwizard/src/test/resources/META-INF/microprofile-config.properties b/components/dropwizard/src/test/resources/META-INF/microprofile-config.properties index c68639ef8..15f4760b2 100644 --- a/components/dropwizard/src/test/resources/META-INF/microprofile-config.properties +++ b/components/dropwizard/src/test/resources/META-INF/microprofile-config.properties @@ -1,5 +1,4 @@ -trellis.triplestore.ldp.type=true -trellis.triplestore.rdf.location=resources -trellis.file.memento.basepath=mementos -trellis.file.binary.basepath=binary -trellis.namespaces.path=namespaces.json +trellis.triplestore.ldp-type=true +trellis.triplestore.rdf-location=resources +trellis.file.memento-path=mementos +trellis.file.binary-path=binary diff --git a/components/file/src/main/java/org/trellisldp/file/FileBinaryService.java b/components/file/src/main/java/org/trellisldp/file/FileBinaryService.java index f70f8779b..2d671965b 100644 --- a/components/file/src/main/java/org/trellisldp/file/FileBinaryService.java +++ b/components/file/src/main/java/org/trellisldp/file/FileBinaryService.java @@ -48,13 +48,13 @@ public class FileBinaryService implements BinaryService { /** The configuration key controlling the base filesystem path for the binary service. */ - public static final String CONFIG_FILE_BINARY_BASE_PATH = "trellis.file.binary.basepath"; + public static final String CONFIG_FILE_BINARY_PATH = "trellis.file.binary-path"; /** The configuration key controlling the levels of hierarchy in a binary storage layout. */ - public static final String CONFIG_FILE_BINARY_HIERARCHY = "trellis.file.binary.hierarchy"; + public static final String CONFIG_FILE_BINARY_HIERARCHY = "trellis.file.binary-hierarchy"; /** The configuration key controlling the length of each level of hierarchy in a filesystem layout. */ - public static final String CONFIG_FILE_BINARY_LENGTH = "trellis.file.binary.length"; + public static final String CONFIG_FILE_BINARY_LENGTH = "trellis.file.binary-length"; private static final Logger LOGGER = getLogger(FileBinaryService.class); private static final int DEFAULT_HIERARCHY = 3; @@ -96,7 +96,7 @@ public FileBinaryService(final IdentifierService idService, final String basePat } private FileBinaryService(final IdentifierService idService, final Config config) { - this(idService, config.getValue(CONFIG_FILE_BINARY_BASE_PATH, String.class), + this(idService, config.getValue(CONFIG_FILE_BINARY_PATH, String.class), config.getOptionalValue(CONFIG_FILE_BINARY_HIERARCHY, Integer.class).orElse(DEFAULT_HIERARCHY), config.getOptionalValue(CONFIG_FILE_BINARY_LENGTH, Integer.class).orElse(DEFAULT_LENGTH)); } diff --git a/components/file/src/main/java/org/trellisldp/file/FileMementoService.java b/components/file/src/main/java/org/trellisldp/file/FileMementoService.java index ac78a0b41..3e20f8613 100644 --- a/components/file/src/main/java/org/trellisldp/file/FileMementoService.java +++ b/components/file/src/main/java/org/trellisldp/file/FileMementoService.java @@ -45,7 +45,7 @@ public class FileMementoService implements MementoService { /** The configuration key controlling the base filesystem path for memento storage. */ - public static final String CONFIG_FILE_MEMENTO_BASE_PATH = "trellis.file.memento.basepath"; + public static final String CONFIG_FILE_MEMENTO_PATH = "trellis.file.memento-path"; private static final Logger LOGGER = getLogger(FileMementoService.class); @@ -55,7 +55,7 @@ public class FileMementoService implements MementoService { * Create a file-based memento service. */ public FileMementoService() { - this(ConfigProvider.getConfig().getValue(CONFIG_FILE_MEMENTO_BASE_PATH, String.class)); + this(ConfigProvider.getConfig().getValue(CONFIG_FILE_MEMENTO_PATH, String.class)); } /** diff --git a/components/file/src/test/java/org/trellisldp/file/FileBinaryServiceTest.java b/components/file/src/test/java/org/trellisldp/file/FileBinaryServiceTest.java index ecc5e5b92..be444d2ee 100644 --- a/components/file/src/test/java/org/trellisldp/file/FileBinaryServiceTest.java +++ b/components/file/src/test/java/org/trellisldp/file/FileBinaryServiceTest.java @@ -52,12 +52,12 @@ class FileBinaryServiceTest { @BeforeAll static void setUpEverything() { - System.setProperty(FileBinaryService.CONFIG_FILE_BINARY_BASE_PATH, directory); + System.setProperty(FileBinaryService.CONFIG_FILE_BINARY_PATH, directory); } @AfterAll static void cleanUp() { - System.clearProperty(FileBinaryService.CONFIG_FILE_BINARY_BASE_PATH); + System.clearProperty(FileBinaryService.CONFIG_FILE_BINARY_PATH); } @Test diff --git a/components/file/src/test/java/org/trellisldp/file/FileMementoServiceTest.java b/components/file/src/test/java/org/trellisldp/file/FileMementoServiceTest.java index 0f5809248..50539644e 100644 --- a/components/file/src/test/java/org/trellisldp/file/FileMementoServiceTest.java +++ b/components/file/src/test/java/org/trellisldp/file/FileMementoServiceTest.java @@ -107,7 +107,7 @@ void testList() { assertTrue(dir.isDirectory(), "Resource directory isn't a valid directory"); try { - System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH, dir.getAbsolutePath()); + System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH, dir.getAbsolutePath()); final MementoService svc = new FileMementoService(); @@ -125,7 +125,7 @@ void testList() { svc.get(identifier, MAX).thenAccept(res -> assertEquals(time2, res.getModified(), "Incorrect date!")) .toCompletableFuture().join(); } finally { - System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH); + System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH); } } @@ -218,7 +218,7 @@ void testListNonExistent() { final File dir = new File(getClass().getResource("/versions").getFile()); try { - System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH, dir.getAbsolutePath()); + System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH, dir.getAbsolutePath()); final MementoService svc = new FileMementoService(); final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + "nonexistent"); @@ -230,7 +230,7 @@ void testListNonExistent() { assertEquals(MISSING_RESOURCE, svc.get(identifier, now()).toCompletableFuture().join(), "Wrong response for missing resource!"); } finally { - System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH); + System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH); } } @@ -239,7 +239,7 @@ void testListNone() { final File dir = new File(getClass().getResource("/versions").getFile()); try { - System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH, dir.getAbsolutePath()); + System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH, dir.getAbsolutePath()); final MementoService svc = new FileMementoService(); final IRI identifier = rdf.createIRI(TRELLIS_DATA_PREFIX + "empty"); @@ -251,7 +251,7 @@ void testListNone() { assertTrue(svc.mementos(identifier).toCompletableFuture().join().isEmpty(), "Memento list isn't empty!"); } finally { - System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH); + System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH); } } @@ -265,7 +265,7 @@ void testNewVersionSystem() { assertFalse(versionDir.exists(), "Version directory already exists!"); try { - System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH, versionDir.getAbsolutePath()); + System.setProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH, versionDir.getAbsolutePath()); final FileMementoService svc = new FileMementoService(); @@ -282,7 +282,7 @@ void testNewVersionSystem() { assertEquals(2L, svc.mementos(identifier).toCompletableFuture().join().size(), "Incorrect count of Mementos!"); } finally { - System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_BASE_PATH); + System.clearProperty(FileMementoService.CONFIG_FILE_MEMENTO_PATH); } } } diff --git a/components/file/src/test/resources/META-INF/microprofile-config.properties b/components/file/src/test/resources/META-INF/microprofile-config.properties index eb98fa8d1..b8e2c1f6e 100644 --- a/components/file/src/test/resources/META-INF/microprofile-config.properties +++ b/components/file/src/test/resources/META-INF/microprofile-config.properties @@ -1,2 +1,2 @@ -trellis.file.memento.basepath=mementos -trellis.file.binary.basepath=binaries +trellis.file.memento-path=mementos +trellis.file.binary-path=binaries diff --git a/components/io-jena/src/main/java/org/trellisldp/io/JenaIOService.java b/components/io-jena/src/main/java/org/trellisldp/io/JenaIOService.java index 9259358a4..a5be11775 100644 --- a/components/io-jena/src/main/java/org/trellisldp/io/JenaIOService.java +++ b/components/io-jena/src/main/java/org/trellisldp/io/JenaIOService.java @@ -97,10 +97,10 @@ public class JenaIOService implements IOService { /** The configuration key listing valid JSON-LD profile documents. */ - public static final String CONFIG_IO_JSONLD_PROFILES = "trellis.io.jsonld.profiles"; + public static final String CONFIG_IO_JSONLD_PROFILES = "trellis.io.jsonld-profiles"; /** The configuration key listing valid JSON-LD profile domains. */ - public static final String CONFIG_IO_JSONLD_DOMAINS = "trellis.io.jsonld.domains"; + public static final String CONFIG_IO_JSONLD_DOMAINS = "trellis.io.jsonld-domains"; private static final Logger LOGGER = getLogger(JenaIOService.class); private static final JenaRDF rdf = new JenaRDF(); diff --git a/components/namespaces/build.gradle b/components/namespaces/build.gradle index 2a4ebef64..79c5d0904 100644 --- a/components/namespaces/build.gradle +++ b/components/namespaces/build.gradle @@ -23,5 +23,5 @@ dependencies { } test { - systemProperty 'trellis.namespace.prefixes', 'dc11=http://purl.org/dc/elements/1.1/,,foo= , =bar,baz, = ' + systemProperty 'trellis.namespaces.mapping', 'dc11=http://purl.org/dc/elements/1.1/,,foo= , =bar,baz, = ' } diff --git a/components/namespaces/src/main/java/org/trellisldp/namespaces/SimpleNamespaceService.java b/components/namespaces/src/main/java/org/trellisldp/namespaces/SimpleNamespaceService.java index 52a50a574..00b09e076 100644 --- a/components/namespaces/src/main/java/org/trellisldp/namespaces/SimpleNamespaceService.java +++ b/components/namespaces/src/main/java/org/trellisldp/namespaces/SimpleNamespaceService.java @@ -45,7 +45,7 @@ @ApplicationScoped public class SimpleNamespaceService implements NamespaceService { - public static final String CONFIG_NAMESPACE_PREFIXES = "trellis.namespace.prefixes"; + public static final String CONFIG_NAMESPACES_MAPPING = "trellis.namespaces.mapping"; private final Map namespaces = new HashMap<>(); @@ -63,7 +63,7 @@ public SimpleNamespaceService() { namespaces.put("xsd", XSD.getNamespace()); namespaces.put("foaf", FOAF.getNamespace()); namespaces.put("vcard", VCARD.getNamespace()); - getConfig().getOptionalValue(CONFIG_NAMESPACE_PREFIXES, String.class).map(SimpleNamespaceService::configToMap) + getConfig().getOptionalValue(CONFIG_NAMESPACES_MAPPING, String.class).map(SimpleNamespaceService::configToMap) .ifPresent(data -> data.forEach(namespaces::put)); } diff --git a/components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResourceService.java b/components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResourceService.java index 3d39760cb..187bae38b 100644 --- a/components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResourceService.java +++ b/components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResourceService.java @@ -95,9 +95,9 @@ public class TriplestoreResourceService implements ResourceService { /** The configuration key used to set where the RDF is stored. */ - public static final String CONFIG_TRIPLESTORE_RDF_LOCATION = "trellis.triplestore.rdf.location"; + public static final String CONFIG_TRIPLESTORE_RDF_LOCATION = "trellis.triplestore.rdf-location"; /** The configuration key used to set whether the LDP type should be included in the body of the RDF. */ - public static final String CONFIG_TRIPLESTORE_LDP_TYPE = "trellis.triplestore.ldp.type"; + public static final String CONFIG_TRIPLESTORE_LDP_TYPE = "trellis.triplestore.ldp-type"; private static final String MODIFIED = "modified"; diff --git a/components/webac/src/main/java/org/trellisldp/webac/WebAcFilter.java b/components/webac/src/main/java/org/trellisldp/webac/WebAcFilter.java index 034548b4b..c55fcb0fe 100644 --- a/components/webac/src/main/java/org/trellisldp/webac/WebAcFilter.java +++ b/components/webac/src/main/java/org/trellisldp/webac/WebAcFilter.java @@ -81,21 +81,21 @@ public class WebAcFilter implements ContainerRequestFilter, ContainerResponseFil *

Values defined here will be in addition to GET, HEAD and OPTIONS. Multiple methods should * be separated with commas. */ - public static final String CONFIG_WEBAC_METHOD_READABLE = "trellis.webac.method.readable"; + public static final String CONFIG_WEBAC_READABLE_METHODS = "trellis.webac.readable-methods"; /** * The configuration key controlling with HTTP methods should apply to the acl:Write. * *

Values defined here will be in addition to GET, HEAD and OPTIONS. Multiple methods should * be separated with commas. */ - public static final String CONFIG_WEBAC_METHOD_WRITABLE = "trellis.webac.method.writable"; + public static final String CONFIG_WEBAC_WRITABLE_METHODS = "trellis.webac.writable-methods"; /** * The configuration key controlling with HTTP methods should apply to the acl:Append. * *

Values defined here will be in addition to GET, HEAD and OPTIONS. Multiple methods should * be separated with commas. */ - public static final String CONFIG_WEBAC_METHOD_APPENDABLE = "trellis.webac.method.appendable"; + public static final String CONFIG_WEBAC_APPENDABLE_METHODS = "trellis.webac.appendable-methods"; /** The configuration key controlling the realm used in a WWW-Authenticate header, or 'trellis' by default. */ public static final String CONFIG_WEBAC_REALM = "trellis.webac.realm"; @@ -164,11 +164,11 @@ public WebAcFilter(final WebAcService accessService, final List challeng .collect(toList()); this.baseUrl = baseUrl; final Config config = getConfig(); - config.getOptionalValue(CONFIG_WEBAC_METHOD_READABLE, String.class).ifPresent(r -> + config.getOptionalValue(CONFIG_WEBAC_READABLE_METHODS, String.class).ifPresent(r -> stream(r.split(",")).map(String::trim).map(String::toUpperCase).forEach(readable::add)); - config.getOptionalValue(CONFIG_WEBAC_METHOD_WRITABLE, String.class).ifPresent(w -> + config.getOptionalValue(CONFIG_WEBAC_WRITABLE_METHODS, String.class).ifPresent(w -> stream(w.split(",")).map(String::trim).map(String::toUpperCase).forEach(writable::add)); - config.getOptionalValue(CONFIG_WEBAC_METHOD_APPENDABLE, String.class).ifPresent(a -> + config.getOptionalValue(CONFIG_WEBAC_APPENDABLE_METHODS, String.class).ifPresent(a -> stream(a.split(",")).map(String::trim).map(String::toUpperCase).forEach(appendable::add)); } diff --git a/components/webac/src/main/java/org/trellisldp/webac/WebAcService.java b/components/webac/src/main/java/org/trellisldp/webac/WebAcService.java index c1f4ffeaf..278c4ba5e 100644 --- a/components/webac/src/main/java/org/trellisldp/webac/WebAcService.java +++ b/components/webac/src/main/java/org/trellisldp/webac/WebAcService.java @@ -83,7 +83,7 @@ public class WebAcService { /** The configuration key controlling whether to check member resources at the AuthZ enforcement point. */ - public static final String CONFIG_WEBAC_MEMBERSHIP_CHECK = "trellis.webac.membership.check"; + public static final String CONFIG_WEBAC_MEMBERSHIP_CHECK = "trellis.webac.membership-check"; private static final Logger LOGGER = getLogger(WebAcService.class); private static final CompletionStage DONE = CompletableFuture.completedFuture(null); diff --git a/components/webac/src/test/java/org/trellisldp/webac/WebAcFilterTest.java b/components/webac/src/test/java/org/trellisldp/webac/WebAcFilterTest.java index cb544d994..b4770ce65 100644 --- a/components/webac/src/test/java/org/trellisldp/webac/WebAcFilterTest.java +++ b/components/webac/src/test/java/org/trellisldp/webac/WebAcFilterTest.java @@ -87,16 +87,16 @@ class WebAcFilterTest { @BeforeAll static void setUpProperties() { - System.setProperty(WebAcFilter.CONFIG_WEBAC_METHOD_READABLE, "READ"); - System.setProperty(WebAcFilter.CONFIG_WEBAC_METHOD_WRITABLE, "WRITE"); - System.setProperty(WebAcFilter.CONFIG_WEBAC_METHOD_APPENDABLE, "APPEND"); + System.setProperty(WebAcFilter.CONFIG_WEBAC_READABLE_METHODS, "READ"); + System.setProperty(WebAcFilter.CONFIG_WEBAC_WRITABLE_METHODS, "WRITE"); + System.setProperty(WebAcFilter.CONFIG_WEBAC_APPENDABLE_METHODS, "APPEND"); } @AfterAll static void cleanUpProperties() { - System.clearProperty(WebAcFilter.CONFIG_WEBAC_METHOD_READABLE); - System.clearProperty(WebAcFilter.CONFIG_WEBAC_METHOD_WRITABLE); - System.clearProperty(WebAcFilter.CONFIG_WEBAC_METHOD_APPENDABLE); + System.clearProperty(WebAcFilter.CONFIG_WEBAC_READABLE_METHODS); + System.clearProperty(WebAcFilter.CONFIG_WEBAC_WRITABLE_METHODS); + System.clearProperty(WebAcFilter.CONFIG_WEBAC_APPENDABLE_METHODS); } @BeforeEach diff --git a/components/webac/src/test/resources/META-INF/microprofile-config.properties b/components/webac/src/test/resources/META-INF/microprofile-config.properties index d3a109c5a..8738c7e41 100644 --- a/components/webac/src/test/resources/META-INF/microprofile-config.properties +++ b/components/webac/src/test/resources/META-INF/microprofile-config.properties @@ -1 +1 @@ -trellis.webac.membership.check=true +trellis.webac.membership-check=true diff --git a/core/http/src/main/java/org/trellisldp/http/CacheControlFilter.java b/core/http/src/main/java/org/trellisldp/http/CacheControlFilter.java index 3de34e425..f9c6cd481 100644 --- a/core/http/src/main/java/org/trellisldp/http/CacheControlFilter.java +++ b/core/http/src/main/java/org/trellisldp/http/CacheControlFilter.java @@ -38,11 +38,11 @@ public class CacheControlFilter implements ContainerResponseFilter { /** The configuration key for setting a cache-control max-age header. */ - public static final String CONFIG_HTTP_CACHE_AGE = "trellis.http.cache.maxage"; + public static final String CONFIG_HTTP_CACHE_MAX_AGE = "trellis.http.cache-max-age"; /** The configuration key for setting a cache-control must-revalidate header. */ - public static final String CONFIG_HTTP_CACHE_REVALIDATE = "trellis.http.cache.revalidate"; + public static final String CONFIG_HTTP_CACHE_REVALIDATE = "trellis.http.cache-revalidate"; /** The configuration key for setting a cache-control no-cache header. */ - public static final String CONFIG_HTTP_CACHE_NOCACHE = "trellis.http.cache.nocache"; + public static final String CONFIG_HTTP_CACHE_NOCACHE = "trellis.http.cache-nocache"; private final int cacheAge; private final boolean revalidate; @@ -57,7 +57,7 @@ public CacheControlFilter() { } private CacheControlFilter(final Config config) { - this(config.getOptionalValue(CONFIG_HTTP_CACHE_AGE, Integer.class).orElse(86400), + this(config.getOptionalValue(CONFIG_HTTP_CACHE_MAX_AGE, Integer.class).orElse(86400), config.getOptionalValue(CONFIG_HTTP_CACHE_REVALIDATE, Boolean.class).orElse(Boolean.TRUE), config.getOptionalValue(CONFIG_HTTP_CACHE_NOCACHE, Boolean.class).orElse(Boolean.FALSE)); } diff --git a/core/http/src/main/java/org/trellisldp/http/WebSubHeaderFilter.java b/core/http/src/main/java/org/trellisldp/http/WebSubHeaderFilter.java index 6d00b5616..9c98b5c6d 100644 --- a/core/http/src/main/java/org/trellisldp/http/WebSubHeaderFilter.java +++ b/core/http/src/main/java/org/trellisldp/http/WebSubHeaderFilter.java @@ -36,7 +36,7 @@ public class WebSubHeaderFilter implements ContainerResponseFilter { /** The configuration key controlling the location of a web-sub-hub. */ - public static final String CONFIG_HTTP_WEB_SUB_HUB = "trellis.http.websubhub"; + public static final String CONFIG_HTTP_WEB_SUB_HUB = "trellis.http.web-sub-hub"; private final String hub; diff --git a/core/http/src/main/java/org/trellisldp/http/core/HttpConstants.java b/core/http/src/main/java/org/trellisldp/http/core/HttpConstants.java index 9ca86bba7..eabdc9077 100644 --- a/core/http/src/main/java/org/trellisldp/http/core/HttpConstants.java +++ b/core/http/src/main/java/org/trellisldp/http/core/HttpConstants.java @@ -53,28 +53,28 @@ public final class HttpConstants { public static final String APPLICATION_LINK_FORMAT = "application/link-format"; /** Configuration key defining the server's base URL. */ - public static final String CONFIG_HTTP_BASE_URL = "trellis.http.baseUrl"; + public static final String CONFIG_HTTP_BASE_URL = "trellis.http.base-url"; /** Configuration key defining the extension graph mapping. */ - public static final String CONFIG_HTTP_EXTENSION_GRAPHS = "trellis.http.extension.graphs"; + public static final String CONFIG_HTTP_EXTENSION_GRAPHS = "trellis.http.extension-graphs"; /** Configuration key defining whether to include dates in memento headers. */ - public static final String CONFIG_HTTP_MEMENTO_HEADER_DATES = "trellis.http.memento.headerdates"; + public static final String CONFIG_HTTP_MEMENTO_HEADER_DATES = "trellis.http.memento-header-dates"; /** Configuration key defining whether to use weak ETags for RDF responses. */ - public static final String CONFIG_HTTP_WEAK_ETAG = "trellis.http.weak.etag"; + public static final String CONFIG_HTTP_WEAK_ETAG = "trellis.http.weak-etag"; /** Configuration key defining the default JSON-LD profile. */ - public static final String CONFIG_HTTP_JSONLD_PROFILE = "trellis.http.jsonld.profile"; + public static final String CONFIG_HTTP_JSONLD_PROFILE = "trellis.http.jsonld-profile"; /** Configuration key defining whether to require precondition headers for PUT operations. */ - public static final String CONFIG_HTTP_PRECONDITION_REQUIRED = "trellis.http.precondition.required"; + public static final String CONFIG_HTTP_PRECONDITION_REQUIRED = "trellis.http.precondition-required"; /** Configuration key defining whether PATCH requests can create resources. */ - public static final String CONFIG_HTTP_PATCH_CREATE = "trellis.http.patch.create"; + public static final String CONFIG_HTTP_PATCH_CREATE = "trellis.http.patch-create"; /** Configuration key defining whether PUT-on-create generates contained or uncontained resources. */ - public static final String CONFIG_HTTP_PUT_UNCONTAINED = "trellis.http.put.uncontained"; + public static final String CONFIG_HTTP_PUT_UNCONTAINED = "trellis.http.put-uncontained"; /** The Trellis query parameter for extended features of a given resource. */ public static final String EXT = "ext"; diff --git a/core/http/src/test/resources/META-INF/microprofile-config.properties b/core/http/src/test/resources/META-INF/microprofile-config.properties index 0c9aced76..3b79e2d94 100644 --- a/core/http/src/test/resources/META-INF/microprofile-config.properties +++ b/core/http/src/test/resources/META-INF/microprofile-config.properties @@ -1,3 +1,2 @@ -trellis.http.baseUrl=http://example.org/ -trellis.http.agent.adminusers=https://example.com/admin +trellis.http.base-url=http://example.org/ diff --git a/notifications/amqp/src/main/java/org/trellisldp/amqp/AmqpEventService.java b/notifications/amqp/src/main/java/org/trellisldp/amqp/AmqpEventService.java index f477eaa36..007927447 100644 --- a/notifications/amqp/src/main/java/org/trellisldp/amqp/AmqpEventService.java +++ b/notifications/amqp/src/main/java/org/trellisldp/amqp/AmqpEventService.java @@ -41,10 +41,10 @@ public class AmqpEventService implements EventService { private static final Logger LOGGER = getLogger(AmqpEventService.class); /** The configuration key controlling the AMQP exchange name. */ - public static final String CONFIG_AMQP_EXCHANGE_NAME = "trellis.amqp.exchangename"; + public static final String CONFIG_AMQP_EXCHANGE_NAME = "trellis.amqp.exchange-name"; /** The configuration key controlling the AMQP routing key. */ - public static final String CONFIG_AMQP_ROUTING_KEY = "trellis.amqp.routingkey"; + public static final String CONFIG_AMQP_ROUTING_KEY = "trellis.amqp.routing-key"; /** The configuration key controlling whether publishing is mandatory. */ public static final String CONFIG_AMQP_MANDATORY = "trellis.amqp.mandatory"; diff --git a/notifications/amqp/src/test/resources/META-INF/microprofile-config.properties b/notifications/amqp/src/test/resources/META-INF/microprofile-config.properties index 2a56266d2..e2186c277 100644 --- a/notifications/amqp/src/test/resources/META-INF/microprofile-config.properties +++ b/notifications/amqp/src/test/resources/META-INF/microprofile-config.properties @@ -1,2 +1,2 @@ -trellis.amqp.exchangename=exchange -trellis.amqp.routingkey=queue +trellis.amqp.exchange-name=exchange +trellis.amqp.routing-key=queue diff --git a/notifications/jms/src/main/java/org/trellisldp/jms/JmsEventService.java b/notifications/jms/src/main/java/org/trellisldp/jms/JmsEventService.java index c596b4537..a62120b84 100644 --- a/notifications/jms/src/main/java/org/trellisldp/jms/JmsEventService.java +++ b/notifications/jms/src/main/java/org/trellisldp/jms/JmsEventService.java @@ -39,7 +39,7 @@ public class JmsEventService implements EventService { /** The configuration key controlling the JMS queue name. */ - public static final String CONFIG_JMS_QUEUE_NAME = "trellis.jms.queue"; + public static final String CONFIG_JMS_QUEUE_NAME = "trellis.jms.queue-name"; /** The configuration key controlling the JMS broker URL. */ public static final String CONFIG_JMS_URL = "trellis.jms.url"; @@ -51,7 +51,7 @@ public class JmsEventService implements EventService { public static final String CONFIG_JMS_PASSWORD = "trellis.jms.password"; /** The configuration key controlling whether to use a topic or queue. */ - public static final String CONFIG_JMS_USE_QUEUE = "trellis.jms.use.queue"; + public static final String CONFIG_JMS_USE_QUEUE = "trellis.jms.use-queue"; private static final Logger LOGGER = getLogger(JmsEventService.class); diff --git a/notifications/jms/src/test/resources/META-INF/microprofile-config.properties b/notifications/jms/src/test/resources/META-INF/microprofile-config.properties index 6ded81429..2bc024492 100644 --- a/notifications/jms/src/test/resources/META-INF/microprofile-config.properties +++ b/notifications/jms/src/test/resources/META-INF/microprofile-config.properties @@ -1,2 +1,2 @@ -trellis.jms.queue=queue +trellis.jms.queue-name=queue trellis.jms.url=vm://localhost diff --git a/platform/openliberty/build.gradle b/platform/openliberty/build.gradle index 720d28883..af4668331 100644 --- a/platform/openliberty/build.gradle +++ b/platform/openliberty/build.gradle @@ -80,11 +80,9 @@ liberty { configFile = file("src/main/liberty/config/server.xml") bootstrapProperties = ['default.http.port': testServerHttpPort, 'default.https.port': testServerHttpsPort, - 'trellis.namespaces.path': "data/namespaces.json", - 'trellis.triplestore.rdf.location': 'data/resources', - 'trellis.file.memento.basepath': 'data/mementos', - 'trellis.file.binary.basepath': 'data/binary', - + 'trellis.triplestore.rdf-location': 'data/resources', + 'trellis.file.memento-path': 'data/mementos', + 'trellis.file.binary-path': 'data/binary', 'app.context.root': warContext] packageLiberty { archive = "$buildDir/${appName}.zip" diff --git a/platform/quarkus/build.gradle b/platform/quarkus/build.gradle index 4e8504b1c..3662fdf5d 100644 --- a/platform/quarkus/build.gradle +++ b/platform/quarkus/build.gradle @@ -68,10 +68,10 @@ dependencies { test { systemProperty 'com.arjuna.ats.arjuna.objectstore.objectStoreDir', "$buildDir/data/ObjectStore" - systemProperty 'trellis.file.binary.basepath', "$buildDir/data/binaries" - systemProperty 'trellis.file.memento.basepath', "$buildDir/data/mementos" - systemProperty 'trellis.triplestore.rdf.location', "$buildDir/data/rdf" - systemProperty 'trellis.namespace.prefixes', 'dc11=http://purl.org/dc/elements/1.1/,,foo= , =bar,baz, = ' + systemProperty 'trellis.file.binary-path', "$buildDir/data/binaries" + systemProperty 'trellis.file.memento-path', "$buildDir/data/mementos" + systemProperty 'trellis.triplestore.rdf-location', "$buildDir/data/rdf" + systemProperty 'trellis.namespaces.mapping', 'dc11=http://purl.org/dc/elements/1.1/,,foo= , =bar,baz, = ' systemProperty 'mp.jwt.verify.publickey.location', 'https://www.trellisldp.org/tests/jwks.json' } diff --git a/platform/quarkus/src/main/java/org/trellisldp/quarkus/AuthorizationCache.java b/platform/quarkus/src/main/java/org/trellisldp/quarkus/AuthorizationCache.java index 057b05d57..2fc0c81d5 100644 --- a/platform/quarkus/src/main/java/org/trellisldp/quarkus/AuthorizationCache.java +++ b/platform/quarkus/src/main/java/org/trellisldp/quarkus/AuthorizationCache.java @@ -35,10 +35,10 @@ public class AuthorizationCache extends TrellisCache> { /** The configuration key for setting the maximum authZ cache size. */ - public static final String CONFIG_AUTHZ_CACHE_SIZE = "trellis.authz.cache.size"; + public static final String CONFIG_QUARKUS_AUTHZ_CACHE_SIZE = "trellis.quarkus.authz-cache-size"; /** The configuration key for setting the authZ cache expiry. */ - public static final String CONFIG_AUTHZ_CACHE_EXPIRE_SECONDS = "trellis.authz.cache.expireSeconds"; + public static final String CONFIG_QUARKUS_AUTHZ_CACHE_EXPIRE_SECONDS = "trellis.quarkus.authz-cache-expire-seconds"; /** Create a cache suitable for authorization data. */ public AuthorizationCache() { @@ -46,8 +46,9 @@ public AuthorizationCache() { } private static Cache> buildCache(final Config config) { - final int size = config.getOptionalValue(CONFIG_AUTHZ_CACHE_SIZE, Integer.class).orElse(1000); - final int expire = config.getOptionalValue(CONFIG_AUTHZ_CACHE_EXPIRE_SECONDS, Integer.class).orElse(600); + final int size = config.getOptionalValue(CONFIG_QUARKUS_AUTHZ_CACHE_SIZE, Integer.class).orElse(1000); + final int expire = config.getOptionalValue(CONFIG_QUARKUS_AUTHZ_CACHE_EXPIRE_SECONDS, Integer.class) + .orElse(600); return newBuilder().maximumSize(size).expireAfterWrite(expire, SECONDS).build(); } } diff --git a/platform/quarkus/src/main/java/org/trellisldp/quarkus/ProfileCache.java b/platform/quarkus/src/main/java/org/trellisldp/quarkus/ProfileCache.java index 77e157542..31fbe84d0 100644 --- a/platform/quarkus/src/main/java/org/trellisldp/quarkus/ProfileCache.java +++ b/platform/quarkus/src/main/java/org/trellisldp/quarkus/ProfileCache.java @@ -31,10 +31,10 @@ public class ProfileCache extends TrellisCache { /** A configuration key that sets the profile cache maximum size. */ - public static final String CONFIG_PROFILE_CACHE_SIZE = "trellis.profile.cache.size"; + public static final String CONFIG_QUARKUS_PROFILE_CACHE_SIZE = "trellis.quarkus.profile-cache-size"; /** A configuration key that sets the profile cache expiry time (in hours). */ - public static final String CONFIG_PROFILE_CACHE_EXPIRE_HOURS = "trellis.profile.cache.expireHours"; + public static final String CONFIG_QUARKUS_PROFILE_CACHE_EXPIRE_HOURS = "trellis.quarkus.profile-cache-expire-hours"; /** Create a cache suitable for JSON-LD profile requests. */ public ProfileCache() { @@ -42,8 +42,8 @@ public ProfileCache() { } private static Cache buildCache(final Config config) { - final int size = config.getOptionalValue(CONFIG_PROFILE_CACHE_SIZE, Integer.class).orElse(100); - final int expire = config.getOptionalValue(CONFIG_PROFILE_CACHE_EXPIRE_HOURS, Integer.class).orElse(24); + final int size = config.getOptionalValue(CONFIG_QUARKUS_PROFILE_CACHE_SIZE, Integer.class).orElse(100); + final int expire = config.getOptionalValue(CONFIG_QUARKUS_PROFILE_CACHE_EXPIRE_HOURS, Integer.class).orElse(24); return newBuilder().maximumSize(size).expireAfterWrite(expire, HOURS).build(); } } diff --git a/platform/quarkus/src/main/resources/application.properties b/platform/quarkus/src/main/resources/application.properties index 0c4e2c85a..f4cb041ad 100644 --- a/platform/quarkus/src/main/resources/application.properties +++ b/platform/quarkus/src/main/resources/application.properties @@ -1,15 +1,14 @@ # Trellis Triplestore -trellis.triplestore.ldp.type=true -trellis.triplestore.rdf.location=data/rdf +trellis.triplestore.ldp-type=true +trellis.triplestore.rdf-location=data/rdf # Trellis Auth trellis.auth.realm=trellis -trellis.auth.oauth.jwk= -trellis.auth.adminusers= +trellis.auth.admin-users= # Trellis JSON-LD -trellis.io.jsonld.profiles= -trellis.io.jsonld.domains= +trellis.io.jsonld-profiles= +trellis.io.jsonld-domains= # Trellis RDFa trellis.rdfa.template= @@ -22,31 +21,31 @@ trellis.webac.challenges=Bearer trellis.webac.realm=trellis # Trellis HTTP -trellis.http.baseUrl= -trellis.http.cache.maxage= -trellis.http.cache.nocache= -trellis.http.cache.revalidate= -trellis.http.extension.graphs= -trellis.http.memento.headerdates=true -trellis.http.jsonld.profile= -trellis.http.precondition.required=false -trellis.http.patch.create=true -trellis.http.put.uncontained=false -trellis.http.weak.etag=false -trellis.http.websubhub= +trellis.http.base-url= +trellis.http.cache-max-age= +trellis.http.cache-nocache= +trellis.http.cache-revalidate= +trellis.http.extension-graphs= +trellis.http.memento-header-dates=true +trellis.http.jsonld-profile= +trellis.http.precondition-required=false +trellis.http.patch-create=true +trellis.http.put-uncontained=false +trellis.http.weak-etag=false +trellis.http.web-sub-hub= # Trellis cache -trellis.profile.cache.size=100 -trellis.profile.cache.expireHours=24 -trellis.authz.cache.size=1000 -trellis.authz.cache.expireSeconds=600 +trellis.quarkus.profile-cache-size=100 +trellis.quarkus.profile-cache-expire-hours=24 +trellis.quarkus.authz-cache-size=1000 +trellis.quarkus.authz-cache-expire-seconds=600 # Trellis namespaces -trellis.namespace.prefixes= +trellis.namespaces.mapping= # Trellis file -trellis.file.binary.basepath=data/binaries -trellis.file.memento.basepath=data/mementos +trellis.file.binary-path=data/binaries +trellis.file.memento-path=data/mementos # CORS quarkus.http.cors=true diff --git a/platform/quarkus/src/test/resources/namespaces.json b/platform/quarkus/src/test/resources/namespaces.json deleted file mode 100644 index 45630f206..000000000 --- a/platform/quarkus/src/test/resources/namespaces.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "acl" : "http://www.w3.org/ns/auth/acl#", - "as" : "https://www.w3.org/ns/activitystreams#", - "dc" : "http://purl.org/dc/terms/", - "dc11" : "http://purl.org/dc/elements/1.1/", - "geo" : "http://www.w3.org/2003/01/geo/wgs84_pos#", - "ldp" : "http://www.w3.org/ns/ldp#", - "memento" : "http://mementoweb.org/ns#", - "owl" : "http://www.w3.org/2002/07/owl#", - "prov" : "http://www.w3.org/ns/prov#", - "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", - "schema" : "http://schema.org/", - "skos" : "http://www.w3.org/2004/02/skos/core#", - "time" : "http://www.w3.org/2006/time#" , - "xsd" : "http://www.w3.org/2001/XMLSchema#" -} -