Component methods

You can call a component method for the component to perform some operation. For example, you can call the update method of the DataBlox component, which updates the data that the component retrieves from the database.

Methods are defined in the component descriptor file. Methods can have any number of arguments. The following example shows how methods are defined in the component descriptor file. The first method, execute, has no arguments, and the second method, login, has two arguments.

<bbcomp:methods>
  <bbcomp:method name="execute"/>
  <bbcomp:method name="login">
    <argument-list>
      <argument-descriptor>
        <property-name>UserName</property-name>
        <property-type>String</property-type>
      </argument-descriptor>
      <argument-descriptor>
        <property-name>Password</property-name>
        <property-type>String</property-type>
      </argument-descriptor>
    </argument-list>
  </bbcomp:method>
</bbcomp:methods>

Each component method that is defined in the component descriptor file has a corresponding public method in the Java™ class. Every method returns void. For example, the two methods that are defined in the above example would appear in the Java class as:

public void execute();
public void update(String userName, String password);

To call a component method, you must use the MethodCallAction action, which takes the component's ID and the component's method name. Then, the component context invokes the method.