1 / 17

Migrating Web Frameworks Using Water Transformations

Migrating Web Frameworks Using Water Transformations. Ahmed E. Hassan Richard C. Holt School of Computer Science University Of Waterloo. Web Applications. A software system whose functionality is delivered through the web Web browser is used as the client

niveditha
Download Presentation

Migrating Web Frameworks Using Water Transformations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Migrating Web FrameworksUsing Water Transformations Ahmed E. Hassan Richard C. Holt School of Computer Science University Of Waterloo

  2. Web Applications • A software system whose functionality is delivered through the web • Web browser is used as the client • HTTP state-less protocol is used as the communication protocol • Many development frameworks have been proposed – JSP, NSP, ASP, ASP+, CF • Active pages are their building blocks

  3. Introduction to Active Pages Simple html file: (foo.html) <html> Welcome to CNN.COM </html> AP file: (foo.ap) <html> Welcome to <% Write(“CNN.COM”) %> </html>

  4. Introduction to Active Pages Interesting AP file: (foo2.ap) <html> Welcome to <% Write(Server.name) %> </html>

  5. Introduction to Active Pages file.ap Web Server Pre-processor file.html COM/ CORBA Objects Data Tables Data Flow

  6. Structure of an Active Page Active Page HTML Server Scripts Client Scripts VBScript Perl JavaScript JavaScript VBScript

  7. Web Application Development Frameworks • Abstract details of developing an application: • access control • client state maintenance • relational database access • file manipulations on the server • Each framework: • uses its own programming language • Each framework provides a set of built-in objects

  8. Migrating from ASP to NSP • Language Transformation: • ASP uses VBScript • NSP uses JavaScript • Object Model Transformation: • Different set of built-in objects

  9. ASP vs NSP built-in objects

  10. ASP Example 1: <HTML> 2: <TITLE>Main Page</TITLE> 3: <% if Session("loggedIn") Then ‘ User already logged in%> 4: Welcome <%Response.Write(Session("username"))%> to your account, 5: To display balance <A HREF="balance.asp">click here</A> 6: <% Else ‘ User needs to login %> 7: Please Login first, <A HREF="login.asp">click here</A> 8: <% End If %> 9: </HTML>

  11. Island Grammars • Used for robust parsing and extraction • Recover from errors and handle ill defined grammars: • Island: • Tokens of interest (VBScript Code) • Parsed and expanded • Water: • Un-interesting tokens (HTML/Comments) • Skipped

  12. Water Transformations • Extends the idea of Island Grammars for code transformations • Converts Water to special Islands • Performs code transformation on Islands using traditional approaches • Convert back the special post-transform. Islands to Water

  13. Migration Overview rmHTML (in Perl) VBScript code rmComment (in Perl) ASP file Lang Trans. (in TXL) Object Model Trans. (TXL) addHTML (in Perl) JavaScript code addComment (in Perl) NSP file

  14. 1: <HTML> 2: <TITLE>Main Page</TITLE> 3: <% if Session("loggedIn") Then ‘ User already logged in%> 4: Welcome <%Response.Write(Session("username"))%> to your account, 5: To display balance <a HREF="balance.asp">click here</A> 6: <% Else ‘ User needs to login %> 7: Please Login first, <a HREF="login.asp">click here</A> 8: <% End If %> 9: </HTML> Input ASP file 1: HTMLCALL(); 2: if Session("loggedIn") Then ‘ User already logged in 3: HTMLCALL(); 4: Response.Write(Session("username")) 5: HTMLCALL(); 6: Else ‘ User needs to login 7: HTMLCALL(); 8: End If 9: HTMLCALL(); After rmHTML

  15. 1: HTMLCALL(); 2: if Session("loggedIn") Then ‘ User already logged in 3: HTMLCALL(); 4: Response.Write(Session("username")) 5: HTMLCALL(); 6: Else ‘ User needs to login 7: HTMLCALL(); 8: End If 9: HTMLCALL(); After rmHTML 1 : HTMLCALL(); 2 : if Session("loggedIn") Then 3 :COMMENTCALL(); 4 : HTMLCALL(); 5 : Response.Write(Session("username")) 6 : HTMLCALL(); 7 : Else 8 :COMMENTCALL(); 9 : HTMLCALL(); 10: End If 11: HTMLCALL(); After rmCmt

  16. 1 : HTMLCALL(); 2 : if Session("loggedIn") Then 3 :COMMENTCALL(); 4 : HTMLCALL(); 5 : Response.Write(Session("username")) 6 : HTMLCALL(); 7 : Else 8 :COMMENTCALL(); 9 : HTMLCALL(); 10: End If 11: HTMLCALL(); After rmCmt 1 : HTMLCALL(); 2 : if (Client.loggedIn)) { 3 : COMMENTCALL(); 4 : HTMLCALL(); 5 : write(Client.username)) ; 6 : HTMLCALL(); 7 :} else { 8 : COMMENTCALL(); 9 : HTMLCALL(); 10: } 11: HTMLCALL(); After TXL Trans.

  17. Conclusion • An approach to migrate ASP to NSP is presented: • Language Transformation • Object Model Transformation • Pre/Post processing steps are used to massage the input and transform it to a traditional program • The approach preserves the location of the comments and HTML compared to the source code to ease future maintenance

More Related