1.4.6.2. Profiles configuration

Profiles are configured in the configuration files of eXo Kernel.

Profiles definition

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:

  1. Any kernel element without profiles attribute will create a configuration object.

  2. Any kernel element having a profiles attribute containing at least one of the active profiles will create a configuration object.

  3. Any kernel element having a profiles attribute matching none of the active profile will not create a configuration object.

  4. Resolution of duplicates (such as two components with same type) is left up to the kernel.

Profiles capable configuration elements

A configuration element is profiles capable when it carries a profiles element.

Component 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>

Component plugin element

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>

Import element

The import element imports a referenced configuration file when activated:


<import>empty</import>
<import profiles="foo">foo</import>
<import profiles="bar">bar</import>

Init param element

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>

Value collection element

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>

Field configuration element

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>
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus