1.4.2.1. Configuration retrieval

The container performs the following steps to make eXo Container configuration retrieval, depending on the container type.

Configuration retrieval order for PortalContainer

The container is initialized by looking into different locations. This container is used by portal applications. Configurations are overloaded in the following lookup sequence:

  1. Default RootContainer configurations from JAR files /conf/configuration.xml

  2. External RootContainer configuration can be found at $AS_HOME/exo-conf/configuration.xml

  3. Default PortalContainer configurations from JAR files /conf/portal/configuration.xml

  4. Web applications configurations from WAR files /WEB-INF/conf/configuration.xml

  5. External configuration for services of named portal can be found at $AS_HOME/exo-conf/portal/$PORTAL_NAME/configuration.xml

Configuration retrieval for StandaloneContainer

The container is initialized by looking into different locations. This container is used by non portal applications. Configurations are overloaded in the following lookup sequence:

  1. Default RootContainer configurations from JAR files /conf/configuration.xml

  2. External RootContainer configuration can be found at $AS_HOME/exo-conf/configuration.xml

  3. Default StandaloneContainer configurations from JAR files /conf/portal/configuration.xml

  4. Web applications configurations from WAR files /WEB-INF/conf/configuration.xml

  5. Then depending on the StandaloneContainer configuration URL initialization:

    • If configuration URL was initialized to be added to services defaults, as below:

      // add configuration to the default services configurations from JARs/WARs
      
      StandaloneContainer.addConfigurationURL(containerConf);

      Configuration from added URL containerConf will override only services configured in the file.

    • If configuration URL is not initialized at all, it will be found at $AS_HOME/exo-configuration.xml. If $AS_HOME/exo-configuration.xml does not exist the container will look for it at $AS_HOME/exo-conf/exo-configuration.xml location and if it is still not found and the StandaloneContainer instance obtained with the dedicated configuration ClassLoader, the container will try to retrieve the resource conf/exo-configuration.xml within the given ClassLoader.

General notes about the configuration retrieval

Warning

Take care to have no dependencies between configurations from JAR files (/conf/portal/configuration.xml and /conf/configuration.xml) since we have no way to know in advance the loading order of those configurations. In other words, if you want to overload some configuration located in the file /conf/portal/configuration.xml of a given JAR file, you must not do it from the file /conf/portal/configuration.xml of another JAR file but from another configuration file loaded after configurations from JAR files /conf/portal/configuration.xml.

After the processing of all configurations available in system, the container will initialize it and start each service in order of the dependency injection (DI).

The user/developer should be careful when configuring the same service in different configuration files. It's recommended to configure a service in its own JAR only. Or, in case of a portal configuration, strictly reconfigure the services in portal WAR files or in an external configuration.

There are services that can be (or should be) configured more than one time. This depends on business logic of the service. A service may initialize the same resource (shared with other services) or may add a particular object to a set of objects (shared with other services too). In the first case, it is critical who will be the last, i.e. whose configuration will be used. In the second case, it does not matter who is the first and who is the last (if the parameter objects are independent).

Getting the effective configuration at runtime

The effective configuration of the StandaloneContainer, RootContainer and/or PortalContainer can be known thanks to the method getConfigurationXML() that is exposed through JMX at the container's level. This method will give you the effective configuration in XML format that has been really interpreted by the kernel. This could be helpful to understand how a given component or plugin has been initialized.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus