Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource. They work as consultants and software engineers for building …
EMF Client Platform 1.7.0 Feature: EMF Change BrokerNovember 17, 2015 | 2 min Read
With Mars.1, we released EMF Client Platform and EMF Forms 1.7.0. EMF Forms is a framework focused on the creation of form-based UIs. If you are not yet familiar with EMF Forms, please refer to this tutorial for a introduction of EMF Forms. EMF Forms is a sub component of the EMF Client Platform, which is designed for general support of the development of applications based on an EMF data model. While we focused our development activities a lot on EMF Forms during the last releases, EMF Client Platform is still under active development, too. In this post, we would like to introduce a new feature of the EMF Client Platform, the EMF Change Broker.
One of the core and most valuable features of EMF is the change notification. By default, it is possible to register change listeners to EObjects and therefore get notified on changes on attributes and references. The EContentAdapter even enables to listen to complete trees of objects, so you can register a listener to all changes in a model instance. However, when implementing an EContentAdapter, you typically need to filter the notifications the adapter receives to only react to changes of interest. As an example, you might only be interested in changes on a certain EClass or on a certain EFeature within your model. Of course, you could add conditions to every listener, but for this kind of generic filters, a central broker architecture is typically more efficient. Additionally, one wants to avoid the registration of several EContentAdapters, as this usually slows down the performance. Therefore a central broker for change notifications of an EMF model instance is very helpful. Such a broker is provided by the EMF Client Platform ChangeBroker. The following diagram shows a conceptional overview.
The ChangeBroker receives notifications from model instances and dispatches them to registered observers. There are specific types of observers, as for example, you can register an observer only for changes on a specific EClass or a specific EFeature.
The change broker is a stand-alone component, which can used in combination with any EMF model. There is a ready-to-use integration with the persistence layer of the EMF Client Platform, but the Change Broker can also be used stand-alone without other components of the EMF Client Platform. Please see this tutorial for a detailed introduction to the change broker.