Author: Jess Sightler
Level: Intermediate
Summary: Windup Java rule add-on that reports on use of the Seam Asynchronous annotation in remote EJBs
https://github.com/windup/windup-quickstarts/
The Seam @Asynchronous
annotation is not compatible with remote EJBs in Red Hat JBoss Enterprise Application Platform.
This Java rule add-on tests for use of org.jboss.seam.annotations.async.Asynchronous
annotations in remote EJBs and reports that it must be replaced with the standard Java EE 6 @Asynchronous
annotation.
These instructions use the following replaceable variables.
-
WINDUP_HOME
: Replace this variable with the fully qualified path to your Windup installation. -
QUICKSTART_HOME
: Replace this variable with the fully qualified path to the root directory of this quickstart.
The EjbBeanUtilsAsyncUsageRuleProvider
class extends AbstractRuleProvider
and overrides the getConfiguration(GraphContext context)
method.
This method looks for annotations named "com.beanutils.async.AsynchronousMethod". When found, it adds the following text to the report and points the person to the JBoss EAP 6 documentation:
`REMOTE_EJB_CLASS_NAME` uses the Seam @Asynchronous annotation. It is not compatible with JBoss EAP Remote EJBs and should be replaced with the standard Java EE 6 @Asynchronous annotation.
The Windup JavaDoc is located here: http://windup.github.io/windup/docs/latest/javadoc/
The rule this project produces is designed to be run on Windup 2.0 or later.
This project requires Java 7 (Java SDK 1.7) or later and Maven 3.0 or later.
If you have not installed Windup, follow the instructions here: Download and Install Windup.
If you have not yet installed and configured Maven, follow the instructions here: Install and Configure Maven.
An example settings.xml
file is provided in the root directory of the quickstarts.
Before Windup can use this rule, it must be compiled and added to the local Maven repository.
-
Open a command prompt and navigate to the
QUICKSTART_HOME/rules-java/
directory. -
Type the following command to compile the quickstart and install it into the local Maven repository:
mvn clean install
-
You should see the message
BUILD SUCCESS
The command to install the rule in Windup uses the Maven GAV (groupId, artifactId, and optional version) to locate the rule in the Maven repository. The command uses the following syntax.
WINDUP_HOME/bin/windup --install GROUP_ID:ARTIFACT_ID[,VERSION]
To find these values, open the QUICKSTART_HOME/rules-java/pom.xml file. These values are located near the beginning of the file.
<groupId>org.jboss.windup.quickstarts</groupId>
<artifactId>windup-ejb-beanutils-async-rules-java</artifactId>
<version>2.6.0-SNAPSHOT</version>
Follow these steps to add the rule to Windup.
-
Open a command prompt and navigate to the
WINDUP_HOME
directory. -
Type the following command, which does not include the optional version.
bin/windup --install org.jboss.windup.quickstarts:windup-ejb-beanutils-async-rules-java
-
At the following prompt, choose
Y
.Confirm installation [Y/n]? Y
-
You should see the following result.
Installation completed successfully.
This quickstart provides an example file containing the Seam org.jboss.seam.annotations.async.Asynchronous
annotation to use when testing the quickstart. It is located in the quickstart’s test-files/src_example/
directory.
The command to test the rule uses this syntax:
WINDUP_HOME/bin/windup [--sourceMode] --input INPUT_ARCHIVE_OR_FOLDER --output OUTPUT_REPORT_DIRECTORY --target TARGET_TECHNOLOGY --packages PACKAGE_1 PACKAGE_2 PACKAGE_N
To test this quickstart using the test-files/src_example/
folder provided in the root directory of this quickstart, follow these steps.
-
Open a command prompt and navigate to the
WINDUP_HOME
directory. -
Type the following command to test the rule.
bin/windup --sourceMode --input QUICKSTART_HOME/test-files/src_example/ --output QUICKSTART_HOME/windup-reports-java/ --target eap --packages org.windup
-
You should see the following result:
***SUCCESS*** Windup report created: QUICKSTART_HOME/windup-reports-java/index.html Access it at this URL: file:///QUICKSTART_HOME/windup-reports-java/index.html
-
Open the link to the
QUICKSTART_HOME/windup-reports-java/index.html
file in a browser. You are presented with theApplication List
page. -
Click on the
src_example
link. This takes you to theReport Index
page, which provides summary information about findings from the migration analysis. -
Under Additional Reports, click on Application Details. This opens the
Application Details Report
page that shows a total of 8 story points and the list of the relevant files along with warning messages. -
Click on the
org.windup.examples.ejb.BeanUtilsAsyncUsingRemote
file link to drill down for more information about the Java source.-
The Information section reports on the matching conditions and provides a link to the standard Java EE servlet annotation documentation. This is followed by the source code matching the condition with a detailed message desription.
-
This quickstart provides Arquillian tests.
-
Open a command prompt and navigate to the
QUICKSTART_HOME/rules-java/
directory. -
Type the following command to run the test goal.
mvn clean test
-
You should see the following results.
Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
You remove the rule from Windup using its Maven GAV (groupId, artifactId, and version).
The command takes the following form:
WINDUP_HOME/bin/windup --remove GROUP_ID:ARTIFACT_ID[,VERSION]
Follow these steps to remove the rule from Windup.
-
Open a command prompt and navigate to the
WINDUP_HOME
directory. -
Type the following command.
bin/windup --remove org.jboss.windup.quickstarts:windup-ejb-beanutils-async-rules-java
-
Enter
Y
to confirm. You should see the following response.Uninstallation completed successfully.