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

Pages: [1]
Print
Author Topic: Module/Shell communication  (Read 7847 times)
mscharp
Newbie
*
Posts: 3


View Profile Email
« on: February 26, 2009, 03:03:27 »

Hey everyone

Ive recently started working with multicore puremvc and had a quick question.  I have a proxy in the Shell application that manages session data, and I'm loading modules which need access to that data.  How can my modules get a reference to that proxy?  If I understand correctly, the modules technically dont have access to the Shell's ApplicationFacade class, so I can't just do a facade.retrieveProxy() call. 

Is there anyway similar to doing a facade.retrieveProxy() or do I have to pass in a reference of that proxy  to my modules when I load them?

Any advice would be appreciated.

Thanks
Logged
Jason MacDonald
Sr. Member
****
Posts: 243


View Profile Email
« Reply #1 on: February 27, 2009, 07:20:17 »

Have a look at the pipes utility. It helps to manage messaging between cores.

There's also a demo for it here
Logged
mscharp
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: February 27, 2009, 11:41:23 »

My title probably wasn't the best for the message.

I am actually using Modularity and not the Pipes Utility.  My modules/shell communicate back and forth nicely.  However I basically want my modules to have access to a proxy in the shell without having to pass the proxy into the modules, or without sending/recieving notifications everytime the modules wants to get a piece of data from that proxy.  Is this possible?

Essentially the proxy I'm referring to is managing the session information, and all the modules loaded need to know about the current state of the session.

Thanks
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: March 01, 2009, 08:11:25 »

To share the Proxy class, it will have to be defined in a library that is common to both the shell and the modules.

Presumably this proxy is already registered in the shell by the time you load any modules, so if you are using interfaces (ala Modularity) to communicate, then you could either place a getSessionProxy method on the shell's interface and have the modules (during their individual startups) call this method to get a reference to the session proxy, then register that proxy reference locally within the module. We'll call this the 'pull' method.

The other way would be to have the shell 'push' the session proxy into the module when it is loaded by calling a injectSessionProxy method defined on the interface for the modules.

I'd suggest going with the 'pull' approach, since the shell might not know when the module has finished with its startup.

-=Cliff>
Logged
mscharp
Newbie
*
Posts: 3


View Profile Email
« Reply #4 on: March 12, 2009, 11:12:10 »

Thanks for the help everyone.

I ended up creating a setter/getter in the Interface for the modules that allowed me to pass in the proxy to the Modules... I actually changed it up a little and just passed in an object of the data the proxy was managing and created a new proxy in the module for that data.  I didn't like having "shell" classes in the "modules".  In any case, all is working.
Logged
Pages: [1]
Print