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]
Author Topic: plugin initialization  (Read 7831 times)
Jr. Member
Posts: 18

View Profile Email
« on: July 18, 2008, 06:52:32 »

Hi. This is more of an architectural question, but it's also related to the multicore framework.

I have an application that uses multicore to implement a plugin framework. I have a Shell application and several Plugins. Each plugin can be a puremvc application or not (that's up to the plugin implementation to decide). So in order to cope with that I am using a Shell/Plugin interface.

The thing is... let's say part of the interface is to provide to the shell some standard view components (like the 'view' view, the 'edit' view, etc...), so that the shell can inject the plugins view components into its own view components. My problem is currently that I don't know what's the best way to design such a system, and I am finding some issues with my current implementation.

The plugins are loaded at runtime (dynamically), and since the plugins don't have to be implemented in puremvc, I decided to do all the puremvc startup in the plugins init method (part of the plugin interface). That is, I am creating the view components from withing my actionscript class (but the components itself are defined in mxml files).

The thing is, view components are not created until needed, so my plugin gets initialized and when I try to access the view components for it, I get a null reference. I tried to use creationPolicy="all" to force the components to be created at startup, but it didn't worked as expected.

Now I was thinking of some way of delaying plugin initialization until all view components are created (and thus, I must somehow force the components to be created before they are actually needed), but couldn't yet find an optimal solution for this.

I hope I have stated my problem clear enough, so that you can help me by giving me some hints and tips about how to solve this.

Many thanks,

Global Moderator
Hero Member
Posts: 2871

View Profile WWW Email
« Reply #1 on: July 18, 2008, 10:36:16 »

You just need an interface that this 'plugin' must implement that the 'shell' will make its calls against once the module is loaded.

Your module should expose a simple factory method like:

public function getModuleUI():UIComponent
   return new MyUI();

MyUI can be defined in MXML, but don't instantiate it in MXML.

Pages: [1]