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
- 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()
- 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());
- Create a jar for the custom library that you created in
Step 1 and add it to the application server classpath.
- Copy the custom jar that you created in Step 3 to the following
locations:
- 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.