<activeProfile>jboss-nexus-repository</activeProfile>-
This guide is for developers who plan to contribute source code updates or core rule add-ons to the Windup 2.0 project.
-
JBoss Windup is a rule-based tool to simplify application migrations.
Windup Forums: https://community.jboss.org/en/windup
Windup Forums: https://developer.jboss.org/en/windup (inherited from Windup 0.x)
+Windup Issue Tracker: https://issues.jboss.org/browse/WINDUP
All project source code contributed to Windup should be formatted using the settings defined in the Eclipse_Code_Format_Profile.xml file located in the root directory of the Windup project.
In Eclipse, choose Windows → Preferences.
Expand Java → Code Style → Formatter (Ctrl+Shift+F by default)
+Expand Java → Code Style → Formatter
Click Import
@@ -1047,37 +1064,76 @@Use this file to format Windup source code: http://plugins.netbeans.org/plugin/50877/eclipse-code-formatter-for-java
+Use this file to format Windup source code:
+Use this file to format Windup source code: http://plugins.jetbrains.com/plugin/?id=6546
+Use this file to format Windup source code:
+*RuleProvider
Do not name interfaces using the prefix 'I' for interface names. Instead, use a descriptive term for the interface, like Module.java.
The implementation class name should begin with a descriptive name, followed by the interface name, for example, for example JavaHandlerModule.java
*Model
Property constants
+Append all RuleProvider class names with RuleProvider.
Append all XML rule file names with .windup.xml
Append all Model class names with Model.
All test names should be prefixed with 'Test'.
+Property constants: TBD
+All test names should be prefixed with 'Test'.
+The following are not really accurate at this time. This is still TBD!
Lowercase with dashes. Start with windup-.
Ruleset addons start with windup-rules-.
If you plan to contribute to the core code base or create Java-based rule addons, you must first install and configure Maven to build Windup from source.
+If you plan to use Eclipse Luna (4.4) to build Windup, you can skip this -step. This version of Eclipse embeds Maven 3.2.1 so you do not need to -install it separately. Skip to the section entitled Configure Maven to Build Windup.
+step and go directly to the section entitled Configure Maven to Build Windup. This version of Eclipse embeds Maven 3.2.1 so you do not need to +install it separately.If you plan to run Maven using the command line or plan to use Red Hat @@ -1467,18 +1526,21 @@
<activeProfile>jboss-nexus-repository</activeProfile>-
<activeProfile>jboss-nexus-repository</activeProfile>
=== Get the Windup Source Code
To contribute to the Windup 2.0 project source code, you must fork the Windup repository to your own Git, clone your fork, commit your work on topic branches, and make pull requests back to the Windup repository.
+You are now configured to build Windup.
+To contribute to the Windup 2.0 project source code, you must fork the Windup repository to your own Git, clone your fork, commit your work on topic branches, and make pull requests back to the Windup repository.
In the Project Explorer tab, find the windup_parent project in the
-list, right-mouse, and choose Run As -→ Maven install.
Run As -→ Maven install.
windup-migr
Note
-If the OUTPUT_REPORT_DIRECTORY directory exists, your are prompted to overwrite the contents. If you respond "y", it is deleted and recreated by Windup, so be careful not to specify an output directory that contains important information!
+If the OUTPUT_REPORT_DIRECTORY directory exists, you are prompted to overwrite the contents. If you respond "y", it is deleted and recreated by Windup, so be careful not to specify an output directory that contains important information!
@@ -2273,7 +2335,10 @@ Windup Processing Overview
Discovery Phase
-Wnen you run the windup-migrate-app command, Windup executes its own core rules to extract files from archives, decompile classes, and analyze the application. In this phase, Windup builds a datamodel, storing component data and relationships in a graph database, which can then be queried and updated as needed by the migration rules and for reporting purposes.
+Wnen you run the windup-migrate-app command, Windup executes its own core rules to extract files from archives, decompile classes, and analyze the application. In this phase Windup builds a data model and stores component data and relationships in a graph database, which can then be queried and updated as needed by the migration rules and for reporting purposes.
+
+
+For more information about the phases of rule execution and how to control rule dependencies, see Rule Execution Lifecycle.
For more information about the graph database components, see Windup Architectural Components.
@@ -2319,7 +2384,7 @@ Rule Execution Lifecycle
Rule Lifecycle
-Windup executes each rule in sequential order. The following
+
Windup executes each rule in a sequential order. The following
sections describe the phases of rule execution and how rules may specify
that one or more other rules must be executed before or after they are
run.
@@ -3074,6 +3139,9 @@ Create the Java RuleProvider
-
+
Add beans.xml file to META-INF/ dir in resources - typically, $project-dir/src/main/resources/META-INF/beans.xml. This file can be empty. It tells CDI to scan your addon for CDI beans.
+
+-
Within your Maven project, create a Java class that extends the WindupRuleProvider class. It is suggested that you end the name of the class with RuleProvider. For example:
@@ -3341,7 +3409,7 @@ Review the Output Report
Create and Test XML Rules
-Create a Basic XML Rule
+Create a Basic XML Rule
You can create a rule addon using Java or a rule using XML or Groovy. This topic describes how to create a rule using XML.
@@ -3362,217 +3430,71 @@ Prerequisites
-
The JavaDoc for the Windup API is located here: http://windup.github.io/windup/docs/javadoc/latest/
-
-
-
-
-
-
-
-
-
-Note
-
-
-Working examples of XML-based rules can be found in the Windup quickstarts GitHub repository located here: https://github.com/windup/windup-quickstarts
-
-
-
-
-
-
-Create a Rule
-
-The following is an example of an XML rule.
-
-
-
-<?xml version="1.0"?>
-<ruleset xmlns="http://windup.jboss.org/v1/xml"
- id="customruleprovider">
- <!-- This defaults to MIGRATION_RULES -->
- <phase>
- DISCOVERY
- </phase>
- <rules>
- <rule>
- <when>
- <javaclass references="javax.servlet.http.HttpServletRequest">
- <location>METHOD_PARAMETER</location>
- </javaclass>
- </when>
- <perform>
- <hint>
- <message>Message from XML Rule</message>
- <link href="http://example.com" description="Description from XML Hint Link" />
- </hint>
- <log message="test log message"/>
- </perform>
- <otherwise>
- <!-- -->
- </otherwise>
- </rule>
- <rule>
- <when>
- <xmlfile xpath="/w:web-app/w:resource-ref/w:res-auth[text() = 'Container']">
- <namespace prefix="w" uri="http://java.sun.com/xml/ns/javaee"/>
- </xmlfile>
- </when>
- <perform>
- <hint>
- <message>Container Auth</message>
- </hint>
- <xslt description="Example XSLT Conversion" extension="-converted-example.xml"
- xsltFile="/exampleconversion.xsl"/>
- <log message="test log message"/>
- </perform>
- <otherwise>
- <!-- -->
- </otherwise>
- </rule>
- </rules>
-</ruleset>
-
-
-
-Create the XML Rule
-
-Note: Windup only analyzes XML files with names ending in .windup.xml. Be sure to name XML-based rules using this naming convention!
-
-
-The XML rule consists of the following level elements:
-
-
-
--
-
<ruleset>: This element defines this as a Windup rule.
-
-
-
<phase>: This element specifies when the ruleset should execute. See Rule Execution Lifecyle for more information about rule phases.
-
--
-
<rules>: element contains the individual rules.
-
-
--
-
<rule>: This element is a child of the rules element. One or more rules can be defined for a ruleset. Each rule contains the following elements.
-
-
--
-
<when>: This element defines the condition to match on.
-
-
--
-
<javaclass references="CLASS_NAME">
-
-
--
-
<location>: The location where the reference was found in a Java source file. See the Enum TypeReferenceLocation Javadoc for valid values.
+The XML rule schema is located here: https://github.com/windup/windup/blob/master/config-xml/rule-schema.xsd.
-
--
-
<perform>: This element is invoked when the condition is met.
-
-
--
-
<hint>: This child element of perform is used to create a hint
-
-
--
-
<message>:
-
--
-
<link>:
-
-
-
-
--
-
<xslt>: This specifies how to transform the the specified XML file
-
--
-
<log>: This child element of perform is used to log a message. It takes the attribute message to define the text message.
-
-
-
-
--
-
The <otherwise> element is invoked when the condition is not met.
-
-
-
-
-
-
-
-
+
+File Naming Convention for XML Rules
+
+You must name the file containing an XML rule with the .windup.xml extension. Windup identifies files with this extension as XML-base rules, so be sure to use this naming convention, otherwise the rule will not be evaluated!
-Add the Rule to Windup
+Basic XML Rule Template
-A Windup rule is installed simply by copying the rule to the appropriate Windup folder. Windup scans for rules in the following locations:
+XML rules consist of conditions and actions and follow the familiar "if/then/else" construct:
-
-
-- WINDUP_HOME/rules/
--
-
This is the Windup folder where you run the Windup executable. See About the WINDUP_HOME Variable for details.
-
-- ${user.home}/.windup/rules/
--
-
This folder is created by Windup the first time you execute Windup.
-
+
-For Linux or Mac: ~/.windup/rules/
-For Windows: "\Documents and Settings\USER_NAME\.windup\rules\" -or- "\Users\USER_NAME\.windup\rules\"
-
-
-
-
-
-
-
-Test the XML Rule
-
-
-
-
-Note
-
-
-If you have not started Windup, follow the instructions to Execute Windup.
-
-
-
+when(condition)
+ perform(action)
+otherwise
+ perform(action)
-
-Test the XML rule against your application file by running the windup-migrate-app command in the Windup console prompt.
-The command uses this syntax:
+The following is the basic syntax for XML rules.
-
+
-windup-migrate-app [--sourceMode true] --input INPUT_ARCHIVE_OR_FOLDER --output OUTPUT_REPORT_DIRECTORY --packages PACKAGE_1 PACKAGE_2 PACKAGE_N
+<?xml version="1.0"?>
+<ruleset xmlns="http://windup.jboss.org/v1/xml" id="XmlFileMappings">
+ <phase>
+ <!-- The phase in which to run the rules -->
+ </phase>
+ <rules>
+ <rule>
+ <when>
+ <!-- Test a condition... -->
+ </when>
+ <perform>
+ <!-- Perform this action when condition is satisfied -->
+ </perform>
+ <otherwise>
+ <!-- Perform this action when condition is not satisfied -->
+ </otherwise>
+ </rule>
+ <rules>
+ </ruleset>
-
-You should see the following result:
-
-
-***SUCCESS*** Windup report created: QUICKSTART_HOME/windup-reports-java/index.html
+
+Create the Rule When Condition
+
+The syntax is dependent on whether you are creating a rule to evaluate Java class, an XML file, a project, or file content and is described in more detail here: XML Rule - When Condition Syntax
+
+Create the Rule Perform Action
-For more information and examples of how to run Windup, see: Execute Windup
+Operations allowed in the perform section of the rule include the classification of application resources, in-line hints for migration steps, links to migration information, and project lineitem reporting. The syntax is described in detail here: XML Rule - Perform Action Syntax.
@@ -3669,7 +3591,10 @@ Classloading Notes
Finding classes
-AddonRegistry.getServices(MyServiceInterface.class)
+AddonRegistry.getServices(MyServiceInterface.class)
+
+// To get the AddonRegistry, use Windup's FurnaceHolder:
+FurnaceHolder.getFurnace().getAddonRegistry().getServices(MyServiceInterface.class);
@@ -3695,6 +3620,28 @@ Which cla
+Reading annotations from classes
+
+Since classes can be proxied by Forge/Furnace, it’s safer to read annotations using Annotations API:
+
+
+
+Rules annotation = Annotations.getAnnotation(this.getClass(), Rules.class);
+
+
+
+Supposedly, Furnace proxies should also be able to handle such call:
+
+
+
+Rules annotation1 = ((FurnaceProxy) proxy).getOriginalClass().getAnnotation(Rules.class);
+
+
+
+TODO: Find out how exactly this is done.
+
+
+
How do I know if I am in a Furnace service?
Every furnace service is wrapped in a proxy. If it came from another
@@ -4709,7 +4656,7 @@
Rule providers
-Models
+Models
-
@@ -4979,7 +4926,7 @@
Rule providers
-Models
+Models
_Subclasses of WindupVertexFrame.
@@ -5418,6 +5365,15 @@ Classloading Problems
Configuring dependencies in a Forge-based project can be a little tricky.
See Dependencies for some hints.
+
+
+Caused by: java.lang.IllegalArgumentException: Type value for model 'org.jboss.windup.rules.files.model.FileReferenceModel' is already registered with model org.jboss.windup.rules.files.model.FileReferenceModel
+
+
+
+This means that the model class is loaded twice. I.e. the module containing it is loaded twice. Or, in tests, you may be (accidentally) adding the class to the deployment.
+This may especially happen after Maven coordinates of some module are changed.
+
Wiki and Product Documentation
@@ -5668,34 +5624,128 @@ Product Documentation
See the CONTRIBUTING guide for AsciiDoc syntax rules regarding headers and links to make this process easier.
+
+
+Update the Windup Documentation with the Latest Wiki Changes
+
+Summary
+
+The Windup guides are located in the windup-documentation/docs directory. They are named the same as the guides in the Wiki but have a 'Windup-' prefix. The windup-documentation/docs guides should kept synchronized with the versions in the windup.wiki.
+
+
+
+
+
+
+
+
+Wiki Guide
+Windup Docs Guide
+
+
+
+
+User-Guide.asciidoc
+Windup-User-Guide.adoc
+
+
+Rules-Development-Guide.asciidoc
+Windup-Rules-Development-Guide.adoc
+
+
+Core-Development-Guide.asciidoc
+Windup-Core-Development-Guide.adoc
+
+
+Migration-Planning-Guide
+Windup-Migration-Planning-Guide.adoc
+
+
+
+
+Documentation Update Scripts
-The https://github.com/windup/windup-documentation/tree/master/scripts/windupDocUpdate.sh script copies the pages from the Windup wiki to the windup-documentation repository, makes minor modifications, and generates each guide in a single HTML page book format. The resulting guides are created in the html/ directory.
+The https://github.com/windup/windup-documentation/tree/master/scripts/windupDocUpdate.sh script copies the pages from the Windup wiki to the windup-documentation repository, makes minor modifications, and generates each guide in a single HTML page book format. The resulting guides are created in the WINDUP_DOCUMENTATION_HOME/html/ directory.
+
+The script performs the following steps.
-
-Publish the HTML docs to online docs (at GitHub IO)
-
-
+
+
-
-
The first time, you must fork and clone the windup GitHub repository. After that, just fetch the latest upstream.
-
+Copies the Windup wiki pages to the WINDUP_DOCUMENTATION_HOME/docs/ directory, renaming them with the .adoc extension.
+
+-
+
Makes sure each guide includes all pages that are referenced by pages within it. Scripts are provided to search for links within each individual guide. They navigate to the WINDUP_DOCUMENTATION_HOME/docs/ directory and search using the following command:
+
-git clone https://github.com/windup/windup.git
-git fetch upstream
+grep 'xref:[A-Z]' `find . -name '*.adoc'`.
+
+
+
+-
+
Replaces each xref: to external pages with an xref: using the following command.
+
+
+find . -name '*.adoc' -print | xargs sed -i 's/xref:/xref:/g'
-
-
The first time, you must fork and clone the windup-documentation GitHub repository. After that, just fetch the latest upstream.
+Navigates to the WINDUP_DOCUMENTATION_HOME/ directory and builds the books. The single page HTML files are created in the WINDUP_DOCUMENTATION_HOME/html/ directory.
+
+
+
+
+
+
+
+Windup Guide
+Command
+
+
+
+
+Windup User Guide
+asciidoctor -t -dbook -a toc -o html/WindupUserGuide.html docs/Windup-User-Guide.adoc
+
+
+Windup Rules Development Guide
+asciidoctor -t -dbook -a toc -o html/WindupRulesDevelopmentGuide.html docs/Windup-Rules-Development-Guide.adoc
+
+
+Windup Core Development Guide
+asciidoctor -t -dbook -a toc -o html/WindupCoreDevelopmentGuide.html docs/Windup-Core-Development-Guide.adoc
+
+
+
+
+
+
+
+
+
+
+Publish the HTML Docs for Access at GitHub IO
+
+The https://github.com/windup/windup-documentation/tree/master/scripts/windupPublish.sh script copies the pages from the Windup wiki to the windup-documentation repository, makes minor modifications, and generates each guide in a single HTML page book format. The resulting guides are created in the WINDUP_DOCUMENTATION_HOME/html/ directory.
+
+
+The script performs the following steps.
+
+
+
+-
+
The first time, you must fork and clone the windup GitHub repository. After that, just fetch the latest upstream.
-git clone https://github.com/windup/windup-documentation.git
+git clone https://github.com/windup/windup.git
git fetch upstream
-
-
Navigate to the local windup directory.
+Navigate to the local WINDUP_HOME/ directory.
cd windup
@@ -5703,26 +5753,28 @@ Publish the HTML doc
-
-
Checkout the gh-pages from the windup repository
+Checkout the gh-pages from the WINDUP_HOME repository
-git checkout -b gh-pages windup
+git checkout -b gh-pages windup/gh-pages
-
-
If the directory does not yet exist, create a docs/WINDUP-RELEASE-html/ directory.
+If the WINDUP_HOME/docs/WINDUP_RELEASE/ directory does not yet exist, create a docs/WINDUP_RELEASE/html/images/
-mkdir -p docs/2.0.0.VERSION/html (if it doesn't exist!)
+mkdir -p docs/WINDUP_RELEASE/html/images (if it doesn't exist!)
-
-
Copy any new images, stylesheets, and html files from windup-documentation:
+Copy any the images, stylesheets, and html files from windup-documentation:
-cp ../windup-documentation/html/*.html ../windup-documentation/*.css ../windup-documentation/images/* docs/2.0.0.VERSION/html
+cp WINDUP_DOCUMENTATION_HOME/html/*.html WINDUP_HOME/docs/WINDUP_RELEASE/html/
+cp WINDUP_DOCUMENTATION_HOME/*.css WINDUP_HOME/docs/WINDUP_RELEASE/html/
+cp WINDUP_DOCUMENTATION_HOME/images/* WINDUP_HOME/docs/WINDUP_RELEASE/html/images/
@@ -5751,7 +5803,69 @@ Publish the HTML doc
-
-
View the documentation at http://windup.github.io/windup/docs/2.0.0.VERSION/html/WindupUserGuide.html
+View the documentation at http://windup.github.io/windup/docs/WINDUP_RELEASE/html/WindupUserGuide.html
+
+-
+
Update the symlink for latest to point to the new version.
+
+
+-
+
Navigate to the WINDUP_HOME/docs directory.
+
+-
+
Remove the existing symlink for "latest".
+
+
+unlink latest
+
+
+
+-
+
Create a symlink to the new documentation.
+
+
+Syntax: ln -s WINDUP_RELEASE latest
+Example: ln -s 2.0.0.Final latest
+
+
+
+-
+
Add the modified "latest" directory to Git.
+
+
+git add latest
+
+
+
+-
+
Commit the change.
+
+
+git commit -m 'Replace symlink for latest to point to 2.0.0.Final'
+
+
+
+-
+
Push the changes to your own git repository, verify and issue a pull.
+
+
+git push origin HEAD
+
+
+
+-
+
Push the changes upstream
+
+
+git push upstream gh-pages
+
+
+
+-
+
View the documentation at http://windup.github.io/windup/docs/latest/html/WindupUserGuide.html
+
+
+
@@ -5925,7 +6039,7 @@ Reporting Terms