vendredi 27 février 2015

Embedded OSGi: accessing dynamically loaded bundle components



I'm getting a little lost when dealing with embedding OSGi into an application/library, loading a bundle at runtime and then using that bundle in the host application/library.


This is code to load the bundle from my host:



// framework is the embedded OSGi framework
Bundle b = framework.getBundleContext().installBundle( "file:/project_dir/bundle/MyBundle.jar" );
b.start();


And the bundle consists of something really simple:



public class Activator implements BundleActivator
{
@Override
public void start( BundleContext context )
{
}

@Override
public void stop( BundleContext context )
{
}

public String shout()
{
return "let it all out";
}
}


How would I access the shout() method from the host application?




Aucun commentaire:

Enregistrer un commentaire