eMongo 1.0.0 Released

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:

Client config

Once the client connection is configured, you may configure one or more databases attached to that client:

Db config

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.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s