APIANT for Integrators
Module IDE

Module Implementation

3min

This tab contains a code editor for editing and compiling the module's implementation:

Document image


Modules can have two code implementations: JavaScript for the browser and Java for the server. Not all modules will have a server-side Java implementation, but all modules must have a browser-side JavaScript implementation.

Module implementations make use of the Module API classes, whose implementations can be viewed in the Module Browser. The Module API allows most JavaScript and Java module implementations to be almost identical, with the Java implementations only needing type information, e.g. "int" instead of "var".

It is beyond the scope of this documentation to describe the Module API and coding details. Use the Module Browser to examine the code for the Module API classes which have inlined documentation, plus examine existing module implementations to learn boilerplate patterns for how modules work with input data and generate output.

At a high level, the general development cycle for a new module is as follows:

Begin by saving a copy of an existing module that closely does what is needed by the new module. Modify its Module Definition and optionally Module Settings until it has the needed inputs for its operation.

Focus first on the JavaScript implementation. Make needed code changes and test them in the assembly editor until confident the JavaScript is working as needed.

Test the JavaScript implementation by running a test assembly in the assembly editor. After you save the module, you can immediately run the test assembly. The editor immediately uses any JavaScript code changes that were made.

You can optionally run the assembly editor in debug mode to trace your code. Enable debug mode here:

Document image


Use the Show/Hide Debugger link at the top right of the editor to toggle the debug window:

Document image


Debug information appears as the assembly is executed. Use _debug(content) found in the _mixinBase class to write information into the debug window. If the content is an object the debug window will inspect that object and give you links to inspect the content within it.

After the module's JavaScript implementation is tested and working as needed, copy the method contents to the same methods in the Java implementation. Then convert all "var" definitions to the needed Java types. Use the Java compiler's error information to finish the conversion of the JavaScript code to Java.

Test the Java implementation by executing the test assembly on the server:



Document image


Leave debug information on so that any _debug() output or runtime errors will appear:



Document image


A new browser tab/window will open with the output from the execution on the server:

Document image


It is best to have an XML Viewer plugin installed in your browser so the output XML will be formatted for viewing.

You can refresh the output page after making Java code changes and saving the module, for quick test iterations.

Post to our Help Forum when you need help building new modules.