In this recipe, we will see how to set a specific site as the default portal available for the entire portal instance. We will set the Financials site as the default portal of the GateIn instance.
Locate the portal configuration file at the following path in your application server, assuming that we are using JBoss AS:
/gatein.ear/02portal.war/WEB-INF/conf/portal/portal-configuration.xml
Otherwise, if you are using the Tomcat distribution, you should have the same file starting from the portal web application:
/GateIn-3.2.0.Final-tomcat6/webapps/portal/WEB-INF/conf/portal/portal-configuration.xml
UserPortalConfigService
:<component> <key>org.exoplatform.portal.config.UserPortalConfigService</key> <type>org.exoplatform.portal.config.UserPortalConfigService</type> … </component>
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
default.portal
value and page.templates.location
that are highlighted here:<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>financials</value> </value-param> <value-param> <name>page.templates.location</name> <description>the path to the location that contains Page templates</description> <value>war:/conf/portal/template/pages</value> </value-param>
<object-param> <name>site.templates.location</name> <description>description</description> <object type="org.exoplatform.portal.config.SiteConfigTemplates"> <field name="location"> <string>war:/conf/portal</string> </field> <field name="portalTemplates"> <collection type="java.util.HashSet"> <value> <string>basic</string> </value> <value> <string>classic</string> </value> </collection> </field> <field name="groupTemplates"> <collection type="java.util.HashSet"> <value> <string>group</string> </value> </collection> </field> <field name="userTemplates"> <collection type="java.util.HashSet"> <value> <string>user</string> </value> </collection> </field> </object> </object-param>
http://localhost:8080/portal
. You should be redirected to the Financials portal at the following URL: http://localhost:8080/portal/financials
The extension mechanism provided by GateIn allows overriding the default portal configuration with your own settings. Each portal can be configured in many ways and it is possible to configure each aspect of a portal instance. For example, in the preceding snippet, we have seen the following settings:
All the other options that we can override will be described later in the chapter.
Notice that we have assumed that you have created the Financials portal before starting this recipe.
If you need to create a new site in the same portal instance, you have to declare the default portal layout in a specific XML navigation file. By taking a look at the examples in the GateIn source code, you will see how to set all parameters.
We are going to create the Financials portal instance by defining the following portal page layout:
financials
in the following path: 02portal.war/WEB-INF/conf/portal/portal
portal.xml
file for defining the new portal layout and enter the following:<portal-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2" xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2"> <portal-name>financials</portal-name> <label>Financials</label> <description>Financials portal</description> <locale>en</locale> <access-permissions>Everyone</access-permissions> <edit-permission>*:/platform/administrators</edit-permission> <properties> <entry key="sessionAlive">onDemand</entry> <entry key="showPortletInfo">0</entry> </properties> <portal-layout> <portlet-application> <portlet> <application-ref>web</application-ref> <portlet-ref>BannerPortlet</portlet-ref> <preferences> <preference> <name>template</name> <value>par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl</value> <read-only>false</read-only> </preference> </preferences> </portlet> <access-permissions>Everyone</access-permissions> <show-info-bar>false</show-info-bar> </portlet-application> <portlet-application> <portlet> <application-ref>web</application-ref> <portlet-ref>NavigationPortlet</portlet-ref> <preferences> <preference> <name>useAJAX</name> <value>false</value> <read-only>false</read-only> </preference> </preferences> </portlet> <access-permissions>Everyone</access-permissions> <show-info-bar>false</show-info-bar> </portlet-application> <portlet-application> <portlet> <application-ref>web</application-ref> <portlet-ref>BreadcumbsPortlet</portlet-ref> <preferences> <preference> <name>useAJAX</name> <value>false</value> <read-only>false</read-only> </preference> </preferences> </portlet> <access-permissions>Everyone</access-permissions> <show-info-bar>false</show-info-bar> </portlet-application> <page-body> </page-body> <portlet-application> <portlet> <application-ref>web</application-ref> <portlet-ref>FooterPortlet</portlet-ref> <preferences> <preference> <name>template</name> <value>par:/groovy/groovy/webui/component/UIFooterPortlet.gtmpl</value> <read-only>false</read-only> </preference> </preferences> </portlet> <access-permissions>Everyone</access-permissions> <show-info-bar>false</show-info-bar> </portlet-application> </portal-layout> </portal-config>
Notice that the first part of the snippet contains all the parameters that you learned in Chapter 2, Managing Portal Contents using the GUI, the following are related to the creation of a new portal:
label
: This is the portal labeldescription
: A description for the portal instanceaccess-permission
: The group that can access the portaledit-permission
: The group that can edit the portalsessionAlive
: This shows how to manage the user sessionshowPortletInfo
: Manages the default behavior information barpage-body
: This is the center section of the body for the portal pageEach XML element declared as portlet-application
is used to define a specific block for the default layout of the portal page. In this
configuration snippet, as you can see, you need to set the following XML sub-elements:
3.16.76.237