You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by cordenier christophe <ch...@gmail.com> on 2009/09/28 17:39:55 UTC

How to create dynamic contributeXxx method ?

Hi

I have multiple services that are based on the information provided to the
ComponentClassResolver : key mapping + package.

Now i'm trying to create a configuration service that will be used by all
the other services to get their configuration. Each configuration will be
mapped on the same key mapping provided to the ComponentClassResolver
service.

Is there a way to allow my configuration service to contribute to the
ComponentClassResolver without creating a complete alias ?

Actually, the objective is to provide the same Library Mapping key to the
ComponentClassResolver and to all of my service without duplicating too much
code or using constant for the library mapping key value and create multiple
contributeXxx methods.

Thanks in advance
Christophe.

Re: How to create dynamic contributeXxx method ?

Posted by ccordenier <Ch...@atosorigin.com>.
Thanks to my colleague,

I have implemented a simple and clean solution in the module class of my
component library which hold the whole configuration. Doing something like
this :

	public static void contributeComponentClassResolver(
			Configuration<LibraryMapping> configuration,
			MyConfigurationService conf) {
                // Add modules from configuration
		for (LibraryMapping mapping : conf.getLibraryMappings()) {
			configuration.add(mapping);
		}
	}

MyConfigurationService is marked as @EagerLoad.

Now the user of my library has only one entry point for the configuration of
module related informations.

-- 
View this message in context: http://www.nabble.com/How-to-create-dynamic-contributeXxx-method---tp25647814p25659365.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org