update to Java 17, update to Gradle 7.5

This commit is contained in:
Jörg Prante 2022-08-04 11:47:14 +02:00
parent 54b000429d
commit eb3a89ddfa
63 changed files with 363 additions and 352 deletions

View file

@ -8,7 +8,7 @@ plugins {
}
wrapper {
gradleVersion = "${rootProject.property('gradle.wrapper.version')}"
gradleVersion = libs.versions.gradle.get()
distributionType = Wrapper.DistributionType.ALL
}

View file

@ -179,12 +179,12 @@ public class ConfigParams implements Comparable<ConfigParams> {
fileLocations;
}
public static class SuffixedReader {
static class SuffixedReader {
Reader reader;
String suffix;
}
public static class JdbcLookup {
static class JdbcLookup {
Connection connection;
String statement;
String[] params;

View file

@ -2,6 +2,9 @@ package org.xbib.config;
public class NullConfigLogger implements ConfigLogger {
public NullConfigLogger() {
}
@Override
public void info(String string) {
}

View file

@ -2,6 +2,9 @@ package org.xbib.config;
public class SystemConfigLogger implements ConfigLogger {
public SystemConfigLogger() {
}
@Override
public void info(String string) {
System.err.println("info: " + string);

View file

@ -1,4 +1,4 @@
dependencies {
api project(':content-api')
api "com.fasterxml.jackson.core:jackson-core:${project.property('jackson.version')}"
api libs.jackson.core
}

View file

@ -12,6 +12,9 @@ public abstract class AbstractXContentGenerator implements XContentGenerator {
protected XContentGenerator generator;
public AbstractXContentGenerator() {
}
public AbstractXContentGenerator setGenerator(XContentGenerator generator) {
this.generator = generator;
return this;

View file

@ -6,19 +6,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*/
public abstract class AbstractXContentParser implements XContentParser {
//private static final MapFactory SIMPLE_MAP_FACTORY = HashMap::new;
//private static final MapFactory TINY_MAP_FACTORY = TinyMap::builder;
private boolean losslessDecimals;
private boolean base16Checks;
public AbstractXContentParser() {
}
protected abstract MapFactory getMapFactory();
protected abstract MapFactory getOrderedMapFactory();

View file

@ -22,6 +22,9 @@ public class XContentService {
}
}
private XContentService() {
}
public static XContentBuilder builder(String name) throws IOException {
return xcontents.containsKey(name) ? DefaultXContentBuilder.builder(xcontents.get(name)) : null;
}

View file

@ -1,7 +1,5 @@
dependencies {
api project(':content-core')
api "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}"
testImplementation("org.mockito:mockito-core:${project.property('mockito.version')}") {
exclude group: 'org.hamcrest'
}
api libs.jackson.databind
testImplementation libs.mockito.inline
}

View file

@ -7,7 +7,7 @@ module org.xbib.content.json {
exports org.xbib.content.json.mergepatch;
exports org.xbib.content.json.patch;
exports org.xbib.content.json.pointer;
requires org.xbib.content.core;
requires com.fasterxml.jackson.databind;
requires transitive org.xbib.content.core;
requires transitive com.fasterxml.jackson.databind;
provides XContent with org.xbib.content.json.JsonXContent;
}

View file

@ -23,6 +23,7 @@ import java.nio.charset.StandardCharsets;
public class JsonXContent implements XContent {
private static final JsonXContent jsonXContent;
private static final JsonFactory jsonFactory;
static {

View file

@ -3,6 +3,7 @@ package org.xbib.content.json.jackson;
import com.fasterxml.jackson.core.JsonLocation;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.io.ContentReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
@ -69,20 +70,8 @@ public final class JsonNodeReader {
* from the stream
*/
public JsonNode fromInputStream(final InputStream in) throws IOException {
JsonParser parser = null;
MappingIterator<JsonNode> iterator = null;
try {
parser = reader.getFactory().createParser(in);
iterator = reader.readValues(parser);
try (JsonParser parser = reader.getFactory().createParser(in); MappingIterator<JsonNode> iterator = reader.readValues(parser)) {
return readNode(iterator);
} finally {
if (parser != null) {
parser.close();
}
if (iterator != null) {
iterator.close();
}
}
}
@ -94,35 +83,21 @@ public final class JsonNodeReader {
* @throws java.io.IOException malformed input, or problem encountered when reading
* from the reader
*/
public JsonNode fromReader(final Reader r)
throws IOException {
JsonParser parser = null;
MappingIterator<JsonNode> iterator = null;
try {
parser = reader.getFactory().createParser(r);
iterator = reader.readValues(parser);
public JsonNode fromReader(final Reader r) throws IOException {
try (JsonParser parser = reader.getFactory().createParser(r); MappingIterator<JsonNode> iterator = reader.readValues(parser)) {
return readNode(iterator);
} finally {
if (parser != null) {
parser.close();
}
if (iterator != null) {
iterator.close();
}
}
}
/**
*
*/
private static final class JsonParseExceptionBuilder {
private JsonParser jsonParser;
private final JsonParser jsonParser;
private JsonLocation location;
private JsonParseExceptionBuilder(final JsonParser jsonParser, final Object source) {
this.jsonParser = jsonParser;
location = new JsonLocation(source, 0L, 1, 1);
location = new JsonLocation(ContentReference.construct(false, source), 0L, 1, 1);
}
private JsonParseExceptionBuilder setLocation(final JsonLocation location) {

View file

@ -17,6 +17,9 @@ import java.io.IOException;
* write our own here.
*/
public final class JsonMergePatchDeserializer extends JsonDeserializer<JsonMergePatch> {
public JsonMergePatchDeserializer() {}
@Override
public JsonMergePatch deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {

View file

@ -15,27 +15,24 @@ import java.io.Reader;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
/**
*
*/
public final class JsonNodeReaderTest {
@Test
public void streamIsClosedOnRead()
throws IOException {
final InputStream in = spy(new ByteArrayInputStream("[]".getBytes(StandardCharsets.UTF_8)));
public void streamIsClosedOnRead() throws IOException {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("[]".getBytes(StandardCharsets.UTF_8));
final InputStream in = spy(byteArrayInputStream);
final JsonNode node = new JsonNodeReader().fromInputStream(in);
verify(in).close();
assertEquals(node, new ObjectMapper().readTree(new ByteArrayInputStream("[]".getBytes("UTF-8"))));
assertEquals(node, new ObjectMapper().readTree(new ByteArrayInputStream("[]".getBytes(StandardCharsets.UTF_8))));
}
@Test
public void readerIsClosedOnRead()
throws IOException {
final Reader reader = spy(new StringReader("[]"));
public void readerIsClosedOnRead() throws IOException {
StringReader stringReader = new StringReader("[]");
final Reader reader = spy(stringReader);
final JsonNode node = new JsonNodeReader().fromReader(reader);
assertEquals(node, new ObjectMapper().readTree(new StringReader("[]")));
verify(reader).close();
assertEquals(node, new ObjectMapper().readTree(new StringReader("[]")));
}
@Test

View file

@ -10,7 +10,7 @@ module org.xbib.content.rdf {
exports org.xbib.content.rdf.io.turtle;
exports org.xbib.content.rdf.io.xml;
exports org.xbib.content.rdf.util;
requires org.xbib.content.resource;
requires org.xbib.content.xml;
requires org.xbib.content.json;
requires transitive org.xbib.content.resource;
requires transitive org.xbib.content.xml;
requires transitive org.xbib.content.json;
}

View file

@ -23,6 +23,9 @@ public class DefaultRdfGraph implements RdfGraph<RdfGraphParams> {
private final Map<IRI, Resource> resources = new LinkedHashMap<>();
public DefaultRdfGraph() {
}
@Override
public Iterator<Resource> getResources() {
return resources.values().stream().iterator();

View file

@ -10,6 +10,9 @@ import java.net.URLConnection;
*/
public abstract class BaseStreamProcessor {
public BaseStreamProcessor() {
}
protected abstract void startStream() throws IOException;
protected abstract void endStream() throws IOException;

View file

@ -1,97 +0,0 @@
package org.xbib.content.rdf.util;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
/**
* A {@link TreeMap} based multi map. The keys ore ordered.
* @param <K> te key type
* @param <V> the value type
*/
public class TreeMultiMap<K, V> implements MultiMap<K, V> {
private final Map<K, Set<V>> map = new TreeMap<>();
@Override
public int size() {
return map.size();
}
@Override
public void clear() {
map.clear();
}
@Override
public boolean isEmpty() {
return map.isEmpty();
}
@Override
public boolean containsKey(K key) {
return map.containsKey(key);
}
@Override
public Set<K> keySet() {
return map.keySet();
}
@Override
public boolean put(K key, V value) {
Set<V> set = map.get(key);
if (set == null) {
set = new LinkedHashSet<>();
set.add(value);
map.put(key, set);
return true;
} else {
set.add(value);
return false;
}
}
@Override
public void putAll(K key, Collection<V> values) {
Set<V> set = map.get(key);
if (set == null) {
set = new LinkedHashSet<>();
map.put(key, set);
}
set.addAll(values);
}
@Override
public Collection<V> get(K key) {
return map.get(key);
}
@Override
public Set<V> remove(K key) {
return map.remove(key);
}
@Override
public boolean remove(K key, V value) {
Set<V> set = map.get(key);
return set != null && set.remove(value);
}
@Override
public boolean equals(Object obj) {
return obj != null && obj instanceof TreeMultiMap && map.equals(((TreeMultiMap) obj).map);
}
@Override
public int hashCode() {
return map.hashCode();
}
@Override
public String toString() {
return map.toString();
}
}

View file

@ -5,9 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
/**
*
*/
public class MultiMapTest {
@Test
@ -23,19 +20,4 @@ public class MultiMapTest {
map.putAll("a", Arrays.asList("d", "e"));
assertEquals("[b, c, d, e]", map.get("a").toString());
}
@Test
public void testTreeMultiMap() {
TreeMultiMap<String, String> map = new TreeMultiMap<>();
map.put("a", "b");
map.put("b", "c");
map.put("a", "c");
assertTrue(map.containsKey("a"));
assertTrue(map.containsKey("b"));
assertEquals("[a, b]", map.keySet().toString());
assertEquals("[b, c]", map.get("a").toString());
assertEquals("[c]", map.get("b").toString());
map.putAll("a", Arrays.asList("d", "e"));
assertEquals("[b, c, d, e]", map.get("a").toString());
}
}

View file

@ -1,4 +1,4 @@
dependencies {
api "org.xbib:net-url:${project.property('xbib.net.version')}"
testImplementation "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}"
api libs.net
testImplementation libs.jackson.databind
}

View file

@ -1,5 +1,5 @@
module org.xbib.content.resource {
exports org.xbib.content.resource;
exports org.xbib.content.resource.text;
requires org.xbib.net.url;
requires transitive org.xbib.net.url;
}

View file

@ -1,4 +0,0 @@
/**
* Classes for content resources (resource identifiers, namespaces, schemes, uniform locations).
*/
package org.xbib.content.resource;

View file

@ -9,8 +9,12 @@ import java.util.NoSuchElementException;
public abstract class CodepointIterator implements Iterator<Codepoint> {
protected int position = -1;
protected int limit = -1;
public CodepointIterator() {
}
/**
* Get a CodepointIterator for the specified char array.
* @param array char array

View file

@ -1,4 +1,4 @@
dependencies {
api project(':content-core')
api "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${project.property('jackson.version')}"
api libs.jackson.dataformat.smile
}

View file

@ -1,7 +1,7 @@
dependencies {
api project(':content-core')
api project(':content-resource')
api "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${project.property('jackson.version')}"
runtimeOnly "com.fasterxml.woodstox:woodstox-core:${project.property('woodstox.version')}"
api libs.jackson.dataformat.xml
runtimeOnly libs.woodstox
testImplementation project(':content-json') // for XContentHelper reading JSON
}

View file

@ -10,6 +10,6 @@ module org.xbib.content.xml {
requires transitive org.xbib.content.core;
requires transitive org.xbib.content.resource;
requires transitive com.fasterxml.jackson.dataformat.xml;
requires com.fasterxml.jackson.core;
requires transitive com.fasterxml.jackson.core;
provides XContent with org.xbib.content.xml.XmlXContent;
}

View file

@ -4,11 +4,11 @@ import java.util.Iterator;
import javax.xml.namespace.NamespaceContext;
/**
*
*/
public class JsonNamespaceContext implements NamespaceContext {
public JsonNamespaceContext() {
}
@Override
public String getNamespaceURI(String prefix) {
throw new UnsupportedOperationException();

View file

@ -23,7 +23,7 @@ import javax.xml.transform.sax.SAXSource;
*/
public class JsonStylesheet {
private QName root = new QName("root");
private QName root;
private XmlNamespaceContext context;
@ -31,6 +31,10 @@ public class JsonStylesheet {
private String[] stylesheets;
public JsonStylesheet() {
this.root = new QName("root");
}
public JsonStylesheet root(QName root) {
this.root = root;
return this;

View file

@ -8,9 +8,6 @@ import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
/**
*
*/
public abstract class JsonReaderXmlEvent {
private Location location;
@ -21,6 +18,9 @@ public abstract class JsonReaderXmlEvent {
private List<Attribute> attributes;
public JsonReaderXmlEvent() {
}
protected void setQName(QName name) {
this.name = name;
}

View file

@ -17,12 +17,15 @@ import javax.xml.namespace.NamespaceContext;
*/
public class SimpleNamespaceContext implements NamespaceContext {
private Map<String, String> prefixToNamespaceUri = new HashMap<>();
private final Map<String, String> prefixToNamespaceUri = new HashMap<>();
private Map<String, List<String>> namespaceUriToPrefixes = new HashMap<>();
private final Map<String, List<String>> namespaceUriToPrefixes = new HashMap<>();
private String defaultNamespaceUri = "";
public SimpleNamespaceContext() {
}
@Override
public String getNamespaceURI(String prefix) {
if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {

View file

@ -13,6 +13,9 @@ public class XMLFilterImplEx extends XMLFilterImpl implements LexicalHandler {
protected boolean namespacePrefixes;
public XMLFilterImplEx() {
}
public boolean getNamespacePrefixes() {
return namespacePrefixes;
}

View file

@ -8,6 +8,9 @@ import javax.xml.transform.TransformerException;
*/
public class DefaultStylesheetErrorListener implements ErrorListener {
public DefaultStylesheetErrorListener() {
}
@Override
public void warning(TransformerException e) throws TransformerException {
//logger.log(Level.WARNING, "warning (recoverable): " + e.getMessage(), e);

View file

@ -1,6 +1,5 @@
package org.xbib.content.xml.transform;
import java.text.MessageFormat;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -21,6 +20,9 @@ public final class StylesheetPool {
*/
private final Map<String, Templates> stylesheets = new ConcurrentHashMap<>();
public StylesheetPool() {
}
/**
* @param transformerFactory transformer factory
* @return returns the identity transformer handler.

View file

@ -47,6 +47,9 @@ public class StylesheetTransformer implements Closeable {
private Result result;
public StylesheetTransformer() {
}
public StylesheetTransformer setPath(String... path) {
if (transformerFactory == null) {
transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();

View file

@ -9,6 +9,9 @@ import javax.xml.transform.TransformerException;
*/
public final class TransformerErrorListener implements ErrorListener {
public TransformerErrorListener() {
}
/**
* We store the exception internally as a workaround to xalan, which reports
* {@link javax.xml.transform.TransformerException} as {@link RuntimeException} (wrapped).

View file

@ -36,7 +36,7 @@ public class XML11Char {
/**
* Character flags for XML 1.1.
*/
private static final byte XML11CHARS[] = new byte[1 << 16];
private static final byte[] XML11CHARS = new byte[1 << 16];
static {
Arrays.fill(XML11CHARS, 1, 9, (byte) 17); // Fill 8 of value (byte) 17
@ -97,6 +97,9 @@ public class XML11Char {
Arrays.fill(XML11CHARS, 65008, 65534, (byte) -19); // Fill 526 of value (byte) -19
}
public XML11Char() {
}
/**
* Returns true if the specified character is a valid name start
* character as defined by production [4] in the XML 1.1

View file

@ -1,5 +1,5 @@
dependencies {
api project(':content-core')
api "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${project.property('jackson.version')}"
implementation "org.yaml:snakeyaml:${project.property('snakeyaml.version')}"
api libs.jackson.dataformat.yaml
implementation libs.snakeyaml
}

View file

@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets;
public class YamlXContent implements XContent {
private static final YamlXContent yamlXContent;
private static final YAMLFactory yamlFactory;
static {
@ -27,6 +28,9 @@ public class YamlXContent implements XContent {
yamlXContent = new YamlXContent();
}
public YamlXContent() {
}
public static YamlXContent yamlContent() {
return yamlXContent;
}

View file

@ -1,13 +1,5 @@
group = org.xbib
name = content
version = 4.0.0
version = 5.0.0
org.gradle.warning.mode = ALL
gradle.wrapper.version = 7.3.2
xbib.net.version = 2.1.1
xbib-datastructures.version = 1.0.0
jackson.version = 2.12.3
woodstox.version = 6.2.6
snakeyaml.version = 1.28
mockito.version = 3.10.0
asciidoclet.version = 1.5.6

View file

@ -1,6 +1,7 @@
apply plugin: "com.github.spotbugs"
spotbugs {
toolVersion = '4.7.1'
ignoreFailures = true
}

View file

@ -1,12 +1,8 @@
def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.7.2'
def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2'
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation libs.junit.jupiter.api
testImplementation libs.junit.jupiter.params
testImplementation libs.hamcrest
testRuntimeOnly libs.junit.jupiter.engine
}
test {

Binary file not shown.

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

275
gradlew vendored
View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -17,67 +17,101 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@ -106,80 +140,101 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

14
gradlew.bat vendored
View file

@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View file

@ -1,3 +1,3 @@
dependencies {
api "org.xbib:datastructures-api:${project.property('xbib-datastructures.version')}"
api libs.datastructures.api
}

View file

@ -11,6 +11,9 @@ public interface Settings extends AutoCloseable {
class Holder {
private Holder() {
}
private static SettingsBuilder createBuilder() {
ServiceLoader<SettingsBuilder> serviceLoader = ServiceLoader.load(SettingsBuilder.class);
Optional<SettingsBuilder> optionalSettingsBuilder = serviceLoader.findFirst();

View file

@ -4,8 +4,7 @@ import org.xbib.settings.content.json.JsonSettingsLoader;
module org.xbib.settings.content.json {
exports org.xbib.settings.content.json;
requires transitive org.xbib.settings.content;
requires org.xbib.content.api;
requires org.xbib.content.json;
requires transitive org.xbib.content.json;
requires org.xbib.settings.api;
uses SettingsLoader;
provides SettingsLoader with JsonSettingsLoader;

View file

@ -11,6 +11,9 @@ import java.util.Set;
*/
public class JsonSettingsLoader extends AbstractSettingsLoader {
public JsonSettingsLoader() {
}
@Override
public XContent content() {
return JsonXContent.jsonContent();

View file

@ -4,8 +4,7 @@ import org.xbib.settings.content.yaml.YamlSettingsLoader;
module org.xbib.settings.content.yaml {
exports org.xbib.settings.content.yaml;
requires transitive org.xbib.settings.content;
requires org.xbib.content.api;
requires org.xbib.content.yaml;
requires transitive org.xbib.content.yaml;
requires org.xbib.settings.api;
uses SettingsLoader;
provides SettingsLoader with YamlSettingsLoader;

View file

@ -15,6 +15,9 @@ public class YamlSettingsLoader extends AbstractSettingsLoader {
private static final Set<String> YAML_SUFFIXES = Set.of("yml", "yaml");
public YamlSettingsLoader() {
}
@Override
public XContent content() {
return YamlXContent.yamlContent();

View file

@ -1,6 +1,6 @@
dependencies {
api project(':settings-api')
api project(':content-core')
api "org.xbib:datastructures-tiny:${project.property('xbib-datastructures.version')}"
api libs.datastructures.tiny
testImplementation project(":settings-content-json")
}

View file

@ -9,8 +9,7 @@ module org.xbib.settings.content {
uses SettingsBuilder;
provides SettingsBuilder with ContentSettingsBuilder;
exports org.xbib.settings.content;
requires org.xbib.settings.api;
requires org.xbib.content.core;
requires org.xbib.datastructures.api;
requires transitive org.xbib.settings.api;
requires transitive org.xbib.content.core;
requires transitive org.xbib.datastructures.tiny;
}

View file

@ -20,6 +20,9 @@ import java.util.Map;
*/
public abstract class AbstractSettingsLoader implements SettingsLoader {
public AbstractSettingsLoader() {
}
public abstract XContent content();
@Override

View file

@ -21,6 +21,9 @@ public class PropertiesSettingsLoader implements SettingsLoader {
private static final Set<String> PROPERTIES_SUFFIXES = new HashSet<>(Collections.singletonList("properties"));
public PropertiesSettingsLoader() {
}
@Override
public Set<String> suffixes() {
return PROPERTIES_SUFFIXES;

View file

@ -1,4 +1,4 @@
dependencies {
api project(':settings-datastructures')
api "org.xbib:datastructures-json-tiny:${project.property('xbib-datastructures.version')}"
api libs.datastructures.json.tiny
}

View file

@ -7,6 +7,9 @@ import java.util.Set;
public class JsonSettingsLoader extends AbstractSettingsLoader {
public JsonSettingsLoader() {
}
@Override
public DataStructure dataStructure() {
return new Json();

View file

@ -1,4 +1,4 @@
dependencies {
api project(':settings-datastructures')
api "org.xbib:datastructures-yaml-tiny:${project.property('xbib-datastructures.version')}"
api libs.datastructures.yaml.tiny
}

View file

@ -10,6 +10,9 @@ import java.util.Set;
public class YamlSettingsLoader extends AbstractSettingsLoader {
public YamlSettingsLoader() {
}
@Override
public DataStructure dataStructure() {
return new Yaml();

View file

@ -1,4 +1,4 @@
dependencies {
api project(':settings-api')
api "org.xbib:datastructures-tiny:${project.property('xbib-datastructures.version')}"
api libs.datastructures.tiny
}

View file

@ -19,6 +19,9 @@ import java.util.Map;
public abstract class AbstractSettingsLoader implements SettingsLoader {
public AbstractSettingsLoader() {
}
public abstract DataStructure dataStructure();
@Override

View file

@ -13,6 +13,9 @@ import java.util.Set;
*/
public class PropertiesSettingsLoader implements SettingsLoader {
public PropertiesSettingsLoader() {
}
@Override
public Set<String> suffixes() {
return Set.of("properties");

View file

@ -1,3 +1,32 @@
dependencyResolutionManagement {
versionCatalogs {
libs {
version('gradle', '7.5')
version('junit', '5.8.2')
version('jackson', '2.13.3')
version('datastructures', '1.0.0')
library('junit-jupiter-api', 'org.junit.jupiter', 'junit-jupiter-api').versionRef('junit')
library('junit-jupiter-params', 'org.junit.jupiter', 'junit-jupiter-params').versionRef('junit')
library('junit-jupiter-engine', 'org.junit.jupiter', 'junit-jupiter-engine').versionRef('junit')
library('junit4', 'junit', 'junit').version('4.13.2')
library('hamcrest', 'org.hamcrest:hamcrest-library:2.2')
library('jackson-core', 'com.fasterxml.jackson.core', 'jackson-core').versionRef('jackson')
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').versionRef('jackson')
library('jackson-dataformat-smile', 'com.fasterxml.jackson.dataformat', 'jackson-dataformat-smile').versionRef('jackson')
library('jackson-dataformat-xml', 'com.fasterxml.jackson.dataformat', 'jackson-dataformat-xml').versionRef('jackson')
library('jackson-dataformat-yaml', 'com.fasterxml.jackson.dataformat', 'jackson-dataformat-yaml').versionRef('jackson')
library('datastructures-api', 'org.xbib', 'datastructures-api').versionRef('datastructures')
library('datastructures-tiny', 'org.xbib', 'datastructures-tiny').versionRef('datastructures')
library('datastructures-json-tiny', 'org.xbib', 'datastructures-json-tiny').versionRef('datastructures')
library('datastructures-yaml-tiny', 'org.xbib', 'datastructures-yaml-tiny').versionRef('datastructures')
library('mockito-core', 'org.mockito', 'mockito-core').version('4.6.1')
library('mockito-inline', 'org.mockito', 'mockito-inline').version('4.6.1')
library('net', 'org.xbib', 'net-url').version('2.1.1')
library('woodstox', 'com.fasterxml.woodstox', 'woodstox-core').version('6.3.0')
library('snakeyaml', 'org.yaml', 'snakeyaml').version('1.30')
}
}
}
include 'content-api'
include 'content-core'
include 'content-csv'
@ -16,3 +45,14 @@ include 'settings-datastructures'
include 'settings-datastructures-json'
include 'settings-datastructures-yaml'
include 'config'
/*
gradle.wrapper.version = 7.4.2
xbib.net.version = 2.1.1
xbib-datastructures.version = 1.0.0
jackson.version = 2.12.3
woodstox.version = 6.2.6
snakeyaml.version = 1.28
mockito.version = 3.10.0
asciidoclet.version = 1.5.6
*/