Contents

Creating/Editing User-defined Function(s)

Custom Functions can be added to the User Defined Functions category of the Function Palette.

Functions can be created by performing the following steps:

  1. Open Mapper perspective (Window > Open perspective > Other > Mapper), right-click Mapper Projects in the Mapper Project Explorer panel and click New option to open a new project.


    Figure 1: Creating a new Mapper project

  2. In the New Mapper Project dialog box,  provide a name and click Finish to create a project.


    Figure 2: Providing a name to the new project

  3. On the Tools menu, click Create/Edit User defined Function(s) option; User Defined Functions dialog box appears.

    Icon

    Alternatively, click icon to open User Defined Functions dialog box.



    Figure 3: Opening User Defined Functions dialog box 

  4. User Defined Functions dialog box  has a list of all extensions that are defined.
    1. To create a new extension, type the name of the extension to be created in the text area provided in this dialog and click Edit button.
    2. To edit one of the existing extension, click on the extension and then press Edit button.

      Icon

      The New Script Function Wizard appears as shown in Figure 5; the wizard has two panels in sequence Script Information panel and Function List panel.


      Figure 4: Extensions Dialog

Script Information

Extensions can be defined either in Javascript or Java language. The language of the extension being added can be specified from the Language combo present in the Script Information panel.

  • The Javascript or the qualified name of the Java class, depending on the language of the extension, needs to be provided in this panel.
  • To add Javascript functions, provide the Javascript and click Next. The script will be processed and the list of functions will be populated in the Function List panel.
  • To add Java Functions, provide the qualified name of the Java class and click Next. The list in the Function List panel will be populated with all the public static functions defined in this class.


    Figure 5: Script Information Panel

Function List

The Function List panel shows the list of functions that were defined in the Script Information panel. The user can select the desired functions and the selected functions will be added to the Function palette under the User Defined Functions category.


Figure 6: Function List panel

Adding Required Jars

For Testing in Mapper

While adding Java functions, the user has to add a .jar file containing the class defining the functions to the classpath in order to fetch the list of functions.

From Script Information panel

This can be done through the Include jar to classpath option in the Script Information panel. Click the browse  button against the Select jar file property and add the required jar file. 


Figure 7: Adding Jar to mapper classpath from Script Information panel

From Preferences

Jars can be added from Preferences also. Navigate through Window > Preferences > Fiorano > Mapper and click Add button to add the jar to the Test Classpath table in the Mapper preferences panel.


Figure 8: Adding Jar to mapper classpath from Mapper Preferences panel

For Runtime

Xslt Component

To use the added funclet(s) in an XSLT component, add the jar to the component resources. To add jar files, follow the steps mentioned in the Add Resources to a Service section.

Route Transformation

To use the added funclet(s) in Route Transformation, add the jar to the Class Path of servers. To add the jar, provide the path in the Server Configuration file by following the below steps:

  1. Open configuration file of the peer server hosting the route's source component and make the changes mentioned in the steps below.
    • server.conf file from the location FioranoHome/esb/server/bin (if you are using server.bat to deploy the server)
    • fps.conf file from the location FioranoHome/esb/server/bin (if you are using fps.bat to deploy the server)
  2. Provide the path (absolute path) where the jar file is saved.
    Example: D:\jars\FileChecker_jar\filechecker.jar (filechecker.jar being the jar file)
  3. Save the file and close it.

  4. Restart the peer server for the changes to take effect.


Figure 9: Adding Jar to classpath in case of server.conf configuration file

Adaptavist ThemeBuilder EngineAtlassian Confluence