Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 18 Functions : Structure of a Function Catalog

Structure of a Function Catalog
A function catalog is an XML file that conforms to the schema file function_catalog.xsd. This allows TIBCO BusinessEvents to integrate your custom functions with the function registry in TIBCO BusinessEvents Studio. The function catalog must be in the XML format shown below and described in Table 31 to map properly to the schema.
Name the function catalog functions.catalog.
Place functions.catalog in the root folder of the required Java archive resource (.jar) file.
Example Function Catalog
This example shows two functions from the standard functions catalog as an example to follow.

 
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<catalog name="Standard">
   <category>
      <name>System</name>
         <function>
            <name>currentTimeMillis</name>
            <class>com.tibco.be.functions.System.SystemHelper</class>
            <args></args>
            <async>false</async>
            <reevaluate>true</reevaluate>
            <isValidInQuery>true</isValidInQuery>
            <isValidInBUI>true</isValidInBUI>
            <helpUrl/>
         </function>
   </category>
   <category>
      <name>Event</name>
         <function>
            <name>createEvent</name>
            <class>com.tibco.be.functions.event.EventHelper</class>
            <args>stylesheet, entityArray</args>
            <isActionOnly>true</isActionOnly>
            <desc>Create a event using XSLT Mapper.
                  This returns a event entity</desc>
            <async>false</async>
            <mapper>
               <enable>true</enable>
               <type>xslt</type>
               <inputElement>
                  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                     <xsd:element name="createEvent">
                        <xsd:complexType>
                           <xsd:sequence>
                              <xsd:element name="event" type="xsd:anyType"
                                           minOccurs="1" maxOccurs="1"/>
                           </xsd:sequence>
                        </xsd:complexType>
                     </xsd:element>
                  </xsd:schema>
               </inputElement>
            </mapper>
            <helpurl></helpurl>
            <isValidInBUI>true</isValidInBUI>
      </function>
   </category>
</catalog>

 
Elements in the Function Catalog
Table 31 lists and describes the elements used in the function catalog.
where name is a name you provide for this functions catalog.
Example: <catalog name="custom">
This is a sub-element of <catalog>. <category> is a nesting container for a set of related functions within this function catalog.
Set to true if the function executes asynchronously.
Set to false if the function executes synchronously.
If this function has side effects, for example, if it can modify values, you can only use it in action rules. Set this parameter to true to alert TIBCO BusinessEvents that this function has side effects and is not valid in conditions. Otherwise, set to false.
Valid values: true, false.
Valid values: true, false.
Valid values: true, false.
Valid values: true, false.
Using the Reevaluate Element
The the <reevaluate> element of a function catalog is relevant only when a function is used in a condition. Its effect is as follows.
If set to true then:
For example, <reevaluate> is set to true for currentTimeMillis(). Given this condition:
stock.price > 10.0;
  currentTimeMillis() - stock.time > 600000;
If the condition stock.price > 10.0; is re-evaluated, then currentTimeMillis() is also re-evaluated.
If set to false then:
In the above stock price example, if <reevaluate> were set to false, then the condition would be re-evaluated only if stock.time changes.
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved