Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Corona management framework access
Revision as of 10:22, 30 April 2007 by Unnamed Poltroon (Talk)
!!Obtaining the Management Enabling environment!!
The Management runtime is exposed as a service in the OSGi environment. The easiest way to obtain a reference to the Management service is to use declarative services. A sample declartive service description that specifies a dependency on the Management environment and a WSDM management binding is given below:
<component name="SimpleJavaObject" immediate="true" >
<implementation class="org.eclipse.corona.wsdm.example.SimpleJavaObject" />
<reference name="ContributionManager" interface="org.eclipse.corona.management.common.ContributionManager" cardinality="1..1" policy="static" />
<reference name="WSDM" interface="org.eclipse.corona.management.binding.Binding" cardinality="1..1" policy="static" target="(provider=WSDM)"/>
</component>
The following code would then be place in org.eclipse.corona.wsdm.example.SimpleJavaObject
:
package org.eclipse.corona.wsdm.example;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
import org.eclipse.corona.management.common.ContributionManager;
public class SimpleJavaObject {
ContributionManager manager;
//Declarative Services methods
protected void activate(ComponentContext ctx)
{
ServiceReference ref = ctx.getBundleContext().getServiceReference(ContributionManager.class.getName());
manager = (ContributionManager)ctx.getBundleContext().getService(ref);
}
protected void deactivate(ComponentContext ctxt)
{
manager.remove(this);
}
//The rest of the class properties and operations
}
The ContributionManager
instance defined by manager
provides the entry point into the Management runtime.