Skip navigation
Jeff Battershall
Currently Being Moderated

Cairngorm 3 & Dynamic Modules

Nov 16, 2009 12:26 PM

I'm excited about the new module implementation, but I have some questions about the way it's getting implemented in Cairngorm 3 so far.  It would seem that the way InsyncContext is architected, the modules are hard coded in the app.  The way I've implemented modules in the past was to make them completely data-driven, so I can make the available modules user profile-driven. 

 

I'm interested in anyone's thoughts on how this could be done with Cairngorm 3.  Maybe some sort of Factory class that provides a new ParsleyModuleDescriptor with passed parameters for the module URL, etc? 

 

Jeff

 
Replies
  • Currently Being Moderated
    Nov 18, 2009 6:10 AM   in reply to Jeff Battershall

    Hi Jeff,

     

    That's a good question and I think modules are a good candidate for runtime configuration. We've also seen the requirement you mention, where different users are entitled to access different modules. Also, it can be desirable to release new modules into production without needing to redeploy the shell application that loads them.

     

    So how could this be implemented? Well both Spring ActionScript and Parsley provide a means of configuring a context at runtime from an XML file. With both frameworks this system is commonly used for configuring the Flex logging framework, but the same mechanism could be used for configuring module descriptors. What is needed is a class for describing the module and a component for loading and rendering it.

     

    Re. the Cairngorm module library, it's early days. This is one of the more experimental parts of Cairngorm and its design is very much up for debate. The intention is to provide some features not included in the Flex SDK, such as:

     

    • Abstraction of the loading process, so that modules, compiled stylesheets, sub-applications and other asynchronous loading processes can be handled in the same way.
    • Support for progress and error states that display while the module is loading and if an error occurs.
    • Runtime configuration of modules through declarative descriptors, placed in XML or MXML (your requirement).
    • Lazy loading of modules in response to messages.

     

    At the same time, features of the standard Flex ModuleLoader shouldn't be lost, such as the ability to declare multiple instances of the same module at different parts of the UI.

     

    Do these requirements resonate with you? Do you have thoughts on how you'd like to see them solved? Have you solved them before? It would be nice to stay as close to convention as possible.

     

    Best,

    Tom

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2009 11:48 AM   in reply to Jeff Battershall

    Are you using parsley 2.1 and the command and module libs from trunk? 

    If not, please try that.

     

    Sent from my iPhone

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 19, 2009 2:28 PM   in reply to Jeff Battershall

    You also need to wire your view to Parsley with i.e. a configureIOC event or the Configure tag. Check out the Parsley docs for that. Have you checked out the InsyncModularExtended projects for an example using the C3 module library? There's also a tutorial on that in our guidelines.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2009 12:52 AM   in reply to Jeff Battershall

    I think that messaging is normally scoped to a context hierarchy, so in order for a message sent in the context of a module to be received by handlers in another context, those contexts must be within a hierarchy. In other words, when you build the context for your module, Parsley needs to be able to find the parent context too. It tries to do this automatically with Parsley 2.1, but in some cases it cannot succeed, so you need to specify the parent context manually via the FlexContextBuilder.build() method.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2009 3:47 AM   in reply to Jeff Battershall

    Maybe you're using the wrong view wiring event? In Parsley 2.0 it was called "configureIOC", but in Parsley 2.1 the ViewConfigurationEvent,CONFIGURE_VIEW is used, or the <Configure> tag.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2009 4:05 AM   in reply to Jeff Battershall

    Jeff,

     

    please have a look into the InsyncModularExtended sample applications. They also use Commands, the IntegrationRPC library and show you how to set it up. It works there but I'd be interested if there's anything different in your scenario that would make the integration library fail. Maybe you're missing to initialize the integration RPC library in your entry level MXML. Check out the Insync samples. They have commands in the contacts module.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 20, 2009 12:14 PM   in reply to Jeff Battershall

    Hi Jeff,

     

    Have you studied the Parsley developer manual for more overview? Also check if this could be causing different instances of your PM. Enable logging on Parsley to see if any message handler runtime errors have been thrown or use Parsley's MessageError tag.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 21, 2009 6:20 AM   in reply to Jeff Battershall

    Have you looked into the Parsley forum post I pointed out in my last post (discussion between Xavi and Jens). Your problem sounds familiar. Also, make sure you understand Parsley's messaging scope feature.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 23, 2009 10:34 PM   in reply to Jeff Battershall

    Hi Jeff,

     

    sorry but I have to repeat myself. Have you read the Parsley forum post between Xavi and Jens I pointed to above? There are also more threads on that topic in the Parsley forum if you search for it. Your problem sounds exactly like that. It's caused by multiple addedToStage events. There are workarounds.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 19, 2010 5:05 AM   in reply to Jeff Battershall

    UPDATED: Ok, doesn't mind. I just understand that you were simply meaning to put the tag <cairngorm:CairngormIntegrationLib /> inside the module.

    Thanks anyway!!

     

     

    Hi Jeff, I'm having the exact same problem in a project; if I change [Command] by [MessageHandler] it works correctly.

     

    The problem is that I have the integrationlib.swc added to the module. What do you mean with "I did not have the integration libs tag in my module"?

     

     

    Thanks!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 22, 2010 8:22 AM   in reply to Jeff Battershall

    Hi Jeff,

     

    I haven't had time to work on this library myself but have a few opinions about how it should change. It's being used on a few other Adobe projects, so I expect some improvements based on their experiences.

     

    I'd like the design to change in this way:

     

    1. Module loading abstracted by an IContent (or something) interface instead of overloading IModuleInfo. Then different implementations can be used for modules, modules with compiled CSS, or other configurations. Some projects need to use special authentication services before loading each module, so that kind of customization could be hidden behind the interface. Instances of these classes could be declared in MXML or XML config files, with the latter being suitable for dynamic modules.

     

    2. Change the ViewLoader component so it works for multiple instances of the same module, and so the behavior is more similar to ModuleLoader in Flex.

     

    3. Write a new stack container for modules, so that only a single loading-overlay and error-state child is present. If you place 10 ViewLoaders in a view stack, you end up with a loading overlay child for each module.

     

    Best,

    Tom

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 22, 2010 8:29 AM   in reply to Jeff Battershall

    Hi Jeff,

     

    Did you notice that commands have been incorporated into the Parsley 2.2 release candidate 2:

     

    http://www.spicefactory.org/parsley/download.php

     

    Jens Halm made some definite improvements over the implementation in Cairngorm 3, so I'd recommend having a look at those. The short-lived command objects are particularly nice. It looks like the Parsley 2.2 developer manual is still in progress, but a description of the new command features can be found here:

     

    http://www.spicefactory.org/parsley/docs/2.1/manual/roadmap.php#comman ds

     

    Best,

    Tom

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points