User-defined funclets that are created in the Mapper perspective can be stored in multiple places in the Fiorano installation.
The two repositories meant for storing funclets are:
- Local Funclet Repository: The funclets that are created inside a mapper transformation in an Event Process, for example, in a component like Xslt or on a port or on a route, are stored in Local Funclet Repository.
- Global Funclet Repository: The funclets that are created in Configuration Repository view of Offline or Online perspectives are stored in Global Funclet Repository of respective perspectives.
Both the repositories are explained in detail in the following sections.
Local Funclet Repository
In the Offline/Online perspective, the User Defined Functions dialog box has more options apart from Remove and Edit buttons present in the Mapper perspective.
Click the "Creating/Editing User-defined Function(s)" icon to open the User Defined Functions dialog box.
Figure 1: User-defined Functions dialog box with functions added in the Event Process perspective
The table below provides information about each button, starting with the Add option to add funclets, in the User Defined Functions dialog box.
Property | Description |
Add | Opens a new script wizard to add a function. |
Remove | Removes the function selected and deletes it from the location where it was added (using the Add button) as well. |
Import from | Imports user-defined functions added in any event process. The specific funclet can be imported into the mapping from the list of existing functions. |
Export to Global Repository | Exports funclets to the Global repository (refer to the section below to understand more about Global Repository). |
Edit | Helps to make changes to the selected script. |
The funclets created in the Local Funclet Repository are saved in the machine where eStudio is launched. These funclets can be seen in Funclet View of this particular eStudio application which is attached to the machine.
Example: %FIORANO_HOME%/eStudio/plugins/com.fiorano.tools.mapper.runtime_1.0.0/resources/functions.repository.
The following scenario explains the availability of funclets in transformations created in Local Funclet Repository:
- In Machine1, launch eStudio, login to Enterprise Server and create an Event Process EVENT_PROCESS1 with a service instance of the Xslt component.
Launch CPS (Configuration Property Sheet) of the Xslt component, open Mapper, and create a funclet "FUNCLET1".
- Use FUNCLET1 in a mapping, save and close the mapping.
- Create another Event Process EVENT_PROCESS2 with another service instance of Xslt.
Launch the Xslt CPS, open mapper and navigate to User Defined Funclets in Funclet View.
- Now, login into the same Enterprise Server from a different machine "Machine2".
Open EVENT_PROCESS1 and open the Xslt CPS.
Global Funclet Repository
The user-defined funclets in the Local Funclet Repository can be created and shared globally to use across eStudio applications in multiple machines which connect to the same Enterprise Server.
In eStudio, Offline and Online perspectives will have separate global funclet repositories:
- In the Offline perspective, funclets will be stored in the same machine as eStudio at
%FIORANO_HOME%\runtimedata\eStudio\workspace\.repositories\Offline\Configurations\funclet\development - In the Online perspective, funclets will be stored in Enterprise Server at
%FIORANO_HOME%\runtimedata\repository\configurations\funclet\development
Adding a funclet to the global repository
In Offline/Online perspective, go to the Configuration Repository view and perform the following actions:
- Right-click the Funclet node, and click the Add Configuration option.
Figure 2: Context menu to add Configuration Click the Add button and provide a name for the funclet in the Extension Name text field that gets displayed, and click the Edit button below the text field to provide its properties.
Figure 3: Option to add funcletsSelect one of the following options from the Language drop-down.
javascript
Add the script for the funclet in the Type in the script here text area and click Next.
Figure 4: Script Information pane with the javascript language optionSelect one or more of the functions to appear in the function palette and click Finish.
Figure 5: Option to choose funclets to appear in function palette
java
Enable the Include jar to classpath checkbox.
Click the Add Jar button, click the Add button in the Select Jars dialog box and select the jars to be added from the location where it is saved.
Figure 6: Options to choose Java jar fileProvide the class name of the jar in the Type in the fully classified jar text box and click Next.
Figure 7: Options to choose Java jars and add jar classSelect one or more of the functions to appear in the function palette and click Finish.
Figure 8: Option to choose funclets to appear in function palette
Click Close/Save.
Figure 9: Option to edit or closeThe global funclet gets added under the Funclet node; expand to see the same.
Figure 10: Global funclet appearing under the Funclet node
Editing the script in the added funclet
To edit the script in the added funclet, perform the following actions:
- Expand the Funclet node, right-click the GlobalFunclets node and click Edit.
Figure 11: Context menu option to edit the funclet script - Select the funclet that needs to be edited and click Edit.
Figure 12: Option to edit the funclet - Edit the script in the Script Information section in the New Script Function dialog box and click Finish.