Introduction to MDAccess for DOORS

By SodiusWillert | 12/01/2012 | Reading time: 8 min

IBM Rational DOORS is a requirements management application, allowing the user to capture, track and manage requirements.

SodiusWillert provides MDAccess for DOORS as a way to get access to all of this information using a simple Java API and Eclipse EMF representation.

This article is a presentation on how to use this technology.

For more details on how to use MDWorkbench, refer to the Introduction to MDAccess for Excel article.

DOORS Metamodel

The following picture represents a subset of the DOORS metamodel:

Subset of DOORS Metamodel
 
Subset of DOORS Metamodel
 
The root element in the DOORS metamodel is Folder. In a DOORS session, the root Folder is called "Root Folder".

A Folder is made of Modules, that can be Formal (FormalModule) or Link (LinkModule).

A FormalModule has Objects, and Objects can contain other Objects (nestedObjects).

A LinkModule can have LinkSets, themselves containing Links between Objects. A LinkSet is represented by a source FormalModule and a target FormalModule.

Modules have Attributes.

 

Elements in DOORS
 
Elements in DOORS

 

Visualizing DOORS information in a viewer

To read from a DOORS database, the DOORS client application must be open. Our example, the EasyStart training database, is provided by IBM.

EasyStart Training
EasyStart Training

 

Using the Application reader, open the DOORS Database in MDWorkbench.

Note: To learn how to open a Model in MDWorkbench, refer to the Introduction to MDAccess for Excel article.

It is possible to choose the items to import (folder, project, or module). In this case, we select the "EasyStart" Project and its contained elements:

Import EasyStart Project
Import EasyStart Project

There are several import modes:

On-Demand

Into this mode, data is read from the application when requested. A click on the plus sign of a relation calls the appropriate DOORS API.

Indeed, the main reason to use the On-Demand mode is the size of databases. When they are too large, it is a means to load only the interesting part and not the entire database.

Exclude

In this mode, data is never read.

Complete

Into this mode, all selected elements are read at once. This is an interesting mode when all the information from a particular node in the DOORS database is needed.

We choose to import the EasyStart project using the "On-Demand" mode.`

Note: It is also possible to import a particular Baseline.

Baseline Import
Baseline Import
 
The DOORS model is opened in the MDWorkbench Model Editor. Only one Folder is loaded: the Root Folder.
 
On demand: Root Folder
On-Demand: Root Folder

 

To load the other elements, click on the "ownedItems" reference. The "EasyStart Tutorial" Folder is loaded.

On Demand loading

 

Use Java to read the model

We would like to programmatically get the Folders' qualified names:

Hierarchy of Folders
Hierarchy of Folders

Create a Plug-in Project called "com.sodius.blogs.demo.doors" and add the following dependencies:

  • com.sodius.mdw.core: the SODIUS infrastructure classes
  • com.sodius.mdw.metamodel.doors: the DOORS metamodel Java APIs
  • com.sodius.mdw.metamodel.doors.connectors.dxl: the DXL reader/writer for the DOORS metamodel
Plugin Dependencies
Plugin Dependencies

Create a Java Class called "ExploreDoorsDatabase":

package com.sodius.blogs.demo.doors;

public class ExploreDoorsDatabase {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}

First create an instance of MDWorkbench, then get the DOORS metamodel, and instantiate it:

MDWorkbench mdw = MDWorkbenchFactory.create();
Metamodel doorsMetamodel = mdw.getMetamodelManager().getMetamodel("doors");
Model doorsModel = doorsMetamodel.createModel();

Use the "Application" reader to populate the Model.

  • By default, the Application reader will read the data On Demand. We just need to add an option not to open the connector's user interface:
Map options = new HashMap();
options.put("doors.ignoreConnectorUI", Boolean.TRUE);
doorsModel.read("Application", "", options);
  •  Then, get the "Root Folder" Folder, and iterate through its owned items:
Folder folder = (Folder) doorsModel
.getInstances(DoorsPackage.eINSTANCE.getFolder(), false).first();
MDWList<Item> ownedItems = folder.getOwnedItems();
printFolder(ownedItems);

with:

private static void printFolder(MDWList<Item> items){
for (Item item : items) {
if(item instanceof Folder){
System.out.println(((Folder)item).getQualifiedName());
printFolder(((Folder)item).getOwnedItems());
}
}
}

Note: For more information on how to use reader options, please refer to the MDAccess documentation.

Now, execute the code, running a Runtime configuration.

Note: To know how to launch a Runtime Configuration in MDWorkbench, and notably to set the license location, refer to the Introduction to MDAccess for Excel article.

Console output:

/EasyStart Tutorial
/EasyStart
/EasyStart/Change Proposal System
/EasyStart/Requirements
/EasyStart/Sub-systems
/EasyStart/Test
/EasyStart Tutorial/EasyStart Learning Area
/Example Data
...
/Example Data/Company Standards/Procedures
/Example Data/General information
/Lost and Found

We would now like to get the elements (Objects, Formal, and Link Modules) under the "Design" Folder:

 

Design Folder Design Folder

 

  • First, we need to reduce the scope of reading to the "Design" Folder. This time we are doing a complete import because all the elements from the "Design" Folder are needed.
ReaderScope scope = new ReaderScope();
scope.getItemScope("/Sports utility vehicle 4x2/Design")
.setMode(ItemScopeMode.COMPLETE);
options.put("doors.scope", scope);
doorsModel.read("Application", "", options);
  • Then we get the "Change Proposal System" Folder:
Folder folderChange = (Folder) doorsModel
.getInstances(DoorsPackage.eINSTANCE.getFolder(), false)
.detect("name", "Design");
System.out.println("nnCurrent Folder = " + folderChange);
  • And we print the different items:
MDWList<Item> items = folder.getOwnedItems();
for (Item item : items) {
if(item instanceof FormalModule){
System.out.println("Formal Module = " + module.getName());
MDWList<Object> objects = ((FormalModule)item).getObjects();
for(Object object : objects){
System.out.println("tObject = " + object.getObjectHeading());
}
}else if(item instanceof LinkModule){
System.out.println("Link Module = " + module.getName());
MDWList<LinkSet> linkSets = ((LinkModule)item).getLinkSets();
for(LinkSet linkSet : linkSets){
System.out.println("tModule Source = "
+ linkSet.getSourceModule().getName()
+ " - Module Target = "
+ linkSet.getTargetModule().getName());
}
}
}

Console output:

Current Folder = Design
Formal Module = Architecture
Object = Body
Object = Drive system
Object = Braking system
...
Object = Indications
Object = Entertainment system
Link Module = Architecture Links
Module Source = - Module Target = Architecture
Formal Module = CI Structure
Object = Electrical equipment
Object = Lighting equipment
Object = Sensors
Object = Motors

Conclusion

This article shows you how to easily read DOORS Database using MDAccess for DOORS. Using the On-Demand connector, the execution is faster because just the needed/necessary elements are read.

Talk to an Expert Today!

Resources

The complete Eclipse project: com_sodius_blogs_demo_doors (File > Import > General > Existing project into Workspace > Select archive file)

Leave us your comment

Most read articles

Subscribe to our blog

Watch the product demo

OSLC Connect for Jira: integrate Jira with IBM Engineering Lifecycle Management.

Icon_OSLC Connect for Jira_color_144*144px_SodiusWillert_2020_RVB

 

OSLC Connect for Jira leverages Open Services for Lifecycle Collaboration (OSLC) technology to collaboratively allow linking across design and implementation teams and better manage requirements and compliance.