The Plate Example

As an example of the development of an Executor, we return to the Plate example.

The plate component is described in The Plate Example.

The Executor for this component must obtain the values of the “Shape” and “Material” properties and calculate the “Area,” “Volume,” and “Weight” based on the dimension parameters provided.

For this simple Plate component there is no external application involved and no need to make this component persistent. Therefore, you can implement the execute method.

The basic sequence of steps for execution are:

  1. Get all necessary property values, which are accessible from the RuntimeEnv object passed in.

    String theShape = 
    runEnv.getScalarProperty("Shape").getValueObj().getAsString();
    String theMaterial =
    runEnv.getScalarProperty("Material").getValueObj().getAsString(
    );
    

  2. Get the values of input parameters, which are contained in a separate Context object available from the RuntimeEnv.

    AggregateVariable dimensions = ((AggregateVariable)runEnv.getContext().
    getParameter("Dimensions"));
    ScalarVariable thicknessParm =
    runEnv.getContext().getScalarParameter("Thickness");
    

  3. Invoke any necessary applications or perform calculations internally (see the full code example in Component Development Reference).

  4. Set values of output parameters:

    runEnv.getContext().getScalarParameter("Area").getValueObj().setValue(ar
    ea);
    runEnv.getContext().getScalarParameter("Volume").getValueObj().setValue(
    volume);
    runEnv.getContext().getScalarParameter("Weight").getValueObj().setValue(
    weight);
    

The complete code for the Executor for this Plate component can be found in Component Development Reference.