- Creating/Editing User-defined Function(s)
- Adding Required Jars
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:
- 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
- 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
On the Tools menu, click Create/Edit User defined Function(s) option; User Defined Functions dialog box appears.
Figure 3: Opening User Defined Functions dialog box
- User Defined Functions dialog box has a list of all extensions that are defined.
To create a new extension
Type the name of the extension to be created in the Extension Name text box provided in this dialog and click the Edit button.
To edit one of the existing extensions
Select the respective extension present under Defined Extensions and click the Edit button.
Figure 4: Extensions Dialog
Script Information and Function List
Provide the script in the text editor which says 'Type in the script here'.
Figure 5: Java script provided in the Script Information Panel
- In the Script Information panel, select 'java' from the Language drop-down.
Provide the fully qualified name of the Java class in the text editor which says 'Type in the fully classified class here'.
Figure 7: Java class provided in the Script Information Panel
Click Next; the list of java functions will be populated.
Figure 8: Java class parameters
In the panel, perform the following actions as required:
Choose from the java function list that appears under the name table by selecting the checkbox.
Select the function name to see the parameters appear.
Double-click the parameter name to change the name if necessary.
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
- In the Script Information panel, select the Include jar to classpath option.
- Click the browse button against the Select jar file property to add the required jar file from the location where it is saved.
Figure 9: Adding Jar to mapper classpath from Script Information panel
- Navigate through Window > Preferences.
- In the Preferences window, expand Fiorano and select Mapper.
- Click the Add button to add the jar to the Test Classpath table in the Mapper preferences panel.
Figure 10: Adding Jar to mapper classpath from Mapper Preferences panel
Adding Classpath for 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:
- 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)
- Provide the path (absolute path) where the jar file is saved.
Example: D:\jars\FileChecker_jar\filechecker.jar (filechecker.jar being the jar file)
Save the file and close it.
- Restart the peer server for the changes to take effect.
Figure 11: Adding Jar to classpath in case of server.conf configuration file