FDM: Extending Scripting with Custom Code Libraries

When implementing advanced integration, analysis or transformation functionality you may want to utilise external code. FDM supports the Java programming language and can access classes via included JAR files. To do this, create your code (e.g. in Eclipse) and package as a JAR file. Deploy this file to the FDM server environment (e.g. in the lib folder for Tomcat) and then restart the server. This JAR is now available to the Class Loader and can be accessed via code.

To make the JAR file accessible to FDM scripts edit the sandboxfactories.properties file (in the fdm configuration folder) and add a line.

The line is in the format of:



gembaFactory = com.fusion242.fdmapi.pojo.samples.GembaClassFactory

This will create an instance of the object (from the class name) and assign it in scripts using the given variable name.

Using the sandbox factories feature is a good way to allow reusable code to be made available to scripts across FDM. This approach also allows the Java code to utilise tests and to be developed more rapidly. IP can also be hidden (albeit from sight only unless the JAR file has restricted access)  from script users.

Copy to Clipboard