Java Process Starter

Java Process Starter is a process starter activity. You can use this activity to create a custom starter written in Java.

General

Java Process Starter Abstract Class

The JavaProcessStarter abstract class defines the interface of your Java Process Starter with the TIBCO BusinessWorks™ Container Edition application. You must define an implementation for the following methods:

  • init() : this method is called when the process engine starts up. This method should initialize any resource connections. You could also specify a Java global instance on the Advanced tab that initializes resource connections. Java global instances are also loaded and initialized during application start up. You can call this .getJavaGlobalInstance() to obtain the Java global instance resource in your process starter code.
  • onStart() : this method is called by the process engine to activate the process starter. This method should activate any event notifier or resource observer code. The notifier or observer code can then call the onEvent() method to start a process instance.
  • onStop(): this method is called by the application to deactivate the process starter. This method should deactivate any event notifier or resource observer code.
  • onShutdown(): this method is called by the application when the AppNode shuts down. This method should release any resources and resource connections and perform any required clean up operations.
The following methods are already implemented and can be used in your code:
  • onEvent(Object object): this method is called when a listener or resource observer catches a new event. The input to this method is a Java object containing the event data.
  • getGlobalInstance(): this method returns an object reference to the Java global resource specified on the Advanced tab of the process starter. This is useful if you want to place initialization code or other shared information in a Java global resource instead of in the init() method of this class.
  • onError(): this method throws the exception specified in the input parameter. Use this method to propagate an error to the ActiveMatrix BusinessWorks™ process instance when a listener or resource observer fails to generate an event.

Passing Java Objects Between Java Activities

You can create instances of Java objects in Java Invoke activity or by using the Java Invoke or XML To Java activities. These Java objects can be passed using an output parameter to another activity later in the process definition. The Java Invoke activity receiving a Java object accepts the object into an input parameter. Map the output Java object to the input object of the receiving Java Invoke object.

Note: Any Java objects passed by input and output parameters between activities should have the capability to serialize.

The General tab has the following fields.

Field Process Property Description
Name No The name to be displayed as the label for the activity in the process.
Class Name No The name of the compiled Java class that is implemented by extending the JavaProcessStarter abstract class.

Use the Browse a Class button to select the class from the specified class library. This shows the classes that extend from the JavaProcessStarter abstract class.

Initialize with Parameters No Selecting this check box displays the Init Method field and Init Parameters table.
Init Method No Selecting the Initialize with Parameters check box displays this field.

You can use the list, if required, to select a different method in the selected Java class.

Init Parameters No Specify default values in this table for the input parameters of the init() method. Each input parameter has three fields:
  • Parameter Name: the name of the parameter.
  • Parameter Type: the datatype of the parameter.
  • Parameter Value: specify a default value for the parameter. It can be a string or a module property.

Description

Provide a short description for the activity.

Advanced

The Advanced tab has the following fields.

Field Literal Value/Module Property Description
Sequence key None This field can contain an XPath expression that specifies which processes should run in sequence. Process instances with sequencing keys that evaluate to the same value are executed in the sequence the process instance was created.
Custom Job Id None This field can contain an XPath expression that specifies a custom job ID for the process instance.
Java Global Instance Yes A Java global instance resource. Specify a value in this field to reference a Java global instance resource in your JavaProcessStarter implementation class.

For more information, see Java Global Instance.

You can use the getGlobalInstance() method to obtain a reference to the Java global instance resource.

Output

The following is the output of the activity.

Output Item Datatype Description
javaObject varies The Java object that was passed to the onEvent() method.

By default, this element is a Java object reference.

Fault

The Fault tab lists the possible exceptions generated by this activity. For more information about error codes and the corrective action to take, see the TIBCO BusinessWorks™ Container Edition Error Codes guide.

Fault Generated When..
JavaEventSourceException Problem occurs on some event.