Cloud Foundry: Design and Architecture
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
The content has been bookmarked!
There was an error bookmarking this content! Please retry.
Posted by Jean-Jacques Dubray on Aug 10, 2010
Daniel Schneller wrote an introduction on Xtext by creating a grammar that provides:
an easy to use and reliable way for configuring navigation through mobile Java applications
In the past, his team hard-coded the application's navigation paths, but because of the growing complexity of the applications, they needed a new solution:
First we thought about an XML based configuration, but this seemed to be a hassle to write (and read) and also would mean we would have to pay the price of parsing it on every application startup.
Recently, they stumbled upon Eclipse Xtext:
[Xtext is] an Eclipse based framework/library for building text based DSLs.
In short, you just provide a grammar description of a new DSL to suit your needs and with – literally – just a few mouse clicks you are provided with a content-assist, syntax-highlight, outline-view-enabled Eclipse editor and optionally a code generator based on that language.
Xtext was originally developed by Sven Efftinge as part of openArchitectureWare and became an integral part of Eclipse this year. It is based on EMF (Eclipse Modeling Framework) and ANTLR.
Daniel created the following grammar:
navigation rules for MyApplication
mappings {
map permission AdminPermission to "privAdmin"
map permission DataAccessPermission to "privData"
map coordinate Login to "com.danielschneller.myapp.gui.login.LoginController"
in "com.danielschneller.myapp.login"
map coordinate LoginFailed to "com.danielschneller.myapp.gui.login.LoginFailedController"
in "com.danielschneller.myapp.login"
map coordinate MainMenu to "com.danielschneller.myapp.gui.menu.MainMenuController"
in "com.danielschneller.myapp.menu"
map coordinate UserAdministration to "com.danielschneller.myapp.gui.admin.UserAdminController"
in "com.danielschneller.myapp.admin"
map coordinate DataLookup to "com.danielschneller.myapp.gui.lookup.LookupController"
in "com.danielschneller.myapp.lookup"
}
navigations {
define navigation USER_LOGON_FAILED
define navigation USER_LOGON_SUCCESS
define navigation OK
define navigation BACK
define navigation ADMIN
define navigation DATA_LOOKUP
}
navrules {
from Login
on navigation USER_LOGON_FAILED
go to LoginFailed
on navigation USER_LOGON_SUCCESS
go to MainMenu
from LoginFailed
on navigation OK
go to Login
from MainMenu
on navigation ADMIN
go to UserAdministration
with AdminPermission
on navigation DATA_LOOKUP
go to DataLookup
with DataAccessPermission
from UserAdministration
on navigation BACK
go to MainMenu
from DataLookup
on navigation BACK
go to MainMenu
}
Xtext lets you define both the syntax and the metamodel behind your grammar at the same time. From there, Xtext generates the code of an Eclipse plugin that will allow developers to create metadata:

The generated editor comes complete with intellisense, color coding, syntax error detection and even the ability to detect broken references, across multiple metadata files.
Xpand was then used to parse and translate the grammar into a HashMap-based data structure:
public class NaviRules {
private Map navigationRules = new Hashtable();
// ...
public NaviRules() {
NaviDestination naviDest;
naviDest = new NaviDestination();
naviDest.action = "USER_LOGON_FAILED";
naviDest.targetClassname = "com.danielschneller.myapp.gui.login.LoginFailedController";
naviDest.targetBundleId = "com.danielschneller.myapp.login";
store("com.danielschneller.myapp.gui.login.LoginController", naviDest);
naviDest = new NaviDestination();
naviDest.action = "USER_LOGON_SUCCESS";
naviDest.targetClassname = "com.danielschneller.myapp.gui.menu.MainMenuController";
naviDest.targetBundleId = "com.danielschneller.myapp.menu";
store("com.danielschneller.myapp.gui.login.LoginController", naviDest);
// =============================================================================
naviDest = new NaviDestination();
naviDest.action = "OK";
naviDest.targetClassname = "com.danielschneller.myapp.gui.login.LoginController";
naviDest.targetBundleId = "com.danielschneller.myapp.login";
store("com.danielschneller.myapp.gui.login.LoginFailedController", naviDest);
// .... and so on ...
}
}
Daniel sees several advantages over XML for mobile applications:
No XML parsing necessary on application startup, saving some performance
Validation of the navigation rules ahead of time, preventing parse errors at runtime
No libraries needed to access the information – by putting everything in a simple HashMap we do not have to rely on any non-standard classes whatsoever
Textual DSLs are maturing rapidly and finding a broad range of applicable scenarios on different platforms. Did you already use a textual-DSL in a real world scenario? What for? What is your feedback?
Requirements, quality and test management e-Kit
Agile Practices to Improve Project Management Organization (PMO) Effectiveness
The WebSphere Liberty Profile for Developers: An Introduction
In today’s hyper-competitive world, later may be too late to adopt Agile development and this Roadmap for Success will help you get started. Download "Agile Development: A Manager's Roadmap for Success" now!
I am interested in this concept, but what kind of platform it support right now?
iPhone, android, j2ME. It seems the DSL generates the java code.
Steve:
Xtext / Xpand is actually a framework from which you can generate any artefact you want (code, config files, documentation...). I successfully built an Objective-C code generator with it.
I found Daniel's article interesting because it shows how easy it is do that by providing an end-to-end scenario.
Jean,
thanks for the article on Xtext. It's always good to see how people use the technologies and frameworks, that I helped to develop.
Just one remark: The Xtext prototype which was part of the openArchitectureWare project was developed by Sven Efftinge [1]. When Xtext became a project at Eclipse it was completely rewritten by a team of great guys around Sven [2]. It's us, who share the vision about Xtext and its future.
Regards,
Sebastian
[1] blog.efftinge.de/
[2] www.eclipse.org/projects/project_summary.php?pr...
Sorry about that, I was under the impression that Markus was behind it. I appreciate the clarification and I apologize for not looking into it further. I'll correct the article.
Derek Collison discusses the goals, the design premises and patterns employed in creating the architecture of Cloud Foundry, VMware’s open source PaaS, unveiling internal architectural details.
Andrew Watson talks about the work of the OMG, where CORBA is alive and well (hint: in your car), UML and UML Profiles vs. custom Modeling languages, DDS and other middleware, and much more.
Sohil Shah discusses creating iPhone and Android enterprise mobile applications based on cloud services using the open source platform OpenMobster.
Paul Sanford presents the transformations supported by data throughout its life cycle, and how that can be better done with Splunk, an engine for monitoring and analyzing machine-generated data.
A common “best practice” for unit tests is to only write a one assertion in each test. I intend to question this advice by showing that multiple assertions per test are both necessary and beneficial.
John Rauser presents the architectural and technological evolution of Amazon retail websites starting with 1994 and ending with adopting Amazon Web Services.
Michael Stal discusses system architecture quality, how to avoid architectural erosion, how to deal with refactoring, and design principles for architecture evolution.
Every developer has had to integrate with another system, API or component. Tis article provides strategies to handle the change and for he separating system boundaries.
4 comments
Watch Thread Reply