Skip to content

Examples.md

Andre Bossert edited this page Mar 18, 2017 · 1 revision

Examples

This page contains a collection of sample feature models illustrating basic usage of the YAFMT tool. See Feature Model Editor and Feature Configuration Editor for instructions how to use feature model and configuration editor.

Each example contains downloadable zipped project which can imported into an Eclipse workspace using File > Import from the main menu and selecting General / Existing Project into Workspace.

Some of the examples also contains XSLT stylesheet that transforms feature configuration into an useful artefact, like HTML page or XML document. To run this tranformation, you will need a XSLT 2.0 processor like Saxon 9 which is also used in our examples bellow.

Car Example

Download: CarExample.zip

Simple Hello World example with feature model of a car. The contained XSLT stylesheet transforms feature configuration into a HTML page invoice.html that represents invoice of the configured car. The transformation can be run with:

java -jar saxon9.jar -s:CarExample.yafc -xsl:invoice.xsl -o:invoice.html

Feature Diagram

Feature diagram of the Car Example

Constraints

  • kl_entry implies pw_locks - Keyless entry requires power locks.
  • not (elec_eng and man_tr) - Electric engine cannot have manual transmission.
  • not (gas_eng and dies_eng) - Gas and Diesel engine cannot be combined together.

Sample Configuration

Sample configuration of the Car Example

Tomcat 7 Configuration

Download: Tomcat7Config.zip

The following feature model represents a small subset of Tomcat 7 configuration options. The contained XSLT stylesheet transforms feature configuration into a tomcat configuration file server.xml. The transformation can be run with:

java -jar saxon9.jar -s:Tomcat7Config.yafc -xsl:server.xsl -o:server.html

Warning: You should never use the generated server.xml file on your server! This is just an example usage of YAFMT.

Feature Diagram

Feature diagram of the Tomcat 7 Configuration

Constraints

  • conn_apr implies apr - When using APR/native connector, the APR must be enabled.
  • (exists connector: conn_apr and conn_ssl) implies apr_ssl - When using APR/native connector with SSL, the APR and SSL must be enabled.

jQuery UI Builder

Download: jQueryUIBuilder.zip

The feature model in this example imitates functionality of the jQuery UI Download Builder which allows you to build and download customized jQuery UI library. The contained XSLT stylesheet transforms feature configuration into a HTTP request to download the configured package. In the command below, the cURL tool is used for sending the HTTP requst:

java -jar saxon9.jar -s:jQueryUIBuilder.yafc -xsl:request.xsl | curl -d @- 'http://download.jqueryui.com/download/' > jquery.zip

Feature Diagram

Feature diagram of the jQuery UI Builder

Constraints

  • droppable implies draggeable - Droppable interaction requires Draggeable interaction.
  • autocomplete implies position - Autocomplete widget requires Position.
  • dialog implies (draggeable and droppable) - Dialog widget requires Draggeable and Droppable interactions.
  • menu implies position - Menu widget requires Position.
  • tooltip implies position - Tooltip widget requires Position.

Sample Configuration

Sample jQuery UI Build