fmp: Feature Modeling Plug-in

The Feature Modeling Plug-in (fmp) is an Eclipse plug-in for editing and configuring feature models. Fmp can be used standalone in Eclipse or together with fmp2rsm plug-in in Rational Software Modeler (RSM) or Rational Software Architect (RSA). fmp2rsm integrates fmp with RSM and enables product line modeling in UML.

Fmp is an open-source project hosted on SourceForge.

Current Version: 0.6.6 - research prototype

Examples are attached to publications.

Project status: Completed
The project has been completed and the tool is no longer maintained. See Clafer for our current work on feature modeling.

Team Members

News

Publications

2005
Czarnecki, K., S. Helsen, and U. Eisenecker, "Staged configuration through specialization and multilevel configuration of feature models", Software Process: Improvement and Practice, vol. 10, issue 2, pp. 143 - 169, 04/2005. [pdf]
Czarnecki, K., S. Helsen, and U. Eisenecker, "Formalizing cardinality-based feature models and their specialization", Software Process: Improvement and Practice, vol. 10, issue 1, pp. 7 - 29, 01/2005. [pdf]
Czarnecki, K., and C H P. Kim, "Cardinality-based feature modeling and constraints: a progress report", International Workshop on Software Factories at OOPSLA'05, San Diego, California, USA, ACM, 2005.
Czarnecki, K., and M. Antkiewicz, "Mapping Features to Models: A Template Approach Based on Superimposed Variants", ACM SIGSOFT/SIGPLAN International Conference on Generative Programming and Component Engineering (GPCE'05), vol. 3676, Tallinn, Estonia, Springer-Verlag, pp. 422 - 437, 2005. [pdf][zip][zip]
Kim, C H P., and K. Czarnecki, "Synchronizing Cardinality-Based Feature Models and Their Specializations", European Conference on Model Driven Architecture – Foundations and Applications (ECMDA-FA’05), vol. 3748, Nuremberg, Germany, Springer-Verlag, pp. 331 - 348, 2005.
2004
Czarnecki, K., S. Helsen, and U. Eisenecker, "Staged Configuration Using Feature Models", Third Software Product-Line Conference (SPLC’04), 2004, vol. 3154, Boston, USA, Springer-Verlag, pp. 266-283, 09/2004. [zip]
Antkiewicz, M., and K. Czarnecki, "FeaturePlugin: Feature Modeling Plug-In for Eclipse", The 2004 OOPSLA Workshop on Eclipse Technology eXchange - Eclipse '04, Vancouver, British Columbia, Canada, ACM Press, pp. 67 - 72, 2004. [pdf][zip]

Overview

XPath 2.0 Constraints

Use node Ids to refer to elements in the feature model. Ids are unique within a feature diagram (i.e., the subtree of a root feature).

f1 requires f2 := if (//f1) then (//f2) else true();

or using our syntactic sugar: (//f1) -> (//f2);

f1 excludes f2 := if (//f1) then not (//f2) else true();

New Model Wizard

Direct (in-place) Edit in modeling, configuration and Properties View

Use Dbl-left-click or space on a tree item to enter in-place editor.

Feature Comaprison View

Expand Subtree Action

Shortcut: <ALT>+<down arrow>

Synchronize Action

Extensible Metamodel as a Feature Model

Show/Hide Unused Metamodel Extensions

Navigation in configuration hierarchy (Go Home, Go Into, Go Back actions)

Unfold Reference action

The action can be used both in the model and in the configuration.

External references (via Load Resource... action)

Cloning with dbl-left-click in configuration

Features implemented in 0.5.2, but no longer implemented in 0.6.6:

fmp 0.7.0

Please note that fmp 0.7.0 is still in development. The constraint checking in the Constraints View is highly experimental. It’s results should be correct when features are optional or mandatory, features groups are restricted to or-groups <1-k>, and xor-groups <1-1>. Feature cardinalities are not supported and untested at the moment.

Installation

New Features

Known Issues

AttachmentSize
ca.uwaterloo.gp_.fmp_0.7.0.jar1.41 MB

Flash Demo

Flash version of a demo presented at OOPSLA'05

Plug-in fmp2rsmVerifier 0.0.1 used in the demo has not been released.

HOW TOs

    start?
  1. set max to * (unbounded)?
  2. create a feature diagram?
  3. create a configuration?

  4. configure?
  5. use in-place editing?
  6. set feature diagram reference?
  7. set up a diagram reference to the diagram from another feature model?
  8. use reference attribute?
  9. set reference attribute’s type in the Properties view?
  10. write a constraint?
  11. write f1 requires f2 constraint?
  12. write f1 excludes f2 constraint?
  13. check constraints?
  14. show hidden meta-model extensions?
  15. incorporate new meta-model extensions to the model and all configurations of its diagrams?
  16. use the Feature Comparison view?

Answers

  1. start?

    - first create a simple project. In Resource perspective, Navigator view, use New->Project…->General->Project action from the pop-up menu. Example models can be imported into the project using Import…->General->File System or Import…->General->Archive File actions.
  2. set max to * (unbounded)?

    - use -1 as a value
  3. create a feature diagram?

    - feature diagram is contained directly by feature model element (the root of the feature tree in the modeling pane) and represented by a root feature
  4. create a configuration?

    - configuration is performed with respect to feature diagram. A feature diagram can have multiple configurations. A configurations can have further configurations. To create new configuration use New Configuration of Root Feature action from the context menu on a feature. Any feature can be configured.
  5. configure?

    - select a configuration and expand it (<alt>+<down arrow> is a useful shortcut). Select feature by left-clicking on a checkbox, eliminate using <ctrl>+<left-click>. You can also override machine selections and eliminations. The conflicts are automatically resolved. Additionally, features with max cardinality greater than 1 or * can be cloned by <dbl-click> on the icon (circles).

    - We refer to the original feature as prototype and its instances as clones. The prototype does not belong to the configuration, the same way as an unchecked optional feature. The difference is that, the prototype can be pre-configured and each of the clones will be an exact copy which can be further configured.


  6. use in-place editing?

    - you can conveniently enter feature names and set diagram references in the Modeling pane using in-place editing. To enter in-place editing mode select a feature or a reference and press space or double left-click. Confirm changes by pressing enter and cancel by pressing escape. In-place editing can also be used for setting feature attribute values in configuration as well.
  7. set feature diagram reference?

    - the easiest way is to simply drag a root feature of the diagram and drop it on the reference. Another way is to use the drop down menu of the reference and choose a root feature.


  8. set up a diagram reference to the diagram from another feature model?

    - use Load Resource… action from FeatureMdl Editor menu to load another feature model into editor’s resource set. Diagrams from every model in the editor’s resource set are available for selection from the drop down menu of the reference. Another possibility is to arrange two editors besides each other and use drag & drop to set a reference.
  9. use reference attribute?

    - reference attribute, unlike integer, string and float attributes, does not have default value. Instead it has a type. The reference attribute’s type can be set in the model and specifies a feature of which clones can be chosen as reference attribute’s value during specialization and configuration. If the type is unspecified, any feature can be a value.
  10. set reference attribute’s type in the Properties view?

    - the properties view is linked with the editor and updates its contents to the current editor’s selection. To set reference attribute’s type first unlink the properties view using link/unlink button . Next drag & drop a feature from the feature model onto the reference attribute’s type. Remember to link the Properties view back to the editor.


  11. write a constraint?

    - constraints reside in root features. Select a root feature in the editor’s modeling pane. If the Constraints view is linked with the editor it displays a list of constraints of the selected root feature. Use Add constraint from the pop-up menu. Write a constraint expression using XPath 2.0. You can also use two templates accessible from the context menu. It is important to use ‘;’ at the end of the constraint.

    - Every feature model element has a unique ID (withing the scope of a root feature). IDs are used in constraints to refer to feature model elements. IDs are created automatically when setting the name of the feature for the first time. IDs start with a lower case letter and consist only of letters and numbers. For example ID of feature ‘0 My New (*& feaTure’ is ‘myNewfeaTure’. IDs are case sensitive.
  12. write f1 requires f2 constraint?

    - if (//f1) then (//f2) else true(); or using our extended syntax: (//f1) -> (//f2);.


  13. write f1 excludes f2 constraint?

    - if (//f1) then not (//f2) else true();
  14. check constraints?

    - In this version of the plug-in the constraints are being automatically checked and enforced. Constraint propagation propagates choices to satisfy the constraints. Conflict resolution accepts the latest selection and resolves conflicts (if any) so that the constraints are always satisfied.
  15. show hidden meta-model extensions?

    - optional extensions of the meta-model are by default hidden in the Properties view. Use Show/hide unused annotations button located in the Properties view’s toolbar.
  16. incorporate new meta-model extensions to the model and all configurations of its diagrams?

    - what you see in the Properties view of any selected modeling element is actually a configuration of the meta-model diagram for that element (e.g.:SolitaryFeature). Modifications of the meta-model diagram have to be Synchronized with all configurations of that diagram. Use Synchronize action from the pop-up menu on the root feature of the meta-model diagram.
  17. use the Feature Comparison view?

    - Feature Comparison view is usefull for comparing different configurations. Create at least one configuration of the root feature and use Feature Comparison action from the context menu.

Known Issues

Things that need to be done:

API

There are two sources of complexity in the design of the fmp plug-in: extensible metamodel and constraint propagation & resolution.

Overview of the API

Metamodel

The metamodel is represented as a feature model as shown on the right side of the figure below. It contains three diagrams, one for each feature model element: Feature, FeatureGroup and Reference. In the example below, feature Catalog selected in the model is an instance of the meta-feature Feature. Properties view shows the configuration of the meta-feature Feature. The properties of model elements can be extended by extending the meta-feature, such as Priority extension.

Properties view on the right shows the configuration of the meta-meta-feature Feature from the meta-metamodel. The meta-metamodel is hardcoded and cannot be extended. Note, that the metamodel is not a complete one - it does not contain structural dependencies between model elements such as 'a feature group can contain features and references, but not other feature groups'.

The implementation of the plug-in is based on Eclipse Modeling Framework (EMF). The next figure shows a complete metamodel (fmp.ecore) as defined in Ecore.
Feature models are serialized according the this metamodel using standard EMF serializer. The root of the EMF resource is Project and contains model, metamodel and meta-metamodel. Every element of the feature model is a Node and contains other nodes as children. The feature model and all of its configurations are represented using the same metamodel. The origin-confs association links nodes from the model (i.e., origins) to nodes from the configuration (i.e., confs).

Features and references with max > 1 can be cloned. The prototype-clones association relates the original feature (i.e., the prototype) with its clones. Additionally, the clonables can have a configuration state which can be one of five states defined in ConfigState enumeration. The default state is UNDECIDED.
The feature-references association allows the reference to point at a feature and navigate from the feature to all references pointing at it. A feature contains a value represented by TypedValue. The fourth value type FEATURE is what we call a reference attribute, a mechanism allowing to select a feature from the configuration as a value of the attribute. A feature can also contain a Constraint in which case, the feature is the context of the constraint (i.e., the constraint may only refer to subfeatures of the context feature).

The metamodel allows configuring a subtree of any feature in the feature model in which case the feature is referred to as a root feature. A root feature contains its configurations, that is copies of its subtree, where elements are related using the origin-confs association. The configurations seen in the Properties view are contained by meta-elements (i.e., the properties of feature Catalog are the configuration of meta-feature Feature and are also contained by Feature). The root of nodes's properties is related with the node using the properties-describedNode association.

The infinite recursion caused by metacircularity is broken in the meta-metamodel nodes, which do not have properties, but use normal class attributes such as Feature.name, Node.min, Reference.feature.

The fmp.system.MetaModel class is used for the creation of initial model, metamodel and meta-metamodel. Function public static Project makeProject() is used by new model wizard to create the contents of an empty feature model.

Role Query

fmp.system.RoleQuery is a utility class used to determine the roles of a given Node. This is necessary because the same metamodel class is used to represent elements in conceptually different places. The following functions return constants defined in the RoleQuery class.

  • public int getLocationType(Node node) returns:
    CONFIGURATION,
    CONFIGURATION_PROPERTIES,
    MODEL,
    MODEL_PROPERTIES,
    METAMODEL,
    METAMODEL_PROPERTIES,
    METAMETAMODEL.
  • public int getNodeType(Node node) returns:
    UNDEFINED,
    ROOT_FEATURE,
    SOLITARY_FEATURE,
    GROUPED_FEATURE,
    SOLITARY_REFERENCE,
    GROUPED_REFERENCE,
    FEATURE_GROUP,
    FEATURE_MODEL.
  • public int getPropertyRole(Node node) returns:
    NONE,
    NAME,
    ID,
    MIN_OCCUR,
    MAX_OCCUR,
    DESCRIPTION,
    ATTRIBUTE,
    TYPE_GROUP,
    TYPE,
    VALUE,
    DEFAULT_VALUE,
    REFERENCED_FEATURE.

Model Navigation

fmp.system.ModelNavigation is a utility class used to navigate in the feature model tree.

  • public List getNodes(Node startingNode, String path)
    - Returns the node starting at the given node to the node pointed to the given path (of feature name). Works only across solitary features and grouped features. Note that this method will skip any feature group in between a solitary feature and a grouped feature. Returns null if no node was found. Use the ModelNavigation.PATH_SEPARATOR defined in this class. No PATH_SEPARATOR at the beginning of path.
  • public Node findNodeWithName(Node node, String name)
    - Returns the first node (closest to the initial argument) with the given name
  • public Feature navigateToRootFeature(Node node)
    - Returns the root feature (in the sense defined in RoleQuery) of a diagram containing the node or null for model, metamodel and meta-metamodel.
  • public Node navigateToFirstOrigin(Node node)
    - Returns its grand-grand...-grand origin node (the one that no longer has origin itself) of the given node.
  • public List getSelectedClonables(List clonables)
    - Returns nodes from the clonables list that are user or machine selected.

Model Manipulation

fmp.system.ModelManipulation is a utility class implementing common operation on the feature model. Functions copy, copyTree, copyNode, and remove work in two modes: instant or deferred. In the deferred mode, the CompoundCommand given as argument is used to accumulate individual modification commands. The modifications are applied during the execution of the command. In the instant mode, the command is null and the model is modified during the execution of the function.

  • public Node copy(Node node, EditingDomain domain, AdapterFactory adapterFactory, CompoundCommand command) - Creates a copy of a given node together with its children and properties. The copy is added as a sibling of the node.
  • public Node copy(Node node, EditingDomain domain, AdapterFactory adapterFactory, CompoundCommand command) - Creates a copy of each node in the tree. Traverses the tree recursively.
  • public Node copyNode(Node node, EditingDomain domain, AdapterFactory adapterFactory, CompoundCommand command) - Creates and returns a copy of a single node.
  • public Feature configure(Feature root) - Configures given root feature. Starts the recursion.
  • public Node configureTree(Node node) - Configures each node in the tree by calling configureNode(Node node). Traverses the tree recursively.
  • public void remove(Node node, EditingDomain domain, CompoundCommand command, boolean appendOnly) - Removes a given node together with its properties.

Commands

Package fmp.provider.command contains frequently used commands. The commands use functions from ModelManipulation class in the deferred mode.

  • CloneCommand - used to create clones of features in configuration.
  • CreateNodeCommand - used to create a new node as a child.
  • RemoveWithPropertiesCommand - used to remove a collection of nodes together with their properties.
  • SynchronizeCommand - used by 'Synchronize' action.
  • UnfoldReferenceCommand - used by 'Unfold Reference' action.

Model Access

Feature models (.fmp files) are serialized using standard EMF serializer and stored in XMI (the resource type is set to XMI in .genmodel). The root of the resource is an instance of Project class. fmp.util.FmpResourceImpl is the implementation of the resource for storing feature models. It is best to load resources using editing domain.

fmp.util.FmpExternalLoader class can be used to load multiple resources the same way the FmpEditor would. To load a resource use public void load(IFile file) or public void load(String fullPath) functions (where fullName is the same as IFile.getFullPath()). Retrieve the list of loaded resources using public EList getResources(). The root object of a resource can be retrieved using getAllContents().next(). In case of feature models, the root object can be cast to Project class.

The model should be modified using commands, which, in turn, can be executed on the command stack. The instance of the command stack can be obtained by calling getEditingDomain.getCommandStack(). Execute the command using getEditingDomain().getCommandStack().execute(Command command).

The model can be saved using public void save(int i) where i is the index of a resource to be saved.

Details of the fmp.util.FmpExternalLoader class.

  • public AdapterFactory getAdapterFactory()
  • public EditingDomain getEditingDomain()
  • public void load(IFile file)
  • public void load(String fullPath)
  • public EList getResources()
  • public void save(int i)