Writing custom greex functions

The Greex framework provides a set of defined functions as a part of the Greex library. You can also write custom Greex functions, if necessary.

About this task

To write a custom Greex function:

Procedure

  1. Provide implementation for your custom library by implementing all functions of the com.yantra.ycp.greex.library.LibraryFunction interface. You must implement the following functions:
    • Object invoke(GreexContext ctx, List params)
    • boolean validateParams(List params)
    • String getName()
    • String getDescription()
    • String getReturnType()
    • String[] getParamTypes()
  2. Register your custom library with Greex framework by calling the registerFunction(LibraryFunction function) method of the LibraryFunctionFactory class.

    For example, to register your custom java class such as MyCustomLibrary, call the following registerfunction() method:

    LibraryFunctionFactory.getInstance().registerFunction(new MyCustomLibrary());
  3. Create a JAR file for the custom library that you created in Step 1 and add it to the application server classpath.
  4. Copy the custom JAR file that you created in Step 3 to the following locations:
    • <runtime_sandbox>/jar/<application_name>
    • <runtime_sandbox>/repository/eardata/platform/war/yfscommon
      Note: Make sure that the custom JAR file is signed before copying it to this location. You must also update the <runtime_sandbox>/repository/eardata/platform/war/yfscommon/jarlist.txt file.
    • <runtime_sandbox>/platformrcp/6_0/othertools/com.yantra.ide.othertools.core_1.1.0
  5. Register the custom Greex function by setting the yfs.custom.greex.functions property in the yfs.properties file to the full package name of the Greex class.