You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by GitBox <gi...@apache.org> on 2021/11/01 13:38:20 UTC

[GitHub] [jena-site] afs commented on a change in pull request #73: Documentation for Fuseki Modules

afs commented on a change in pull request #73:
URL: https://github.com/apache/jena-site/pull/73#discussion_r740216511



##########
File path: source/documentation/fuseki2/fuseki-modules.md
##########
@@ -0,0 +1,117 @@
+---
+title: Fuseki Modules
+---
+
+<em>Fuseki modules</em> are a mechniam to include extension code into a Fuseki
+server. Modules are invoked during the process of building a [Fuseki
+Main](./fuseki-main.html) server. The module can modify the server
+configuration, add new functiomnality, or react to a server being built and
+started.
+
+Fuseki Modules are loaded use the JDK
+[ServiceLoader](https://www.baeldung.com/java-spi) by being placing a jar file on the classpath,
+together with any additional dependencies. The service loader looks for files
+`META-INF/services/org.apache.jena.fuseki.main.sys.FusekiModule` in the jar
+file.
+This is often done by placing the file in the development code in
+`src/main/resources/META-INF/services/`).
+The file containing a line with the implementation full class name. If
+[repacking](../notes/jena-repack.html) Fuseki with the maven-shade-plugin, make
+sure the `ServicesResourceTransformer` is used. The module must have a no
+argument constructor.
+
+If using Fuseki as an [embedded server](./fuseki-embedded.html), the module is
+added in code as:
+
+```
+    FusekiModule module = new MyModule();
+    FusekiModules.add(module);
+```
+
+The method `start` is called when the module is loaded. Custom operations can
+be globally registered at this point (see the [Fuseki
+examples](https://github.com/apache/jena/tree/main/jena-fuseki2/jena-fuseki-main/src/test/java/org/apache/jena/fuseki/main/examples) directory).
+
+The module lifecycle during creating a Fuseki server is:
+
+* `configuration` - access and modify the setup. 
+  This is called after the server has been configured, just before the server is built.
+* `server` - access the built server
+* `serverBeforeStarting` - about to call "server.start()"
+* `serverAfterStarting` - just after calling "server.start()"
+* `serverStopped` - called as the server stop 
+  (note, this is not always called because a server can simply exit the JVM).
+
+A Fuseki module does not need to implement all these steps, the default for all
+of them is "do nothing". Usually, an extension will only be interested in
+certain stpes, like the configuration and registry information of
+`configuration`.
+
+During the configuration step, the Fuskei configuration file for the server is
+available. If the server is built prorgammatically without a configuration file,

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: dev-unsubscribe@jena.apache.org

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