This trac page is outdated.
Please, visit the new API2MoL page.
Welcome to API2MoL
Api2mol (API to Metamodel Language) is a Domain Specific Language (DSL) which allow you to define the mapping between an API and a metamodel (i.e. API classes and metamodel elements). The mapping definition is used to project models form/into APIs, that is, to inject/extract models by calling to API methods.
Description
A software asset enables access to its internal functionality through an Application Programming Interface (API) that describes the set of public services offered by the software. Given the importance of the API concept in software engineering, we need mechanisms to integrate APIs in Model-Driven Engineering (MDE), for instance, as part of software modernization or code-generation scenarios. However, in current approaches integration is done by hardcoding glue code directly in the MDE application.
Our generic solution API2MoL is a Domain Specific Language specially designed to integrate APIs into MDE. With API2MoL, developers can define the mappings between an API and a metamodel (i.e. mappings between API classes and metamodel elements). It is also possible to automatically create a metamodel definition directly from the API information if not existing metamodel is already available. These mappings can then be used to anytime we need to bridge the gap between software and models. For instance, we can create complete models from running applications or create complete software artifacts from models, where complete, in both examples, refers to the fact that the model/software will include all the necessary calls to the APIs used by the software.

Features
- Language specially tailored to extract and inject models from APIs by means of a mapping definition
- Bidireccional mapping
- Bootstrap process for automatically obtaining the API metamodel
- Java-based APIs
- Extraction and injection of in-memory run-time Java objects
Documentation
Examples
Swing example
Swing is a widget toolkit for Java. It is part of Sun Microsystems' Java Foundation Classes (JFC) — an API for providing a graphical user interface (GUI) for Java programs. Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit.
This simple example illustrates the use of API2MoL in the Swing API. Both the Swing metamodel and the API2MoL mapping definition are first automatically obtained by applying the API2MoL bootstrap process and then they are used to inject/extract Swing applications.
The Swing example files (reflective metamodel, api metamodel and mapping definition) can be downloaded from here.
SWT example
The Standard Widget Toolkit (SWT) is a graphical widget toolkit for use with the Java platform. It was originally developed by IBM and is now maintained by the Eclipse Foundation in tandem with the Eclipse IDE. It is an alternative to the AWT and Swing Java GUI toolkits provided by Sun Microsystems as part of the Java Platform, Standard Edition.
This example deals with the ControlExample included in the SWT example library. The bootstrap process allows us to obtain the SWT metamodel and the mapping definition and then the injection and extraction process can be applied.
The SWT example files (reflective metamodel, api metamodel and mapping definition) can be downloaded from here.
JTwitter example
Twitter is a social networking and microblogging service that enables its users to send and read messages known as tweets. Tweets are text-based posts of up to 140 characters displayed on the author's profile page and delivered to the author's subscribers who are known as followers. Senders can restrict delivery to those in their circle of friends or, by default, allow open access. Since late 2009, users can follow lists of authors instead of following individual authors. Since its creation in 2006 by Jack Dorsey, Twitter has gained notability and popularity worldwide. It is sometimes described as "SMS of the Internet." The use of Twitter's application programming interface for sending and receiving text messages by other applications often eclipses direct use of Twitter.
JTwitter is a small library providing easy access to the Twitter API. Set and get your status, manage your network of friends, message friends, maintain lists, etc.
This example performs the injection process of a Twitter account. It allows us to retrieve the status messages of the twitter account along with its friends, followers, lists, etc.
The Twitter example files (reflective metamodel, api metamodel and mapping definition) can be downloaded from here.
Download
API2MoL implementation along with some validation examples will be available in a couple of days
This work has been co-supported by INFO and FEDER up to 80%, grant PCTRM 2007-2010.
Attachments
- api2mol.png (37.3 KB) - added by jlcanovas 23 months ago.
-
jtwitter-files.zip
(119.5 KB) - added by jlcanovas
23 months ago.
JTwitter files
-
swing-files.zip
(0.6 MB) - added by jlcanovas
23 months ago.
Swing files
-
swt-files.zip
(421.6 KB) - added by jlcanovas
23 months ago.
SWT files
- feder.gif (1.6 KB) - added by jlcanovas 22 months ago.
- crecemos.gif (3.1 KB) - added by jlcanovas 22 months ago.
-
api2mol.ecore
(4.7 KB) - added by jlcanovas
14 months ago.
API2MoL abstract syntax
-
api2mol.g
(1.6 KB) - added by jlcanovas
14 months ago.
API2MoL concrete syntax
![(please configure the [header_logo] section in trac.ini)](/trac/api2mol/chrome/site/api2molLogo.png)