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.
Difference between revisions of "Corona management framework access"
(New page: !!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 i...) |
|||
Line 29: | Line 29: | ||
</pre></code> | </pre></code> | ||
The <code>ContributionManager</code> instance defined by <code>manager</code> provides the entry point into the Management runtime. | The <code>ContributionManager</code> instance defined by <code>manager</code> provides the entry point into the Management runtime. | ||
+ | |||
+ | [[Corona_HowTo_Management_Annotations|Return to Tutorial]] |
Revision as of 09:44, 30 April 2007
!!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="your.sample.Component" immediate="true" >
<implementation class="your.sample.ComponentImpl" />
<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 your.sample.ComponentImpl
:
private ContributionManager manager;
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 ContributionManager
instance defined by manager
provides the entry point into the Management runtime.