The Pruner Component
The Pruner component can be used to remove all structures (architecture structures), types, and version graphs that are not part of a selected architecture found in a xADL document. The algorithm used in the Pruner component traverses through the architectural elements hierarchicaly and discovers which elements are not linked up to architecture and need to be "pruned." The algorithm achieves this by taking a starting element, either a type or structure, and then hierarchically visiting each of the structures' architectural elements (components, connectors, and interfaces) and inspecting those elements' corresponding types as well as visiting the substructure (if any) of all component types and connector types. Any elements not visited in this fashion are removed from the document. Ultimately, this results in an architecture that consists only of architectural elements that can be reached by traveling hierarchically down the architecture from the specified starting element. Additionally, the pruner removes any version graph whose internal nodes are not referenced by any type included in the selected architecture. The entire document is cloned before pruning so that the pruning is performed on a copy of the document. For more information on xADL documents, visit the xADL 2.0 website.
The diagram below gives a simple illustration on what the Pruner
component does to an architecture. The architecture on the left hand side
includes a structure containing components A, B, and C. The architecture
also contains the components' respective types (links to these types are shown
with dotted arrows) as well as two extraneous types, component types D, and E.
The resulting architecture after the pruning operation was performed (seen on
the right) looks just like the original architecture; however, the extraneous
types are removed. Also, supposing component type E had internal
substructure its substructure would be removed too (not shown in diagram).
Please click on the image to enlarge in a separate window.
|
This component could be used, for example, after an architecture has been run
through the
Selector component. The larger architecture will only have a subset selected
from it and the unselected types and structures will then be removed after being run through the
Pruner.
Please refer to the
Selector Driver component for instructions on how to use the Selector and
Pruner components through a convenient GUI.
Using the Pruner
In order to use the Pruner component, it is necessary to create and fire off a PerformArchPrunerMessage within the component that wishes to make use of the Pruner service. The PerformArchPrunerMessage constructor is defined as follows:
PerformArchPrunerMessagepublic PerformArchPrunerMessage(String archURL, String targetArchURL, String componentID, String startingID, boolean isStructural)
|
The PerformArchPrunerMessage should be sent up the ArchStudio architecture. The following code demonstrates this:
/* * Create a PerformArchPrunerMessage message. * Assumes that arguments used exist and were * already assigned appropriately. */ PerformArchPrunerMessage pruneMessage = new PerformArchPrunerMessage(archURL, targetURL, componentID, startingID, isStructural); // Send request up to the Pruner's bottom Iface sendToAll(pruneMessage, topIface); |
The Pruner component fires off ArchPrunerStatusMessage messages to indicate the progress of the "pruning." These messages can be intercepted and used to keep track of the progress of the Pruner operations. The ArchPrunerStatusMessage message holds the following values that can be used for determining the state of a "prune" operation:
ArchPrunerStatusMessagepublic ArchPrunerStatusMessage(String prunedArchURL, String componentID, int currentValue, int upperBound ,boolean isDone, boolean errorOccurred, Exception error)
|
All of these values can be obtained through a simple get operation. For
example, getPrunedArchURL()
would get the prunedArchURL value,
getComponentID()
would get the componentID value, and so forth.
Questions about the Pruner should be sent to Christopher Van der Westhuizen.