Sample function definition file with imports element
Following is a function definition file that specifies the imports element.
Example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE function SYSTEM "http://www.apama.com/dtd/fdf.dtd">
<!--Apama Function Definition File-->
<function name="ExtractTimeField" display-string=”ExtractTimeField"
return-type="float">
<version>
<id>1.0</id>
<date>17 May 2005</date>
<author>Ben Spiller</author>
<comments>External function</comments>
</version>
<description>
Return the value of a single field from the specified
time string (using the TimeFormatPlugin). Date fields
include 'dd', 'MM' and 'yyyy'. Time fields include 'HH',
'mm' and 'ss'.
</description>
<imports>
<import library="TimeFormatPlugin" alias="timePlugin"/>
</imports>
<parameters>
<fixed-parameter name="time" type="float" />
<fixed-parameter name="field identifier" type="string" />
</parameters>
<code><![CDATA[
action #name#(float time, string field_id) returns float
{
// If the field string is invalid, make it obvious!
if field_identifier.length() == 0 then {
return 0.0;
}
// Should return 0 if the field specifier is invalid
return #timePlugin#.format
(time,"%"+field_id).toFloat();
}
]]></code>
</function>
Notes
Notes for this function:
The value of the
function name attribute, ExtractTimeField, is unique within the directory that contains this
.fdf file.
Appears as
ExtractTimeField in the Event Modeler rules menu.
Returns a float.
The
imports element specifies
timePlugin as the alias for the plug-in, and
TimeFormatPlugin as the shared library that contains the plug-in.
The
code element specifies
timePlugin to refer to required plug-in.
Takes two parameters — a
float that specifies a time, and a
String that specifies a field ID.
The EPL ensures that the
ID field is valid and then invokes the
format function by specifying the alias for the
TimeFormatPlugin library:
return #timePlugin#.format
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.