Implementing Engine Hooks as a Grid Library

To implement an Engine Hook as a Grid Library you must create a type of Grid Library called a Super Grid Library. If you are unfamiliar with implementing a Grid Library, review Creating Services.

Super Grid Libraries are very similar to regular Grid Libraries. You still need to use a ZIP archive to contain the code and XML documents just like a regular Grid Library. In the grid-library.xml, you must add an attribute to the <grid-library> element called super which is set to true. Additionally, for the code to be used as an Engine Hook, you must specify a folder where the XML descriptor for the hook is contained. Below is an example of a grid-library.xml file that has been set up for an Engine Hook:

<?xml version="1.0" encoding="UTF-8"?>
<grid-library super="true">
<grid-library-name>AddPropHook</grid-library-name>
<grid-library-version>1.0</grid-library-version>
<jar-path>
<pathelement>jars</pathelement>
</jar-path>
<hooks-path>
<pathelement>hook</pathelement>
</hooks-path>
</grid-library>

Populating the Super Grid Library is also very similar to a regular Grid Library. The folder structure includes the folder you specified in the grid-library.xml for the hook's XML descriptor and the grid-library.xml is placed at the top level of the folder structure within the Grid Library. For example, the following is the top level folder structure for an example Engine Hook:

    jars/
    AddPropHook.xml
    grid-library.xml

Once the Super Grid Library has been constructed, upload it to the Manager in exactly the same way as a standard Grid Library. After it is deployed, the Engines discover it is a Super Grid Library and immediately execute the initialized() method.