Managing the navigation tree using XML

In this recipe, we will describe how you can change the default structure of the navigation tree to initialize your own portal for your specific requirements.

Getting ready

Three different configuration files manage the configuration for the navigation of a portal, so let's start discussing about these files:

  • portal.xml: Contains the default layout and the standard applications for a portal
  • pages.xml: Contains the pages layout and the standard applications for pages
  • navigation.xml: Contains all the pages of the tree

You already know the first two files, as we have already discussed them in the previous recipes: portal.xml is covered in the Managing portals using XML recipe, while pages.xml is explained in the Managing portal pages using XML recipe.

Locate the navigation.xml file inside this path:

/02portal.war/WEB-INF/conf/portal/portal/classic

Again, we want to understand how GateIn was developed so that we can extend it for our needs.

How to do it...

Taking a look at the navigation.xml file, we can see that only need to define, for each page that we want to show in the portal instance, a specific navigation node. For instance, to define the Contact Us page visible in the Financials portal, we have to enter the following snippet:

<node-navigation 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">
  <priority>1</priority>
  <page-nodes>
     <node>
       <name>contactus</name>
      <label xml:lang="en">Contact us</label>
      . . .
    <page-reference>portal::financials::contactus</page-reference>
     </node>   
    <node>

How it works...

The navigation must be declared as a unique root element node-navigation that must conform to the following XML namespace:

http://www.gatein.org/xml/ns/gatein_objects_1_2

Inside the root element, you need to define a container element named page-nodes that will include the page nodes. The fundamental sub-elements to show a page in the portal are defined in the page node element (node):

  • name: The internal name of the page node
  • label: This is the label of the page (multi-value)
  • page-reference: This is the page reference

The label element can be used to set a label for the page for each supported locale. This is done by using the xml:lang attribute.

The page-reference must be used to set values according to the following convention:

portal::portal-instance-name::page-name

In order to take a quick look at some default components of the portal, you can also use the export tool of GateIn as shown in Chapter 11, Managing Portal Resources with the Management Component. This way, you can see how to change a specific setting of a portal by trying to import your changes at runtime without restarting your portal instance.

See also

  • Chapter 11, Managing Portal Resources with the Management Component
  • The Managing portals using XML recipe
  • The Managing portal pages using XML recipe
  • The Wrapping it all up in a separate EAR recipe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.124.145