Chapter 4 Creating Custom 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 the rule editor. The function catalog must be in the XML format described in Table 7 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
Table 7 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.
The name of the function.
The java class that implements the function.
A comma separated list of descriptive names for the function’s arguments. BusinessEvents takes the argument type from the function itself.
Valid values: true, false
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.
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
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>