The current version (version 0.8) already provides components for creating EMF models from java source code (see this older post). In next version, new components will be dedicated to JSP reverse-engineering. They have been developped by Fabien Giquel and Nicolas Guyomar of Mia-Software.
They are composed of:
- a metamodel for describing a JSP
- a discoverer for creating a model from a set of JSP pages
- a generator for generating JSP pages from a model
The JSP metamodel (defined with Ecore) is an extention of the XML metamodel (also provided by MoDisco) which contains types such as Page, JSPScriptlet, JSPExpression, JSPTagLib, etc.
The discoverer, is a component which analyzes JSP pages and creates an EMF model conforming to the JSP metamodel.
It can be launched from a project, or directly from JSP pages.
The result is an EMF model which can be opened with the MoDisco Model Browser.
The generator allows regenerating JSP files from an EMF model (conforming to the JSP metamodel). While it still needs to be improved to support a better formatting, yet it can already be used to produce JSP files.
With these new components, you can reverse-enginer JSP files and use EMF APIs in order to control coding norms, detect patterns, document existing pages or refactor them by applying transformation at the model level (and then use the generator to get a new version of your JSPs).
Exciting feature!
ReplyDeleteRegards,
Madhu Samuel
Eclipse Trainer and Consultant - Bangalore,
EclipseBible.com
Nice! could be applied the same pattern on html pages ?
ReplyDeleteYes, you can launch the discoverer from any HTML file and you will get an EMF model.
ReplyDeleteThe JSP Ecore definition is an extension of the XML Ecore definition. The EMF model of an HTML page will be an instance of Page containing instances of Element containing instances of Attribute and other instances of Element.
interesting approach.. i'll take a look to it! thx
ReplyDeleteGiulio
Could be interesting to create a live render for html models.. based on firefox xulrunner.. in the same manner eclipse4 emf ui renderer works.
ReplyDeleteGiulio
great
ReplyDelete