0

I am new to OSGI ,I have just manged to Implement Host and Consumer services bundles and Checked how they worked.Bundles are now at Active State.But I have another application which is not a OSGI type of application.It is a standard Java Application.Now my confusion are,

  1. How can we refer those OSGI bundles in this Java Project(I am using Eclipse.Can i refer as i refer Normal Jar files?).
  2. How can we call a service method when a Host and Consumer service are active?

I can just learned that normally services can be accessed in Activator's Start method by getting references.But After Service is successfully started , Start event is not going to triggered again. So this time how can we explicitly call Services when bundle are at Active state ?Eclipse is automatically creating following Static reference and static getContext() method when we create the OSGI Project.Can i supposed to use this static getContext() to achieve my goal?

Eclipse Auto created code

private static BundleContext context;

static BundleContext getContext() 
{   
    return context;
}

public void start(BundleContext bundleContext) throws Exception 
{
    Activator.context = bundleContext;
}
4

0 回答 0