Chapter 4 Creating Custom Functions : Overview of Creating Custom Functions

Overview of Creating Custom Functions
This chapter does not contain detailed instructions for creating custom functions or programming in Java. It is assumed that you are comfortable programming in Java, and have at a minimum already implemented a class and a static function.
Restrictions
Note the following restrictions that pertain to using custom functions.
Static and Non-Static Functions
Custom functions must be written in Java and have public static modifiers.
As a workaround, encapsulate a non-static function in a static function and compile the encapsulating class to get the .class file.
Return Types
BusinessEvents custom functions support the following return types:
Java types supported are: Object, String, Calendar (which displays in BusinessEvents as DateTime), Integer, Long, Double, Boolean, int, long, double, and boolean (but not byte, short, float, or char).
Name Overloading
The functions.catalog file makes functions available for use in TIBCO Designer. The structure of the file requires each function within a class to have a unique name. Because of this structure, you cannot refer to an overloaded function in functions.catalog.
For example, the standard Java library has several String.valueOf() functions overloaded for each primitive type (String.valueOf(int i), String.valueOf(double d) and so on). However, the BusinessEvents standard function catalog has a separate function name for each data type: valueOfBoolean(), valueOfDouble(), valueOfInt(), and valueOfLong().
See Structure of a Function Catalog, for more about the functions.catalog file.
Task Summary
TIBCO BusinessEvents allows you to write your own custom functions in Java and add them to the function registry, making them available from within the function registry along with the prepackaged functions in the rule editor.
The steps below summarize the tasks required to integrate your own custom functions with TIBCO BusinessEvents:
1.
2.
Create a file called functions.catalog, an XML file that makes it possible to access your custom functions from the functions registry within the rule editor. The XML can also include information for a tool tip for each function.
3.
Create a .jar file that includes your .class file and functions.catalog.
4.
Add the location of the .jar file to the class path for the BusinessEvents Server and Workbench. Also add locations for any dependent classes.
The following pages provide more information about each of these tasks.