You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by "afs (via GitHub)" <gi...@apache.org> on 2024/11/15 19:31:31 UTC

[PR] Customize Fuseki main arguments [jena]

afs opened a new pull request, #2845:
URL: https://github.com/apache/jena/pull/2845

   GitHub issue resolved #2753
   
   ----
   
    - [x] Tests are included.
    - [ ] Documentation change and updates are provided for the [Apache Jena website](https://github.com/apache/jena-site/)
    - [ ] Commits have been squashed to remove intermediate development commit messages.
    - [x] Key commit messages start with the issue number (GH-xxxx)
   
   By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the [Contributor's Agreement](https://www.apache.org/licenses/contributor-agreements.html).
   
   ----
   
   See the [Apache Jena "Contributing" guide](https://github.com/apache/jena/blob/main/CONTRIBUTING.md).
   


-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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


Re: [PR] GH-2753: Customize Fuseki main arguments [jena]

Posted by "kinow (via GitHub)" <gi...@apache.org>.
kinow commented on code in PR #2845:
URL: https://github.com/apache/jena/pull/2845#discussion_r1847296121


##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/DSGSetup.java:
##########
@@ -46,40 +61,78 @@
 
         if ( IO.isEmptyDirectory(directory) ) {
             if ( useTDB2 )
-                setupTDB2(directory, serverConfig);
+                setupTDB2(log, directory, serverArgs);
             else
-                setupTDB1(directory, serverConfig);
+                setupTDB1(log, directory, serverArgs);
             return;
         }
 
         // Exists, not empty or does not exist
         if ( TDBOps.isTDB1(directory) ) {
-            setupTDB1(directory, serverConfig);
+            setupTDB1(log, directory, serverArgs);
             return;
         } else if ( TDBOps.isTDB2(directory) ) {
-            setupTDB2(directory, serverConfig);
+            setupTDB2(log, directory, serverArgs);
             return;
         } else
             throw new CmdException("Directory not a database: " + directory);
     }
 
-    private static void setupTDB1(String directory, ServerConfig serverConfig) {
-        serverConfig.datasetDescription = "TDB1 dataset: location="+directory;
-        serverConfig.dsg = TDB1Factory.createDatasetGraph(directory);
+    private static void setupTDB1(Logger log, String directory, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "TDB1 dataset: location="+directory;
+        serverArgs.dsg = TDB1Factory.createDatasetGraph(directory);
     }
 
-    private static void setupTDB2(String directory, ServerConfig serverConfig) {
-        serverConfig.datasetDescription = "TDB2 dataset: location="+directory;
-        serverConfig.dsg = DatabaseMgr.connectDatasetGraph(directory);
+    private static void setupTDB2(Logger log, String directory, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "TDB2 dataset: location="+directory;
+        serverArgs.dsg = DatabaseMgr.connectDatasetGraph(directory);
     }
 
-    public static void setupMemTDB(boolean useTDB2, ServerConfig serverConfig) {
+    /*package*/ static void setupMemTDB(Logger log, boolean useTDB2, ServerArgs serverArgs) {
         String tag = useTDB2 ? "TDB2" : "TDB1";
-        serverConfig.datasetDescription = tag+" dataset in-memory";
-        serverConfig.dsg = useTDB2
+        serverArgs.datasetDescription = tag+" dataset in-memory";
+        serverArgs.dsg = useTDB2
             ? DatabaseMgr.createDatasetGraph()
             : TDB1Factory.createDatasetGraph();
-        serverConfig.allowUpdate = true;
+        serverArgs.allowUpdate = true;
+    }
+
+    /*package*/ static void setupMem(Logger log, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "in-memory";
+        serverArgs.dsg = DatasetGraphFactory.createTxnMem();
+        serverArgs.allowUpdate = true;
+    }
+
+    /*package*/ static void setupFile(Logger log, List<String> filenames, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "in-memory, with files loaded";
+        serverArgs.dsg = DatasetGraphFactory.createTxnMem();
+
+        for(String filename : filenames ) {

Review Comment:
   s/for(/for (/ ?



-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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


Re: [PR] GH-2753: Customize Fuseki main arguments [jena]

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on code in PR #2845:
URL: https://github.com/apache/jena/pull/2845#discussion_r1848745146


##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/cmds/DSGSetup.java:
##########
@@ -46,40 +61,78 @@
 
         if ( IO.isEmptyDirectory(directory) ) {
             if ( useTDB2 )
-                setupTDB2(directory, serverConfig);
+                setupTDB2(log, directory, serverArgs);
             else
-                setupTDB1(directory, serverConfig);
+                setupTDB1(log, directory, serverArgs);
             return;
         }
 
         // Exists, not empty or does not exist
         if ( TDBOps.isTDB1(directory) ) {
-            setupTDB1(directory, serverConfig);
+            setupTDB1(log, directory, serverArgs);
             return;
         } else if ( TDBOps.isTDB2(directory) ) {
-            setupTDB2(directory, serverConfig);
+            setupTDB2(log, directory, serverArgs);
             return;
         } else
             throw new CmdException("Directory not a database: " + directory);
     }
 
-    private static void setupTDB1(String directory, ServerConfig serverConfig) {
-        serverConfig.datasetDescription = "TDB1 dataset: location="+directory;
-        serverConfig.dsg = TDB1Factory.createDatasetGraph(directory);
+    private static void setupTDB1(Logger log, String directory, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "TDB1 dataset: location="+directory;
+        serverArgs.dsg = TDB1Factory.createDatasetGraph(directory);
     }
 
-    private static void setupTDB2(String directory, ServerConfig serverConfig) {
-        serverConfig.datasetDescription = "TDB2 dataset: location="+directory;
-        serverConfig.dsg = DatabaseMgr.connectDatasetGraph(directory);
+    private static void setupTDB2(Logger log, String directory, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "TDB2 dataset: location="+directory;
+        serverArgs.dsg = DatabaseMgr.connectDatasetGraph(directory);
     }
 
-    public static void setupMemTDB(boolean useTDB2, ServerConfig serverConfig) {
+    /*package*/ static void setupMemTDB(Logger log, boolean useTDB2, ServerArgs serverArgs) {
         String tag = useTDB2 ? "TDB2" : "TDB1";
-        serverConfig.datasetDescription = tag+" dataset in-memory";
-        serverConfig.dsg = useTDB2
+        serverArgs.datasetDescription = tag+" dataset in-memory";
+        serverArgs.dsg = useTDB2
             ? DatabaseMgr.createDatasetGraph()
             : TDB1Factory.createDatasetGraph();
-        serverConfig.allowUpdate = true;
+        serverArgs.allowUpdate = true;
+    }
+
+    /*package*/ static void setupMem(Logger log, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "in-memory";
+        serverArgs.dsg = DatasetGraphFactory.createTxnMem();
+        serverArgs.allowUpdate = true;
+    }
+
+    /*package*/ static void setupFile(Logger log, List<String> filenames, ServerArgs serverArgs) {
+        serverArgs.datasetDescription = "in-memory, with files loaded";
+        serverArgs.dsg = DatasetGraphFactory.createTxnMem();
+
+        for(String filename : filenames ) {

Review Comment:
   Fixed.



-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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


Re: [PR] GH-2753: Customize Fuseki main arguments [jena]

Posted by "rvesse (via GitHub)" <gi...@apache.org>.
rvesse commented on code in PR #2845:
URL: https://github.com/apache/jena/pull/2845#discussion_r1848576525


##########
jena-fuseki2/jena-fuseki-main/src/main/java/org/apache/jena/fuseki/main/sys/FusekiModules.java:
##########
@@ -23,16 +23,51 @@
 import java.util.function.Consumer;
 
 /**
- * List of {@linkplain FusekiModule Fuseki modules}.
- * This is the immutable group of modules for a server.
+ * A collection of {@linkplain FusekiModule Fuseki modules}.
  * <p>
+ * There is one specific collection of modules - a system wide set of modules.
+ * This collection defaults to the automatically discovered modules {@link FusekiAutoModules#load()}.
+ *
  * @see FusekiAutoModules
  */
 public class FusekiModules {
 
+    private static FusekiModules autoLoadedFusekiModules = FusekiAutoModules.get();
+    // Never null, maybe empty
+    private static FusekiModules systemFusekiModules = autoLoadedFusekiModules;
+
+    /**
+     * There is a system wide set of modules used when o other are indicated.

Review Comment:
   ```suggestion
        * There is a system wide set of modules used when no other are indicated.
   ```



-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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


Re: [PR] GH-2753: Customize Fuseki main arguments [jena]

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on PR #2845:
URL: https://github.com/apache/jena/pull/2845#issuecomment-2486853713

   > Looks good to me, and looking at the test cases this covers all the scenarios that motivated my original ticket #2753
   
   There a few niggles in the command argument processing that could be improved and the overall system assumes a degree of cooperation between elements not to tread on each other. These are best dealt with from experience.
   
   Please do let us know how using it goes.


-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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


Re: [PR] GH-2753: Customize Fuseki main arguments [jena]

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs merged PR #2845:
URL: https://github.com/apache/jena/pull/2845


-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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


Re: [PR] GH-2753: Customize Fuseki main arguments [jena]

Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on PR #2845:
URL: https://github.com/apache/jena/pull/2845#issuecomment-2486867795

   Apologies - I forgot to push the fixes mentioned above. I'll include them in an args clearup PR.


-- 
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.

To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org

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