You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/11/03 16:58:09 UTC

[GitHub] [jena] afs commented on a change in pull request #822: Add Fuseki /$/compact/* endpoint (JENA-1987)

afs commented on a change in pull request #822:
URL: https://github.com/apache/jena/pull/822#discussion_r516813995



##########
File path: jena-fuseki2/jena-fuseki-webapp/pom.xml
##########
@@ -56,6 +56,12 @@
       <artifactId>jena-text</artifactId>
       <version>3.17.0-SNAPSHOT</version>
     </dependency>
+    
+    <dependency>
+        <groupId>org.apache.jena</groupId>
+        <artifactId>jena-tdb2</artifactId>
+        <version>3.17.0-SNAPSHOT</version>
+    </dependency>

Review comment:
       core has a dependency on jena-tdb2 via apache-jena-libs.
   
   I also check by adding a call to `DatabaseMgr.compact` in a class jena-fuseki-webapp.
   
   `(cd jena-fuseki-webapp ; mvn dependency:tree)` on the default branch of the codebase gives me:
   ```
   [INFO] org.apache.jena:jena-fuseki-webapp:jar:3.17.0-SNAPSHOT
   [INFO] +- org.apache.jena:jena-fuseki-core:jar:3.17.0-SNAPSHOT:compile
   [INFO] |  +- org.apache.jena:apache-jena-libs:pom:3.17.0-SNAPSHOT:compile
   [INFO] |  |  +- org.apache.jena:jena-shacl:jar:3.17.0-SNAPSHOT:compile
   [INFO] |  |  |  \- org.apache.jena:jena-arq:jar:3.17.0-SNAPSHOT:compile
   [INFO] |  |  +- org.apache.jena:jena-tdb:jar:3.17.0-SNAPSHOT:compile
   [INFO] |  |  +- org.apache.jena:jena-tdb2:jar:3.17.0-SNAPSHOT:compile
   ```

##########
File path: jena-fuseki2/jena-fuseki-webapp/src/main/java/org/apache/jena/fuseki/mgt/ActionCompact.java
##########
@@ -0,0 +1,69 @@
+/**
+ * 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.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.apache.jena.tdb2.DatabaseMgr;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ActionCompact extends ActionAsyncTask
+{
+    public ActionCompact() { super("Compact"); }
+
+    @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;
+        }
+

Review comment:
       Maybe test it is the right species of DatrasetGraph and return an error if it is not.
   
   See `TDBOps` in fuseki-core.

##########
File path: jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/FusekiServer.java
##########
@@ -1021,6 +1021,7 @@ private void servletsAndFilters(ServletContextHandler context) {
                 addServlet(context, "/$/stats/*", new ActionStats());
             if ( withMetrics )
                 addServlet(context, "/$/metrics", new ActionMetrics());
+            // TODO Should we support registering other functionality e.g. /$/backup/* and /$/compact/*

Review comment:
       There are a couple of big issues here.
   
   1. Security. So far fuseki-main additional operations under `/$/`are "mostly harmless" but this is a step more impactful.
   1. The general area of admin for Fuseki/main where my concern is that we are building in a URL pattern and _maybe_ a better design is add it as a service on the `/myTDB2dataset/compact`.
   
   Suggestion: add this admin function now for fuseki-webapp and fuseki-main later.
   
   Let's discuss on the JIRA ticket as it is not about the jena-webapps code which looks fine.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org