Ok, I kind-of expected problems like this. OSGI classloader issues are quite complex and very hard to get right. As a first step I assume you have added some test log print code to verify that your plugin is called at all?

My more general preference would be to move away from Java-based extensions. Could you summarize why Java is needed in your case, or whether the same results could be achieved through some other means, in particular JavaScript?

Thanks,
Holger


On 23/02/2017 19:47, Oleksandr Mandryk wrote:
Hi Hogler,
thank you for the reply.
My plugin.xml looks like this:

|
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
 point="org.topbraid.core.pluginActivators">
      <activator
class="com.my.ExportToHIXFunctionPluginActivator">
      </activator>
      <function
class="com.my.ExportToHIX"
uri="http://my.com/functions#exportToHIX";>
      </function>
   </extension>

</plugin>
|

Generated Bundle Activator:
|
public class Activator implements BundleActivator {
private BundleContext context;

@Override
public void start(BundleContext context) throws Exception {
System.out.println("Starting Bundle: ExportToHIX");
this.context = context;
}

@Override
public void stop(BundleContext arg0) throws Exception {
System.out.println("Stopping Bundle: ExportToHIX");
this.context = null;
}
}
|

And Function Registration:
|
import org.apache.jena.sparql.function.FunctionRegistry;
import org.topbraid.core.activator.IPluginActivator;

public class ExportToHIXFunctionPluginActivator implements IPluginActivator {

private static final String EXPORT_TO_HIX_ID = "http://my.com/functions#exportToHIX";;
@Override
public void activate() {
FunctionRegistry.get().put(EXPORT_TO_HIX_ID, ExportToHIX.class);
}
}
|

Function class:
|
import org.apache.jena.sparql.expr.NodeValue;
import org.apache.jena.sparql.function.FunctionEnv;
import org.topbraid.spin.arq.AbstractFunction0;

public class ExportToHIX extends AbstractFunction0 {

@Override
protected NodeValue exec(FunctionEnv arg0) {
return NodeValue.makeString("Hello World Custom Java Function");
}

}

|

Manifest file:

|
Manifest-Version:1.0
Bundle-ManifestVersion:2
Bundle-Name:MyBundle
Bundle-SymbolicName:com.my.functions;singleton:=true
Bundle-Version:0.0.1
Bundle-Activator:com.my.functions.Activator
Bundle-RequiredExecutionEnvironment:JavaSE-1.8
Import-Package:org.osgi.framework;version="1.3.0"
Bundle-Vendor:ME
Require-Bundle:org.eclipse.core.runtime,org.topbraid.lib.jena,org.topbraid.core,org.topbraid.spin
|

I've tried to put ExportToHIXFunctionPluginActivator instead of Activator to the manifest file, but it didn't help.

On Thursday, February 23, 2017 at 10:33:15 AM UTC+1, Holger Knublauch wrote:

    Could you share the plugin.xml file? If the function is not
    registered you could also try to register it through a bundle
    activator.

    Holger


    Sent from my iPad

    On 22 Feb 2017, at 23:04, Oleksandr Mandryk <[email protected]
    <javascript:>> wrote:

    Hi,

    I've created a test Equinox plugin using this guide:
    TBC > Help > Help Contents > TopBraid Composer > Extending
    TopBraid Suite

    It works fine when I run it using "*Launch an Eclipse
    application"* in TBC.

    I would like to use my exposed function in EVN so I've created
    OSGi bundle from this project
    by using maven-jar-plugin plugin:
    |
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.0.2</version>
    <configuration>
    <archive>
    <manifestFile>META-INF/MANIFEST.MF</manifestFile>
    </archive>
    </configuration>
    </plugin>
    |


    after restarting Tomcat I can see my bundle with the status
    RESOLVED in the EVN's list of OSGi bundles,
    but my function doesn't work in EVN and I've noticed the warning
    in logs:
    [TopBraid Warning] 2017-02-22T10:50:22+0000 -
    org.topbraid.eclipsex:  WARN [http-nio-8080-exec-4]
    (E_Function.java:89) - URI <http://my.com/functions#exportToHIX
    <http://my.com/functions#exportToHIX>> has no registered function
    factory

    Could you tell me please what I'm doing wrong?

    Thank you.

    Best regards,
    Oleksandr Mandryk

-- You received this message because you are subscribed to the
    Google Group "TopBraid Suite Users", the topics of which include
    the TopBraid Suite family of products and its base technologies
    such as SPARQLMotion, SPARQL Web Pages and SPIN.
    To post to this group, send email to [email protected]
    <javascript:>
    ---
    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] <javascript:>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.

--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include the TopBraid Suite family of products and its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
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] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid 
Suite Users", the topics of which include the TopBraid Suite family of products and 
its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- 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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to