This HowTo describes how to add a new kind of routine step to OptSuite.
Knowledge of the basic extension concepts of OptSuite are required as well as some Java knowledge.
MeasurementRoutineStep is a simple interface with its most important method run(). In run() a MeasurementRoutineStep is asked to perform its very specific action. All other methods of the interface are used to display the RoutineStep and its settings. AbstractMeasurementRoutineStep implements the interface suitable for most new RoutineStep. Inheriting your new RoutienStep from AbstractMeasurementRoutineStep is good practice. Done so you you’ll only have to implement getStepTreeNode(MeasurementRoutineTreeNode parent) and run(). A common implementation would look like this:
public MeasurementRoutineStepTreeNode getStepTreeNode(MeasurementRoutineTreeNode parent) { MeasurementRoutineStepTreeNode treeNode = new MeasurementRoutineStepTreeNode(parent, this); treeNode.setTitle("My first Task"); treeNode.setIcon(myRoutineStepIcon); return treeNode; } public void run() { // do whatever my routine step has to do }
One MeasurementRoutineStep is instantiated per reference in a MeasurementRoutine, so there is no need to work with a PreferencesObject like for MeasurementTools. MeasurementRoutineSteps can store their configuration data within themselves, they are persited within the MeasurementRoutineStore. Note that this will fail unless you do not register your new RoutineStep in the global classsharing by the globalclasspublish extension point of com.nightlabs.classsharing.
As mentioned above one MeasurementRoutineStep is instatiated per membership in a MeasurementRoutine. The registration and instantiation of a RoutineStep is done via an extension point of OptSuite: imtek.optsuite.acquisition.measurementroutinestepfactory. Extensions to this point have to implement the MeasurementRoutineStepFactory interface. They will be asked to create new MeasurementRoutineSteps to a given MeasurementRoutine. The creation parameters can be configured with parts of the “New Routinestep”-Wizard a factory can provide.
Extension to the stepfactory point can be grouped into categries. All factories of a category will be grouped in the Wizards first page. Here is how a typical extension for a new RoutineStepFactory might look:
<extension point="imtek.optsuite.acquisition.measurementroutinestepfactory"> <!-- This is the categroy definition --> <measurementRoutineStepCategory description="My new Category" icon="icons/myCategoryIcon.gif" id="imtek.optsuite.mytasks.myCategory"/> <!-- Here now follows the element defining the MeasurementRoutineStepFactory --> <measurementRoutineStepFactory categoryID="imtek.optsuite.mytasks.myCategory" class="imtek.optsuite.mytasks.Task1Factory" icon="icons/task1.gif" stepDescription="This is the first task I wrote"/> </extension>
The above XML defines a new category “My new Category” and one MeasurementRoutineStepFactory within this category. The most important attribute of the measurementRoutineStepFactory-element is class. This has to be the fully qualified classname of an implementation of MeasurementRoutineStepFactory.
![]() | ![]() |
| This is how the “Add routine step”-Wizard would look like with the definitions we’ve just made. | Here is how a newly created Task1RoutineStep would be displayed in the “Routine-tree” |
All measurement data that is instances of AcquiredData should be stored within the DataStore to the parent MeasurementRoutine of a MeasurementRoutineStep.
Documentation

