+

Search Tips   |   Advanced Search


SampleAction.java code sample

This is an example of SampleAction.java.


SampleAction.java

package test;

import com.ibm.rational.test.lt.kernel.IKSubsystem;
import com.ibm.rational.test.lt.kernel.action.IContainer;
import com.ibm.rational.test.lt.kernel.action.impl.KAction;

public class SampleAction extends KAction {
  final String subsystemName = "test.SampleSubsystem";
  private boolean serviced = false;

  public SampleAction(IContainer arg0, String arg1) {
    super(arg0, arg1);
    // TODO Auto-generated constructor stub
  }

  public void execute() {
    if (serviced) {
      reportMessage("SampleAction execute():  service completed");
      finish();
    } else {
      IKSubsystem subsystem = getSubsystem(subsystemName);
      if (subsystem != null) {
        reportMessage("SampleAction execute():  requesting service");
        subsystem.enqueue(this);
      } else {
        reportMessage("SampleAction execute():  Cannot find subsystem '" + subsystemName + "'");
        finish();
      }
    }
  }
  
  public void setServiced() {
    serviced = true;
  }
}