Funclet Repository
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:
- Funclet Repository#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.
- 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".
FUNCLET1 will be available in User Defined Funclets in Funclet View.
- 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.
FUNCLET1 will be available here and can be used in new mappings since this event process is created in the same Machine1.
- Now, login into the same Enterprise Server from a different machine "Machine2".
Open EVENT_PROCESS1 and open the Xslt CPS.
The mapping created earlier with FUNCLET1 will be present and existing transformation will work fine.
However, the funclet FUNCLET1 will not be available in User Defined Funclets in Funclet View. So, new mappings with the same funclet cannot be created.
To use FUNCLET1 in Machine2, export EVENT_PROCESS1 in Machine1 and use the Import from option. This is where Global Funclet Repository becomes relevant.
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 funcletsThe table below provides information about each button, starting with the Add option to add funclets, in the Add New Configuration dialog box.
Property Description Add To add a funclet, click Add, provide Extension Name, and click Finish to open a new script function wizard.
Remove Removes the selected funclet from the repository. Import Local Funclets Event Process Repository: The custom funclets added in any event process in the event process repository get displayed from where the required funclet can be chosen. Exported Event Process: The custom funclets present in an exported event process get displayed from where the required funclet can be chosen.
Import Global Funclets To import the funclets that are exported previously from global repository to the local disk. Export to Local Disk The selected funclet will be zipped and saved in the location specified. Select 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.
How to create Jar file in Eclipse?
There are different ways to create a jar file, one of which is by using Eclipse as below:
1. Right-click the java project or file.
2. Select Export.
3. Select Java > JAR file.
4. Select the destination location and click Finish.To create Runnable JAR, select Runnable JAR file while exporting.
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.
Points to note
During runtimedata migration, the funclets in Global Repository will also be migrated along with all other configurations in Enterprise Server.
While adding new funclets, if a funclet in the global repository (global funclet) and a funclet defined in an event process (local funclet) have the same name, the local funclet takes precedence and will be shown in Funclet View while editing a transformation in Mapper.
When a global funclet is edited in Online perspective, a running event process should be restarted to reflect the changes in a port or route transformation during runtime. If the funclet is used in a service instance transformation, like Xslt, restarting just the component will suffice.
When exporting event processes using global funclets, the funclets should be exported from the global funclet repository explicitly. The same is to be done while importing these event processes.
Support for exporting the funclets along with the event process will be added in future releases.