eXo Platform 4.0 Documentation > Reference Guide / GateIn > Portal Development

2.3. Default portal configuration

GateIn 3.5 default homepage URL is http://{hostname}:{port}/portal/. There may be multiple independent portals deployed in parallel at any given time, each of which has its root context (i.e.:http://{hostname}:{port}/sample-portal/). Each portal is internally composed of one or more 'portals'. It is required to have at least one such portal - the default one is called 'classic'. When accessing the default homepage URL of GateIn 3.5, you are automatically redirected to the 'classic' portal.

The default portal performs another important task. When starting up GateIn 3.5 for the first time, its JCR database will be empty (that's where portals keep their runtime-configurable settings). It is the default portal used to detect this, and to trigger automatic data initialization.

Configuration

The following example configuration can be found at: portal.war:/WEB-INF/conf/portal/portal-configuration.xml.


<component>
    <key>org.exoplatform.portal.config.UserPortalConfigService</key>
    <type>org.exoplatform.portal.config.UserPortalConfigService</type>
    <component-plugins>
        <component-plugin>
            <name>new.portal.config.user.listener</name>
            <set-method>initListener</set-method>
            <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
            <description>this listener init the portal configuration</description>
            <init-params>
                <value-param>
                    <name>default.portal</name>
                    <description>The default portal for checking db is empty or not</description>
                    <value>classic</value>
                </value-param>
                ...
            </init-params>
        </component-plugin>
    </component-plugins>
</component>

In this example, the classic portal has been set as the default.

Note

Components, component-plugins, and init-params are explained in the Advanced Development - Foundations chapter. For now, just note how the NewPortalConfigListener component-plugin is used to add configuration to UserPortalConfigService, which is designed in this way to allow other components to add configuration to it.

Deleting Portals Definition by Configuration

In some cases, some portal definitions are defined but not used any more. If you want to delete them, you can add some configurations to portal.war/WEB-INF/conf/portal/portal-configuration.xml.

To delete a portal definition or a portal template definition, you need to define a component plug-in as the example below:


<external-component-plugins>
    <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
    <component-plugin>
      <name>new.portal.config.user.listener</name>
      <set-method>deleteListenerElements</set-method>
      <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
      <description>this listener delete some predefined portal and templates configuration</description>
      <init-params>
        <object-param>
          <name>site.templates.location</name>
          <description>description</description>
          <object type="org.exoplatform.portal.config.SiteConfigTemplates">
            <field name="portalTemplates">
              <collection type="java.util.HashSet">
                <value>
                  <string>basic</string>
                </value>
                <value>
                  <string>classic</string>
                </value>
              </collection>
            </field>
          </object>
        </object-param>Setting the info bar shown by default for portlet
          <name>portal.configuration</name>
          <description>description</description>
          <object type="org.exoplatform.portal.config.NewPortalConfig">
            <field  name="predefinedOwner">
              <collection type="java.util.HashSet">
                <value><string>classic</string></value>
              </collection>
            </field>
            <field name="ownerType"><string>portal</string></field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
</external-component-plugins>

Setting the info bar shown by default for portlet

You can set the info bar shown by default for portlets of a portal by adding a property for the portal-config configuration in the portal.xml file.


<properties>
  <entry key="showPortletInfo">1</entry>
</properties>

There are two values for "showPortletInfo": 0 and 1. If the value is 1, the info bar of portlets is shown by default. If the value is 0, it is not.

Disabling a Portal Container

Once you have created a custom portal container that suits your needs, you may wish to disable a portal container that is no longer required.

Prerequisites: A new portal container is created.

  1. Add the following configuration to the configuration.xml file of the custom extension in order to disable a portal container:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
              http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
                   xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.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>
          <!-- (existing configuration for new portal container) -->
        </component-plugin>
        <component-plugin>
          <!-- The name of the plugin -->
          <name>Disable a PortalContainer</name>
          <!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions -->
          <set-method>registerDisablePlugin</set-method>
          <!-- The full qualified name of the PortalContainerDefinitionDisablePlugin -->

          <type>org.exoplatform.container.definition.PortalContainerDefinitionDisablePlugin</type>
          <init-params>
            <!-- The list of the name of the portal containers to disable-->
            <values-param>
              <name>names</name>
              <value>$PORTAL_NAME</value>
            </values-param>
          </init-params>
        </component-plugin>
      </external-component-plugins>
    </configuration>
  2. The portal name declared in the <values-param> directive will no longer be available at http://{hostname}:{port}/portal.

Note

Disabling the default portal container is possible as well, but some functions, such as WSRP, or Services Management, depend on the default portal container to be deployed, and will no longer work if this is disabled.

See also

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