I am currently working on a project that was supposed to be a learning experience for me in using both Cairngorm and modules. I was running into the same thing you guys are and (while I hate to admit this) I had to ditch both Cairngorm and modules because my deadline is super tight and I wasn't making enough progress because I was running into the same issues you are. So what I am saying is... I have no useful input... but I will be listening intently.
-----Original Message----- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Schmalle Sent: Wednesday, January 24, 2007 9:12 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] CGRM :: ServiceLocator :: Modules - how to share Hi Jason, I was looking at application domains... Chicken and egg here. If you seperated out the module into a new application domain, you would have to make a project for each. If you load the module into the current domain, then you are sharing singletons. So the obvious answer is to modify something. :) Honestly the pattern I am using for FrontControllers seems to work well. Only if you describe a concrete interface that all modules must use. For instance; The ApplicationController is responsible for - initializations - configuration loading - delegating module execution and loading. If you then start to look at a module as a 'stack' or library of panes, this becomes easier to think about. Say you have a LoginModule. This module implements the IControllerClient interface that has; - function initialize(controller:ApplicationController):void; When the ApplicationController loads this module(login), when it creates the instance through a command or whatever, it calls - IControllerClient(instance).initialize(controller); Through this call, the LoginModule now can register it's commands with the ApplicationController. This works great, I am just working on the timing of things a bit more. Back to the service locator. > It may be best to register these ServiceLocators against a name That is a good idea. Some how use namespaces. Anybody? Are we missing something obvious about loading modules and a single service locator? Common, people have to have started to run into this by now. :) Peace, Mike On 1/24/07, [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hi Mike, I'm having precicely the same issue - I need to look into the new module feature further. My solution was to hack the Cairngorm ServiceLocator and make it a Multiton (every time you create a ServiceLocator, it simply adds itself to an array of instances, rather than keeping just 1 instance), when getServiceForId is called, it checks all registered services in each ServiceLocator and throws a new CairngormMessageCodes.DUPLICATE_SERVICE error if it finds more than one with the same name. This isn't ideal because every service must have a unique name within the Application which is far from ideal. It may be best to register these ServiceLocators against a name, and ask for a particular service on a particular ServiceLocator - I haven't considered options down this path yet. The next problem I have is that I am using multiple Flex Library Projects for additional Cairngorm based functionality that will get shared between multiple projects, but if the Flex Library Project uses CFC's or XML files they don't get copied over at compile time, so the Services don't work. I'm stuck between a rock and a hard place at the moment. :P Jay Proulx [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> _____ From: flexcoders@yahoogroups.com [mailto: flexcoders@ <mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com> ] On Behalf Of Michael Schmalle Sent: January 24, 2007 8:04 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] CGRM :: ServiceLocator :: Modules - how to share Hi, I have a question here I have tried to resolve myself but, I am interested in opinions. Using the new modules algorithm. In my mind I have Application (shell) - LoginModule - ProjectModule - ASDocModule - DocumentModule - WikiModule Imagine the 'Application' is a desktop, where you start a program and that is a module. It seems to me in this new design pattern, using a FrontController for the whole application seems ludicrous. I mean, this is set up like we don't really even know what is going to be loaded into this desktop, except that we have defined interfaces for what DOES load into it. The ServiceLocator is a singleton, so if you have a service locator defined in the 'Application' what should I do with the modules that have their own dependent service that have nothing to do with the shell application? I know their are established methodologies out their but, we all know things must change and I think the current pattern in crgrm is to limiting for an application that delegates most of it's processes to module that are actually self executing encapsulated ententes themselves. I have come up with some ideas that actually work but, I ran into a problem with the service locator. I have each module create a FrontController, these sub controllers register their commands to the ApplicationController through interface( no coupling here). I can't get more specific but, if anyone wants to start a quick conversation about this and modules, I could maybe get more explicit. Peace, Mike -- Teoti Graphix http://www.teotigraphix.com <http://www.teotigraphix.com> Blog - Flex2Components http://www.flex2components.com <http://www.flex2components.com> You can find more by solving the problem then by 'asking the question'. -- Teoti Graphix http://www.teotigraphix.com <http://www.teotigraphix.com> Blog - Flex2Components http://www.flex2components.com <http://www.flex2components.com> You can find more by solving the problem then by 'asking the question'.