Subscribe to our blog

Application migration and modernization is a daunting task.  Not only do you have to update legacy applications with newer libraries and APIs, but often must also address new frameworks, infrastructures, and architectures all while simultaneously keeping resources dedicated to new features and versions.

Red Hat Application Migration Toolkit (RHAMT), formerly Windup, provides a series of utilities for easing this process.  Applications can be analyzed through a CLI, a web-based interface, or directly inside Eclipse, allowing immediate modification of the source code.

Choosing the Right Distribution

You’ve read the introduction, possibly seen a video, and are eager to run your first application through the process.  Where do you begin?

RHAMT provides a number of different distributions to meet your needs, and all include detailed reports that highlight migration issues with effort estimation.  Each of these is summarized below.

CLI

CLI Download - Product Documentation

The CLI is a command-line tool, typically used by advanced users with highly customized needs.  It allows you to finely tune the RHAMT analysis options or to integrate with external automation tools.

Web Console

Web Console Download - Product Documentation

The web console is a web-based system that allows a team of users to assess and prioritize migration and modernization efforts.  In addition, applications can be grouped into projects for analysis.

Eclipse Plugin

Eclipse Plugin Download - Product Documentation

The Eclipse plugin provides assistance directly in Eclipse and Red Hat JBoss Developer Studio, and allows developers to see migration issues directly in the source code.  The Eclipse plugin also provides guidance on resolving issues, and offers automatic code replacement where possible.

Start by choosing the distribution that fits your needs best.  Follow the download link, and then examine the first few chapters in the appropriate guide to install and run the tool.

Analyzing an Application

You have a local installation of RHAMT, located at RHAMT_HOME, and an application you want to analyze.  For the purposes of this blog, we’ll assume that you chose the CLI.  With that out of the way, let’s get started!

The analysis is performed by calling `rhamt` and passing it in the application along with any desired options, as seen in the following example.

$ bin/rhamt-cli --sourceMode --input /path/to/source_folder/ --output /path/to/output_folder/ --target eap7
Source Code Application Migration

The options are straightforward:

  • --sourceMode - indicates the input files are source files instead of compiled binaries
  • --input - path to the file or directory containing the files to be analyzed
  • --output - path to the directory to contain the reports
  • --target - technology to migrate to; used to determine the rules for the analysis

Once the analysis finishes, a message will be seen in the console indicating the path to the report.

Report created: /path/to/output_folder/index.html

             Access it at this URL: file:///path/to/output_folder/index.html

Output of CLI Analysis

 

Rule Creation

While RHAMT contains a number of rules for common middleware platforms, it also allows you to define a set of custom rules which can be used to identify components or libraries that are not covered by the base ruleset.

Rules are defined in XML, using the following pattern:

when(condition)
 perform(action)
otherwise(action)
Rule Definition Pattern

 

Let’s take a look at an actual rule.  Assuming there’s an annotation `ProprietaryServlet` that should be flagged, we can create a rule that identifies this annotation and instead references the main `WebServlet` annotation in the standard javadocs.  In this case, we only define the `when(condition)` and `perform(action)`.

<?xml version="1.0"?>
<ruleset id="JBoss5-web-class-loading"
   xmlns="http://windup.jboss.org/schema/jboss-ruleset"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
   <metadata>
       <description>
           This ruleset looks for the class-loading element in a jboss-web.xml file, which is no longer valid in JBoss EAP 8
       </description>
        <dependencies>
           <addon id="org.jboss.windup.rules,windup-rules-javaee,3.0.0.Final"/>
           <addon id="org.jboss.windup.rules,windup-rules-java,3.0.0.Final"/>
       </dependencies>
       <sourceTechnology id="eap" versionRange="(4,5)"/>
       <targetTechnology id="eap" versionRange="[6,)"/>
   </metadata>
   <rules>
       <rule id="proprietary-servlet-annotations-01000">
           <when>
               <javaclass references="com.example.proprietary.servlet.annotation.ProprietaryServlet" as="default">
                   <location>ANNOTATION</location>
               </javaclass>
           </when>
           <perform>
               <hint title="Proprietary Servlet annotation" effort="1">
                   <message>Replace the proprietary @ProprietaryServlet annotation with the Java EE 6 standard @WebServlet annotation.</message>
                </hint>
               <hint title="Standard Java EE 8 annotations">
                   <message>See the javax.servlet.annotation JavaDoc for more information.</message>
                   <link href="http://docs.oracle.com/javaee/6/api/javax/servlet/annotation/package-summary.html"
                       title="Java EE 8 Servlet annotation package summary" />
               </hint>
           </perform>
       </rule>
    </rules>
</ruleset>
Sample RHAMT Rule

 

Save the rule as `sample.rhamt.xml`, then copy it into the `RHAMT_HOME/rules/` directory.  The next time RHAMT Is executed this rule will be evaluated, and any hints will be included in the generated report.

The above highlights including a simple rule into your installation. For full instructions on rule creation examine the Rules Development Guide.

Just Lifting and Shifting?

Lifting and shifting, or rehosting, an application is the first step in migrating it.  This process involves moving the application onto a different framework or infrastructure.  A common end goal of this stage is to make the smallest number of changes to have the application running successfully in a cloud environment.

Once the application is successfully running in the cloud, the next step is to modernize the application so that it’s natively designed for a cloud environment.  Instead of simply rehosting the application, this step involves redesigning it, moving unnecessary dependencies and libraries outside the application.

Regardless of which step you’re at, RHAMT assists with both of these steps by providing a set of cloud-ready rules.  Once executed against the application, a detailed report is created that indicates what changes should be made. For anyone familiar with using RHAMT to migrate middleware platforms, the process is similar - examine the report and adjust your application based on the feedback.

It’s that simple.

Summary

Wherever you are in the migration process, I’d recommend looking at RHAMT.  It’s extremely simple to set up, and comes with a number of default rules to assist in any part of the migration and modernization process.


저자 소개

Deon Ballard is a product marketing manager focusing on customer experience, adoption, and renewals for Red Hat Enterprise Linux. Red Hat Enterprise Linux is the foundation for open hybrid cloud. In previous roles at Red Hat, Ballard has been a technical writer, doc lead, and content strategist for technical documentation, specializing in security technologies such as NSS, LDAP, certificate management, and authentication / authorization, as well as cloud and management. She also wrote and edited the Middleware Blog for Red Hat and led portfolio solution marketing for integration and business automation.

Read full bio

채널별 검색

automation icon

오토메이션

기술, 팀, 환경을 포괄하는 자동화 플랫폼에 대한 최신 정보

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

cloud services icon

클라우드 서비스

관리형 클라우드 서비스 포트폴리오에 대해 더 보기

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리