Model-Driven Reverse-Engineering of JSP Pages

Discussions

News: Model-Driven Reverse-Engineering of JSP Pages

  1. Model-Driven Reverse-Engineering of JSP Pages (4 messages)

    The next release of MoDisco (version 0.9) is under development and is planned to be released with Indigo. This release will come with new components for creating EMF models from the source code of JEE applications.


    One of these new components is dedicated to JSP reverse-engineering. It is 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

    For more detail please read the full story.

  2. It does sound like a very interesting (and perhaps very ambitious) project. I have many questions for what concerns creating a model from JSP pages, particularly considering the plethora of frameworks around and HTML-wizardry used in many project (particularly in the early stages of JSP).

     

  3. Hi Allessandro,

    There are also plethora of use-cases for such a solution.

    The idea is to have a comprehensive representation of the JSP in EMF. The level of abstraction is the same, but in a format (EMF) which allows using and combining any EMF compliant tool (browsing, mode-to-model transformation, code generation, comparison, ...).

    For example, for one of our customers who had a Struts based application which was not documented at all, we have used EMF models of the JSP pages, the Java classes and the struts-config.xml file to deduce a UML model (with a specific profile) describing the cinematic of the application (pages, actions, forms, events, ...). This UML model has been created with Mia-Studio which is a model-to-model transformation tool based on EMF. The transformation rules were specific to the patterns which have been used by this customer.

    We could also use a model of JSP to check coding norms or design patterns.

    We can also perform a transformation directly on the JSP model and then regenerate the JSP file. It allows performing refactorings on existing JSPs.

    Due to the plethora of frameworks and specific practices, you will never find the tool which does exactly what you want. So, our objective is to provide a solution which facilitates the development of specific tools dedicated to the context of your project(s).

    Fred

  4. Fred,

    thanks for your very exhaustive reply. I initially had a different understanding about what the project goal was and now it is much clearer.

    Will the EMF model be able to represent looping regions of JSP code? In other words, will it be able to detect loops within the scriptlets?

  5. Alessandro,

    The EMF model describes scriptlets as text fragments. If a loop is coded in the text of the scriptlet, you will have to parse the text of the scriptlet to detect it. If you use the tag "foreach" in the JSP, the loop is represented directly in the model.

    I have posted a more detailed answer on my blog:

    http://fmadiot.blogspot.com/2010/10/using-emf-to-detect-loops-within-jsp.html

    Fred