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] 2
1  PureMVC Manifold / MultiCore Version / Re: Notification best practices on: July 18, 2008, 11:26:47
great explanation. thank you.
2  PureMVC Manifold / MultiCore Version / Notification best practices on: July 18, 2008, 10:09:29
When dispatching notifications for informing about data availability (on proxies), what's the best practice: to send the data as the notification body, or to save the data as a property of the proxy, and let the mediator retrieve the data by calling up the proxy?
3  PureMVC Manifold / MultiCore Version / plugin initialization 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,

ricardo
4  Announcements and General Discussion / Architecture / Re: plugin architecture and updates on: June 26, 2008, 06:16:47
Hi Cliff,

thanks for the answer. I have been walking this last path (using modules with multicore). Since you are telling them apart, what is the difference between loaded swfs and flex modules? Aren't flex modules also compiled to swfs which can be loaded dynamically at run-time (this is actually what I am doing).

thank you for any clarification
5  PureMVC Manifold / MultiCore Version / Re: loading modules dynamically on: June 23, 2008, 12:35:25
just for the record..

the issue here was not calling facade.removeCore() before unloading the module (which generated the issues when re-loading the module).

anyway, all the answers where helpful and insightful, so thank you all

this is really a community with a great feeling about it . keep on!! :-)

ricardo
6  PureMVC Manifold / Demos and Utils / Re: Modularity - a PureMVC AS3 MultiCore Demo on: June 09, 2008, 12:21:16
What are the benefits/drawbacks of each approach? What I mean is, how do I know which of the two approaches suits me best?
7  PureMVC Manifold / MultiCore Version / Re: loading modules dynamically on: June 04, 2008, 07:16:28
no, I haven't, because I am not using FlexDeveloper, but just vim. Either way, that shouldn't work (I think), since according to the error message, the problem is that the facade object didn't get created at all, the second time. I will try to put a trace or Alert message in order to debug this.
8  PureMVC Manifold / MultiCore Version / Re: loading modules dynamically on: June 04, 2008, 06:53:09
ok Cliff,

the methods I am using belong to a ModuleProxy class.

data is an ArrayCollection.

-------------------------------------------------------------------------------------

        public function loadModule(module:ModuleVO):void
        {
            var index:Number = getLoaderIndex(module);
            if (index == -1)
            {
                var loader:ModuleLoader = new ModuleLoader();
                loader.url = module.url;
                loader.addEventListener(ModuleEvent.READY, onModuleLoaded);
                data.addItem(loader);
                loader.loadModule();
            }
        }

        private function getLoaderIndex(module:ModuleVO):Number
        {
            // find loader
            var index:Number = -1;
            var tmp:ModuleLoader;
            for (var i:Number = 0 ; i < loaders.length; i++)
            {
                tmp = loaders.getItemAt(i) as ModuleLoader;
                if (tmp.url == module.url)
                {
                    index = i;
                    break;
                }
            }

            // return index found
            return index;
        }

        public function unloadModule(module:ModuleVO):void
        {
            // find loader
            var index:Number = getLoaderIndex(module);
            // loader was found
            if (index != -1)
            {
                var loader:ModuleLoader = loaders.removeItemAt(index) as ModuleLoader;
                loader.addEventListener(ModuleEvent.UNLOAD, onModuleUnloaded);
                loader.addEventListener(ModuleEvent.ERROR, onModuleError);
                loader.unloadModule();
            }
        }

        private function onModuleLoaded(event:ModuleEvent):void
        {
            if (event.module)
            {
                sendNotification(ApplicationFacade.MODULE_LOADED);
            }
        }

        private function onModuleUnloaded(event:ModuleEvent):void
        {
            if (event.module)
            {
                sendNotification(ApplicationFacade.MODULE_UNLOADED);
            }
        }

        public function get loaders():ArrayCollection
        {
            return data as ArrayCollection;
        }
    }

--------------------------------------------------------------------------

the ModuleVO object, basically has an url, a name and a description.

I hope this code is enough for you to understand how it works. If it's not, then I can send you the whole source code as an attachment.

the items are getting correctly added and removed from the ArrayCollection.
9  PureMVC Manifold / MultiCore Version / loading modules dynamically on: June 03, 2008, 12:25:33
Hi,

I am writing some code to load modules dynamically. Each module is implemented as a standalone application (meaning it has it's own Facade, Model, View and Controller). I am using (in my shell application)  a ModuleProxy, which loads and unloads modules. While they are loaded, the proxy keeps a reference in an ArrayCollection.

The strange thing is, I can load a module perfectly the first time, then unload it without any problems, and if I want to load it again afterwards, I get an error in the module's main mxml (which has the Module tag), saying that it "cannot access a property or method of a null object reference". This happens in the creationComplete event handler which looks like

<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
    verticalGap="0"
    horizontalGap="0"
    creationComplete="facade.startup(this);">
    <mx:Script>
        <![CDATA[
        import my.name.space.ApplicationFacade;
        public static const NAME:String = 'MyModule';
        protected var facade:ApplicationFacade = ApplicationFacade.getInstance(NAME);
        ]]>
    </mx:Script>
...
</mx:Module>

so that means, the null object reference is the facade object, right?

Now, what does this exactly mean? Why is it null the second time I try to load the module, but not the first time?
10  PureMVC Manifold / Demos and Utils / Re: Modularity - a PureMVC AS3 MultiCore Demo on: June 02, 2008, 12:06:33
ok, nice to hear. in the mean time, could you give me some thoughts on how I should approach this issue in order to try to solve it by myself (until I get the chance to peek into your code)?

thank you again
11  PureMVC Manifold / Demos and Utils / Re: Modularity - a PureMVC AS3 MultiCore Demo on: June 02, 2008, 11:44:15
Hi Cliff,

I woud like to ask you if you plan to extend the Modularity demo to include modules loaded at runtime. I ask this, because I would really like to see how you approach this issue (which includes loading and unloading flex modules, and doing all the registration/unregistration tasks related to housekeeping), since every demo I saw you wrote was quite a beauty (from the cleanliness and well-laid out code).

thanks for the feedback, and keep up the good work :-)

12  PureMVC Manifold / Demos and Utils / Re: Pipes - A PureMVC AS3 MultiCore Utility on: May 30, 2008, 07:39:13
Is the aim of the pipes utility to be used for every inter-module comunication, that is, between sibling modules and between app shell and child modules? Is is supposed to be sort of a standard interface for communicating between cores no matter what kind of task those cores perform, or is it more aimed at communication between sibling modules only (i.e. not the core running the shell app)?
13  Announcements and General Discussion / Architecture / Re: plugin architecture and updates on: May 29, 2008, 08:33:28
I was just thinking...

maybe I don't need to use modules.. because I just want to dynamically *load* stuff (at app's startup time), but I don't really need to isolate each part from the other, and I don't need to unload it or reload it once the app has started.

what do you think? are modules my only option here?

thanks

ricardo
14  Announcements and General Discussion / Architecture / Re: plugin architecture and updates on: May 29, 2008, 06:44:13
Hi Cliff, thanks for the answer

I am using Flex, but embedding the app in xulrunner, so I can execute external commands (as far as I know, this cannot be done with AIR at the moment). With regard to updates, the idea is that the user will download the app only once, and get new product definitions and/or new functionality as plugins (when possible), so that they can be downloaded and integrated with the app without having to download everything again.

With respect to 'drop-in' detectability, I was thinking of something like executing a filesystem inspection, either through xulrunner, or by executing an external command, to detect wich files are present in the application directory, and (if new files are present) update the available products list. For now, this is what I need (i.e. I don't think I need to detect changes while the app is running, only at startup).

I have seen some posts by Zilet about using modules. Is this the currently best approach for the kind of stuff I am trying to do? I have seen that MultiCore is marked as alpha. How true is that? Does that mean that it currently is not an option for a production application?

Thanks again

Ricardo
15  Announcements and General Discussion / Architecture / plugin architecture and updates on: May 28, 2008, 08:32:37
Hi. For the design of my app I am thinking of using something like "plugins". What I want to have is this:

The main app basically consists of a product (for some definition of product) editor. The list of available products is dynamic, so that you will only have the choice of products among the products available at run time (I want to be able to add/remove available products on demand, so compiling everything right into the swf file is not the best option). I thought of using modules or something like that, so that I could just drop a new file into the app's directory and it would (when started) detect the new product implemented in that file, and make it available. That file should hold the product's view, model and controller parts (i.e. everything that is necessary to work with that product).

This way of architecting my app is to enable updates without having to download the whole app's code again.

I hope the main idea is clear. Now my question is: what is the best way to architect my app in order to achieve this? Are modules the answer? or RSL/SWC?
Can I use the standard AS3 version of the framework, or do I have to use the multicore version?

On a side note.. how would you manage updates to your app's functionality, in general?

Any ideas or suggestions (and critics) are welcome.

Ricardo
Pages: [1] 2