Problem with mediator mapping when loading module into child domain
Hi,
I've same problem, which was described here http://knowledge.robotlegs.org/discussions/questions/602-modular-utility-causing-error-1065-variable-footerview-is-not-defined .
The issue dissapear if I remove the mediator mapping or load module into current domain )
moduleLoaderInstance.applicationDomain = "ApplicationDomain.currentDomain"
instead of
moduleLoaderInstance.applicationDomain = "{new ApplicationDomain(ApplicationDomain.currentDomain)}" )
Thanks for any hints.
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Ondina D.F. on Jun 04, 2013 @ 02:22 PM
Hi Jancula,
First of all, I’m very sorry that your question hasn’t been answered until now.
Our excuse: I was away for a while, and Shaun and creynders have been very (= =extremely) busy with robotlegs version 2, which will be released soon, so your post might have escaped their attention … :)
I’m afraid I can’t explain very well the internals of SwiftSuspenders and also of the Modular Utility in rl1, but, fact is that swiftsuspenders needs to know the ApplicationDomain of the classes to which it applies injections. If no ApplicationDomain has been specified, the Injector will use the currentDomain:
If a Module has been loaded in an ApplicationDomain other than the currentDomain, the Injector won’t be able to apply the injections needed by the Module, unless you find a way to explicitly “inform” the Injector about the Module’s domain.
As you know, you have to let your Module implement IModule when using the Modular utility. IModule sets the parent injector. You could replace that interface with your own, where you’d also provide a method for setting the applicationDomain. Or, you could set parentInjector.applicationDomain when you load the Module. But, I’m not sure if that’s not problematic in case you want to load several modules, each in a different applicationDomain. You’d have to try it out yourself.
The safest way would be to load the module into the currentDomain.
Working with Modules in robotlegs version 2 and the latest Swiftsuspenders version is easier; setting
moduleLoader.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); works without problems.
More about ApplicationDomain:
http://livedocs.adobe.com/flex/3/html/18_Client_System_Environment_...
Ondina
2 Posted by Jancula on Jun 05, 2013 @ 07:58 AM
Thanks for your suggestions. We will move to version 2 in near term, We used solution for v1 in subclassing ModularContext this way:
public class ChildAppDomainAwareModuleContext extends org.robotlegs.utilities.modular.mvcs.ModuleContext
{
public function ChildAppDomainAwareModuleContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true, parentInjector:IInjector=null)
{
var applicationDomain : ApplicationDomain =
(contextView["moduleFactory"] && contextView["moduleFactory"].info) ?
contextView["moduleFactory"].info().currentDomain :
contextView.loaderInfo.applicationDomain;
super(contextView, autoStartup, parentInjector, applicationDomain);
}
}
}
Support Staff 3 Posted by Ondina D.F. on Jun 05, 2013 @ 11:07 AM
No problem:)
Right. Now I remember Till suggesting such a solution a while back. Glad it’s working for you.
I'll close this issue. If you need anything further related to it, please post and it will be automatically re-opened.
Cheers,
Ondina
Ondina D.F. closed this discussion on Jun 05, 2013 @ 11:07 AM.