You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2025/10/27 12:52:40 UTC
(jena) 02/03: GH-3537: Retire jena-fuseki-webapp and jena-fuseki-war
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit b414be274db5d53593b741c196267a18deb24328
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Fri Oct 24 10:20:46 2025 +0100
GH-3537: Retire jena-fuseki-webapp and jena-fuseki-war
---
jena-fuseki2/jena-fuseki-war/pom.xml | 108 ----
.../jena-fuseki-war/war-inclusions/DEPENDENCIES | 111 ----
jena-fuseki2/jena-fuseki-webapp/fuseki-dev | 105 ----
jena-fuseki2/jena-fuseki-webapp/pom.xml | 247 --------
.../jena/fuseki/authz/AuthorizationFilter403.java | 59 --
.../org/apache/jena/fuseki/authz/DenyFilter.java | 33 -
.../apache/jena/fuseki/authz/LocalhostFilter.java | 72 ---
.../org/apache/jena/fuseki/cmd/FusekiArgs.java | 64 --
.../java/org/apache/jena/fuseki/cmd/FusekiCmd.java | 29 -
.../apache/jena/fuseki/cmd/FusekiErrorHandler.java | 56 --
.../apache/jena/fuseki/cmd/FusekiWebappCmd.java | 401 ------------
.../apache/jena/fuseki/cmd/JettyFusekiWebapp.java | 351 -----------
.../apache/jena/fuseki/cmd/JettyServerConfig.java | 57 --
.../org/apache/jena/fuseki/cmd/WebappDSGSetup.java | 72 ---
.../org/apache/jena/fuseki/mgt/ActionBackup.java | 77 ---
.../apache/jena/fuseki/mgt/ActionBackupList.java | 93 ---
.../org/apache/jena/fuseki/mgt/ActionDatasets.java | 625 -------------------
.../org/apache/jena/fuseki/mgt/ActionLogs.java | 56 --
.../apache/jena/fuseki/mgt/ActionServerStatus.java | 98 ---
.../java/org/apache/jena/fuseki/mgt/Backup.java | 123 ----
.../org/apache/jena/fuseki/mgt/ServerMgtConst.java | 41 --
.../java/org/apache/jena/fuseki/mgt/Template.java | 70 ---
.../apache/jena/fuseki/mgt/TemplateFunctions.java | 86 ---
.../org/apache/jena/fuseki/webapp/FusekiEnv.java | 154 -----
.../fuseki/webapp/FusekiServerEnvironmentInit.java | 68 --
.../jena/fuseki/webapp/FusekiServerListener.java | 134 ----
.../apache/jena/fuseki/webapp/FusekiWebapp.java | 453 --------------
.../jena/fuseki/webapp/ShiroEnvironmentLoader.java | 138 -----
.../org/apache/jena/fuseki/webapp/config.ttl | 30 -
.../org/apache/jena/fuseki/webapp/shiro.ini | 39 --
.../apache/jena/fuseki/webapp/templates/config-mem | 36 --
.../fuseki/webapp/templates/config-mem-readonly | 31 -
.../apache/jena/fuseki/webapp/templates/config-tdb | 38 --
.../jena/fuseki/webapp/templates/config-tdb-dir | 37 --
.../webapp/templates/config-tdb-dir-readonly | 32 -
.../jena/fuseki/webapp/templates/config-tdb-mem | 37 --
.../webapp/templates/config-tdb-mem-readonly | 32 -
.../fuseki/webapp/templates/config-tdb-readonly | 33 -
.../jena/fuseki/webapp/templates/config-tdb2 | 39 --
.../jena/fuseki/webapp/templates/config-tdb2-dir | 37 --
.../webapp/templates/config-tdb2-dir-readonly | 32 -
.../jena/fuseki/webapp/templates/config-tdb2-mem | 37 --
.../webapp/templates/config-tdb2-mem-readonly | 32 -
.../fuseki/webapp/templates/config-tdb2-readonly | 34 -
.../src/main/webapp/META-INF/context.xml | 19 -
.../src/main/webapp/WEB-INF/web.xml | 316 ----------
.../jena-fuseki-webapp/src/main/webapp/favicon.ico | Bin 1085 -> 0 bytes
.../src/main/webapp/log4j2.properties | 65 --
.../jena/fuseki/AbstractFusekiWebappTest.java | 50 --
.../jena/fuseki/AbstractTestWebappAuth_JDK.java | 96 ---
.../java/org/apache/jena/fuseki/FileSender.java | 84 ---
.../java/org/apache/jena/fuseki/ServerCtl.java | 286 ---------
.../java/org/apache/jena/fuseki/ServerTest.java | 37 --
.../org/apache/jena/fuseki/TS_FusekiWebapp.java | 63 --
.../org/apache/jena/fuseki/TestWebappAdmin.java | 457 --------------
.../org/apache/jena/fuseki/TestWebappAdminAPI.java | 101 ---
.../TestWebappAdminAddDeleteDatasetFile.java | 690 ---------------------
.../TestWebappAdminAddDeleteDatasetTemplate.java | 299 ---------
.../jena/fuseki/TestWebappAuthQuery_JDK.java | 96 ---
.../jena/fuseki/TestWebappAuthUpdate_JDK.java | 90 ---
.../apache/jena/fuseki/TestWebappFileUpload.java | 103 ---
.../org/apache/jena/fuseki/TestWebappMetrics.java | 48 --
.../jena/fuseki/TestWebappSPARQLProtocol.java | 83 ---
.../jena/fuseki/TestWebappServerReadOnly.java | 136 ----
.../org/apache/jena/fuseki/test/FusekiTest.java | 48 --
.../java/org/apache/jena/fuseki/test/HttpTest.java | 104 ----
.../src/test/resources/log4j2-test.properties | 66 --
.../testing/config-ds-bad-name-1.ttl | 15 -
.../testing/config-ds-bad-name-2.ttl | 15 -
.../testing/config-ds-bad-name-3.ttl | 15 -
.../testing/config-ds-bad-name-4.ttl | 15 -
.../jena-fuseki-webapp/testing/config-ds-inf.ttl | 30 -
.../testing/config-ds-plain-1.ttl | 17 -
.../testing/config-ds-plain-2.ttl | 18 -
.../jena-fuseki-webapp/testing/config-tdb2a.ttl | 18 -
.../jena-fuseki-webapp/testing/config-tdb2b.ttl | 18 -
.../jena-fuseki-webapp/testing/config-tdb2c.ttl | 19 -
pom.xml | 7 -
78 files changed, 8061 deletions(-)
diff --git a/jena-fuseki2/jena-fuseki-war/pom.xml b/jena-fuseki2/jena-fuseki-war/pom.xml
deleted file mode 100644
index 20143f2705..0000000000
--- a/jena-fuseki2/jena-fuseki-war/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <name>Apache Jena - Fuseki WAR File</name>
- <artifactId>jena-fuseki-war</artifactId>
-
- <parent>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- </parent>
-
- <packaging>war</packaging>
-
- <dependencies>
-
- <!-- backend servlets, filters (CORS, Shiro, etc.) -->
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki-webapp</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- frontend assets (HTML, JS, CSS, images, etc.) -->
- <!-- Currently done by unpacking in jena-fuseki-webapp
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki-ui</artifactId>
- <version>${project.version}</version>
- </dependency>
- -->
-
- <!-- Require a logging implementation -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j2-impl</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- </dependencies>
-
- <build>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-webapp</id>
- <phase>package</phase>
- <goals><goal>war</goal></goals>
- </execution>
- </executions>
- <configuration>
- <warSourceDirectory>../jena-fuseki-webapp/target/webapp/</warSourceDirectory>
- <webXml>../jena-fuseki-webapp/src/main/webapp/WEB-INF/web.xml</webXml>
-
- <webResources>
- <resource>
- <directory>war-inclusions/</directory>
- <targetPath>/</targetPath>
- </resource>
- <resource>
- <directory>../jena-fuseki-webapp/src/main/webapp</directory>
- <includes>log4j2.properties</includes>
- <targetPath>/</targetPath>
- </resource>
- </webResources>
-
- <!-- Safe: Don't put in the Jetty dependency nor javax.servlet -->
- <packagingExcludes>WEB-INF/lib/jetty-*,WEB-INF/lib/javax.servlet*</packagingExcludes>
- </configuration>
- </plugin>
- </plugins>
-
- </build>
-</project>
diff --git a/jena-fuseki2/jena-fuseki-war/war-inclusions/DEPENDENCIES b/jena-fuseki2/jena-fuseki-war/war-inclusions/DEPENDENCIES
deleted file mode 100644
index 9bfde718be..0000000000
--- a/jena-fuseki2/jena-fuseki-war/war-inclusions/DEPENDENCIES
+++ /dev/null
@@ -1,111 +0,0 @@
-- - - - - - - - - - - - - - - - - - - - - - -
-
-This product bundles "Simple Logging Facade for Java (SLF4J)", which is available under an
-MIT license (MIT). See https://www.slf4j.org/license.html
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-This product bundles "jsonld-java" , which is available under a
-BSD license (BSD-3-Clause). See
-https://github.com/jsonld-java/jsonld-java/blob/master/LICENCE
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-This product bundles "Dexx Collections", which is available under an
-MIT license (MIT). See https://github.com/andrewoma/dexx/blob/master/LICENSE.txt
-
-"Dexx Collections" includes following NOTICE
-----------
-Portions based on code from the Scala standard library.
-Copyright (c) 2002-2014 EPFL
-Copyright (c) 2011-2014 Typesafe, Inc.
-Licensed under BSD-style license (see licenses/LICENSE_Scala.txt)
-----------
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-This product bundles Google Protocol Buffers java runtime:
-
-Copyright 2008 Google Inc. All rights reserved.
-https://github.com/protocolbuffers/protobuf/blob/master/LICENSE
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-This product bundles "LatencyUtils"
-which is available under a "BSD 2-Clause License" (BSD-2-Clause).
-See https://github.com/LatencyUtils/LatencyUtils/blob/master/LICENSE
-
-This product bundles "HdrHistogram"
-which is available under a "BSD 2-Clause License" (BSD-2-Clause).
-See https://github.com/HdrHistogram/HdrHistogram/blob/master/LICENSE.txt
-
-- - - - - - - - - - - - - - - - - - - - - - -
-
-This product bundles "Bootstrap", which is available under an
-MIT license. See: https://github.com/twbs/bootstrap/blob/master/LICENSE
-
-This product bundles "codemirror", which is available under an
-MIT license. See http://codemirror.net/LICENSE
-
-This product bundles "jquery", which is available under an
-MIT license. See https://jquery.org/license/
-
-This product bundles "jquery.form", which is available under an
-MIT license. See http://malsup.github.io/mit-license.txt
-
-This product bundles "jquery.xdomainrequest", which is available under an
-MIT license. See https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest/blob/master/LICENSE.txt
-
-This product bundles "backbone.js", which is available under an
-MIT license. See https://github.com/jashkenas/backbone/blob/master/LICENSE
-
-This product bundles "backbone.marionette", which is available under an
-MIT license. See http://mutedsolutions.mit-license.org/
- "backbone.marionette" includes "Backbone.BabySitter" and
- "Backbone.Wreqr" also available under the same MIT license.
-
-This product bundles "html5shiv", which is available under an
-MIT license. See https://code.google.com/p/html5shiv/
-
-This product bundles "RequireJS", which is available under an
-MIT license.
-https://github.com/jrburke/requirejs/blob/master/LICENSE
- "RequireJS" is also available with a "30clause BSD license"
-
-This product bundles "Respond", which is available under an
-MIT license. See https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
-
-This product bundles "sprintf.js", which is available under a
-"3 clause BSD" license.
- https://github.com/alexei/sprintf.js/blob/master/LICENSE
-
-This product bundles "underscore", which is available under an
-MIT license. See https://github.com/jashkenas/underscore/blob/master/LICENSE
-
-This product bundles "FontAwesome"
- "Font Awesome by Dave Gandy - http://fontawesome.io"
-The font is available under an SIL Open Font License 1.1
-and the CSS files under an MIT License.
-See http://fontawesome.io/license/
-
-This product bundles "jQuery File Upload Plugin"
-which is available under an MIT License.
-See https://github.com/blueimp/jQuery-File-Upload
-
-This product bundles "Bootstrap-select"
-which is available under an MIT License.
-See https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE
-
-This product bundles "pivot.js"
-which is available under a BSD 3-clause style license.
-https://github.com/rwjblue/pivot.js/blob/master/LICENSE
-
-This product bundles "YASEQE - Yet Another Sparql Query Editor"
-which is available under an MIT License.
-See http://yasqe.yasgui.org/license.txt
-from https://github.com/YASGUI/YASQE
-
-This product bundles "YASR - Yet Another Sparql Resultset GUI"
-which is available under an MIT License.
-See http://yasr.yasgui.org/license.txt
-from https://github.com/YASGUI/YASR
diff --git a/jena-fuseki2/jena-fuseki-webapp/fuseki-dev b/jena-fuseki2/jena-fuseki-webapp/fuseki-dev
deleted file mode 100755
index b75d941bca..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/fuseki-dev
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-## Run Fuseki, include development code if it looks like it's available.
-
-function check_dir() {
- local NAME="$1"
- local DIR="$2"
- if [ ! -e "$DIR" ]
- then
- echo "$NAME: '$DIR' does not exist" 1>&2
- exit 1
- fi
- if [ ! -d "$DIR" ]
- then
- echo "$NAME: '$DIR' exists but is not a directory" 1>&2
- exit 1
- fi
-}
-
-export FUSEKI_HOME="${FUSEKI_HOME:-$PWD}"
-check_dir "FUSEKI_HOME" "$FUSEKI_HOME"
-
-export FUSEKI_BASE="${FUSEKI_BASE:-$FUSEKI_HOME/run}"
-check_dir "FUSEKI_BASE" "$FUSEKI_BASE"
-
-CPF="$FUSEKI_HOME/fuseki.classpath"
-if [ ! -e "$CPF" ]; then
- echo "Need to create Fuseki classpath file"
- echo "Ensure maven is upto date with the latest snapshots and then run"
- echo -e "( cd $FUSEKI_HOME ; \n mvn dependency:build-classpath -DincludeScope=runtime -Dmdep.outputFile=fuseki.classpath )"
- exit 1
-fi
-CP="$(cat $CPF)"
-
-# Add development directories.
-if [ -e "$FUSEKI_HOME/classes" ]
-then
- CP="$FUSEKI_HOME/classes:$CP"
-elif [ -e "$FUSEKI_HOME/target/classes" ]
-then
- CP="$FUSEKI_HOME/target/classes:$CP"
-fi
-
-# Prepend any development directories here
-DEVDIRS="jena-core jena-tdb jena-arq jena-text jena-fuseki2/jena-fuseki-core jena-fuseki2/jena-fuseki-webapp"
-for X in $DEVDIRS
-do
- CPX="$FUSEKI_HOME/../../$X/target/classes"
- if [ -e "$CPX" ]
- then
- CP="$CPX:$CP"
- fi
-done
-
-## echo "$CP"
-## exit
-
-FUSEKI_LOG="" #${FUSEKI_LOG:-}
-
-if [ -z "$JAVA" ]
-then
- if [ -z "$JAVA_HOME" ]
- then
- JAVA=$(which java)
- else
- JAVA=$JAVA_HOME/bin/java
- fi
-fi
-
-if [ -z "$JAVA" ]
-then
- (
- echo "Cannot find a Java JDK."
- echo "Please set either set JAVA or JAVA_HOME and put java (>=1.8) in your PATH."
- ) 1>&2
- exit 1
-fi
-
-JVM_ARGS=${JVM_ARGS:--Xmx1200M}
-
-# Debug assistence
-## echo "++++ Classpath:"
-## echo "$(echo $CP | sed -e "s/:/\n/g")"
-## exit
-
-exec "$JAVA" -cp "$CP" $JVM_ARGS $FUSEKI_LOG org.apache.jena.fuseki.cmd.FusekiCmd "$@"
-
-# Run as war file.
-# java -jar jetty-runner.jar fuseki-server.war
diff --git a/jena-fuseki2/jena-fuseki-webapp/pom.xml b/jena-fuseki2/jena-fuseki-webapp/pom.xml
deleted file mode 100644
index 26f506b3f9..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/pom.xml
+++ /dev/null
@@ -1,247 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- </parent>
-
- <name>Apache Jena - Fuseki Webapp</name>
- <artifactId>jena-fuseki-webapp</artifactId>
- <packaging>jar</packaging>
-
- <properties>
- <automatic.module.name>org.apache.jena.fuseki.webapp</automatic.module.name>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki-core</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki-core</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-cmds</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-text</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.jetty.ee10</groupId>
- <artifactId>jetty-ee10-webapp</artifactId>
- </dependency>
-
- <!-- Shiro -->
-
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-core</artifactId>
- <classifier>jakarta</classifier>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-web</artifactId>
- <classifier>jakarta</classifier>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-config-core</artifactId>
- </dependency>
-
- <!-- See https://shiro.apache.org/jakarta-ee.html -->
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-jakarta-ee</artifactId>
- <classifier>jakarta</classifier>
- </dependency>
-
- <!-- frontend assets (HTML, JS, CSS, images, etc.) -->
- <!-- Currently done by unpacking.
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki-ui</artifactId>
- <version>${project.version}</version>
- </dependency>
- -->
-
- <!-- Logging -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j2-impl</artifactId>
- </dependency>
-
- <!-- Within-webapp use -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-web</artifactId>
- </dependency>
-
- <!-- Testing -->
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-arq</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-base</artifactId>
- <version>5.7.0-SNAPSHOT</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-params</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.junit.platform</groupId>
- <artifactId>junit-platform-suite</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.awaitility</groupId>
- <artifactId>awaitility</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <resources>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <filtering>false</filtering>
- <directory>src/main/webapp/</directory>
- <targetPath>${project.build.directory}/webapp/</targetPath>
- </resource>
- </resources>
-
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>package</phase>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <includes>
- <include>**/TS_*.java</include>
- </includes>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>process-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.jena</groupId>
- <artifactId>jena-fuseki-ui</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <outputDirectory>${project.build.directory}</outputDirectory>
- <includes>webapp/**/*.*</includes>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
-
- <configuration>
- <overWriteReleases>false</overWriteReleases>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </plugin>
-
- </plugins>
-
- </build>
-</project>
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/AuthorizationFilter403.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/AuthorizationFilter403.java
deleted file mode 100644
index 70160b01cf..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/AuthorizationFilter403.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.authz;
-
-import java.io.IOException;
-
-import jakarta.servlet.ServletRequest;
-import jakarta.servlet.ServletResponse;
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.jena.web.HttpSC;
-import org.apache.shiro.web.filter.authz.AuthorizationFilter;
-import org.apache.shiro.web.util.WebUtils;
-
-/** Specialise AuthorizationFilter to yield HTTP 403 on access denied */
-public abstract class AuthorizationFilter403 extends AuthorizationFilter
-{
- private String message;
-
- protected AuthorizationFilter403(String text) { setMessage(text); }
- protected AuthorizationFilter403() { this(null); }
-
- /** Set the message used in HTTP 403 responses */
- public void setMessage(String msg) { message = msg; }
-
- public String getMessage() { return message; }
-
- @Override
- protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws IOException {
- HttpServletResponse httpResponse;
- try { httpResponse = WebUtils.toHttp(response); }
- catch (ClassCastException ex) {
- // Not a HTTP Servlet operation
- return super.onAccessDenied(request, response);
- }
- if ( message == null )
- httpResponse.sendError(HttpSC.FORBIDDEN_403);
- else
- httpResponse.sendError(HttpSC.FORBIDDEN_403, message);
- return false; // No further processing.
- }
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/DenyFilter.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/DenyFilter.java
deleted file mode 100644
index dca0cef7f8..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/DenyFilter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.authz;
-
-import jakarta.servlet.ServletRequest;
-import jakarta.servlet.ServletResponse;
-
-/** An authorization filter that always denies access and sends back HTTP 403 */
-public class DenyFilter extends AuthorizationFilter403 {
-
- public DenyFilter() { super("Access denied"); }
-
- @Override
- protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
- return false;
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/LocalhostFilter.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/LocalhostFilter.java
deleted file mode 100644
index d14780e06d..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/authz/LocalhostFilter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.authz;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Set;
-
-import jakarta.servlet.ServletRequest;
-import jakarta.servlet.ServletResponse;
-
-import org.apache.shiro.web.filter.authz.PortFilter;
-
-/**
- * A Filter that can allow or deny access based on whether the
- * the host that sent the request is the loopback address (AKA localhost).
- * Use of the external IP address of the local machine does not permit access,
- * only the loopback interface is authorized.
- * Responds with HTTP 403 on any denied request.
- *
- * Example:
- * <pre>
- * [main]
- * localhost=org.apache.jena.fuseki.authz.LocalhostFilter
- * ...
- * [urls]
- * /LocalFilesForLocalPeople/** = localhost
- * </pre>
- * @see PortFilter
- */
-
-public class LocalhostFilter extends AuthorizationFilter403 {
-
- private static final String message = "Access denied : only localhost access allowed";
-
- public LocalhostFilter() { super(message); }
-
- private static String LOCALHOST_IpV6_a = "[0:0:0:0:0:0:0:1]";
- private static String LOCALHOST_IpV6_b = "0:0:0:0:0:0:0:1";
- // This is what appears in the Chrome developer tools client-side.
- // "[0:0:0:0:0:0:0:1]" by the time it arrives here, It is not clear which
- // software component is responsible for that.
- // To be safe we add "[::1]".
- private static String LOCALHOST_IpV6_c = "[::1]";
- private static String LOCALHOST_IpV4 = "127.0.0.1"; // Strictly, 127.*.*.*
-
- private static final Collection<String> localhosts = Set.copyOf(
- Arrays.asList(LOCALHOST_IpV4, LOCALHOST_IpV6_a, LOCALHOST_IpV6_b, LOCALHOST_IpV6_c));
-
- @Override
- protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
- return localhosts.contains(request.getRemoteAddr());
- }
-}
-
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiArgs.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiArgs.java
deleted file mode 100644
index 7078c6806a..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiArgs.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.jena.sparql.core.DatasetGraph;
-
-/** Dataset setup (command line, config file) for a dataset (or several if config file) */
-public class FusekiArgs {
- public boolean quiet = false;
- public boolean verbose = false;
-
- // Priority order : --conf, templated
- // through the command line processing should not allow --conf and a templated /dataset.
-
- // Label for dataset setup (command line).
- public String datasetDescription = null;
- // Either this ... command line ...
- public String templateFile = null; // Command list args --mem, --loc, --memtdb
- public String datasetPath = null; // Dataset name on the command line.
- public boolean allowUpdate = false; // Command line --update.
- // Special case - prebuilt dataset. Uses datasetPath.
- public DatasetGraph dsg = null; // Embedded or command line --file)
-
- /** RDFS dataset - only when dataset is defined on the command line. */
- public String rdfsGraph = null;
-
- // Or configuration file from command line
- public String fusekiCmdLineConfigFile = null; // Command line --conf.
- // Or configuration from run area (lowest priority)
- public String fusekiServerConfigFile = null; // "run" area
-
- // Additional information.
- public Map<String,String> params = new HashMap<>();
-
- public FusekiArgs() {}
-
- public void reset() {
- templateFile = null;
- datasetPath = null;
- allowUpdate = false;
- dsg = null;
- fusekiCmdLineConfigFile = null; // Command line --conf.
- fusekiServerConfigFile = null;
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
deleted file mode 100644
index d75199350f..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-/**
- * @deprecated Use {@link FusekiWebappCmd}.
- */
-@Deprecated(since="5.1.0", forRemoval = true)
-public class FusekiCmd {
- static public void main(String... argv) {
- FusekiWebappCmd.main(argv);
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiErrorHandler.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiErrorHandler.java
deleted file mode 100644
index ae8c0d520b..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiErrorHandler.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.List;
-
-import org.apache.jena.riot.WebContent;
-import org.eclipse.jetty.http.MimeTypes;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Response;
-import org.eclipse.jetty.server.handler.ErrorHandler;
-import org.eclipse.jetty.util.Callback;
-
-/**
- * Fuseki error handler (used with ServletAPI HttpServletResponse.sendError).
- * Typically ServletOps.responseSendError is used which directly sends the error and a message.
- */
-public class FusekiErrorHandler extends ErrorHandler
-{
- private static List<Charset> utf8List = List.of(StandardCharsets.UTF_8);
-
- // Only used if ServletOps.responseSendError calls Servlet API response.sendError
- // or a non-Fuseki error occurs.
- public FusekiErrorHandler() {}
-
- @Override
- protected boolean generateAcceptableResponse(Request request, Response response, Callback callback, String contentType, List<Charset> charsets, int code, String message, Throwable cause) throws IOException {
- // Fix Jetty GH-10474 : (12.0.0, 12.0.1)
- // ContentType application/json cause illegal state exception
- if ( contentType != null && contentType.equals(WebContent.contentTypeJSON) ) {
- contentType = MimeTypes.Type.TEXT_PLAIN.asString();
- charsets = utf8List;
- }
- //ServletOps.setNoCache(response);
- return super.generateAcceptableResponse(request, response, callback, contentType, utf8List, code, message, cause);
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiWebappCmd.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiWebappCmd.java
deleted file mode 100644
index 4c9a27b149..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/FusekiWebappCmd.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.List;
-
-import arq.cmdline.CmdARQ;
-import arq.cmdline.ModDatasetAssembler;
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.cmd.ArgDecl;
-import org.apache.jena.cmd.CmdException;
-import org.apache.jena.cmd.TerminationException;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.FusekiException;
-import org.apache.jena.fuseki.mgt.Template;
-import org.apache.jena.fuseki.system.FusekiCore;
-import org.apache.jena.fuseki.system.FusekiLogging;
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-import org.apache.jena.fuseki.webapp.FusekiServerListener;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.query.ARQ;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.riot.RDFLanguages;
-import org.apache.jena.riot.RiotException;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sys.JenaSystem;
-import org.apache.jena.system.Txn;
-import org.apache.jena.tdb1.sys.Names;
-import org.slf4j.Logger;
-
-/**
- * Handles the fuseki command, used to start a Fuseki Webapp server.
- */
-public class FusekiWebappCmd {
- // This allows us to set logging before calling FusekiCmdInner
- // FusekiCmdInner inherits from CmdMain which statically sets logging.
- // By java classloading, super class statics run before the
- // statics of a class are run.
-
- static {
- FusekiEnv.mode = FusekiEnv.INIT.STANDALONE;
- FusekiEnv.setEnvironment();
- FusekiLogging.setLogging(FusekiEnv.FUSEKI_BASE, false);
- }
-
- static public void main(String... argv) {
- FusekiCmdInner.innerMain(argv);
- }
-
- static class FusekiCmdInner extends CmdARQ {
- private static ArgDecl argMem = new ArgDecl(ArgDecl.NoValue, "mem");
- // This does not apply to empty in-memory setups.
- private static ArgDecl argUpdate = new ArgDecl(ArgDecl.NoValue, "update", "allowUpdate");
-
- private static ArgDecl argFile = new ArgDecl(ArgDecl.HasValue, "file");
- private static ArgDecl argTDB1mode = new ArgDecl(ArgDecl.NoValue, "tdb1");
- private static ArgDecl argTDB2mode = new ArgDecl(ArgDecl.NoValue, "tdb2");
- private static ArgDecl argMemTDB = new ArgDecl(ArgDecl.NoValue, "memtdb", "memTDB", "tdbmem");
- // And not ModLocation.
- private static ArgDecl argTDB = new ArgDecl(ArgDecl.HasValue, "loc", "location", "tdb");
-
- // RDFS vocabulary applied to command line defined dataset.
- private static ArgDecl argRDFS = new ArgDecl(ArgDecl.HasValue, "rdfs");
-
- private static ArgDecl argPort = new ArgDecl(ArgDecl.HasValue, "port");
- private static ArgDecl argLocalhost = new ArgDecl(ArgDecl.NoValue, "localhost", "local");
- private static ArgDecl argTimeout = new ArgDecl(ArgDecl.HasValue, "timeout");
- private static ArgDecl argFusekiConfig = new ArgDecl(ArgDecl.HasValue, "config", "conf");
- private static ArgDecl argJettyConfig = new ArgDecl(ArgDecl.HasValue, "jetty-config", "jetty");
- private static ArgDecl argGZip = new ArgDecl(ArgDecl.HasValue, "gzip");
- private static ArgDecl argContextPath = new ArgDecl(ArgDecl.HasValue, "pathBase", "contextPath", "pathbase", "contextpath");
-
- // Deprecated. Use shiro.
- private static ArgDecl argBasicAuth = new ArgDecl(ArgDecl.HasValue, "basic-auth");
-
- private static ModDatasetAssembler modDataset = new ModDatasetAssembler();
-
- static public void innerMain(String... argv) {
- JenaSystem.init();
- // Do explicitly so it happens after subsystem initialization.
- FusekiCore.init();
- new FusekiCmdInner(argv).mainRun();
- }
-
- private JettyServerConfig jettyServerConfig = new JettyServerConfig();
- {
- jettyServerConfig.port = 3030;
- jettyServerConfig.contextPath = "/";
- jettyServerConfig.jettyConfigFile = null;
- jettyServerConfig.enableCompression = true;
- jettyServerConfig.verboseLogging = false;
- }
-
- private final FusekiArgs cmdLine = new FusekiArgs();
- private boolean useTDB2 = true;
-
- public FusekiCmdInner(String... argv) {
- super(argv);
-
- getUsage().startCategory("Fuseki");
- addModule(modDataset);
- add(argMem, "--mem",
- "Create an in-memory, non-persistent dataset for the server");
- add(argFile, "--file=FILE",
- "Create an in-memory, non-persistent dataset for the server, initialised with the contents of the file");
- add(argTDB1mode, "--tdb1",
- "Use TDB1 for command line persistent datasets (default is TDB2)");
- add(argTDB2mode, "--tdb2",
- "Use TDB2 for command line persistent datasets (default is TDB2)");
- add(argTDB, "--loc=DIR",
- "Use an existing TDB database (or create if does not exist)");
- add(argMemTDB, "--memTDB",
- "Create an in-memory, non-persistent dataset using TDB (testing only)");
-
- add(argRDFS, "--rdfs=FILE",
- "Apply RDFS on top of the dataset");
- add(argPort, "--port",
- "Listen on this port number");
- // Set via jetty config file.
- add(argLocalhost, "--localhost",
- "Listen only on the localhost interface");
- add(argTimeout, "--timeout=",
- "Global timeout applied to queries (value in ms) -- format is X[,Y] ");
- add(argUpdate, "--update",
- "Allow updates (via SPARQL Update and SPARQL HTTP Update)");
- add(argContextPath, "--contextPath=PATH",
- "Set up the server context (root) path");
- add(argFusekiConfig, "--config=",
- "Use a configuration file to determine the services");
- add(argJettyConfig, "--jetty-config=FILE",
- "Set up the server (not services) with a Jetty XML file");
-
- add(argBasicAuth);
- add(argGZip, "--gzip=on|off",
- "Enable GZip compression (HTTP Accept-Encoding) if request header set");
-
- super.modVersion.addClass(Fuseki.class);
- }
-
- private static String argUsage = "[--config=FILE] [--mem|--loc=TDBdatabase|--file=FILE] [--port PORT] /DatasetPathName";
-
- @Override
- protected String getSummary() {
- return getCommandName() + " " + argUsage;
- }
-
- @Override
- protected void processModulesAndArgs() {
- if ( super.isVerbose() || super.isDebug() ) {
- jettyServerConfig.verboseLogging = true;
- // Output is still at level INFO (currently)
- }
-
- cmdLine.quiet = super.isQuiet();
- cmdLine.verbose = super.isVerbose();
-
- // Any final tinkering with FUSEKI_HOME and FUSEKI_BASE (run area), e.g. arguments like --home, --base, then ....
-// if ( contains(argHome) )
-// Fuseki.configLog.warn("--home ignored (use enviroment variables $FUSEKI_HOME and $FUSEKI_BASE)");
-
- FusekiEnv.resetEnvironment();
-
- Logger log = Fuseki.serverLog;
-
- if ( contains(argFusekiConfig) ) {
- cmdLine.fusekiCmdLineConfigFile = getValue(argFusekiConfig);
- cmdLine.datasetDescription = "Configuration: "+cmdLine.fusekiCmdLineConfigFile;
- }
-
- // ---- Datasets
- // Check one and only way is defined.
- int x = 0;
-
- if ( contains(argMem) )
- x++;
- if ( contains(argFile) )
- x++;
- if ( contains(argTDB) )
- x++;
- if ( contains(argMemTDB) )
- x++;
-
- if ( cmdLine.fusekiCmdLineConfigFile != null ) {
- if ( x >= 1 )
- throw new CmdException("Dataset specified on the command line but a configuration file also given.");
- } else {
- // No configuration file. 0 or 1 legal.
- if ( x > 1 )
- throw new CmdException("Multiple ways providing a dataset. Only one of --mem, --file, --loc or --desc");
- }
-
- boolean cmdlineConfigPresent = ( x != 0 );
- if ( cmdlineConfigPresent && getPositional().size() == 0 )
- throw new CmdException("Missing service name");
-
- if ( cmdLine.fusekiCmdLineConfigFile != null && getPositional().size() > 0 )
- throw new CmdException("Service name will come from --conf; no command line service name allowed");
-
-
- if ( !cmdlineConfigPresent && getPositional().size() > 0 )
- throw new CmdException("Service name given but no configuration argument to match (e.g. --mem, --loc/--tdb, --file)");
-
- if ( cmdlineConfigPresent && getPositional().size() > 1 )
- throw new CmdException("Multiple dataset path names given");
-
- if ( ! cmdlineConfigPresent && cmdLine.fusekiCmdLineConfigFile == null ) {
- // Turn command line argument into an absolute file name.
- FusekiEnv.setEnvironment();
- Path cfg = FusekiEnv.FUSEKI_BASE.resolve(FusekiWebapp.DFT_CONFIG).toAbsolutePath();
- if ( Files.exists(cfg) )
- cmdLine.fusekiServerConfigFile = cfg.toString();
- }
-
- if ( ! cmdlineConfigPresent && contains(argRDFS) )
- throw new CmdException("Need to define RDFS setup in the configuration file.");
-
- // ---- General settings.
-
- cmdLine.allowUpdate = contains(argUpdate);
-
- // This influences later settings.
- if ( contains(argLocalhost) ) {
- cmdLine.allowUpdate = true;
- jettyServerConfig.loopback = true;
- }
-
- if ( contains(argTimeout) ) {
- String str = getValue(argTimeout);
- ARQ.getContext().set(ARQ.queryTimeout, str);
- }
-
- // Which TDB to use to create a command line TDB database.
- if ( contains(argTDB1mode) )
- useTDB2 = false;
- if ( contains(argTDB2mode) )
- useTDB2 = true;
-
- // ---- Per storage/configuration
-
- if ( contains(argMem) ) {
- cmdLine.datasetDescription = "in-memory";
- // Only one setup should be called by the test above but to be safe
- // and in case of future changes, clear the configuration.
- cmdLine.reset();
- cmdLine.templateFile = Template.templateTIM_MemFN;
- // Always allow.
- cmdLine.allowUpdate = true;
- }
-
- if ( contains(argFile) ) {
- List<String> filenames = getValues(argFile);
- // Directly populate the dataset.
- cmdLine.reset();
- cmdLine.dsg = DatasetGraphFactory.createTxnMem();
- // Update is not enabled by default for --file
- cmdLine.allowUpdate = contains(argUpdate);
- cmdLine.datasetDescription = "in-memory, with files loaded";
- for ( String filename : filenames ) {
- String pathname = filename;
- if ( filename.startsWith("file:") )
- pathname = filename.substring("file:".length());
- if ( !FileOps.exists(filename) )
- throw new CmdException("File not found: " + filename);
- Lang language = RDFLanguages.filenameToLang(filename);
- if ( language == null )
- throw new CmdException("Can't guess language for file: " + filename);
- Txn.executeWrite(cmdLine.dsg, ()->{
- try {
- log.info("Dataset: in-memory: load file: " + filename);
- RDFDataMgr.read(cmdLine.dsg, filename);
- } catch (RiotException ex) {
- throw new CmdException("Failed to load file: " + filename);
- }
- });
- }
- }
-
- if ( contains(argMemTDB) ) {
- cmdLine.reset();
- cmdLine.templateFile = useTDB2 ? Template.templateTDB2_MemFN : Template.templateTDB1_MemFN;
- cmdLine.params.put(Template.DIR, Names.memName);
- // Always allow.
- cmdLine.allowUpdate = true;
- cmdLine.datasetDescription = useTDB2 ? "TDB2 dataset (in-memory)" : "TDB1 dataset (in-memory)";
- }
-
- if ( contains(argTDB) ) {
- String dir = getValue(argTDB);
- cmdLine.params.put(Template.DIR, dir);
- cmdLine.reset();
- cmdLine.allowUpdate = contains(argUpdate);
- WebappDSGSetup.setup(dir, useTDB2, cmdLine);
- }
-
- if ( contains(argRDFS) ) {
- String rdfsVocab = getValue(argRDFS);
- if ( !FileOps.exists(rdfsVocab) )
- throw new CmdException("No such file for RDFS: "+rdfsVocab);
- cmdLine.rdfsGraph = rdfsVocab;
- cmdLine.datasetDescription = cmdLine.datasetDescription+ " (with RDFS)";
- }
-
- if ( cmdlineConfigPresent ) {
- cmdLine.datasetPath = getPositionalArg(0);
- if ( cmdLine.datasetPath.length() > 0 && !cmdLine.datasetPath.startsWith("/") )
- throw new CmdException("Dataset path name must begin with a /: " + cmdLine.datasetPath);
- if ( ! cmdLine.allowUpdate )
- Fuseki.serverLog.info("Running in read-only mode for "+cmdLine.datasetPath);
- // Include the dataset name as NAME for any templates.
- cmdLine.params.put(Template.NAME, cmdLine.datasetPath);
- }
-
- // ---- Jetty server
- if ( contains(argBasicAuth) )
- Fuseki.configLog.warn("--basic-auth ignored: Use Apache Shiro security - see shiro.ini");
-
- if ( contains(argPort) ) {
- String portStr = getValue(argPort);
- try {
- jettyServerConfig.port = Integer.parseInt(portStr);
- } catch (NumberFormatException ex) {
- throw new CmdException(argPort.getKeyName() + " : bad port number: " + portStr);
- }
- }
-
- if ( contains(argContextPath) ) {
- String contextPath = getValue(argContextPath);
- contextPath = sanitizeContextPath(contextPath);
- if ( contextPath != null )
- jettyServerConfig.contextPath = contextPath;
- }
-
- if ( contains(argJettyConfig) ) {
- jettyServerConfig.jettyConfigFile = getValue(argJettyConfig);
- if ( !FileOps.exists(jettyServerConfig.jettyConfigFile) )
- throw new CmdException("No such file: " + jettyServerConfig.jettyConfigFile);
- }
-
- if ( contains(argGZip) ) {
- if ( !hasValueOfTrue(argGZip) && !hasValueOfFalse(argGZip) )
- throw new CmdException(argGZip.getNames().get(0) + ": Not understood: " + getValue(argGZip));
- jettyServerConfig.enableCompression = super.hasValueOfTrue(argGZip);
- }
- }
-
- private static String sanitizeContextPath(String contextPath) {
- if ( contextPath.isEmpty() )
- return null;
- if ( contextPath.equals("/") )
- return null;
- if ( contextPath.endsWith("/") ) {
- throw new CmdException("Path base must not end with \"/\": '"+contextPath+"'");
- //contextPath = StringUtils.chop(contextPath);
- }
- if ( ! contextPath.startsWith("/") )
- contextPath = "/"+contextPath;
- return contextPath;
- }
-
- @Override
- protected void exec() {
- try {
- runFuseki(cmdLine, jettyServerConfig);
- } catch (FusekiException ex) {
- throw new TerminationException(1);
- }
- }
-
- @Override
- protected String getCommandName() {
- return "fuseki";
- }
- }
-
- /** Configure and run a Fuseki server - this function does not return except for error starting up */
- public static void runFuseki(FusekiArgs serverConfig, JettyServerConfig jettyConfig) {
- FusekiServerListener.initialSetup = serverConfig;
- JettyFusekiWebapp.initializeServer(jettyConfig);
- JettyFusekiWebapp.instance.start();
- JettyFusekiWebapp.instance.join();
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/JettyFusekiWebapp.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/JettyFusekiWebapp.java
deleted file mode 100644
index e3c65b8778..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/JettyFusekiWebapp.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-import static java.lang.String.format;
-import static org.apache.jena.fuseki.Fuseki.serverLog;
-
-import java.nio.file.Path;
-
-import jakarta.servlet.ServletContext;
-import org.apache.jena.atlas.lib.DateTimeUtils;
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.FusekiConfigException;
-import org.apache.jena.fuseki.FusekiException;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry;
-import org.apache.jena.fuseki.server.FusekiCoreInfo;
-import org.apache.jena.fuseki.system.FusekiCore;
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-import org.apache.jena.sys.JenaSystem;
-import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
-import org.eclipse.jetty.ee10.servlet.security.ConstraintMapping;
-import org.eclipse.jetty.ee10.servlet.security.ConstraintSecurityHandler;
-import org.eclipse.jetty.ee10.webapp.WebAppContext;
-import org.eclipse.jetty.security.*;
-import org.eclipse.jetty.security.Constraint.Authorization;
-import org.eclipse.jetty.security.authentication.BasicAuthenticator;
-import org.eclipse.jetty.server.*;
-import org.eclipse.jetty.server.handler.gzip.GzipHandler;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.resource.ResourceFactory;
-import org.eclipse.jetty.xml.XmlConfiguration;
-
-/** Standalone full server, not run as a WAR file.
- *
- * SPARQLServer is the Jena server instance which wraps/utilizes
- * {@link org.eclipse.jetty.server.Server}. This class provides
- * immediate access to the {@link org.eclipse.jetty.server.Server#start()} and
- * {@link org.eclipse.jetty.server.Server#stop()} commands as well as obtaining
- * instances of the server and server configuration. Finally we can obtain
- * instances of {@link org.apache.jena.fuseki.cmd.JettyServerConfig}.
- */
-public class JettyFusekiWebapp {
- // Jetty specific.
- // This class is becoming less important - it now sets up a Jetty server for in-process use
- // either for the command line in development
- // and in testing but not direct webapp deployments.
- static {
- JenaSystem.init();
- FusekiCore.init();
- }
-
- public static JettyFusekiWebapp instance = null;
-
- private ServerConnector serverConnector = null;
- // If a separate ...
- private ServerConnector mgtConnector = null;
-
- private JettyServerConfig serverConfig;
-
- // The jetty server.
-
- private Server server = null;
- private ServletContext servletContext = null;
-
- // Location of webapp static resources.
- // -- Standalone jar
- public static final String baseResource1 = "webapp";
- // -- Development
- public static final String baseResource2 = "target/webapp";
-
- /**
- * Default setup which requires a {@link org.apache.jena.fuseki.cmd.JettyServerConfig}
- * object as input. We use this config to pass in the command line arguments for dataset,
- * name etc.
- * @param config
- */
- public static void initializeServer(JettyServerConfig config) {
- instance = new JettyFusekiWebapp(config);
- }
-
- private JettyFusekiWebapp(JettyServerConfig config) {
- this.serverConfig = config;
- buildServerWebapp(serverConfig.contextPath, serverConfig.jettyConfigFile);
- if ( mgtConnector == null )
- mgtConnector = serverConnector;
-
- if ( config.enableCompression ) {
- @SuppressWarnings("all")
- GzipHandler gzipHandler = new GzipHandler();
- gzipHandler.setHandler(server.getHandler());
- server.setHandler(gzipHandler);
- }
- }
-
- /**
- * Initialize the {@link JettyFusekiWebapp} instance.
- */
- public void start() {
-
- FusekiCoreInfo.logCode(serverLog);
- // This does not get anything usefully for Jetty as we use it.
- // String jettyVersion = org.eclipse.jetty.server.Server.getVersion();
- // serverLog.info(format("Jetty %s",jettyVersion));
-
- String host = serverConnector.getHost();
- if ( host != null )
- serverLog.info("Incoming connections limited to " + host);
-
- try {
- server.start();
- } catch (java.net.BindException ex) {
- serverLog.error("SPARQLServer (port="+serverConnector.getPort()+"): Failed to start server: " + ex.getMessage());
- throw new FusekiException("BindException: port="+serverConnector.getPort()+": Failed to start server: " + ex.getMessage(), ex);
- } catch (Exception ex) {
- serverLog.error("SPARQLServer: Failed to start server: " + ex.getMessage(), ex);
- throw new FusekiException("Failed to start server: " + ex.getMessage(), ex);
- }
- String now = DateTimeUtils.nowAsString();
- serverLog.info(format("Started %s on port %d", now, serverConnector.getPort()));
- }
-
- /**
- * Sync with the {@link JettyFusekiWebapp} instance.
- * Returns only if the server exits cleanly
- */
- public void join() {
- try {
- server.join();
- } catch (InterruptedException ex) { }
- }
-
- /**
- * Stop the {@link JettyFusekiWebapp} instance.
- */
- public void stop() {
- String now = DateTimeUtils.nowAsString();
- serverLog.info(format("Stopped %s on port %d", now, serverConnector.getPort()));
- try {
- server.stop();
- } catch (Exception ex) {
- Fuseki.serverLog.warn("SPARQLServer: Exception while stopping server: " + ex.getMessage(), ex);
- }
- }
-
- public static WebAppContext createWebApp(String contextPath) {
- FusekiEnv.setEnvironment();
- WebAppContext webapp = new WebAppContext();
- webapp.getContext().getServletContextHandler().setMaxFormContentSize(20 * 1000 * 1000);
-
- // Hunt for the webapp for the standalone jar (or development system).
- // Note that Path FUSEKI_HOME is not initialized until the webapp starts
- // so it is not available here.
-
- String baseResource3 = null;
- String baseResource4 = null;
- if ( FusekiEnv.FUSEKI_HOME != null ) {
- String HOME = FusekiEnv.FUSEKI_HOME.toString();
- baseResource3 = HOME+"/"+baseResource1;
- baseResource4 = HOME+"/"+baseResource2;
- }
-
- // The location in the webapp, not the URL names.
- String baseResource = tryBaseResource(baseResource1, null);
- baseResource = tryBaseResource(baseResource2, baseResource);
- baseResource = tryBaseResource(baseResource3, baseResource);
- baseResource = tryBaseResource(baseResource4, baseResource);
-
- if ( baseResource == null ) {
- if ( baseResource3 == null )
- Fuseki.serverLog.error("Can't find baseResource (tried "+baseResource1+" and "+baseResource2+")");
- else
- Fuseki.serverLog.error("Can't find baseResource (tried "+baseResource1+", "+baseResource2+", "+baseResource3+" and "+baseResource4+")");
- Fuseki.serverLog.error("Failed to start");
- throw new FusekiException("Failed to start");
- }
-
- String web_xml = baseResource+"/WEB-INF/web.xml";
- if ( ! FileOps.exists(web_xml) )
- Fuseki.serverLog.warn("Can't find WEB-INF/web.xml in "+baseResource);
- webapp.setDescriptor(web_xml);
- webapp.setContextPath(contextPath);
- // Avoid BaseResource aliasing warnings.
- Path absBaseResource = Path.of(baseResource).toAbsolutePath();
- webapp.getContext().getServletContextHandler().setBaseResourceAsPath(absBaseResource);
-
- //-- Jetty setup for the ServletContext logger.
- // The name of the Jetty-allocated slf4j/log4j logger is
- // the display name or, if null, the context path name.
- // It is set, without checking for a previous call of setLogger in "doStart"
- // which happens during server startup.
- // This the name of the ServletContext logger as well
- webapp.setDisplayName(Fuseki.servletRequestLogName);
- webapp.setParentLoaderPriority(true); // Normal Java classloader behaviour.
- webapp.setErrorHandler(new FusekiErrorHandler()); // If used.
- return webapp;
- }
-
- public static String getenv(String name) {
- String x = System.getenv(name);
- if ( x == null )
- x = System.getProperty(name);
- return x;
- }
-
- public DataAccessPointRegistry getDataAccessPointRegistry() {
- return DataAccessPointRegistry.get(servletContext);
- }
-
- private static String tryBaseResource(String maybeResourceBase, String currentResourceBase) {
- if ( currentResourceBase != null )
- return currentResourceBase;
- if ( maybeResourceBase != null && FileOps.exists(maybeResourceBase) )
- return maybeResourceBase;
- return currentResourceBase;
- }
-
- private void buildServerWebapp(String contextPath, String jettyConfig) {
- if ( jettyConfig != null )
- // --jetty-config=jetty-fuseki.xml
- // for detailed configuration of the server using Jetty features.
- configServer(jettyConfig);
- else
- defaultServerConfig(serverConfig.port, serverConfig.loopback);
-
- WebAppContext webapp = createWebApp(contextPath);
- if ( false /*enable symbolic links */ ) {
- // See http://www.eclipse.org/jetty/documentation/current/serving-aliased-files.html
- // Record what would be needed:
- // 1 - Allow all symbolic links without checking
- webapp.addAliasCheck(new AllowedResourceAliasChecker(webapp));
- // 2 - Check links are to valid resources. But default for Unix?
- webapp.addAliasCheck(new SymlinkAllowedResourceAliasChecker(webapp));
- }
- servletContext = webapp.getServletContext();
- server.setHandler(webapp);
- // Replaced by Shiro.
- if ( jettyConfig == null && serverConfig.authConfigFile != null )
- security(webapp, serverConfig.authConfigFile);
- }
-
- // This is normally provided by Shiro.
- private static void security(ServletContextHandler context, String authfile) {
- UserStore userStore = makeUserStore(authfile);
-
- ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
- IdentityService identService = new DefaultIdentityService();
- securityHandler.setIdentityService(identService);
-
- // ---- HashLoginService
- HashLoginService loginService = new HashLoginService("Fuseki Authentication");
- loginService.setUserStore(userStore);
- loginService.setIdentityService(identService);
- securityHandler.setLoginService(loginService);
-
- Authenticator authenticator = new BasicAuthenticator();
- securityHandler.setAuthenticator(authenticator);
- securityHandler.setRealmName("Fuseki");
-
- ConstraintMapping mapping = new ConstraintMapping();
- Constraint.Builder constraintBuilder = new Constraint.Builder();
- constraintBuilder.authorization(Authorization.ANY_USER);
-
- String authName = securityHandler.getAuthenticator().getAuthenticationType();
- constraintBuilder.name(authName);
-
- Constraint constraint = constraintBuilder.build();
- mapping.setConstraint(constraint);
- mapping.setPathSpec("/*");
- securityHandler.addConstraintMapping(mapping);
-
- context.setSecurityHandler(securityHandler);
- serverLog.debug("Basic Auth Configuration = " + authfile);
- }
-
- /**
- * Make a {@link UserStore} from a password file.
- * {@link PropertyUserStore} for details.
- */
- private static UserStore makeUserStore(String passwordFile) {
- if ( ! FileOps.exists(passwordFile) )
- throw new FusekiConfigException("No such file: "+passwordFile);
- PropertyUserStore propertyUserStore = new PropertyUserStore();
- Resource pwResource = newResource(passwordFile);
- propertyUserStore.setConfig(pwResource);
- propertyUserStore.setReloadInterval(5); // Need directory access
- try { propertyUserStore.start(); }
- catch (Exception ex) { throw new RuntimeException("UserStore", ex); }
- return propertyUserStore;
- }
-
- /** Create a resource for a filename */
- private static Resource newResource(String filename) {
- return ResourceFactory.root().newResource(filename);
- }
-
- private void defaultServerConfig(int port, boolean loopback) {
- // At least 3.
-// ThreadPool threadPool = new QueuedThreadPool(4);
-// server = new Server(threadPool);
- server = new Server();
- HttpConnectionFactory f1 = new HttpConnectionFactory();
- // Some people do try very large operations ... really, should use POST.
- f1.getHttpConfiguration().setRequestHeaderSize(512 * 1024);
- f1.getHttpConfiguration().setOutputBufferSize(5 * 1024 * 1024);
- // Do not add "Server: Jetty(....) when not a development system.
- if ( ! Fuseki.outputJettyServerHeader )
- f1.getHttpConfiguration().setSendServerVersion(false);
-
- // https is better done with a Jetty configuration file
- // because there are several things to configure.
- // See "examples/fuseki-jetty-https.xml"
-
- ServerConnector connector = new ServerConnector(server, f1);
- connector.setPort(port);
- server.addConnector(connector);
- if ( loopback )
- connector.setHost("localhost");
- serverConnector = connector;
- }
-
- private void configServer(String jettyConfig) {
- try {
- serverLog.info("Jetty server config file = " + jettyConfig);
- server = new Server();
- Resource configXml = ResourceFactory.root().newResource(jettyConfig);
- XmlConfiguration configuration = new XmlConfiguration(configXml);
- configuration.configure(server);
- serverConnector = (ServerConnector)server.getConnectors()[0];
- } catch (Exception ex) {
- serverLog.error("SPARQLServer: Failed to configure server: " + ex.getMessage(), ex);
- throw new FusekiException("Failed to configure a server using configuration file '" + jettyConfig + "'");
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/JettyServerConfig.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/JettyServerConfig.java
deleted file mode 100644
index 9047ebefdc..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/JettyServerConfig.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-
-/**
- * Configuration of the Jetty server when run from the command line directly,
- * not as a webapp/war file.
- */
-
-public class JettyServerConfig
-{
- public JettyServerConfig() {}
-
- /** Port to run the server service on */
- public int port;
-
- /** Path to run the server service under */
- public String contextPath;
-
- /** Jetty config file - if null, use the built-in configuration of Jetty */
- public String jettyConfigFile = null;
-
- /** Listen only on the loopback (localhost) interface */
- public boolean loopback = false;
-
- /** Enable Accept-Encoding compression. Set to false by default.*/
- public boolean enableCompression = false;
-
- /** Enable additional logging */
- public boolean verboseLogging = false;
-
- /** Authentication config file used to setup Jetty Basic auth,
- * if a Jetty config file was set this is ignored since Jetty config
- * allows much more complex auth methods to be implemented.
- * Using Apache Shiro is better as well.
- */
- public String authConfigFile;
-
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/WebappDSGSetup.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/WebappDSGSetup.java
deleted file mode 100644
index 47c4f4ef45..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/cmd/WebappDSGSetup.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.cmd;
-
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.cmd.CmdException;
-import org.apache.jena.fuseki.mgt.Template;
-import org.apache.jena.fuseki.system.spot.TDBOps;
-
-/*package*/ class WebappDSGSetup {
-
- /**
- * Given a path name and a preference of TDB1/TDB2 for new databases, return
- * details of the setup to use.
- */
- /*package*/ static void setup(String directory, boolean useTDB2, FusekiArgs cmdLineConfig) {
- if ( ! IO.exists(directory) )
- throw new CmdException("Does not exist: " + directory);
- if ( ! IO.isDirectory(directory) )
- throw new CmdException("Not a directory: " + directory);
-
- if ( IO.isEmptyDirectory(directory) ) {
- if ( useTDB2 )
- setupTDB2(directory, cmdLineConfig);
- else
- setupTDB1(directory, cmdLineConfig);
- return;
- }
-
- // Exists, not empty or does not exist
- if ( TDBOps.isTDB1(directory) ) {
- setupTDB1(directory, cmdLineConfig);
- return;
- } else if ( TDBOps.isTDB2(directory) ) {
- setupTDB2(directory, cmdLineConfig);
- return;
- } else
- throw new CmdException("Directory not a database: " + directory);
- }
-
- private static void setupTDB1(String directory, FusekiArgs cmdLineConfig) {
- cmdLineConfig.params.put(Template.DIR, directory);
- cmdLineConfig.templateFile = cmdLineConfig.allowUpdate
- ? Template.templateTDB1_DirFN
- : Template.templateTDB1_DirReadFN;
- cmdLineConfig.datasetDescription = "TDB1 dataset: location="+directory;
- }
-
- private static void setupTDB2(String directory, FusekiArgs cmdLineConfig) {
- cmdLineConfig.params.put(Template.DIR, directory);
- cmdLineConfig.templateFile = cmdLineConfig.allowUpdate
- ? Template.templateTDB2_DirFN
- : Template.templateTDB2_DirReadFN;
- cmdLineConfig.datasetDescription = "TDB2 dataset: location="+directory;
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
deleted file mode 100644
index 55b4ed139b..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionBackup.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import static java.lang.String.format;
-
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.ctl.ActionAsyncTask;
-import org.apache.jena.fuseki.ctl.TaskBase;
-import org.apache.jena.fuseki.servlets.HttpAction;
-import org.apache.jena.fuseki.servlets.ServletOps;
-import org.slf4j.Logger;
-
-public class ActionBackup extends ActionAsyncTask
-{
- public ActionBackup() { super("Backup"); }
-
- @Override
- public void validate(HttpAction action) {}
-
- @Override
- protected Runnable createRunnable(HttpAction action) {
- String name = getItemName(action);
- if ( name == null ) {
- action.log.error("Null for dataset name in item request");
- ServletOps.errorOccurred("Null for dataset name in item request");
- return null;
- }
-
- action.log.info(format("[%d] Backup dataset %s", action.id, name));
- // ** Error changing in TaskBase
- BackupTask task = new BackupTask(action);
- if ( task.dataset == null ) {
- ServletOps.errorBadRequest("Dataset not found");
- return null;
- }
- return task;
- }
-
- static class BackupTask extends TaskBase {
- static private Logger log = Fuseki.backupLog;
-
- public BackupTask(HttpAction action) {
- super(action);
- }
-
- @Override
- public void run() {
- try {
- String backupFilename = Backup.chooseFileName(datasetName);
- log.info(format("[%d] >>>> Start backup %s -> %s", actionId, datasetName, backupFilename));
- Backup.backup(transactional, dataset, backupFilename);
- log.info(format("[%d] <<<< Finish backup %s -> %s", actionId, datasetName, backupFilename));
- } catch (Throwable ex) {
- log.warn(format("[%d] **** Exception in backup", actionId), ex);
- // Pass on - the async task tracking infrastructure will record this.
- throw ex;
- }
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java
deleted file mode 100644
index c831c45e7b..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionBackupList.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import static java.lang.String.format;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.jena.atlas.json.JsonBuilder;
-import org.apache.jena.atlas.json.JsonValue;
-import org.apache.jena.fuseki.ctl.ActionCtl;
-import org.apache.jena.fuseki.servlets.HttpAction;
-import org.apache.jena.fuseki.servlets.ServletOps;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-
-/**
- * A JSON API to list all the backups in the backup directory
- */
-public class ActionBackupList extends ActionCtl {
-
- @Override
- public void execGet(HttpAction action) {
- executeLifecycle(action);
- }
-
- @Override
- public void execPost(HttpAction action) {
- executeLifecycle(action);
- }
-
- @Override
- public void validate(HttpAction action) {}
-
- @Override
- public void execute(HttpAction action) {
- JsonValue result = description(action);
- ServletOps.setNoCache(action);
- ServletOps.sendJsonReponse(action, result);
- }
-
- private static DirectoryStream.Filter<Path> filterVisibleFiles = (entry) -> {
- File f = entry.toFile();
- return f.isFile() && !f.isHidden();
- };
-
- private JsonValue description(HttpAction action) {
- if ( ! Files.isDirectory(FusekiWebapp.dirBackups) )
- ServletOps.errorOccurred(format("[%d] Backup area '%s' is not a directory", action.id, FusekiWebapp.dirBackups));
-
- List<Path> paths = new ArrayList<>();
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(FusekiWebapp.dirBackups, filterVisibleFiles)) {
- stream.forEach(paths::add);
- } catch (IOException ex) {
- action.log.error(format("[%d] Backup file list :: IOException :: %s", action.id, ex.getMessage()));
- ServletOps.errorOccurred(ex);
- }
-
- List<String> fileNames = paths.stream().map((p)->p.getFileName().toString()).sorted().toList();
-
- JsonBuilder builder = new JsonBuilder();
- builder.startObject("top");
- builder.key("backups");
-
- builder.startArray();
- fileNames.forEach(builder::value);
- builder.finishArray();
-
- builder.finishObject("top");
- return builder.build();
-
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
deleted file mode 100644
index 38164418a9..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionDatasets.java
+++ /dev/null
@@ -1,625 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import static java.lang.String.format;
-
-import java.io.StringReader;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.*;
-
-import jakarta.servlet.http.HttpServletRequest;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.jena.atlas.RuntimeIOException;
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.atlas.json.JsonBuilder;
-import org.apache.jena.atlas.json.JsonValue;
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.atlas.lib.InternalErrorException;
-import org.apache.jena.atlas.lib.NotImplemented;
-import org.apache.jena.atlas.logging.FmtLog;
-import org.apache.jena.atlas.web.ContentType;
-import org.apache.jena.datatypes.xsd.XSDDatatype;
-import org.apache.jena.dboe.base.file.Location;
-import org.apache.jena.fuseki.FusekiConfigException;
-import org.apache.jena.fuseki.build.DatasetDescriptionMap;
-import org.apache.jena.fuseki.build.FusekiConfig;
-import org.apache.jena.fuseki.ctl.ActionContainerItem;
-import org.apache.jena.fuseki.ctl.JsonDescription;
-import org.apache.jena.fuseki.metrics.MetricsProvider;
-import org.apache.jena.fuseki.server.*;
-import org.apache.jena.fuseki.servlets.ActionLib;
-import org.apache.jena.fuseki.servlets.HttpAction;
-import org.apache.jena.fuseki.servlets.ServletOps;
-import org.apache.jena.fuseki.system.FusekiNetLib;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.graph.Graph;
-import org.apache.jena.graph.Node;
-import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryFactory;
-import org.apache.jena.rdf.model.*;
-import org.apache.jena.rdf.model.impl.Util;
-import org.apache.jena.riot.*;
-import org.apache.jena.riot.system.StreamRDF;
-import org.apache.jena.riot.system.StreamRDFLib;
-import org.apache.jena.shared.JenaException;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.Quad;
-import org.apache.jena.sparql.core.assembler.AssemblerUtils;
-import org.apache.jena.sparql.exec.QueryExec;
-import org.apache.jena.sparql.exec.RowSet;
-import org.apache.jena.sparql.util.FmtUtils;
-import org.apache.jena.system.G;
-import org.apache.jena.tdb1.TDB1;
-import org.apache.jena.tdb2.TDB2;
-import org.apache.jena.vocabulary.RDF;
-import org.apache.jena.web.HttpSC;
-
-public class ActionDatasets extends ActionContainerItem {
- static private Property pServiceName = FusekiVocab.pServiceName;
-
- private static final String paramDatasetName = "dbName";
- private static final String paramDatasetType = "dbType";
- private static final String tDatabaseTDB1 = "tdb";
- private static final String tDatabaseTDB2 = "tdb2";
- private static final String tDatabaseMem = "mem";
-
- public ActionDatasets() { super(); }
-
- @Override
- public void validate(HttpAction action) { }
-
- // ---- GET : return details of dataset or datasets.
- @Override
- protected JsonValue execGetContainer(HttpAction action) {
- action.log.info(format("[%d] GET datasets", action.id));
- JsonBuilder builder = new JsonBuilder();
- builder.startObject("D");
- builder.key(ServerConst.datasets);
- JsonDescription.arrayDatasets(builder, action.getDataAccessPointRegistry());
- builder.finishObject("D");
- return builder.build();
- }
-
- @Override
- protected JsonValue execGetItem(HttpAction action) {
- String item = getItemDatasetName(action);
- action.log.info(format("[%d] GET dataset %s", action.id, item));
- JsonBuilder builder = new JsonBuilder();
- DataAccessPoint dsDesc = getItemDataAccessPoint(action, item);
- if ( dsDesc == null )
- ServletOps.errorNotFound("Not found: dataset "+item);
- JsonDescription.describe(builder, dsDesc);
- return builder.build();
- }
-
- // ---- POST
-
- /** Create dataset */
- @Override
- protected JsonValue execPostContainer(HttpAction action) {
- UUID uuid = UUID.randomUUID();
-
- ContentType ct = ActionLib.getContentType(action);
-
- boolean hasParams = action.getRequestParameterNames().hasMoreElements();
-
- if ( ct == null && ! hasParams )
- ServletOps.errorBadRequest("Bad request - Content-Type or both parameters dbName and dbType required");
-
- boolean succeeded = false;
- // Used in clear-up.
- String configFile = null;
- String systemFileCopy = null;
-
- DatasetDescriptionMap registry = new DatasetDescriptionMap();
-
- synchronized (FusekiWebapp.systemLock) {
- try {
- // Get the request input.
- Model modelFromRequest = ModelFactory.createDefaultModel();
- StreamRDF dest = StreamRDFLib.graph(modelFromRequest.getGraph());
-
- boolean templatedRequest = false;
-
- try {
- if ( hasParams || WebContent.isHtmlForm(ct) ) {
- assemblerFromForm(action, dest);
- templatedRequest = true;
- // dbName, dbType
- } else if ( WebContent.isMultiPartForm(ct) ) {
- // Cannot be enabled.
- ServletOps.errorBadRequest("Service configuration from a multipart upload not supported");
- //assemblerFromUpload(action, dest);
- } else {
- if ( ! FusekiWebapp.allowConfigFiles() )
- ServletOps.errorBadRequest("Service configuration from an upload file not supported");
- assemblerFromBody(action, dest);
- }
- } catch (RiotException ex) {
- ActionLib.consumeBody(action);
- action.log.warn(format("[%d] Failed to read configuration: %s", action.id, ex.getMessage()));
- ServletOps.errorBadRequest("Failed to read configuration");
- }
-
- // ----
- // Add the dataset and graph wiring for assemblers
- Model model = ModelFactory.createDefaultModel();
- model.add(modelFromRequest);
- model = AssemblerUtils.prepareForAssembler(model);
-
- // ----
- // Process configuration.
- // Returns the "service fu:name NAME" statement
- Statement stmt = findService(model);
- if ( stmt == null ) {
- action.log.warn(format("[%d] No service name", action.id));
- ServletOps.errorBadRequest(format("No service name"));
- }
-
- Resource subject = stmt.getSubject();
- Literal object = stmt.getObject().asLiteral();
-
- if ( object.getDatatype() != null && ! object.getDatatype().equals(XSDDatatype.XSDstring) )
- action.log.warn(format("[%d] Service name '%s' is not a string", action.id, FmtUtils.stringForRDFNode(object)));
-
- final String datasetPath;
- {
- String datasetName = object.getLexicalForm();
- // This duplicates the code FusekiBuilder.buildDataAccessPoint to give better error messages and HTTP status code."
-
- // ---- Check and canonicalize name.
- // Various explicit check for better error messages.
-
- if ( datasetName.isEmpty() ) {
- action.log.warn(format("[%d] Empty dataset name", action.id));
- ServletOps.errorBadRequest("Empty dataset name");
- }
- if ( StringUtils.isBlank(datasetName) ) {
- action.log.warn(format("[%d] Whitespace dataset name: '%s'", action.id, datasetName));
- ServletOps.errorBadRequest(format("Whitespace dataset name: '%s'", datasetName));
- }
- if ( datasetName.contains(" ") ) {
- action.log.warn(format("[%d] Bad dataset name (contains spaces) '%s'", action.id, datasetName));
- ServletOps.errorBadRequest(format("Bad dataset name (contains spaces) '%s'", datasetName));
- }
- if ( datasetName.equals("/") ) {
- action.log.warn(format("[%d] Bad dataset name '%s'", action.id, datasetName));
- ServletOps.errorBadRequest(format("Bad dataset name '%s'", datasetName));
- }
-
- // The service names must be a valid URI path
- try {
- ValidString validServiceName = Validators.serviceName(datasetName);
- } catch (FusekiConfigException ex) {
- action.log.warn(format("[%d] Invalid service name: '%s'", action.id, datasetName));
- ServletOps.error(HttpSC.BAD_REQUEST_400, format("Invalid service name: '%s'", datasetName));
- }
-
- // Canonical - starts with "/",does not end in "/"
- datasetPath = DataAccessPoint.canonical(datasetName);
-
- // For this operation, check additionally that the path does not go outside the expected file area.
- // This imposes the path component-only rule and does not allow ".."
- if ( ! isValidServiceName(datasetPath) ) {
- action.log.warn(format("[%d] Database service name not acceptable: '%s'", action.id, datasetName));
- ServletOps.error(HttpSC.BAD_REQUEST_400, format("Database service name not acceptable: '%s'", datasetName));
- }
- }
-
- // ---- Check whether it already exists
- if ( action.getDataAccessPointRegistry().isRegistered(datasetPath) ) {
- action.log.warn(format("[%d] Name already registered '%s'", action.id, datasetPath));
- ServletOps.error(HttpSC.CONFLICT_409, format("Name already registered '%s'", datasetPath));
- }
-
- // -- Validate any TDB locations.
- // If this is a templated request, there is no need to do this
- // because the location is "datasetPath" which has been checked.
- if ( ! templatedRequest ) {
- // -- Validate any TDB locations.
- // If this is a templated request, there is no need to do this because the location is "datasetPath"
- List<String> tdbLocations = tdbLocations(action, model.getGraph());
- for(String tdbLocation : tdbLocations ) {
- if ( ! isValidTDBLocation(tdbLocation) ) {
- action.log.warn(format("[%d] TDB database location not acceptable: '%s'", action.id, tdbLocation));
- ServletOps.error(HttpSC.BAD_REQUEST_400, format("TDB database location not acceptable: '%s'", tdbLocation));
- }
- }
- }
-
- // ----
- // Keep a persistent copy with a globally unique name.
- // This is not used for anything other than being "for the record".
- systemFileCopy = FusekiWebapp.dirSystemFileArea.resolve(uuid.toString()).toString();
- RDFWriter.source(model).lang(Lang.TURTLE).output(systemFileCopy);
-
- // ----
- action.log.info(format("[%d] Create database : name = %s", action.id, datasetPath));
-
- List<String> existing = FusekiWebapp.existingConfigurationFile(datasetPath);
- if ( ! existing.isEmpty() )
- ServletOps.error(HttpSC.CONFLICT_409, "Configuration file for '"+datasetPath+"' already exists");
-
- configFile = FusekiWebapp.generateConfigurationFilename(datasetPath);
-
- // ---- Build the service
- DataAccessPoint dataAccessPoint = FusekiConfig.buildDataAccessPoint(subject.getModel().getGraph(), subject.asNode(), registry);
- if ( dataAccessPoint == null ) {
- FmtLog.error(action.log, "Failed to build DataAccessPoint: datasetPath = %s; DataAccessPoint name = %s", datasetPath, dataAccessPoint);
- ServletOps.errorBadRequest("Failed to build DataAccessPoint");
- return null;
- }
- dataAccessPoint.getDataService().setEndpointProcessors(action.getOperationRegistry());
-
- // Write to configuration directory.
- RDFWriter.source(model).lang(Lang.TURTLE).output(configFile);
-
- if ( ! datasetPath.equals(dataAccessPoint.getName()) )
- FmtLog.warn(action.log, "Inconsistent names: datasetPath = %s; DataAccessPoint name = %s", datasetPath, dataAccessPoint);
-
- dataAccessPoint.getDataService().goActive();
- succeeded = true;
-
- // At this point, a server restarting will find the new service.
- // This next line makes it dispatchable in this running server.
- action.getDataAccessPointRegistry().register(dataAccessPoint);
-
- // Add to metrics
- MetricsProvider metricProvider = action.getMetricsProvider();
- if ( metricProvider != null )
- action.getMetricsProvider().addDataAccessPointMetrics(dataAccessPoint);
-
- action.setResponseContentType(WebContent.contentTypeTextPlain);
- ServletOps.success(action);
- } finally {
- // Clear-up on failure.
- if ( ! succeeded ) {
- if ( systemFileCopy != null ) FileOps.deleteSilent(systemFileCopy);
- if ( configFile != null ) FileOps.deleteSilent(configFile);
- }
- }
- return null;
- }
- }
-
- /**
- * Check whether a service name is acceptable.
- * A service name is used as a filesystem path component,
- * except it may have a leading "/"., to store the database and the configuration.
- * <p>
- * The canonical name for a service (see {@link DataAccessPoint#canonical})
- * starts with a "/" and this will be added if necessary.
- */
- private boolean isValidServiceName(String datasetPath) {
- // Leading "/" is OK , nowhere else is.
- int idx = datasetPath.indexOf('/', 1);
- if ( idx > 0 )
- return false;
- // No slash, except maybe at the start so a meaningful use of .. can only be at the start.
- if ( datasetPath.startsWith("/.."))
- return false;
- // Character restrictions done by Validators.serviceName
- return true;
- }
-
- // This works for TDB1 as well.
- private boolean isValidTDBLocation(String tdbLocation) {
- Location location = Location.create(tdbLocation);
- if ( location.isMem() )
- return true;
- String locationString = location.getDirectoryPath();
- // No ".."
- if (locationString.startsWith("..") || locationString.contains("/..") ) {
- // That test was too strict.
- List<String> components = FileOps.pathComponents(locationString);
- if ( components.contains("..") )
- return false;
- }
- return true;
- }
-
- /** Find the service resource. There must be only one in the configuration. */
- private Statement findService(Model model) {
- // Try to find by unique pServiceName (max backwards compatibility)
- // then try to find by rdf:type fuseki:Service.
-
- Statement stmt = getOne(model, null, pServiceName, null);
- // null means 0 or many, not one.
-
- if ( stmt == null ) {
- // This calculates { ?x rdf:type fu:Service ; ?x fu:name ?name }
- // One and only one service.
- Statement stmt2 = getOne(model, null, RDF.type, FusekiVocab.fusekiService);
- if ( stmt2 == null ) {
- int count = model.listStatements(null, RDF.type, FusekiVocab.fusekiService).toList().size();
- if ( count == 0 )
- ServletOps.errorBadRequest("No triple rdf:type fuseki:Service found");
- else
- ServletOps.errorBadRequest("Multiple Fuseki service descriptions");
- }
- Statement stmt3 = getOne(model, stmt2.getSubject(), pServiceName, null);
- if ( stmt3 == null ) {
- StmtIterator sIter = model.listStatements(stmt2.getSubject(), pServiceName, (RDFNode)null );
- if ( ! sIter.hasNext() )
- ServletOps.errorBadRequest("No name given in description of Fuseki service");
- sIter.next();
- if ( sIter.hasNext() )
- ServletOps.errorBadRequest("Multiple names given in description of Fuseki service");
- throw new InternalErrorException("Inconsistent: getOne didn't fail the second time");
- }
- stmt = stmt3;
- }
-
- if ( stmt == null )
- return null;
-
- if ( ! stmt.getObject().isLiteral() )
- ServletOps.errorBadRequest("Found "+FmtUtils.stringForRDFNode(stmt.getObject())+" : Service names are strings, which are then used to build the external URI");
-
- return stmt;
- }
-
- @Override
- protected JsonValue execPostItem(HttpAction action) {
- String name = getItemDatasetName(action);
- if ( name == null )
- name = "''";
- action.log.info(format("[%d] POST dataset %s", action.id, name));
-
- // Not in the action - this not an ActionService.
- DataAccessPoint dap = getItemDataAccessPoint(action, name);
-
- if ( dap == null )
- ServletOps.errorNotFound("Not found: dataset "+name);
-
- DataService dSrv = dap.getDataService();
- if ( dSrv == null )
- // If not set explicitly, take from DataAccessPoint
- dSrv = action.getDataAccessPoint().getDataService();
-
- String s = action.getRequestParameter("state");
- if ( s == null || s.isEmpty() )
- ServletOps.errorBadRequest("No state change given");
- return null;
- }
-
- // ---- DELETE
-
- @Override
- protected void execDeleteItem(HttpAction action) {
- // Does not exist?
- String name = getItemDatasetName(action);
- if ( name == null )
- name = "";
- action.log.info(format("[%d] DELETE dataset=%s", action.id, name));
-
- if ( ! action.getDataAccessPointRegistry().isRegistered(name) )
- ServletOps.errorNotFound("No such dataset registered: "+name);
-
- boolean succeeded = false;
-
- synchronized(FusekiWebapp.systemLock) {
- try {
- // Redo check inside transaction.
- DataAccessPoint ref = action.getDataAccessPointRegistry().get(name);
- if ( ref == null )
- ServletOps.errorNotFound("No such dataset registered: "+name);
-
- // Get a reference before removing.
- DataService dataService = ref.getDataService();
-
- // Remove from the registry - operation dispatch will not find it any more.
- action.getDataAccessPointRegistry().remove(name);
-
- // Find the configuration.
- List<String> configurationFiles = FusekiWebapp.existingConfigurationFile(name);
-
- if ( configurationFiles.isEmpty() ) {
- // -- Unmanaged
- action.log.warn(format("[%d] Can't delete database configuration - not a managed database", action.id, name));
-// ServletOps.errorOccurred(format("Can't delete database - not a managed configuration", name));
- succeeded = true;
- ServletOps.success(action);
- return;
- }
-
- if ( configurationFiles.size() > 1 ) {
- // -- This should not happen.
- action.log.warn(format("[%d] There are %d configuration files, not one.", action.id, configurationFiles.size()));
- ServletOps.errorOccurred(format("There are %d configuration files, not one. Delete not performed; manual clean up of the filesystem needed.",
- configurationFiles.size()));
- return;
- }
-
- // -- Remove managed database.
- String cfgPathname = configurationFiles.get(0);
-
- // Delete configuration file.
- // Once deleted, server restart will not have the database.
- FileOps.deleteSilent(cfgPathname);
-
- // Delete the database for real only if it is in the server
- // "run/databases" area. Don't delete databases that reside
- // elsewhere. We have already deleted the configuration file, so the
- // databases will not be associated with the server anymore.
-
- @SuppressWarnings("removal")
- boolean isTDB1 = org.apache.jena.tdb1.sys.TDBInternal.isTDB1(dataService.getDataset());
- boolean isTDB2 = org.apache.jena.tdb2.sys.TDBInternal.isTDB2(dataService.getDataset());
-
- try {
- dataService.shutdown();
- } catch (JenaException ex) {
- return;
- }
- // JENA-1481: Really delete files.
- if ( ( isTDB1 || isTDB2 ) ) {
- // Delete databases created by the UI, or the admin operation, which are
- // in predictable, unshared locations on disk.
- // There may not be any database files, the in-memory case.
- // (TDB supports an in-memory mode.)
- String filename = name.startsWith("/") ? name.substring(1) : name;
- Path pDatabase = FusekiWebapp.dirDatabases.resolve(filename);
- if ( Files.exists(pDatabase)) {
- try {
- if ( Files.isSymbolicLink(pDatabase)) {
- action.log.info(format("[%d] Database is a symbolic link, not removing files", action.id, pDatabase));
- } else {
- IO.deleteAll(pDatabase);
- action.log.info(format("[%d] Deleted database files %s", action.id, pDatabase));
- }
- } catch (RuntimeIOException ex) {
- action.log.error(format("[%d] Error while deleting database files %s: %s", action.id, pDatabase, ex.getMessage()), ex);
- // But we have managed to remove it from the running server, and removed its configuration, so declare victory.
- }
- }
- }
-
- succeeded = true;
- ServletOps.success(action);
- } finally {
- // No clearup needed
- }
- }
- }
-
- private static void assemblerFromBody(HttpAction action, StreamRDF dest) {
- bodyAsGraph(action, dest);
- }
-
- private static Map<String, String> dbTypeToTemplate = new HashMap<>();
- static {
- dbTypeToTemplate.put(tDatabaseTDB1, Template.templateTDB1_FN);
- dbTypeToTemplate.put(tDatabaseTDB2, Template.templateTDB2_FN);
- dbTypeToTemplate.put(tDatabaseMem, Template.templateTIM_MemFN);
- }
-
- private static void assemblerFromForm(HttpAction action, StreamRDF dest) {
- String dbType = action.getRequestParameter(paramDatasetType);
- String dbName = action.getRequestParameter(paramDatasetName);
- // Test for null, empty or only whitespace.
- if ( StringUtils.isBlank(dbType) || StringUtils.isBlank(dbName) ) {
- action.log.warn(format("[%d] Both parameters 'dbName' and 'dbType' required and not be blank", action.id));
- ServletOps.errorBadRequest("Received HTML form. Both parameters 'dbName' and 'dbType' required");
- }
-
- Map<String, String> params = new HashMap<>();
- if ( dbName.startsWith("/") )
- params.put(Template.NAME, dbName.substring(1));
- else
- params.put(Template.NAME, dbName);
- params.put(Template.NAME, dbName);
- FusekiWebapp.addGlobals(params);
-
- String template = dbTypeToTemplate.get(dbType.toLowerCase(Locale.ROOT));
- if ( template == null ) {
- List<String> keys = new ArrayList<>(dbTypeToTemplate.keySet());
- Collections.sort(keys);
- ServletOps.errorBadRequest(format("dbType can be only one of %s", keys));
- }
-
- String instance = TemplateFunctions.templateFile(template, params, Lang.TTL);
- RDFParser.create().source(new StringReader(instance)).base("http://base/").lang(Lang.TTL).parse(dest);
- }
-
- private static void assemblerFromUpload(HttpAction action, StreamRDF dest) {
- throw new NotImplemented();
- //DataUploader.incomingData(action, dest);
- }
-
- // ---- Auxiliary functions
-
- private static Quad getOne(DatasetGraph dsg, Node g, Node s, Node p, Node o) {
- Iterator<Quad> iter = dsg.findNG(g, s, p, o);
- if ( ! iter.hasNext() )
- return null;
- Quad q = iter.next();
- if ( iter.hasNext() )
- return null;
- return q;
- }
-
- private static Statement getOne(Model m, Resource s, Property p, RDFNode o) {
- StmtIterator iter = m.listStatements(s, p, o);
- if ( ! iter.hasNext() )
- return null;
- Statement stmt = iter.next();
- if ( iter.hasNext() )
- return null;
- return stmt;
- }
-
- private static void bodyAsGraph(HttpAction action, StreamRDF dest) {
- HttpServletRequest request = action.getRequest();
- String base = ActionLib.wholeRequestURL(request);
- ContentType ct = FusekiNetLib.getContentType(request);
- Lang lang = RDFLanguages.contentTypeToLang(ct.getContentTypeStr());
- if ( lang == null ) {
- ServletOps.errorBadRequest("Unknown content type for triples: " + ct);
- return;
- }
- dest.prefix("root", base+"#");
- ActionLib.parse(action, dest, lang, base);
- }
-
- // ---- POST
-
- private static final String NL = "\n";
-
- @SuppressWarnings("removal")
- private static final String queryStringLocations =
- "PREFIX tdb1: <"+TDB1.namespace+">"+NL+
- "PREFIX tdb2: <"+TDB2.namespace+">"+NL+
- """
- SELECT * {
- ?x ( tdb2:location | tdb1:location) ?location
- }
- """ ;
-
- private static final Query queryLocations = QueryFactory.create(queryStringLocations);
-
- private static List<String> tdbLocations(HttpAction action, Graph configGraph) {
- try ( QueryExec exec = QueryExec.graph(configGraph).query(queryLocations).build() ) {
- RowSet results = exec.select();
- List<String> locations = new ArrayList<>();
- results.forEach(b->{
- Node loc = b.get("location");
- String location;
- if ( loc.isURI() )
- location = loc.getURI();
- else if ( Util.isSimpleString(loc) )
- location = G.asString(loc);
- else {
- //action.log.warn(format("[%d] Database location is not a string nor a URI", action.id));
- // No return
- ServletOps.errorBadRequest("TDB database location is not a string");
- location = null;
- }
- locations.add(location);
- });
- return locations;
- } catch (Exception ex) {
- // No return
- ServletOps.errorBadRequest("TDB database location can not be deterined");
- return null;
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java
deleted file mode 100644
index f8978a8fc4..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionLogs.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import static org.apache.jena.riot.WebContent.charsetUTF8;
-import static org.apache.jena.riot.WebContent.contentTypeTextPlain;
-
-import java.io.IOException;
-
-import jakarta.servlet.ServletOutputStream;
-
-import org.apache.jena.fuseki.ctl.ActionCtl;
-import org.apache.jena.fuseki.servlets.HttpAction;
-import org.apache.jena.fuseki.servlets.ServletOps;
-
-public class ActionLogs extends ActionCtl
-{
- public ActionLogs() { super(); }
-
- @Override
- public void validate(HttpAction action) {}
-
- @Override
- public void execGet(HttpAction action) {
- executeLifecycle(action);
- }
-
- @Override
- public void execute(HttpAction action) {
- try {
- ServletOutputStream out = action.getResponseOutputStream();
- action.setResponseContentType(contentTypeTextPlain);
- action.setResponseCharacterEncoding(charsetUTF8);
- out.println("Not implemented yet");
- out.println();
- out.flush();
- ServletOps.success(action);
- } catch (IOException ex) { ServletOps.errorOccurred(ex); }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
deleted file mode 100644
index 73069c7076..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionServerStatus.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import static org.apache.jena.riot.WebContent.charsetUTF8;
-import static org.apache.jena.riot.WebContent.contentTypeJSON;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import org.apache.jena.atlas.json.JSON;
-import org.apache.jena.atlas.json.JsonBuilder;
-import org.apache.jena.atlas.json.JsonValue;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.ctl.ActionCtl;
-import org.apache.jena.fuseki.ctl.JsonDescription;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry;
-import org.apache.jena.fuseki.server.ServerConst;
-import org.apache.jena.fuseki.servlets.HttpAction;
-import org.apache.jena.fuseki.servlets.ServletOps;
-
-/** Description of datasets for a server */
-public class ActionServerStatus extends ActionCtl
-{
- public ActionServerStatus() { super(); }
-
- @Override
- public void validate(HttpAction action) {}
-
- @Override
- public void execGet(HttpAction action) {
- executeLifecycle(action);
- }
-
- @Override
- public void execPost(HttpAction action) {
- executeLifecycle(action);
- }
-
- @Override
- public void execute(HttpAction action) {
- try {
- description(action);
- ServletOps.success(action);
- } catch (IOException e) {
- ServletOps.errorOccurred(e);
- }
- }
-
- private void description(HttpAction action) throws IOException {
- OutputStream out = action.getResponseOutputStream();
- action.setResponseContentType(contentTypeJSON);
- action.setResponseCharacterEncoding(charsetUTF8);
-
- JsonBuilder builder = new JsonBuilder();
- builder.startObject();
- describeServer(builder, action.getRequestLocalPort());
- describeDatasets(builder, action.getDataAccessPointRegistry());
- builder.finishObject();
-
- JsonValue v = builder.build();
- JSON.write(out, v);
- out.write('\n');
- out.flush();
- }
-
- private void describeServer(JsonBuilder builder, int requestPort) {
- String versionStr = Fuseki.VERSION;
- builder
- .pair(ServerMgtConst.version, versionStr)
- .pair(ServerMgtConst.startDT, Fuseki.serverStartedAt())
- .pair(ServerMgtConst.uptime, Fuseki.serverUptimeSeconds())
- ;
- }
-
- private void describeDatasets(JsonBuilder builder, DataAccessPointRegistry registry) {
- builder.key(ServerConst.datasets);
- JsonDescription.arrayDatasets(builder, registry);
- }
-
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/Backup.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/Backup.java
deleted file mode 100644
index 5d16692965..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/Backup.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import java.io.BufferedOutputStream;
-import java.io.OutputStream;
-import java.nio.file.Path;
-import java.util.Collections;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.zip.GZIPOutputStream;
-
-import org.apache.jena.atlas.io.IOX;
-import org.apache.jena.atlas.lib.DateTimeUtils;
-import org.apache.jena.atlas.logging.FmtLog;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.FusekiException;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.Transactional;
-import org.apache.jena.sparql.core.TransactionalNull;
-import org.apache.jena.system.Txn;
-
-/** Perform a backup */
-public class Backup
-{
- public static String chooseFileName(String dsName) {
- // Without the "/" - i.e. a relative name.
- String ds = dsName;
- if ( ds.startsWith("/") )
- ds = ds.substring(1);
- if ( ds.contains("/") ) {
- Fuseki.adminLog.warn("Dataset name: weird format: "+dsName);
- // Some kind of fixup
- ds = ds.replace("/", "_");
- }
-
- String timestamp = DateTimeUtils.nowAsString("yyyy-MM-dd_HH-mm-ss");
- String filename = ds + "_" + timestamp;
- filename = FusekiWebapp.dirBackups.resolve(filename).toString();
- return filename;
- }
-
- // Record of all backups so we don't attempt to backup the
- // same dataset multiple times at the same time.
- private static Set<DatasetGraph> activeBackups = Collections.newSetFromMap(new ConcurrentHashMap<>());
-
- /**
- * Perform a backup.
- * <p>
- * A backup is a dump of the dataset in compressed N-Quads, done inside a transaction.
- */
- public static void backup(Transactional transactional, DatasetGraph dsg, String backupfile) {
- if ( transactional == null )
- transactional = new TransactionalNull();
- Txn.executeRead(transactional, ()->backup(dsg, backupfile));
- }
-
- // This seems to achieve about the same as "gzip -6"
- // It's not too expensive in elapsed time but it's not
- // zero cost. GZip, large buffer.
- private static final boolean USE_GZIP = true;
-
- /**
- * Perform a backup.
- *
- * @see #backup(Transactional, DatasetGraph, String)
- */
-
- private static void backup(DatasetGraph dsg, String backupfile) {
- if (dsg == null) {
- throw new FusekiException("No dataset provided to backup");
- }
-
- // Per backup source lock.
- synchronized(activeBackups) {
- // Atomically check-and-set
- if ( activeBackups.contains(dsg) )
- FmtLog.warn(Fuseki.serverLog, "Backup already in progress");
- activeBackups.add(dsg);
- }
-
- if ( !backupfile.endsWith(".nq") )
- backupfile = backupfile + ".nq";
-
- if ( USE_GZIP )
- backupfile = backupfile + ".gz";
-
- try {
- IOX.safeWrite(Path.of(backupfile), outfile -> {
- OutputStream out = outfile;
- if ( USE_GZIP )
- out = new GZIPOutputStream(outfile, 8 * 1024);
- try (OutputStream out2 = new BufferedOutputStream(out)) {
- RDFDataMgr.write(out2, dsg, Lang.NQUADS);
- }
- });
- } finally {
- // Remove lock.
- synchronized(activeBackups) {
- activeBackups.remove(dsg);
- }
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java
deleted file mode 100644
index 056b161470..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ServerMgtConst.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-/**
- * Various constants used in the management API functions and JSON responses in the
- * webapp/full server.
- */
-public class ServerMgtConst {
- public static final String opDatasets = "datasets";
- public static final String opBackup = "backup";
- public static final String opCompact = "compact";
- public static final String opListBackups = "backups-list";
- public static final String opServer = "server";
-
- public static final String uptime = "uptime";
- public static final String startDT = "startDateTime";
-// public static final String server = "server";
-// public static final String port = "port";
- public static final String hostname = "hostname";
- public static final String admin = "admin";
- public static final String version = "version";
- public static final String built = "built";
- public static final String services = "services";
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/Template.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/Template.java
deleted file mode 100644
index f8d7bc9525..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/Template.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import java.nio.file.Path;
-
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-
-public class Template
-{
- public static Path getPath(String templateName) {
- return FusekiEnv.FUSEKI_BASE.resolve(templateName);
- }
-
- public static final String templateDir = "templates";
-
- // These are used by the command line start up.
- public static final String templateServiceFN = templateDir+"/config-service"; // Dummy used by dataset-less service.
-
- // TDB1 - for backwards compatibility, the files are called "tdb"
- public static final String templateTDB1_FN = templateDir+"/config-tdb";
- public static final String templateTDB1_MemFN = templateDir+"/config-tdb-mem";
- public static final String templateTDB1_DirFN = templateDir+"/config-tdb-dir";
- public static final String templateTDB1_DirReadFN = templateDir+"/config-tdb-dir-readonly";
-
- public static final String templateTDB2_FN = templateDir+"/config-tdb2";
- public static final String templateTDB2_MemFN = templateDir+"/config-tdb2-mem";
- public static final String templateTDB2_DirFN = templateDir+"/config-tdb2-dir";
- public static final String templateTDB2_DirReadFN = templateDir+"/config-tdb2-dir-readonly";
-
-
- public static final String templateTIM_MemFN = templateDir+"/config-mem";
- public static final String templateTIM_MemReadFN = templateDir+"/config-mem-readonly";
-
- // Template may be in a resources area of a jar file so you can't do a directory listing.
- public static final String[] templateNames = {
- templateTIM_MemFN,
-
- templateTDB1_FN ,
- templateTDB1_MemFN ,
- templateTDB1_DirFN ,
- templateTDB1_DirReadFN,
-
- templateTDB2_FN ,
- templateTDB2_MemFN ,
- templateTDB2_DirFN ,
- templateTDB2_DirReadFN
- };
-
- public static final String NAME = "NAME";
- public static final String DATA = "DATA";
- public static final String DIR = "DIR";
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/TemplateFunctions.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/TemplateFunctions.java
deleted file mode 100644
index 1b8686fad4..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/TemplateFunctions.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.mgt;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.util.FileUtils;
-
-public class TemplateFunctions
-{
- /** Read in a template from a file, substitute for {NAME} and return the string. */
- public static String templateFile(String templateName, Map<String, String> params, Lang lang) {
- String templateFilename = Template.getPath(templateName).toString();
- String template;
- try { template = FileUtils.readWholeFileAsUTF8(templateFilename); }
- catch (IOException ex) {
- Fuseki.serverLog.error("File not found: "+templateFilename);
- IO.exception(ex); return null;
- }
- return templateString(template, params, lang);
- }
-
- /** Read a template file, substitute for {NAME} and return the model. */
- public static String templateResource(String resourceName, Map<String, String> params, Lang lang) {
- String template;
- try {
- InputStream in = TemplateFunctions.class.getClassLoader().getResourceAsStream(resourceName);
- if ( in == null )
- Fuseki.serverLog.error("Resource not found: "+resourceName);
- template = FileUtils.readWholeFileAsUTF8(in);
- }
- catch (IOException ex) {
- Fuseki.serverLog.error("Error reading resource: "+resourceName);
- IO.exception(ex); return null;
- }
- return templateString(template, params, lang);
- }
-
- /** Create a template from a String */
- public static String templateString(String template, Map<String, String> params, Lang lang) {
- for ( Entry<String, String> e : params.entrySet() ) {
- // Literal string replacement.
- // If using .replaceAll, need to use Match.quoteReplacement on the value.
- String x = e.getValue();
- String k = "{"+e.getKey()+"}";
-
- if ( lang != null ) {
- if ( Lang.TTL.equals(lang) ||
- Lang.TRIG.equals(lang) ||
- Lang.NT.equals(lang) ||
- Lang.NQ.equals(lang) ||
- Lang.JSONLD.equals(lang) ||
- Lang.RDFJSON.equals(lang)
- ) {
- // Make safe for a RDF language ""-string - especially MS Windows \ path separators.
- x = x.replace("\\", "\\\\");
- x = x.replace("\"", "\\\"");
- }
- }
- template = template.replace(k, x);
- }
- return template;
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java
deleted file mode 100644
index bc14db2ba1..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiEnv.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.webapp;
-
-import static org.apache.jena.atlas.lib.Lib.getenv;
-
-import java.nio.file.Path;
-
-import org.apache.commons.lang3.SystemUtils;
-
-/**
- * Separate initialization for FUSEKI_HOME and FUSEKI_BASE so that
- * FusekiLogging can use these values.
- * This code must not touch Jena.
- *
- * @see FusekiWebapp
- */
-public class FusekiEnv {
- // Initialization logging happens via stdout/stderr directly.
- // Fuseki logging is not initialized to avoid going in circles.
-
- private static final boolean LogInit = false;
-
- /** Unused */
- // public static final String DFT_FUSEKI_HOME = isWindows
- // ? /*What's correct here?*/ "/usr/share/fuseki"
- // : "/usr/share/fuseki";
- static final boolean isWindows = SystemUtils.IS_OS_WINDOWS;
- static final String DFT_FUSEKI_BASE = isWindows ? /* What's correct here? */"/etc/fuseki" : "/etc/fuseki";
-
- /** Initialization mode, depending on the way Fuseki is started:
- <ul>
- <li>{@code WAR} - Running as a WAR file.</li>
- <li>{@code EMBEDDED}</li>
- <li>{@code STANDALONE} - Running as the standalone server in Jetty</li>
- <li>{@code TEST} - Running inside maven/JUnit and as the standalone server</li>
- <li>{@code UNSET} - Initial state.</li>
- </ul>
- <p>
- If at server initialization, the MODE is UNSET, then assume WAR setup.
- A WAR file does not have the opportunity to set the mode.
- <p>
- TEST: (better to set FUSEKI_HOME, FUSEKI_BASE from the test environment
- */
- public enum INIT {
- // Default values of FUSEKI_HOME, and FUSEKI_BASE.
- WAR (null, "/etc/fuseki") ,
- EMBEDDED (null, null) ,
- STANDALONE (".", "run") ,
- TEST ("src/main/webapp", "target/run") ,
- UNSET (null, null);
-
- final String dftFusekiHome;
- final String dftFusekiBase;
-
- INIT(String home, String base) {
- this.dftFusekiHome = home;
- this.dftFusekiBase = base;
- }
- }
-
- public static INIT mode = INIT.UNSET;
-
- /** Root of the Fuseki installation for fixed files.
- * This may be null (e.g. running inside a web application container) */
- public static Path FUSEKI_HOME = null;
-
- /** Root of the varying files in this deployment. Often $FUSEKI_HOME/run.
- * This is not null - it may be /etc/fuseki, which must be writable.
- */
- public static Path FUSEKI_BASE = null;
-
- public static final String ENV_runArea = "run";
- private static boolean initialized = false;
-
- /** Initialize the server : standalone and WAR versions : not embedded */
- public static synchronized void setEnvironment() {
- if ( initialized )
- return;
- resetEnvironment();
- }
-
- /** Reset environment - use with care and before server start up */
- public static synchronized void resetEnvironment() {
- initialized = true;
- logInit("FusekiEnv:Start: ENV_FUSEKI_HOME = %s : ENV_FUSEKI_BASE = %s : MODE = %s", FUSEKI_HOME, FUSEKI_BASE, mode);
-
- if ( mode == null || mode == INIT.UNSET )
- mode = INIT.WAR;
-
- if ( FUSEKI_HOME == null ) {
- // Make absolute
- String x1 = getenv("FUSEKI_HOME");
- if ( x1 == null )
- x1 = mode.dftFusekiHome;
- if ( x1 != null )
- FUSEKI_HOME = Path.of(x1);
- }
-
- if ( FUSEKI_BASE == null ) {
- String x2 = getenv("FUSEKI_BASE");
- if ( x2 == null )
- x2 = mode.dftFusekiBase;
- if ( x2 != null )
- FUSEKI_BASE = Path.of(x2);
- else {
- if ( FUSEKI_HOME != null )
- FUSEKI_BASE = FUSEKI_HOME.resolve(ENV_runArea);
- else {
- // This is bad - there should have been a default by now.
- logInitError("Can't find a setting for FUSEKI_BASE - guessing wildy");
- // Neither FUSEKI_HOME nor FUSEKI_BASE set.
- FUSEKI_BASE = Path.of(DFT_FUSEKI_BASE);
- }
- }
- }
-
- if ( FUSEKI_HOME != null )
- FUSEKI_HOME = FUSEKI_HOME.toAbsolutePath();
-
- FUSEKI_BASE = FUSEKI_BASE.toAbsolutePath();
-
- logInit("FusekiEnv:Finish: ENV_FUSEKI_HOME = %s : ENV_FUSEKI_BASE = %s", FUSEKI_HOME, FUSEKI_BASE);
- }
-
- private static void logInit(String fmt, Object ... args) {
- if ( LogInit ) {
- System.out.printf(fmt, args);
- System.out.println();
- }
- }
-
- private static void logInitError(String fmt, Object ... args) {
- System.err.printf(fmt, args);
- System.err.println();
- }
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java
deleted file mode 100644
index fac2ccf80f..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerEnvironmentInit.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.webapp;
-
-import jakarta.servlet.ServletContextEvent;
-import jakarta.servlet.ServletContextListener;
-
-import org.apache.jena.fuseki.system.FusekiLogging;
-import org.apache.jena.fuseki.system.FusekiCore;
-import org.apache.jena.sys.JenaSystem;
-
-/** Setup the environment and logging.
- * Runs before the {@link ShiroEnvironmentLoader}.
- * The main configuration happens in {@link FusekiServerListener} which runs after {@link ShiroEnvironmentLoader}.
- */
-public class FusekiServerEnvironmentInit implements ServletContextListener {
-
- public FusekiServerEnvironmentInit() { }
-
- @Override
- public void contextInitialized(ServletContextEvent sce) {
- // These do not touch Jena.
- FusekiEnv.setEnvironment();
- // The command line initializes Fuseki-full with FusekiLogging.setLogging()
- if ( ! FusekiLogging.hasInitialized() ) {
- // If this is set, the webapp is controlling log4j setup via log4j-web and its own initialization.
- // The logging file in in log4j2.properties in the webapp root directory.
- String x = sce.getServletContext().getInitParameter(FusekiLogging.log4j2_web_configuration);
- if ( x != null ) {
- // https://logging.apache.org/log4j/2.x/manual/webapp.html
- FusekiLogging.markInitialized(true);
- } else {
- FusekiLogging.setLogging(FusekiEnv.FUSEKI_BASE, false);
- }
- }
- JenaSystem.init();
- FusekiCore.init();
-
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent sce) {
- // Stop handling requests.
-
- // ActionService uses DataAccessPointRegistry to map URI to services (DataAccessPoint)
-
- // DataService -> DataService
-// DataAccessPointRegistry.shutdown();
-// DatasetDescriptionRegistry.reset();
- JenaSystem.shutdown();
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java
deleted file mode 100644
index ce31533dce..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiServerListener.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.webapp;
-
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.ServletContextEvent;
-import jakarta.servlet.ServletContextListener;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.FusekiException;
-import org.apache.jena.fuseki.cmd.FusekiArgs;
-import org.apache.jena.fuseki.metrics.MetricsProvider;
-import org.apache.jena.fuseki.metrics.PrometheusMetricsProvider;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry;
-import org.apache.jena.fuseki.server.FusekiCoreInfo;
-import org.apache.jena.fuseki.server.OperationRegistry;
-import org.slf4j.Logger;
-
-/** Setup configuration.
- * The order is controlled by {@code web.xml}:
- * <ul>
- * <li>{@link FusekiServerEnvironmentInit}
- * <li>{@link ShiroEnvironmentLoader}
- * <li>{@link FusekiServerListener}, the main configuration
- * </ul>
- */
-
-public class FusekiServerListener implements ServletContextListener {
-
- public FusekiServerListener() { }
-
- public static FusekiArgs initialSetup = null;
-
- private boolean initialized = false;
-
- @Override
- public void contextInitialized(ServletContextEvent sce) {
- ServletContext servletContext = sce.getServletContext();
- String x = servletContext.getContextPath();
- if ( ! x.isEmpty() )
- Fuseki.configLog.info("Context path = "+x);
- serverInitialization(servletContext);
- }
-
- @SuppressWarnings("removal")
- @Override
- public void contextDestroyed(ServletContextEvent sce) {
- org.apache.jena.tdb1.sys.TDBInternal.reset();
- org.apache.jena.tdb2.sys.TDBInternal.reset();
- }
-
- private synchronized void serverInitialization(ServletContext servletContext) {
- if ( initialized )
- return;
- initialized = true;
-
- OperationRegistry operationRegistry = OperationRegistry.createStd();
- OperationRegistry.set(servletContext, operationRegistry);
- DataAccessPointRegistry dataAccessPointRegistry = new DataAccessPointRegistry();
- DataAccessPointRegistry.set(servletContext, dataAccessPointRegistry);
-
- try {
- FusekiWebapp.formatBaseArea();
- if ( ! FusekiWebapp.serverInitialized ) {
- Fuseki.serverLog.error("Failed to initialize : Server not running");
- return;
- }
-
- // The command line code sets initialSetup.
- // In a non-command line startup, initialSetup is null.
- if ( initialSetup == null ) {
- initialSetup = new FusekiArgs();
- String cfg = FusekiEnv.FUSEKI_BASE.resolve(FusekiWebapp.DFT_CONFIG).toAbsolutePath().toString();
- initialSetup.fusekiServerConfigFile = cfg;
- }
-
- if ( initialSetup == null ) {
- Fuseki.serverLog.error("No configuration");
- throw new FusekiException("No configuration");
- }
- Fuseki.setVerbose(servletContext, initialSetup.verbose);
- FusekiWebapp.initializeDataAccessPoints(dataAccessPointRegistry,
- initialSetup,
- FusekiWebapp.dirConfiguration.toString());
- dataAccessPointRegistry.forEach((name, dap)->{
- dap.getDataService().setEndpointProcessors(operationRegistry);
- dap.getDataService().goActive();
- //Fuseki.configLog.info("Register: "+dap.getName());
- });
-
- MetricsProvider metricsProvider = new PrometheusMetricsProvider();
- MetricsProvider.setMetricsProvider(servletContext, metricsProvider);
- metricsProvider.dataAccessPointMetrics(metricsProvider, dataAccessPointRegistry);
-
- } catch (Throwable th) {
- Fuseki.serverLog.error("Exception in initialization: {}", th.getMessage());
- throw th;
- }
-
- if ( initialSetup.quiet )
- return;
-
- info(initialSetup.datasetPath,
- initialSetup.datasetDescription,
- initialSetup.fusekiServerConfigFile,
- dataAccessPointRegistry);
- }
-
- /** Print command line setup */
- private static void info(String datasetPath,
- String datasetDescription,
- String serverConfigFile,
- DataAccessPointRegistry dapRegistry) {
- Logger log = Fuseki.serverLog;
- FusekiCoreInfo.logServerCmdSetup(log, initialSetup.verbose,
- dapRegistry,
- datasetPath, datasetDescription, serverConfigFile, null);
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiWebapp.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiWebapp.java
deleted file mode 100644
index b68c555a55..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/FusekiWebapp.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.webapp;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.nio.file.DirectoryStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.util.*;
-
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.atlas.lib.InternalErrorException;
-import org.apache.jena.cmd.CmdException;
-import org.apache.jena.dboe.sys.Names;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.FusekiConfigException;
-import org.apache.jena.fuseki.build.FusekiConfig;
-import org.apache.jena.fuseki.cmd.FusekiArgs;
-import org.apache.jena.fuseki.mgt.ActionDatasets;
-import org.apache.jena.fuseki.mgt.Template;
-import org.apache.jena.fuseki.mgt.TemplateFunctions;
-import org.apache.jena.fuseki.server.DataAccessPoint;
-import org.apache.jena.fuseki.server.DataAccessPointRegistry;
-import org.apache.jena.fuseki.server.DataService;
-import org.apache.jena.fuseki.servlets.ServletOps;
-import org.apache.jena.fuseki.system.FusekiCore;
-import org.apache.jena.graph.Graph;
-import org.apache.jena.rdf.model.*;
-import org.apache.jena.rdfs.RDFSFactory;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.riot.RDFLanguages;
-import org.apache.jena.riot.RDFParser;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.assembler.AssemblerUtils;
-import org.apache.jena.sys.JenaSystem;
-
-public class FusekiWebapp
-{
- // Initialization of FUSEKI_HOME and FUSEKI_BASE is done in FusekiEnv.setEnvironment()
- // so that the code is independent of any logging. FusekiLogging can use
- // initialized values of FUSEKI_BASE while looking forlog4j configuration.
-
- /* * Root of the Fuseki installation for fixed files.
- * This may be null (e.g. running inside a web application container) */
- //public static Path FUSEKI_HOME = null;
-
- /* * Root of the varying files in this deployment. Often $FUSEKI_HOME/run.
- * This is not null - it may be /etc/fuseki, which must be writable.
- */
- //public static Path FUSEKI_BASE = null;
-
- // Relative names of directories in the FUSEKI_BASE area.
- public static final String runArea = FusekiEnv.ENV_runArea;
- public static final String databasesLocationBase = "databases";
- // Place to put Lucene text and spatial indexes.
- //private static final String databaseIndexesDir = "indexes";
-
- public static final String backupDirNameBase = "backups";
- public static final String configDirNameBase = "configuration";
- public static final String logsNameBase = "logs";
- public static final String systemDatabaseNameBase = "system";
- public static final String systemFileAreaBase = "system_files";
- public static final String templatesNameBase = "templates";
- // This name is in web.xml as well.
- public static final String DFT_SHIRO_INI = "shiro.ini";
- // In FUSEKI_BASE
- public static final String DFT_CONFIG = "config.ttl";
-
- /** Directory for TDB databases - this is known to the assembler templates */
- public static Path dirDatabases = null;
-
- /** Directory for writing backups */
- public static Path dirBackups = null;
-
- /** Directory for assembler files */
- public static Path dirConfiguration = null;
-
- /** Directory for assembler files */
- public static Path dirLogs = null;
-
- /** Directory for system database */
- public static Path dirSystemDatabase = null;
-
- /** Directory for files uploaded (e.g upload assembler descriptions); not data uploads. */
- public static Path dirSystemFileArea = null;
-
- /** Directory for assembler files */
- public static Path dirTemplates = null;
-
- private static boolean initialized = false;
- // Marks the end of successful initialization.
- /*package*/static boolean serverInitialized = false;
-
- // Run-time lock for operations that change the server configuration (e..g adding and deleting data services)
- public static final Object systemLock = new Object();
-
- /**
- * Control whether to allow creating new dataservices by uploading a config file.
- * See {@link ActionDatasets}.
- *
- */
- public static final String allowConfigFileProperty = "fuseki:allowAddByConfigFile";
-
- /**
- * Return whether to allow service configuration files to be uploaded as a file.
- * See {@link ActionDatasets}.
- */
- public static boolean allowConfigFiles() {
- String value = System.getProperty(allowConfigFileProperty);
- if ( value != null )
- return "true".equals(value);
- return false;
- }
-
- public /*package*/ synchronized static void formatBaseArea() {
- if ( initialized )
- return;
- initialized = true;
- try {
- FusekiEnv.setEnvironment();
- Path FUSEKI_HOME = FusekiEnv.FUSEKI_HOME;
- Path FUSEKI_BASE = FusekiEnv.FUSEKI_BASE;
-
- JenaSystem.init();
- FusekiCore.init();
- Fuseki.configLog.info("FUSEKI_HOME="+ ((FUSEKI_HOME==null) ? "unset" : FUSEKI_HOME.toString()));
- Fuseki.configLog.info("FUSEKI_BASE="+FUSEKI_BASE.toString());
-
- // ---- Check FUSEKI_HOME and FUSEKI_BASE
- // If FUSEKI_HOME exists, it may be FUSEKI_BASE.
-
- if ( FUSEKI_HOME != null ) {
- if ( ! Files.isDirectory(FUSEKI_HOME) )
- throw new FusekiConfigException("FUSEKI_HOME is not a directory: "+FUSEKI_HOME);
- if ( ! Files.isReadable(FUSEKI_HOME) )
- throw new FusekiConfigException("FUSEKI_HOME is not readable: "+FUSEKI_HOME);
- }
-
- if ( Files.exists(FUSEKI_BASE) ) {
- if ( ! Files.isDirectory(FUSEKI_BASE) )
- throw new FusekiConfigException("FUSEKI_BASE is not a directory: "+FUSEKI_BASE);
- if ( ! Files.isWritable(FUSEKI_BASE) )
- throw new FusekiConfigException("FUSEKI_BASE is not writable: "+FUSEKI_BASE);
- } else {
- ensureDir(FUSEKI_BASE);
- }
-
- // Ensure FUSEKI_BASE has the assumed directories.
- dirTemplates = writeableDirectory(FUSEKI_BASE, templatesNameBase);
- dirDatabases = writeableDirectory(FUSEKI_BASE, databasesLocationBase);
- dirBackups = writeableDirectory(FUSEKI_BASE, backupDirNameBase);
- dirConfiguration = writeableDirectory(FUSEKI_BASE, configDirNameBase);
- dirLogs = writeableDirectory(FUSEKI_BASE, logsNameBase);
- dirSystemDatabase = writeableDirectory(FUSEKI_BASE, systemDatabaseNameBase);
- dirSystemFileArea = writeableDirectory(FUSEKI_BASE, systemFileAreaBase);
- //Possible intercept point
-
- // ---- Initialize with files.
-
- if ( Files.isRegularFile(FUSEKI_BASE) )
- throw new FusekiConfigException("FUSEKI_BASE exists but is a file");
-
- // Copy missing files into FUSEKI_BASE
- copyFileIfMissing(null, DFT_SHIRO_INI, FUSEKI_BASE);
- copyFileIfMissing(null, DFT_CONFIG, FUSEKI_BASE);
- for ( String n : Template.templateNames ) {
- copyFileIfMissing(null, n, FUSEKI_BASE);
- }
-
- serverInitialized = true;
- } catch (RuntimeException ex) {
- Fuseki.serverLog.error("Exception in server initialization", ex);
- throw ex;
- }
- }
-
- /** Copy a file from src to dst under name fn.
- * If src is null, try as a classpath resource
- * @param src Source directory, or null meaning use java resource.
- * @param fn File name, a relative path.
- * @param dst Destination directory.
- *
- */
- private static void copyFileIfMissing(Path src, String fn, Path dst) {
-
- Path dstFile = dst.resolve(fn);
- if ( Files.exists(dstFile) )
- return;
-
- // fn may be a path.
- if ( src != null ) {
- try {
- Files.copy(src.resolve(fn), dstFile, StandardCopyOption.COPY_ATTRIBUTES);
- } catch (IOException e) {
- IO.exception("Failed to copy file "+src.resolve(fn), e);
- e.printStackTrace();
- }
- } else {
- copyFileFromResource(fn, dstFile);
- }
- }
-
- public static void copyFileFromResource(String fn, Path dstFile) {
- try {
- // Get from the file from area "org/apache/jena/fuseki/webapp" (our package)
- URL url = FusekiWebapp.class.getResource(fn);
- if ( url == null )
- throw new FusekiConfigException("Failed to find resource '"+fn+"'");
- InputStream in = url.openStream();
- Files.copy(in, dstFile);
- }
- catch (IOException e) {
- IO.exception("Failed to copy file from resource: "+fn, e);
- e.printStackTrace();
- }
- }
-
- public static void initializeDataAccessPoints(DataAccessPointRegistry registry, FusekiArgs initialSetup, String configDir) {
- List<DataAccessPoint> configFileDBs = initServerConfiguration(initialSetup);
- List<DataAccessPoint> directoryDBs = FusekiConfig.readConfigurationDirectory(configDir);
- List<DataAccessPoint> datapoints = new ArrayList<>();
- datapoints.addAll(configFileDBs);
- datapoints.addAll(directoryDBs);
-
- datapoints.forEach(registry::register);
- }
-
- private static List<DataAccessPoint> initServerConfiguration(FusekiArgs params) {
- // Has a side effect of global context setting
- // when processing a config file.
- // Compatibility.
-
- List<DataAccessPoint> datasets = new ArrayList<>();
- if ( params == null )
- return datasets;
-
- if ( params.fusekiCmdLineConfigFile != null ) {
- List<DataAccessPoint> confDatasets = processServerConfigFile(params.fusekiCmdLineConfigFile);
- datasets.addAll(confDatasets);
- } else if ( params.fusekiServerConfigFile != null ) {
- List<DataAccessPoint> confDatasets = processServerConfigFile(params.fusekiServerConfigFile);
- datasets.addAll(confDatasets);
- } else if ( params.dsg != null ) {
- // RDFS
- if ( params.rdfsGraph != null ) {
- Graph rdfsGraph = RDFDataMgr.loadGraph(params.rdfsGraph);
- params.dsg = RDFSFactory.datasetRDFS(params.dsg, rdfsGraph);
- }
- DataAccessPoint dap = datasetDefaultConfiguration(params.datasetPath, params.dsg, params.allowUpdate);
- datasets.add(dap);
- } else if ( params.templateFile != null ) {
- DataAccessPoint dap = configFromTemplate(params.templateFile, params.datasetPath, params.allowUpdate, params.params);
- if ( params.rdfsGraph != null ) {
- // RDFS
- // Create a new DataAccessPoint - same name, same operations, different dataset.
- DataService dSrv = dap.getDataService();
- DatasetGraph dsg = dSrv.getDataset();
- Graph rdfsGraph = RDFDataMgr.loadGraph(params.rdfsGraph);
- DatasetGraph dsg2 = RDFSFactory.datasetRDFS(dsg, rdfsGraph);
- DataService dSrv2 = DataService.newBuilder(dSrv).dataset(dsg2).build();
- dap = new DataAccessPoint(dap.getName(), dSrv2);
- }
- datasets.add(dap);
- }
- // No datasets is valid.
- return datasets;
- }
-
- private static List<DataAccessPoint> processServerConfigFile(String configFilename) {
- if ( ! FileOps.exists(configFilename) ) {
- Fuseki.configLog.warn("Configuration file '" + configFilename+"' does not exist");
- return Collections.emptyList();
- }
- //Fuseki.configLog.info("Configuration file: " + configFilename);
- Model model = AssemblerUtils.readAssemblerFile(configFilename);
- if ( model.size() == 0 )
- return Collections.emptyList();
- List<DataAccessPoint> x = FusekiConfig.processServerConfiguration(model, Fuseki.getContext());
- return x;
- }
-
- private static DataAccessPoint configFromTemplate(String templateFile, String datasetPath,
- boolean allowUpdate, Map<String, String> params) {
- // ---- Setup
- if ( params == null ) {
- params = new HashMap<>();
- params.put(Template.NAME, datasetPath);
- } else {
- if ( ! params.containsKey(Template.NAME) ) {
- Fuseki.configLog.warn("No NAME found in template parameters (added)");
- params.put(Template.NAME, datasetPath);
- }
- }
- //-- Logging
- Fuseki.configLog.info("Template file: " + templateFile);
- String dir = params.get(Template.DIR);
- if ( dir != null ) {
- if ( ! Objects.equals(dir, Names.memName) && !FileOps.exists(dir) )
- throw new CmdException("Directory not found: " + dir);
- }
- //-- Logging
-
- datasetPath = DataAccessPoint.canonical(datasetPath);
-
- // DRY -- ActionDatasets (and others?)
- addGlobals(params);
-
- String str = TemplateFunctions.templateFile(templateFile, params, Lang.TTL);
- Lang lang = RDFLanguages.filenameToLang(templateFile, Lang.TTL);
- Model model = RDFParser.fromString(str, lang).base(datasetPath).toModel();
-
- List<DataAccessPoint> defns = FusekiConfig.servicesAndDatasets(model.getGraph());
- if ( defns.size() != 1 ) {
- if ( defns.isEmpty() )
- ServletOps.errorBadRequest("No description of a Fuseki service");
- else
- ServletOps.errorBadRequest("Multiple descriptions of Fuseki service");
- }
- DataAccessPoint dap = defns.get(0);
- return dap;
- }
-
- public static void addGlobals(Map<String, String> params) {
- if ( params == null ) {
- Fuseki.configLog.warn("FusekiServer.addGlobals : params is null", new Throwable());
- return;
- }
-
- if ( ! params.containsKey("FUSEKI_BASE") )
- params.put("FUSEKI_BASE", pathStringOrElse(FusekiEnv.FUSEKI_BASE, "unset"));
- if ( ! params.containsKey("FUSEKI_HOME") )
- params.put("FUSEKI_HOME", pathStringOrElse(FusekiEnv.FUSEKI_HOME, "unset"));
- }
-
- private static String pathStringOrElse(Path path, String dft) {
- if ( path == null )
- return dft;
- return path.toString();
- }
-
- // DRY -- ActionDatasets (and others?)
- private static Statement getOne(Model m, Resource s, Property p, RDFNode o) {
- StmtIterator iter = m.listStatements(s, p, o);
- if ( ! iter.hasNext() )
- return null;
- Statement stmt = iter.next();
- if ( iter.hasNext() )
- return null;
- return stmt;
- }
-
- private static DataAccessPoint datasetDefaultConfiguration( String name, DatasetGraph dsg, boolean allowUpdate) {
- name = DataAccessPoint.canonical(name);
- DataService ds = FusekiConfig.buildDataServiceStd(dsg, allowUpdate);
- DataAccessPoint dap = new DataAccessPoint(name, ds);
- return dap;
- }
-
- // ---- Helpers
-
- /** Ensure a directory exists, creating it if necessary.
- */
- private static void ensureDir(Path directory) {
- File dir = directory.toFile();
- if ( ! dir.exists() ) {
- boolean b = dir.mkdirs();
- if ( ! b )
- throw new FusekiConfigException("Failed to create directory: "+directory);
- }
- else if ( ! dir.isDirectory())
- throw new FusekiConfigException("Not a directory: "+directory);
- }
-
- private static void mustExist(Path directory) {
- File dir = directory.toFile();
- if ( ! dir.exists() )
- throw new FusekiConfigException("Does not exist: "+directory);
- if ( ! dir.isDirectory())
- throw new FusekiConfigException("Not a directory: "+directory);
- }
-
- private static boolean emptyDir(Path dir) {
- return dir.toFile().list().length <= 2;
- }
-
- private static boolean exists(Path directory) {
- File dir = directory.toFile();
- return dir.exists();
- }
-
- private static Path writeableDirectory(Path root , String relName ) {
- Path p = makePath(root, relName);
- ensureDir(p);
- if ( ! Files.isWritable(p) )
- throw new FusekiConfigException("Not writable: "+p);
- return p;
- }
-
- private static Path makePath(Path root , String relName ) {
- Path path = root.resolve(relName);
- // Must exist
-// try { path = path.toRealPath(); }
-// catch (IOException e) { IO.exception(e); }
- return path;
- }
-
- /** New configuration file name - absolute filename */
- public static String generateConfigurationFilename(String dsName) {
- String filename = dsName;
- // Without "/"
- if ( filename.startsWith("/"))
- filename = filename.substring(1);
- Path p = FusekiWebapp.dirConfiguration.resolve(filename+".ttl");
- return p.toString();
- }
-
- /** Return the filenames of all matching files in the configuration directory (absolute paths returned ). */
- public static List<String> existingConfigurationFile(String serviceName) {
- String filename = DataAccessPoint.isCanonical(serviceName) ? serviceName.substring(1) : serviceName;
- try {
- List<String> paths = new ArrayList<>();
- // This ".* is a file glob pattern, not a regular expression - it looks for file extensions.
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(FusekiWebapp.dirConfiguration, filename+".*") ) {
- stream.forEach((p)-> paths.add(FusekiWebapp.dirConfiguration.resolve(p).toString() ));
- }
- return paths;
- } catch (IOException ex) {
- throw new InternalErrorException("Failed to read configuration directory "+FusekiWebapp.dirConfiguration);
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/ShiroEnvironmentLoader.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/ShiroEnvironmentLoader.java
deleted file mode 100644
index e7498e2d07..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/ShiroEnvironmentLoader.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.webapp;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Path;
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.ServletContextEvent;
-import jakarta.servlet.ServletContextListener;
-
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.system.FusekiCore;
-import org.apache.jena.irix.IRIs;
-import org.apache.jena.sys.JenaSystem;
-import org.apache.shiro.lang.io.ResourceUtils;
-import org.apache.shiro.web.env.EnvironmentLoader;
-import org.apache.shiro.web.env.ResourceBasedWebEnvironment;
-import org.apache.shiro.web.env.WebEnvironment;
-
-/** A place to perform Fuseki-specific initialization of Apache Shiro.
- * Runs after listener {@link FusekiServerEnvironmentInit} and before {@link FusekiServerListener}.
- * This means finding shiro.ini in multiple possible places, based on
- * different deployment setups.
- */
-public class ShiroEnvironmentLoader extends EnvironmentLoader implements ServletContextListener {
- private ServletContext servletContext;
-
- public ShiroEnvironmentLoader() {}
-
- @Override
- public void contextInitialized(ServletContextEvent sce) {
- FusekiWebapp.formatBaseArea();
- this.servletContext = sce.getServletContext();
- try {
- // Shiro.
- initEnvironment(servletContext);
- } catch (Exception ex) {
- Fuseki.configLog.error("Shiro initialization failed: "+ex.getMessage());
- // Exit?
- throw ex;
- }
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent sce) {
- destroyEnvironment(sce.getServletContext());
- }
-
- /**
- * Normal Shiro initialization only supports one location for an INI file.
- *
- * When given multiple locations for the shiro.ini file, and
- * if a {@link ResourceBasedWebEnvironment}, check the list of configuration
- * locations, testing whether the name identified an existing resource.
- * For the first resource name found to exist, reset the {@link ResourceBasedWebEnvironment}
- * to name that resource alone so the normal Shiro initialization
- */
- @Override
- protected void customizeEnvironment(WebEnvironment environment) {
- if ( environment instanceof ResourceBasedWebEnvironment env ) {
- String[] locations = env.getConfigLocations();
- String loc = huntForShiroIni(locations);
- Fuseki.configLog.info("Shiro file: "+loc);
- if (loc != null )
- locations = new String[] {loc};
- env.setConfigLocations(locations);
- }
- }
-
- private static final String FILE = "file";
-
- /** Look for a Shiro ini file, or return null */
- private static String huntForShiroIni(String[] locations) {
- JenaSystem.init();
- FusekiCore.init();
- FusekiEnv.setEnvironment();
- for ( String loc : locations ) {
- // If file:, look for that file.
- // If a relative name without scheme, look in FUSEKI_BASE, FUSEKI_HOME, webapp.
- String scheme = IRIs.scheme(loc);
-
- // Covers C:\\ as a "scheme name"
- if ( scheme != null ) {
- if ( scheme.equalsIgnoreCase(FILE)) {
- // Test file: for exists
- Path p = Path.of(loc.substring(FILE.length()+1));
- if ( ! p.toFile().exists() )
- continue;
- // Fall through.
- }
- // Can't test - try
- return loc;
- }
- // No scheme .
- Path p = Path.of(loc);
-
- String fn = resolve(FusekiEnv.FUSEKI_BASE, p);
- if ( fn != null )
- return "file://"+fn;
- fn = resolve(FusekiEnv.FUSEKI_HOME, p);
- if ( fn != null )
- return "file://"+fn;
-
- // Try in webapp.
-
- try ( InputStream is = ResourceUtils.getInputStreamForPath(loc); ) {
- boolean exists = (is != null );
- return loc;
- } catch (IOException e) { }
- }
- return null;
- }
-
- /** Directory + name -> filename if it exists */
- private static String resolve(Path dir, Path file) {
- Path p = dir.resolve(file);
- if ( p.toFile().exists() )
- return p.normalize().toString();
- return null;
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/config.ttl b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/config.ttl
deleted file mode 100644
index 7b9ac5bc7c..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/config.ttl
+++ /dev/null
@@ -1,30 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-## Fuseki Server configuration file.
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-[] rdf:type fuseki:Server ;
- # Example::
- # Server-wide query timeout.
- #
- # Timeout - server-wide default: milliseconds.
- # Format 1: "1000" -- 1 second timeout
- # Format 2: "10000,60000" -- 10s timeout to first result,
- # then 60s timeout for the rest of query.
- #
- # See javadoc for ARQ.queryTimeout for details.
- # This can also be set on a per dataset basis in the dataset assembler.
- #
- # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "30000" ] ;
-
- # Add any custom classes you want to load.
- # Must have a "public static void init()" method.
- # ja:loadClass "your.code.Class" ;
-
- # End triples.
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/shiro.ini b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/shiro.ini
deleted file mode 100644
index 26e3a5a78f..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/shiro.ini
+++ /dev/null
@@ -1,39 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-[main]
-# Development
-ssl.enabled = false
-
-plainMatcher=org.apache.shiro.authc.credential.SimpleCredentialsMatcher
-#iniRealm=org.apache.shiro.realm.text.IniRealm
-iniRealm.credentialsMatcher = $plainMatcher
-
-localhostFilter=org.apache.jena.fuseki.authz.LocalhostFilter
-
-[users]
-# Implicitly adds "iniRealm = org.apache.shiro.realm.text.IniRealm"
-admin=pw
-
-[roles]
-
-[urls]
-## Control functions open to anyone
-/$/status = anon
-/$/server = anon
-/$/ping = anon
-/$/metrics = anon
-
-## and the rest are restricted to localhost.
-/$/** = localhostFilter
-
-## If you want simple, basic authentication user/password
-## on the operations,
-## 1 - set a better password in [users] above.
-## 2 - comment out the "/$/** = localhost" line and use:
-## "/$/** = authcBasic,user[admin]"
-
-## or to allow any access.
-##/$/** = anon
-
-# Everything else
-/**=anon
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-mem b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-mem
deleted file mode 100644
index fa53c4bd38..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-mem
+++ /dev/null
@@ -1,36 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable in-memory dataset.
-
-<#service1> rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/{NAME}
- fuseki:name "{NAME}" ;
- fuseki:dataset <#dataset> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-# Transactional, in-memory dataset. Initially empty.
-<#dataset> rdf:type ja:DatasetTxnMem .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-mem-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-mem-readonly
deleted file mode 100644
index 2e47f687f0..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-mem-readonly
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable in-memory dataset.
-
-<#service1> rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/{NAME}
- fuseki:name "{NAME}" ;
- fuseki:dataset <#dataset> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-# Transactional, in-memory dataset. Initially empty.
-<#dataset> rdf:type ja:DatasetTxnMem .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb
deleted file mode 100644
index b4373a0c03..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB1 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ;
- tdb:location "{FUSEKI_BASE}/databases/{NAME}" ;
- ##ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "3000" ] ;
- ##tdb:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-dir b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-dir
deleted file mode 100644
index d7b0b1b2d2..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-dir
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB1 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ;
- tdb:location "{DIR}" ;
- ##tdb:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-dir-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-dir-readonly
deleted file mode 100644
index fccfe309ce..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-dir-readonly
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB1 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ;
- tdb:location "{DIR}" ;
- ##tdb:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-mem b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-mem
deleted file mode 100644
index 25dfb74f41..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-mem
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset im-memory with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB1 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ;
- tdb:location "--mem--" ;
- ## tdb:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-mem-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-mem-readonly
deleted file mode 100644
index 3045620148..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-mem-readonly
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset im-memory with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB1 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ;
- tdb:location "--mem--" ;
- ## tdb:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-readonly
deleted file mode 100644
index 8578f96db3..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb-readonly
+++ /dev/null
@@ -1,33 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB1 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ;
- tdb:location "{FUSEKI_BASE}/databases/{NAME}" ;
- ##ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "3000" ] ;
- ##tdb:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2 b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2
deleted file mode 100644
index 32b331e74b..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2
+++ /dev/null
@@ -1,39 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB2 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
-
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "{FUSEKI_BASE}/databases/{NAME}" ;
- ##ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "3000" ] ;
- ##tdb2:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-dir b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-dir
deleted file mode 100644
index 87c118d055..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-dir
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-## ---------------------------------------------------------------
-## Updatable TDB2 dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB2 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "{DIR}" ;
- ##tdb2:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-dir-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-dir-readonly
deleted file mode 100644
index 1f21b3695b..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-dir-readonly
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-## ---------------------------------------------------------------
-## Updatable TDB2 dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB2 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "{DIR}" ;
- ##tdb2:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-mem b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-mem
deleted file mode 100644
index 08d66e3cb5..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-mem
+++ /dev/null
@@ -1,37 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-## ---------------------------------------------------------------
-## Updatable TDB2 dataset im-memory with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB2 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-rw ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "update" ;
- fuseki:operation fuseki:update ] ;
- fuseki:endpoint [ fuseki:name "data" ;
- fuseki:operation fuseki:gsp-rw ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "--mem--" ;
- ## tdb2:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-mem-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-mem-readonly
deleted file mode 100644
index 348b15022f..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-mem-readonly
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-## ---------------------------------------------------------------
-## Updatable TDB2 dataset im-memory with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB2 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "--mem--" ;
- ## tdb2:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-readonly b/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-readonly
deleted file mode 100644
index 5871ebec47..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/resources/org/apache/jena/fuseki/webapp/templates/config-tdb2-readonly
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-## ---------------------------------------------------------------
-## Updatable TDB dataset with all services enabled.
-
-<#service_tdb_all> rdf:type fuseki:Service ;
- rdfs:label "TDB2 {NAME}" ;
- fuseki:name "{NAME}" ;
- fuseki:dataset <#tdb_dataset_readwrite> ;
-
- fuseki:endpoint [ fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:operation fuseki:gsp-r ] ;
-
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "query" ;
- fuseki:operation fuseki:query ] ;
- fuseki:endpoint [ fuseki:name "get" ;
- fuseki:operation fuseki:gsp-r ] ;
-
- .
-
-<#tdb_dataset_readwrite> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "{FUSEKI_BASE}/databases/{NAME}" ;
- ##ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "3000" ] ;
- ##tdb2:unionDefaultGraph true ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/META-INF/context.xml b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/META-INF/context.xml
deleted file mode 100644
index 55edfc0d1c..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/META-INF/context.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<Context allowCasualMultipartParsing="true">
-</Context>
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/WEB-INF/web.xml b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 2a097f3508..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,316 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- version="3.0">
-
- <display-name>Apache Jena Fuseki Server</display-name>
-
- <listener>
- <!-- Basic server initialization, including logging -->
- <listener-class>org.apache.jena.fuseki.webapp.FusekiServerEnvironmentInit</listener-class>
- </listener>
-
- <!-- Apache Shiro setup -->
- <listener>
- <!-- This replaces org.apache.shiro.web.env.EnvironmentLoaderListener
- Support multiple locations and looks in Fuseki-relevant places.
- -->
- <listener-class>org.apache.jena.fuseki.webapp.ShiroEnvironmentLoader</listener-class>
- </listener>
-
- <!--
- Disable Shiro automatic initialization. This allows us to order the listeners.
- -->
- <context-param>
- <param-name>org.apache.shiro.ee.disabled</param-name>
- <param-value>true</param-value>
- </context-param>
-
- <!-- Apache Jena Fuseki setup -->
- <listener>
- <listener-class>org.apache.jena.fuseki.webapp.FusekiServerListener</listener-class>
- </listener>
-
- <!-- CORS -->
- <filter>
- <filter-name>cross-origin</filter-name>
- <!-- Ported and standalone version of org.eclipse.jetty.servlets.CrossOriginFilter -->
- <filter-class>org.apache.jena.fuseki.servlets.CrossOriginFilter</filter-class>
- <!-- Defaults may be fine -->
- <init-param>
- <param-name>allowedOrigins</param-name>
- <param-value>*</param-value>
- </init-param>
- <init-param>
- <param-name>allowedMethods</param-name>
- <param-value>GET,POST,DELETE,PUT,HEAD,OPTIONS,PATCH</param-value>
- </init-param>
- <init-param>
- <param-name>allowedHeaders</param-name>
- <param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified, Authorization</param-value>
- </init-param>
- <init-param>
- <param-name>exposedHeaders</param-name>
- <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
- </init-param>
- <init-param>
- <param-name>chainPreflight</param-name>
- <param-value>false</param-value>
- </init-param>
- </filter>
-
- <filter-mapping>
- <filter-name>cross-origin</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <!-- Before FusekiFilter -->
- <filter>
- <filter-name>ShiroFilter</filter-name>
- <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>ShiroFilter</filter-name>
- <url-pattern>/*</url-pattern>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- <dispatcher>ERROR</dispatcher>
- </filter-mapping>
-
- <context-param>
- <param-name>shiroConfigLocations</param-name>
- <!-- Try a path name in: FUSEKI_BASE, FUSEKI_HOME, war resource
- If a "file:" then look there and there only.
- -->
- <param-value>shiro.ini</param-value>
- </context-param>
-
- <context-param>
- <param-name>log4jConfiguration</param-name>
- <param-value>log4j2.properties</param-value>
- </context-param>
-
- <!-- Fuseki dataset serviced calls -->
- <filter>
- <filter-name>Fuseki</filter-name>
- <filter-class>org.apache.jena.fuseki.servlets.FusekiFilter</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>Fuseki</filter-name>
- <url-pattern>/*</url-pattern>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>INCLUDE</dispatcher>
- <dispatcher>ERROR</dispatcher>
- </filter-mapping>
-
- <!-- Server controls-->
-
- <servlet>
- <servlet-name>PingServlet</servlet-name>
- <servlet-class>org.apache.jena.fuseki.ctl.ActionPing</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>PingServlet</servlet-name>
- <url-pattern>/$/ping</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>ActionStats</servlet-name>
- <servlet-class>org.apache.jena.fuseki.ctl.ActionStats</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ActionStats</servlet-name>
- <url-pattern>/$/stats/*</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>ActionMetrics</servlet-name>
- <servlet-class>org.apache.jena.fuseki.ctl.ActionMetrics</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ActionMetrics</servlet-name>
- <url-pattern>/$/metrics</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>ActionTasks</servlet-name>
- <servlet-class>org.apache.jena.fuseki.ctl.ActionTasks</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ActionTasks</servlet-name>
- <url-pattern>/$/tasks/*</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>ActionBackup</servlet-name>
- <servlet-class>org.apache.jena.fuseki.mgt.ActionBackup</servlet-class>
- </servlet>
-
- <servlet>
- <servlet-name>BackupListServlet</servlet-name>
- <servlet-class>org.apache.jena.fuseki.mgt.ActionBackupList</servlet-class>
- </servlet>
-
- <servlet>
- <servlet-name>ActionCompact</servlet-name>
- <servlet-class>org.apache.jena.fuseki.ctl.ActionCompact</servlet-class>
- </servlet>
-
- <!-- An action that only creates a background task that sleeps. -->
- <servlet>
- <servlet-name>ActionSleep</servlet-name>
- <servlet-class>org.apache.jena.fuseki.ctl.ActionSleep</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ActionSleep</servlet-name>
- <url-pattern>/$/sleep/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>ActionBackup</servlet-name>
- <url-pattern>/$/backup/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>ActionBackup</servlet-name>
- <url-pattern>/$/backups/*</url-pattern> <!-- Alt spelling -->
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>BackupListServlet</servlet-name>
- <url-pattern>/$/backups-list</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>ActionCompact</servlet-name>
- <url-pattern>/$/compact/*</url-pattern>
- </servlet-mapping>
-
- <!-- Admin controls-->
-
- <servlet>
- <servlet-name>ServerStatusServlet</servlet-name>
- <servlet-class>org.apache.jena.fuseki.mgt.ActionServerStatus</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ServerStatusServlet</servlet-name>
- <url-pattern>/$/server</url-pattern>
- </servlet-mapping>
-
- <!-- Alternative name mentioned in default shiro.ini -->
- <servlet-mapping>
- <servlet-name>ServerStatusServlet</servlet-name>
- <url-pattern>/$/status</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>ActionDatasets</servlet-name>
- <servlet-class>org.apache.jena.fuseki.mgt.ActionDatasets</servlet-class>
- </servlet>
-
- <servlet>
- <servlet-name>ActionLogs</servlet-name>
- <servlet-class>org.apache.jena.fuseki.mgt.ActionLogs</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ActionDatasets</servlet-name>
- <url-pattern>/$/datasets/*</url-pattern>
- </servlet-mapping>
-
- <servlet-mapping>
- <servlet-name>ActionLogs</servlet-name>
- <url-pattern>/$/logs</url-pattern>
- </servlet-mapping>
-
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- </welcome-file-list>
-
- <!-- For serving static files -->
-
- <mime-mapping>
- <extension>rdf</extension>
- <mime-type>application/rdf+xml</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>ttl</extension>
- <mime-type>text/turtle;charset=utf-8</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>nt</extension>
- <mime-type>application/n-triples</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>nq</extension>
- <mime-type>application/n-quads</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>trig</extension>
- <mime-type>application/trig</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>jsonld</extension>
- <mime-type>application/ld+json</mime-type>
- </mime-mapping>
-
- <mime-mapping>
- <extension>tr</extension>
- <mime-type>application/rdf+thrift</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>trdf</extension>
- <mime-type>application/rdf+thrift</mime-type>
- </mime-mapping>
-
- <mime-mapping>
- <extension>rq</extension>
- <mime-type>application/sparql-query</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>ru</extension>
- <mime-type>application/sparql-update</mime-type>
- </mime-mapping>
-
- <mime-mapping>
- <extension>srx</extension>
- <mime-type>application/sparql-results+xml</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>srj</extension>
- <mime-type>application/sparql-results+json</mime-type>
- </mime-mapping>
- <mime-mapping>
- <extension>srt</extension>
- <mime-type>application/sparql-results+thrift</mime-type>
- </mime-mapping>
-
-</web-app>
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/favicon.ico b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/favicon.ico
deleted file mode 100644
index f5d685e085..0000000000
Binary files a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/favicon.ico and /dev/null differ
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties b/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties
deleted file mode 100644
index 029030168d..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/webapp/log4j2.properties
+++ /dev/null
@@ -1,65 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-status = error
-name = FusekiLoggingWebapp
-filters = threshold
-filter.threshold.type = ThresholdFilter
-filter.threshold.level = ALL
-
-appender.console.type = Console
-appender.console.name = OUT
-appender.console.target = SYSTEM_OUT
-appender.console.layout.type = PatternLayout
-## appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-15c{1} :: %m%n
-appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-15c{1} :: %m%n
-
-rootLogger.level = INFO
-rootLogger.appenderRef.stdout.ref = OUT
-
-logger.jena.name = org.apache.jena
-logger.jena.level = INFO
-
-logger.arq-exec.name = org.apache.jena.arq.exec
-logger.arq-exec.level = INFO
-
-logger.arq-info.name = org.apache.jena.arq.info
-logger.arq-info.level = INFO
-
-logger.riot.name = org.apache.jena.riot
-logger.riot.level = INFO
-
-logger.fuseki.name = org.apache.jena.fuseki
-logger.fuseki.level = INFO
-
-logger.fuseki-fuseki.name = org.apache.jena.fuseki.Fuseki
-logger.fuseki-fuseki.level = INFO
-
-logger.fuseki-server.name = org.apache.jena.fuseki.Server
-logger.fuseki-server.level = INFO
-
-logger.fuseki-config.name = org.apache.jena.fuseki.Config
-logger.fuseki-config.level = INFO
-
-logger.fuseki-admin.name = org.apache.jena.fuseki.Admin
-logger.fuseki-admin.level = INFO
-
-logger.jetty.name = org.eclipse.jetty
-logger.jetty.level = WARN
-
-logger.shiro.name = org.apache.shiro
-logger.shiro.level = WARN
-
-# Hide issue with Shiro 1.5.0+, 2.0.0
-logger.shiro-realm.name = org.apache.shiro.realm.text.IniRealm
-logger.shiro-realm.level = ERROR
-
-# This goes out in NCSA format
-appender.plain.type = Console
-appender.plain.name = PLAIN
-appender.plain.layout.type = PatternLayout
-appender.plain.layout.pattern = %m%n
-
-logger.fuseki-request.name = org.apache.jena.fuseki.Request
-logger.fuseki-request.additivity = false
-logger.fuseki-request.level = OFF
-logger.fuseki-request.appenderRef.plain.ref = PLAIN
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractFusekiWebappTest.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractFusekiWebappTest.java
deleted file mode 100644
index b78884a159..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractFusekiWebappTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-/**
- * This package has the Fuseki full server tests. ServerCtl manages a full server for testing.
- *
- * Tests on the server also test the client-side operation
- * It is testing various client APIs.
- *
- * jena-integration-tests tests RDFConnection with the basic Fuseki server and
- * RDFConnection calls the different client APIs. So both servers get tested with the
- * client APIs, by different means.
- *
- * See {@link org.apache.jena.fuseki.AbstractFusekiWebappTest}.
- *
- * Framework for tests using client-side operation onto a forked Fuseki server. Not
- * general - some test sets set up their own environment for different, additional
- * requirements.
- */
-
-public class AbstractFusekiWebappTest
-{
- @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
- @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
- @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
- @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java
deleted file mode 100644
index 6b4d247950..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/AbstractTestWebappAuth_JDK.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.Authenticator;
-import java.net.http.HttpClient;
-
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.atlas.web.WebLib;
-import org.apache.jena.fuseki.cmd.JettyFusekiWebapp;
-import org.apache.jena.fuseki.system.FusekiLogging;
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-import org.apache.jena.http.auth.AuthLib;
-import org.apache.jena.sparql.exec.http.QueryExecutionHTTP;
-import org.apache.jena.sparql.exec.http.QueryExecutionHTTPBuilder;
-import org.apache.jena.sparql.exec.http.UpdateExecutionHTTP;
-import org.apache.jena.sparql.exec.http.UpdateExecutionHTTPBuilder;
-import org.junit.After;
-import org.junit.Before;
-
-public class AbstractTestWebappAuth_JDK {
-
- protected int authPort = WebLib.choosePort();
- protected String authUrlRoot() { return "http://localhost:"+authPort+"/"; }
- protected String authDatasetPath() { return "/dataset"; }
- protected String authServiceUpdate() { return "http://localhost:"+authPort+authDatasetPath()+"/update"; }
- protected String authServiceQuery() { return "http://localhost:"+authPort+authDatasetPath()+"/query"; }
- protected String authServiceREST() { return "http://localhost:"+authPort+authDatasetPath()+"/data";}
- private static File realmFile;
-
- private static final String FusekiTestHome = "target/FusekiTest";
- private static final String FusekiTestBase = FusekiTestHome+"/run";
-
- // False when in TS_FusekiWebapp
- public static boolean RunDependently = true;
-
- @Before public void setupFusekiServer() throws IOException {
- ensureEnvironment();
-
- realmFile = File.createTempFile("realm", ".properties");
- realmFile.deleteOnExit();
- // user: password, realm
- try ( FileWriter writer = new FileWriter(realmFile); ) {
- writer.write("allowed: password, fuseki\n");
- writer.write("forbidden: password, other");
- }
-
- ServerCtl.setupServer(authPort, realmFile.getAbsolutePath(), authDatasetPath(), true);
- }
-
- private static void ensureEnvironment() {
- if ( RunDependently ) {
- FileOps.ensureDir(FusekiTestHome);
- FileOps.clearAll(FusekiTestHome);
- System.setProperty("FUSEKI_HOME", FusekiTestHome);
- System.setProperty("FUSEKI_BASE", FusekiTestBase);
- FusekiEnv.setEnvironment();
- FusekiLogging.setLogging();
- //LogCtl.enable(Fuseki.actionLog);
- }
- }
-
- @After public void teardownServer() {
- JettyFusekiWebapp.instance.stop();
- }
-
- public static QueryExecutionHTTP withAuthJDK(QueryExecutionHTTPBuilder builder, String user, String passwd) {
- Authenticator authenticator = AuthLib.authenticator(user, passwd);
- HttpClient hc = HttpClient.newBuilder().authenticator(authenticator).build();
- return builder.httpClient(hc).build();
- }
- public static UpdateExecutionHTTP withAuthJDK(UpdateExecutionHTTPBuilder builder, String user, String passwd) {
- Authenticator authenticator = AuthLib.authenticator(user, passwd);
- HttpClient hc = HttpClient.newBuilder().authenticator(authenticator).build();
- return builder.httpClient(hc).build();
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/FileSender.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/FileSender.java
deleted file mode 100644
index ce6ec45f06..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/FileSender.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.http.HttpClient;
-import java.net.http.HttpRequest;
-import java.net.http.HttpRequest.BodyPublishers;
-import java.net.http.HttpResponse;
-import java.net.http.HttpResponse.BodyHandlers;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.jena.http.HttpLib;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.riot.web.HttpNames;
-
-/**
- * Simple multipart form data HTTP PUT/POST sender, primarily for.
- * This class does not stream the content.
- */
-public class FileSender {
- // This class is in main/src to enable sharing without needing to depend on a test artifact.
-
- private static record Entry(String fileName, String content, String contentType) {}
- private List<Entry> items = new ArrayList<>();
- private final String url;
-
- public FileSender(String url ) { this.url = url; }
-
- public void add(String filename, String content, String type) {
- Entry e = new Entry(filename, content, type);
- items.add(e);
- }
-
- /** Return response code */
- public int send(String method) {
- String WNL = "\r\n"; // Web newline
- String boundary = UUID.randomUUID().toString();
-
- // This is for testing so build a body.
- StringBuilder strBuidler = new StringBuilder();
- for ( Entry e : items ) {
- strBuidler.append("--" + boundary+WNL);
- strBuidler.append("Content-Disposition: form-data; name=\"FILE\"; filename=\""+e.fileName+"\""+WNL);
- strBuidler.append("Content-Type: "+e.contentType+";charset=UTF-8"+WNL);
- strBuidler.append(WNL);
- strBuidler.append(e.content);
- strBuidler.append(WNL);
- }
- strBuidler.append("--" + boundary + "--"+WNL);
-
- URI uri = HttpLib.toRequestURI(url);
- String body = strBuidler.toString();
- String ctHeaderValue = WebContent.contentTypeMultipartFormData+"; boundary="+boundary;
-
- HttpRequest request = HttpRequest
- .newBuilder(uri)
- .setHeader(HttpNames.hContentType, ctHeaderValue)
- .method(method, BodyPublishers.ofString(body))
- .build();
- HttpResponse<InputStream> response = HttpLib.executeJDK(HttpClient.newHttpClient(), request, BodyHandlers.ofInputStream());
- HttpLib.handleResponseNoBody(response);
- return response.statusCode();
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/ServerCtl.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/ServerCtl.java
deleted file mode 100644
index 3397fcaadb..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/ServerCtl.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.fuseki.ServerCtl.ServerScope.CLASS;
-import static org.apache.jena.fuseki.ServerCtl.ServerScope.SUITE;
-import static org.apache.jena.fuseki.ServerCtl.ServerScope.TEST;
-
-import java.nio.file.Path;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.atlas.web.WebLib;
-import org.apache.jena.fuseki.cmd.FusekiArgs;
-import org.apache.jena.fuseki.cmd.JettyFusekiWebapp;
-import org.apache.jena.fuseki.cmd.JettyServerConfig;
-import org.apache.jena.fuseki.system.FusekiCore;
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-import org.apache.jena.fuseki.webapp.FusekiServerListener;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sparql.modify.request.Target;
-import org.apache.jena.sparql.modify.request.UpdateDrop;
-import org.apache.jena.sys.JenaSystem;
-import org.apache.jena.system.Txn;
-import org.apache.jena.update.Update;
-import org.apache.jena.update.UpdateExecutionFactory;
-import org.apache.jena.update.UpdateProcessor;
-
-/**
- * <b>Note:</b>
- * <br/>
- * <em> There is a {@code FusekiTestServer} in the basic Fuseki server which is more
- * appropriate for testing SPARQL protocols. It does not have an on-disk footprint.</em>
- * <br/>
- * This class is
- * primarily for testing the full Fuseki server and has a full on-disk configuration.
- *
- * Manage a single server for use with tests. It supports three modes:
- * <ul>
- * <li>One server for a whole test suite
- * <li>One server per test class
- * <li>One server per individual test
- * </ul>
- * One server per individual test can be troublesome due to connections not closing down
- * fast enough (left in TCP state {@code TIME_WAIT} which is 2 minutes) and also can be
- * slow. One server per test class is a good compromise.
- * <p>
- * The data in the server is always reset between tests.
- * <p>
- * Usage:
- * </p>
- * <p>
- * In the test suite, put:
- *
- * <pre>
- * {@literal @BeforeClass} static public void beforeSuiteClass() { ServerCtl.ctlBeforeTestSuite(); }
- * {@literal @AfterClass} static public void afterSuiteClass() { ServerCtl.ctlAfterTestSuite(); }
- * </pre>
- * <p>
- * In the test class, put:
- *
- * <pre>
- * {@literal @BeforeClass} public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
- * {@literal @AfterClass} public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
- * {@literal @Before} public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
- * {@literal @After} public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
- * </pre>
- */
-public class ServerCtl {
- static {
- JenaSystem.init();
- FusekiCore.init();
- }
-
- /* Cut&Paste versions:
-
- Test suite (TS_*)
- @BeforeClass static public void beforeSuiteClass() { ServerCtl.ctlBeforeTestSuite(); }
- @AfterClass static public void afterSuiteClass() { ServerCtl.ctlAfterTestSuite(); }
-
- Test class (Test*)
- @BeforeClass public static void ctlBeforeClass() { ServerCtl.ctlBeforeClass(); }
- @AfterClass public static void ctlAfterClass() { ServerCtl.ctlAfterClass(); }
- @Before public void ctlBeforeTest() { ServerCtl.ctlBeforeTest(); }
- @After public void ctlAfterTest() { ServerCtl.ctlAfterTest(); }
-
- */
-
- // Note: it is important to cleanly close a PoolingHttpClient across server restarts
- // otherwise the pooled connections remain for the old server.
-
- /*package : for import static */ enum ServerScope { SUITE, CLASS, TEST }
- private static ServerScope serverScope = ServerScope.CLASS;
- private static int currentPort = WebLib.choosePort();
-
- public static int port() {
- return currentPort;
- }
-
- // Whether to use a transaction on the dataset or to use SPARQL Update.
- static boolean CLEAR_DSG_DIRECTLY = true;
- static private DatasetGraph dsgTesting;
-
- // Abstraction that runs a SPARQL server for tests.
- public static final String urlRoot() { return "http://localhost:"+port()+"/"; }
- public static final String datasetName() { return "dataset"; }
- public static final String datasetPath() { return "/"+datasetName(); }
- public static final String urlDataset() { return "http://localhost:"+port()+datasetPath(); }
-
- public static final String serviceUpdate() { return "http://localhost:"+port()+datasetPath()+"/update"; }
- public static final String serviceQuery() { return "http://localhost:"+port()+datasetPath()+"/query"; }
- public static final String serviceGSP() { return "http://localhost:"+port()+datasetPath()+"/data"; }
-
-
- public static void ctlBeforeTestSuite() {
- if ( serverScope == SUITE ) {
- setHttpClient();
- allocServer();
- }
- }
-
- public static void ctlAfterTestSuite() {
- if ( serverScope == SUITE ) {
- freeServer();
- resetDefaultHttpClient();
- }
- }
-
- /**
- * Setup for the tests by allocating a Fuseki instance to work with
- */
- public static void ctlBeforeClass() {
- if ( serverScope == CLASS ) {
- setHttpClient();
- allocServer();
- }
- }
-
- /**
- * Clean up after tests by de-allocating the Fuseki instance
- */
- public static void ctlAfterClass() {
- if ( serverScope == CLASS ) {
- freeServer();
- resetDefaultHttpClient();
- }
- }
-
- /**
- * Placeholder.
- */
- public static void ctlBeforeTest() {
- if ( serverScope == TEST ) {
- setHttpClient();
- allocServer();
- }
- }
-
- /**
- * Clean up after each test by resetting the Fuseki dataset
- */
- public static void ctlAfterTest() {
- if ( serverScope == TEST ) {
- freeServer();
- resetDefaultHttpClient();
- } else
- resetServer();
- }
-
- private static void setHttpClient() {}
- private static void resetDefaultHttpClient() {}
-
- // reference count of start/stop server
- private static AtomicInteger countServer = new AtomicInteger();
- private static JettyFusekiWebapp server = null;
-
- /*package*/ static void allocServer() {
- if ( countServer.getAndIncrement() == 0 )
- setupServer(true);
- }
-
- /*package*/ static void freeServer() {
- if ( countServer.decrementAndGet() == 0 )
- teardownServer();
- }
-
- protected static void setupServer(boolean updateable) {
- // Does not initial Fuseki webapp.
- FusekiEnv.FUSEKI_HOME = Path.of(TS_FusekiWebapp.FusekiTestHome).toAbsolutePath();
- FileOps.ensureDir("target");
- FileOps.ensureDir(TS_FusekiWebapp.FusekiTestHome);
- FileOps.ensureDir(TS_FusekiWebapp.FusekiTestBase);
- FusekiEnv.FUSEKI_BASE = Path.of(TS_FusekiWebapp.FusekiTestBase).toAbsolutePath();
- // Must have shiro.ini.
- // This fakes the state after FusekiSystem initialization
- // in the case of starting in the same location. FusekiSystem has statics.
- // Fuseki-full is designed to be the only server, not restartable.
- // Here, we want to reset for testing.
- FusekiWebapp.formatBaseArea();
- emptyDirectory(FusekiWebapp.dirSystemDatabase);
- emptyDirectory(FusekiWebapp.dirBackups);
- emptyDirectory(FusekiWebapp.dirLogs);
- emptyDirectory(FusekiWebapp.dirConfiguration);
- emptyDirectory(FusekiWebapp.dirDatabases);
- emptyDirectory(FusekiWebapp.dirSystemFileArea);
-
- setupServer(port(), null, datasetPath(), updateable);
- }
-
- private static void emptyDirectory(Path directory) {
- if ( directory == null )
- // Server will create.
- return;
- FileOps.clearAll(directory.toString());
- }
-
- public static void setupServer(int port, String authConfigFile, String datasetPath, boolean updateable) {
- FusekiArgs params = new FusekiArgs();
- dsgTesting = DatasetGraphFactory.createTxnMem();
- params.dsg = dsgTesting;
- params.datasetPath = datasetPath;
- params.allowUpdate = updateable;
-
- FusekiServerListener.initialSetup = params;
-
- JettyServerConfig config = make(port, true);
- config.authConfigFile = authConfigFile;
- JettyFusekiWebapp.initializeServer(config);
- JettyFusekiWebapp.instance.start();
- server = JettyFusekiWebapp.instance;
- }
-
- /*package*/ static void teardownServer() {
- if ( server != null ) {
- // Clear out the registry.
- server.getDataAccessPointRegistry().clear();
- FileOps.clearAll(FusekiWebapp.dirConfiguration.toFile());
- server.stop();
- }
- server = null;
- }
-
- /*package*/ static JettyServerConfig make(int port, boolean allowUpdate) {
- JettyServerConfig config = new JettyServerConfig();
- // Avoid any persistent record.
- config.port = port;
- config.contextPath = "/";
- // Always execute tests with localhost only access.
- config.loopback = true;
- config.jettyConfigFile = null;
- config.enableCompression = true;
- config.verboseLogging = false;
- return config;
- }
-
- /*package*/ static void resetServer() {
- if (countServer.get() == 0)
- throw new RuntimeException("No server started!");
- if ( CLEAR_DSG_DIRECTLY ) {
- Txn.executeWrite(dsgTesting, ()->dsgTesting.clear());
- } else {
- Update clearRequest = new UpdateDrop(Target.ALL);
- UpdateProcessor proc = UpdateExecutionFactory.createRemote(clearRequest, serviceUpdate());
- try {proc.execute(); }
- catch (Throwable e) {e.printStackTrace(); throw e;}
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/ServerTest.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/ServerTest.java
deleted file mode 100644
index 4cd79eb8c2..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/ServerTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import org.apache.jena.graph.Graph;
-import org.apache.jena.graph.Node;
-import org.apache.jena.graph.NodeFactory;
-import org.apache.jena.sparql.sse.SSE;
-
-class ServerTest {
- public static final String graphName1 = "http://graph/1";
- public static final String graphName2 = "http://graph/2";
- public static final String graphName99 = "http://graph/99";
-
- public static final Node gn1 = NodeFactory.createURI("http://graph/1");
- public static final Node gn2 = NodeFactory.createURI("http://graph/2");
- public static final Node gn99 = NodeFactory.createURI("http://graph/99");
-
- public static final Graph graph1 = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 1)))");
- public static final Graph graph2 = SSE.parseGraph("(base <http://example/> (graph (<x> <p> 2)))");
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java
deleted file mode 100644
index 14733687de..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TS_FusekiWebapp.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import org.apache.jena.atlas.lib.FileOps;
-import org.apache.jena.fuseki.system.FusekiLogging;
-import org.apache.jena.fuseki.webapp.FusekiEnv;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {
- TestWebappSPARQLProtocol.class
- , TestWebappAuthQuery_JDK.class
- , TestWebappAuthUpdate_JDK.class
- , TestWebappFileUpload.class
- , TestWebappAdmin.class
- , TestWebappAdminAddDeleteDatasetTemplate.class
- , TestWebappAdminAddDeleteDatasetFile.class
- , TestWebappAdminAPI.class
- , TestWebappServerReadOnly.class
- , TestWebappMetrics.class
-})
-
-public class TS_FusekiWebapp extends ServerTest
-{
- public static String FusekiTestHome = "target/FusekiTest";
- public static String FusekiTestBase = FusekiTestHome+"/run";
-
- @BeforeClass public static void setupForFusekiServer() {
- AbstractTestWebappAuth_JDK.RunDependently = false;
- FileOps.ensureDir(FusekiTestHome);
- FileOps.clearAll(FusekiTestHome);
- System.setProperty("FUSEKI_HOME", FusekiTestHome);
- FusekiEnv.setEnvironment();
- FusekiLogging.setLogging();
- ServerCtl.ctlBeforeTestSuite();
- }
-
- @AfterClass
- static public void afterSuiteClass() {
- ServerCtl.ctlAfterTestSuite();
- AbstractTestWebappAuth_JDK.RunDependently = false;
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdmin.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdmin.java
deleted file mode 100644
index 499bb1507e..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdmin.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opBackup;
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opDatasets;
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opListBackups;
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opServer;
-import static org.apache.jena.fuseki.server.ServerConst.opPing;
-import static org.apache.jena.http.HttpOp.httpGet;
-import static org.apache.jena.http.HttpOp.httpGetJson;
-import static org.apache.jena.http.HttpOp.httpPost;
-import static org.apache.jena.http.HttpOp.httpPostRtnJSON;
-import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.atlas.json.JSON;
-import org.apache.jena.atlas.json.JsonArray;
-import org.apache.jena.atlas.json.JsonObject;
-import org.apache.jena.atlas.json.JsonValue;
-import org.apache.jena.atlas.lib.Lib;
-import org.apache.jena.atlas.logging.LogCtl;
-import org.apache.jena.atlas.web.HttpException;
-import org.apache.jena.atlas.web.TypedInputStream;
-import org.apache.jena.fuseki.ctl.JsonConstCtl;
-import org.apache.jena.fuseki.mgt.ServerMgtConst;
-import org.apache.jena.fuseki.server.ServerConst;
-import org.apache.jena.fuseki.test.HttpTest;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.web.HttpSC;
-import org.awaitility.Awaitility;
-
-/** Tests of the admin functionality */
-public class TestWebappAdmin extends AbstractFusekiWebappTest {
-
- // Name of the dataset in the assembler file.
- static String fileBase = "testing/";
-
- @Before public void setLogging() {
- LogCtl.setLevel(Fuseki.backupLogName, "ERROR");
- LogCtl.setLevel(Fuseki.compactLogName,"ERROR");
- Awaitility.setDefaultPollDelay(20,TimeUnit.MILLISECONDS);
- Awaitility.setDefaultPollInterval(50,TimeUnit.MILLISECONDS);
- }
-
- @After public void unsetLogging() {
- LogCtl.setLevel(Fuseki.backupLogName, "WARN");
- LogCtl.setLevel(Fuseki.compactLogName,"WARN");
- }
-
- // --- Ping
-
- @Test public void ping_1() {
- httpGet(ServerCtl.urlRoot()+"$/"+opPing);
- }
-
- @Test public void ping_2() {
- httpPost(ServerCtl.urlRoot()+"$/"+opPing);
- }
-
- // --- Server status
-
- @Test public void server_1() {
- JsonValue jv = httpGetJson(ServerCtl.urlRoot()+"$/"+opServer);
- JsonObject obj = jv.getAsObject();
- // Now optional : assertTrue(obj.hasKey(JsonConst.admin));
- assertTrue(obj.hasKey(ServerConst.datasets));
- assertTrue(obj.hasKey(ServerMgtConst.uptime));
- assertTrue(obj.hasKey(ServerMgtConst.startDT));
- }
-
- @Test public void server_2() {
- httpPost(ServerCtl.urlRoot()+"$/"+opServer);
- }
-
- // --- List all datasets
-
- @Test public void list_datasets_1() {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opDatasets); ) {
- IO.skipToEnd(in);
- }
- }
-
- @Test public void list_datasets_2() {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opDatasets) ) {
- assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parseAny(in);
- assertNotNull(v.getAsObject().get("datasets"));
- checkJsonDatasetsAll(v);
- }
- }
-
- // Specific dataset
- @Test public void list_datasets_3() {
- checkExists(ServerCtl.datasetName());
- }
-
- // Specific dataset
- @Test public void list_datasets_4() {
- HttpTest.expect404( () -> getDatasetDescription("does-not-exist") );
- }
-
- // Specific dataset
- @Test public void list_datasets_5() {
- JsonValue v = getDatasetDescription(ServerCtl.datasetName());
- checkJsonDatasetsOne(v.getAsObject());
- }
-
- // ---- Backup
-
- @Test public void create_backup_1() {
- String id = null;
- try {
- JsonValue v = httpPostRtnJSON(ServerCtl.urlRoot() + "$/" + opBackup + "/" + ServerCtl.datasetName());
- id = v.getAsObject().getString("taskId");
- } finally {
- waitForTasksToFinish(1000, 10, 20000);
- }
- Assert.assertNotNull(id);
- checkInTasks(id);
-
- // Check a backup was created
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opListBackups) ) {
- assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parseAny(in);
- assertNotNull(v.getAsObject().get("backups"));
- JsonArray a = v.getAsObject().get("backups").getAsArray();
- Assert.assertEquals(1, a.size());
- }
-
- JsonValue task = getTask(id);
- Assert.assertNotNull(id);
- // Expect task success
- Assert.assertTrue("Expected task to be marked as successful", task.getAsObject().getBoolean(JsonConstCtl.success));
- }
-
- @Test
- public void create_backup_2() {
- HttpTest.expect400(()->{
- JsonValue v = httpPostRtnJSON(ServerCtl.urlRoot() + "$/" + opBackup + "/noSuchDataset");
- });
- }
-
- @Test public void list_backups_1() {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opListBackups) ) {
- assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parseAny(in);
- assertNotNull(v.getAsObject().get("backups"));
- }
- }
-
- @Test public void sleep_1() {
- String x = execSleepTask(null, 1);
- }
-
- @Test public void sleep_2() {
- try {
- String x = execSleepTask(null, -1);
- fail("Sleep call unexpectedly succeed");
- } catch (HttpException ex) {
- assertEquals(400, ex.getStatusCode());
- }
- }
-
- @Test public void sleep_3() {
- try {
- String x = execSleepTask(null, 20*1000+1);
- fail("Sleep call unexpectedly succeed");
- } catch (HttpException ex) {
- assertEquals(400, ex.getStatusCode());
- }
- }
-
- // Async task testing
-
- @Test public void task_1() {
- String x = execSleepTask(null, 10);
- assertNotNull(x);
- Integer.parseInt(x);
- }
-
- @Test public void task_2() {
- String x = "NoSuchTask";
- String url = ServerCtl.urlRoot()+"$/tasks/"+x;
- HttpTest.expect404(()->httpGetJson(url) );
- try {
- checkInTasks(x);
- fail("No failure!");
- } catch (AssertionError ex) {}
- }
-
-
- @Test public void task_3() {
- // Timing dependent.
- // Create a "long" running task so we can find it.
- String x = execSleepTask(null, 100);
- checkTask(x);
- checkInTasks(x);
- assertNotNull(x);
- Integer.parseInt(x);
- }
-
- @Test public void task_4() {
- // Timing dependent.
- // Create a "short" running task
- String x = execSleepTask(null, 1);
- // Check exists in the list of all tasks (should be "finished")
- checkInTasks(x);
- String url = ServerCtl.urlRoot()+"$/tasks/"+x;
-
- boolean finished = false;
- for ( int i = 0; i < 10; i++ ) {
- if ( i != 0 )
- Lib.sleep(25);
- JsonValue v = httpGetJson(url);
- checkTask(v);
- if ( v.getAsObject().hasKey("finished") ) {
- finished = true;
- break;
- }
- }
- if ( ! finished )
- fail("Task has not finished");
- }
-
- @Test public void task_5() {
- // Short running task - still in info API call.
- String x = execSleepTask(null, 1);
- checkInTasks(x);
- }
-
- @Test public void task_6() {
- String x1 = execSleepTask(null, 1000);
- String x2 = execSleepTask(null, 1000);
- await().timeout(500,TimeUnit.MILLISECONDS).until(() -> runningTasks().size() > 1);
- await().timeout(2000, TimeUnit.MILLISECONDS).until(() -> runningTasks().isEmpty());
- }
-
- @Test public void task_7() {
- try {
- String x1 = execSleepTask(null, 1000);
- String x2 = execSleepTask(null, 1000);
- String x3 = execSleepTask(null, 1000);
- String x4 = execSleepTask(null, 1000);
- try {
- // Try to make test more stable on a loaded CI server.
- // Unloaded the first sleep will fail but due to slowness/burstiness
- // some tasks above may have completed.
- String x5 = execSleepTask(null, 4000);
- String x6 = execSleepTask(null, 4000);
- String x7 = execSleepTask(null, 4000);
- String x8 = execSleepTask(null, 10);
- fail("Managed to add a 5th test");
- } catch (HttpException ex) {
- assertEquals(HttpSC.BAD_REQUEST_400, ex.getStatusCode());
- }
- } finally {
- waitForTasksToFinish(1000, 250, 4000);
- }
- }
-
- private void assertEqualsIgnoreCase(String contenttypejson, String contentType) {}
-
- private static JsonValue getTask(String taskId) {
- String url = ServerCtl.urlRoot()+"$/tasks/"+taskId;
- return httpGetJson(url);
- }
-
- private static JsonValue getDatasetDescription(String dsName) {
- if ( dsName.startsWith("/") )
- dsName = dsName.substring(1);
- try (TypedInputStream in = httpGet(ServerCtl.urlRoot() + "$/" + opDatasets + "/" + dsName)) {
- assertEqualsContentType(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parse(in);
- return v;
- }
- }
-
- private static String execSleepTask(String name, int millis) {
- String url = ServerCtl.urlRoot()+"$/sleep";
- if ( name != null ) {
- if ( name.startsWith("/") )
- name = name.substring(1);
- url = url + "/"+name;
- }
-
- JsonValue v = httpPostRtnJSON(url+"?interval="+millis);
- String id = v.getAsObject().getString("taskId");
- return id;
- }
-
- private static void checkTask(String x) {
- String url = ServerCtl.urlRoot()+"$/tasks/"+x;
- JsonValue v = httpGetJson(url);
- checkTask(v);
- }
-
- private static void checkTask(JsonValue v) {
- assertNotNull(v);
- assertTrue(v.isObject());
- //System.out.println(v);
- JsonObject obj = v.getAsObject();
- try {
- assertTrue(obj.hasKey("task"));
- assertTrue(obj.hasKey("taskId"));
- // Not present until it runs : "started"
- } catch (AssertionError ex) {
- System.out.println(obj);
- throw ex;
- }
- }
-
- private static void checkInTasks(String x) {
- String url = ServerCtl.urlRoot()+"$/tasks";
- JsonValue v = httpGetJson(url);
- assertTrue(v.isArray());
- JsonArray array = v.getAsArray();
- int found = 0;
- for ( int i = 0; i < array.size(); i++ ) {
- JsonValue jv = array.get(i);
- assertTrue(jv.isObject());
- JsonObject obj = jv.getAsObject();
- checkTask(obj);
- if ( obj.getString("taskId").equals(x) ) {
- found++;
- }
- }
- assertEquals("Occurrence of taskId count", 1, found);
- }
-
- private static List<String> runningTasks(String... x) {
- String url = ServerCtl.urlRoot()+"$/tasks";
- JsonValue v = httpGetJson(url);
- assertTrue(v.isArray());
- JsonArray array = v.getAsArray();
- List<String> running = new ArrayList<>();
- for ( int i = 0; i < array.size(); i++ ) {
- JsonValue jv = array.get(i);
- assertTrue(jv.isObject());
- JsonObject obj = jv.getAsObject();
- if ( isRunning(obj) )
- running.add(obj.getString("taskId"));
- }
- return running;
- }
-
- /**
- * Wait for tasks to all finish.
- * Algorithm: wait for {@code pause}, then start polling for upto {@code maxWaitMillis}.
- * Intervals in milliseconds.
- * @param pauseMillis
- * @param pollInterval
- * @param maxWaitMillis
- * @return
- */
- private static boolean waitForTasksToFinish(int pauseMillis, int pollInterval, int maxWaitMillis) {
- // Wait for them to finish.
- // Divide into chunks
- if ( pauseMillis > 0 )
- Lib.sleep(pauseMillis);
- long start = System.currentTimeMillis();
- long endTime = start + maxWaitMillis;
- final int intervals = maxWaitMillis/pollInterval;
- long now = start;
- for (int i = 0 ; i < intervals ; i++ ) {
- // May have waited (much) longer than the pollInterval : heavily loaded build systems.
- if ( now-start > maxWaitMillis )
- break;
- List<String> x = runningTasks();
- if ( x.isEmpty() )
- return true;
- Lib.sleep(pollInterval);
- now = System.currentTimeMillis();
- }
- return false;
- }
-
- private static boolean isRunning(JsonObject taskObj) {
- checkTask(taskObj);
- return taskObj.hasKey("started") && ! taskObj.hasKey("finished");
- }
-
- private static void askPing(String name) {
- if ( name.startsWith("/") )
- name = name.substring(1);
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+name+"/sparql?query=ASK%7B%7D") ) {
- IO.skipToEnd(in);
- }
- }
-
- private static void adminPing(String name) {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opDatasets+"/"+name) ) {
- IO.skipToEnd(in);
- }
- }
-
- private static void checkExists(String name) {
- adminPing(name);
- askPing(name);
- }
-
- private static void checkJsonDatasetsAll(JsonValue v) {
- assertNotNull(v.getAsObject().get("datasets"));
- JsonArray a = v.getAsObject().get("datasets").getAsArray();
- for ( JsonValue v2 : a )
- checkJsonDatasetsOne(v2);
- }
-
- private static void checkJsonDatasetsOne(JsonValue v) {
- assertTrue(v.isObject());
- JsonObject obj = v.getAsObject();
- assertNotNull(obj.get("ds.name"));
- assertNotNull(obj.get("ds.services"));
- assertNotNull(obj.get("ds.state"));
- assertTrue(obj.get("ds.services").isArray());
- }
-
- /** Expect two strings to be non-null and be {@link String#equalsIgnoreCase} */
- protected static void assertEqualsContentType(String expected, String actual) {
- if ( expected == null && actual == null )
- return;
- if ( expected == null || actual == null )
- fail("Expected: "+expected+" Got: "+actual);
- if ( ! expected.equalsIgnoreCase(actual) )
- fail("Expected: "+expected+" Got: "+actual);
- }
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAPI.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAPI.java
deleted file mode 100644
index 8fa3ff7004..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAPI.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-import org.apache.jena.atlas.web.HttpException;
-import org.apache.jena.atlas.web.TypedInputStream;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.http.HttpOp;
-import org.apache.jena.query.QueryExecution;
-import org.apache.jena.rdfconnection.RDFConnection;
-import org.apache.jena.sparql.exec.http.Params;
-import org.apache.jena.web.HttpSC;
-import org.junit.Test;
-
-/** More tests of the admin functionality
- * See also TestAdmin.
- */
-public class TestWebappAdminAPI extends AbstractFusekiWebappTest {
-
- @Test public void add_delete_api_1() throws Exception {
- if ( org.apache.jena.tdb1.sys.SystemTDB.isWindows )
- return;
- testAddDelete("db_mem", "mem", false);
- }
-
- private static void testAddDelete(String dbName, String dbType, boolean hasFiles) {
- String datasetURL = ServerCtl.urlRoot()+dbName;
- String admin = ServerCtl.urlRoot()+"$/";
-
- Params params = Params.create().add("dbName", dbName).add("dbType", dbType);
-
- assertFalse(exists(datasetURL));
-
- HttpOp.httpPostForm(admin+"datasets", params);
-
- RDFConnection conn = RDFConnection.connect(datasetURL);
- conn.update("INSERT DATA { <x:s> <x:p> 123 }");
- int x1 = count(conn);
- assertEquals(1, x1);
-
- Path pathDB = FusekiWebapp.dirDatabases.resolve(dbName);
-
- if ( hasFiles )
- assertTrue(Files.exists(pathDB));
-
- HttpOp.httpDelete(admin+"datasets/"+dbName);
-
- assertFalse(exists(datasetURL));
-
- //if ( hasFiles )
- assertFalse(Files.exists(pathDB));
-
- // Recreate : no contents.
- HttpOp.httpPostForm(admin+"datasets", params);
- assertTrue("false: exists("+datasetURL+")", exists(datasetURL));
- int x2 = count(conn);
- assertEquals(0, x2);
- if ( hasFiles )
- assertTrue(Files.exists(pathDB));
- }
-
- private static boolean exists(String url) {
- try ( TypedInputStream in = HttpOp.httpGet(url) ) {
- return true;
- } catch (HttpException ex) {
- if ( ex.getStatusCode() == HttpSC.NOT_FOUND_404 )
- return false;
- throw ex;
- }
- }
-
- static int count(RDFConnection conn) {
- try ( QueryExecution qExec = conn.query("SELECT (count(*) AS ?C) { ?s ?p ?o }")) {
- return qExec.execSelect().next().getLiteral("C").getInt();
- }
- }
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAddDeleteDatasetFile.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAddDeleteDatasetFile.java
deleted file mode 100644
index 82a376103f..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAddDeleteDatasetFile.java
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opBackup;
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opCompact;
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opDatasets;
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opListBackups;
-import static org.apache.jena.fuseki.server.ServerConst.opStats;
-import static org.apache.jena.http.HttpOp.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.http.HttpRequest.BodyPublisher;
-import java.net.http.HttpRequest.BodyPublishers;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.AssumptionViolatedException;
-import org.junit.Before;
-import org.junit.jupiter.api.Test;
-
-import org.apache.commons.lang3.SystemUtils;
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.atlas.json.JSON;
-import org.apache.jena.atlas.json.JsonArray;
-import org.apache.jena.atlas.json.JsonObject;
-import org.apache.jena.atlas.json.JsonValue;
-import org.apache.jena.atlas.lib.Lib;
-import org.apache.jena.atlas.logging.LogCtl;
-import org.apache.jena.atlas.web.HttpException;
-import org.apache.jena.atlas.web.TypedInputStream;
-import org.apache.jena.fuseki.ctl.JsonConstCtl;
-import org.apache.jena.fuseki.test.HttpTest;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.query.QueryExecution;
-import org.apache.jena.rdfconnection.RDFConnection;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.web.HttpSC;
-import org.awaitility.Awaitility;
-
-/** Tests of the admin functionality */
-public class TestWebappAdminAddDeleteDatasetFile extends AbstractFusekiWebappTest {
-
- // Name of the dataset in the assembler file.
- static String dsTest = "test-ds1";
- static String dsTestInf = "test-ds4";
-
- // There are two Fuseki-TDB2 tests: add_delete_dataset_6() and compact_01().
- //
- // On certain build systems (GH action/Linux under load, ASF Jenkins sometimes),
- // add_delete_dataset_6 fails (transactions active), or compact_01 (gets a 404),
- // if the two databases are the same.
- static String dsTestTdb2a = "test-tdb2a";
- static String dsTestTdb2b = "test-tdb2b";
- static String fileBase = "testing/";
-
- @Before public void setLogging() {
- LogCtl.setLevel(Fuseki.backupLogName, "ERROR");
- LogCtl.setLevel(Fuseki.compactLogName,"ERROR");
- LogCtl.setLevel(Fuseki.adminLogName,"ERROR");
- Awaitility.setDefaultPollDelay(20,TimeUnit.MILLISECONDS);
- Awaitility.setDefaultPollInterval(50,TimeUnit.MILLISECONDS);
- }
-
- @After public void unsetLogging() {
- LogCtl.setLevel(Fuseki.backupLogName, "WARN");
- LogCtl.setLevel(Fuseki.compactLogName,"WARN");
- LogCtl.setLevel(Fuseki.adminLogName,"WARN");
- }
-
- private static void withFileEnabled(Runnable action) {
- System.setProperty(FusekiWebapp.allowConfigFileProperty, "true");
- try {
- action.run();
- } finally {
- System.getProperties().remove(FusekiWebapp.allowConfigFileProperty);
- }
- }
-
- // --- List all datasets
-
- @Test public void list_datasets_1() {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opDatasets); ) {
- IO.skipToEnd(in);
- }
- }
-
- @Test public void list_datasets_2() {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opDatasets) ) {
- assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parseAny(in);
- assertNotNull(v.getAsObject().get("datasets"));
- checkJsonDatasetsAll(v);
- }
- }
-
- // Specific dataset
- @Test public void list_datasets_3() {
- checkExists(ServerCtl.datasetName());
- }
-
- // Specific dataset
- @Test public void list_datasets_4() {
- HttpTest.expect404( () -> getDatasetDescription("does-not-exist") );
- }
-
- // Specific dataset
- @Test public void list_datasets_5() {
- JsonValue v = getDatasetDescription(ServerCtl.datasetName());
- checkJsonDatasetsOne(v.getAsObject());
- }
-
- @Test public void add_dataset_blocked() {
- // Do without enabling upload of configuration files - expected to fail
- HttpException ex = assertThrows(HttpException.class, ()->addTestDatasetPerform(fileBase+"config-ds-plain-1.ttl"));
- assertEquals(ex.getStatusCode(), HttpSC.BAD_REQUEST_400);
- }
-
- // Specific dataset
- @Test public void add_delete_dataset_1() {
- checkNotThere(dsTest);
-
- addTestDataset();
-
- // Check exists.
- checkExists(dsTest);
-
- // Remove it.
- deleteDataset(dsTest);
- checkNotThere(dsTest);
- }
-
- // Try to add twice
- @Test public void add_delete_dataset_2() {
- checkNotThere(dsTest);
-
- withFileEnabled(()->{
- try {
- Path f = Path.of(fileBase+"config-ds-plain-1.ttl");
- {
- httpPost(ServerCtl.urlRoot()+"$/"+opDatasets,
- WebContent.contentTypeTurtle+"; charset="+WebContent.charsetUTF8,
- BodyPublishers.ofFile(f));
- }
- // Check exists.
- checkExists(dsTest);
- try {
- } catch (HttpException ex) {
- httpPost(ServerCtl.urlRoot()+"$/"+opDatasets,
- WebContent.contentTypeTurtle+"; charset="+WebContent.charsetUTF8,
- BodyPublishers.ofFile(f));
- assertEquals(HttpSC.CONFLICT_409, ex.getStatusCode());
- }
- } catch (IOException ex) { IO.exception(ex); return; }
- });
- // Check exists.
- checkExists(dsTest);
- deleteDataset(dsTest);
- }
-
- @Test public void add_delete_dataset_3() {
- checkNotThere(dsTest);
- addTestDataset();
- checkExists(dsTest);
- deleteDataset(dsTest);
- checkNotThere(dsTest);
- addTestDataset();
- checkExists(dsTest);
- deleteDataset(dsTest);
- }
-
- @Test public void add_delete_dataset_4() {
- checkNotThere(dsTest);
- checkNotThere(dsTestInf);
- addTestDatasetInf();
- checkNotThere(dsTest);
- checkExists(dsTestInf);
-
- deleteDataset(dsTestInf);
- checkNotThere(dsTestInf);
- addTestDatasetInf();
- checkExists(dsTestInf);
- deleteDataset(dsTestInf);
- }
-
- @Test public void add_delete_dataset_5() {
- // New style operations : cause two fuseki:names
- addTestDataset(fileBase+"config-ds-plain-2.ttl");
- checkExists("test-ds2");
- }
-
- @Test public void add_delete_dataset_6() {
- String testDB = dsTestTdb2a;
- assumeNotWindows();
-
- checkNotThere(testDB);
-
- addTestDatasetTDB2(testDB);
-
- // Check exists.
- checkExists(testDB);
-
- // Remove it.
- deleteDataset(testDB);
- checkNotThere(testDB);
- }
-
- @Test public void add_delete_dataset_TDB_1() {
- String testDB = dsTestTdb2a;
- assumeNotWindows();
-
- checkNotThere(testDB);
-
- addTestDatasetTDB2(testDB);
-
- // Check exists.
- checkExists(testDB);
-
- // Remove it.
- deleteDataset(testDB);
- checkNotThere(testDB);
- }
-
- @Test public void add_delete_dataset_TDB_2() {
- // This has location "--mem--"
- String testDB = dsTestTdb2b;
- checkNotThere(testDB);
- addTestDatasetTDB2(testDB);
- // Check exists.
- checkExists(testDB);
- // Remove it.
- deleteDataset(testDB);
- checkNotThere(testDB);
- }
-
- @Test public void add_error_1() {
- HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400,
- ()-> addTestDataset(fileBase+"config-ds-bad-name-1.ttl"));
- }
-
- @Test public void add_error_2() {
- HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400,
- ()-> addTestDataset(fileBase+"config-ds-bad-name-2.ttl"));
- }
-
- @Test public void add_error_3() {
- HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400,
- ()-> addTestDataset(fileBase+"config-ds-bad-name-3.ttl"));
- }
-
- @Test public void add_error_4() {
- HttpTest.execWithHttpException(HttpSC.BAD_REQUEST_400,
- ()-> addTestDataset(fileBase+"config-ds-bad-name-4.ttl"));
- }
-
- @Test public void noOverwriteExistingConfigFile() throws IOException {
- var workingDir = Paths.get("").toAbsolutePath();
- var path = workingDir.resolve(TS_FusekiWebapp.FusekiTestBase+"/configuration/test-ds0-empty.ttl");
- var dbConfig = path.toFile();
- dbConfig.createNewFile();
- try {
- // refresh the file system so that the file exists
- dbConfig = path.toFile();
- assertTrue (dbConfig.exists());
- assertEquals(0, dbConfig.length());
-
- // Try to override the file with a new configuration.
- String ct = WebContent.contentTypeHTMLForm;
- String body = "dbName=test-ds0-empty&dbType=mem";
- HttpException ex = assertThrows(org.apache.jena.atlas.web.HttpException.class,
- ()-> httpPost(ServerCtl.urlRoot()+"$/" + opDatasets, ct, body));
- assertEquals(HttpSC.CONFLICT_409, ex.getStatusCode());
- // refresh the file system
- dbConfig = path.toFile();
- assertTrue(dbConfig.exists());
- assertEquals("File should be still empty", 0, dbConfig.length());
- }
- finally {
- // Clean up the file.
- if (Files.exists(path)) {
- Files.delete(path);
- }
- }
- }
-
- @Test public void delete_dataset_1() {
- String name = "NoSuchDataset";
- HttpTest.expect404( ()-> httpDelete(ServerCtl.urlRoot()+"$/"+opDatasets+"/"+name) );
- }
-
- // ---- Backup
-
- @Test public void create_backup_1() {
- String id = null;
- try {
- JsonValue v = httpPostRtnJSON(ServerCtl.urlRoot() + "$/" + opBackup + "/" + ServerCtl.datasetName());
- id = v.getAsObject().getString("taskId");
- } finally {
- waitForTasksToFinish(1000, 10, 20000);
- }
- Assert.assertNotNull(id);
- checkInTasks(id);
-
- // Check a backup was created
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opListBackups) ) {
- assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parseAny(in);
- assertNotNull(v.getAsObject().get("backups"));
- JsonArray a = v.getAsObject().get("backups").getAsArray();
- Assert.assertEquals(1, a.size());
- }
-
- JsonValue task = getTask(id);
- Assert.assertNotNull(id);
- // Expect task success
- Assert.assertTrue("Expected task to be marked as successful", task.getAsObject().getBoolean(JsonConstCtl.success));
- }
-
- @Test
- public void create_backup_2() {
- HttpTest.expect400(()->{
- JsonValue v = httpPostRtnJSON(ServerCtl.urlRoot() + "$/" + opBackup + "/noSuchDataset");
- });
- }
-
- @Test public void list_backups_1() {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opListBackups) ) {
- assertEqualsIgnoreCase(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parseAny(in);
- assertNotNull(v.getAsObject().get("backups"));
- }
- }
-
- // ---- Compact
-
- @Test public void compact_01() {
- assumeNotWindows();
-
- String testDB = dsTestTdb2b;
- try {
- checkNotThere(testDB);
- addTestDatasetTDB2(testDB);
- checkExists(testDB);
-
- String id = null;
- try {
- JsonValue v = httpPostRtnJSON(ServerCtl.urlRoot() + "$/" + opCompact + "/" + testDB);
- id = v.getAsObject().getString(JsonConstCtl.taskId);
- } finally {
- waitForTasksToFinish(1000, 500, 20_000);
- }
- Assert.assertNotNull(id);
- checkInTasks(id);
-
- JsonValue task = getTask(id);
- // ----
- // The result assertion is throwing NPE occasionally on some heavily loaded CI servers.
- // This may be because of server or test code encountering a very long wait.
- // These next statements check the assumed structure of the return.
- Assert.assertNotNull("Task value", task);
- JsonObject obj = task.getAsObject();
- Assert.assertNotNull("Task.getAsObject()", obj);
- // Provoke code to get a stacktrace.
- obj.getBoolean(JsonConstCtl.success);
- // ----
- // The assertion we really wanted to check.
- // Check task success
- Assert.assertTrue("Expected task to be marked as successful", task.getAsObject().getBoolean(JsonConstCtl.success));
- } finally {
- deleteDataset(testDB);
- }
- }
-
- @Test public void compact_02() {
- HttpTest.expect400(()->{
- JsonValue v = httpPostRtnJSON(ServerCtl.urlRoot() + "$/" + opCompact + "/noSuchDataset");
- });
- }
-
- private void assumeNotWindows() {
- if (SystemUtils.IS_OS_WINDOWS)
- throw new AssumptionViolatedException("Test may be unstable on Windows due to inability to delete memory-mapped files");
- }
-
- @Test public void stats_1() {
- JsonValue v = execGetJSON(ServerCtl.urlRoot()+"$/"+opStats);
- checkJsonStatsAll(v);
- }
-
- @Test public void stats_2() {
- addTestDataset();
- JsonValue v = execGetJSON(ServerCtl.urlRoot()+"$/"+opStats+ServerCtl.datasetPath());
- checkJsonStatsAll(v);
- deleteDataset(dsTest);
- }
-
- @Test public void stats_3() {
- addTestDataset();
- HttpTest.expect404(()-> execGetJSON(ServerCtl.urlRoot()+"$/"+opStats+"/DoesNotExist"));
- deleteDataset(dsTest);
- }
-
- @Test public void stats_4() {
- JsonValue v = execPostJSON(ServerCtl.urlRoot()+"$/"+opStats);
- checkJsonStatsAll(v);
- }
-
- @Test public void stats_5() {
- addTestDataset();
- JsonValue v = execPostJSON(ServerCtl.urlRoot()+"$/"+opStats+ServerCtl.datasetPath());
- checkJsonStatsAll(v);
- deleteDataset(dsTest);
- }
-
- // Async task testing
-
- private void assertEqualsIgnoreCase(String contenttypejson, String contentType) {}
-
- private static JsonValue getTask(String taskId) {
- String url = ServerCtl.urlRoot()+"$/tasks/"+taskId;
- return httpGetJson(url);
- }
-
- private static JsonValue getDatasetDescription(String dsName) {
- if ( dsName.startsWith("/") )
- dsName = dsName.substring(1);
- try (TypedInputStream in = httpGet(ServerCtl.urlRoot() + "$/" + opDatasets + "/" + dsName)) {
- assertEqualsContentType(WebContent.contentTypeJSON, in.getContentType());
- JsonValue v = JSON.parse(in);
- return v;
- }
- }
-
- // -- Add
-
- private static void addTestDataset() {
- addTestDataset(fileBase+"config-ds-plain-1.ttl");
- }
-
- private static void addTestDatasetInf() {
- addTestDataset(fileBase+"config-ds-inf.ttl");
- }
-
- private static void addTestDatasetTDB2(String DBname) {
- Objects.nonNull(DBname);
- if ( DBname.equals(dsTestTdb2a) ) {
- addTestDataset(fileBase+"config-tdb2a.ttl");
- return;
- }
- if ( DBname.equals(dsTestTdb2b) ) {
- addTestDataset(fileBase+"config-tdb2b.ttl");
- return;
- }
- throw new IllegalArgumentException("No configuration for "+DBname);
- }
-
- private static void addTestDataset(String filename) {
- withFileEnabled(()->{
- addTestDatasetPerform(filename);
- });
- }
-
- private static void addTestDatasetPerform(String filename) {
- try {
- Path f = Path.of(filename);
- BodyPublisher body = BodyPublishers.ofFile(f);
- String ct = WebContent.contentTypeTurtle;
- httpPost(ServerCtl.urlRoot()+"$/"+opDatasets, ct, body);
- } catch (FileNotFoundException e) {
- IO.exception(e);
- }
- }
-
- private static void deleteDataset(String name) {
- httpDelete(ServerCtl.urlRoot()+"$/"+opDatasets+"/"+name);
- }
-
- private static void checkTask(JsonValue v) {
- assertNotNull(v);
- assertTrue(v.isObject());
- //System.out.println(v);
- JsonObject obj = v.getAsObject();
- try {
- assertTrue(obj.hasKey("task"));
- assertTrue(obj.hasKey("taskId"));
- // Not present until it runs : "started"
- } catch (AssertionError ex) {
- System.out.println(obj);
- throw ex;
- }
- }
-
- private static void checkInTasks(String x) {
- String url = ServerCtl.urlRoot()+"$/tasks";
- JsonValue v = httpGetJson(url);
- assertTrue(v.isArray());
- JsonArray array = v.getAsArray();
- int found = 0;
- for ( int i = 0; i < array.size(); i++ ) {
- JsonValue jv = array.get(i);
- assertTrue(jv.isObject());
- JsonObject obj = jv.getAsObject();
- checkTask(obj);
- if ( obj.getString("taskId").equals(x) ) {
- found++;
- }
- }
- assertEquals("Occurrence of taskId count", 1, found);
- }
-
- private static List<String> runningTasks(String... x) {
- String url = ServerCtl.urlRoot()+"$/tasks";
- JsonValue v = httpGetJson(url);
- assertTrue(v.isArray());
- JsonArray array = v.getAsArray();
- List<String> running = new ArrayList<>();
- for ( int i = 0; i < array.size(); i++ ) {
- JsonValue jv = array.get(i);
- assertTrue(jv.isObject());
- JsonObject obj = jv.getAsObject();
- if ( isRunning(obj) )
- running.add(obj.getString("taskId"));
- }
- return running;
- }
-
- /**
- * Wait for tasks to all finish.
- * Algorithm: wait for {@code pause}, then start polling for upto {@code maxWaitMillis}.
- * Intervals in milliseconds.
- * @param pauseMillis
- * @param pollInterval
- * @param maxWaitMillis
- * @return
- */
- private static boolean waitForTasksToFinish(int pauseMillis, int pollInterval, int maxWaitMillis) {
- // Wait for them to finish.
- // Divide into chunks
- if ( pauseMillis > 0 )
- Lib.sleep(pauseMillis);
- long start = System.currentTimeMillis();
- long endTime = start + maxWaitMillis;
- final int intervals = maxWaitMillis/pollInterval;
- long now = start;
- for (int i = 0 ; i < intervals ; i++ ) {
- // May have waited (much) longer than the pollInterval : heavily loaded build systems.
- if ( now-start > maxWaitMillis )
- break;
- List<String> x = runningTasks();
- if ( x.isEmpty() )
- return true;
- Lib.sleep(pollInterval);
- now = System.currentTimeMillis();
- }
- return false;
- }
-
- private static boolean isRunning(JsonObject taskObj) {
- checkTask(taskObj);
- return taskObj.hasKey("started") && ! taskObj.hasKey("finished");
- }
-
- private static void askPing(String name) {
- if ( name.startsWith("/") )
- name = name.substring(1);
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+name+"/sparql?query=ASK%7B%7D") ) {
- IO.skipToEnd(in);
- }
- }
-
- private static void adminPing(String name) {
- try ( TypedInputStream in = httpGet(ServerCtl.urlRoot()+"$/"+opDatasets+"/"+name) ) {
- IO.skipToEnd(in);
- }
- }
-
- private static void checkExists(String name) {
- adminPing(name);
- askPing(name);
- }
-
- private static void checkNotThere(String name) {
- String n = (name.startsWith("/")) ? name.substring(1) : name;
- // Check gone exists.
- HttpTest.expect404(()-> adminPing(n) );
- HttpTest.expect404(() -> askPing(n) );
- }
-
- private static void checkJsonDatasetsAll(JsonValue v) {
- assertNotNull(v.getAsObject().get("datasets"));
- JsonArray a = v.getAsObject().get("datasets").getAsArray();
- for ( JsonValue v2 : a )
- checkJsonDatasetsOne(v2);
- }
-
- private static void checkJsonDatasetsOne(JsonValue v) {
- assertTrue(v.isObject());
- JsonObject obj = v.getAsObject();
- assertNotNull(obj.get("ds.name"));
- assertNotNull(obj.get("ds.services"));
- assertNotNull(obj.get("ds.state"));
- assertTrue(obj.get("ds.services").isArray());
- }
-
- private static void checkJsonStatsAll(JsonValue v) {
- assertNotNull(v.getAsObject().get("datasets"));
- JsonObject a = v.getAsObject().get("datasets").getAsObject();
- for ( String dsname : a.keys() ) {
- JsonValue obj = a.get(dsname).getAsObject();
- checkJsonStatsOne(obj);
- }
- }
-
- private static void checkJsonStatsOne(JsonValue v) {
- checkJsonStatsCounters(v);
- JsonObject obj1 = v.getAsObject().get("endpoints").getAsObject();
- for ( String srvName : obj1.keys() ) {
- JsonObject obj2 = obj1.get(srvName).getAsObject();
- assertTrue(obj2.hasKey("description"));
- assertTrue(obj2.hasKey("operation"));
- checkJsonStatsCounters(obj2);
- }
- }
-
- private static void checkJsonStatsCounters(JsonValue v) {
- JsonObject obj = v.getAsObject();
- assertTrue(obj.hasKey("Requests"));
- assertTrue(obj.hasKey("RequestsGood"));
- assertTrue(obj.hasKey("RequestsBad"));
- }
-
- private static JsonValue execGetJSON(String url) {
- try ( TypedInputStream in = httpGet(url) ) {
- assertEqualsContentType(WebContent.contentTypeJSON, in.getContentType());
- return JSON.parse(in);
- }
- }
-
- private static JsonValue execPostJSON(String url) {
- try ( TypedInputStream in = httpPostStream(url, null, null, null) ) {
- assertEqualsContentType(WebContent.contentTypeJSON, in.getContentType());
- return JSON.parse(in);
- }
- }
-
- static int count(RDFConnection conn) {
- try ( QueryExecution qExec = conn.query("SELECT (count(*) AS ?C) { ?s ?p ?o }")) {
- return qExec.execSelect().next().getLiteral("C").getInt();
- }
- }
-
- /** Expect two strings to be non-null and be {@link String#equalsIgnoreCase} */
- protected static void assertEqualsContentType(String expected, String actual) {
- if ( expected == null && actual == null )
- return;
- if ( expected == null || actual == null )
- fail("Expected: "+expected+" Got: "+actual);
- if ( ! expected.equalsIgnoreCase(actual) )
- fail("Expected: "+expected+" Got: "+actual);
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAddDeleteDatasetTemplate.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAddDeleteDatasetTemplate.java
deleted file mode 100644
index ae37944880..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAdminAddDeleteDatasetTemplate.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.fuseki.mgt.ServerMgtConst.opDatasets;
-import static org.apache.jena.http.HttpOp.httpPost;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.EOFException;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.http.HttpRequest.BodyPublisher;
-import java.net.http.HttpRequest.BodyPublishers;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.concurrent.TimeUnit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.jena.atlas.io.IO;
-import org.apache.jena.atlas.logging.LogCtl;
-import org.apache.jena.atlas.web.HttpException;
-import org.apache.jena.atlas.web.TypedInputStream;
-import org.apache.jena.base.Sys;
-import org.apache.jena.fuseki.webapp.FusekiWebapp;
-import org.apache.jena.http.HttpOp;
-import org.apache.jena.query.QueryExecution;
-import org.apache.jena.rdfconnection.RDFConnection;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.sparql.exec.http.Params;
-import org.apache.jena.web.HttpSC;
-import org.apache.jena.web.HttpSC.Code;
-import org.awaitility.Awaitility;
-
-/** Tests of the admin functionality */
-public class TestWebappAdminAddDeleteDatasetTemplate extends AbstractFusekiWebappTest {
-
- // Name of the dataset in the assembler file.
- static String dsTest = "test-ds1";
- static String dsTestInf = "test-ds4";
-
- // There are two Fuseki-TDB2 tests: add_delete_dataset_6() and compact_01().
- //
- // On certain build systems (GH action/Linux under load, ASF Jenkins sometimes),
- // add_delete_dataset_6 fails (transactions active), or compact_01 (gets a 404),
- // if the two databases are the same.
- static String dsTestTdb2a = "test-tdb2a";
- static String dsTestTdb2b = "test-tdb2b";
- static String fileBase = "testing/";
-
- @Before public void setLogging() {
- LogCtl.setLevel(Fuseki.backupLogName, "ERROR");
- LogCtl.setLevel(Fuseki.compactLogName,"ERROR");
- LogCtl.setLevel(Fuseki.adminLogName,"ERROR");
- Awaitility.setDefaultPollDelay(20,TimeUnit.MILLISECONDS);
- Awaitility.setDefaultPollInterval(50,TimeUnit.MILLISECONDS);
- }
-
- @After public void unsetLogging() {
- LogCtl.setLevel(Fuseki.backupLogName, "WARN");
- LogCtl.setLevel(Fuseki.compactLogName,"WARN");
- LogCtl.setLevel(Fuseki.adminLogName,"WARN");
- }
-
- @Test public void add_dataset_01() {
- testAddDataset("db_1");
- }
-
- @Test public void add_dataset_02() {
- testAddDataset( "/db_2");
- }
-
- // Do as a file - which is blocked.
- @Test public void add_dataset_99() {
- expect400(()->addTestDataset(fileBase+"config-ds-plain-1.ttl"));
- }
-
- private static void addTestDataset(String filename) {
- try {
- Path f = Path.of(filename);
- BodyPublisher body = BodyPublishers.ofFile(f);
- String ct = WebContent.contentTypeTurtle;
- httpPost(ServerCtl.urlRoot()+"$/"+opDatasets, ct, body);
- } catch (FileNotFoundException e) {
- IO.exception(e);
- }
- }
-
- @Test public void add_dataset_bad_02() {
- badAddDataserverRequest("bad_2 illegal");
- }
-
- @Test public void add_dataset_bad_03() {
- badAddDataserverRequest("bad_3/path");
- }
-
- @Test public void add_dataset_bad_04() {
- badAddDataserverRequest("");
- }
-
- @Test public void add_dataset_bad_05() {
- badAddDataserverRequest(" ");
- }
-
- @Test public void add_dataset_bad_06() {
- badAddDataserverRequest("bad_6_AB CD");
- }
-
- @Test public void add_dataset_bad_07() {
- badAddDataserverRequest("..");
- }
-
- @Test public void add_dataset_bad_08() {
- badAddDataserverRequest("/..");
- }
-
- @Test public void add_dataset_bad_09() {
- badAddDataserverRequest("/../elsewhere");
- }
-
- @Test public void add_dataset_bad_10() {
- badAddDataserverRequest("//bad_10");
- }
-
- // add-delete
-
- @Test public void add_delete_mem_1() {
- testAddDeleteAdd("db_add_delete_1", "mem", false, false);
- }
-
- @Test public void add_delete_tdb_1() {
- if ( Sys.isWindows )
- return;
- testAddDeleteAdd("db_add_delete_tdb_1", "tdb2", false, true);
- }
-
- @Test public void add_delete_tdb_2() {
- if ( Sys.isWindows )
- return;
- String dbName = "db_add_delete_tdb_2";
- testAddDeleteAdd(dbName, "tdb2", false, true);
- }
-
- // Attempt to add a in-memory dataset. Used to test the name checking.
- private void testAddDataset(String dbName) {
- Params params = Params.create().add("dbName", dbName).add("dbType", "mem");
- // Use the template
- String actionURL = ServerCtl.urlRoot()+"$/datasets";
- HttpOp.httpPostForm(actionURL, params);
- String datasetURL = dbName.startsWith("/")
- ? ServerCtl.urlRoot()+(dbName.substring(1))
- : ServerCtl.urlRoot()+dbName;
- assertTrue(exists(datasetURL));
- }
-
- private void testAddDeleteAdd(String dbName, String dbType, boolean alreadyExists, boolean hasFiles) {
- String datasetURL = ServerCtl.urlRoot()+dbName;
- Params params = Params.create().add("dbName", dbName).add("dbType", dbType);
-
- if ( alreadyExists )
- assertTrue(exists(datasetURL));
- else
- assertFalse(exists(datasetURL));
-
- // Use the template
- HttpOp.httpPostForm(ServerCtl.urlRoot()+"$/datasets", params);
-
- RDFConnection conn = RDFConnection.connect(ServerCtl.urlRoot()+dbName);
- conn.update("INSERT DATA { <x:s> <x:p> 123 }");
- int x1 = count(conn);
- assertEquals(1, x1);
-
- Path pathDB = FusekiWebapp.dirDatabases.resolve(dbName);
-
- if ( hasFiles )
- assertTrue(Files.exists(pathDB));
-
- HttpOp.httpDelete(ServerCtl.urlRoot()+"$/datasets/"+dbName);
-
- assertFalse(exists(datasetURL));
-
- //if ( hasFiles )
- assertFalse(Files.exists(pathDB));
-
- // Recreate : no contents.
- HttpOp.httpPostForm(ServerCtl.urlRoot()+"$/datasets", params);
- assertTrue(exists(datasetURL));
- int x2 = count(conn);
- assertEquals(0, x2);
- if ( hasFiles )
- assertTrue(Files.exists(pathDB));
- }
-
- private void badAddDataserverRequest(String dbName) {
- Runnable r = protect(()->testAddDataset(dbName));
- expect400(r);
- }
-
- private static Runnable protect(Runnable action) {
- return ()-> {
- try {
- action.run();
- } catch (HttpException ex) {
- if ( ex.getCause() instanceof IOException ) {
- if ( ex.getCause().getCause() instanceof IOException ) {
- if ( ex.getCause().getCause().getCause() instanceof EOFException ) {
- /*
- * In github actions, this happens intermittently (unknown reason).
- * It happens more at busy times.
- * Ignore if the cause is looks like:
- * Error
- * org.apache.jena.atlas.web.HttpException: POST ....
- * Caused by: java.io.IOException: HTTP/1.1 header parser received no bytes
- * Caused by: java.io.IOException: HTTP/1.1 header parser received no bytes
- * Caused by: java.io.EOFException: EOF reached while reading
- */
- throw new HttpException(400, "Dummy 400");
- }
- }
- }
- throw ex;
- }
- };
- }
-
- private static boolean exists(String url) {
- try ( TypedInputStream in = HttpOp.httpGet(url) ) {
- return true;
- } catch (HttpException ex) {
- if ( ex.getStatusCode() == HttpSC.NOT_FOUND_404 )
- return false;
- throw ex;
- }
- }
-
- static int count(RDFConnection conn) {
- try ( QueryExecution qExec = conn.query("SELECT (count(*) AS ?C) { ?s ?p ?o }")) {
- return qExec.execSelect().next().getLiteral("C").getInt();
- }
- }
-
- // -- From fusekiTestLib
-
- public static void expect400(Runnable runnable) {
- expectFail(runnable, HttpSC.Code.BAD_REQUEST);
- }
-
- public static void expect401(Runnable runnable) {
- expectFail(runnable, HttpSC.Code.UNAUTHORIZED);
- }
-
- public static void expect403(Runnable runnable) {
- expectFail(runnable, HttpSC.Code.FORBIDDEN);
- }
-
- public static void expect404(Runnable runnable) {
- expectFail(runnable, HttpSC.Code.NOT_FOUND);
- }
-
- public static void expect409(Runnable runnable) {
- expectFail(runnable, HttpSC.Code.CONFLICT);
- }
-
- public static void expectFail(Runnable runnable, Code code) {
- if ( code == null || ( 200 <= code.getCode() && code.getCode() < 300 ) ) {
- runnable.run();
- return;
- }
- try {
- runnable.run();
- fail("Failed: Got no exception: Expected HttpException "+code.getCode());
- } catch (HttpException ex) {
- if ( ex.getStatusCode() == code.getCode() )
- return;
- throw ex;
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAuthQuery_JDK.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAuthQuery_JDK.java
deleted file mode 100644
index f504e5afed..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAuthQuery_JDK.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import java.net.URI;
-
-import org.apache.jena.fuseki.test.HttpTest;
-import org.apache.jena.http.auth.AuthEnv;
-import org.apache.jena.sparql.exec.http.QueryExecutionHTTP;
-import org.junit.Assert;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestWebappAuthQuery_JDK extends AbstractTestWebappAuth_JDK {
- @Test
- public void query_auth_jdk_01_no_auth() {
- QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(authServiceQuery()).query("ASK { }").build();
- // No auth credentials should result in an error
- HttpTest.expectQuery401(()->qe.execAsk());
- }
-
- @Test
- public void query_auth_jdk_02_bad_auth() {
- // Auth - bad password
- QueryExecutionHTTP qe = withAuthJDK(QueryExecutionHTTP.create().endpoint(authServiceQuery()).query("ASK { }"),
- "allowed", "incorrect");
- HttpTest.expectQuery401(()->qe.execAsk());
- }
-
- @Test
- public void query_auth_jdk_03_good_auth() {
- // Auth credentials for valid user with correct password
- QueryExecutionHTTP qe = withAuthJDK(QueryExecutionHTTP.create().endpoint(authServiceQuery()).query("ASK { }"),
- "allowed", "password");
- Assert.assertTrue(qe.execAsk());
- }
-
- @Test
- public void query_authenv_01_good() {
- // Auth credentials for valid user with correct password
- QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(authServiceQuery()).query("ASK { }").build();
- String dsURL = authServiceQuery();
- URI uri = URI.create(dsURL);
- AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
- try {
- Assert.assertTrue(qe.execAsk());
- } finally {
- AuthEnv.get().unregisterUsernamePassword(uri);
- }
- }
-
- @Test
- public void query_authenv_02_prefix_good() {
- QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(authServiceQuery()).query("ASK { }").build();
- String dsURL = "http://localhost:"+authPort+authDatasetPath();
- URI uri = URI.create(dsURL);
- AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
- try {
- Assert.assertTrue(qe.execAsk());
- } finally {
- AuthEnv.get().unregisterUsernamePassword(uri);
- }
- }
-
- @Test
- public void query_authenv_03_bad_endpoint() {
- QueryExecutionHTTP qe = QueryExecutionHTTP.create().endpoint(authServiceQuery()).query("ASK { }").build();
- // Wrong registration
- String dsURL = "http://localhost:"+authPort+"/anotherPlace";
- URI uri = URI.create(dsURL);
- AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
- try {
- HttpTest.expectQuery401(()->qe.execAsk());
- } finally {
- AuthEnv.get().unregisterUsernamePassword(uri);
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAuthUpdate_JDK.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAuthUpdate_JDK.java
deleted file mode 100644
index 93f897d273..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappAuthUpdate_JDK.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import java.net.URI;
-
-import org.apache.jena.fuseki.test.HttpTest;
-import org.apache.jena.http.auth.AuthEnv;
-import org.apache.jena.sparql.exec.http.UpdateExecutionHTTP;
-import org.apache.jena.update.UpdateFactory;
-import org.apache.jena.update.UpdateProcessor;
-import org.apache.jena.update.UpdateRequest;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runners.MethodSorters;
-
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestWebappAuthUpdate_JDK extends AbstractTestWebappAuth_JDK {
- @Test
- public void update_jdk_auth_01() {
- UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
- UpdateProcessor ue = UpdateExecutionHTTP.create()
- .endpoint(authServiceUpdate())
- .update(updates)
- .build();
- // No auth credentials should result in an error
- HttpTest.expect401(()->ue.execute());
- }
-
- @Test
- public void update_jdk_auth_02() {
- UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
- UpdateProcessor ue = withAuthJDK(UpdateExecutionHTTP.create()
- .endpoint(authServiceUpdate())
- .update(updates),
- "allowed", "bad-password");
- HttpTest.expect401(()->ue.execute());
- }
-
- @Test
- public void update_jdk_auth_03() {
- UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
- UpdateProcessor ue = withAuthJDK(UpdateExecutionHTTP.create()
- .endpoint(authServiceUpdate())
- .update(updates),
- "allowed", "password");
- ue.execute();
- }
-
- @Test
- public void update_with_auth_04() {
- UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
- UpdateProcessor ue = withAuthJDK(UpdateExecutionHTTP.create()
- .endpoint(authServiceUpdate())
- .update(updates),
- "allowed", "password");
- ue.execute();
- }
-
- @Test
- public void update_authenv_01_good() {
- // Auth credentials for valid user with correct password
- UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
- UpdateProcessor ue = UpdateExecutionHTTP.create().endpoint(authServiceUpdate()).update(updates).build();
- String dsURL = authServiceUpdate();
- URI uri = URI.create(dsURL);
- AuthEnv.get().registerUsernamePassword(uri, "allowed", "password");
- try {
- ue.execute();
- } finally {
- AuthEnv.get().unregisterUsernamePassword(uri);
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappFileUpload.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappFileUpload.java
deleted file mode 100644
index 338ae1aad4..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappFileUpload.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.atlas.web.TypedInputStream;
-import org.apache.jena.graph.Graph;
-import org.apache.jena.http.HttpOp;
-import org.apache.jena.http.HttpRDF;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFDataMgr;
-import org.apache.jena.riot.system.StreamRDF;
-import org.apache.jena.riot.system.StreamRDFLib;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.exec.http.DSP;
-import org.apache.jena.sparql.exec.http.GSP;
-import org.apache.jena.sparql.graph.GraphFactory;
-import org.junit.Test;
-
-/**
- * Tests for multi-part file upload.
- */
-public class TestWebappFileUpload extends AbstractFusekiWebappTest {
-
- @Test
- public void upload_gsp_01() {
- FileSender x = new FileSender(ServerCtl.serviceGSP() + "?default");
- x.add("D.ttl", "<http://example/s> <http://example/p> <http://example/o> .", "text/turtle");
- x.send("POST");
-
- // Ways to get the content, from highest to lowest level APIs.
-
- Graph graph1 = GSP.service(ServerCtl.serviceGSP()).acceptHeader("text/turtle").defaultGraph().GET();
- assertEquals(1, graph1.size());
-
- Graph graph2 = HttpRDF.httpGetGraph(ServerCtl.serviceGSP(), "text/turtle");
- assertEquals(1, graph2.size());
-
- Graph graph3 = GraphFactory.createDefaultGraph();
- StreamRDF stream = StreamRDFLib.graph(graph3);
- HttpRDF.httpGetToStream(ServerCtl.serviceGSP(), "text/turtle", stream);
-
- Graph graph4 = GraphFactory.createDefaultGraph();
- TypedInputStream in = HttpOp.httpGet(ServerCtl.serviceGSP(), "text/turtle");
- RDFDataMgr.read(graph4, in, Lang.TTL);
-
- assertEquals(1, graph4.size());
- }
-
- @Test
- public void upload_gsp_02() {
- FileSender x = new FileSender(ServerCtl.serviceGSP() + "?default");
- x.add("D.ttl", "<http://example/s> <http://example/p> 123 .", "text/turtle");
- x.add("D.nt", "<http://example/s> <http://example/p> <http://example/o-456> .", "application/n-triples");
- x.send("PUT");
-
- Graph graph = GSP.service(ServerCtl.serviceGSP()).defaultGraph().GET();
- assertEquals(2, graph.size());
- }
-
- // Extension of GSP - no graph selector => dataset
- @Test
- public void upload_gsp_03() {
- FileSender x = new FileSender(ServerCtl.serviceGSP());
- x.add("D.ttl", "<http://example/s> <http://example/p> <http://example/o> .", "text/turtle");
- x.add("D.trig", "<http://example/g> { <http://example/s> <http://example/p> 123,456 }", "text/trig");
- x.send("POST");
-
- DatasetGraph dsg = DSP.service(ServerCtl.serviceGSP()).GET();
- long c = Iter.count(dsg.find());
- assertEquals(3, c);
- }
-
- @Test
- public void upload_gsp_04() {
- FileSender x = new FileSender(ServerCtl.urlDataset());
- x.add("D.ttl", "<http://example/s> <http://example/p> <http://example/o> .", "text/plain");
- x.add("D.trig", "<http://example/g> { <http://example/s> <http://example/p> 123,456 }", "text/plain");
- x.send("POST");
-
- DatasetGraph dsg = DSP.service(ServerCtl.serviceGSP()).GET();
- assertEquals(1, dsg.getDefaultGraph().size());
- assertEquals(2, dsg.getUnionGraph().size());
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappMetrics.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappMetrics.java
deleted file mode 100644
index fa04212fb4..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappMetrics.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.http.HttpLib.handleResponseRtnString;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.net.http.HttpRequest;
-import java.net.http.HttpResponse;
-import java.net.http.HttpResponse.BodyHandlers;
-
-import org.apache.jena.http.HttpEnv;
-import org.apache.jena.http.HttpLib;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.riot.web.HttpNames;
-import org.junit.Test;
-
-public class TestWebappMetrics extends AbstractFusekiWebappTest {
-
- @Test
- public void can_retrieve_metrics() {
- String r = ServerCtl.urlRoot() + "$/metrics";
- HttpRequest request = HttpRequest.newBuilder().uri(HttpLib.toRequestURI(r)).build();
- HttpResponse<InputStream> response = HttpLib.executeJDK(HttpEnv.getDftHttpClient(), request, BodyHandlers.ofInputStream());
- String body = handleResponseRtnString(response);
-
- String ct = response.headers().firstValue(HttpNames.hContentType).orElse(null);
- assertTrue(ct.contains(WebContent.contentTypeTextPlain));
- assertTrue(ct.contains(WebContent.charsetUTF8));
- assertTrue(body.contains("fuseki_requests_good"));
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappSPARQLProtocol.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappSPARQLProtocol.java
deleted file mode 100644
index b21df62451..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappSPARQLProtocol.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.fuseki.ServerCtl.serviceGSP;
-import static org.apache.jena.fuseki.ServerCtl.serviceQuery;
-import static org.apache.jena.fuseki.ServerCtl.serviceUpdate;
-import static org.apache.jena.fuseki.ServerTest.gn1;
-import static org.apache.jena.fuseki.ServerTest.graph1;
-import static org.apache.jena.fuseki.ServerTest.graph2;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.jena.query.*;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.sparql.exec.http.GSP;
-import org.apache.jena.sparql.exec.http.QueryExecutionHTTP;
-import org.apache.jena.sparql.exec.http.UpdateSendMode;
-import org.apache.jena.sparql.util.Convert;
-import org.apache.jena.update.*;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestWebappSPARQLProtocol extends AbstractFusekiWebappTest
-{
- @Before
- public void before() {
- GSP.service(serviceGSP()).defaultGraph().PUT(graph1);
- GSP.service(serviceGSP()).graphName(gn1).PUT(graph2);
- }
-
- static String query(String base, String queryString) {
- return base + "?query=" + Convert.encWWWForm(queryString);
- }
-
- @Test
- public void query_01() {
- Query query = QueryFactory.create("SELECT * { ?s ?p ?o }");
- try ( QueryExecution qexec = QueryExecution.service(serviceQuery(), query) ) {
- ResultSet rs = qexec.execSelect();
- int x = ResultSetFormatter.consume(rs);
- assertTrue(x != 0);
- }
- }
-
- @Test
- public void query_02() {
- Query query = QueryFactory.create("SELECT * { ?s ?p ?o }");
- QueryExecution qExec = QueryExecutionHTTP.create()
- .endpoint(serviceQuery())
- .query(query)
- .acceptHeader(WebContent.contentTypeResultsJSON)
- .build();
- ResultSet rs = qExec.execSelect();
- int x = ResultSetFormatter.consume(rs);
- assertTrue(x != 0);
- }
-
- @Test
- public void update_01() {
- UpdateExecution.service(serviceUpdate()).update("INSERT DATA {}").execute();
- }
-
- @Test
- public void update_02() {
- UpdateExecution.service(serviceUpdate()).update("INSERT DATA {}").sendMode(UpdateSendMode.asPostForm).execute();
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappServerReadOnly.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappServerReadOnly.java
deleted file mode 100644
index 6a56814c38..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/TestWebappServerReadOnly.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki;
-
-import static org.apache.jena.fuseki.ServerCtl.serviceQuery;
-import static org.apache.jena.fuseki.ServerCtl.serviceUpdate;
-
-import java.net.http.HttpRequest.BodyPublisher;
-import java.net.http.HttpRequest.BodyPublishers;
-
-import org.apache.jena.atlas.web.TypedInputStream;
-import org.apache.jena.fuseki.test.FusekiTest;
-import org.apache.jena.fuseki.test.HttpTest;
-import org.apache.jena.http.HttpOp;
-import org.apache.jena.query.Query;
-import org.apache.jena.query.QueryFactory;
-import org.apache.jena.sparql.exec.http.QueryExecutionHTTP;
-import org.apache.jena.update.UpdateExecution;
-import org.apache.jena.web.HttpSC;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/** Tests on a read only server. */
-public class TestWebappServerReadOnly
-{
- // readonly server.
- @BeforeClass
- public static void allocServerForSuite() {
- ServerCtl.freeServer();
- ServerCtl.setupServer(false);
- }
-
- @AfterClass
- public static void freeServerForSuite() {
- ServerCtl.freeServer();
- }
-
- @Test
- public void query_readonly() {
- Query query = QueryFactory.create("ASK{}");
- QueryExecutionHTTP.service(serviceQuery(), query).execAsk();
- }
-
- @Test()
- public void update_readonly() {
- HttpTest.expect405( () -> {
- // There is no dispatch and it gets passed to the web container.
- // Theee is no POSTS handler - there is for for GET (static resources).
- UpdateExecution.service(serviceUpdate()).update("INSERT DATA {}").execute();
- });
- }
-
- @Test
- public void gsp_w_readonly_POST() {
- // Try to write
- HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, ()->{
- BodyPublisher bodyPublisher = BodyPublishers.ofString("");
- HttpOp.httpPost(ServerCtl.serviceGSP()+"?default", null, bodyPublisher);
- });
- }
-
- @Test
- public void gsp_w_readonly_PUT() {
- // Try to write
- HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, ()->{
- BodyPublisher bodyPublisher = BodyPublishers.ofString("");
- HttpOp.httpPut(ServerCtl.serviceGSP()+"?default", null, bodyPublisher);
- });
- }
-
- @Test
- public void gsp_w_readonly_DELETE() {
- // Try to write
- HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, ()->{
- HttpOp.httpDelete(ServerCtl.serviceGSP()+"?default");
- });
- }
-
- @Test
- public void dataset_readonly_GET() {
- // Try to read
- try ( TypedInputStream in = HttpOp.httpGet(ServerCtl.urlDataset()) ) {}
- }
-
-
- @Test
- public void dataset_w_readonly_POST() {
- // Try to write
- HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, ()->{
- BodyPublisher bodyPublisher = BodyPublishers.ofString("");
- HttpOp.httpPost(ServerCtl.urlDataset(), null, bodyPublisher);
- });
- }
-
- @Test
- public void dataset_w_readonly_PUT() {
- // Try to write
- HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, ()->{
- BodyPublisher bodyPublisher = BodyPublishers.ofString("");
- HttpOp.httpPut(ServerCtl.urlDataset(), null, bodyPublisher);
- });
- }
-
- @Test
- public void dataset_w_readonly_DELETE() {
- // Try to write
- HttpTest.execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, ()->{
- HttpOp.httpDelete(ServerCtl.urlDataset());
- });
- }
-
- @Test
- public void options_gsp_readonly() {
- String v = HttpOp.httpOptions(ServerCtl.serviceGSP()+"?default");
- FusekiTest.assertStringList(v, "GET", "OPTIONS", "HEAD");
- }
-
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/test/FusekiTest.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/test/FusekiTest.java
deleted file mode 100644
index 7d26a5e7fc..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/test/FusekiTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.test;
-
-import java.util.Objects;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-public class FusekiTest {
-
- /** Check whether str is a comma separated list of expected (unordered) */
- public static void assertStringList(String str, String... expected) {
- str = str.replace(" ", "");
- String[] x = str.split(",");
- for ( String ex : expected ) {
- assertTrue(containsStr(ex, x), "Got: "+str+" - Does not contain "+ex);
- }
- for ( String s : x ) {
- assertTrue(containsStr(s, expected), "Got: "+str+" - Not expected "+s);
- }
- }
-
- /** Is v in the list of strings? */
- public static boolean containsStr(String v, String[] strings) {
- for ( String s: strings ) {
- if ( Objects.equals(v, s))
- return true;
- }
- return false;
- }
-}
-
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/test/HttpTest.java b/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/test/HttpTest.java
deleted file mode 100644
index 3ea177a721..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/java/org/apache/jena/fuseki/test/HttpTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.fuseki.test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.fail;
-
-import org.apache.jena.atlas.web.HttpException;
-import org.apache.jena.sparql.engine.http.QueryExceptionHTTP;
-import org.apache.jena.web.HttpSC;
-
-public class HttpTest {
-
- public static void expect4xx(Runnable action) {
- try {
- action.run();
- fail("Expected HttpException");
- } catch (QueryExceptionHTTP ex) {
- if ( ex.getStatusCode() < 400 || ex.getStatusCode() > 499 )
- fail(ex.getMessage());
- } catch (HttpException ex) {
- // -1 : any status code in HttpException
- if ( ex.getStatusCode() < 400 || ex.getStatusCode() > 499 )
- fail(ex.getMessage());
- }
- }
-
- public static void expect400(Runnable action) {
- execWithHttpException(HttpSC.BAD_REQUEST_400, action);
- }
-
- public static void expect401(Runnable action) {
- execWithHttpException(HttpSC.UNAUTHORIZED_401, action);
- }
-
- public static void expect403(Runnable action) {
- execWithHttpException(HttpSC.FORBIDDEN_403, action);
- }
-
- public static void expect404(Runnable action) {
- execWithHttpException(HttpSC.NOT_FOUND_404, action);
- }
-
- public static void expect405(Runnable action) {
- execWithHttpException(HttpSC.METHOD_NOT_ALLOWED_405, action);
- }
-
- // 406 : "Accept:" failure
- public static void expect406(Runnable action) {
- execWithHttpException(HttpSC.NOT_ACCEPTABLE_406, action);
- }
-
- // 415 : Can not receive Content-Type
- public static void expect415(Runnable action) {
- execWithHttpException(HttpSC.UNSUPPORTED_MEDIA_TYPE_415, action);
- }
-
- public static void execWithHttpException(int expectedStatusCode, Runnable action) {
- try {
- action.run();
- fail("Expected HttpException "+expectedStatusCode);
- } catch (QueryExceptionHTTP ex) {
- if ( expectedStatusCode > 0 )
- assertEquals(expectedStatusCode, ex.getStatusCode(), ex.getMessage()+" ::");
- } catch (HttpException ex) {
- if ( expectedStatusCode > 0 )
- assertEquals(expectedStatusCode, ex.getStatusCode(), ex.getMessage()+" ::");
- }
- }
-
- public static void expectQuery403(Runnable action) {
- expectQuery(action, HttpSC.FORBIDDEN_403);
- }
-
- public static void expectQuery401(Runnable action) {
- expectQuery(action, HttpSC.UNAUTHORIZED_401);
- }
-
- public static void expectQuery(Runnable action, int expected) {
- try {
- action.run();
- throw new HttpException("Expected QueryExceptionHTTP["+expected+"]");
- } catch (QueryExceptionHTTP ex) {
- if ( ex.getStatusCode() != expected )
- throw ex;
- }
- }
-}
diff --git a/jena-fuseki2/jena-fuseki-webapp/src/test/resources/log4j2-test.properties b/jena-fuseki2/jena-fuseki-webapp/src/test/resources/log4j2-test.properties
deleted file mode 100644
index 9b915f0a7f..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/src/test/resources/log4j2-test.properties
+++ /dev/null
@@ -1,66 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-status = error
-name = PropertiesConfig
-filters = threshold
-
-filter.threshold.type = ThresholdFilter
-filter.threshold.level = ALL
-
-appender.console.type = Console
-appender.console.name = OUT
-appender.console.target = SYSTEM_ERR
-appender.console.layout.type = PatternLayout
-appender.console.layout.pattern = %d{HH:mm:ss} %-5p %-10c{1} :: %m%n
-#appender.console.layout.pattern = [%d{yyyy-MM-dd HH:mm:ss}] %-5p %-10c{1} :: %m%n
-
-rootLogger.level = INFO
-rootLogger.appenderRef.stdout.ref = OUT
-
-logger.jena.name = org.apache.jena
-logger.jena.level = INFO
-
-logger.arq-exec.name = org.apache.jena.arq.exec
-logger.arq-exec.level = INFO
-
-logger.riot.name = org.apache.jena.riot
-logger.riot.level = INFO
-
-# All logs : .Request, .Fuseki, .Server
-logger.fuseki.name = org.apache.jena.fuseki
-logger.fuseki.level = INFO
-
-logger.fuseki-request.name = org.apache.jena.fuseki.Request
-logger.fuseki-request.level = WARN
-
-logger.fuseki-fuseki.name = org.apache.jena.fuseki.Fuseki
-logger.fuseki-fuseki.level = WARN
-
-logger.fuseki-server.name = org.apache.jena.fuseki.Server
-logger.fuseki-server.level = WARN
-
-logger.fuseki-admin.name = org.apache.jena.fuseki.Admin
-logger.fuseki-admin.level = WARN
-
-logger.fuseki-config.name = org.apache.jena.fuseki.Config
-logger.fuseki-config.level = WARN
-
-logger.jetty.name = org.eclipse.jetty
-logger.jetty.level = WARN
-
-logger.shiro.name = org.apache.shiro
-logger.shiro.level = WARN
-
-# Hide issue with Shiro 1.5.0+, 2.0.0
-logger.shiro-realm.name = org.apache.shiro.realm.text.IniRealm
-logger.shiro-realm.level = ERROR
-
-# This goes out in NCSA format
-appender.plain.type = Console
-appender.plain.name = PLAIN
-appender.plain.layout.type = PatternLayout
-appender.plain.layout.pattern = %m%n
-
-logger.request-log.name = org.apache.jena.fuseki.Request
-logger.request-log.additivity = false
-logger.request-log.level = OFF
-logger.request-log.appenderRef.plain.ref = PLAIN
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-1.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-1.ttl
deleted file mode 100644
index 05640fd0cf..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-1.ttl
+++ /dev/null
@@ -1,15 +0,0 @@
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-<#service1> rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/ds
- fuseki:name "" ;
- fuseki:serviceQuery "sparql" ;
- fuseki:dataset <#emptyDataset> ;
- .
-
-<#emptyDataset> rdf:type ja:RDFDataset .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-2.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-2.ttl
deleted file mode 100644
index 27df06bcb4..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-2.ttl
+++ /dev/null
@@ -1,15 +0,0 @@
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-<#service1> rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/ds
- fuseki:name " " ;
- fuseki:serviceQuery "sparql" ;
- fuseki:dataset <#emptyDataset> ;
- .
-
-<#emptyDataset> rdf:type ja:RDFDataset .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-3.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-3.ttl
deleted file mode 100644
index 19caef108b..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-3.ttl
+++ /dev/null
@@ -1,15 +0,0 @@
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-<#service1> rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/ds
- fuseki:name "ABC DEF" ;
- fuseki:serviceQuery "sparql" ;
- fuseki:dataset <#emptyDataset> ;
- .
-
-<#emptyDataset> rdf:type ja:RDFDataset .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-4.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-4.ttl
deleted file mode 100644
index f57840e418..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-bad-name-4.ttl
+++ /dev/null
@@ -1,15 +0,0 @@
-@prefix : <#> .
-@prefix fuseki: <http://jena.apache.org/fuseki#> .
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
-
-<#service1> rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/ds
- fuseki:name "/ABC DEF " ;
- fuseki:serviceQuery "sparql" ;
- fuseki:dataset <#emptyDataset> ;
- .
-
-<#emptyDataset> rdf:type ja:RDFDataset .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-inf.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-inf.ttl
deleted file mode 100644
index b75cf18ce3..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-inf.ttl
+++ /dev/null
@@ -1,30 +0,0 @@
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-
-<#service2> rdf:type fuseki:Service ;
- fuseki:name "test-ds4" ;
- fuseki:serviceQuery "sparql" ;
- fuseki:dataset <#infDataset> ;
- .
-
-<#infDataset> rdf:type ja:RDFDataset ;
- ja:defaultGraph <#infGraph> ;
- .
-
-<#infGraph> a ja:InfModel;
- ja:reasoner [ja:reasonerURL <http://jena.hpl.hp.com/2003/OWLFBRuleReasoner>] ;
- ja:baseModel <#tdb_graph> ;
- .
-
-<#tdb_graph> rdf:type tdb2:GraphTDB ;
- tdb2:dataset <#tdb_dataset> ;
- .
-
-<#tdb_dataset> rdf:type tdb2:DatasetTDB ;
- tdb2:location "--mem--" ;
- .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-plain-1.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-plain-1.ttl
deleted file mode 100644
index f993f350fd..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-plain-1.ttl
+++ /dev/null
@@ -1,17 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-<#service1> #rdf:type fuseki:Service ;
- # URI of the dataset -- http://host:port/ds
- fuseki:name "test-ds1" ;
- fuseki:serviceQuery "sparql" ;
- fuseki:dataset <#emptyDataset> ;
- .
-
-<#emptyDataset> rdf:type ja:RDFDataset .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-plain-2.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-plain-2.ttl
deleted file mode 100644
index d4b3fc9022..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-ds-plain-2.ttl
+++ /dev/null
@@ -1,18 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-
-<#service1> rdf:type fuseki:Service ;
- fuseki:name "test-ds2" ;
- fuseki:endpoint [
- fuseki:operation fuseki:query ;
- fuseki:name "sparql"
- ] ;
- fuseki:dataset <#emptyDataset> ;
- .
-
-<#emptyDataset> rdf:type ja:MemoryDataset .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2a.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2a.ttl
deleted file mode 100644
index 6ad26b9835..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2a.ttl
+++ /dev/null
@@ -1,18 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-
-<#service1> rdf:type fuseki:Service ;
- fuseki:name "test-tdb2a" ;
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:dataset <#dataset> .
-
-<#dataset> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "target/tdb2a" .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2b.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2b.ttl
deleted file mode 100644
index 572927c331..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2b.ttl
+++ /dev/null
@@ -1,18 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-
-<#service1> rdf:type fuseki:Service ;
- fuseki:name "test-tdb2b" ;
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:dataset <#dataset> .
-
-<#dataset> rdf:type tdb2:DatasetTDB2 ;
- tdb2:location "target/tdb2b" .
diff --git a/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2c.ttl b/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2c.ttl
deleted file mode 100644
index d71cf281a2..0000000000
--- a/jena-fuseki2/jena-fuseki-webapp/testing/config-tdb2c.ttl
+++ /dev/null
@@ -1,19 +0,0 @@
-## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
-
-PREFIX : <#>
-PREFIX fuseki: <http://jena.apache.org/fuseki#>
-PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-
-PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
-PREFIX tdb2: <http://jena.apache.org/2016/tdb#>
-
-<#service1> rdf:type fuseki:Service ;
- fuseki:name "test-tdb2b" ;
- fuseki:endpoint [ fuseki:name "sparql" ;
- fuseki:operation fuseki:query ] ;
- fuseki:dataset <#dataset> .
-
-<#dataset> rdf:type tdb2:DatasetTDB2 ;
- # Bad.
- tdb2:location "../tdb2c" .
diff --git a/pom.xml b/pom.xml
index d7aff5dfac..1f83f76e44 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,7 +126,6 @@
<ver.plugin.compiler>3.14.1</ver.plugin.compiler>
<ver.plugin.surefire>3.5.4</ver.plugin.surefire>
<ver.plugin.javadoc>3.12.0</ver.plugin.javadoc>
- <ver.plugin.war>3.4.0</ver.plugin.war>
<ver.plugin.shade>3.6.1</ver.plugin.shade>
<ver.plugin.enforcer>3.6.2</ver.plugin.enforcer>
<ver.plugin.cyclonedx>2.9.1</ver.plugin.cyclonedx>
@@ -1095,12 +1094,6 @@
<version>${ver.plugin.shade}</version>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>${ver.plugin.war}</version>
- </plugin>
-
</plugins>
</pluginManagement>
</build>