Skip to content

Commit

Permalink
cleanup all rio settings that should have used one of the specialized…
Browse files Browse the repository at this point in the history
… impelementations that supports overriding with system property
  • Loading branch information
hmottestad committed Jun 19, 2024
1 parent 689d1eb commit 4773b78
Show file tree
Hide file tree
Showing 27 changed files with 165 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
package org.eclipse.rdf4j.query.resultio;

import org.eclipse.rdf4j.rio.RioSetting;
import org.eclipse.rdf4j.rio.helpers.BooleanRioSetting;
import org.eclipse.rdf4j.rio.helpers.RioSettingImpl;
import org.eclipse.rdf4j.rio.helpers.StringRioSetting;

/**
* {@link RioSetting} constants to use with {@link QueryResultWriter}s.
Expand All @@ -26,7 +28,7 @@ public class BasicQueryWriterSettings {
* <p>
* Defaults to false.
*/
public final static RioSetting<Boolean> ADD_SESAME_QNAME = new RioSettingImpl<>(
public final static BooleanRioSetting ADD_SESAME_QNAME = new BooleanRioSetting(
"org.eclipse.rdf4j.query.resultio.addsesameqname", "Add Sesame QName", false);

/**
Expand All @@ -35,7 +37,7 @@ public class BasicQueryWriterSettings {
* <p>
* Defaults to "sesamecallback".
*/
public static final RioSetting<String> JSONP_CALLBACK = new RioSettingImpl<>(
public static final StringRioSetting JSONP_CALLBACK = new StringRioSetting(
"org.eclipse.rdf4j.query.resultio.jsonpcallback", "JSONP callback function", "sesamecallback");

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.eclipse.rdf4j.repository.http.HTTPRepository;
import org.eclipse.rdf4j.rio.RioSetting;
import org.eclipse.rdf4j.rio.helpers.IntegerRioSetting;
import org.eclipse.rdf4j.rio.helpers.RioSettingImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -31,7 +32,7 @@ public class HTTPRepositorySettings {
* By default inner buffers within {@link org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection} keep in memory
* up to 200000 statement before they are flushed to the remote repository.
*/
public static final RioSetting<Integer> MAX_STATEMENT_BUFFER_SIZE = new RioSettingImpl<>(
public static final IntegerRioSetting MAX_STATEMENT_BUFFER_SIZE = new IntegerRioSetting(
"org.eclipse.rdf4j.http.maxstatementbuffersize", "Maximum number of statement buffered in memory", 200000);

}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.verify_datatype_values}.
*/
public static final RioSetting<Boolean> VERIFY_DATATYPE_VALUES = new BooleanRioSetting(
public static final BooleanRioSetting VERIFY_DATATYPE_VALUES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.verify_datatype_values", "Verify recognised datatype values", Boolean.FALSE);

/**
Expand All @@ -58,7 +58,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.fail_on_unknown_datatypes}.
*/
public static final RioSetting<Boolean> FAIL_ON_UNKNOWN_DATATYPES = new BooleanRioSetting(
public static final BooleanRioSetting FAIL_ON_UNKNOWN_DATATYPES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.fail_on_unknown_datatypes", "Fail on unknown datatypes", Boolean.FALSE);

/**
Expand All @@ -70,7 +70,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.normalize_datatype_values}.
*/
public static final RioSetting<Boolean> NORMALIZE_DATATYPE_VALUES = new BooleanRioSetting(
public static final BooleanRioSetting NORMALIZE_DATATYPE_VALUES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.normalize_datatype_values", "Normalize recognised datatype values", Boolean.FALSE);

/**
Expand All @@ -91,7 +91,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.fail_on_unknown_languages}.
*/
public static final RioSetting<Boolean> FAIL_ON_UNKNOWN_LANGUAGES = new BooleanRioSetting(
public static final BooleanRioSetting FAIL_ON_UNKNOWN_LANGUAGES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.fail_on_unknown_languages", "Fail on unknown languages", Boolean.FALSE);

/**
Expand All @@ -104,7 +104,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.verify_language_tags}.
*/
public static final RioSetting<Boolean> VERIFY_LANGUAGE_TAGS = new BooleanRioSetting(
public static final BooleanRioSetting VERIFY_LANGUAGE_TAGS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.verify_language_tags", "Verify language tags", Boolean.TRUE);

/**
Expand All @@ -116,7 +116,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.normalize_language_tags}.
*/
public static final RioSetting<Boolean> NORMALIZE_LANGUAGE_TAGS = new BooleanRioSetting(
public static final BooleanRioSetting NORMALIZE_LANGUAGE_TAGS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.normalize_language_tags", "Normalize recognised language tags", Boolean.FALSE);

/**
Expand All @@ -134,7 +134,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.verify_relative_uris}.
*/
public static final RioSetting<Boolean> VERIFY_RELATIVE_URIS = new BooleanRioSetting(
public static final BooleanRioSetting VERIFY_RELATIVE_URIS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.verify_relative_uris", "Verify relative URIs", Boolean.TRUE);

/**
Expand All @@ -145,7 +145,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.verify_uri_syntax}.
*/
public static final RioSetting<Boolean> VERIFY_URI_SYNTAX = new BooleanRioSetting(
public static final BooleanRioSetting VERIFY_URI_SYNTAX = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.verify_uri_syntax", "Verify URI syntax", Boolean.TRUE);

/**
Expand All @@ -156,7 +156,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.preserve_bnode_ids}.
*/
public static final RioSetting<Boolean> PRESERVE_BNODE_IDS = new BooleanRioSetting(
public static final BooleanRioSetting PRESERVE_BNODE_IDS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.preserve_bnode_ids", "Preserve blank node identifiers", Boolean.FALSE);

/**
Expand All @@ -168,7 +168,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.skolem_origin}.
*/
public static final RioSetting<String> SKOLEMIZE_ORIGIN = new StringRioSetting(
public static final StringRioSetting SKOLEMIZE_ORIGIN = new StringRioSetting(
"org.eclipse.rdf4j.rio.skolem_origin",
"Replace blank nodes with well known genid IRIs using this scheme and authority", null);

Expand Down Expand Up @@ -197,7 +197,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.large_literals_limit}.
*/
public static final RioSetting<Long> LARGE_LITERALS_LIMIT = new LongRioSetting(
public static final LongRioSetting LARGE_LITERALS_LIMIT = new LongRioSetting(
"org.eclipse.rdf4j.rio.large_literals_limit", "Size limit for large literals", 1048576L);

/**
Expand Down Expand Up @@ -227,7 +227,7 @@ public class BasicParserSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.process_encoded_rdf_star}.
*/
public static final RioSetting<Boolean> PROCESS_ENCODED_RDF_STAR = new BooleanRioSetting(
public static final BooleanRioSetting PROCESS_ENCODED_RDF_STAR = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.process_encoded_rdf_star",
"Converts RDF-star triples encoded as RDF-compatible IRIs back to triple values", Boolean.TRUE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class BasicWriterSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.pretty_print}.
*/
public static final RioSetting<Boolean> PRETTY_PRINT = new BooleanRioSetting("org.eclipse.rdf4j.rio.pretty_print",
public static final BooleanRioSetting PRETTY_PRINT = new BooleanRioSetting("org.eclipse.rdf4j.rio.pretty_print",
"Pretty print", Boolean.TRUE);

/**
Expand All @@ -42,7 +42,7 @@ public class BasicWriterSettings {
*
* @since 2.3
*/
public static final RioSetting<Boolean> INLINE_BLANK_NODES = new BooleanRioSetting(
public static final BooleanRioSetting INLINE_BLANK_NODES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.inline_blank_nodes",
"Use blank node property lists, collections, and anonymous nodes instead of blank node labels",
Boolean.FALSE);
Expand All @@ -57,7 +57,7 @@ public class BasicWriterSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.rdf10_plain_literals}.
*/
public static final RioSetting<Boolean> XSD_STRING_TO_PLAIN_LITERAL = new BooleanRioSetting(
public static final BooleanRioSetting XSD_STRING_TO_PLAIN_LITERAL = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.rdf10_plain_literals", "RDF-1.0 compatible Plain Literals", Boolean.TRUE);

/**
Expand All @@ -78,7 +78,7 @@ public class BasicWriterSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.rdf10_language_literals}.
*/
public static final RioSetting<Boolean> RDF_LANGSTRING_TO_LANG_LITERAL = new BooleanRioSetting(
public static final BooleanRioSetting RDF_LANGSTRING_TO_LANG_LITERAL = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.rdf10_language_literals", "RDF-1.0 compatible Language Literals", Boolean.TRUE);

/**
Expand All @@ -88,7 +88,7 @@ public class BasicWriterSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.base_directive}.
*/
public static final RioSetting<Boolean> BASE_DIRECTIVE = new BooleanRioSetting(
public static final BooleanRioSetting BASE_DIRECTIVE = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.base_directive", "Serialize base directive", Boolean.TRUE);

/**
Expand All @@ -99,7 +99,7 @@ public class BasicWriterSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.convert_rdf_star}.
*/
public static final RioSetting<Boolean> CONVERT_RDF_STAR_TO_REIFICATION = new BooleanRioSetting(
public static final BooleanRioSetting CONVERT_RDF_STAR_TO_REIFICATION = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.convert_rdf_star", "Convert RDF-star statements to RDF reification", Boolean.FALSE);

/**
Expand All @@ -113,7 +113,7 @@ public class BasicWriterSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.encode_rdf_star}.
*/
public static final RioSetting<Boolean> ENCODE_RDF_STAR = new BooleanRioSetting(
public static final BooleanRioSetting ENCODE_RDF_STAR = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.encode_rdf_star",
"Encodes RDF-star triples to special IRIs for compatibility with RDF", Boolean.TRUE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class BinaryRDFWriterSettings {
* @deprecated Use {@link org.eclipse.rdf4j.rio.binary.BinaryRDFWriterSettings#VERSION} instead.
*/
@Deprecated(since = "4.3.0", forRemoval = true)
public static final RioSetting<Long> VERSION = new LongRioSetting(
public static final LongRioSetting VERSION = new LongRioSetting(
"org.eclipse.rdf4j.rio.binary.format_version", "Binary RDF format", 2L);

/**
Expand All @@ -46,7 +46,7 @@ public class BinaryRDFWriterSettings {
* @deprecated Use {@link org.eclipse.rdf4j.rio.binary.BinaryRDFWriterSettings#BUFFER_SIZE} instead.
*/
@Deprecated(since = "4.3.0", forRemoval = true)
public static final RioSetting<Long> BUFFER_SIZE = new LongRioSetting(
public static final LongRioSetting BUFFER_SIZE = new LongRioSetting(
"org.eclipse.rdf4j.rio.binary.buffer_size", "Buffer size", 8192L);

/**
Expand All @@ -60,7 +60,7 @@ public class BinaryRDFWriterSettings {
* @deprecated Use {@link org.eclipse.rdf4j.rio.binary.BinaryRDFWriterSettings#CHARSET} instead.
*/
@Deprecated(since = "4.3.0", forRemoval = true)
public static final RioSetting<String> CHARSET = new StringRioSetting(
public static final StringRioSetting CHARSET = new StringRioSetting(
"org.eclipse.rdf4j.rio.binary.charset", "Charset", StandardCharsets.UTF_8.name());

/**
Expand All @@ -81,7 +81,7 @@ public class BinaryRDFWriterSettings {
* @deprecated Use {@link org.eclipse.rdf4j.rio.binary.BinaryRDFWriterSettings#RECYCLE_IDS} instead.
*/
@Deprecated(since = "4.3.0", forRemoval = true)
public static final RioSetting<Boolean> RECYCLE_IDS = new BooleanRioSetting(
public static final BooleanRioSetting RECYCLE_IDS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.binary.recycle_ids", "Charset", true);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*******************************************************************************
* Copyright (c) 2024 Eclipse RDF4J contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
package org.eclipse.rdf4j.rio.helpers;

import org.eclipse.rdf4j.rio.RioSetting;

/**
* A {@link RioSetting} with a {@link Integer} value. The given default for the setting can be overridden by means of a
* system property with a name equal to the setting key.
*
* @author Håvard M. Ottestad
*/
public class IntegerRioSetting extends AbstractRioSetting<Integer> {

private static final long serialVersionUID = -5945095126593465950L;

public IntegerRioSetting(String key, String description, Integer defaultValue) {
super(key, description, defaultValue);
}

@Override
public Integer convert(String stringValue) {
try {
return Integer.parseInt(stringValue);
} catch (NumberFormatException e) {
throw new RioConfigurationException("Conversion error for setting: " + getKey(), e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class JSONSettings {
* Can be overridden by setting system property
* {@code org.eclipse.rdf4j.rio.json.allow_backslash_escaping_any_character}.
*/
public static final RioSetting<Boolean> ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_backslash_escaping_any_character",
"Allow backslash escaping any character", Boolean.FALSE);

Expand All @@ -40,7 +40,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_comments}.
*/
public static final RioSetting<Boolean> ALLOW_COMMENTS = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_COMMENTS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_comments", "Allow comments", Boolean.FALSE);

/**
Expand All @@ -50,7 +50,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_non_numeric_numbers}.
*/
public static final RioSetting<Boolean> ALLOW_NON_NUMERIC_NUMBERS = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_NON_NUMERIC_NUMBERS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_non_numeric_numbers", "Allow non-numeric numbers", Boolean.FALSE);

/**
Expand All @@ -60,7 +60,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_numeric_leading_zeros}.
*/
public static final RioSetting<Boolean> ALLOW_NUMERIC_LEADING_ZEROS = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_NUMERIC_LEADING_ZEROS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_numeric_leading_zeros", "Allow numeric leading zeros", Boolean.FALSE);

/**
Expand All @@ -70,7 +70,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_single_quotes}.
*/
public static final RioSetting<Boolean> ALLOW_SINGLE_QUOTES = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_SINGLE_QUOTES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_single_quotes", "Allow single quotes", Boolean.FALSE);

/**
Expand All @@ -80,7 +80,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_unquoted_control_chars}.
*/
public static final RioSetting<Boolean> ALLOW_UNQUOTED_CONTROL_CHARS = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_UNQUOTED_CONTROL_CHARS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_unquoted_control_chars", "Allow unquoted control chars", Boolean.FALSE);

/**
Expand All @@ -90,7 +90,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_unquoted_field_names}.
*/
public static final RioSetting<Boolean> ALLOW_UNQUOTED_FIELD_NAMES = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_UNQUOTED_FIELD_NAMES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_unquoted_field_names", "Allow unquoted field names", Boolean.FALSE);

/**
Expand All @@ -100,7 +100,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_yaml_comments}.
*/
public static final RioSetting<Boolean> ALLOW_YAML_COMMENTS = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_YAML_COMMENTS = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_yaml_comments", "Allow YAML comments", Boolean.FALSE);

/**
Expand All @@ -110,7 +110,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.allow_trailing_comma}.
*/
public static final RioSetting<Boolean> ALLOW_TRAILING_COMMA = new BooleanRioSetting(
public static final BooleanRioSetting ALLOW_TRAILING_COMMA = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.allow_trailing_comma", "Allow trailing comma", Boolean.FALSE);

/**
Expand All @@ -120,7 +120,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.include_source_in_location}.
*/
public static final RioSetting<Boolean> INCLUDE_SOURCE_IN_LOCATION = new BooleanRioSetting(
public static final BooleanRioSetting INCLUDE_SOURCE_IN_LOCATION = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.include_source_in_location", "Include Source in Location", Boolean.TRUE);

/**
Expand All @@ -131,7 +131,7 @@ public class JSONSettings {
* <p>
* Can be overridden by setting system property {@code org.eclipse.rdf4j.rio.json.strict_duplicate_detection}.
*/
public static final RioSetting<Boolean> STRICT_DUPLICATE_DETECTION = new BooleanRioSetting(
public static final BooleanRioSetting STRICT_DUPLICATE_DETECTION = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.json.strict_duplicate_detection", "Strict duplicate detection", Boolean.FALSE);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class NTriplesParserSettings {
* @deprecated Use {@link org.eclipse.rdf4j.rio.ntriples.NTriplesParserSettings#FAIL_ON_INVALID_LINES} instead.
*/
@Deprecated(since = "4.3.0", forRemoval = true)
public static final RioSetting<Boolean> FAIL_ON_INVALID_LINES = new BooleanRioSetting(
public static final BooleanRioSetting FAIL_ON_INVALID_LINES = new BooleanRioSetting(
"org.eclipse.rdf4j.rio.ntriples.fail_on_invalid_lines", "Fail on N-Triples invalid lines", Boolean.TRUE);

/**
Expand Down
Loading

0 comments on commit 4773b78

Please sign in to comment.