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

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / MultiCore Version / Re: Multicore, pipes and loading modules from SWFs 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
2  PureMVC Manifold / MultiCore Version / 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
Pages: [1]