I am attempting to get into module development. For now I am just trying to add a scripting library to interface with an external API I have. I want to add layers to the scripting library so for example:
system.example.assets and system.example.oee
where each of these has it's own functions underneath them. I can get it to work at the client and designer scope, but I cannot get it to do it at the gateway scope as well. It seems to be an issue with the getRPCHandler method. I have looked at other articles on here regarding it and cannot seem to get a handle on how to add multiple script modules.
Here is what I have tried inside of the GatewayHook.java from the scripting-function example in the Inductive Git Repo
@Override
public void initializeScriptManager(ScriptManager manager) {
super.initializeScriptManager(manager);
manager.addScriptModule(
"system.example.assets",
assetModule,
new PropertiesFileDocProvider());
manager.addScriptModule(
"system.example.oee",
oeeModule,
new PropertiesFileDocProvider());
}
@Override
public Object getRPCHandler(ClientReqSession session, String projectName) {
return assetModule;
}
If I switch it to the oeeModule as the return it will allow me to call the functions under that but not assetsModule and vice versa. I have the manager.addScriptModule code almost identical in the ClientHook.java and DesignerHook.java files and it works great when I call it from a binding or expression.
So what am I doing wrong here?