Java Process Starter
Java Process Starter is a process starter activity. You can use this activity to create a custom starter written in Java.
Java Process Starter Abstract Class
The JavaProcessStarter abstract class defines the interface of your Java Process Starter with the 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.
- 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 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.
General
The General tab has the following fields.
Description
Provide a short description for the activity.
Advanced
The Advanced tab has the following fields.
| Field | Description |
|---|---|
| Sequence key | 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 | This field can contain an XPath expression that specifies a custom job ID for the process instance. |
| Java Global Instance | A Java global instance resource. Specify a value in this field to reference a Java global instance resource in your JavaProcessStarter implementation class. Refer to
Java Global Instance for details.
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 thrown by this activity. See Error Codes for more information about error codes and the corrective action to take.
| Error Schema Element | Datatype | Description |
|---|---|---|
| msg | string | The error message. For details, refer to Error Codes. |
| msgCode | string | The error code. For details, refer to Error Codes. |