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]

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 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'. 

Reply via email to