Profiles are configured in the configuration files of eXo Kernel.
Profile activation occurs at XML to configuration object unmarshalling time. It is based on a "profile" attribute that is present on some of the XML elements of the configuration files. To enable this, the kernel configuration schema has been upgraded to kernel_1_1.xsd. The configuration is based on the following rules:
Any kernel element without profiles attribute will create a configuration object.
Any kernel element having a profiles attribute containing at least one of the active profiles will create a configuration object.
Any kernel element having a profiles attribute matching none of the active profile will not create a configuration object.
Resolution of duplicates (such as two components with same type) is left up to the kernel.
A configuration element is profiles capable when it carries a profiles element.
The component element declares a component when activated. It will shadow any element with the same key declared before in the same configuration file:
<component>
<key>Component</key>
<type>Component</type>
</component>
<component profiles="foo">
<key>Component</key>
<type>FooComponent</type>
</component>
The component-plugin element is used to dynamically extend the configuration of a given component. Thanks to the profiles, the component-plugins could be enabled or disabled:
<external-component-plugins>
<target-component>Component</target-component>
<component-plugin profiles="foo">
<name>foo</name>
<set-method>addPlugin</set-method>
<type>type</type>
<init-params>
<value-param>
<name>param</name>
<value>empty</value>
</value-param>
</init-params>
</component-plugin>
</external-component-plugins>
The import element imports a referenced configuration file when activated:
<import>empty</import>
<import profiles="foo">foo</import>
<import profiles="bar">bar</import>
The init param element configures the parameter argument of the construction of a component service:
<component>
<key>Component</key>
<type>ComponentImpl</type>
<init-params>
<value-param>
<name>param</name>
<value>empty</value>
</value-param>
<value-param profiles="foo">
<name>param</name>
<value>foo</value>
</value-param>
<value-param profiles="bar">
<name>param</name>
<value>bar</value>
</value-param>
</init-params>
</component>
The value collection element configures one of the values of collection data:
<object type="org.exoplatform.container.configuration.ConfigParam">
<field name="role">
<collection type="java.util.ArrayList">
<value><string>manager</string></value>
<value profiles="foo"><string>foo_manager</string></value>
<value profiles="foo,bar"><string>foo_bar_manager</string></value>
</collection>
</field>
</object>
The field configuration element configures the field of an object:
<object-param>
<name>test.configuration</name>
<object type="org.exoplatform.container.configuration.ConfigParam">
<field name="role">
<collection type="java.util.ArrayList">
<value><string>manager</string></value>
</collection>
</field>
<field name="role" profiles="foo,bar">
<collection type="java.util.ArrayList">
<value><string>foo_bar_manager</string></value>
</collection>
</field>
<field name="role" profiles="foo">
<collection type="java.util.ArrayList">
<value><string>foo_manager</string></value>
</collection>
</field>
</object>
</object-param>