Futurescale, Inc.
PureMVC Home
The PureMVC Framework
Code at the Speed of Thought
Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
New discussions should be taken up in issues on the appropriate projects at
https://github.com/PureMVC
PureMVC Architects Lounge
PureMVC Manifold
Port to AS3
MultiCore Version
Multicore, pipes and loading modules from SWFs
Pages: [
1
]
« previous
next »
Author
Topic: Multicore, pipes and loading modules from SWFs (Read 7781 times)
Stephen
Newbie
Posts: 2
Multicore, pipes and loading modules from SWFs
«
on:
March 12, 2009, 09:45:23 »
Hello,
I'm trying to get an app working where the modules are loaded from SWFs, then connected to the shell using pipes. I'm following the Pipe Works demo application. The module loads fine, but when the shell tries to send a message to the module, it gets a "null object reference" exception being thrown by the Pipe class. The Pipe's 'output' variable is null, so it seems something is not getting initialized properly.
The weird thing is, after stepping through the module code in the debugger, it looks like notifications aren't getting sent within the module's core. The module's StartupCommand gets called, and registers the junction mediator and other mediators, but these mediators never respond to notifications.
Here's the shell's junction mediator method where it wires up the connection to the module:
override public function handleNotification(note:INotification):void {
switch (note.getName()) {
case ApplicationFacade.MODULE_LOADED:
var moduleVo:ModuleInfo = note.getBody() as ModuleInfo;
var module:IPipeAware = moduleVo.module as IPipeAware;
trace ("Connecting pipes to module " + moduleVo.name);
// Connect module's OUT pipe to this app's IN pipe.
var moduleToApp:Pipe = new Pipe();
module.acceptOutputPipe(PipeAwareModule.STDSHELL,
moduleToApp);
var appIn:TeeMerge =
junction.retrievePipe(PipeAwareModule.STDIN) as TeeMerge;
appIn.connectInput(moduleToApp);
// Connect app's OUT pipe to module's IN pipe.
var appToModulePipe:Pipe = new Pipe();
module.acceptInputPipe(PipeAwareModule.STDIN,
appToModulePipe);
var appOut:IPipeFitting =
junction.retrievePipe(PipeAwareModule.STDOUT) as IPipeFitting;
appOut.connect(appToModulePipe);
break;
case ApplicationFacade.EXPORT_MODULE_VIEW:
trace ("Exporting module's view...");
junction.sendMessage(PipeAwareModule.STDOUT,
new Message(PipeModuleConstants.EXPORT_MODULE_VIEW,
this,
"Conneced to EDU Client"));
break;
default:
// Let super handle the rest (ACCEPT_OUTPUT_PIPE, ACCEPT_INPUT_PIPE)
super.handleNotification(note);
break;
}
}
I'm stumped at the moment. Any suggestions/guidance will be greatly appreciated.
Thanks,
Stephen
Logged
Stephen
Newbie
Posts: 2
Re: Multicore, pipes and loading modules from SWFs
«
Reply #1 on:
March 12, 2009, 11:48:12 »
This is fixed. My problem was loading a SWF module that was out of date, so I wasn't seeing the changes in the module. Well, I would intermittently see updates in the module, because we're using Maven to build all this stuff, and blah, blah, blah...
Building loosely coupled applications from independent modules that get dynamically loaded at runtime can be tricky.
Stephen
Logged
puremvc
Global Moderator
Hero Member
Posts: 2871
Re: Multicore, pipes and loading modules from SWFs
«
Reply #2 on:
March 14, 2009, 07:37:45 »
Yes it can be tricky. Which is why the demos skip the loading part because it can be rather involved and FlexBuilder alone isn't enough usually. You need a solid build script and you (should) split everything up into multiple projects. This isn't just a PureMVC problem, it comes part and parcel with modular development.
Glad to see you got the kinks worked out.
-=Cliff>
Logged
Pages: [
1
]
« previous
next »
Stack Overflow
GitHub
Linked In
Google Plus
Twitter
Powered by SMF 2.0.15
|
SMF © 2006-2007, Simple Machines LLC
|
Content © 2006-2018, Futurescale, Inc.
Loading...