Db4o-Osgi Usage

db4o-osgi service can be accessed like any other OSGI service:

ServiceReference serviceRef = _context.getServiceReference(Db4oService.class.getName());

Db4oService db4oService = (Db4oService)_context.getService(serviceRef);

db4o-osgi uses Bundle-ActivationPolicy:lazy header to define the lazy bundle loading policy (only utilized in some environments, like Eclipse).

Db4oService instance can be used as Db4o class in usual environment:

Configuration config = db4oService.newConfiguration();

ObjectContainer db = db4oService.openFile(config, filename);

Also available are methods for opening db4o server and client. For more information see the API documentation.

Once the service instance is obtained, you can continue to work with db4o API as usual.

Installation in Eclipse

  1. Put the db4o osgi jar file on eclipse/plugins folder
  2. Start/restart Eclipse
  3. While on Eclipse switch from the "Package Explorer" tab to the "Plug-ins" tab
  4. Find the db4o bundle (should be listed there), right click on it and select "Import As" -> "Source Project"