Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 7 Java Palette : Java Method

Java Method
Activity
The Java Method activity allows you to invoke a method contained in a Java class. You can construct an instance of the specified Java class, if you choose to invoke the constructor for the class.
The Java class file must be located in the classpath for TIBCO Designer and the TIBCO ActiveMatrix BusinessWorks process engine. Update the designer.tra and bwengine.tra file to contain the directory where your Java class files are located.
See Common Features of Java Code and Java Method for more information about features available in the Java Code activity.
Configuration
The Configuration tab has the following fields:
You can execute methods on shared Java objects created by Java Global Instance resources by specifying the resource in this field. See Java Global Instance for more information about the shared Java objects created by Java Global Instance resources.
Note: If the configuration of the Java Global Instance resource changes, you must select and view any Java Method activities in your process definitions that reference the Java Global Instance to automatically propagate the changes. An exception is raised if you attempt to test your process definitions before refreshing the reference to the Java Global Instance. You may need to manually update the mappings of any input or output if you select a new method with a different signature in the Java Global Instance resource.
Use this field to specify an AliasLibrary resource that is used to locate the Java class files. See TIBCO Designer Palette Reference for more information about AliasLibrary resources.
The declared Java class whose method you want to execute. Use the Show Class Browser button to select the class and method, or use the Java Global Instance field to specify a shared Java object.
Note: You can hover the cursor over this field to display the signature of the selected method.
Advanced
The Advanced tab has the following fields:.
See Caching the Java Class for more information about caching the declared class.
Caching the Java Class
When the Cache Constructed Class check box is selected on the Advanced tab, all instances of the same Java method activity share the same Java object. For example, each process instance that executes this Java Method activity will share the same instance of the class.
Also, if this activity is executed multiple times in a loop, each execution of this activity uses the same cached instance of the object. Figure 16 illustrates multiple processes and Java Methods in a group all sharing the same Java class.
Figure 16 Sharing a cached class
However, different instances of a Java Method activity that invoke methods on the same class do not share the instance of the object. For example, Figure 17 illustrates two Java Method activities in the same process definition, each executing different methods on the same Java object. However, each of these Java Method activities operate on their own instances of the inv class, if they both select the Cache Constructed Class check box.
Figure 17 Different Java Method activities in the same process do not share the class
In the process definition illustrated in Figure 17, for each process instance that is created, each time the inv.CheckInventory activity executes, it shares one instance of the inv object that has been cached. Similarly, each time the inv.DecreaseInv activity executes, it shares the instance of the inv object that the activity has cached. However, the inv.CheckInventory and inv.DecreaseInv activities do not share their cached Java objects with each other.
Input
See TIBCO ActiveMatrix BusinessWorks Process Design for more information about mapping and transforming input data.
The input for the activity is the following.
<declaringClass>
Output
The output for the activity is the following.
Error Output
The Error Output tab lists the exceptions that can be thrown by the invoked method. Once a method to invoke is selected, the exceptions that the method can throw are listed on the Error Output tab. Because a method can return any Java exception, the potential exceptions cannot be listed here.
While all potential errors cannot be known, the error schema for all errors is the same. The following describes the schema for exceptions returned by the Java Method activity.
<exceptionName>
<exceptionName>
 

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved