I have released eMongo version 1.0.0. eMongo provides a set of OSGi services for interfacing to MongoDB. The main advantage to using eMongo is in an enterprise environment where you would like to configure your database parameters like hostname, user, password, etc without having to re-deploy your server. eMongo services utilize the OSGi metatype service which, when combined with the Apache Felix Web Console, gives the administrator a convenient UI for configuring the MongoDB driver. Access to a MongoDB database is split between two services: one for the client connection, and one for the database. Here is the configuration through the web console:
Once the client connection is configured, you may configure one or more databases attached to that client:
The developer API is very simple. Here is an example of an OSGi component accessing a MongoDB database:
@Component
public class MyComponent
{
private volatile MongoDatabaseProvider mongoDatabaseProvider;
@Activate
public void activate()
{
DB database = mongoDatabaseProvider.getDB();
DBCollection collection = database.getCollection("items");
...
}
@Reference(unbind = "-", target = "(alias=primary)")
public void bindMongoDatabaseProvider(MongoDatabaseProvider mongoDatabaseProvider)
{
this.mongoDatabaseProvider = mongoDatabaseProvider;
}
}
There are a few additional features like a service for creating a sequential record ID, and a JUnit rule for unit testing. For more information, please see the eMongo Wiki.