5.1.3.11. How to create/define a new portal?

To duplicate the entire "portal.war" file to create a new portal, you just need to duplicate the following files from the original "portal.war":

You need also to duplicate the "rest.war" file to create a dedicated rest web application for your portal as we must have one rest web application per portal, in fact you just need to duplicate the following files from the original "rest.war":

Finally, you need to register and define the corresponding PortalContainerDefinition. The PortalContainerDefinition of your portal will be composed of:

See an example below:


<?xml version="1.0" encoding="UTF-8"?>
<configuration
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
  xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
  <external-component-plugins>
    <!-- The full qualified name of the PortalContainerConfig -->
    <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
    <component-plugin>
      <!-- The name of the plugin -->
      <name>Add PortalContainer Definitions</name>
      <!-- The name of the method to call on the PortalContainerConfig in order to register the PortalContainerDefinitions -->
      <set-method>registerPlugin</set-method>
      <!-- The full qualified name of the PortalContainerDefinitionPlugin -->
      <type>org.exoplatform.container.definition.PortalContainerDefinitionPlugin</type>
      <init-params>
        <object-param>
          <name>sample-portal</name>
          <object type="org.exoplatform.container.definition.PortalContainerDefinition">
            <!-- The name of the portal container -->
            <field name="name"><string>sample-portal</string></field>
            <!-- The name of the context name of the rest web application -->
            <field name="restContextName"><string>rest-sample-portal</string></field>
            <!-- The name of the realm -->
            <field name="realmName"><string>exo-domain-sample-portal</string></field>
            <!-- All the dependencies of the portal container ordered by loading priority -->
            <field name="dependencies">
              <collection type="java.util.ArrayList">
                <value>
                  <string>eXoResources</string>
                </value>
                <value>
                  <string>portal</string>
                </value>
                <value>
                  <string>dashboard</string>
                </value>
                <value>
                  <string>exoadmin</string>
                </value>
                <value>
                  <string>eXoGadgets</string>
                </value>
                <value>
                  <string>eXoGadgetServer</string>
                </value>
                <value>
                  <string>rest-sample-portal</string>
                </value>
                <value>
                  <string>web</string>
                </value>
                <value>
                  <string>wsrp-producer</string>
                </value>
                <value>
                  <string>sample-portal</string>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
</configuration>

Useful Information #1

A portal is implicitly a PortalContainerConfigOwner which means that it shares the configuration file embedded into the war file, located at WEB-INF/conf/configuration.xml

Useful Information #2

The position of the servlet context name of this web application in the dependency list is important since the last configuration file loaded has always right towards other configuration files. Each configuration file loaded, could potentially redefine a configuration file that has already been loaded. Moreover, as we now use a unified Servlet Context to load the configuration files, if you want for instance to import the file war:/conf/database/database-configuration.xml and this file exists in 2 different web applications, the file from the last (according to the dependency order) web application will be loaded.

Copyright ©2012. All rights reserved. eXo Platform SAS