The only thing left - is a connection to the db4o_osgi plug-in. It can be established upon the plug-in start and terminated upon the plug-in stop:
Activator.java: start /** * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(BundleContext) * Obtains a db4o_osgi service reference and registers it with Db4oProvider */ public void start(BundleContext context) throws Exception { super.start(context); ServiceReference serviceRef = context. getServiceReference(Db4oService.class.getName()); Db4oService db4oService = (Db4oService)context.getService(serviceRef); Db4oProvider.Initialize(db4oService); }
Activator.java: stop /** * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(BundleContext) * Unregisters the db4o_osgi service from Db4oProvider */ public void stop(BundleContext context) throws Exception { Db4oProvider.UnInitialize(); plugin = null; super.stop(context); }
Download example code: