Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Jena's initialization mechanism for subsystems #39

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eu.ostrzyciel.jelly.convert.jena.riot.JellySubsystemLifecycle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ object JellyLanguage:
/**
* Register the Jelly language and formats in Jena.
*
* This method is idempotent and should be called automatically when the class is loaded.
* This method is idempotent and should be called automatically when Jena is initialized.
* See: https://jena.apache.org/documentation/notes/system-initialization.html
* However, you may also want to call this manually if Jena doesn't load the language automatically.
*/
def register(): Unit = this.synchronized {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package eu.ostrzyciel.jelly.convert.jena.riot

import org.apache.jena.sys.JenaSubsystemLifecycle

/**
* Subsystem lifecycle for registering the Jelly language in Jena.
* See: https://jena.apache.org/documentation/notes/system-initialization.html
*/
class JellySubsystemLifecycle extends JenaSubsystemLifecycle:
override def start(): Unit = JellyLanguage.register()

override def stop(): Unit = ()

// "Application code should use level above 500."
// Not clear whether the plugins should use > 500 or < 500...
// Let's use 501, this should make Jelly load before the other application subsystems.
override def level() = 501