Advanced FeaturesProfile SelectionRequires Merlin 3.1 In the Profile tutorial we covered the mechanisms used to establish a pre-configured deployment profile. In this tutorial we update the <classname>.xprofile to include multiple named profiles and show how you can select a specific profile when declaring a component in block descriptor. Component deployment profiles are co-located with the component implementation class under an .xprofile resource. Adding multiple profilesThe RandomGeneratorProvider.xprofile is updated to include multiple profiles. RandomGeneratorProvider.xprofile <?xml version="1.0"?> <profiles> <profile name="primary"> <configuration> <seed>1024</seed> </configuration> </profile> <profile name="secondary"> <configuration> <seed>2048</seed> </configuration> </profile> </profiles> Component declaration using a named profileA <component> element may contain the profile attribute. The value of the profile attribute is the name of a profile declared under the .xprofile resource. If a component directive uses the profile attribute content of the element will be ignored. Extract from block.xml <component name="randomizer" class="tutorial.RandomGeneratorProvider" profile="secondary"/> Executing the tutorialBuild and run the tutorial. $ maven jar $ merlin -execute target\classes In the logging output we see that Merlin has selected the "secondary" profile and as a consequence the random seed declared in the secondary profile is different to our earlier examples. [INFO ] (kernel): installing: file:/${user.dir}/target/classes/ [INFO ] (tutorial.randomizer): configuration stage [INFO ] (tutorial.randomizer): seed: 2048 [INFO ] (tutorial.hello): supplied random: 1998430032 [INFO ] (kernel): dissassembly phase [INFO ] (kernel): disposal phase |