OpenLegacy comes with a built-in analyzer which enables you to analyze recorded screens and convert them to meaningful strong type Java classes, while analyzing all host component into data types and/or Java annotations.

The analyzer rules are bundled within OpenLegacy Eclipse plug-in, which is part of openlegacy-designtime JAR. We understand that it’s impossible to have predefined rules that know how to analyze any host application on the planet, so we let you as a developer customize it at will.

To customize the analyzer, right click on the project, and select: OpenLegacy -> “Customize Analyzer rules…”

The resulting file, contains a list of rules and matching parameters for each analyzer rule. For most cases, changing the parameters is enough. The rules are based on JBoss Drools project (.drl files), the leading open-source rule engine. It is required to learn Drools in order to write your own rules. We embrace it. In addition, it is required to understand regular expression, as they are widely used within the rules.

Let’s take a simple example. You have window screen which its frame is:

* *
* *

In this case you can either modify identify-window rule parameters to the matching regex:

Code Snippet:

Or, you can replace an existing pattern, or add a new ruleParametersSet to apply this rule in addition to the other patterns.

(NOTE: At the time of writing, OpenLegacy has no graphical representation of host windows. It is used for API purposes for now).

Writing your own rules
OpenLegacy provides you the capability to add your own custom rules. A sample.drl is included within src/main/resource/rules. It is required to include it within the project customized openlegacy-designtime-context.xml (has a commented example).

You may follow existing rules to better understand how to write rules.