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 2023/10/22 10:57:38 UTC

[jena] branch jena5 updated (61bf4f1b6c -> 3fb67a51f3)

This is an automated email from the ASF dual-hosted git repository.

andy pushed a change to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git


    from 61bf4f1b6c GH-2040: Remove support for custom scripts in Python
     new 41acb38a34 Fix handling filenames as base URIs
     new 250b2118bd Tidy comments and code
     new f1e2341804 GH-2033: Move StoreConnection to oaj.tdb1.sys
     new 23799d7837 GH-2020: Remove deprecated methods (Fuseki)
     new 3fb67a51f3 More control for U+FFFD (Replacement Character)

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../jena/riot/tokens/TokenizeTextBuilder.java      |  18 +--
 .../org/apache/jena/riot/tokens/TokenizerText.java |  93 ++++++++++----
 .../jena/sparql/core/DatasetGraphFactory.java      |  26 +++-
 .../apache/jena/sparql/core/DatasetGraphOne.java   |   4 +
 .../sparql/core/assembler/DatasetAssembler.java    |   2 +-
 .../sparql/engine/main/solver/StageMatchData.java  |   2 +-
 .../engine/main/solver/StageMatchTriple.java       |   2 +-
 .../org/apache/jena/sparql/graph/GraphTxn.java     |  14 ++-
 .../org/apache/jena/riot/tokens/TestTokenizer.java |  53 +++++---
 .../src/main/java/org/apache/jena/atlas/io/IO.java |  10 +-
 .../jena/datatypes/DatatypeFormatException.java    |  16 +--
 .../org/apache/jena/graph/GraphListenerBase.java   | 104 ++++++++++++++++
 .../java/org/apache/jena/graph/NodeFactory.java    |   5 +-
 .../org/apache/jena/graph/impl/LiteralLabel.java   |  12 --
 .../src/main/java/org/apache/jena/irix/IRIs.java   |  15 ++-
 .../org/apache/jena/fuseki/build/FusekiConfig.java |   2 -
 .../org/apache/jena/fuseki/build/FusekiExt.java    |  42 +------
 .../fuseki/server/DataAccessPointRegistry.java     |  10 --
 .../apache/jena/fuseki/system/FusekiNetLib.java    |  13 --
 .../org/apache/jena/fuseki/main/FusekiLib.java     |  36 +-----
 .../org/apache/jena/fuseki/main/FusekiServer.java  |  19 ---
 .../org/apache/jena/fuseki/main/JettyServer.java   |   6 -
 .../ExFuseki_99_CustomOperation_GlobalDefault.java | 136 ---------------------
 .../org/apache/jena/fuseki/webapp/SystemState.java |   2 +-
 .../org/apache/jena/rdfpatch/TestPatchIO_Text.java |   3 +-
 .../main/java/org/apache/jena/tdb1/TDB1Backup.java |   1 +
 .../java/org/apache/jena/tdb1/TDB1Factory.java     |   1 +
 .../jena/tdb1/{ => sys}/StoreConnection.java       |   8 +-
 .../java/org/apache/jena/tdb1/sys/TDBInternal.java |   1 -
 .../java/org/apache/jena/tdb1/sys/TDBMaker.java    |   1 -
 .../tdb1/transaction/DatasetGraphTransaction.java  |   2 +-
 .../jena/tdb1/setup/TestStoreParamsCreate.java     |   2 +-
 .../jena/tdb1/store/AbstractStoreConnections.java  |   2 +-
 .../store/TestLocationLockStoreConnection.java     |   2 +-
 .../tdb1/transaction/AbstractTestTransSeq.java     |   2 +-
 .../AbstractTestTransSequentialDisk.java           |   2 +-
 .../jena/tdb1/transaction/TestTDBInternal.java     |   2 +-
 .../apache/jena/tdb1/transaction/TestTransMem.java |   2 +-
 .../jena/tdb1/transaction/TestTransRestart.java    |   2 +-
 39 files changed, 311 insertions(+), 364 deletions(-)
 create mode 100644 jena-core/src/main/java/org/apache/jena/graph/GraphListenerBase.java
 delete mode 100644 jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples/ExFuseki_99_CustomOperation_GlobalDefault.java
 rename jena-tdb1/src/main/java/org/apache/jena/tdb1/{ => sys}/StoreConnection.java (98%)


[jena] 02/05: Tidy comments and code

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 250b2118bdeff0263e29131798f210e35715bc3d
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Wed Oct 18 22:55:20 2023 +0100

    Tidy comments and code
---
 .../jena/sparql/core/DatasetGraphFactory.java      |  26 +++++-
 .../apache/jena/sparql/core/DatasetGraphOne.java   |   4 +
 .../sparql/core/assembler/DatasetAssembler.java    |   2 +-
 .../sparql/engine/main/solver/StageMatchData.java  |   2 +-
 .../engine/main/solver/StageMatchTriple.java       |   2 +-
 .../org/apache/jena/sparql/graph/GraphTxn.java     |  14 ++-
 .../jena/datatypes/DatatypeFormatException.java    |  16 ++--
 .../org/apache/jena/graph/GraphListenerBase.java   | 104 +++++++++++++++++++++
 .../java/org/apache/jena/graph/NodeFactory.java    |   5 +-
 .../org/apache/jena/graph/impl/LiteralLabel.java   |  12 ---
 10 files changed, 153 insertions(+), 34 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
index c9740624a8..03b879801b 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFactory.java
@@ -62,10 +62,10 @@ public class DatasetGraphFactory
     public static DatasetGraph createTxnMem() { return new DatasetGraphInMemory(); }
 
     /**
-     * Create a general-purpose  {@link Dataset}.<br/>
-     * Any graphs needed are in-memory unless explicitly added with {@link Dataset#addNamedModel}.
+     * Create a general-purpose  {@link DatasetGraph}.<br/>
+     * Any graphs needed are in-memory unless explicitly added with {@link DatasetGraph#addGraph(Node, Graph)}.
      * <p>
-     * This dataset type can contain graphs from any source when added via {@link Dataset#addNamedModel}.
+     * This dataset type can contain graphs from any source.
      * These are held as links to the supplied graph and not copied.
      * <p>
      * <em>This dataset does not support the graph indexing feature of jena-text.</em>
@@ -76,7 +76,25 @@ public class DatasetGraphFactory
      * @return a general-purpose Dataset
      */
     public static DatasetGraph createGeneral() {
-        return new DatasetGraphMapLink(graphMakerMem.create(null), graphMakerMem) ;
+        return createGeneral(graphMakerMem.create(null));
+    }
+
+    /**
+     * Create a general-purpose  {@link DatasetGraph}.<br/>
+     * Any graphs needed are in-memory unless explicitly added with {@link DatasetGraph#addGraph(Node, Graph)}.
+     * <p>
+     * This dataset type can contain graphs from any source.
+     * These are held as links to the supplied graph and not copied.
+     * <p>
+     * <em>This dataset does not support the graph indexing feature of jena-text.</em>
+     * <p>
+     * This dataset does not support serialized transactions (it only provides MRSW locking).
+     *
+     * @see #createTxnMem
+     * @return a general-purpose Dataset
+     */
+    public static DatasetGraph createGeneral(Graph dftGraph) {
+        return new DatasetGraphMapLink(dftGraph, graphMakerMem) ;
     }
 
     /**
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
index 9926189e8a..88b05fab4d 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphOne.java
@@ -50,6 +50,10 @@ public class DatasetGraphOne extends DatasetGraphBaseFind {
     private final Transactional txn;
     private final boolean supportsAbort;
 
+    public static DatasetGraph createRaw(Graph graph) {
+        return new DatasetGraphOne(graph);
+    }
+
     public static DatasetGraph create(Graph graph) {
         // Find the deepest graph, the one that may be attached to a DatasetGraph.
         Graph graph2 = unwrap(graph);
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssembler.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssembler.java
index dac2054d66..db281ec028 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssembler.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/assembler/DatasetAssembler.java
@@ -33,7 +33,7 @@ import org.apache.jena.sparql.core.DatasetGraph;
 public abstract class DatasetAssembler extends AssemblerBase implements Assembler {
 
     /** This is the superclass of all datasets assemblers */
-       public static Resource getGeneralType() {
+    public static Resource getGeneralType() {
         return DatasetAssemblerVocab.tDataset ;
     }
 
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchData.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchData.java
index 50a0db83e4..446c71b36f 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchData.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchData.java
@@ -38,7 +38,7 @@ import org.apache.jena.sparql.engine.binding.BindingFactory;
  * This is the data access step of quads and datasets.
  * <p>
  * Plain matching - see {@link SolverRX4#rdfStarQuad} for matching with variables
- * in RDF-star embedded triples and
+ * in RDF-star triple terms.
  */
 public class StageMatchData {
 
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchTriple.java b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchTriple.java
index 3b756cd4c7..58e59fab66 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchTriple.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/engine/main/solver/StageMatchTriple.java
@@ -93,7 +93,7 @@ public class StageMatchTriple {
         return true;
     }
 
-    // Variable or not a variable. Not <<?var>>
+    // Variable or not a variable. Not recursively inside a triple term <<?var>>
     private static Node substituteFlat(Node n, Binding binding) {
         return Var.lookup(binding::get, n);
     }
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphTxn.java b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphTxn.java
index 813d0c06b8..e5e4b1e444 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphTxn.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphTxn.java
@@ -115,7 +115,7 @@ public class GraphTxn extends GraphWrapper implements Transactional {
         IteratorTxn(GraphTxn graph, ExtendedIterator<T> base) {
             super(base, true);  // removeDenied.
             this.graph = graph;
-            needIterTxn = graph.getT().isInTransaction();
+            needIterTxn = ! graph.getT().isInTransaction();
             if ( needIterTxn )
                 graph.begin(TxnType.READ);
         }
@@ -129,16 +129,24 @@ public class GraphTxn extends GraphWrapper implements Transactional {
         }
     }
 
+    /**
+     * Whether to read the base graph completely at the point that "find" is called
+     * or to have an iterator over results. Both setting should work in normal situations
+     * Using a {@link IteratorTxn}, which is an {@link ExtendedIterator},
+     * starts a read transaction and that assumes the extended iterator is closed.
+     */
+    private static boolean ISOLATE = false;
+
     @Override
     public ExtendedIterator<Triple> find(Triple triple) {
-        if ( false )
+        if ( ISOLATE )
             return isolate(get().find(triple));
         return new IteratorTxn<Triple>(this, get().find(triple));
     }
 
     @Override
     public ExtendedIterator<Triple> find(Node s, Node p, Node o) {
-        if ( false )
+        if ( ISOLATE )
             return isolate(get().find(s, p, o));
         return new IteratorTxn<Triple>(this, get().find(s, p, o));
     }
diff --git a/jena-core/src/main/java/org/apache/jena/datatypes/DatatypeFormatException.java b/jena-core/src/main/java/org/apache/jena/datatypes/DatatypeFormatException.java
index 1ad3e3a0f5..5d8b0cf5f6 100644
--- a/jena-core/src/main/java/org/apache/jena/datatypes/DatatypeFormatException.java
+++ b/jena-core/src/main/java/org/apache/jena/datatypes/DatatypeFormatException.java
@@ -24,16 +24,16 @@ import org.apache.jena.shared.* ;
  * Exception thrown when a lexical form does not match the stated
  * datatype.
  */
-public class DatatypeFormatException extends JenaException 
+public class DatatypeFormatException extends JenaException
 {
 
     /**
      * Constructs a new {@code DatatypeFormatException} with the specified
      * illegal lexical form, datatype and cause. The detail message (for later
-     * retrieval by the {@link #getMessage()} method) is generated using the given 
+     * retrieval by the {@link #getMessage()} method) is generated using the given
      * datatype and illegal lexical form.
-     * 
-     * @param  lexicalForm the illegal lexical form discovered. The illegal lexical form 
+     *
+     * @param  lexicalForm the illegal lexical form discovered. The illegal lexical form
      *         is saved for later retrieval by the {@link #getLexicalForm()} method.
      * @param  dtype the datatype that found the problem. The datatype is saved for
      *         later retrieval by the {@link #getDataType()} method.
@@ -51,8 +51,8 @@ public class DatatypeFormatException extends JenaException
     /**
      * Constructs a new {@code DatatypeFormatException} with the specified
      * illegal lexical form, datatype and detail message.
-     * 
-     * @param  lexicalForm the illegal lexical form discovered. The illegal lexical form 
+     *
+     * @param  lexicalForm the illegal lexical form discovered. The illegal lexical form
      *         is saved for later retrieval by the {@link #getLexicalForm()} method.
      * @param  dtype the datatype that found the problem. The datatype is saved for
      *         later retrieval by the {@link #getDataType()} method.
@@ -69,7 +69,7 @@ public class DatatypeFormatException extends JenaException
     private final RDFDatatype dataType;
 
     /**
-     * Creates a new instance of <code>DatatypeFormatException</code> 
+     * Creates a new instance of <code>DatatypeFormatException</code>
      * without detail message.
      */
     public DatatypeFormatException() {
@@ -80,7 +80,7 @@ public class DatatypeFormatException extends JenaException
     /**
      * Constructs a new {@code DatatypeFormatException} with the specified
      * detail message and cause.
-     * 
+     *
      * @param  message the detail message (which is saved for later retrieval
      *         by the {@link #getMessage()} method).
      * @param  cause the cause (which is saved for later retrieval by the
diff --git a/jena-core/src/main/java/org/apache/jena/graph/GraphListenerBase.java b/jena-core/src/main/java/org/apache/jena/graph/GraphListenerBase.java
new file mode 100644
index 0000000000..4b567d9402
--- /dev/null
+++ b/jena-core/src/main/java/org/apache/jena/graph/GraphListenerBase.java
@@ -0,0 +1,104 @@
+/*
+ * 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.graph;
+
+import java.util.Iterator ;
+import java.util.List ;
+
+/**
+ * A {@link GraphListener} that converts "add" and "delete" operations to
+ * {@link #addEvent} and {@link #deleteEvent} together with optional
+ * {@link #startRead} and {@link #finishRead}.
+ */
+public abstract class GraphListenerBase implements GraphListener
+{
+    public GraphListenerBase() {}
+
+    @Override
+    public void notifyAddTriple(Graph g, Triple t) { addEvent(t) ; }
+
+    @Override
+    public void notifyAddArray(Graph g, Triple[] triples) {
+        for ( Triple triple : triples ) {
+            addEvent(triple);
+        }
+    }
+
+    @Override
+    public void notifyAddList(Graph g, List<Triple> triples) {
+        notifyAddIterator(g, triples.iterator());
+    }
+
+    @Override
+    public void notifyAddIterator(Graph g, Iterator<Triple> it) {
+        for ( ; it.hasNext() ; )
+            addEvent(it.next());
+    }
+
+    @Override
+    public void notifyAddGraph(Graph g, Graph added) {
+        added.find().forEach(this::addEvent);
+    }
+
+    @Override
+    public void notifyDeleteTriple(Graph g, Triple t) {
+        deleteEvent(t);
+    }
+
+    @Override
+    public void notifyDeleteList(Graph g, List<Triple> triples) {
+        notifyDeleteIterator(g, triples.iterator());
+    }
+
+    @Override
+    public void notifyDeleteArray(Graph g, Triple[] triples) {
+        for ( Triple triple : triples ) {
+            deleteEvent(triple);
+        }
+    }
+
+    @Override
+    public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {
+        for ( ; it.hasNext() ; )
+            deleteEvent(it.next());
+    }
+
+    @Override
+    public void notifyDeleteGraph(Graph g, Graph removed) {
+        removed.find().forEach(this::deleteEvent);
+    }
+
+    protected abstract void addEvent(Triple t);
+
+    protected abstract void deleteEvent(Triple t);
+
+    // --------
+
+    @Override
+    public void notifyEvent(Graph source, Object value) {
+        if ( value.equals(GraphEvents.startRead) )
+            startRead();
+        else if ( value.equals(GraphEvents.finishRead) )
+            finishRead();
+    }
+
+    protected void startRead() {}
+
+    protected void finishRead() {}
+}
diff --git a/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java b/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java
index 4f02f4bbc1..545148fd45 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/NodeFactory.java
@@ -21,7 +21,6 @@ package org.apache.jena.graph;
 import java.util.Objects;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.jena.datatypes.DatatypeFormatException;
 import org.apache.jena.datatypes.RDFDatatype;
 import org.apache.jena.datatypes.TypeMapper;
 import org.apache.jena.datatypes.xsd.XSDDatatype;
@@ -141,10 +140,8 @@ public class NodeFactory {
      *            the lexical form of the literal
      * @param dtype
      *            the type of the literal
-     * @throws DatatypeFormatException
-     *             if lex is not a legal form of dtype
      */
-    public static Node createLiteral(String lex, RDFDatatype dtype) throws DatatypeFormatException {
+    public static Node createLiteral(String lex, RDFDatatype dtype) {
         Objects.requireNonNull(lex, "null lexical form for literal");
         if ( dtype == null )
             dtype = XSDDatatype.XSDstring;
diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java
index c8fa3a47fb..2e62963c90 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java
@@ -370,18 +370,6 @@ final public class LiteralLabel {
         return lang;
     }
 
-//    /**
-//     * Answer a suitable instance of a Java class representing this literal's value.
-//     * May throw an exception if the literal is ill-formed.
-//     */
-//    public Object getValue() throws DatatypeFormatException {
-//    if (wellformed) {
-//        return value;
-//    } else {
-//        throw new DatatypeFormatException(lexicalForm, dtype, exception);
-//    }
-//}
-
     /**
      * Answer a suitable instance of a Java class representing this literal's value.
      * May throw an exception if the literal is ill-formed.


[jena] 01/05: Fix handling filenames as base URIs

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 41acb38a3498f86b4d11200188350611c3c83649
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Wed Oct 18 22:55:03 2023 +0100

    Fix handling filenames as base URIs
---
 jena-core/src/main/java/org/apache/jena/irix/IRIs.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/jena-core/src/main/java/org/apache/jena/irix/IRIs.java b/jena-core/src/main/java/org/apache/jena/irix/IRIs.java
index 67efa01bbe..2cdbbc8bd4 100644
--- a/jena-core/src/main/java/org/apache/jena/irix/IRIs.java
+++ b/jena-core/src/main/java/org/apache/jena/irix/IRIs.java
@@ -86,8 +86,13 @@ public class IRIs {
             if ( scheme != null && scheme.length() == 1 )
                 scheme = "file";
         }
-        if ( scheme != null && scheme.equals("file") )
-            return IRILib.filenameToIRI(baseURI);
+        // File scheme if the URI is "file:" or there is no scheme
+        // and the system base is a "file:" URI
+        boolean isFile = ( scheme != null )
+                ? scheme.equals("file")
+                : IRIs.getSystemBase().hasScheme("file");
+        if ( isFile )
+            baseURI = IRILib.encodeFileURL(baseURI);
         return IRIs.getSystemBase().resolve(baseURI).toString();
     }
 
@@ -172,14 +177,16 @@ public class IRIs {
     // Return the index of the ":" starting from "start"
     // so that start to the returned index is the scheme including ":"
     // Return <= 0 for no scheme.
-    // -1 Syntax error
-    // 0 did not find a colon.
+    // -1 Not a scheme - non-scheme character
+    // 0 did not find a colon or zero characters before the colon.
+    //    A scheme is at least one character.
     private static int scheme(String str, int start) {
         int p = start;
         int end = str.length();
         while (p < end) {
             char c = str.charAt(p);
             if ( c == ':' )
+                // End of scheme.
                 return p;
             if ( ! isAlpha(c) ) {
                 if ( p == start )


[jena] 05/05: More control for U+FFFD (Replacement Character)

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 3fb67a51f35adfae053f5c2e3d0a6a952a4da7bc
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Fri Oct 20 15:39:07 2023 +0100

    More control for U+FFFD (Replacement Character)
    
    Ensure that decoding is an error for ASCII input.
---
 .../jena/riot/tokens/TokenizeTextBuilder.java      | 18 ++---
 .../org/apache/jena/riot/tokens/TokenizerText.java | 93 +++++++++++++++-------
 .../org/apache/jena/riot/tokens/TestTokenizer.java | 53 ++++++++----
 .../src/main/java/org/apache/jena/atlas/io/IO.java | 10 ++-
 .../org/apache/jena/rdfpatch/TestPatchIO_Text.java |  3 +-
 5 files changed, 124 insertions(+), 53 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizeTextBuilder.java b/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizeTextBuilder.java
index 03c5dcfb25..b4811e6d14 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizeTextBuilder.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizeTextBuilder.java
@@ -32,14 +32,14 @@ import org.slf4j.Logger;
 public class TokenizeTextBuilder {
 
     // One of these.
-    private PeekReader   peekReader   = null;
-    private InputStream  input        = null;
-    private Reader       reader       = null;
-    private String       string       = null;
+    private PeekReader   peekReader      = null;
+    private InputStream  input           = null;
+    private Reader       reader          = null;
+    private String       string          = null;
 
-    private boolean      lineMode     = false;
-    private boolean      utf8         = true;
-    private ErrorHandler errorHandler = null;
+    private boolean      singleLineMode  = false;
+    private boolean      utf8            = true;
+    private ErrorHandler errorHandler    = null;
 
     TokenizeTextBuilder() {}
 
@@ -75,7 +75,7 @@ public class TokenizeTextBuilder {
     }
 
     public TokenizeTextBuilder lineMode(boolean lineMode) {
-        this.lineMode = lineMode;
+        this.singleLineMode = lineMode;
         return this;
     }
 
@@ -129,6 +129,6 @@ public class TokenizeTextBuilder {
             throw new IllegalStateException("No data source");
         }
 
-        return TokenizerText.internal(pr, lineMode, errHandler);
+        return TokenizerText.internal(pr, singleLineMode, !utf8, errHandler);
     }
 }
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java b/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
index 9c02bf0b24..93bfe3b038 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
@@ -51,29 +51,33 @@ public final class TokenizerText implements Tokenizer
     // bytecodes and even if it it did, JIT will remove dead branches).
     private static final boolean Checking = false;
 
-    private Token token = null;
     private final StringBuilder stringBuilder = new StringBuilder(200);
     private final PeekReader reader;
     // Whether whitespace between tokens includes newlines (in various forms).
-    private final boolean lineMode;
-    private boolean finished = false;
+    private final boolean singleLineMode;
+    // Indicator. The PeekReader should throw java.nio.charset.MalformedInputException
+    private final boolean isASCII;
     private final TokenChecker checker = null;
-
     // The code assumes that errors throw exception and so stop parsing.
     private final ErrorHandler errorHandler;
 
+    private Token token = null;
+    private boolean finished = false;
+
+
     public static TokenizeTextBuilder create() { return new TokenizeTextBuilder(); }
 
     public static Tokenizer fromString(String string) { return create().fromString(string).build(); }
 
-    /*package*/ static TokenizerText internal(PeekReader reader, boolean lineMode, ErrorHandler errorHandler) {
-        return new TokenizerText(reader, lineMode, errorHandler);
+    /*package*/ static TokenizerText internal(PeekReader reader, boolean singleLineMode, boolean isASCII, ErrorHandler errorHandler) {
+        return new TokenizerText(reader, singleLineMode, isASCII, errorHandler);
     }
 
-    private TokenizerText(PeekReader reader, boolean lineMode, ErrorHandler errorHandler) {
+    private TokenizerText(PeekReader reader, boolean singleLineMode, boolean isASCII, ErrorHandler errorHandler) {
         this.reader = Objects.requireNonNull(reader, "PeekReader");
-        this.lineMode = lineMode;
+        this.singleLineMode = singleLineMode;
         this.errorHandler = Objects.requireNonNull(errorHandler, "ErrorHandler");
+        this.isASCII = isASCII;
     }
 
     @Override
@@ -171,7 +175,7 @@ public final class TokenizerText implements Tokenizer
             }
 
             // Including excess newline chars from comment.
-            if ( lineMode ) {
+            if ( singleLineMode ) {
                 if ( !isHorizontalWhitespace(ch) )
                     break;
             } else {
@@ -538,6 +542,10 @@ public final class TokenizerText implements Tokenizer
                     else
                         warning("Bad character in IRI (space): <%s[space]...>", stringBuilder.toString());
                     break;
+                case REPLACEMENT:
+                    if ( WarnOnReplacmentCharInIRI )
+                        warning("Unicode replacement character U+FFFD in IRI");
+                    break;
                 default:
                     if ( ch <= 0x19 )
                         warning("Illegal character in IRI (control char 0x%02X): <%s[0x%02X]...>", ch, stringBuilder.toString(), ch);
@@ -641,7 +649,23 @@ public final class TokenizerText implements Tokenizer
         return readSegment(true);
     }
 
-    // Read the prefix or localname part of a prefixed.
+    // Controls related to raw use U+FFFD, the Unicode replacement character.
+    // These are a sign that the input has been corrupted at some point, not necessarily the file being read but also in the way it was created,
+    // They do occur in practice.
+
+    // Replacement characters can occur in four places:
+    // * IRIs -- illegal IRI syntax
+    // * Strings -- in lexical forms.
+    // * Prefixed names -- illegal syntax but they end the token so cause a different token.
+    // * Blank node labels -- illegal syntax but they end the token so cause a different token.
+    // Note that when ASCII input, U+FFFD occurs for non-ASCII characters.
+
+    private final static boolean WarnOnReplacmentCharInIRI = false;
+    private final static boolean WarnOnReplacmentCharInString = false;
+    private final static boolean WarnOnReplacmentCharInPrefixedName = true;
+    private final static boolean WarnOnReplacmentCharInBlankNodeLabel = true;
+
+    // Read the prefix or localname part of a prefixed name.
     // Returns "" when there are no valid characters, e.g. prefix for ":foo" or local name for "ex:".
     private String readSegment(boolean isLocalPart) {
         // Prefix: PN_CHARS_BASE                       ((PN_CHARS|'.')* PN_CHARS)?
@@ -665,8 +689,10 @@ public final class TokenizerText implements Tokenizer
                 reader.readChar();
                 processPLX(ch);
             } else if ( RiotChars.isPNChars_U_N(ch) ) {
-                if ( ch == REPLACEMENT )
-                    warning("Unicode replacement character U+FFFD");
+                if ( WarnOnReplacmentCharInPrefixedName ) {
+                    if ( ch == REPLACEMENT )
+                        warning("Unicode replacement character U+FFFD in prefixed name");
+                }
                 insertCodepoint(stringBuilder, ch);
                 reader.readChar();
             } else
@@ -714,8 +740,10 @@ public final class TokenizerText implements Tokenizer
             }
 
             if ( ch != CH_DOT ) {
-                if ( ch == REPLACEMENT )
-                    warning("Unicode replacement character U+FFFD");
+                if ( WarnOnReplacmentCharInPrefixedName ) {
+                    if ( ch == REPLACEMENT )
+                        warning("Unicode replacement character U+FFFD in prefixed name");
+                }
                 insertCodepoint(stringBuilder, ch);
             } else {
                 // DOT - delay until next loop.
@@ -770,11 +798,14 @@ public final class TokenizerText implements Tokenizer
 
         for (;;) {
             int ch = reader.readChar();
-
-            // Raw replacement char in a string.
-            if ( ch == REPLACEMENT )
-                warning("Unicode replacement character U+FFFD in string");
-            else if ( ch == EOF ) {
+            if ( WarnOnReplacmentCharInString ) {
+                // Raw replacement char in a string.
+                if ( ch == REPLACEMENT )
+                    warning("Unicode replacement character U+FFFD in string");
+            }
+            if ( ch == NotACharacter || ch == ReverseOrderBOM )
+                warning("Unicode non-character U+%4X in string", ch);
+            if ( ch == EOF ) {
                 // if ( endNL ) return stringBuilder.toString();
                 fatal("Broken token: %s", stringBuilder.toString());
             }
@@ -785,7 +816,6 @@ public final class TokenizerText implements Tokenizer
             else if ( ch == CH_RSLASH )
                 // Allow escaped replacement character.
                 ch = readLiteralEscape();
-
             insertCodepoint(stringBuilder, ch);
         }
     }
@@ -794,9 +824,12 @@ public final class TokenizerText implements Tokenizer
         stringBuilder.setLength(0);
         for (;;) {
             int ch = reader.readChar();
-            if ( ch == REPLACEMENT )
-                warning("Input has Unicode replacement character U+FFFD in string");
-            else if ( ch == EOF ) {
+            if ( WarnOnReplacmentCharInString ) {
+                // Raw replacement char in a string.
+                if ( ch == REPLACEMENT )
+                    warning("Unicode replacement character U+FFFD in string");
+            }
+            if ( ch == EOF ) {
                 if ( endNL )
                     return stringBuilder.toString();
                 fatal("Broken long string");
@@ -894,8 +927,11 @@ public final class TokenizerText implements Tokenizer
             if ( !RiotChars.isPNChars_U_N(ch) )
                 fatal("Blank node label does not start with alphabetic or _ : '%c'", (char)ch);
             reader.readChar();
-            if ( ch == REPLACEMENT )
-                warning("Unicode replacement character U+FFFD in blank node label");
+            if ( WarnOnReplacmentCharInBlankNodeLabel ) {
+                // Raw replacement char in a string.
+                if ( ch == REPLACEMENT )
+                    warning("Unicode replacement character U+FFFD in blank node label");
+            }
             insertCodepoint(stringBuilder, ch);
         }
 
@@ -919,8 +955,11 @@ public final class TokenizerText implements Tokenizer
             }
 
             if ( ch != CH_DOT ) {
-                if ( ch == REPLACEMENT )
-                    warning("Unicode replacement character U+FFFD in blank node label");
+                if ( WarnOnReplacmentCharInBlankNodeLabel ) {
+                    // Raw replacement char in a string.
+                    if ( ch == REPLACEMENT )
+                        warning("Unicode replacement character U+FFFD in blank node label");
+                }
                 insertCodepoint(stringBuilder, ch);
             } else
                 // DOT - delay until next loop.
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenizer.java b/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenizer.java
index 0ebe54a8a8..1fabb8de70 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenizer.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/tokens/TestTokenizer.java
@@ -926,24 +926,47 @@ public class TestTokenizer {
     }
 
     @Test
-    public void tokenizer_charset_1() {
+    public void tokenizer_charset_str_1() {
         Tokenizer tokenizer = tokenizerASCII("'abc'") ;
         Token t = tokenizer.next() ;
         assertFalse(tokenizer.hasNext()) ;
     }
 
+    // Check the RiotParseException is about bad encoding.
+    private void expectBadEncoding(Runnable action) {
+        try {
+            action.run();
+        } catch ( RiotParseException ex ) {
+            assertTrue(ex.getMessage().contains("Bad character encoding"));
+            throw ex;
+        }
+    }
+
     @Test(expected = RiotParseException.class)
-    public void tokenizer_charset_2() {
-        Tokenizer tokenizer = tokenizerASCII("'abcdé'") ;
-        // ASCII only -> bad.
-        Token t = tokenizer.next() ;
+    public void tokenizer_charset_str_2() {
+        expectBadEncoding(()->{
+            Tokenizer tokenizer = tokenizerASCII("'abcdé'") ;
+            // ASCII only -> bad.
+            Token t = tokenizer.next() ;
+        });
     }
 
     @Test(expected = RiotParseException.class)
-    public void tokenizer_charset_3() {
-        Tokenizer tokenizer = tokenizerASCII("<http://example/abcdé>") ;
-        // ASCII only -> bad.
-        Token t = tokenizer.next() ;
+    public void tokenizer_charset_str_3() {
+        expectBadEncoding(()->{
+            Tokenizer tokenizer = tokenizerASCII("'α'") ;
+            // ASCII only -> bad.
+            Token t = tokenizer.next() ;
+        });
+    }
+
+    @Test(expected = RiotParseException.class)
+    public void tokenizer_charset_uri_1() {
+        expectBadEncoding(()->{
+            Tokenizer tokenizer = tokenizerASCII("<http://example/abcdé>") ;
+            // ASCII only -> bad.
+            Token t = tokenizer.next() ;
+        });
     }
 
     @Test(expected=RiotParseException.class)
@@ -972,10 +995,12 @@ public class TestTokenizer {
         //assertFalse(tokenizer.hasNext()) ;
     }
 
+    private final int CountWaringsOnReplacmeentChar = 0;
+
     // Test for warnings
     @Test
     public void tokenStr_replacmentChar_str_1() {
-        testExpectWarning("'\uFFFD'", TokenType.STRING, 1);
+        testExpectWarning("'\uFFFD'", TokenType.STRING, CountWaringsOnReplacmeentChar);
     }
 
     @Test
@@ -986,7 +1011,7 @@ public class TestTokenizer {
 
     @Test
     public void tokenStr_replacmentChar_str_3() {
-        testExpectWarning("'''\uFFFD'''", TokenType.STRING, 1);
+        testExpectWarning("'''\uFFFD'''", TokenType.STRING, CountWaringsOnReplacmeentChar);
     }
 
     @Test
@@ -997,7 +1022,7 @@ public class TestTokenizer {
 
     @Test
     public void tokenStr_replacmentChar_str_5() {
-        testExpectWarning("'abc\uFFFDdef'", TokenType.STRING, 1);
+        testExpectWarning("'abc\uFFFDdef'", TokenType.STRING, CountWaringsOnReplacmeentChar);
     }
 
     @Test
@@ -1011,7 +1036,7 @@ public class TestTokenizer {
         byte[] bytes = {(byte)0x22, (byte)0xDF, (byte)0x22};
         Reader r = IO.asUTF8(new ByteArrayInputStream(bytes));
         PeekReader pr = PeekReader.make(r);
-        Token t = testExpectWarning(pr, TokenType.STRING, 1);
+        Token t = testExpectWarning(pr, TokenType.STRING, CountWaringsOnReplacmeentChar);
         int char0 = t.getImage().codePointAt(0);
         assertEquals("Expected Unicode REPLACEMENT CHARACTER", 0xFFFD, char0);
     }
@@ -1023,7 +1048,7 @@ public class TestTokenizer {
 
     @Test
     public void tokenStr_replacmentChar_IRI_2() {
-        // As unicode escape. Still bad (it is not a ucschar so not an IRI character)
+        // As unicode escape. Still bad in a URI.
         testExpectWarning("<http://example/\\uFFFD>", TokenType.IRI, 1);
     }
 
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java b/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
index 0f27b9d01c..fac0bf4e11 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
@@ -21,6 +21,8 @@ package org.apache.jena.atlas.io;
 import java.io.*;
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.*;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -207,9 +209,15 @@ public class IO
         return new InputStreamReader(in, StandardCharsets.UTF_8);
     }
 
+
     /** Create a unbuffered reader that uses ASCII encoding */
     static public Reader asASCII(InputStream in) {
-        return new InputStreamReader(in, StandardCharsets.US_ASCII);
+        //return new InputStreamReader(in, StandardCharsets.US_ASCII);
+
+        CharsetDecoder dec = StandardCharsets.US_ASCII.newDecoder();
+        // Make into an error - the default is REPLACE (insert unicode U+FFFD)
+        dec.onMalformedInput(CodingErrorAction.REPORT);
+        return new InputStreamReader(in, dec);
     }
 
     /** Create an buffered reader that uses UTF-8 encoding */
diff --git a/jena-rdfpatch/src/test/java/org/apache/jena/rdfpatch/TestPatchIO_Text.java b/jena-rdfpatch/src/test/java/org/apache/jena/rdfpatch/TestPatchIO_Text.java
index 8724b97a1c..bb80a1df2a 100644
--- a/jena-rdfpatch/src/test/java/org/apache/jena/rdfpatch/TestPatchIO_Text.java
+++ b/jena-rdfpatch/src/test/java/org/apache/jena/rdfpatch/TestPatchIO_Text.java
@@ -58,8 +58,7 @@ public class TestPatchIO_Text extends AbstractTestPatchIO {
         return patch;
     }
 
-    @Test(expected=ErrorHandlerTestLib.ExWarning.class)
-    public void read_warning_01() {
+    @Test public void read_warning_01() {
         String str = "A <http://example/s1> <http://example/p1> 'abc\uFFFDdef' <http://example/g1> .";
         parseSyntax(str);
     }


[jena] 04/05: GH-2020: Remove deprecated methods (Fuseki)

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 23799d78378a2835013881e5cbad35495f9a7132
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Fri Oct 20 12:24:19 2023 +0100

    GH-2020: Remove deprecated methods (Fuseki)
---
 .../org/apache/jena/fuseki/build/FusekiConfig.java |   2 -
 .../org/apache/jena/fuseki/build/FusekiExt.java    |  42 +------
 .../fuseki/server/DataAccessPointRegistry.java     |  10 --
 .../apache/jena/fuseki/system/FusekiNetLib.java    |  13 --
 .../org/apache/jena/fuseki/main/FusekiLib.java     |  36 +-----
 .../org/apache/jena/fuseki/main/FusekiServer.java  |  19 ---
 .../org/apache/jena/fuseki/main/JettyServer.java   |   6 -
 .../ExFuseki_99_CustomOperation_GlobalDefault.java | 136 ---------------------
 8 files changed, 8 insertions(+), 256 deletions(-)

diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
index 6bfcfbc8f6..af3b0b8eef 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiConfig.java
@@ -104,8 +104,6 @@ public class FusekiConfig {
         if ( allowUpdate ) {
             stdWrite.forEach((name, op) -> accEndpoint(endpoints, op, name));
             stdDatasetWrite.forEach(op -> accEndpoint(endpoints, op));
-            if ( FusekiExt.extraOperationServicesWrite != null )
-                FusekiExt.extraOperationServicesWrite.forEach((name, op) -> accEndpoint(endpoints, op, name));
         } else {
             stdRead.forEach((name, op) -> accEndpoint(endpoints, op, name));
             stdDatasetRead.forEach(op -> accEndpoint(endpoints, op));
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiExt.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiExt.java
index a503be8877..a982c76f12 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiExt.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/build/FusekiExt.java
@@ -18,7 +18,6 @@
 
 package org.apache.jena.fuseki.build;
 
-import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.jena.fuseki.server.Operation;
@@ -31,42 +30,11 @@ import org.apache.jena.fuseki.servlets.ActionService;
 public class FusekiExt {
 
     // Additional operations provided by extension, added via Jena init / typically ServiceLoader
-    static Map<String, Operation> extraOperationServicesRead;
-    static Map<String, Operation> extraOperationServicesWrite;
-
-    /**
-     * Add a new operation, which will be included in a default configuration.
-     * The operation must have been added with {@link #registerOperation} first.
-     * @deprecated Use {@code FusekiModules} with FusekiMain.
-     */
-    @Deprecated
-    public static void addDefaultEndpoint(Operation op, String serviceName) {
-        // Include in both sets.
-        addDefaultEndpoint(op, serviceName, false);
-        addDefaultEndpoint(op, serviceName, true);
-    }
-
-    /**
-     * Add a new operation, which will be included in a default configuration,
-     * depending on whether it is for general inclusion or for inclusion for update
-     * only configuration.
-     * The operation must have been added with {@link #registerOperation} first.
-     * @deprecated Use {@code FusekiModules} with FusekiMain.
-     */
-    @Deprecated
-    public static void addDefaultEndpoint(Operation op, String serviceName, boolean forUpdate) {
-        // Due to class loading and ServiceLoader interaction, it is not reliable to
-        // set extraOperationServices as it is declared.
-        if ( extraOperationServicesRead == null )
-            extraOperationServicesRead = new HashMap<>();
-        if ( extraOperationServicesWrite == null )
-            extraOperationServicesWrite = new HashMap<>();
-
-        if ( forUpdate )
-            extraOperationServicesWrite.put(serviceName, op);
-        else
-            extraOperationServicesRead.put(serviceName, op);
-    }
+    // These are used in FuskeiConfig.
+    // Left in case in the future we want to have customized defautl setup.
+    // Currently, Jena5, the preferred way is to have control via config.ttl or FusekiServer.Builder.
+    /*package*/ static Map<String, Operation> extraOperationServicesRead = null;
+    /*package*/ static Map<String, Operation> extraOperationServicesWrite = null;
 
     /** Make a new operation available. */
     public static void registerOperation(Operation op, ActionService handler) {
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
index d859138dba..14566f0977 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/DataAccessPointRegistry.java
@@ -71,16 +71,6 @@ public class DataAccessPointRegistry extends Registry<String, DataAccessPoint>
         return accessPoints;
     }
 
-    /**
-     *  @deprecated Use {@link #register(DataAccessPoint)}.
-     * This method ignores the accessPointName argument.
-     */
-    @Override
-    @Deprecated
-    public void put(String accessPointName, DataAccessPoint dap) {
-        register(dap);
-    }
-
     @Override
     public DataAccessPoint get(String key) {
         return super.get(key);
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiNetLib.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiNetLib.java
index 35b5a38853..9739332efb 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiNetLib.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/FusekiNetLib.java
@@ -22,12 +22,9 @@ import java.util.Enumeration;
 import java.util.Iterator;
 
 import jakarta.servlet.http.HttpServletRequest;
-
 import org.apache.commons.collections4.MultiMapUtils;
 import org.apache.commons.collections4.MultiValuedMap;
 import org.apache.jena.atlas.web.ContentType;
-import org.apache.jena.atlas.web.WebLib;
-import org.apache.jena.fuseki.FusekiException;
 import org.apache.jena.fuseki.servlets.HttpAction;
 import org.apache.jena.graph.Graph;
 import org.apache.jena.graph.Node;
@@ -173,14 +170,4 @@ public class FusekiNetLib {
         PrefixMapping pmapDest = dest.getDefaultGraph().getPrefixMapping();
         pmapDest.withDefaultMappings(pmapSrc);
     }
-
-    /** Use {@link WebLib#choosePort} or start servers with port 0 and then ask which port was allocated. */
-    @Deprecated
-    public static int choosePort() {
-        try {
-            return WebLib.choosePort();
-        } catch (RuntimeException ex) {
-            throw new FusekiException(ex.getMessage());
-        }
-    }
 }
diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiLib.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiLib.java
index efbcfe4fdd..0b0d152525 100644
--- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiLib.java
+++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiLib.java
@@ -25,18 +25,17 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.apache.jena.fuseki.FusekiConfigException;
 import org.apache.jena.fuseki.access.AccessCtl_AllowGET;
 import org.apache.jena.fuseki.access.AccessCtl_Deny;
 import org.apache.jena.fuseki.access.AccessCtl_GSP_R;
 import org.apache.jena.fuseki.access.AccessCtl_SPARQL_QueryDataset;
-import org.apache.jena.fuseki.build.FusekiConfig;
-import org.apache.jena.fuseki.server.*;
+import org.apache.jena.fuseki.server.DataAccessPointRegistry;
+import org.apache.jena.fuseki.server.Endpoint;
+import org.apache.jena.fuseki.server.Operation;
 import org.apache.jena.fuseki.servlets.ActionService;
 import org.apache.jena.fuseki.servlets.GSP_RW;
 import org.apache.jena.fuseki.servlets.HttpAction;
 import org.apache.jena.riot.WebContent;
-import org.apache.jena.sparql.core.DatasetGraph;
 
 /** Actions on and about a {@link FusekiServer} */
 public class FusekiLib {
@@ -53,35 +52,6 @@ public class FusekiLib {
         return names;
     }
 
-    /**
-     * Add a dataset to a server, with the default set of services.
-     * @deprecated Construct the server with the a {@link FusekiServer.Builder}.
-     */
-    @Deprecated
-    public static FusekiServer addDataset(FusekiServer server, String name, DatasetGraph dsg, boolean withUpdate) {
-        DataService dataService = FusekiConfig.buildDataServiceStd(dsg, withUpdate);
-        return addDataset(server, name, dataService);
-    }
-
-    @Deprecated
-    /** Add a {@link DataService} to a server */
-    public static FusekiServer addDataset(FusekiServer server, String name, DataService dataService) {
-        DataAccessPointRegistry dataAccessPoints = DataAccessPointRegistry.get(server.getServletContext());
-        name = DataAccessPoint.canonical(name);
-        if ( dataAccessPoints.isRegistered(name) )
-            throw new FusekiConfigException("Data service name already registered: "+name);
-        FusekiConfig.addDataService(dataAccessPoints, name, dataService);
-        return server;
-    }
-
-    /** Remove dataset from a server */
-    @Deprecated
-    public static FusekiServer removeDataset(FusekiServer server, String name) {
-        DataAccessPointRegistry dataAccessPoints = DataAccessPointRegistry.get(server.getServletContext());
-        FusekiConfig.removeDataset(dataAccessPoints, name);
-        return server;
-    }
-
     /**
      * Return a {@code FusekiServer.Builder} setup for data access control.
      */
diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java
index 37bf0ef6b6..bf5688849f 100644
--- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java
+++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java
@@ -1078,25 +1078,6 @@ public class FusekiServer {
             return this;
         }
 
-        /** @deprecated Use {@link #fusekiModules(FusekiModules)}. */
-        @Deprecated
-        public Builder setModules(FusekiModules modules) {
-            return fusekiModules(modules);
-        }
-
-        // Conflict with fusekiModules()
-//        /**
-//         * Set the {@link FusekiModules Fuseki Modules} for a server.
-//         * If no modules are added to a builder, then the system-wide default set (found by loading FusekiModules
-//         * via Java's {@link ServiceLoader} mechanism) is used.
-//         * <p>Pass {@code null} to switch back the system-wide default set.
-//         *
-//         * @see FusekiModules
-//         */
-//        public Builder fusekiModules(FusekiModule ...fmods) {
-//            return fusekiModules(FusekiModules.create(fmods));
-//        }
-
         /**
          * Set the {@link FusekiModule Fuseki Module} for a server.
          * If no modules are added to a builder, then the system-wide default set (found by loading FusekiModule
diff --git a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/JettyServer.java b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/JettyServer.java
index 3ef6689ccc..80641c76f6 100644
--- a/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/JettyServer.java
+++ b/jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/JettyServer.java
@@ -314,12 +314,6 @@ public class JettyServer {
             return this;
         }
 
-        /** @deprecated Renamed as {@link #maxServerThreads} */
-        @Deprecated
-        public Builder maxServerNumThreads(int maxThreads) {
-            return maxServerThreads(maxThreads);
-        }
-
         /**
          * Set the maximum number threads used by Jetty.
          * This is equivalent to {@code numServerThreads(-1, maxThreads)}
diff --git a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples/ExFuseki_99_CustomOperation_GlobalDefault.java b/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples/ExFuseki_99_CustomOperation_GlobalDefault.java
deleted file mode 100644
index 35ffbd2698..0000000000
--- a/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples/ExFuseki_99_CustomOperation_GlobalDefault.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.main.examples;
-
-import java.io.IOException;
-import java.util.ServiceLoader;
-
-import org.apache.jena.atlas.lib.DateTimeUtils;
-import org.apache.jena.fuseki.Fuseki;
-import org.apache.jena.fuseki.FusekiException;
-import org.apache.jena.fuseki.build.FusekiExt;
-import org.apache.jena.fuseki.main.FusekiServer;
-import org.apache.jena.fuseki.main.sys.FusekiModule;
-import org.apache.jena.fuseki.server.Operation;
-import org.apache.jena.fuseki.servlets.ActionService;
-import org.apache.jena.fuseki.servlets.HttpAction;
-import org.apache.jena.fuseki.system.FusekiLogging;
-import org.apache.jena.http.HttpOp;
-import org.apache.jena.riot.WebContent;
-import org.apache.jena.sparql.core.DatasetGraphFactory;
-import org.apache.jena.sys.JenaSubsystemLifecycle;
-import org.apache.jena.sys.JenaSystem;
-import org.apache.jena.web.HttpSC;
-
-/**
- * Example of adding a new operation to a Fuseki server by registering it with the
- * global Fuseki registries and adding it to the global default services.
- * <p>
- * <i>The preferred way of doing this is now to use {@link FusekiModule FusekiModules}.</i>
- * <p>
- * The custom operation is loaded using {@link ServiceLoader} as shown in
- * {@link InitFusekiCustomOperation}.
- * <p>
- * {@link ExFuseki_04_CustomOperation_Module}
- * <p>
- * Doing this, adding the jar to the classpath, including the {@link ServiceLoader}
- * setup, will automatically add it to the server.
- * <p>
- * See <a href="https://jena.apache.org/documentation/notes/jena-repack.html">Repacking Jena jars</a>.
- * <p>
- * See <a href="https://jena.apache.org/documentation/notes/system-initialization.html">System Initialization</a>
- * <p>
- * <b>This example code predates {@link FusekiModule FusekiModules}.</b>
- */
-@Deprecated
-public class ExFuseki_99_CustomOperation_GlobalDefault {
-
-    static {
-        JenaSystem.init();
-        FusekiLogging.setLogging();
-    }
-
-    // Example usage.
-    public static void main(String...args) {
-
-        // Imitate Service loader behaviour for Jena initialization.
-        new InitFusekiCustomOperation().start();
-
-        FusekiServer.create().port(3230).add("/ds", DatasetGraphFactory.createTxnMem()).build().start();
-
-        callOperation("extra");
-        System.exit(0);
-    }
-
-    private static void callOperation(String name) {
-        String x = HttpOp.httpGetString("http://localhost:3230/ds/"+name);
-        if ( x == null ) {
-            System.out.println("Not found : <null>");
-        } else {
-            System.out.print(x);
-            if ( ! x.endsWith("\n") )
-                System.out.println();
-        }
-    }
-
-    public static class InitFusekiCustomOperation implements JenaSubsystemLifecycle {
-
-        public InitFusekiCustomOperation() {}
-
-        @Override
-        public void start() {
-            // Can use Fuseki server logging.
-            Fuseki.configLog.info("Add custom operation");
-            System.err.println("**** Fuseki extension (global) ****");
-            Operation op = Operation.alloc("http://example/extra-service", "extra-service", "Test");
-            FusekiExt.registerOperation(op, new MyCustomService());
-            FusekiExt.addDefaultEndpoint(op, "extra");
-        }
-
-        @Override
-        public void stop() {}
-
-        @Override
-        public int level() { return 1000; }
-    }
-
-    // For convenience of the example - include the implementation of the custom operation in the same file.
-    private static class MyCustomService extends ActionService {
-
-        // Choose.
-        @Override
-        public void execGet(HttpAction action) {
-            executeLifecycle(action);
-        }
-
-        @Override
-        public void validate(HttpAction action) { }
-
-        @Override
-        public void execute(HttpAction action) {
-            action.setResponseStatus(HttpSC.OK_200);
-            action.setResponseContentType(WebContent.contentTypeTextPlain);
-            try {
-                action.getResponseOutputStream().print("** GET ** "+DateTimeUtils.nowAsXSDDateTimeString());
-            } catch (IOException e) {
-                throw new FusekiException(e);
-            }
-        }
-    }
-}


[jena] 03/05: GH-2033: Move StoreConnection to oaj.tdb1.sys

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git

commit f1e2341804a809baf91a2338df6fd221938d0b70
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Thu Oct 19 18:05:07 2023 +0100

    GH-2033: Move StoreConnection to oaj.tdb1.sys
---
 .../src/main/java/org/apache/jena/fuseki/webapp/SystemState.java  | 2 +-
 jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Backup.java      | 1 +
 jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Factory.java     | 1 +
 .../main/java/org/apache/jena/tdb1/{ => sys}/StoreConnection.java | 8 +++-----
 jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBInternal.java | 1 -
 jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBMaker.java    | 1 -
 .../org/apache/jena/tdb1/transaction/DatasetGraphTransaction.java | 2 +-
 .../java/org/apache/jena/tdb1/setup/TestStoreParamsCreate.java    | 2 +-
 .../java/org/apache/jena/tdb1/store/AbstractStoreConnections.java | 2 +-
 .../apache/jena/tdb1/store/TestLocationLockStoreConnection.java   | 2 +-
 .../org/apache/jena/tdb1/transaction/AbstractTestTransSeq.java    | 2 +-
 .../jena/tdb1/transaction/AbstractTestTransSequentialDisk.java    | 2 +-
 .../java/org/apache/jena/tdb1/transaction/TestTDBInternal.java    | 2 +-
 .../test/java/org/apache/jena/tdb1/transaction/TestTransMem.java  | 2 +-
 .../java/org/apache/jena/tdb1/transaction/TestTransRestart.java   | 2 +-
 15 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
index 1b16a36852..bf7becccb2 100644
--- a/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
+++ b/jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/webapp/SystemState.java
@@ -21,12 +21,12 @@ package org.apache.jena.fuseki.webapp;
 import org.apache.jena.atlas.lib.FileOps;
 import org.apache.jena.fuseki.Fuseki;
 import org.apache.jena.query.Dataset;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1;
 import org.apache.jena.tdb1.TDB1Factory;
 import org.apache.jena.tdb1.base.block.FileMode;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.setup.StoreParams;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.transaction.DatasetGraphTransaction;
 
 /**
diff --git a/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Backup.java b/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Backup.java
index 149e646f95..c5db66071f 100644
--- a/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Backup.java
+++ b/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Backup.java
@@ -27,6 +27,7 @@ import org.apache.jena.query.TxnType;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.tdb1.base.file.Location;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.transaction.DatasetGraphTxn;
 
 /**
diff --git a/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Factory.java b/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Factory.java
index 1b8d84240c..d0fd416510 100644
--- a/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Factory.java
+++ b/jena-tdb1/src/main/java/org/apache/jena/tdb1/TDB1Factory.java
@@ -30,6 +30,7 @@ import org.apache.jena.tdb1.assembler.VocabTDB;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.setup.StoreParams;
 import org.apache.jena.tdb1.store.DatasetGraphTDB;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.TDBInternal;
 import org.apache.jena.tdb1.sys.TDBMaker;
 import org.apache.jena.tdb1.transaction.DatasetGraphTransaction;
diff --git a/jena-tdb1/src/main/java/org/apache/jena/tdb1/StoreConnection.java b/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/StoreConnection.java
similarity index 98%
rename from jena-tdb1/src/main/java/org/apache/jena/tdb1/StoreConnection.java
rename to jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/StoreConnection.java
index 66f460a16b..fd9ca1987c 100644
--- a/jena-tdb1/src/main/java/org/apache/jena/tdb1/StoreConnection.java
+++ b/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/StoreConnection.java
@@ -16,23 +16,21 @@
  * limitations under the License.
  */
 
-package org.apache.jena.tdb1 ;
+package org.apache.jena.tdb1.sys ;
 
 import java.util.HashMap ;
 import java.util.Map ;
 import java.util.Set ;
 
 import org.apache.jena.query.TxnType;
+import org.apache.jena.tdb1.TDB1Exception;
+import org.apache.jena.tdb1.TDB1Factory;
 import org.apache.jena.tdb1.base.file.ChannelManager;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.base.file.LocationLock;
 import org.apache.jena.tdb1.setup.DatasetBuilderStd;
 import org.apache.jena.tdb1.setup.StoreParams;
 import org.apache.jena.tdb1.store.DatasetGraphTDB;
-import org.apache.jena.tdb1.sys.ProcessUtils;
-import org.apache.jena.tdb1.sys.SystemTDB;
-import org.apache.jena.tdb1.sys.TDBInternal;
-import org.apache.jena.tdb1.sys.TDBMaker;
 import org.apache.jena.tdb1.transaction.*;
 
 /** A StoreConnection is the reference to the underlying storage.
diff --git a/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBInternal.java b/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBInternal.java
index f0b6c71952..9d04abe0c9 100644
--- a/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBInternal.java
+++ b/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBInternal.java
@@ -25,7 +25,6 @@ import org.apache.jena.atlas.lib.Lib ;
 import org.apache.jena.graph.Node ;
 import org.apache.jena.query.Dataset ;
 import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1Exception;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.setup.StoreParamsConst;
diff --git a/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBMaker.java b/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBMaker.java
index 1cebcb9d3a..4625697907 100644
--- a/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBMaker.java
+++ b/jena-tdb1/src/main/java/org/apache/jena/tdb1/sys/TDBMaker.java
@@ -21,7 +21,6 @@ package org.apache.jena.tdb1.sys;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1Factory;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.transaction.DatasetGraphTransaction;
diff --git a/jena-tdb1/src/main/java/org/apache/jena/tdb1/transaction/DatasetGraphTransaction.java b/jena-tdb1/src/main/java/org/apache/jena/tdb1/transaction/DatasetGraphTransaction.java
index da88dfc788..660b1cc4bf 100644
--- a/jena-tdb1/src/main/java/org/apache/jena/tdb1/transaction/DatasetGraphTransaction.java
+++ b/jena-tdb1/src/main/java/org/apache/jena/tdb1/transaction/DatasetGraphTransaction.java
@@ -31,13 +31,13 @@ import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.DatasetGraphWrapper;
 import org.apache.jena.sparql.core.Quad;
 import org.apache.jena.sparql.util.Context ;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1;
 import org.apache.jena.tdb1.TDB1Exception;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.store.DatasetGraphTDB;
 import org.apache.jena.tdb1.store.GraphTxnTDB;
 import org.apache.jena.tdb1.store.PrefixMapTDB1;
+import org.apache.jena.tdb1.sys.StoreConnection;
 
 /**
  * A transactional {@code DatasetGraph} that allows one active transaction per thread.
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/setup/TestStoreParamsCreate.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/setup/TestStoreParamsCreate.java
index 6d45395fcd..4822343799 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/setup/TestStoreParamsCreate.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/setup/TestStoreParamsCreate.java
@@ -27,8 +27,8 @@ import org.apache.jena.atlas.json.JSON ;
 import org.apache.jena.atlas.json.JsonObject ;
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.tdb1.ConfigTest;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.base.file.Location;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.junit.After ;
 import org.junit.Before ;
 import org.junit.Test ;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/AbstractStoreConnections.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/AbstractStoreConnections.java
index 18b508b67b..b3138e6827 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/AbstractStoreConnections.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/AbstractStoreConnections.java
@@ -30,10 +30,10 @@ import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;
 import org.apache.jena.tdb1.ConfigTest;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1;
 import org.apache.jena.tdb1.TDB1Factory;
 import org.apache.jena.tdb1.base.file.Location;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.TDBInternal;
 import org.apache.jena.tdb1.transaction.DatasetGraphTxn;
 import org.apache.jena.tdb1.transaction.TDBTransactionException;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/TestLocationLockStoreConnection.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/TestLocationLockStoreConnection.java
index c88e8adab1..cc0ecd6b87 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/TestLocationLockStoreConnection.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/store/TestLocationLockStoreConnection.java
@@ -22,11 +22,11 @@ import java.io.BufferedWriter;
 import java.io.FileWriter;
 import java.io.IOException;
 
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1Exception;
 import org.apache.jena.tdb1.base.file.Location;
 import org.apache.jena.tdb1.base.file.LocationLock;
 import org.apache.jena.tdb1.sys.ProcessUtils;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.BeforeClass;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSeq.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSeq.java
index a1612a8e62..a8f55d420f 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSeq.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSeq.java
@@ -28,9 +28,9 @@ import org.apache.jena.sparql.JenaTransactionException;
 import org.apache.jena.sparql.core.DatasetGraph ;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1Exception;
 import org.apache.jena.tdb1.store.DatasetGraphTDB;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.SystemTDB;
 import org.junit.AfterClass ;
 import org.junit.BeforeClass ;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSequentialDisk.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSequentialDisk.java
index 5b717c70a4..8ccb448a43 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSequentialDisk.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/AbstractTestTransSequentialDisk.java
@@ -21,7 +21,7 @@ package org.apache.jena.tdb1.transaction;
 import java.io.File ;
 
 import org.apache.jena.tdb1.ConfigTest;
-import org.apache.jena.tdb1.StoreConnection;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.TDBInternal;
 import org.junit.After ;
 import org.junit.Before ;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTDBInternal.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTDBInternal.java
index 1930b1c8a8..f06dcc4050 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTDBInternal.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTDBInternal.java
@@ -22,8 +22,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock ;
 
 import org.apache.jena.query.ReadWrite ;
 import org.apache.jena.sparql.core.DatasetGraph ;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.TDB1Factory;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.TDBInternal;
 import org.junit.Assert ;
 import org.junit.Test ;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransMem.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransMem.java
index 2f84223ee7..77a8d80a9a 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransMem.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransMem.java
@@ -18,8 +18,8 @@
 
 package org.apache.jena.tdb1.transaction;
 
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.base.file.Location;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.TDBInternal;
 import org.junit.After ;
 import org.junit.Before ;
diff --git a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransRestart.java b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransRestart.java
index 4d9875d8fa..fe24580522 100644
--- a/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransRestart.java
+++ b/jena-tdb1/src/test/java/org/apache/jena/tdb1/transaction/TestTransRestart.java
@@ -30,7 +30,6 @@ import org.apache.jena.query.TxnType;
 import org.apache.jena.sparql.core.Quad ;
 import org.apache.jena.sparql.sse.SSE ;
 import org.apache.jena.tdb1.ConfigTest;
-import org.apache.jena.tdb1.StoreConnection;
 import org.apache.jena.tdb1.base.block.FileMode;
 import org.apache.jena.tdb1.base.file.FileFactory;
 import org.apache.jena.tdb1.base.file.Location;
@@ -38,6 +37,7 @@ import org.apache.jena.tdb1.base.objectfile.ObjectFile;
 import org.apache.jena.tdb1.setup.DatasetBuilderStd;
 import org.apache.jena.tdb1.store.DatasetGraphTDB;
 import org.apache.jena.tdb1.sys.Names;
+import org.apache.jena.tdb1.sys.StoreConnection;
 import org.apache.jena.tdb1.sys.SystemTDB;
 import org.apache.jena.tdb1.sys.TDBInternal;
 import org.junit.After ;