Creating your own service

From RifidiWiki

Revision as of 19:43, 26 November 2010 by Matt (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • 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