Is it applicable for me to use one context to hold all the mappings for a big and modular application?

Meteor's Avatar

Meteor

15 Aug, 2012 07:38 AM

Is it applicable for me to use one context to hold all the mappings for a big and modular application? just like Spring's application-context.xml

thanks!

  1. Support Staff 1 Posted by Ondina D.F. on 15 Aug, 2012 04:54 PM

    Ondina D.F.'s Avatar

    Hi Meteor,

    I’ve never used XML for Context configuration, so, I’m not sure if this will help you.

    http://knowledge.robotlegs.org/kb/framework-core/is-robotlegs-compa...
    https://github.com/tschneidereit/SwiftSuspenders/tree/the-past#xml-...

    http://www.helmutgranda.com/2009/12/02/robotlegs-and-flash-ide-cs4-...

    Follow Ruprict’s link (odoe’s comments):
    http://knowledge.robotlegs.org/discussions/questions/38-can-i-injec...

    Ondina

    P.S. Huge configuration files or classes are not easy to maintain.

    For example, it would be much better to split the mappings into smaller classes (Commands) than to have them all inside a huge Context class.

    The mappings can be grouped together by “type” or by “features”, or other criteria.
    So in your Context you’d have something like this:

    commandMap.mapEvent(MappingsEvent.START_MAPPING, MapControllersCommand, MappingsEvent, true);

    commandMap.mapEvent(MappingsEvent.START_MAPPING, MapModelsCommand, MappingsEvent, true);

    commandMap.mapEvent(MappingsEvent.START_MAPPING, MapServicesCommand, MappingsEvent, true);

    commandMap.mapEvent(MappingsEvent.START_MAPPING, MapViewsCommand, MappingsEvent, true);

    In your MapControllersCommand you’d map Commands, in your MapViewsCommand you’d map Views and Mediators..etc

    The naming of those commands is up to you, of course. (bootstrap, config..)
    You could as well have commands for mapping the modules, if need be.

    The local mappings, inside of each module, should be done in the module’s own Context. (following the same pattern as the one above)

  2. Ondina D.F. closed this discussion on 25 Aug, 2012 02:39 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac