jModex Tutorial

Prerequisite

Expected results

  • An ASLan++ model for the application.

Resources required

  • Download the following archive.
  • Apache Tomcat 6.0 or greater installed.

Tutorial steps

 

    1. Download and unzip the BookStore application. Use the version developed using standard JSP technology.

 

    1. The JSPs must be manually converted into servlets using the Jasper compiler provided by the Apache Tomcat 6.0. You can use the Shell/Ant scripts from theconvjsp folder from the archive. In essence, in the build.sh file you will have to specify i) the path to the Tomcat home folder, ii) the path to the folder containing the application i.e. the folder obtained by unzipping the BookStrore application and iii) the path to the folder that will contain the generated code:
      jModexTut21
      After running this script the code corresponding to the JSPs is found in the folder containing the generated code, more precisely in the WEB-INF/src sub-folder.

 

    1. After that, in Eclipse, you must create a Java 1.6 project and import into its srcfolder, the content of the folder containing the generated code i.e., WEB-INF/src(In the case studies from SPaCIoS Deliverable 5.4 we only used a partion of the BookStore application i.e., we imported only Login and MyInfo components to be further analyzed with jModex
      jModexTut3
      For this operation use the Import menu choosing as import source the File System alternative. At this moment, the project should contain all the required sources but should also exhibit some compile errors due to some missing libraries. Consequently, you will have to add in the project build path some jars i.e., el-api.jar, jasper.jar, jsp-api.jar and servlet-api.jar. All these files are located in the lib folder from the Tomcat home directory. After that, the project should not contain any further compile error.

 

    1. Now, it is time to set the jModex options for the created project: right-click on the project, select the Properties menu, and go to the SPaCIoS/jModex page. Here you should i) enable the usage of Tomcat Servlet and Java SQL predefined specifier ii) specify the absolute path to the file containing the structure of the database and iii) add the folder(s) containing the user defined specifiers for this project.
      jModexTut4
      For the purpose of this tutorial, a file containing the structure of the database is already provided in the archive. Additionally, since BookStore is a non trivial application, we must simplify it to some degree. In the same archive, you can find the source and the compiled code of a technology specifier we used in this tutorial. Please check the specifier source code in order to understand the kind of simplifications enforced by this specifier.

 

  1. At this moment, everything is set and you simply have to invoke jModex: right-click on the project and select the SPaCIoS/jModex/Infer Aslan++ Model menu. After the initiated job is done, the extracted Aslan++ should be found in a file having the same name as the project and that is located in the root of the analyzed project (these are the default location and name of the output file).