tags:

views:

167

answers:

2

Hi All

We are building a fairly complex application that we need to be able to release different parts of at different times. To help us solve this problem we are using RSLs and Modules.

so let me describe the projects (names have been changed to protect the innocent)

core (rsl)

client (application)

groceries (module) groceriesCore (rsl)

bakery (module) bakeryCore (rsl)

We have one application client that loads the areas of the application as modules. We have a core RSL that does things like login and holds entitlements and provides an API for the modules to access this sort of state and also to communicate with each other.

When we load client we only want the core rsl to be loaded as that is that is currently required. When the groceries module is loaded we want the groceries rsl to load and likewise when the bakery module is loaded we want the bakeryCore rsl to load.

In reality this isn't what happens. If we set the projects up like that at run time the core rsl loads at application startup but the module RSLs do not load when the module is loaded. If we run an application from the project that houses the groceries module then he rsl loads when the application loads but not when the module does.

We need a way of loading the rsl when the module loads.

At the moment we specify groceriesCore and bakeryCore in the client application so they all load when the client loads. This is obviously not a good idea as when we add another 30 departments we don't want all these departments being downloaded at application startup - we only want them to be downloaded when they are required - when the application loads.

How do I achieve this? (other than a horrible custom rsl loader type thing).

+1  A: 

RSLs can only be loaded at application startup. What I've done in the past is to make things like your groceriesCore another module instead of an RSL. Then you just specify it somewhere as a dependency for the groceries module so that when you want to load groceries it will check if the groceriesCore module is loaded and if needed, load it.

Managing the dependencies of modules is not something that Flex manages for you. So you will have to do it manually. Or perhaps the Potomac Framework will help with it's OSGI-ish approach.

James Ward
Thanks for the reply James. I had seen the Potomac framework mentioned before and thought that it might be useful for us but have never got round to looking into it.Can't you load RSLs your self at run time or do they have to be turned into a module?
Roaders
A: 

Hi Roaders,

Did you find any elegant solution to this?

Thanks, Ozay

Ozay
Not really other than lazily loading modules with the required classes when they are required. Parsley / Cairngorm 3 make this pretty easy. I talk about this a bit here:http://blog.giles.roadnight.name/2010/08/cairngorm-3-module-library.html
Roaders