Difference between revisions of "Creating your own service"

From RifidiWiki

Jump to: navigation, search
(New page: ==Define your service== * create a new OSGi Bundle. * First create an interface for your service. * Implement the interface. * Register the service in the activator: public void start(Bun...)
 
(Define your service)
Line 1: Line 1:
 
==Define your service==
 
==Define your service==
 
* create a new OSGi Bundle.
 
* create a new OSGi Bundle.
* First create an interface for your service.
+
* Create an interface for your service.
 
* Implement the interface.
 
* Implement the interface.
 
* Register the service in the activator:
 
* Register the service in the activator:

Revision as of 22:07, 3 June 2008

Define your service

  • create a new OSGi Bundle.
  • Create an interface for your service.
  • Implement the interface.
  • Register the service in the activator:
public void start(BundleContext context) throws Exception {
	super.start(context);
	plugin = this;
	context.registerService(CablingService.class.getName(),
				new CablingServiceImpl(), null);
}

And that's it. Your service is available as soon as the first class from your bundle is loaded.

Personal tools