© 2006 IBM Corporation
®
RAD PlugRAD Plug--in for Migrating fromin for Migrating from STRUTS
to SPRINGSTRUTS to SPRING
By
AM13
Presenters
AM13
AM13
Market Analysis
Technology Solutions
AM13
Code Migration
AM13
AM13
• Helps in reducing the complexities
• Enhances the concept of reusability along with the basic
principles of design pattern
MVC ( Model View Controller) Framework
• Design paradigm, originated in the Smalltalk community
• Separates Business logic/state (the Model) from User Interface
(the View) and
program progression/flow (the Control)
• View: How data is represented to the user
• Controller: Responsible for controlling the flow of the
program
Framework Overview -
AM13
View – JSPs, ActionForms
Controller – ActionServlet, Actions
Spring Framework
Encapsulates navigation logic & delegates to the service
objects for business
logic
Stores the Model data & associates a View to the request
Can be a physical View implementation or a logical View name
ViewResolver - Maps logical View names to actual View
implementations
HandlerMapping-Strategy interface used by DispatcherServlet for
mapping incoming
requests to individual Controllers
AM13
AM13
AM13
AM13
Framework Migration Methodology A simple struts application can be
divided into 6 categories
JSP * (ex- login.jsp)
Library Files (ex- struts.jar)
Step 1: Face Lift ( JSP’s )
Any struts specific tag is to be converted to it’s corresponding
simple HTML tag
Step 2: Organ Transplant ( Form beans)
change the existing Form beans to Command Classes
Step 3: Heart Transplant (Action Classes)
Change the existing Action Classes to Controller Classes
Step 4: Brain Transplant (XML’s)
Change the struts specific config files to spring specific config
files
Step 5: Blood Transfusion
AM13
Step 1: Face Lift ( JSP’s ) : Changing Struts specific tags to
simple HTML Tags in
JSP
JSP’s in a Struts application can contain Struts specific tags
where as JSP’s in a
Spring application contains simple HTML tags.
& * * "
$
+$ / ( $
+$%
/ ( $
AM13
$ $
,( * ' " => ?
,( *' = > ?
AM13
Step 3: Heart Transplant: Changing Struts Action classes to Spring
Controller
classes
Struts provide ActionServlet by default as the controller where as
in Spring the
default controller is DispatcherServlet
Spring has different controllers which handle individual modules.
These can be
seen as replacement for Action Classes
$ * , *
' " ' ,
B38 ' A $ ,
CD $ ' 1
AM13
Step 4: Brain Transplant : Changing Struts Configuration files to
Spring Configuration
files
$-.* * , *
7<,;*.do/012
AM13
Step 5: Blood Transfusion : Replacing Struts jar files with Spring
jar files
Removing the struts specific jars (struts.jar ,
struts-legacy.jar etc)
Adding Spring specific jars (standard.jar , spring.jar
etc) into lib folder of the
application.
AM13
AM13
Pluggable parcels
AM13
Checks the input project folder structure & files
Stores Input & Output project folder path in mapping
database
File Converter
Converts struts related tags, codes etc to spring equivalent
File Creator
Copies converted files to appropriate folders
AM13
AM13
It can convert an application from Struts to Spring
Easy to install & enhance
Creating new Folder Structure according to
the migrated framework.
Converting Configuration files from one framework to other.
Converting one Framework specific tags to other framework
specific tags
AM13
(PDE) for RAD, which is used to develop MIGRATOR
Plug-in.
This helps it to plug in various different IDE’s like
Rational Application Developer (RAD), Websphere
Application Developer (WSAD), Netbeans, and Eclipse
3.0.
Places all framework specific jars in lib folder
Converts framework specific code of JSP’s, Form beans, Action
Classes
Creates/Converts framework specific configuration XML’s
Places all the converted files in appropriate folder
AM13
Migrator can be installed on any eclipse based IDE or NetBeans IDE
using the Installer provided.
There are two ways to start Migrator
Installing Migrator Plug-in
AM13
Phase-wise capability in terms of effectiveness of migrating a
simple application from Struts to Spring
Phase in Migration Plug in Capability
Face Lift 50%
Organ Transplant 90%
Heart Transplant 30%
Brain Transplant 20%
Blood Transfusion 90%
Overall the MIGRATOR Plug-in is capable to reduce 70% (approx) of
the manual
efforts in migrating a simple Struts application to Spring. Further
enhancements may
increase the level of automation.
Migrator Plug-in Capability
AM13
AM13
AM13
AM13
AM13
AM13
AM13
Demo
AM13
AM13
AM13
AM13
AM13
Presently MIGRATOR plug-in is capable of migrating simple
applications in
Struts to Spring, for more complex applications
It can be enhanced to migrate areas such as
Struts tld library
AM13
It only handles SimpleCommandController
findForward("sucess") , “success” is user defined tag which cannot
be pre assumed for
success or failure views. So after conversion both the statements
of Success & Failure
are inserted in comment , the programmer can choose the statement
according to the
view required
Some closing tags are missed out or not in proper place , the
programmer must ensure
it before executing
Programmer has to handle logical flow of the application as
migrator handles only
framework specific code
AM13
Questions
AM13
[email protected]
[email protected]
[email protected]