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:
public class MyComponent
private volatile MongoDatabaseProvider mongoDatabaseProvider;
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.
I have released eUnit version 1.0.0. eUnit is a utility framework to assist with JUnit testing in an OSGi environment. The primary feature available in this first version is a JUnit @Rule for locating an OSGi service. Here is a simple example:
public ServiceLocator<LogService> logServiceLocator = new ServiceLocator<LogService>(LogService.class);
private LogService logService;
public void setUp()
logService = logServiceLocator.getService();
This framework is the result of a large refactoring of my MongoEMF framework. I have split that project into smaller, standalone, projects and I will be releasing additional content over the next couple of months.
I have released MongoEMF version 0.5.1. MongoEMF is a bridge between MongoDB and the Eclipse Modeling Framework making it very easy to store and retrieve instances of EMF objects in MongoDB. This version updates the MongoDB driver to version 2.9.3, support for passing a generic MongoDB query in the URI, and bug fixes. Please see the Release Notes for details.
I’m working on MongoEMF 0.8.0 in the next branch and there will be a fairly significant code refactoring. I’m going to be renaming packages, and splitting code out into multiple projects. This will hopefully be the last major API change before I declare the API stable and release 1.0. I’m still very interested in hooking up a query engine based on Xtext, but currently do not have time to work on this. If you are interested in contributing in this area, or any other part of the project, please let me know.
I have a couple of updates for you on the MongoEMF project. First off, I have released version 0.6.0. This version brings a significant refactoring to the structure of the project to make way for a new query engine. More on this in a bit. I changed all OSGi services to use declarative services (DS), so you will now need to include the appropriate DS bundle for your favorite OSGi container. I also removed lazy bundle activation (Neil will be proud) so you must make sure the org.eclipselabs.mongo and org.eclipselabs.mongo.emf.query.simple bundles get started. Finally, I added the ability for a query to return a cursor instead of materializing all of the objects. Please see the Release Notes for all the details.
The current query engine in MongoEMF has several limitations that need to be overcome. As I mentioned in a previous post, I have proposed a Google Summer of Code project to re-write the query engine using Xtext. Tiger Gui has submitted a student proposal to Google for this project. He has already done some prototyping and the results look very promising. If you are interested in seeing Eclipse accept this project for GSoC, please show your support on the soc-dev mailing list. If you have any feedback on the design of the new query engine, please post to the MongoEMF community forum.
Right now, I’m taking a serious look at the OSGi services in MongoEMF. I’m planning on refactoring them in the next release to include the ability to configure Mongo instances through the OSGi ConfigAdmin. If you have any interest in this area, you feedback is welcome.
Finally, I’m considering proposing MongoEMF as an Eclipse project. I don’t expect to begin the process until we get close to the 1.0 release. Would you, the community, support this project proposal and the move to an Eclipse project?
I have released MongoEMF version 0.5.1. MongoEMF is a bridge between MongoDB and the Eclipse Modeling Framework making it very easy to store and retrieve instances of EMF objects in MongoDB. This version is a maintenance release with bug fixes and minor enhancements. For a complete list of new features, please see the Release Notes. A Google group is now available for community discussions of MongoEMF.
I have released version 0.5.0 of MongoEMF. MongoEMF is a bridge between MongoDB and the Eclipse Modeling Framework making it very easy to store and retrieve instances of EMF objects in MongoDB. This version includes the ability to provide custom data type converters for storing non-native attribute values as a native type in MongoDB. For example, you can now store a Calendar as a long. The code was also refactored into a builder pattern, giving you the ability to completely customize how objects are serialized and deserialized in the database. For a complete list of new features, please see the Release Notes. I have also made some progress on a User Guide. If you have any interest in contributing to this project, please contact me.
The Eclipse Google Summer of Code for 2012 will start coming to life soon, and I have an idea for a project involving Xtext, EMF, and MongoDB. Ed Merks and I have created a project called MongoEMF that allows you to persist EMF objects to MongoDB. MongoEMF has the ability to query objects based on attribute and reference values, but is lacking some functionality and robustness. We think a re-write of the query engine using Xtext and EMF would make for a great Google Summer of Code project. This project has a very well defined scope, is easily unit tested, and involves some pretty cool technology.
The project will consist of two major parts. The first will be to define a query grammar (possibly re-using an existing grammar) using Xtext. The result will be an EMF query model that can be serialized and de-serialized to a string. The string will be used as the query portion of a URI, and must be human readable. For example: mongo://host/db/collection/?(tag == ‘java’ || tag == ‘JSON’) && (category == ‘Eclipse’). Clients will be able to specify the query as string or EMF model. The second part of the project will be to create a processing engine that builds a MongoDB query from the EMF query model. The result will be a DBObject that can be sent to MongoDB as a query.
An example use-case is as follows: A client constructs an EMF query model. The query model is then serialized to a string and included in a URI. The URI is sent to a server in a HTTP GET call. The server extracts the query string from the URI and re-builds the EMF query model. The query model is passed to the query engine and a DBObject is returned containing a MongoDB specific query. The DBObject is sent to MongoDB resulting in some number of DBObjects returned. The resulting DBObjects are converted into EMF objects and returned to the client.
The student is expected to develop extensive unit tests for his / her code as well as end-user documentation. Documentation will be contributed to the UserGuide on the MongoEMF wiki. We also anticipate that the student will become a committer on MongoEMF, and will continue to provide bug fixes and enhancements after the project is complete.
We consider this to be an advanced Eclipse project. The student should already be comfortable coding in Java and developing OSGi bundles with Eclipse. A student with working knowledge of EMF will be preferred, but you are not required to already know Xtext or MongoDB. If you are interested in this project, I would recommend forking the MongoEMF project on GitHub and experimenting with the latest code in the master branch. Instructions for setting up your environment can be found on the Development wiki page. If you have any questions, please comment on this post.
This project idea will be included on the Eclipse Google Summer of Code wiki soon.