<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Reference_Guide.ent">
%BOOK_ENTITIES;
]>
<section id="sect-Reference_Guide-Default_Portal_Configuration">
	<title>Default Portal Configuration</title>
	<section id="sect-Reference_Guide-Default_Portal_Configuration-Overview">
		<title>Overview</title>
		<para>
			&PRODUCT; default homepage URL is <literal>http://{hostname}:{port}/portal/</literal>.
         There may be multiple independent portals deployed in parallel at any given time, each of which has its root
         context (i.e.: <literal>http://{hostname}:{port}/sample-portal/</literal>).
         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 &PRODUCT;, you
         are automatically redirected to the 'classic' portal.

         The default portal performs another important task. When starting up &PRODUCT; 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.
		</para>
	</section>
	
	<section id="sect-Reference_Guide-Default_Portal_Configuration-Configuration">
		<title>Configuration</title>
		<para>
			The following example configuration can be found at: &#34;<filename>02portal.war:/WEB-INF/conf/portal/portal-configuration.xml</filename>&#34;.
		</para>
		
<programlisting role="XML">&#60;component&#62;
    &#60;key&#62;org.exoplatform.portal.config.UserPortalConfigService&#60;/key&#62;
    &#60;type&#62;org.exoplatform.portal.config.UserPortalConfigService&#60;/type&#62;
    &#60;component-plugins&#62;           
     &#60;component-plugin&#62;
       &#60;name&#62;new.portal.config.user.listener&#60;/name&#62;
       &#60;set-method&#62;initListener&#60;/set-method&#62;
       &#60;type&#62;org.exoplatform.portal.config.NewPortalConfigListener&#60;/type&#62;
       &#60;description&#62;this listener init the portal configuration&#60;/description&#62;
       &#60;init-params&#62;
         &#60;value-param&#62;
           &#60;name&#62;default.portal&#60;/name&#62;
           &#60;description&#62;The default portal for checking db is empty or not&#60;/description&#62;
           &#60;value&#62;classic&#60;/value&#62;
         &#60;/value-param&#62; 
         ...
       &#60;/init-params&#62;
     &#60;/component-plugin&#62;
    &#60;/component-plugins&#62; 
  &#60;/component&#62;
</programlisting>
		<para>
			In this example, the <emphasis role="bold">classic</emphasis> portal has been set as the default.
		</para>
      <note>
         <para>
         Components, component-plugins, and init-params are explained in the Foundations chapter. For now, just note how the
         <literal>NewPortalConfigListener</literal> component-plugin is used to add configuration to
         <literal>UserPortalConfigService</literal>, which is designed in this way to allow other components
         to add configuration to it.
         </para>
      </note>
	</section>
    <section id="sect-Reference_Guide-Default_Portal_Configuration-Tips">
    <title>Tips</title>
    <section id="sect-Reference_Guide-Default_Portal_Configuration-Tips-Delete_Portals_Definition">
      <title>Delete Portals Definition by Configuration</title>
        <para>
            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
            <emphasis>portal.war/WEB-INF/conf/portal/portal-configuration.xml</emphasis>.
        </para>
        <para>
            To delete a portal definition or a portal template definition, you need to define a component plug-in as the example below:
        </para>
        <programlisting role="XML"><![CDATA[
<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>
		<object-param>
		  <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>
         ]]></programlisting>
        </section>
        <section id="sect-Reference_Guide-Default_Portal_Configuration-Tips-Show_Info_bar_portlet">
            <title>Set the info bar shown by default for portlet</title>
            <para>You can set the info bar shown by default for portlets of a portal by adding a property for the <emphasis>portal-config</emphasis> configuration in the <emphasis>portal.xml</emphasis> file.</para>
            <programlisting><![CDATA[
                    <properties>
                        <entry key="showPortletInfo">1</entry>
                    </properties>
            ]]></programlisting>
            <para>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.</para>
        </section>
    </section>
</section>


