MongoEMF Update

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?


16 thoughts on “MongoEMF Update

  1. Glad to see we are now using DS. Have been building functionality on the 0.5. release, so I’ll go back in today and update my existing work to use the new 0.6.0. Will give feedback as I go along.

    Interesting that your looking at configAdmin. This is an area that I have done a good bit of work in especially with regards to Declarative Services, Metatype and Monitorable services (also WireAdmin but that is another story). Have leveraged this to the point of implementing a fairly comprehensive Eclipse editor for configurations and and a monitoring view as well as utilities for config export and loading using standard metatype documents. My work on top of MongoEMF utilizes this approach, which allows the user to configure one or multiple connections to MongoEMF. IMHO Metatype has got to be one of the most function yet unknown features of OSGi. Will start a thread in the MongoEMF group about it.

    I’m already using the code so +1 to support this effort as an Eclipse project.

  2. Hi Bryan,
    I like this idea a lot 🙂
    Do you have a simple hello world style sample without the declarative services etc ?

    Thanks for help.

    • I do not have any examples without declarative services. One could be crafted using an Activator and a ServiceTracker, but why would you do that when you can use a declarative service?

      • Hi Bryan,

        I am working in a equinox (eclipse) environment and at first shot, I want to just set the example and understand how it works. Later perhaps if I want to use it then I would definitely go for OSGi service approach. But downloading the example and running without any change and running it using the launchers did not really work for me. Any suggestions ?

        Thanks for help

      • The example, assuming you are using version 0.7.0) requires OSGi declarative services. The service implementations are package private, so there is no way to manually stitch together the necessary services like you could with the older versions of MongoEMF. The launcher should work provided your target platform is set up correctly. Some of the services require configuration which you can do through the Felix Webconsole or using the local configurator bundle. If you launch with the OSGi console, you can use “ss” to see the state of the bundles and “ls” to see the state of the services. Those two commands can be very useful when debugging services and why they have not been started.

  3. Thank you for the reply.

    I tried this way but no success. here’s what I did.

    1. I downloaded 0.7.0 zip file and imported the ‘bundles’ into my eclipse (juno).
    2. I did not have the required ‘hamcrest'(1.3) library so I modified the ‘org.eclipselabs.mongo.emf.developer.junit’ bundle to import 1.1 instead.
    3. I updated the launch configuration to include

    When I do the above, I can see the OSGi console for a second but immediately after that the execution is terminated. Am i missing something ?

    Thanks for help.

    • When launching, I recommend using the command line option -consoleLog and using the VM argument -Declipse.ignoreApp=true. The output of the console log might be helpful.

      • Log was not very useful.

        I tried to create an activator for the example bundle and put the code in the start of the activator. It appears that the binding operation is not succesfull. The ‘resourceSetFactory’ is throwing null.

      • Most likely your problem is either a missing bundle, a bundle not starting, or a missing configuration. The output of “ss” and “ls” from the console would be useful.

  4. I tried to get the service from bundleContext as below
    ServiceReference serviceRef = context.getServiceReference(“org.eclipselabs.mongo.emf.ext.IResourceSetFactory”); which is returning null.

    Below is the output from ss and ls.
    osgi> ss
    “Framework is shutdown.”

    id State Bundle
    0 STARTING org.eclipse.osgi_3.8.1.v20120830-144521
    1 ACTIVE org.eclipse.equinox.console_1.0.0.v20120522-1841
    2 ACTIVE org.eclipse.equinox.preferences_3.5.0.v20120522-1841
    3 ACTIVE org.eclipse.core.resources_3.8.1.v20120802-154922
    4 ACTIVE org.eclipselabs.mongo.emf_0.7.0.qualifier
    5 ACTIVE org.eclipse.emf.ecore_2.8.3.v20130125-0546
    6 ACTIVE org.eclipse.equinox.cm_1.0.200.v20100520
    7 ACTIVE org.eclipse.equinox.app_1.3.100.v20120522-1841
    8 RESOLVED at.bestsolution.efxclipse.runtime.osgi_0.8.1.201303112105
    9 ACTIVE org.eclipse.equinox.registry_3.5.200.v20120522-1841
    10 STARTING org.eclipselabs.mongo.emf.examples_0.7.0.qualifier
    11 ACTIVE org.hamcrest.core_1.1.0.v20090501071000
    12 ACTIVE org.apache.felix.gogo.command_0.8.0.v201108120515
    13 ACTIVE org.eclipse.core.jobs_3.5.300.v20120622-204750
    14 RESOLVED org.eclipse.core.runtime.compatibility.registry_3.5.100.v20120521-2346
    15 ACTIVE org.eclipse.equinox.common_3.6.100.v20120522-1841
    16 ACTIVE org.eclipse.emf.common_2.8.0.v20130125-0546
    17 ACTIVE org.junit_4.10.0.v4_10_0_v20120426-0900
    18 ACTIVE org.eclipse.core.expressions_3.4.401.v20120627-124442
    19 ACTIVE org.apache.felix.gogo.shell_0.8.0.v201110170705
    20 ACTIVE org.eclipse.core.contenttype_3.4.200.v20120523-2004
    21 ACTIVE org.eclipse.orbit.mongodb_2.7.3.v20120213-1927
    22 ACTIVE org.eclipse.core.filesystem_1.3.200.v20120522-2012
    23 ACTIVE
    24 ACTIVE org.eclipselabs.mongo_0.7.0.qualifier
    25 ACTIVE org.eclipse.core.variables_3.2.600.v20120521-2012
    26 ACTIVE org.apache.felix.gogo.runtime_0.8.0.v201108120515
    27 RESOLVED org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20120522-1137
    28 ACTIVE org.eclipse.osgi.services_3.3.100.v20120522-1822
    29 ACTIVE org.eclipselabs.mongo.emf.developer.junit_0.7.0.qualifier
    30 ACTIVE org.eclipselabs.mongo.emf.ext_0.7.0.qualifier
    31 ACTIVE org.eclipse.core.runtime_3.8.0.v20120521-2346
    32 ACTIVE org.eclipse.emf.ecore.xmi_2.8.1.v20130125-0546
    33 ACTIVE org.eclipse.ant.core_3.2.400.v20120523-1752
    osgi> ls

      • Works like a charm 🙂

        Silly it may sound, but I did miss the ‘.ds’ bundle. I added it to my configuration, and ‘autostart’ed it.
        I will now evaluate this on the my model Project model.

        Thanks a lot.

  5. Hello Bryan

    I have a couple of questions regarding reading/querying the mongodatabase using mongoemf. Could you please help me out ?

    1. How do I get a complete collection of objects ? [I tried resourceSet.getResource(URI.createURI(“mongodb://localhost/test/Parent/”),true) to get the Parent Colleciton. but the resource has empty contents]
    2. How do I search for a model ? [eg: how do I get all parents whose name contains ‘1’]

    Thanks in advance for help.

    • Queries are specified in the query portion of the URI. I believe you can specify “*” for the query to get all elements : mongodb://localhost/test/Parent/?* (It’s been a while since I’ve done this). To query by a property, try: mongodb://localhost/test/Parent/?name=”1″ (it might be ==). Not sure if I already mentioned this, but the next version will support MongoDB native queries: { name : “1” }.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s