Functions : Structure of a Function Catalog

Structure of a Function Catalog
A function catalog is an XML file that conforms to function_catalog.xsd — a schema. This allows BusinessEvents to integrate your custom functions with the function registry in BusinessEvents Studio. The function catalog must be in the XML format described in Table 24 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.
Elements in the Function Catalog
Table 24 lists and describes the elements used in the function catalog. Each element’s horizontal position within the Element Name column indicates the correct nesting position within the XML file.
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 functions catalog.
A comma separated list of descriptive names for the function’s arguments. BusinessEvents takes the argument type from the function itself.
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 BusinessEvents that this function has side effects.
BusinessEvents does not memorize the result of the evaluation of the condition that contains this function.
For example, <reevaluate> is set to true for currentTimeMillis(). Given this condition:
  currentTimeMillis() - stock.time > 600000;
If the condition stock.price > 10.0; is re-evaluated, then currentTimeMillis() is also re-evaluated.
BusinessEvents calls the function during the first evaluation and stores the result is stored and used for subsequent condition evaluations.
BusinessEvents Studio re-evaluates the condition only if another part of the same condition changes.
In the above stock price example, if <reevaluate> were set to false, then the condition would be re-evaluated only if stock.time changes.
This is a sub-element of <function>. This element contains the elements of a tool tip. A tool tip provides information about a function when the user floats the curser over the name of the function in the functions catalog in the rule editor.
A container for descriptive information about the function’s arguments. The information you provide will be displayed in the function’s tool tip.
   <paramdesc>
A sub-element of <args>. Provides descriptive information for one argument. Use this tag once for each argument. Attributes:
name=’arg_name
type=’arg_type
<paramdesc name=’amount’ type=’int’>arg1</paramdesc>
Attribute: type=’return_type
Example Function Catalog

 
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<catalog name="Custom">
  <category>
    <name>Categories</name>
    <category>
      <name>SimpleOnes</name>
      <function>
        <name>firstSample</name>
        <method>firstSample</method>
        <class>com.tibco.be.functions.custom.CustomJavaHelper</class>
        <args></args>
          <tooltip>
          <synopsis>You could write java here</synopsis>
        </tooltip>
        </function>
  </category>
  <category>
    <name>TimeBasedPropertyValues</name>
      <function>
      <name>snapshotOverTime</name>
      <method>snapshotOverTime</method>
      <class>com.tibco.be.functions.custom.CustomJavaHelper</class>
      <args>entity, startTime, endTime, namespace</args>
      <isActionOnly>true</isActionOnly>
      <tooltip>
        <synopsis>This is the synopsis</synopsis>
        <args>
            <paramdesc name="propertyDouble"
          type="PropertyAtomDouble">Property to serialize.</paramdesc>
          <paramdesc name="startTime"type="long">Start time for
            serialising the history values.</paramdesc>
          <paramdesc name="endTime" type="long">End time for
            serialising the history valiues.</paramdesc>
        </args>
        <returns type="String">An XML String Serialization
          of the PropertyAtomDouble passed.</returns>
      </tooltip>
      </function>
    </category>
    <category>
      <name>Serialize</name>
        <function>
      <name>serializeConcept</name>
      <method>serializeConcept</method>
        <class>com.tibco.be.functions.custom.CustomJavaHelper</class>
      <args>concept, changedOnly, nameSpace, root</args>
      <isActionOnly>true</isActionOnly>
      <tooltip>
        <synopsis>Serializes the Concept passed to an XML String
          which is returned.</synopsis>
        <args>
          <paramdesc name='concept' type='Concept'>The Concept to
              serialize.</paramdesc>
          <paramdesc name='changedOnly' type='boolean'>true - data
            modified since last conflict resolution cycle
            serialized</paramdesc>
          <paramdesc name='nameSpace' type='String'>A path describing
            the nameSpace to save in.</paramdesc>
          <paramdesc name='root' type='String'>The name of
            the serialized data.</paramdesc>
        </args>
      <returns type='String'>An XML String Serialization of
        the Concept passed.</returns>
      </tooltip>
      </function>
      </category>
    </category>
</catalog>