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 2018/08/20 07:39:02 UTC

[03/19] jena git commit: Typos and comments.

Typos and comments.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/8d0c1310
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/8d0c1310
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/8d0c1310

Branch: refs/heads/master
Commit: 8d0c1310a89c115553889208c97cbdfdfb1958b2
Parents: 09994d2
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Aug 14 13:02:38 2018 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Aug 15 21:34:46 2018 +0100

----------------------------------------------------------------------
 .../org/apache/jena/riot/RDFParserBuilder.java    |  2 +-
 .../jena/fuseki/servlets/ActionService.java       |  3 ++-
 .../apache/jena/fuseki/servlets/SPARQL_Query.java | 18 +++++++++++++++---
 .../fuseki/servlets/ServiceDispatchRegistry.java  | 17 ++++++++++++++---
 .../jena/fuseki/servlets/ServiceRouter.java       | 18 +++++++++++-------
 .../apache/jena/fuseki/embedded/FusekiServer.java |  2 +-
 6 files changed, 44 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/8d0c1310/jena-arq/src/main/java/org/apache/jena/riot/RDFParserBuilder.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParserBuilder.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParserBuilder.java
index 8b59be5..b0a9015 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParserBuilder.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParserBuilder.java
@@ -278,7 +278,7 @@ public class RDFParserBuilder {
     public RDFParserBuilder base(String base) { this.baseUri = base ; return this; }
 
     /** Choose whether to resolve URIs.<br/>
-     *  This does not affect all langages: N-Triples and N-Quads never resolve URIs.<br/>
+     *  This does not affect all languages: N-Triples and N-Quads never resolve URIs.<br/>
      *  Relative URIs are bad data.<br/>
      *  Only set this to false for debugging and development purposes. 
      */ 

http://git-wip-us.apache.org/repos/asf/jena/blob/8d0c1310/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionService.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionService.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionService.java
index 79cc236..a22b097 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionService.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionService.java
@@ -100,7 +100,8 @@ public abstract class ActionService extends ActionBase {
     // Overridden by the ServiceRouter.
     protected Operation chooseOperation(HttpAction action, DataService dataService, String serviceName) {
         // This default implementation is plain service name to operation based on the
-        // DataService as would be used by operation servlets bound by web.xml.
+        // DataService as would be used by operation servlets bound by web.xml
+        // except Fuseki can add and delete mapping while running.
         Endpoint ep = dataService.getEndpoint(serviceName);
         Operation operation = ep.getOperation();
         return operation;

http://git-wip-us.apache.org/repos/asf/jena/blob/8d0c1310/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
index d88a51c..bb81696 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
@@ -267,7 +267,7 @@ public abstract class SPARQL_Query extends SPARQL_Protocol
         try {
             action.beginRead() ;
             Dataset dataset = decideDataset(action, query, queryStringLog) ;
-            try ( QueryExecution qExec = createQueryExecution(query, dataset) ; ) {
+            try ( QueryExecution qExec = createQueryExecution(action, query, dataset) ; ) {
                 SPARQLResult result = executeQuery(action, qExec, query, queryStringLog) ;
                 // Deals with exceptions itself.
                 sendResults(action, result, query.getPrologue()) ;
@@ -285,8 +285,8 @@ public abstract class SPARQL_Query extends SPARQL_Protocol
     }
 
     /**
-     * Check the query - if unacceptable, throw ActionErrorException or call
-     * super.error
+     * Check the query - if unacceptable, throw ActionErrorException 
+     * or call on of the {@link ServletOps#error} operations.
      * @param action HTTP Action
      * @param query  SPARQL Query
      */
@@ -296,11 +296,23 @@ public abstract class SPARQL_Query extends SPARQL_Protocol
      * @param query
      * @param dataset
      * @return QueryExecution
+     * @deprecated Use {@link #createQueryExecution(HttpAction, Query, Dataset)}
      */
+    @Deprecated
     protected QueryExecution createQueryExecution(Query query, Dataset dataset) {
         return QueryExecutionFactory.create(query, dataset) ;
     }
 
+    /** Create the {@link QueryExecution} for this operation.
+     * @param action
+     * @param query
+     * @param dataset
+     * @return QueryExecution
+     */
+    protected QueryExecution createQueryExecution(HttpAction action, Query query, Dataset dataset) {
+        return createQueryExecution(query, dataset);
+    }
+
     /** Perform the {@link QueryExecution} once.
      * @param action
      * @param queryExecution

http://git-wip-us.apache.org/repos/asf/jena/blob/8d0c1310/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceDispatchRegistry.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceDispatchRegistry.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceDispatchRegistry.java
index cc45de4..bbc1eb5 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceDispatchRegistry.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceDispatchRegistry.java
@@ -29,8 +29,14 @@ import org.apache.jena.fuseki.server.DataService;
 import org.apache.jena.fuseki.server.Operation;
 import org.apache.jena.riot.WebContent;
 
-/** 
- * The global mapping of content-type to Operation and operation to implementation.
+/**
+ * Mapping of dispatching operations. {@link Operation} is the operation reference (name)
+ * but the {@link Operation} does not carry the implementation. The registry, which is
+ * per-server, maps:
+ * <ul>
+ * <li>Content-type to {@code Operation}.
+ * <li>{@code Operation} to {@link ActionService} implementation
+ * </ul>
  */
 
 public class ServiceDispatchRegistry {
@@ -94,13 +100,18 @@ public class ServiceDispatchRegistry {
      * Register a new {@link Operation}, with its {@code Content-Type} (may be null,
      * meaning no dispatch by content type), and the implementation handler.
      * <p>
-     * The application needs to enable an operation on a service endpoint. 
+     * The application needs to enable an operation on a service endpoint.
+     * <p>
+     * Replaces any existing registration.  
      */
     public void register(Operation operation, String contentType, ActionService action) {
         Objects.requireNonNull(operation);
         Objects.requireNonNull(action);
         if ( contentType != null )
             contentTypeToOperation.put(contentType, operation);
+        else
+            // Remove any mapping.
+            contentTypeToOperation.values().remove(operation);
         operationToHandler.put(operation, action);
     }
     

http://git-wip-us.apache.org/repos/asf/jena/blob/8d0c1310/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceRouter.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceRouter.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceRouter.java
index 59a5b5c..c54a69b 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceRouter.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ServiceRouter.java
@@ -42,7 +42,7 @@ import org.apache.jena.riot.web.HttpNames;
  * for operations by service endpoint.
  * <p>
  * Normal use is to route all service operations to this servlet via {@link ActionService}.
- * It will route for operations on the dataset and the
+ * It will route for operations on the dataset.
  * <p>
  * It be attached to a dataset location and acts as a router for all SPARQL operations
  * (query, update, graph store, both direct and indirect naming, quads operations on a
@@ -120,10 +120,12 @@ public abstract class ServiceRouter extends ActionService {
             return isEnabled(action, Operation.Quads_RW);
         }
 
-        // Test whether there is a configuration that allows this action as the operation
-        // given.
-        // Ignores the operation in the action (set due to parsing - it might be "quads"
-        // which is the generic operation when just the dataset is specificed.
+        /**
+         * Test whether there is a configuration that allows this action as the operation
+         * given. Ignores the operation in the action which is set due to parsing - it
+         * might be "quads" which is the generic operation when just the dataset is
+         * specificed.
+         */
         private boolean isEnabled(HttpAction action, Operation operation) {
             // Disregard the operation name of the action
             DataService dSrv = action.getDataService();
@@ -137,7 +139,10 @@ public abstract class ServiceRouter extends ActionService {
         super();
     }
 
-    // These calls should not happen because we hook in at executeAction
+    // These calls should not happen because ActionService calls chooseOperation(),
+    // looks that up in the ServiceDispatchRegistry for the servlet context,
+    // then calls executeLifecycle() on that servlet.
+    // These exceptions catch any loops. 
     @Override
     protected void validate(HttpAction action) {
         throw new FusekiException("Call to ServiceRouterServlet.validate");
@@ -201,7 +206,6 @@ public abstract class ServiceRouter extends ActionService {
      * <li>HTTP params (for ?query= and ?update=)</li>
      * <li>Content type</li>
      * </ul>
-     * 
      */
     @Override
     protected Operation chooseOperation(HttpAction action, DataService dataService) {

http://git-wip-us.apache.org/repos/asf/jena/blob/8d0c1310/jena-fuseki2/jena-fuseki-embedded/src/main/java/org/apache/jena/fuseki/embedded/FusekiServer.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-embedded/src/main/java/org/apache/jena/fuseki/embedded/FusekiServer.java b/jena-fuseki2/jena-fuseki-embedded/src/main/java/org/apache/jena/fuseki/embedded/FusekiServer.java
index 09a9a79..2df22e7 100644
--- a/jena-fuseki2/jena-fuseki-embedded/src/main/java/org/apache/jena/fuseki/embedded/FusekiServer.java
+++ b/jena-fuseki2/jena-fuseki-embedded/src/main/java/org/apache/jena/fuseki/embedded/FusekiServer.java
@@ -351,7 +351,7 @@ public class FusekiServer {
         /**
          * Add an operation to the server, together with its triggering Content-Type (may be null) and servlet handler.
          * <p>
-         * To associate an operation with a daatsets, call {@link #addOperation} after adding the dataset. 
+         * To associate an operation with a dataset, call {@link #addOperation} after adding the dataset. 
          *
          * @see #addOperation 
          */