Hi David,

TopBraid Composer, and EDG versions prior to 7.0, were built on Eclipse and 
OSGi. With the EDG 7.x series of releases, we are transitioning off this 
technology foundation. This requires changes to the way extensions are done. 
The transition process is not complete, and our developer documentation is 
somewhat behind.

> On 25 Nov 2021, at 06:45, David Habgood <[email protected]> 
> wrote:
> 
> Before I continue with the above, I wanted to ask more generally, assuming I 
> may use EDG Studio and not eclipse going forward, and that the functions 
> would ultimately be deployed on a server instance, what would the recommended 
> approach be for integrating these functions?




For both Composer and EDG Studio, it is now necessary to create an instance of 
org.topbraid.core.PluginActivator that registers the SPARQL function in the 
activate() method. For example:

    public class MyPluginActivator implements PluginActivator {
        @Override
        public void activate() {
            FunctionRegistry.get().put("http://example.org/ns#myFunction";, 
MyFunction.class);
        }
    }

This method will be called during system startup. Any other initialisation code 
may be placed there as well. An optional deactivate() method for shutdown can 
also be provided.


Making this work in Composer 7.0 and 7.1:

The plugin activator, SPARQL function implementation, and any other supporting 
Java code and jar files need to be packaged in an Eclipse plugin. The plugin 
activator needs to be announced in the plugin.xml file using the 
org.topbraid.core.pluginActivators extension point, for example:

    <plugin>
        <extension point="org.topbraid.core.pluginActivators">
            <activator class="org.example.MyPluginActivator"/>
        </extension>
    </plugin>

Note that these plugin activators are *not* OSGi/Eclipse bundle activators. 
They are our own homegrown mechanism for a similar purpose.

The Eclipse plugin needs to be placed in Composer's dropins folder. When 
Composer is running, the list of installed Eclipse plugins can be reviewed in 
the “About TopBraid Composer ME” window under “Installation Details” to verify 
that the plugin has been discovered.


Making this work in EDG Studio 7.1:

Plugin activator, SPARQL function implementation and any other supporting Java 
code need to be packaged in a normal jar file, and the plugin activator needs 
to be announced using Java's ServiceLoader mechanism. This means adding a file 
META-INF/services/org.topbraid.core.PluginActivator to the jar file, with its 
contents being the qualified class name of the plugin activator:

    org.example.MyPluginActivator

The jar file should include one of the strings "edg", "topbraid" or "tq" in the 
name to mark it as an EDG extension. The jar file, along with any other 
required library jar files, needs to be placed in EDG Studio's lib directory.

If EDG Studio is launched with --verbose, all plugin activators are listed on 
the console during startup, so this is a way of verifying that it is being 
found. After startup, this information can also be viewed under Server 
Administration > Startup Sequence.


Making this work in production EDG 7.0 and 7.1 on Tomcat:

A jar file built for EDG Studio will work in production EDG. To deploy it, 
place it, along with any other required library jar files, in the WEB-INF/lib 
subdirectory within the directory where edg.war is unpacked, e.g., 
webapps/edg/WEB-INF/lib.

All found plugin activators are listed in the edg.log during startup. After 
startup, this information can also be viewed under Server Administration > 
Startup Sequence.


Hope this helps,
Richard

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/25479A07-77F7-4CC0-8B70-3A1A95DC5078%40topquadrant.com.

Reply via email to