So I am trying to instantiate a SimpleTagProvider in the common scope. For this, I need access to the GatewayContext.
However, my common scope class is not created through my GatewayHook, but rather at runtime via Python hooks.
I have tried creating a static method something like this on my GatewayHook:
public static GatewayContext getGatewayContext(){
return instance; //where instance is a static reference to a singleton of the hook, more or less.
}
But common scoped classes can’t seem to find the Gateway scoped classes. If I try to fix that, I get circularity warnings.
Not sure if this is a build.xml/module.xml issue or if I’ve hit a genuine feature wall.
What exactly are you a referrring by the “common scope”? AFAIK, the gateway context is only available on the gateway, so what you are trying to do does not seems to make sense. A simple tag provider is running on the gateway, so it needs to be defined in the gateway. Maybe you should give a little bit more details on what your are trying to do?
There can be directories or projects called Common which will be used in all scopes.
Your SimpleTagProvider will need to be created in the Gateway scope. The scopes have things that are not accessible in other scopes. For example the GatewayContext object is not accessible in the Designer and Client scopes. Various functions and objects and classes in the Client and Designer scopes are not accessible in the Gateway scope.
The gateway context is only available in the gateway. Most contexts extend from BaseContext, which contains the getTagManager method. What are you trying to do exactly?
What I’ve figured out is where ever I want to add script module (Gateway/Designer/Client), I need to pass in context and/or context dependent objects with an new instance such as:
@Override
public void initializeScriptManager(ScriptManager manager) {
super.initializeScriptManager(manager);
manager.addScriptModule("com.some.module", new SomeClass(tagProvider));
}
The big thing in different contexts will be limiting behavior, probably by creating a specific interface to the common code from each context.