<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<book>
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bookinfo.xml"/>
  <chapter id="DEV.Introduction">
    <title>Introduction </title>
    <section id="DEV.Introduction.Welcome">
      <title>Welcome to eXo Platform 3.5 </title>
      <para>eXo Platform is the first and only integrated, cloud-ready user experience platform for building and deploying transactional websites, managing web and social content and creating gadgets and dashboards. eXo Platform lets companies leverage their existing Java infrastructure, while accommodating changing user behavior driven by consumer web technologies, such as social networks, social publishing and forums. </para>
      <para>The following illustration gives you the overall architecture of eXo Platform 3.5.   <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/Architecture_PLF3.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/Architecture_PLF3.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>The foundation of eXo Platform 3.5 is an enterprise portal and content management system. This provides a powerful set of REST-based services for rapid website development, content management and gadget-based development and deployment. eXo Platform 3.5 includes the following features.</para>
      <itemizedlist>
        <listitem>
          <para>An enterprise portal serves as a powerful framework for developing portlets and other web-based user interfaces, and is based on the open source GateIn portal project co-developed by eXo and Red Hat.</para>
        </listitem>
        <listitem>
          <para>Web Content Management extends portal-based applications, allowing you to build dynamic and content-rich websites.</para>
        </listitem>
        <listitem>
          <para>Document Management for capturing and organizing documents and unstructured content, with content storage in the built-in Java Content Repository (JCR). </para>
        </listitem>
        <listitem>
          <para>xCMIS is an implementation of the full stack of Java-based CMIS (Content Management Interoperability Specification) services, so eXo-based applications can integrate with existing content management tools.</para>
        </listitem>
        <listitem>
          <para>Business Process Management (BPM) from Bonita Open Solution enables you to define workflow processes with automatic actions for web content, documents and more.</para>
        </listitem>
        <listitem>
          <para>Cloud-ready features allow eXo Platform 3.5 to run in multi-tenant environments, so social intranets and websites can take advantage of the benefits of private and public cloud platforms.</para>
        </listitem>
      </itemizedlist>
      <para>With eXo Platform 3.5, you can customize and extend your portal-based applications with user experience services to  build social intranets and extranets.</para>
      <itemizedlist>
        <listitem>
          <para>Enterprise social network features allow users to connect, collaborate within dedicated spaces, and publish real-time updates in activity streams. Support for OpenSocial provides a framework for building gadgets that can display and mash up activity information for contacts, social networks, applications and services.</para>
        </listitem>
        <listitem>
          <para>Collaboration &amp; communication tools let you build a more productive and interactive dashboard for social intranet users. Intuitive Mail, Chat, Calendar and Address Book functionalities can seamlessly extend your portal-based web applications.</para>
        </listitem>
        <listitem>
          <para>Knowledge management features, including Forums, Answers, FAQs, and a complete enterprise wiki, can transform an extranet into an interactive online community and valuable knowledge base.</para>
        </listitem>
        <listitem>
          <para>Custom development in the web-based IDE is an intuitive web-based development environment where you can build, test and deploy client applications, such as gadgets and mash-ups, and RESTful services online. Offering the ability to extend eXo Platform online, eXo IDE instantly publishes any application that you can create and deploy immediately in your portal-based solutions.</para>
        </listitem>
        <listitem>
          <para>CRaSH is an open source tool to view and query content within a JCR server at runtime. It enables you to browse JCR trees, and serves as a shell for executing JCR operations easily, such as importing or exporting data securely. You can now extend the shell by writing Groovy commands, without recompiling easily.</para>
        </listitem>
        <listitem>
          <para>Native mobile applications for iPhone, iPad and Android allow users to easily and securely access their personalized intranet dashboards, activity streams, documents and more.</para>
        </listitem>
      </itemizedlist>
      <para> </para>
    </section>
    <section id="DEV.Introduction.AboutDeveloperGuide">
      <title>About this guide </title>
      <para>The eXo Platform Developer Guide presents a complete overview of the eXo Platform 3.5 capabilities. This guide is intended for system integrators who want to know how to leverage eXo Platform in their customer projects and IT enterprises who need to customize and deploy their portals. Accordingly, this guide introduces the eXo Platform architecture, and shows developers how to perform some of the most common tasks needed for working with eXo Platform 3.5. It also serves as an entry point for the Reference Guide, which provides more in-depth technical details about eXo Platform 3.5. As a result, developers could be able to customize their own portals with eXo Platform 3.5.</para>
      <para>This guide includes the following topics.</para>
      <informaltable>
        <tgroup cols="2">
          <tbody>
            <row>
              <entry>
                <link linkend="DEV.Introduction">Introduction</link>
              </entry>
              <entry>Overview of eXo Platform 3.5, of the developer guide and its intended readers.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.Glossary">Glossary</link>
              </entry>
              <entry>Terms commonly used in the developers' aspect in the process of implementing the eXo Platform applications.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.SettingUpYourProject">Set Up Your Project</link>
              </entry>
              <entry>Step-by-step instructions on how to set up projects.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.eXoArchitecturePrimer">eXo Architecture Primer</link>
              </entry>
              <entry>Introduction to Kernel, GateIn Extensions, and Java Content Repository and their components.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.CreatingYourOwnPortal">Create Your Own Portal</link>
              </entry>
              <entry>Steps of creating a portal.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.WorkingwithContent">Work with Content</link>
              </entry>
              <entry>Topics related to the eXo Platform content.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.WorkingwithApplications">Work with Applications</link>
              </entry>
              <entry>Instructions on how to integrate applications into your portal and how to deploy your own applications.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.SystemIntegration">Integrate eXo Platform 3.5 into one information system</link>
              </entry>
              <entry>Topics related to the eXo Platform 3.5 integration into information systems through specific topics, such as authentication, user integration, LDAP integration and Email configuration.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.eXoPlatformAPIs">eXo Platform 3.5 APIs</link>
              </entry>
              <entry>Information about APIs.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.Cookbook">Cookbook</link>
              </entry>
              <entry>Introduction to Cookbook, particularly steps on how to copy a site.</entry>
            </row>
            <row>
              <entry>
                <link linkend="DEV.NewFeatures">New Features</link>
              </entry>
              <entry>New features integrated into eXo Platform 3.5. At present, in this chapter, only one feature called Navigation By Content is introduced.</entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
  </chapter>
  <chapter id="DEV.Glossary">
    <title>Glossary </title>
    <para>This chapter will provide you explanations about some technical terms which are used throughout the documentation.</para>
    <itemizedlist>
      <listitem>
        <para>
          <emphasis role="bold">Container templates</emphasis> are those used to contain the UI components in a specific layout and display them on the portal page.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">ConversationState</emphasis> is an object which stores all information about the state of the current user. This <emphasis role="bold">ConversationState</emphasis> object also stores acquired attributes of an Identity which is a set of principals to identify a user.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Data container</emphasis> implements the physical data storage. It enables different types of backend (such as RDB, FS files) to be used as a storage for the JCR data. With the main Data Container, other storages for persisted Property Values can be configured and used. The eXo JCR persistent data container can work in two configuration modes.</para>
        <itemizedlist>
          <listitem>
            <para>Multi-database: A database for each workspace (used in the standalone eXo JCR service mode).</para>
          </listitem>
          <listitem>
            <para>Single-database: All workspaces persisted in one database (used in the embedded eXo JCR service mode; for example in eXo portal).</para>
          </listitem>
        </itemizedlist>
      </listitem>
    </itemizedlist>
    <para>The data container uses the JDBC driver to communicate with the actual database software. For example, any JDBC-enabled data storage can be used with the eXo JCR implementation.</para>
    <itemizedlist>
      <listitem>
        <para>
          <emphasis role="bold">Database Creator</emphasis> (DBCreator) is a service that is responsible for executing the DDL (Data Definition Language) script in runtime. A DDL script may contain templates for database name, username, and password which will be replaced by real values at execution time.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Drives</emphasis> are customized workspaces with:</para>
        <itemizedlist>
          <listitem>
            <para>a configured path where the user will start when browsing the drive.</para>
          </listitem>
          <listitem>
            <para>a set of views with limitations to available actions, such as editing or creating contents while being in the drive.</para>
          </listitem>
          <listitem>
            <para>a set of permissions to limit the access (and view) of the drive to a restricted number of people.</para>
          </listitem>
          <listitem>
            <para>a set of options to describe the behavior of the drive when users browse it.</para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">eXo Cache</emphasis> is one which all applications on the top of eXo JCR need. This can rely on an <emphasis role="italic">org.exoplatform.services.cache.ExoCache</emphasis> instance managed by <emphasis role="italic">org.exoplatform.services.cache.CacheService</emphasis>.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">eXoContainer</emphasis> behaves like a class loader that is responsible for loading services/components. The eXoContainer class is inherited by all the containers, including RootContainer, PortalContainer, and StandaloneContainer. It itself inherits from a PicoContainer framework which allows eXo to apply the IoC Inversion of Control principles. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">External Plugin</emphasis> allows adding configuration for services and components easily.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Folksonomy</emphasis> is a system of classification derived from the practice and a method of collaboratively creating and managing tags to annotate and categorize content. This practice is also known as collaborative tagging social classification social indexing and social tagging (Source: <ulink url="http://en.wikipedia.org).">http://en.wikipedia.org).</ulink>
        </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Gadgets</emphasis> are web-based software components based on HTML, CSS, and JavaScript. They allow developers to easily write useful web applications that work anywhere on the web without modification. (Source: opensocial.org)</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Groovy template</emphasis> is widely used in eXo UI framework. It leverages the usage of Groovy language, a scripting language for Java. The template file consists of HTML code and Groovy code blocks.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">JCR WebDav</emphasis> is a service that allows a JCR repository to be accessed via WebDav.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">JobSchedulerService</emphasis> defines a job to execute a given number of times during a given period. It is a service that is in charge of unattended background executions commonly known for historical reasons as batch processing. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">JodConverter</emphasis> (Java OpenDocument Converter) is a tool that converts documents into different office formats and vice versa.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold"> JCR Item</emphasis> can be a node or a property.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">ListenerService</emphasis> is an event mechanism which allows triggering and listening to events under specific conditions inside eXo Platform. This mechanism is used in several places in eXo Platform, such as login/logout time, creating/updating users, and groups.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">LockManager</emphasis> stores lock objects so it can give a lock object or can release it. Also, LockManager is responsible for removing Locks that live too long. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Namespace</emphasis> is the name of a node and property which may have a prefix delimited by a single ':' colon character. This name indicates the namespace of the item (Source JSR 170) and is used to avoid the naming conflict. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Navigation node</emphasis> looks like a label of the link to page on the Navigation bar. By clicking a node, the page content is displayed. A node maps a URI and a portal page for the portal's navigation system. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Navigation</emphasis> looks like a menu which is to help users visualize the site structure and to provide hyperlinks to other parts on a Portal. Thus, a bar which contains navigations is called the Navigation bar. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Node type</emphasis> defines child nodes and properties which a node may (or must) have. Every node type has attributes, such as name, supertypes, mixin status, orderable child nodes status, property definitions, child node definitions and primary item name (Source: JSR 170). </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Node</emphasis> is an element in the tree structure that makes up a repository. Each node may have zero or more child nodes and zero or more child properties. There is a single root node per workspace which has no parent. All other nodes have only one parent. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Organization listener</emphasis> provides a mechanism to receive notifications via an organization listener, including UserEventListener, GroupEventListener and MembershipEventListener. </para>
        <itemizedlist>
          <listitem>
            <para>UserEventListener is called when a user is created, deleted or modified.</para>
          </listitem>
          <listitem>
            <para>GroupEventListener is called when a group is created, deleted or modified.</para>
          </listitem>
          <listitem>
            <para>MembershipEventListener is called when a membership is created or removed.</para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Organization management</emphasis> is a portlet that manages users groups and memberships. This portlet is often managed by administrators to set up permission for users and groups. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">OrganizationService</emphasis> is a service that allows accessing the Organization model. This model is composed of users, groups, and memberships. It is the basis of eXo's personalization and authorizations and is used for all over the platform. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Path constraint</emphasis> restricts the result node to a scope specified by a path expression. The following path constraints must be supported exact child nodes descendants and descendants or self (Source: JCR 170). </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Permission</emphasis> is a permission settings control which actions users can or cannot perform within the portal and are set by the portal administrators. Permission types specify what a user can do within the portal. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Portal Page</emphasis> consists of one or more various portlets. Their layouts are defined by container templates. To display a portal page, this page must be mapped to a navigation node. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Portal skins</emphasis> are graphic styles that display an attractive user interface. Each skin has its own characteristics with different backgrounds, icons, color, and more. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">PortalContainer</emphasis> is a type of container which is created at the startup of the portal web application in the init method of the PortalController servlet. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Portlet</emphasis> is a web-based application that provides a specific piece of content to be included as part of a portal page. In other words, portlets are pluggable user interface components that provide a presentation layer to information systems. There are two following types of portlet:</para>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Functional Portlets</emphasis> support all functions within the portal. They are integrated into the portal that can be accessed through toolbar links.</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">Interface Portlets</emphasis> constitute the interface of a portal. eXo Portal consists of some Interface Portlets, such as Banner Portlet, Footer Portlet, Homepage Portlet, Console Portlet, Breadcrumb Portlet and more. </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Property constraint</emphasis> is one which may be specified by a query on the result nodes by way of property constraints (Source: JCR 170). </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Property</emphasis> is an element in the tree structure that makes up a repository. Each property has only one parent node and has no child node. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Repository</emphasis> holds references to one or more workspaces. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">eXo REST framework</emphasis> is used to make eXo services (for example, the components deployed inside eXo Container) simply and transparently accessible via HTTP in a RESTful manner. In other words, those services should be viewed as a set of REST Resources-endpoints of the HTTP request-response chain. Those services are called <emphasis role="bold">ResourceContainers</emphasis>. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">RootContainer</emphasis> is a base container. It plays an important role during the startup but it is recommended that it should not be used directly.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">RTL Framework</emphasis> (Right To Left Framework) is a framework that handles the text orientation depending on the current locale settings. It consists of four components, including Groovy template, Stylesheet, Images, and Client java.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">StandaloneContainer</emphasis> is a context independent eXo Container. It is also used for unit tests.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Taxonomy</emphasis> is used to sort documents to ease searches when browsing documents online.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Tree structure</emphasis> is defined as a hierarchical structure with a set of linked nodes and properties.</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Type constraint</emphasis> specifies the common primary node type of the returned nodes plus possibly additional mixin types that they also must have. Type constraints are inheritance-sensitive in which specifying a constraint of node type x will include all nodes explicitly declared to be type x and all nodes of subtypes of x (Source: JSR 170).</para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Web Content</emphasis> is the textual, visual or aural content that is encountered as part of the user experiences on a website. It may include other things, such as texts images, sounds, videos, and animations. </para>
      </listitem>
      <listitem>
        <para>
          <emphasis role="bold">Workspace</emphasis> is a container of single rooted tree that includes items.</para>
      </listitem>
    </itemizedlist>
  </chapter>
  <chapter id="DEV.SettingUpYourProject">
    <title>Set Up Your Project </title>
    <para>This section aims at helping you apply eXo Platform to your projects successfully by introducing eXo architecture and giving step-by-step instructions for you to build your own custom portal based on eXo Platform.</para>
    <para>
      <emphasis role="bold">Requirements:</emphasis>
    </para>
    <itemizedlist>
      <listitem>
        <para>JDK (Java Development Kit) 6.0 </para>
      </listitem>
      <listitem>
        <para>SVN 1.6+</para>
      </listitem>
      <listitem>
        <para>Maven 2.2.1+</para>
      </listitem>
      <listitem>
        <para>Tomcat 6.0.26 or JBoss 5.1.0</para>
      </listitem>
    </itemizedlist>
    <para>
      <emphasis role="bold">Install and configure Maven:</emphasis>
    </para>
    <para>You need to add a system environment variable <emphasis role="italic">MAVEN_OPTS</emphasis> (it could be in a .profile startup script on Linux/MacOS operating systems or in the global environment variables panel on Windows).</para>
    <itemizedlist>
      <listitem>
        <para>Windows:</para>
      </listitem>
    </itemizedlist>
    <programlistingco>
      <areaspec units="linecolumn"/>
      <programlisting><![CDATA[
set MAVEN_OPTS=-Xshare:auto -Xms128M -Xmx1G -XX:MaxPermSize=256M
]]></programlisting>
    </programlistingco>
    <itemizedlist>
      <listitem>
        <para>Linux/MacOS:</para>
      </listitem>
    </itemizedlist>
    <programlistingco>
      <areaspec units="linecolumn"/>
      <programlisting><![CDATA[
export MAVEN_OPTS="-Xshare:auto -Xms128M -Xmx1G -XX:MaxPermSize=256M"
]]></programlisting>
    </programlistingco>
    <para>
      <emphasis role="bold">Maven settings:</emphasis>
    </para>
    <para>
      <emphasis role="bold">1.</emphasis> Save the <emphasis role="italic">settings.xml</emphasis> file to the path: <emphasis role="italic">HOME/.m2/settings.xml</emphasis>.</para>
    <para>
      <emphasis role="bold">2.</emphasis> Edit and change the <emphasis role="italic">local-properties</emphasis> profile, including:</para>
    <itemizedlist>
      <listitem>
        <para>
          <emphasis role="italic">exo.projects.directory.dependencies</emphasis> contains the application servers, and Openfire.</para>
      </listitem>
    </itemizedlist>
    <itemizedlist>
      <listitem>
        <para>each <emphasis role="italic">exo.projects.app.AS-NAME.version</emphasis> contains the name and version of the application servers.</para>
      </listitem>
    </itemizedlist>
    <note>
      <para>If the <emphasis role="italic">settings.xml</emphasis> file has been existing, you can merge them. You will need the followings:</para>
      <itemizedlist>
        <listitem>
          <para>The <emphasis role="italic">local-properties</emphasis> profile, which defines properties, is used to build application server distributions of our products.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>The <ulink url="http://repository.exoplatform.org/public">repository</ulink> to download our dependencies.</para>
        </listitem>
      </itemizedlist>
    </note>
  </chapter>
  <chapter id="DEV.eXoArchitecturePrimer">
    <title>eXo Architecture Primer </title>
    <para>With the aim of helping readers further understand about the eXo architecture, including Kernel, GateIn extensions and Java Content Repository via concepts, services, configuration, and more, this chapter is divided into 3 main sections with their sub-topics as follows:</para>
    <para>The <emphasis role="bold">
        <link linkend="DEV.eXoArchitecturePremer.Kernel">Kernel</link>
      </emphasis> part presents the following main contents:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.Containers">Containers</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.Services">Services</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.ServiceConfiguration">Service configuration</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.Plugins">Plugins</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="ADM.eXoArchitecturePremer.ConfigureLoadingSequence">Configuration loading sequence</link>
        </para>
      </listitem>
    </itemizedlist>
    <para>The <emphasis role="bold">
        <link linkend="DEV.eXoArchitecturePremer.GateInExtensions">GateIn extensions</link>
      </emphasis> part includes contents of the followings:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.defaultPortalContainer">Default Portal Container</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.RegisterExtension">Register Extension</link>
        </para>
      </listitem>
    </itemizedlist>
    <para>The <emphasis role="bold">
        <link linkend="DEV.eXoArchitecturePremer.JavaContentRepository">Java Content Repository</link>
      </emphasis> part shows you the following main contents:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.Repositories&amp;Workspaces">Repositories and workspaces</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoArchitecturePremer.WorkingWithNodes&amp;Properties">Tree structure: working with nodes and properties</link>
        </para>
      </listitem>
    </itemizedlist>
    <section id="DEV.eXoArchitecturePremer.Kernel">
      <title>Kernel </title>
      <para>All eXo Platform services are built around the eXo Kernel, or the service management layer, which manages the configuration and the execution of all components. The main kernel object is the eXo Container, a micro-container that glues services together through the dependency injection. The container is responsible for loading services/components.</para>
      <para>This part introduces concepts of Container and Services with an overview before configuring basic services.</para>
      <section id="DEV.eXoArchitecturePremer.Containers">
        <title>Containers </title>
        <para>A container is always required to access a service, because the eXo Kernel relies on the dependency injection. This means that the lifecycle of a service (for example, instantiating, opening and closing streams, disposing) is handled by a dependency provider, such as the eXo Container, rather than the consumer. The consumer only needs a reference to an implementation of the requested service. The implementation is configured in an <emphasis role="bold">.xml</emphasis> configuration file that comes with every service. To learn more about the dependency injection, visit <ulink url="http://en.wikipedia.org/wiki/Dependency_injection">here</ulink>.</para>
        <para>eXo Platform provides two types of containers: RootContainer and PortalContainer.</para>
        <para>The RootContainer holds the low level components. It is automatically started before the PortalContainer. You will rarely interact directly with the RootContainer except when you activate your own extension. The PortalContainer is created for each portal (one or several portals). All services started by this container will run as embedded in the portal. It also gives access to components of its parent RootContainer.</para>
        <para>In your code, if you need to invoke a service of a container, you can use the ExoContainerContext helper from any location. The code below shows you a utility method that you can use to invoke any eXo Platform service.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
public class ExoUtils {
  /**
  * Get a service from the portal container
  * @param type : component type
  * @return the concrete instance retrieved in the container using the type as key
  */
  public <T>T getService(Class<T> type) {
    return (T)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(type);
  }
}
]]></programlisting>
        </programlistingco>
        <para>Then, invoking becomes as easy as:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
OrganizationService orgService = ExoUtils.getService(OrganizationService.class)
]]></programlisting>
        </programlistingco>
      </section>
      <section id="DEV.eXoArchitecturePremer.Services">
        <title>Services </title>
        <para>Containers are used to gain access to services. The followings are important characteristics of services:</para>
        <itemizedlist>
          <listitem>
            <para>Because of the Dependency Injection concept, the interface and implementation for a service are usually separate.</para>
          </listitem>
          <listitem>
            <para>Each service has to be implemented as a singleton, which means it is created only once per portal container in a single instance.</para>
          </listitem>
          <listitem>
            <para>A component equals a service. A service must not be a large application. A service can be a little component that reads or transforms a document where the term "component" is often used instead of service.</para>
          </listitem>
        </itemizedlist>
        <para>For example, in the lib/folder, you can find services for databases, caching, LDAP:</para>
        <itemizedlist>
          <listitem>
            <para>exo.core.component.database-x.y.z.jar</para>
          </listitem>
          <listitem>
            <para>exo.kernel.component.cache-x.y.z.jar</para>
          </listitem>
          <listitem>
            <para>exo.core.component.organization.ldap-x.y.z.jar</para>
          </listitem>
        </itemizedlist>
      </section>
      <section id="DEV.eXoArchitecturePremer.ServiceConfiguration">
        <title>Service configuration </title>
        <para>To declare a service, you must add the <emphasis role="bold">.xml</emphasis> configuration file to a specific place. This file can be in the jar file, in a webapp or in the external configuration directory. If you write a new component for the eXo Container, you should always provide a default configuration in your jar file. This default configuration must be in the /conf/portal/configuration.xml file in your jar.</para>
        <para>A configuration file can specify several services, so there can be several services in one jar file.</para>
        <section id="DEV.eXoArchitecturePremer.KernalXMLSchema">
          <title>Kernel XML Schema </title>
          <para>Containers configuration files must comply with the kernel configuration grammar. Thus, all configurations will contain an XSD declaration like this:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<configuration xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
</configuration>
]]></programlisting>
          </programlistingco>
          <para>The kernel_1_1.xsd file mentioned in the example above can be found inside <code>exo.kernel.container-x.y.z.jar!org/exoplatform/container/configuration/</code> along with other versions.</para>
        </section>
        <section id="DEV.eXoArchitecturePremer.Components">
          <title>Components </title>
          <para>The service registration within the container is done with the &lt;component&gt; element.</para>
          <para>For example, open the <emphasis role="italic">exo-ecms-core-services-x.y.z.jar</emphasis> file. Next, open the <emphasis role="italic">/conf/portal/configuration.xml</emphasis> file. You will see:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<component>
  <type>org.exoplatform.services.deployment.ContentInitializerService</type>
</component>
<component>
  <key>org.exoplatform.services.cms.CmsService</key>
  <type>org.exoplatform.services.cms.impl.CmsServiceImpl</type>
</component>	
]]></programlisting>
          </programlistingco>
          <para>Each component has a <emphasis role="italic">key</emphasis> which matches with the qualified Java interface name (<emphasis role="italic">org.exoplatform.services.cms.CmsService</emphasis>).</para>
          <para>The specific implementation class of the component (CmsServiceImpl) is defined in the &lt;type&gt; tag.</para>
          <para>If a service does not have a separate interface, the &lt;type&gt; will be used as the key in the container. This is the case of ContentInitializerService.</para>
        </section>
        <section id="DEV.eXoArchitecturePremer.Parameters">
          <title>Parameters </title>
          <para>You can provide initial parameters for your service by defining them in the configuration file. The followings are different parameters:</para>
          <itemizedlist>
            <listitem>
              <para>value-param</para>
            </listitem>
            <listitem>
              <para>properties-param</para>
            </listitem>
            <listitem>
              <para>object-param</para>
            </listitem>
            <listitem>
              <para>collection</para>
            </listitem>
            <listitem>
              <para>map</para>
            </listitem>
            <listitem>
              <para>native-array</para>
            </listitem>
          </itemizedlist>
          <section id="DEV.eXoArchitecturePremer.Value-param">
            <title>Value-param </title>
            <para>You can use the value-param to pass a single value to the service.</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<component>
  <key>org.exoplatform.services.resources.LocaleConfigService</key>
  <type>org.exoplatform.services.resources.impl.LocaleConfigServiceImpl</type>
  <init-params>
    <value-param>
      <name>locale.config.file</name>
      <value>war:/conf/common/locales-config.xml</value>
    </value-param>
  </init-params>
</component>
]]></programlisting>
            </programlistingco>
            <para>The LocaleConfigService service accesses the value of value-param in its constructor.</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="java"><![CDATA[
package org.exoplatform.services.resources.impl;
public class LocaleConfigServiceImpl implements LocaleConfigService {
  public LocaleConfigServiceImpl(InitParams params, ConfigurationManager cmanager) throws Exception {
    configs_ = new HashMap<String, LocaleConfig>(10);
    String confResource = params.getValueParam("locale.config.file").getValue();
    InputStream is = cmanager.getInputStream(confResource);
    parseConfiguration(is);
  }
}
]]></programlisting>
            </programlistingco>
          </section>
          <section id="DEV.eXoArchitecturePremer.Object-param">
            <title>Object-param </title>
            <para>For the object-param component, you can look at the LDAP service:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<component>
  <key>org.exoplatform.services.ldap.LDAPService</key>
  <type>org.exoplatform.services.ldap.impl.LDAPServiceImpl</type>
  <init-params>
    <object-param>
      <name>ldap.config</name>
      <description>Default ldap config</description>
      <object type="org.exoplatform.services.ldap.impl.LDAPConnectionConfig">
        <field name="providerURL"><string>ldaps://10.0.0.3:636</string></field>
        <field name="rootdn"><string>CN=Administrator,CN=Users,DC=exoplatform,DC=org</string></field>
        <field name="password"><string>exo</string></field>
        <field name="version"><string>3</string></field>
        <field name="minConnection"><int>5</int></field>
        <field name="maxConnection"><int>10</int></field>
        <field name="referralMode"><string>ignore</string></field>
        <field name="serverName"><string>active.directory</string></field>
      </object>
    </object-param>
  </init-params>
</component>
]]></programlisting>
            </programlistingco>
            <para>The object-param is used to create an object (which is actually a Java Bean) passed as a parameter to the service. This object-param is defined by a name, a description and exactly one object. The object tag defines the type of the object, while the field tags define parameters for that object.</para>
            <para>You can see how the service accesses the object in the code below:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="java"><![CDATA[
package org.exoplatform.services.ldap.impl;

public class LDAPServiceImpl implements LDAPService {
  // ...
  public LDAPServiceImpl(InitParams params) {
    LDAPConnectionConfig config = (LDAPConnectionConfig) params.getObjectParam("ldap.config").getObject();
    ...
  }
  // ...
}
]]></programlisting>
            </programlistingco>
            <para>The passed object is LDAPConnectionConfig, which is a classic Java Bean. It contains all fields defined in the configuration files and also the appropriate getters and setters (not listed here). You also can provide default values. The container creates a new instance of your Java Bean and calls all setters whose values are configured in the configuration file.</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="java"><![CDATA[
package org.exoplatform.services.ldap.impl;

public class LDAPConnectionConfig {
  private String providerURL = "ldap://127.0.0.1:389";
  private String rootdn;
  private String password;
  private String version;
  private String authenticationType = "simple";
  private String serverName = "default";
  private int minConnection;
  private int maxConnection;
  private String referralMode = "follow";
  // ...
}
]]></programlisting>
            </programlistingco>
          </section>
          <section id="DEV.eXoArchitecturePremer.RestOfParameterTypes">
            <title>Rest of parameter types </title>
            <para>Other possible parameter types are Collection, Map and Native Array. See the exhaustive reference in the Kernel reference guide.</para>
          </section>
        </section>
      </section>
      <section id="DEV.eXoArchitecturePremer.Plugins">
        <title>Plugins </title>
        <para>Some components may want to offer some extensibilities. For this, they use a plugin mechanism based on the injection method. To offer an extension point for plugins, a component needs to provide a public method that takes an instance of <emphasis role="italic">org.exoplatform.container.xml. ComponentPlugin</emphasis> as a parameter.</para>
        <para>Plugins enable you to provide the structured configuration outside the original declaration of the component. This is the main way to customize eXo Platform to your needs.</para>
        <para>You can have a look at the configuration of the TaxonomyPlugin of the TaxonomyService as below:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<external-component-plugins>
  <target-component>org.exoplatform.services.cms.taxonomy.TaxonomyService</target-component>
  <component-plugin>
    <name>predefinedTaxonomyPlugin</name>
    <set-method>addTaxonomyPlugin</set-method>
    <type>org.exoplatform.services.cms.taxonomy.impl.TaxonomyPlugin</type>
    <init-params><!-- ... --></init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
        </programlistingco>
        <para>The &lt;target-component&gt; defines components that host the extension point. The configuration is injected by the container using the method defined in &lt;set-method&gt; (addTaxonomyPlugin(). The method accepts exactly one argument of the <emphasis role="italic">org.exoplatform.services. cms.categories.impl.TaxonomyPlugin</emphasis> type.</para>
        <para>The content of &lt;init-params&gt; is interpreted by the TaxonomyPlugin object.</para>
      </section>
      <section id="ADM.eXoArchitecturePremer.ConfigureLoadingSequence">
        <title>Configuration loading sequence </title>
        <para>The Kernel startup follows a well-defined sequence to load configuration files. The objects are initialized in the container only after the whole loading sequence is done. Hence, by placing your configuration in the upper location of the sequence, you can override a component declaration by yourself. You will typically do this when you want to provide your own implementation of a component, or declare custom init-params.</para>
        <note>
          <para>The <emphasis role="italic">external-component-plugins</emphasis> declarations are additive, so it is NOT possible to override them.</para>
        </note>
        <para>The loading sequence involves loading successively configurations for the RootContainer then from the PortalContainers:</para>
        <itemizedlist>
          <listitem>
            <para>Services default RootContainer configurations from JAR files: <emphasis role="italic">/conf/configuration.xml</emphasis>.</para>
          </listitem>
          <listitem>
            <para>External RootContainer configuration will be found at <emphasis role="italic">$exo.conf.dir/configuration.xml</emphasis>.</para>
          </listitem>
          <listitem>
            <para>Services default PortalContainer configurations from JAR files: <emphasis role="italic">/conf/$PORTAL/configuration.xml</emphasis>.</para>
          </listitem>
          <listitem>
            <para>Web applications configurations from WAR files <emphasis role="italic">/WEB-INF/conf/configuration.xml</emphasis>.</para>
          </listitem>
          <listitem>
            <para>External configuration for services of the portal will be found at <emphasis role="italic">$exo.conf.dir/portal/$PORTAL/configuration.xml</emphasis>.</para>
          </listitem>
        </itemizedlist>
        <note>
          <itemizedlist>
            <listitem>
              <para>$exo.conf.dir is a system property that points to the external configuration file on the file system. It is passed to the JVM in the startup script like <emphasis role="italic">-Dexo.conf.dir=gatein</emphasis>.</para>
            </listitem>
            <listitem>
              <para>$PORTAL is the name of the portal container. By default, the name "portal" is unique.</para>
            </listitem>
          </itemizedlist>
        </note>
      </section>
    </section>
    <section id="DEV.eXoArchitecturePremer.GateInExtensions">
      <title>GateIn extensions </title>
      <para>GateIn extensions are special <emphasis role="bold">.war</emphasis> files that are recognized by eXo Platform and contribute to custom configurations to the PortalContainer. To create your own portal, you will have to create a GateIn extension.</para>
      <para>The extension mechanism makes possible to extend or even override portal resources in almost plug-and-play way. You simply add a <emphasis role="bold">.war</emphasis> archive with your custom resources to the war folder and edit the configuration of the PortalContainerConfig service. Customizing a portal does not involve unpacking and repacking the original portal <emphasis role="bold">.war</emphasis> archives. Instead, you need to create your own <emphasis role="bold">.war</emphasis> archive with your own configurations, and modify resources. The content of your custom <emphasis role="bold">.war</emphasis> archive overrides the resources in the original archives.</para>
      <para>The most elegant way to reuse configuration for different coexisting portals is by way of extension mechanism - by inheriting resources and configuration from existing web archives, and just adding extra resources to it, and overriding those that need to be changed by including modified copies.</para>
      <note>
        <para>Starter is a web application that has been added to create and start all the portals, such as portal containers, at the same time once all the other web applications have already been started. In fact, all other web applications can potentially defined several things at startup, such as skins, Javascripts, Google gadgets and configuration files. The loading order is important as we can define skins or configuration files or a Javascript again from a web application 1. This could depend on another Javascript from a web application 2. Thus, if the web application 2 is loaded after the web application 1, you will get errors in the merged Javascript file.</para>
      </note>
      <para>If you ship servlets or servlet filters as part of your portal extension, and if you need to access specific resources of portal at any time during processing of the servlet or filter request, you need to make sure that the <emphasis role="italic">servlet/filter</emphasis> is associated with the current container. The proper way to do that is to make your servlet extend the <emphasis role="italic">org.exoplatform.container.web.AbstractHttpServlet</emphasis> class. This will not only properly initialize the current PortalContainer for you, but  also  set  the  current  thread's  context  classloader  to  one  that  looks  for  resources in associated web applications in the order specified by Dependencies configuration (as explained in the Extension mechanism section).</para>
      <para>As similar to filters, make  sure that your filter class extends <emphasis role="italic">org.exoplatform.container.web.AbstractFilter</emphasis>. Both AbstractHttpServlet and AbstractFilter have the method getContainer(), which returns the current PortalContainer.</para>
      <section id="DEV.eXoArchitecturePremer.defaultPortalContainer">
        <title>Default Portal Container </title>
        <para>eXo Platform comes with a pre-configured PortalContainer named "portal". This portal container configuration ties the core and extended services stack. The default Portal Container is started from <emphasis role="italic">portal.war</emphasis> and naturally maps to the <emphasis role="italic">/portal</emphasis> URL.</para>
        <para>The GateIn extension mechanism lets you extend the portal context easily. This feature is fundamental as it shields you from any changes we may want to do in <emphasis role="italic">portal.war</emphasis>. You do not need to be afraid of upgrades anymore as your <emphasis role="italic">extension.war</emphasis> will be clearly separated from the <emphasis role="italic">portal.war</emphasis>.</para>
        <para>To achieve this extensibility, the PortalContainer activates two advanced features: </para>
        <itemizedlist>
          <listitem>
            <para>A unified classloader: any classpath resource, such as property files, will be accessible as if it was inside the <emphasis role="italic">portal.war</emphasis>.</para>
          </listitem>
        </itemizedlist>
        <note>
          <para>This is valid only for resources but not for Java classes.</para>
        </note>
        <itemizedlist>
          <listitem>
            <para>A unified servlet context: any web resource contained in your <emphasis role="italic">extension.war</emphasis> will be accessible from /portal/ uri.</para>
          </listitem>
        </itemizedlist>
        <para>The next part explains what to do to make a simple extension for "portal" container.</para>
      </section>
      <section id="DEV.eXoArchitecturePremer.RegisterExtension">
        <title>Register Extension </title>
        <para>The webapps are loaded in the order defined in the list of dependencies of the <emphasis role="italic">PortalContainerDefinition</emphasis>. You then need to deploy the <emphasis role="italic">starter.war</emphasis>; otherwise, the webapps will be loaded in the default application server's order', such as the loading order of the Application Server.</para>
        <para>If you need to customize your portal by adding a new extension and/or a new portal, you need to define the related <emphasis role="italic">PortalContainerDefinitions</emphasis> and to deploy the starter. Otherwise, you do not need to define any <emphasis role="italic">PortalContainerDefinition</emphasis> or deploy the starter.</para>
        <para>First, you need to tell eXo Platform to load <emphasis role="italic">WEB-INF/conf/configuration.xml</emphasis> of your extension, you need to declare it as a <emphasis role="italic">PortalContainerConfigOwner</emphasis>. Next, open the file <emphasis role="italic">WEB-INF/web.xml</emphasis> of your extension and add a listener:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<web-app>
  <display-name>my-portal</display-name>
    <listener>
      <listener-class>org.exoplatform.container.web.PortalContainerConfigOwner</listener-class>
    </listener>
  <!-- ... -->
</web-app>
]]></programlisting>
        </programlistingco>
        <para>You need to register your extension in the portal container. This is done by the <emphasis role="bold">.xml</emphasis> configuration file like this: </para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<external-component-plugins>
  <target-component>org.exoplatform.container.definition.PortalContainerConfig</target-component>
  <component-plugin>
    <name>Change PortalContainer Definitions</name>
    <set-method>registerChangePlugin</set-method>
    <type>org.exoplatform.container.definition.PortalContainerDefinitionChangePlugin</type>
    <init-params>
      <object-param>
        <name>change</name>
        <object type="org.exoplatform.container.definition.PortalContainerDefinitionChange$AddDependencies">
        <field name="dependencies">
          <collection type="java.util.ArrayList">
            <value>
              <string>my-portal</string>
            </value>
            <value>
              <string>my-portal-resources</string>
            </value>              
          </collection>
        </field>
        </object>
      </object-param> 
      <value-param>
        <name>apply.default</name>
        <value>true</value>
      </value-param>       
    </init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
        </programlistingco>
        <para>A <emphasis role="italic">PortalContainerDefinitionChangePlugin</emphasis> plugin is defined to the <emphasis role="italic">PortalContainerConfig</emphasis>. The plugin declares a list of dependencies that are webapps. The <emphasis role="italic">apply.default=true</emphasis> indicates that your extension is actually extending <emphasis role="italic">portal.war</emphasis>. You  need to package your extension into a <emphasis role="bold">.war</emphasis> file and put it to the tomcat webapps folder, then restart the server.</para>
        <para>In your portal, if you want to add your own property file to support localization for your keys, you can do as follows:</para>
        <itemizedlist>
          <listitem>
            <para>Put your property file into the <emphasis role="italic">/WEB-INF/classes/locale/portal</emphasis> folder of your extension project.</para>
          </listitem>
        </itemizedlist>
        <itemizedlist>
          <listitem>
            <para>Add an external plugin declaration to the <emphasis role="italic">.xml</emphasis> configuration file.   </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<external-component-plugins>
  <!-- The full qualified name of the ResourceBundleService -->
  <target-component>org.exoplatform.services.resources.ResourceBundleService</target-component>
  <component-plugin>
    <!-- The name of the plugin -->
    <name>Sample ResourceBundle Plugin</name>
    <!-- The name of the method to call on the ResourceBundleService in order to register the ResourceBundles -->
    <set-method>addResourceBundle</set-method>
    <!-- The full qualified name of the BaseResourceBundlePlugin -->
    <type>org.exoplatform.services.resources.impl.BaseResourceBundlePlugin</type>
    <init-params>
      <!--values-param>
        <name>classpath.resources</name>
        <description>The resources that start with the following package name should be load from file system</description>
        <value>locale.portlet</value>
      </values-param-->
      <values-param>
        <name>init.resources</name>
        <description>Store the following resources into the db for the first launch </description>
        <value>locale.portal.sample</value>
      </values-param>
      <values-param>
        <name>portal.resource.names</name>
        <description>The properties files of the portal , those file will be merged
        into one ResoruceBundle properties </description>
        <value>locale.portal.sample</value>
      </values-param>
    </init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
        </programlistingco>
      </section>
    </section>
    <section id="DEV.eXoArchitecturePremer.JavaContentRepository">
      <title>Java Content Repository </title>
      <para>All data of eXo Platform are stored in a Java Content Repository (JCR). JCR is the Java specification (<ulink url="http://jcp.org/aboutJava/communityprocess/final/jsr170/index.html">JSR-170</ulink> ) for a type of Object Database tailored to the storage, searching, and retrieval of hierarchical data. It is useful for the content management systems, which require storage of objects associated with metadata. The JCR also provides versioning, transactions, observations of changes in data, and import or export of data in XML. The data in JCR are stored hierarchically in a tree of nodes with associated properties.</para>
      <para>Also, the JCR is primarily used as an internal storage engine. Accordingly, eXo Content lets you manipulate JCR data directly in several places. </para>
      <section id="DEV.eXoArchitecturePremer.Repositories&amp;Workspaces">
        <title>Repositories and workspaces </title>
        <para>A content repository consists of one or more workspaces. Each workspace contains a tree of items.</para>
        <para>To access the repository's content from a service:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
import javax.jcr.Session;

import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
import org.exoplatform.services.wcm.utils.WCMCoreUtils;

// For example
RepositoryService repositoryService = WCMCoreUtils.getService(RepositoryService.class);
ManageableRepository manageableRepository = repositoryService.getRepository(repository);
SessionProvider sessionProvider = WCMCoreUtils.getSessionProvider();
Session session = sessionProvider.getSession(workspace, manageableRepository);
]]></programlisting>
        </programlistingco>
        <para>You can use the session object to retrieve your node content.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
String path = "/"; // put your node path here
Node node = (Node) session.getItem(path);
]]></programlisting>
        </programlistingco>
        <para>The javax.jcr.Repository object can be obtained via one of the following ways:</para>
        <itemizedlist>
          <listitem>
            <para>Using the eXo Container "native" mechanism. All Repositories are kept with a single RepositoryService component. So it can be obtained from eXo Container as below:</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
RepositoryService repositoryService = (RepositoryService) container.getComponentInstanceOfType(RepositoryService.class);
Repository repository = repositoryService.getRepository("repositoryName");
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>Using the eXo Container "native" mechanism with a thread local saved "current" repository (especially if you plan to use a single repository which covers more than 90% of usecases)</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
// set current repository at initial time
RepositoryService repositoryService = (RepositoryService) container.getComponentInstanceOfType(RepositoryService.class);
repositoryService.setCurrentRepositoryName("repositoryName");
....
// retrieve and use this  repository
Repository repository = repositoryService.getCurrentRepository();
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>Using JNDI as specified in JSR-170.</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
Context ctx = new InitialContext();
Repository repository =(Repository) ctx.lookup("repositoryName");
]]></programlisting>
        </programlistingco>
        <para>Next, you need to log in the server to get a Session object by either of two ways:</para>
        <itemizedlist>
          <listitem>
            <para>Creating a Credential object, for example:</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
Credentials credentials = new SimpleCredentials("exo", "exo".toCharArray());

Session jcrSession = repository.login(credentials, "production");
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>Logging in by using:</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
Session jcrSession = repository.login("production");
]]></programlisting>
        </programlistingco>
        <para>This way is only applied when you run an implementation of eXo Platform embedded in the portal.</para>
        <para>In embedded cases, the implementation will directly leverage the organization and security services that rely on LDAP or DB storage and JAAS login modules. Single-Sign-On products can now also be used as eXo Platform v.2 which supports them.</para>
        <para>
          <emphasis role="bold">JCR Session common considerations:</emphasis>
        </para>
        <itemizedlist>
          <listitem>
            <para>javax.jcr.Session is not a safe object of thread. So, you should never try to share it between threads.</para>
          </listitem>
          <listitem>
            <para>Do not use System session from the user-related code because a system session has unlimited rights. Call ManageableRepository.getSystemSession() from the process-related code only.</para>
          </listitem>
          <listitem>
            <para>Call Session.logout() explicitly to release resources assigned to the session.</para>
          </listitem>
          <listitem>
            <para>When designing your application, you should take care of the Session policy inside your application. Two strategies are possible: Stateless (Session per business request) and Stateful (Session per User) or some mixings.</para>
          </listitem>
        </itemizedlist>
      </section>
      <section id="DEV.eXoArchitecturePremer.WorkingWithNodes&amp;Properties">
        <title>Tree structure: working with nodes and properties </title>
        <para>Every node can only have one primary node type. The primary node type defines names, types and other characteristics of the properties and child nodes that a node is allowed (or required) to have. Every node has a special property called jcr:primaryType that records the name of its primary node type. A node may also have one or more mixin types. These are node type definitions that can mandate extra characteristics (for example, more child nodes, properties and their respective names and types).</para>
        <para>Data are stored in properties, which may hold simple values, such as numbers, strings or binary data of arbitrary length.</para>
        <para>The JCR API provides methods to define node types and node properties, create or delete nodes, and add or delete properties to an existing node.</para>
        <para>You can refer to Section 6.2.3. Node Read Methods in the JCR Specification document.</para>
      </section>
    </section>
  </chapter>
  <chapter id="DEV.CreatingYourOwnPortal">
    <title>Create Your Own Portal </title>
    <para>When working with eXo Platform, it is important not to modify the source code. This will ensure compatibility with future upgrades, and support will be simplified. To customize your portal, you need to create an extension project by providing your own artifacts as a set of wars/jars/ears.</para>
    <para>This chapter will show you how to create a portal via the following topics:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.CreateYourOwnPortal.CreateExtensionProject">Create your extension project</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.CreateYourOwnPortal.StructureOfPortalPages&amp;Menus">Structure of portal, pages and menus</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.CreateYourOwnPortal.AddOrRemoveLanguages">Add/remove languages</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.CreateYourOwnPortal.CreateCustomLookAndFeel">Create custom look and feel</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.CreateYourOwnPortal.StructureStylesheet">Structure stylesheet</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.CreateYourOwnPortal.ConfigureSkinInGatein">Configure skin in GateIn</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.CreateYourOwnPortal.ConfigureSkinInWCM">Configure skin in WCM</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.CreateYourOwnPortal.CreateAndApplyGloabalStylesheet">Create and apply Global stylesheet</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.CreateYourOwnPortal.CustomizeAdminbar">Customize Admin bar</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.CreateYourOwnPortal.AddJavaScriptToYourPortal">Add JavaScript to your portal</link>
        </para>
      </listitem>
    </itemizedlist>
    <section id="DEV.CreateYourOwnPortal.CreateExtensionProject">
      <title>Create your extension project </title>
      <para>A custom extension contains two mandatory items:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">extension webapp</emphasis> contains resources and kernel configurations.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">extension activator jar</emphasis> identifies your webapp as a dependency of the portal container.</para>
        </listitem>
      </itemizedlist>
      <para>To see the sample extension package, visit <ulink url="http://anonsvn.jboss.org/repos/gatein/portal/trunk/examples/extension/">here</ulink>.</para>
      <para>Once you have modified the sample extension to build your own portal, use the <emphasis role="italic">maven clean install</emphasis> command to create the archive files.</para>
      <para>
        <emphasis role="bold">To deploy your extension in Tomcat:</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Add the <emphasis role="italic">sample-ext.war</emphasis> file from the <emphasis role="italic">sample/extension/war/target</emphasis>/ to the <emphasis role="italic">tomcat/webapps</emphasis> directory.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Add the <emphasis role="italic">starter</emphasis> folder from <emphasis role="italic">starter/war/target</emphasis>/ to the <emphasis role="italic">tomcat/webapps</emphasis> directory.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Rename the <emphasis role="italic">starter</emphasis> directory (unzipped folder) to <emphasis role="italic">starter.war</emphasis>.</para>
      <note>
        <para>This will only work if the starter.war is the last .war file to be loaded, so you may need to rename it if your war files are loaded in the alphabetical order.</para>
      </note>
      <para>
        <emphasis role="bold">4.</emphasis> Add the .jar file named exo.portal.sample.extension.config-X.Y.Z.jar from <emphasis role="italic">sample/extension/config/target</emphasis>/ to the <emphasis role="italic">tomcat/lib</emphasis> directory.</para>
      <para>
        <emphasis role="bold">5.</emphasis> Add the .jar file named <emphasis role="italic">exo.portal.sample.extension.jar-X.Y.Z.jar</emphasis> from <emphasis role="italic">sample/extension/jar/target</emphasis>/ to the <emphasis role="italic">tomcat/lib</emphasis> directory.</para>
      <para>For the JBoss deployment with more details, refer to Reference Guide on <ulink url="http://platform.demo.exoplatform.org/docs/">here</ulink>.</para>
    </section>
    <section id="DEV.CreateYourOwnPortal.StructureOfPortalPages&amp;Menus">
      <title>Structure of portal, pages and menus </title>
      <para>You can create multiple pages within a single portal. Permissions can be defined to make them visible only to specific groups and/or users. This chapter describes how to define this structure.</para>
      <section id="DEV.CreateYourOwnPortal.PageLayout">
        <title>Page layout </title>
        <para>The configuration of "classic" portal can be found in the <emphasis role="italic">/src/main/webapp/WEB-INF/conf/sample-ext/portal/portal/classic</emphasis> directory of your extension webapp.</para>
        <para>
          <emphasis role="bold">Portal:</emphasis>
        </para>
        <para>The <emphasis role="italic">portal.xml</emphasis> file describes the layout and portlets common to all pages of the portal.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<portal-config xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0">
  <portal-name>classic</portal-name>
  <locale>en</locale>
  <access-permissions>Everyone</access-permissions>
  <edit-permission>*:/platform/administrators</edit-permission>
  <properties>
    <entry key="sessionAlive">onDemand</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>
        ...
      </portlet>
    </portlet-application>

    <portlet-application>
      <portlet>
        ...
      </portlet>
    </portlet-application>

    <page-body> </page-body>

    <portlet-application>
      <portlet>
        ...
      </portlet>
    </portlet-application>
  </portal-layout>
</portal-config>
]]></programlisting>
        </programlistingco>
        <para>As you can see, each portlet can be configured with a set of preferences, which will be further detailed in Chapter 6. The tag &lt;page-body&gt; &lt;/page-body&gt; is a placeholder for the different pages of your portal. When the user opens a new portal page, all portlets of the portal layout (portal.xml) are remained, whereas the content of &lt;page-body&gt; switches to the page opened by the user.</para>
        <para>
          <emphasis role="bold">Pages:</emphasis>
        </para>
        <para>The <emphasis role="italic">pages.xml</emphasis> file is used to describe the content of pages of your portal. In particular, pages of your portal will be inside the &lt;page-body&gt; tag of the <emphasis role="italic">portal.xml</emphasis> file above.</para>
        <para>This is the example of the <emphasis role="italic">pages.xml</emphasis> file of the classic portal.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<page>
  <name>homepage</name>
  <title>Home Page</title>
  <access-permissions>Everyone</access-permissions>
  <edit-permission>*:/platform/administrators</edit-permission>
  <container id="ClassicBody" template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
    <access-permissions>Everyone</access-permissions>
    <container id="ClassicLeft" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
      <access-permissions>Everyone</access-permissions>
      <portlet-application>
        <portlet>
          <application-ref>presentation</application-ref>
          <portlet-ref>SingleContentViewer</portlet-ref>
          <preferences>
            <preference>
              <name>repository</name>
              <value>repository</value>
              <read-only>false</read-only>
            </preference>
            ...
            <preference>
              <name>ShowTitle</name>
              <value>false</value>
              <read-only>false</read-only>
            </preference>
          </preferences>
        </portlet>
        <title>Introduce</title>
        <access-permissions>Everyone</access-permissions>
        <show-info-bar>false</show-info-bar>
        <show-application-state>false</show-application-state>
        <show-application-mode>false</show-application-mode>
      </portlet-application>
    </container>
  </container>
</page>
]]></programlisting>
        </programlistingco>
        <note>
          <para>See Chapter 6 to learn more about the portlet configuration within the <emphasis role="italic">pages.xml</emphasis> file.</para>
        </note>
        <para>
          <emphasis role="bold">Navigation:</emphasis>
        </para>
        <para>The <emphasis role="italic">navigation.xml</emphasis> is used to associate the links in your navigation with your portal pages. The navigation is a tree structure of "navigation nodes". Each navigation node points to one page (called the page node). The tree structure corresponds to a hierarchy of menus and sub-menus of a site.</para>
        <para>If the pattern #{} is used, the link label will be loaded from the portal resource bundle. To learn more, refer to <ulink url="http://platform.demo.exoplatform.org/docs/refguide/html/gatein/chap-Reference_Guide-Development.html#sect-Reference_Guide-Internationalization_Configuration">Internationalization Configuration</ulink>.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[

<node-navigation>
  <owner-type>portal</owner-type>
  <owner-id>classic</owner-id>
  <priority>1</priority>
  <page-nodes>
    <node>
      <uri>home</uri>
      <name>home</name>
      <label>#{portal.classic.home}</label>
      <page-reference>portal::classic::homepage</page-reference>
    </node>
    <node>
      <uri>webexplorer</uri>
      <name>webexplorer</name>
      <label>#{portal.classic.webexplorer}</label>
      <page-reference>portal::classic::webexplorer</page-reference>
    </node>
  </page-nodes>
</node-navigation>
]]></programlisting>
        </programlistingco>
        <para>This navigation tree is shown and reused in different portlets, such as sitemap, navigation or breadcrumbs. The breadcrumbs portlet renders the position of the current navigation node.</para>
        <note>
          <para>For the top nodes, the URI and the navigation node name must have the same value. For other nodes, the URI is composed like &lt;uri&gt;contentmanagement/fileexplorer&lt;/uri&gt; where 'contentmanagement' is the name of the parent node and 'fileexplorer' is the name of node (&lt;name&gt;fileexplorer&lt;/name&gt;).</para>
        </note>
      </section>
      <section id="DEV.CreateYourOwnPortal.VisibilityPages">
        <title>Visibility of pages </title>
        <para>When you configure the <emphasis role="italic">navigation.xml</emphasis> file, sometimes you need to set the visibility of page (node).</para>
        <para>To configure, simply put <emphasis role="italic">&lt;visibility&gt;type_of_visibility&lt;/visibility&gt;</emphasis> as a child of &lt;node&gt; tag.</para>
        <para>GateIn supports 4 types of page visibility, including:</para>
        <itemizedlist>
          <listitem>
            <para>DISPLAYED: The page will be displayed.</para>
          </listitem>
          <listitem>
            <para>HIDDEN: The page is not visible in the navigation but can be accessed directly with its URL.</para>
          </listitem>
          <listitem>
            <para>SYSTEM: It is a system page which is visible to superusers. In particular, only superusers can change or delete this system page. </para>
          </listitem>
          <listitem>
            <para>TEMPORAL: The page is displayed in related time range. When the visibility of TEMPORAL page is configured, the start and end date can be specified by using &lt;startpublicationdate&gt; and &lt;endpublicationdate&gt;. For example:</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<node>
  ...
  <visibility>TEMPORAL</visibility>
  <startpublicationdate>01/13/2011 12:46:38</startpublicationdate>
  <endpublicationdate>01/20/2011 18:46:42</endpublicationdate>
</node>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>To hide a page, use &lt;visibility&gt;HIDDEN&lt;/visibility&gt;:</para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<node-navigation xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_0 http://www.gatein.org/xml/ns/gatein_objects_1_0">
  <page-nodes>
    <node>
      <uri>sitemap</uri>
      <name>sitemap</name>
      <label>#{portal.classic.sitemap}</label>
      <visibility>HIDDEN</visibility>
      <page-reference>portal::classic::sitemap</page-reference>
    </node>
    ...
  </page-nodes>
</node-navigation>
]]></programlisting>
        </programlistingco>
      </section>
      <section id="DEV.CreateYourOwnPortal.PagesAccessPermission">
        <title>Page access permission </title>
        <para>You can easily restrict the access of selected pages and navigation nodes to certain groups and users. You just need to create <emphasis role="italic">pages.xml</emphasis> and <emphasis role="italic">navigation.xml</emphasis> files in folders named after the group and user to which you want to give permission:</para>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="italic">sample-ext/portal/group/group-name/your files</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="italic">sample-ext/portal/user/username/your files</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <para>As you know, the permission on a page has two types: access and edit. </para>
        <para>To configure them, edit the <emphasis role="italic">pages.xml</emphasis> file and put tags: &lt;access-permissions&gt; and &lt;edit-permission&gt;. Currently, eXo Platform supports several access permissions but only one edit permission. It means that you can configure to make many groups to have the access permission but you can only set one group for edit permission. </para>
        <para>For example:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<page>
  <name>newStaff</name>
  <title>New Staff</title>
  <access-permissions>manager:/organization/management/executive-board;member:/organization/management/executive-board</access-permissions>
  <edit-permission>manager:/organization/management/executive-board</edit-permission>
  ...
</page>
]]></programlisting>
        </programlistingco>
      </section>
    </section>
    <section id="DEV.CreateYourOwnPortal.AddOrRemoveLanguages">
      <title>Add/remove languages </title>
      <para>All languages are put in the <emphasis role="italic">myextension.war/WEB-INF/conf/common/locales-config.xml</emphasis> directory. Each language consists of information related to key, output-encoding, input-encoding, description and orientation. Different languages will be defined in corresponding <emphasis role="italic">resource bundle</emphasis> files with keys specified in the <emphasis role="italic">locale-config.xml</emphasis> file.</para>
      <para>All languages defined in the <emphasis role="italic">locale-config.xml</emphasis> file are listed in <emphasis role="bold">Interface Language Settings</emphasis>. </para>
      <section id="DEV.CreateYourOwnPortal.AddNewLanguages">
        <title>Add new languages </title>
        <para>To add a new language, you need to add the corresponding language node in the <emphasis role="italic">locale-config.xml</emphasis> file. Next, you must create a new <emphasis role="italic">resource bundle</emphasis> file containing the suffix name as key of the added node.</para>
        <para>For example, to add Italian, do as follows:</para>
        <para>
          <emphasis role="bold">1.</emphasis> Add the following node to the <emphasis role="italic">locale-config.xml</emphasis> file.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<locale-config>
  <locale>it</locale>
  <output-encoding>UTF-8</output-encoding>
  <input-encoding>UTF-8</input-encoding>
  <description>Default configuration for Italian locale</description>
</locale-config>
]]></programlisting>
        </programlistingco>
        <para>
          <emphasis role="bold">2.</emphasis> Create a new <emphasis role="italic">resource bundle</emphasis> as <emphasis role="bold">
            <emphasis role="italic">webui_it.properties</emphasis>
          </emphasis> in the <emphasis role="italic">myextension.war/WEB-INF/classes/locale/portal</emphasis> folder.</para>
        <note>
          <para>This step is necessary because the Resource Bundle Service of the portal will find keys and values in the <emphasis role="italic">resource bundle</emphasis> of each corresponding language. </para>
        </note>
        <para>
          <emphasis role="bold">3.</emphasis> Restart the server.</para>
        <para>To check if the added language takes effect, simply click the <emphasis role="bold">Change Language</emphasis> button on the top right corner of the portal. In the <emphasis role="bold">Interface Language Setting</emphasis> window, you will see Italian as shown:</para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/example_addItalian.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/example_addItalian.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
      </section>
      <section id="DEV.CreateYourOwnPortal.RemoveLanguages">
        <title>Remove languages </title>
        <para>To remove an existing language, you need to delete the relevant language node in the <emphasis role="italic">locale-config.xml</emphasis> file and all files containing the suffix name as the key of language.</para>
        <para>For example, to remove French, do as follows:</para>
        <para>
          <emphasis role="bold">1.</emphasis> Find and remove the following node from the <emphasis role="italic">locale-config.xml</emphasis> file.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<locale-config>
  <locale>fr</locale>
  <output-encoding>UTF-8</output-encoding>
  <input-encoding>UTF-8</input-encoding>
  <description>Default configuration for france locale</description>
</locale-config>
]]></programlisting>
        </programlistingco>
        <para>
          <emphasis role="bold">2.</emphasis> Continue removing all <emphasis role="italic">resource bundle</emphasis> files containing the suffix name as <emphasis role="bold">fr</emphasis> in all folders.</para>
        <note>
          <para>It is recommended this step should be done to delete unnecessary data in the application.</para>
        </note>
        <para>  <emphasis role="bold">3.</emphasis> Restart the server.</para>
        <para>To check if the French removal takes effect, simply click the <emphasis role="bold">Change Language</emphasis> button on the top right corner of the portal. In the <emphasis role="bold">Interface Language Setting</emphasis> window, French will not exist on the <emphasis role="bold">Interface Language Setting</emphasis> window any longer. </para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/example_removeFrench.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/example_removeFrench.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
      </section>
    </section>
    <section id="DEV.CreateYourOwnPortal.CreateCustomLookAndFeel">
      <title>Create custom look and feel </title>
      <section id="DEV.CreateYourOwnPortal.StructureStylesheet">
        <title>Structure stylesheet </title>
        <section id="DEV.CreateYourOwnPortal.PageSkinElemnets">
          <title>Page skin Elements </title>
          <para>The complete skinning of a page can be decomposed into three main parts:</para>
          <para>
            <emphasis role="bold">Portal skin</emphasis>
          </para>
          <para>The portal skin contains styles for the HTML tags (for example, div, th, td) and the portal UI (including the toolbar). This should include all UI components, except for window decorators and portlet specific styles.</para>
          <para>
            <emphasis role="bold">Window styles</emphasis>
          </para>
          <para>The CSS styles are associated with the portlet window decorators. The window decorators contain control buttons and borders surrounding each portlet. Individual portlets can have their own window decorators selected, or be rendered without one.</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata fileref="images/window_decoration.jpg" format="JPG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata fileref="images/window_decoration.jpg" format="JPG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>
            <emphasis role="bold">Portlet skins</emphasis>
          </para>
          <para>The portlet skins affect how portlets are rendered on the page. The portlet skins can affect in two main ways:</para>
          <section id="DEV.CreateYourOwnPortal.PortletSpecificationCSSClasses">
            <title>Portlet Specification CSS Classes </title>
            <para>The <ulink url="http://jcp.org/en/jsr/detail?id=286">portlet specification</ulink> defines a set of CSS classes that should be available to portlets. eXo Platform provides these classes as a part of the portal skin. This enables each portal skin to define its own look and feel for these default values.</para>
          </section>
          <section id="DEV.CreateYourOwnPortal.PortletSkins">
            <title>Portlet skins </title>
            <para>eXo Platform provides a means for portlet CSS files to be loaded that is based on the current portal skin. This enables a portlet to provide different CSS styles to better match the current portal's look and feel.</para>
            <note>
              <para>The window decorators and the default portlet specification CSS classes should be considered as separate types of skinning components, but they need to be included as a part of the overall portal skin. The portal skin must include CSS classes of these components or they will not be displayed correctly. A portlet skin does not need  to be  included as part of the portal skin and can be included within the portlets web application.</para>
            </note>
          </section>
        </section>
        <section id="DEV.CreateYourOwnPortal.BestPracticeToCustomizeSkin">
          <title>Best practices to customize a skin </title>
          <para>The skin folder structure must be prepared once you start the design. Follow these conventions and best practices to ease the integration of your design in eXo Platform.</para>
        </section>
        <section id="DEV.CreateYourOwnPortal.NameFiles&amp;Folder">
          <title>Name files and folders </title>
          <para>The id and class names are defined after the WebUI components name and portlets name with the 'UI-' as prefix. The same rule is applied for folder that contains components and portlets. It will help you find and edit correct files easily.  For example, the UI portlet will be named as UIFooterPortlet, or UIBannerPortlet and the UI component will be named as UIToolbarContainer, or UIVerticalTab.</para>
        </section>
        <section id="DEV.CreateYourOwnPortal.FolderStructure">
          <title>Folder structure </title>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Portal skin:</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <para>The portal skin will appear as a single link to a CSS file. This link will contain contents from all the portal skin classes merged into one file. This enables the portal skin to be transferred more quickly as a single file instead of many smaller files included with every page render.</para>
          <para>
            <emphasis role="bold">The general folder structure for portal skin:</emphasis>
          </para>
          <para>
            <code>/webapp/skin/NameOfPortalSkin/portal</code>
          </para>
          <para>For example: </para>
          <para>
            <code>/webapp/skin/DefaultSkin/portal</code>
          </para>
          <para>
            <emphasis role="bold">The main entry CSS file:</emphasis>
          </para>
          <para>The main entry CSS file should be placed right in the main portal skin folder. The file is the main entry point to the CSS class definitions for the skin: </para>
          <para>
            <code>/webapp/skin/NameOfPortalSkin/Stylesheet.css</code> </para>
          <para>For example: </para>
          <para>
            <code>/webapp/skin/SkinBlue/Stylesheet.css</code>
          </para>
          <para>
            <emphasis role="bold">The folder structure for WebUI components:</emphasis> </para>
          <para>
            <code>/webapp/skin/SkinBlue/webui/component/YourUIComponentName</code>
          </para>
          <para>For example:  </para>
          <para>
            <code>/webapp/skin/SkinBlue/webui/component/UIToolbarContainer</code>
          </para>
          <para>
            <emphasis role="bold">Window decorator CSS is put in:</emphasis>
          </para>
          <para>
            <code>webapp/skin/PortletThemes/Stylesheet.css</code>
          </para>
          <para>
            <emphasis role="bold">Where to put images for portal skin?</emphasis>
          </para>
          <para>The images for portal skin should be put in the background folder right in the Portal skin folder and for each UI component.</para>
          <para>For example:</para>
          <para> <code>/webapp/skin/SkinBlue/webui/component/UIProfileUser/SkinBlue/background</code>
          </para>
          <para>In summary, the folder structure for a new portal skin should be:</para>
          <para>webapp</para>
          <itemizedlist>
            <listitem>
              <para>skin</para>
              <itemizedlist>
                <listitem>
                  <para>NameOfPortalSkin</para>
                  <itemizedlist>
                    <listitem>
                      <para>stylesheet.css</para>
                    </listitem>
                    <listitem>
                      <para>webui </para>
                      <itemizedlist>
                        <listitem>
                          <para>component</para>
                          <itemizedlist>
                            <listitem>
                              <para>UIComponentName</para>
                              <itemizedlist>
                                <listitem>
                                  <para>NameOfPortalSkin.css</para>
                                </listitem>
                                <listitem>
                                  <para>NameOfPortalSkin</para>
                                  <itemizedlist>
                                    <listitem>
                                      <para>background</para>
                                    </listitem>
                                  </itemizedlist>
                                </listitem>
                              </itemizedlist>
                            </listitem>
                          </itemizedlist>
                        </listitem>
                      </itemizedlist>
                    </listitem>
                  </itemizedlist>
                </listitem>
              </itemizedlist>
            </listitem>
          </itemizedlist>
          <para>For example:</para>
          <para>webapp</para>
          <itemizedlist>
            <listitem>
              <para>skin</para>
              <itemizedlist>
                <listitem>
                  <para>DefaultSkin</para>
                  <itemizedlist>
                    <listitem>
                      <para>stylesheet.css</para>
                    </listitem>
                    <listitem>
                      <para>webui</para>
                      <itemizedlist>
                        <listitem>
                          <para>UISpaceSearch</para>
                          <itemizedlist>
                            <listitem>
                              <para>DefaultSkin.css</para>
                            </listitem>
                            <listitem>
                              <para>DefaultSkin</para>
                              <itemizedlist>
                                <listitem>
                                  <para>background</para>
                                </listitem>
                              </itemizedlist>
                            </listitem>
                          </itemizedlist>
                        </listitem>
                      </itemizedlist>
                    </listitem>
                  </itemizedlist>
                </listitem>
              </itemizedlist>
            </listitem>
          </itemizedlist>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Portlet skin:</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <para>Each portlet on a page may contribute its own style. The link to the portlet skin will only appear on the page if that portlet is loaded on the current page. A page may contain many portlet skin CSS links or none. The link ID will be named like {portletAppName}{PortletName}. For example,  ContentPortlet in <emphasis role="italic">content.war</emphasis> will have the <emphasis role="italic">id="contentContentPortlet"</emphasis>.</para>
          <para>
            <emphasis role="bold">General folder structure for portlet skin:</emphasis> <emphasis role="italic">/webapp/skin/portlet/webui/component/YourUIPortletName</emphasis>
          </para>
          <para>and for the Groovy skin: <emphasis role="italic">/webapp/groovy/portlet/webui/component/YourUIPortletName</emphasis>/</para>
          <para>For example:  </para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">/webapp/skin/portlet/webui/component/UIBannerPortlet</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">/webapp/groovy/portlet/webui/component/UIBannerPortlet</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="bold">Portlet images folder:</emphasis> <emphasis role="italic">/webapp/skin/portlet/YourUIPortletName/PortalSkinName/background</emphasis>
          </para>
          <para>For example: </para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">/webapp/skin/portlet/UIBannerPortlet/BlueSkin/background</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="bold">Portlet themes</emphasis>
          </para>
          <para>Main entry CSS:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">/webapp/skin/PortletThemes/Stylesheet.css</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">/webapp/skin/PortletThemes/background</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">/webapp/skin/PortletThemes/icons</emphasis>
              </para>
            </listitem>
          </itemizedlist>
        </section>
      </section>
      <section id="DEV.CreateYourOwnPortal.ConfigureSkinInGatein">
        <title>Configure skin in GateIn </title>
        <para>GateIn provides support for skinning the entire User Interface (UI) of portal, including all common portal elements, custom skins and window decorator for individual portlets. Skins are designed to help you pack and reuse common graphic resources.</para>
        <section id="DEV.CreateYourOwnPortal.SelectSkinWithinConfigurationFiles">
          <title>Select skins within the configuration files </title>
          <para>The default skin can be set in the portal configuration files. The skin configured as default is used by GateIn as the administrator starts/restarts the server. To change the default skin, add a skin tag to the <emphasis role="italic">portal.war/WEB-INF/conf/portal/portal/classic/portal.xml</emphasis> configuration file. To change the skin to MySkin, do as follows:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<portal-config>
  <portal-name>classic</portal-name>
  <locale>en</locale>
  <access-permissions>Everyone</access-permissions>
  <edit-permission>*:/platform/administrators</edit-permission>
  <skin>MySkin</skin>
  ...
</portal-config>
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.CreateYourOwnPortal.SkinsInThePageMarkup">
          <title>Skins in the page markup </title>
          <para>The GateIn 3.2 skin not only contains CSS styles for the portal's components, but also shares components that may be reused in portlets. When GateIn 3.2 generates the page markup of portal, it inserts stylesheet links in the page's head tag. There are two main types of CSS links which appear in the head tag: one to the portal skin CSS file and the other to the portlet skin CSS file.</para>
          <orderedlist>
            <listitem>
              <para>
                <emphasis role="bold">Portal Skin</emphasis> appears as a single link to a CSS file. This link contains contents from all portal skin classes merged into one file. The portal skin will be transferred more quickly as a single file instead of multiple smaller files. </para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">Portlet Skin</emphasis> only appears as the link on the page if that portlet is loaded on the current page. A page may contain many CSS links of portlet skins or none.</para>
            </listitem>
          </orderedlist>
          <para>In the code fragment below, you can see two types of links:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
<head>
  ...
  <!-- The portal skin -->
  <link id="CoreSkin" rel="stylesheet" type="text/css" href="/eXoResources/skin/Stylesheet.css" />
  <!-- The portlet skins -->
  <link id="web_FooterPortlet" rel="stylesheet" type="text/css"
    href="/web/skin/portal/webui/
component/UIFooterPortlet/DefaultStylesheet.css" />
  <link id="web_NavigationPortlet" rel="stylesheet" type="text/css"
    href="/web/skin/portal/webui/
component/UINavigationPortlet/DefaultStylesheet.css" />
  <link id="web_HomePagePortlet" rel="stylesheet" type="text/css"
    href="/portal/templates/skin/
webui/component/UIHomePagePortlet/DefaultStylesheet.css" />
  <link id="web_BannerPortlet" rel="stylesheet" type="text/css"
    href="/web/skin/portal/webui/
component/UIBannerPortlet/DefaultStylesheet.css" />
  ...
</head>
]]></programlisting>
          </programlistingco>
          <note>
            <para>Window styles and portlet specification CSS classes are included within the portal skin.</para>
          </note>
        </section>
        <section id="DEV.CreateYourOwnPortal.SkinService">
          <title>SkinService </title>
          <para>SkinService in GateIn 3.2 is to manage various types of skins. It is used to discover and deploy skins into the portal.</para>
          <section id="DEV.CreateYourOwnPortal.ConfigureSkins">
            <title>Configure skins </title>
            <para>GateIn 3.2 automatically discovers web archives that contain a file descriptor for skins (WEB-INF/gatein-resources.xml). This file is to specify which portal, portlet and window decorators will be deployed into the skin service. The full schema can be found in the lib directory: <emphasis role="italic">exo.portal.component.portal.jar/gatein_resources_1_0.xsd</emphasis>. Here is an example where a skin (MySkin) with its CSS location is defined, and a few window decorator skins are specified:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<gatein-resources>
  <portal-skin>
    <skin-name>MySkin</skin-name>
    <css-path>/skin/myskin.css</css-path>
    <overwrite>false</overwrite>
  </portal-skin>

  <!-- window style -->
  <window-style>
    <style-name>MyThemeCategory</style-name>
    <style-theme>
      <theme-name>MyThemeBlue</theme-name>
    </style-theme>
    <style-theme>
      <theme-name>MyThemeRed</theme-name>
    </style-theme>
  </window-style>
</gatein-resources>
]]></programlisting>
            </programlistingco>
          </section>
          <section id="DEV.CreateYourOwnPortal.ResourceRequestFilter">
            <title>ResourceRequestFilter </title>
            <para>With the Right-To-Left support, you need to retrieve all CSS files through a Servlet filter and to configure the web application to activate this filter. This has been already done for the eXoResources.war web application which contains the default skin. Any new web applications containing skinning CSS files need to have the following added to their web.xml:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<filter>
  <filter-name>ResourceRequestFilter</filter-name>
  <filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>ResourceRequestFilter</filter-name>
  <url-pattern>*.css</url-pattern>
</filter-mapping>
]]></programlisting>
            </programlistingco>
            <note>
              <para>The configuration of Portlet Skin takes an optional parameter application-name, which is the web application wrapping skinned portlet. Hence, the display-name element in web.xml needs to be coherent with the application-name in the gatein-resources.xml file.</para>
            </note>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<portlet-skin>
  <!-- the application-name must be identical to display-name of the web application wrapping HomePagePortlet portlet -->
  <application-name>web</application-name>
  <portlet-name>HomePagePortlet</portlet-name>
  <skin-name>Default</skin-name>
  <css-path>/templates/skin/webui/component/UIHomePagePortlet/DefaultStylesheet.css</css-path>
</portlet-skin>
]]></programlisting>
            </programlistingco>
          </section>
        </section>
        <section id="DEV.CreateYourOwnPortal.DefaultSkin">
          <title>Default skin </title>
          <para>The default skin of GateIn 3.2 is located as part of the eXoResource.war. The main files associated with the skin include:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">WEB-INF/gatein-resources.xml</emphasis>: defines the skin settings to use.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="italic">WEB-INF/web.xml</emphasis>: contains the resource filter with the display-name set.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="italic">skin/Stylesheet.css</emphasis>: contains the CSS class definitions for this skin.</para>
            </listitem>
          </itemizedlist>
          <para>The following block of CSS illustrates content of the <emphasis role="italic">Stylesheet.css</emphasis> file:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
@import url(DefaultSkin/portal/webui/component/UIPortalApplicationSkin.css); (1)
@import url(DefaultSkin/webui/component/Stylesheet.css); (2)
@import url(PortletThemes/Stylesheet.css); (3)
@import url(Portlet/Stylesheet.css); (4)
]]></programlisting>
          </programlistingco>
          <para>In which:</para>
          <itemizedlist>
            <listitem>
              <para>(1) Skin of portal page. UIPortalApplicationSkin.css defines CSS classes shared by all the portal pages.</para>
            </listitem>
            <listitem>
              <para>(2) Skins of various portal-owned components, such as WorkingWorkspace, MaskWorkspace, PortalForm, and more.</para>
            </listitem>
            <listitem>
              <para>(3) Window decorator skins.</para>
            </listitem>
            <listitem>
              <para>(4) The portlet specification CSS classes. (The CSS styles defined in Portlet Specification JSR286)</para>
            </listitem>
          </itemizedlist>
          <para>To make a default skin flexible and highly reusable, instead of defining all CSS classes in this file, CSS classes are arranged in nested stylesheet files, based on the @import statement. This makes easier for new skins to reuse parts of the default skin.  To reuse a CSS stylesheet from the default portal skin, you need to refer to the default skin from eXoResources. For example, to include the window decorators from the default skin within a new portal skin, you need to use the following import:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
@import url(/eXoResources/skin/Portlet/Stylesheet.css);
]]></programlisting>
          </programlistingco>
          <note>
            <para>When the portal skin is added to the page, it merges all CSS stylesheets into a single file.</para>
          </note>
        </section>
        <section id="DEV.CreateYourOwnPortal.CreateNewSkins">
          <title>Create new skins </title>
          <section id="DEV.CreateYourOwnPortal.CreateNewPortalSkins">
            <title>Create new portal skins </title>
            <section id="DEV.CreateYourOwnPortal.ConfigurePortalSkins">
              <title>Configure portal skins </title>
              <para>You need to specify the new portal skin in the <emphasis role="italic">gatein-resources.xml</emphasis> file. You also need to specify the name of new skin, where to locate its CSS stylesheet file and whether to overwrite the existing portal theme with the same name.</para>
              <programlistingco>
                <areaspec units="linecolumn"/>
                <programlisting language="xml"><![CDATA[
<gatein-resources>
  <portal-skin>
    <skin-name>MySkin</skin-name>
    <css-path>/skin/myskin.css</css-path>
    <overwrite>false</overwrite>
  </portal-skin>
</gatein-resources>
]]></programlisting>
              </programlistingco>
              <para>The default portal skin and window styles are defined in the <emphasis role="italic">eXoResources.war/WEB-INF/gatein-resources.xml</emphasis> file.</para>
              <note>
                <para>The CSS for the portal skin needs to contain CSS for all window decorators and portlet specification CSS classes.</para>
              </note>
            </section>
            <section id="DEV.CreateYourOwnPortal.PortalSkinPreviewIcon">
              <title>Portal skin preview icon </title>
              <para>You can preview the appearance of portal skin when selecting it. To display the preview image of deployed skins, the current skin must be aware of all those icons. Hence, each skin must contain preview images of all other skins.</para>
              <para>For any portal skin, the paths to preview images are specified in CSS class UIChangeSkinForm: </para>
              <itemizedlist>
                <listitem>
                  <para>
                    <emphasis role="italic">eXoResources/src/main/webapp/skin/DefaultSkin/portal/webui/component/customization/UIChangeSkinForm/Stylesheet.css</emphasis>
                  </para>
                </listitem>
              </itemizedlist>
              <para>For the portal named MySkin, it is required to define the following CSS classes:</para>
              <programlistingco>
                <areaspec units="linecolumn"/>
                <programlisting><![CDATA[
.UIChangeSkinForm .UIItemSelector .TemplateContainer .MySkinImage
]]></programlisting>
              </programlistingco>
              <para>The default skin would be aware of skin icons if the preview screenshot is placed in: </para>
              <itemizedlist>
                <listitem>
                  <para>
                    <emphasis role="italic">eXoResources.war:/skin/DefaultSkin/portal/webui/component/customization/UIChangeSkinForm/background</emphasis>.</para>
                </listitem>
              </itemizedlist>
              <para>The CSS stylesheet for the default portal needs to have the following updated with the preview icon CSS class.  For the skin named MySkin, it is required to update the following:</para>
              <itemizedlist>
                <listitem>
                  <para>
                    <emphasis role="italic">eXoResources.war:/skin/DefaultSkin/portal/webui/component/customization/UIChangeSkinForm/Stylesheet.css</emphasis>.</para>
                </listitem>
              </itemizedlist>
              <para>For now, amending the deployed package eXoResources is inevitable (modifying the default war/jar breaches development convention of GateIn-based products). The problem would be resolved in future GateIn versions in which different skin modules are fully independent, for example, there will be no preview image duplication.</para>
              <programlistingco>
                <areaspec units="linecolumn"/>
                <programlisting><![CDATA[
.UIChangeSkinForm .UIItemSelector .TemplateContainer .MySkinImage {
margin: auto;
width: 329px; height:204px;
background: url('background/MySkin.jpg') no-repeat top;
cursor: pointer ;
}
]]></programlisting>
              </programlistingco>
            </section>
          </section>
          <section id="DEV.CreateYourOwnPortal.CreateNewWindowStyles">
            <title>Create new window styles </title>
            <para>Window style is the CSS applied to the window decorator. When the administrator selects a new application to add to a page, he can decide which style of decorator surrounding the window if any.</para>
            <section id="DEV.CreateYourOwnPortal.ConfigureWindowStyles">
              <title>Configure window styles </title>
              <para>Window style is defined within the <emphasis role="italic">gatein-resources.xml</emphasis> file used by the SkinService to deploy the window style into the portal. Window styles can belong to a window style category. This category and window styles need to be specified in the resources file. The following <emphasis role="italic">gatein-resource.xml</emphasis> fragment will add MyThemeBlue and MyThemeRed to the MyTheme category.</para>
              <programlistingco>
                <areaspec units="linecolumn"/>
                <programlisting language="xml"><![CDATA[
<window-style>
  <style-name>MyTheme</style-name>
  <style-theme>
    <theme-name>MyThemeBlue</theme-name>
  </style-theme>
  <style-theme>
    <theme-name>MyThemeRed</theme-name>
  </style-theme>
</window-style>
]]></programlisting>
              </programlistingco>
              <para>The windows style of the default skin is configured in the <emphasis role="italic">eXoResources.war/WEB-INF/gatein-resources.xml</emphasis> file.</para>
              <note>
                <para>When a window style is defined in the <emphasis role="italic">gatein-resources.xml</emphasis> file, it will be available to all portlets regardless of whether the current portal skin supports the window decorator or not. When a new window decorator is added, it should be added to all portal skins or the portal skins should share a common stylesheet for window decorators.</para>
              </note>
            </section>
            <section id="DEV.CreateYourOwnPortal.WindowStyleCSS">
              <title>Window style CSS </title>
              <para>In order for the SkinService to display the window decorators, it must have CSS classes with the specific naming related to the window style name. The service will try and display CSS based on this naming. The CSS class must be included as part of the current portal skin for the window decorators to be displayed. The window decorator CSS classes for the default portal theme are located at <emphasis role="italic">eXoResources.war/skin/PortletThemes/Stylesheet.css</emphasis>.</para>
            </section>
            <section id="DEV.CreateYourOwnPortal.SetDefaultWindowStyle">
              <title>Set the default window style </title>
              <para>To set the default window style for a portal, you need to specify the CSS classes for a theme called DefaultTheme.</para>
              <note>
                <para>You do not need to specify the DefaultTheme in the <emphasis role="italic">gatein-resources.xml</emphasis> file.</para>
              </note>
            </section>
          </section>
          <section id="DEV.CreateYourOwnPortal.CreateNewPortletSkins">
            <title>Create new portlet skins </title>
            <para>Portlets often require additional styles that may not be defined by the portal skin. GateIn 3.2 defines additional stylesheets for each portlet and will append the corresponding link tags to the head. The ID attribute of &lt;link&gt; element will be in the <emphasis role="italic">portletAppName/PortletName</emphasis> form.  For example, the ContentPortlet in content.war takes "content/ContentPortlet" as ID. To define a new CSS file to be included whenever a portlet is available on a portal page, the following fragment needs to be added in the <emphasis role="italic">gatein-resources.xml</emphasis> file.</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<portlet-skin>
  <application-name>portletAppName</application-name>
  <portlet-name>PortletName</portlet-name>
  <skin-name>Default</skin-name>
  <css-path>/skin/DefaultStylesheet.css</css-path>
</portlet-skin>
<portlet-skin>
  <application-name>portletAppName</application-name>
  <portlet-name>PortletName</portlet-name>
  <skin-name>OtherSkin</skin-name>
  <css-path>/skin/OtherSkinStylesheet.css</css-path>
</portlet-skin>
]]></programlisting>
            </programlistingco>
            <para>This action will load DefaultStylesheet.css or OtherSkinStylesheet.css when the DefaultSkin or OtherSkin is used respectively.</para>
            <note>
              <para>If the current portal skin is not defined as part of the supported skins, the portlet CSS class will not be loaded. The portlet skins should be updated whenever a new portal skin is created.</para>
            </note>
          </section>
          <section id="DEV.CreateYourOwnPortal.ChangePortletIcons">
            <title>Change portlet icons </title>
            <para>Each portlet can be represented by an unique icon that you can see in the portlet registry or page editor. This icon can be changed by adding an image to the directory of portlet web application: <emphasis role="italic">skin/DefaultSkin/portletIcons/icon_name.png</emphasis>. The icon must be named after the portlet. For example, the icon of account portlet must be named AccountPortlet and located at: <emphasis role="italic">skin/DefaultSkin/portletIcons/AccountPortlet.png</emphasis>.</para>
            <note>
              <para>You must use <emphasis role="italic">skin/DefaultSkin/portletIcons/</emphasis> for the directory to store the portlet icon regardless of using any skins.</para>
            </note>
          </section>
          <section id="DEV.CreateYourOwnPortal.ConfigureRightToLeftSkins">
            <title>Configure right-to-left skins </title>
            <para>The SkinService handles stylesheet rewriting to accommodate the orientation. It works by appending <emphasis role="italic">-lt</emphasis> or <emphasis role="italic">-rt</emphasis> to the stylesheet name. For example, <emphasis role="italic">/web/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet-rt.css</emphasis> will return the same stylesheet as <emphasis role="italic">/web/skin/portal/webui/component/UIFooterPortlet/DefaultStylesheet.css</emphasis> but processed for the RT orientation. The <emphasis role="italic">-lt</emphasis> suffix is optional. Stylesheet authors can annotate their stylesheet to create content that depends on the orientation.</para>
            <para>Example 1. This example uses the orientation to modify the float attribute that will make the horizontal tabs either float on left or on right:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
float: left; /* orientation=lt */
float: right; /* orientation=rt */
font-weight: bold;
text-align: center;
white-space: nowrap;
]]></programlisting>
            </programlistingco>
            <para>The LT produced output will be:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
float: left; /* orientation=lt */
font-weight: bold;
text-align: center;
white-space: nowrap;
]]></programlisting>
            </programlistingco>
            <para>The RT produced output will be:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
float: right; /* orientation=rt */
font-weight: bold;
text-align: center;
white-space: nowrap;
]]></programlisting>
            </programlistingco>
            <para>Example 2. In this example, you need to modify the padding based on the orientation:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
color: white;
line-height: 24px;
padding: 0px 5px 0px 0px; /* orientation=lt */
padding: 0px 0px 0px 5px; /* orientation=rt */
]]></programlisting>
            </programlistingco>
            <para>The LT produced output will be:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
color: white;
line-height: 24px;
padding: 0px 5px 0px 0px; /* orientation=lt */
]]></programlisting>
            </programlistingco>
            <para>The RT produced output will be:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
color: white;
line-height: 24px;
padding: 0px 0px 0px 5px; /* orientation=rt */
]]></programlisting>
            </programlistingco>
          </section>
        </section>
        <section id="DEV.CreateYourOwnPortal.OverrideSkinsWithExtension">
          <title>Override skins with extension </title>
          <para>The extension mechanism of GateIn 3.2 enables the skin definition to be replaced with the skin resource configured in the extension-deployed web application. This is the example where the CSS path of default portal skin needs to be modified without touching the GateIn's files.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<gatein-resources>
  <portal-skin>
    <skin-name>MySkin</skin-name>
    <css-path>/skin/myskin.css</css-path>
    <overwrite>false</overwrite>
  </portal-skin>
</gatein-resources>
]]></programlisting>
          </programlistingco>
          <para>Do as follows:</para>
          <para>
            <emphasis role="bold">1.</emphasis> Create a web application whose <emphasis role="italic">gatein-resources.xml</emphasis> contains the same content as the above xml block, except the element &lt;css-path&gt; is modified.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Register the artifact in the dependencies list of extended Portal Container.</para>
          <para>
            <emphasis role="bold">3.</emphasis> Ensure that once the server has deployed the artifact, it does not load any web application with <emphasis role="italic">gatein-resources.xml</emphasis> configuring the same portal skin.</para>
          <para>By the time those lines are written out, the control of loading order required in the third step relies totally on the Web Container Integration (WCI), hence the conflict may occur. That would be resolved by the concept of portal skin priority introduced in the coming version of GateIn.</para>
        </section>
      </section>
      <section id="DEV.CreateYourOwnPortal.ConfigureSkinInWCM">
        <title>Configure skin in WCM </title>
        <section id="DEV.CreateYourOwnPortal.Goal">
          <title>Goal </title>
          <para>This tutorial will help you to create a new layout and skin, and give some best practices you should know and respect when creating a new layout and skin for your portal and page.</para>
        </section>
        <section id="DEV.CreateYourOwnPortal.Assumptions">
          <title>Assumptions </title>
          <itemizedlist>
            <listitem>
              <para>You have an extension named "MyPortal", and you need to create a site called "MySite" inside this portal.</para>
            </listitem>
            <listitem>
              <para>The <emphasis role="italic">&lt;myportal_path&gt;</emphasis> below is replaced by the based path of your "MyPortal" extension.</para>
            </listitem>
            <listitem>
              <para>If you see any folder/file which does not exist, you should create a new one.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section id="DEV.CreateYourOwnPortal.CustomizePortalLayout">
          <title>Customize portal's layout </title>
          <note>
            <para>This section is related to the configuration. You can see a sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/ecmdemo/webapp/src/main/webapp/WEB-INF/conf/sample-portal/portal/portal/acme/portal.xml">here.</ulink> You can leave all the portlet's preferences as blank, that means the default value will be taken and you do not need to care about it at this time.</para>
          </note>
          <itemizedlist>
            <listitem>
              <para>For example, you will have a layout like this:</para>
            </listitem>
          </itemizedlist>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/samplelayout.jpg" format="JPG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/samplelayout.jpg" format="JPG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>In which:</para>
          <itemizedlist>
            <listitem>
              <para>Branding: A branding application</para>
            </listitem>
            <listitem>
              <para>Top navigation: A top navigation application</para>
            </listitem>
          </itemizedlist>
          <para>A table column container with three nested containers:</para>
          <itemizedlist>
            <listitem>
              <para>Left Column and Right Column: contain one application for each.</para>
            </listitem>
            <listitem>
              <para>Main content: contains the page body.</para>
            </listitem>
          </itemizedlist>
          <para>And here is the "short version" of <emphasis role="italic">portal.xml</emphasis>.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/portal/portal/mysite/portal.xml</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<!-- ... -->

<portlet-application>
  <!-- Branding application. You can use WCM web content *exo:webContent* for the content and SCV portlet to display -->
</portlet-application>

<portlet-application>
  <!-- navigation application. You can use WCM web content *exo:webContent* for the content and SCV portlet to display -->
</portlet-application>

<container id="MySite" template="system:/groovy/portal/webui/container/UITableColumnContainer.gtmpl">
  <container id="LeftColumn" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
    <!-- One or more application(s) here -->
    <portlet-application>
    </portlet-application>
  </container>

  <container template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
    <page-body>
    </page-body>
  </container>

  <container id="RightColumn" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
    <!-- One or more application(s) here -->
    <portlet-application>
    </portlet-application>
  </container>
</container>

<portlet-application>
  <!-- Footer application. You can use WCM web content *exo:webContent* for the content and SCV portlet to display -->
</portlet-application>

<!-- ... -->
]]></programlisting>
          </programlistingco>
          <para>As you see in the <emphasis role="italic">portal.xml</emphasis> file above, every <emphasis role="bold">container</emphasis> tag has an <emphasis role="bold">id</emphasis> attribute, for example "&lt;container id = '<emphasis role="bold">RightColumn</emphasis>'&gt;". When you create a CSS file, the property applied for this container should have the following name manner:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
${container_id}TDContainer
]]></programlisting>
          </programlistingco>
          <para>and the details of this container: </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
RightColumnTDContainer
]]></programlisting>
          </programlistingco>
          <para>The reason is, when you have a look in the file system: <emphasis role="italic">/groovy/portal/webui/container/UITableColumnContainer.gtmpl</emphasis> shown above, you will see this code fragment:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
<table class="UITableColumnContainer"
  style="table-layout: fixed; margin: 0px auto;">
  <tr class="TRContainer">
    <% for(uiChild in uicomponent.getChildren()) {%>
    <td class="${uiChild.id}TDContainer TDContainer"><%
      uicomponent.renderUIComponent(uiChild) %></td> <% } %>
  </tr>
</table>
]]></programlisting>
          </programlistingco>
          <para>So, in the <emphasis role="bold">table</emphasis> element (which represents the outer container), there are many <emphasis role="bold">td</emphasis> elements, each of which has the <emphasis role="bold">class</emphasis> attribute that equals to the <emphasis role="bold">id</emphasis> of the corresponding child component plus the "TDContainer" string literal.</para>
          <para>To learn more, see <link linkend="customize-portal-and-page-style">Customize portal and page's style</link>.</para>
        </section>
        <section id="DEV.CreateYourOwnPortal.CustomizePageLayout">
          <title>Customize page's layouts </title>
          <note>
            <para>This section is related to the configuration. You can see a sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/ecmdemo/webapp/src/main/webapp/WEB-INF/conf/sample-portal/portal/portal/acme/pages.xml">here.</ulink> You can leave all the portlet's preferences as blank, that means the default value will be taken and you do not need to care about it at this time.</para>
          </note>
          <itemizedlist>
            <listitem>
              <para>Like <emphasis role="italic">portal.xml</emphasis>, you can define the layout for each page in your site as shown in the following example:</para>
            </listitem>
          </itemizedlist>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata fileref="sample_page.jpg" format="JPG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata fileref="sample_page.jpg" format="JPG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<!-- ... -->

<portlet-application> <!-- A custom document for content and SCV portlet to display -->
</portlet-application>

<portlet-application> <!-- A CLV portlet with a custom template. -->
</portlet-application>

<portlet-application> <!-- A CLV portlet with another custom template. -->
</portlet-application>

<!-- ... -->
]]></programlisting>
          </programlistingco>
        </section>
        <section id="customize-portal-and-page-style">
          <title>Customize portal and page's style </title>
          <para>If you want your skin to be applied for every page, do as follows:</para>
          <para>
            <emphasis role="bold">1.</emphasis> Go to <emphasis role="bold">Sites Explorer &gt;</emphasis> <emphasis role="bold">Shared</emphasis> drive <emphasis role="bold">&gt; CSS</emphasis> folder.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Create a new CSS document which contains your stylesheet. You can use any name for this document and put a priority number.</para>
          <para>If you want your skin to be applied for your <emphasis role="bold">MySite</emphasis> page only, do as follows:</para>
          <para>
            <emphasis role="bold">1.</emphasis> Open the browser <emphasis role="bold">&gt; Sites Explorer</emphasis> portlet <emphasis role="bold">&gt; Sites management</emphasis> drive <emphasis role="bold">&gt; MySite/css</emphasis> folder.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Create a new CSS document which contains your stylesheet for the portal and the page layout. You can use any name for this document and put a priority number.</para>
          <warning>
            <para>This document should contain <emphasis role="bold">ONLY</emphasis> one stylesheet for the page and portal level.</para>
          </warning>
          <para>The following is one sample stylesheet:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
/* ... */
.LeftColumnTDContainer { 
/* ... */
  
}

.RightColumnTDContainer { 
/* ... */
  
}

/* ... */
]]></programlisting>
          </programlistingco>
          <note>
            <para>The order of applying CSS files (of site and web content) depends on their own <emphasis role="bold">priority</emphasis> property value. It means that we can apply the site CSS first and then web content CSS, or vice versa.</para>
          </note>
        </section>
        <section id="DEV.CreateYourOwnPortal.CustomizeCLVPortletTemplate">
          <title>Customize CLV portlet's template </title>
          <note>
            <para>This section is related to the configuration. You can see a sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/wcm/webapp/src/main/webapp/WEB-INF/conf/wcm-artifacts/application-templates/content-list-viewer/list-by-folder/TwoColumnsCLVTemplate.gtmpl">here.</ulink>
            </para>
          </note>
          <itemizedlist>
            <listitem>
              <para>Apply your HTML/Groovy template code for this template. </para>
            </listitem>
          </itemizedlist>
          <para>For example: <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/template/list/ACustomizedCLVTemplate.gtmpl</emphasis>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
<div id="$uicomponent.id" class="ACustomizedCLVTemplate">
  <div class="ListContents">
    <!-- something here -->
  </div>
</div>
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>Now, you need to import this template to the database.</para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/template/configuration.xml</emphasis>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<external-component-plugins>
  <target-component>org.exoplatform.services.cms.views.ApplicationTemplateManagerService</target-component>
  <component-plugin>
    <name>ACustomizedCLVTemplate</name>
    <set-method>addPlugin</set-method>
    <type>org.exoplatform.services.cms.views.PortletTemplatePlugin</type>
    <description>This is a sample customized CLV template</description>
    <init-params>
      <value-param>
        <name>portletName</name>
        <value>Content List Viewer</value>
      </value-param>
      <value-param>
        <name>portlet.template.path</name>
        <value>war:/conf/myportal/customized/template</value>
      </value-param>
      <object-param>
        <name>default.folder.list.viewer</name>
        <description>Default folder list viewer groovy template</description>
        <object type="org.exoplatform.services.cms.views.PortletTemplatePlugin$PortletTemplateConfig">
          <field name="templateName">
            <string>ACustomizedCLVTemplate.gtmpl</string>
          </field>
          <field name="category">
            <string>list</string>
          </field>
        </object>
      </object-param>
    </init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.CreateYourOwnPortal.CustomizeCLVTemplateStyle">
          <title>Customize CLV template's style </title>
          <para>To customize the CLV template's style, do as follows:</para>
          <para>
            <emphasis role="bold">1.</emphasis> Go to <emphasis role="bold">Sites explorer</emphasis> portlet <emphasis role="bold">&gt; Sites management</emphasis> drive <emphasis role="bold">&gt; MySite/css</emphasis> folder.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Create a new CSS document which contains your stylesheet for the portal and the page layout. You can use any name for this document and put a priority number.</para>
          <warning>
            <para>This document should contain <emphasis role="bold">ONLY</emphasis> the stylesheet for <emphasis role="bold">THIS</emphasis> template. If you have another template, you should create a new CSS document.</para>
          </warning>
          <itemizedlist>
            <listitem>
              <para>The following is one sample stylesheet:</para>
            </listitem>
          </itemizedlist>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
/* ... */
.ACustomizedCLVTemplate { 
/* ... */
  
}

.ListContents { 
/* ... */
  
}

/* ... */
]]></programlisting>
          </programlistingco>
          <para>
            <emphasis role="bold">3.</emphasis> Export the document and now you have an XML file.</para>
          <para>Please check out <ulink url="http://wiki.exoplatform.com/xwiki/bin/view/WCM/How+to+create+and+deploy+pre-defined+contents+in+WCM">this tutorial</ulink> to know how to import this XML into database.</para>
        </section>
        <section id="DEV.CreateYourOwnPortal.CustomizeDocuemntSkin">
          <title>Customize Document's skin </title>
          <note>
            <para>This section is related to the configuration. You can see a sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/wcm/webapp/src/main/webapp/WEB-INF/conf/wcm-extension/wcm/nodetypes-configuration.xml">here.</ulink>
            </para>
          </note>
          <para>First, you need to create a new document definition.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/document/ACustomizedDocument.xml</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <para> </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
	node type name :exo:customizedDocument
	properties: exo:name(type : String), exo:title(type : String), exo:content(type : String)
]]></programlisting>
          </programlistingco>
          <para>You also need to configure it to make sure it is imported to the database.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/document/definition-configuration.xml</emphasis>
              </para>
            </listitem>
          </itemizedlist>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[ 
<external-component-plugins>
  <target-component>org.exoplatform.services.jcr.RepositoryService</target-component>
  <component-plugin>
    <name>ACustomizedDocument</name>
    <set-method>addPlugin</set-method>
    <type>org.exoplatform.services.jcr.impl.AddNodeTypePlugin</type>
    <priority>200</priority>
    <init-params>
      <values-param>
        <name>autoCreatedInNewRepository</name>
        <description>ACustomizedDocument document definition</description>
        <value>war:/conf/myportal/customized/document/ACustomizedDocument.xml</value>
      </values-param>
    </init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
          </programlistingco>
          <para>Next, create the templates for this document, including:</para>
          <itemizedlist>
            <listitem>
              <para>Dialog: see the sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/wcm/webapp/src/main/webapp/WEB-INF/conf/dms-extension/dms/artifacts/templates/article/dialogs/dialog1.gtmpl">here</ulink>
              </para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/document/dialog.gtmpl</emphasis>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
<div class="UIForm ACustomizedDocument">
  <% uiform.begin() %>
  <!-- Document dialog content is here -->
  <% uiform.end() %>
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>View: see the sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/wcm/webapp/src/main/webapp/WEB-INF/conf/dms-extension/dms/artifacts/templates/article/views/view1.gtmpl">here</ulink>
              </para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/document/view.gtmpl</emphasis>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
<style>
  <% _ctx.include(uicomponent.getTemplateSkin("exo:customizedDocument", "Stylesheet")); %>
</style>
<!-- Document view template content is here -->
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>Stylesheet: see the sample <ulink url="http://svn.exoplatform.org:3840/projects/ecms/tags/2.1.0-GA/packaging/wcm/webapp/src/main/webapp/WEB-INF/conf/dms-extension/dms/artifacts/templates/article/skins/Stylesheet-lt.css">here</ulink>
              </para>
            </listitem>
          </itemizedlist>
          <warning>
            <para>This document should contain <emphasis role="bold">ONLY</emphasis> the stylesheet for <emphasis role="bold">THIS</emphasis> template.</para>
          </warning>
          <para>
            <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/document/stylesheet.css</emphasis>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
/* ... */

.ACustomizedDocument {
  /* ... */
}

/* ... */
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>You also need to import them to database.</para>
            </listitem>
          </itemizedlist>
          <para>
            <emphasis role="italic">&lt;myportal_path&gt;/src/main/webapp/WEB-INF/conf/myportal/customized/document/template-configuration.xml</emphasis>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<external-component-plugins>
  <target-component>org.exoplatform.services.cms.templates.TemplateService</target-component>
  <component-plugin>
    <name>addTemplates</name>
    <set-method>addTemplates</set-method>
    <type>org.exoplatform.services.cms.templates.impl.TemplatePlugin</type>
    <init-params>
      <value-param>
        <name>autoCreateInNewRepository</name>
        <value>true</value>
      </value-param>
      <value-param>
        <name>storedLocation</name>
        <value>war:/conf/myportal/customized/document</value>
      </value-param>
      <value-param>
        <name>repository</name>
        <value>repository</value>
      </value-param>
      <object-param>
        <name>template.configuration</name>
        <description>configuration for the localtion of nodetypes templates to inject in jcr</description>
        <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig">
          <field name="nodeTypes">
            <collection type="java.util.ArrayList">
              <value>
                <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType">
                  <field name="nodetypeName">
                    <string>exo:customizedDocument</string>
                  </field>
                  <field name="documentTemplate">
                    <boolean>true</boolean>
                  </field>
                  <field name="label">
                    <string>Customized Document</string>
                  </field>
                  <field name="referencedView">
                    <collection type="java.util.ArrayList">
                      <value>
                        <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                          <field name="templateFile">
                            <string>view.gtmpl</string>
                          </field>
                          <field name="roles">
                            <string>*</string>
                          </field>
                        </object>
                      </value>
                    </collection>
                  </field>
                  <field name="referencedDialog">
                    <collection type="java.util.ArrayList">
                      <value>
                        <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                          <field name="templateFile">
                            <string>dialog.gtmpl</string>
                          </field>
                          <field name="roles">
                            <string>webdesigner:/platform/web-contributors</string>
                          </field>
                        </object>
                      </value>
                    </collection>
                  </field>
                  <field name="referencedSkin">
                    <collection type="java.util.ArrayList">
                      <value>
                        <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                          <field name="templateFile">
                            <string>stylesheet.css</string>
                          </field>
                          <field name="roles">
                            <string>*</string>
                          </field>
                        </object>
                      </value>
                    </collection>
                  </field>
                </object>
              </value>
            </collection>
          </field>
        </object>
      </object-param>
    </init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
          </programlistingco>
          <para>Finally, you should create some initial contents and export them to XML files.</para>
          <para>To import this XML into database, you can set up the deployment like this:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<external-component-plugins>
  <target-component>org.exoplatform.services.wcm.deployment.WCMContentInitializerService</target-component>
  <component-plugin>
    <name>Content Initializer Service</name>
    <set-method>addPlugin</set-method>
    <type>org.exoplatform.services.wcm.deployment.plugins.XMLDeploymentPlugin</type>
    <description>XML Deployment Plugin</description>
    <init-params>
      <object-param>
        <name>ACME Logo data</name>
        <description>Deployment Descriptor</description>
        <object type="org.exoplatform.services.deployment.DeploymentDescriptor">
          <field name="target">
            <object type="org.exoplatform.services.deployment.DeploymentDescriptor$Target">
              <field name="repository">
                <string>repository</string>
              </field>
              <field name="workspace">
                <string>collaboration</string>
              </field>
              <field name="nodePath">
                <string>/sites content/live/acme/web contents/site artifacts</string>
              </field>
            </object>
          </field>
          <field name="sourcePath">
            <string>war:/conf/wcm/artifacts/site-resources/acme/Logo.xml</string>
          </field>
        </object>
      </object-param>
    </init-params>
  </component-plugin>
</external-component-plugins>
]]></programlisting>
          </programlistingco>
        </section>
      </section>
      <section id="DEV.CreateYourOwnPortal.CreateAndApplyGloabalStylesheet">
        <title>Create and apply Global stylesheet </title>
        <para>Global stylesheet is the shared stylesheet which is applied to your entire site or a set of pages, depending on your configuration. When you want to make changes on your site, you only need to create a new global stylesheet, or edit the existing global stylesheet.</para>
        <para>Global stylesheets of eXo Platform are put into the CSS folder to manage the stylesheet of your desired site. This section aims at showing you how to create and apply your own global stylesheet by <emphasis role="bold">Content Explorer</emphasis> and by configuration. </para>
        <section id="DEV.CreateYourOwnPortal.CreateAndApplyGlobalStylesheetByContentExplorer">
          <title>Create and apply the global stylesheet by Content Explorer </title>
          <para>
            <emphasis role="bold">1.</emphasis> Select <emphasis role="bold">My Spaces &gt; Content Explorer &gt; Sites Management</emphasis>.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Select one site node in the <emphasis role="bold">Sites Management</emphasis> pane, for example <emphasis role="bold">acme</emphasis>, and then select the CSS folder.</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/CreateNewGlobalStylesheet.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/CreateNewGlobalStylesheet.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>
            <emphasis role="bold">3.</emphasis> Click <emphasis role="bold">Add Document</emphasis> to open the form to create the new global stylesheet.</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/CreateGlobalStylesheetForm.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/CreateGlobalStylesheetForm.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>
            <emphasis role="bold">4.</emphasis> Enter the name of global stylesheet into the <emphasis role="bold">Name</emphasis> field, for example <emphasis role="bold">GlobalStylesheet_Organge</emphasis>.</para>
          <para>
            <emphasis role="bold">5.</emphasis> Set the value as "True" to activate your global stylesheet for your site in the <emphasis role="bold">Active</emphasis> field. By default, "True" will be set when you create a new global stylesheet. If you select "False", your newly created global style will be disabled.</para>
          <para>
            <emphasis role="bold">6.</emphasis> Input one positive integer into the <emphasis role="bold">Priority</emphasis> field, for example "10".</para>
          <note>
            <para>The successful application of your newly created global stylesheet depends on values in both <emphasis role="bold">Active</emphasis> and <emphasis role="bold">Priority</emphasis> fields. If "True" is set in many global stylesheets, the system will automatically render all global stylesheets in the CSS folder in the descending order and get the stylesheet with the highest priority. Thus, after selecting "True", you need to pay attention to the priority level so that the selected priority of your stylesheet is higher than those of other global stylesheets in the CSS folder. </para>
            <para>The default global stylesheet will be automatically created in the CSS folder when you create a new site. However, this global stylesheet can be overwritten by either setting "False" for its <emphasis role="bold">Active</emphasis> field or setting the higher priority for other global stylesheet than that of the default global stylesheet.</para>
          </note>
          <para>
            <emphasis role="bold">7.</emphasis> Define your styles in the <emphasis role="bold">CSS data</emphasis> field. Here, you can directly enter your CSS rules, or copy and paste them from your favorite text editor.</para>
          <para>For example, you can define your styles with the following information:</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/cssdata.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/cssdata.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>
            <emphasis role="bold">8.</emphasis> Click the <emphasis role="bold">Save as Draft</emphasis> button to save your newly created global stylesheet. You will see your global stylesheet in the <emphasis role="bold">Sites Management</emphasis> pane.</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/GlobalStylesheet_org.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/GlobalStylesheet_org.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject> </para>
          <itemizedlist>
            <listitem>
              <para>To edit your global stylesheet or predefined global stylesheets, simply select the corresponding file and click <emphasis role="bold">Edit Document</emphasis> on the action bar to open the <emphasis role="bold">Edit</emphasis> form. To rename the document, right-click the corresponding global stylesheets in the <emphasis role="bold">Sites Management</emphasis> pane, then select <emphasis role="bold">Rename</emphasis>.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section id="DEV.CreateYourOwnPortal.CreateAndApplyGlobalStylesheetByConfiguration">
          <title>Create and apply the global stylesheet by configuration </title>
          <para>After being created as above, your desired global stylesheet can be initialized automatically when the application is started by doing as follows:</para>
          <para>
            <emphasis role="bold">1.</emphasis> Open the CSS folder.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Select <emphasis role="bold">System</emphasis> and click <emphasis role="bold">Export Node</emphasis> on the action bar.</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/ExportImportGlobalStylesheet.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/ExportImportGlobalStylesheet.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>
            <emphasis role="bold">3.</emphasis> Copy and paste the file you have exported, for example <emphasis role="bold">StylesheetOrange.xml</emphasis>, into the folder containing all stylesheets for your site, such as "/acme-website/WEB-INF/conf/acme-portal/wcm/artifacts/site-resources/acme/".</para>
          <para>
            <emphasis role="bold">4.</emphasis> Add the code below to the file where all global stylesheets will be initialized for your site, such as <emphasis role="bold">acme-deployment-configuration.xml</emphasis> in the folder "/acme-website/WEB-INF/conf/acme-portal/wcm/deployment/".</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<object-param>
  <name>ACME Stylesheet Green data</name>
  <description>Deployment Descriptor</description>
  <object type="org.exoplatform.services.deployment.DeploymentDescriptor">
    <field name="target">
      <object type="org.exoplatform.services.deployment.DeploymentDescriptor$Target">
        <field name="repository">
          <string>repository</string>
        </field>
        <field name="workspace">
          <string>collaboration</string>
        </field>
        <field name="nodePath">
          <string>/sites content/live/acme/css</string>
        </field>
      </object>
    </field>
    <field name="sourcePath">
      <string>war:/conf/acme-portal/wcm/artifacts/site-resources/acme/StylesheetOrange.xml</string>
    </field>
    <field name="cleanupPublication">
      <boolean>true</boolean>
    </field>
  </object>
</object-param>
]]></programlisting>
          </programlistingco>
          <para>
            <emphasis role="bold">5.</emphasis> Save the file where you have added the code in <emphasis role="bold">Step 4</emphasis> and clean data created in the previous start-up.</para>
          <para>
            <emphasis role="bold">6.</emphasis> Start eXo Platform. After accessing the Content Explorer page, you will find your global stylesheet in the CSS folder of the relevant site.</para>
        </section>
        <section id="DEV.CreateYourOwnPortal.CheckDisplayOfGlobalStylesheet">
          <title>Check display of global stylesheets </title>
          <para>You can have several global stylesheets in one site. To see differences when applying various global stylesheets, for example <emphasis role="bold">GlobalStylesheet_Blue</emphasis> and <emphasis role="bold">GlobalStylesheet_Orange</emphasis>, do as follows:</para>
          <para>
            <emphasis role="bold">1.</emphasis> Activate the <emphasis role="bold">GlobalStylesheet_Blue</emphasis> and <emphasis role="bold">GlobalStylesheet_Orange</emphasis> by turns.</para>
          <para>
            <emphasis role="bold">2.</emphasis> Click <emphasis role="bold">My Spaces</emphasis> on the administration bar and select the relevant site, for example "acme".</para>
          <para>If you activate <emphasis role="bold">GlobalStylesheet_Blue</emphasis>, your site will be displayed as below:</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/DisplayGlobalStyleBlue.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/DisplayGlobalStyleBlue.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>If you activate <emphasis role="bold">GlobalStylesheet_Orange</emphasis>, your site will be displayed in such a different way: </para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/DisplayGlobalStyleOrange.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/DisplayGlobalStyleOrange.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
        </section>
      </section>
      <section id="DEV.CreateYourOwnPortal.CustomizeAdminbar">
        <title>How to customize the Admin bar </title>
        <section id="DEV.CreateYourOwnPortal.ChangeColorScheme">
          <title>Change the color scheme </title>
          <para>The current color of Admin bar is dark blue and yellow. However, you can change the color to match your brand colors.</para>
          <para>The Admin bar looks like this:</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/admin_bar.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/admin_bar.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>The style of Admin bar is defined in the <emphasis role="bold">stylesheet.css</emphasis> located in src/main/webapp/skin/officeSkin/UIToolbarContainer.</para>
          <para>The CSS code below shows how to modify the Admin bar to look like this:</para>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/modified_admin_bar.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/modified_admin_bar.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
/*toolbar background color*/
.UIWorkingWorkspace .UIToolbarContainer .NormalContainerBlock .ToolbarContainer
  {
  background: #20263f;
  height: 31px;
  border: none;
}

/*toolbar text color*/
.UIWorkingWorkspace .UIToolbarContainer .ToolbarContainer a.TBIcon {
  color: white;
  font-weight: normal;
  padding: 0 12px;
  display: block;
  white-space: nowrap;
  background: none;
  margin-left: 0;
  zoom: 1;
}
/*toolbar text color when hover*/
.UIWorkingWorkspace .UIToolbarContainer .ToolbarContainer a:hover {
  color: #8F8F8F;
}

/*background color of drop-down menu*/
.UIWorkingWorkspace .UIToolbarContainer .UITab .MenuItemContainer {
  border: 1px solid transparent;
  background: #20263f;
  margin-top: 0;
}

/*background color and border color of drop-down menu*/
UIWorkingWorkspace .UIToolbarContainer .UITab .MenuItem {
  border-top: 1px solid #414760;
  border-bottom: none;
  background: #20263f;
  opacity: 1;
  height: 28px;
  line-height: 28px;
  text-align: left;
}

/*text color of menu items*/
.UIWorkingWorkspace .UIToolbarContainer .ToolbarContainer .UITab .MenuItemContainer .MenuItem a
  {
  padding: 0 24px 0 35px; /* orientation=lt */
  padding: 0 35px 0 24px; /* orientation=rt */
  font-family: "Lucida Sans";
  font-size: 12px;
  color: white;
  display: block;
  font-weight: normal;
  white-space: nowrap;
}

/*text color of menu items when hover*/
.UIWorkingWorkspace .UIToolbarContainer .ToolbarContainer .UITab .MenuItemContainer .MenuItem a:hover
  {
  color: #92918f;
  background-color: transparent;
}

/*color of title bar text and background in drop-down menu*/
.UIWorkingWorkspace .UIToolbarContainer .TitleBar {
  color: #20263f;
  background: #92a9b9;
  font-weight: bold;
  padding: 0px 5px;
}
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.CreateYourOwnPortal.ChangeAdminbarContent">
          <title>Change the content of the Admin bar </title>
          <para>
            <inlinemediaobject>
              <imageobject role="fo">
                <imagedata align="center" fileref="images/admin_bar_portlets.png" format="PNG"/>
              </imageobject>
              <imageobject role="html">
                <imagedata align="center" fileref="images/admin_bar_portlets.png" format="PNG"/>
              </imageobject>
            </inlinemediaobject>
          </para>
          <para>
            <emphasis role="bold">Portlets on Admin bar</emphasis> </para>
          <para>The Admin bar is a special container composed of portlets. It is defined in <emphasis role="italic">WEB-INF/conf/portal/portal/sharedlayout.xml</emphasis>. In the illustration above, each circle represents a portlet defined in the Admin bar and configured in <emphasis role="bold">sharedlayout.xml</emphasis>.</para>
          <para>It is possible to override the whole Admin bar by adding it into an extension at <emphasis role="italic">custom-extension.war!WEB-INF/conf/portal/portal/sharedlayout.xml</emphasis>.</para>
          <para>The <emphasis role="italic">sharedlayout.xml</emphasis> file configures the current displayed portlets on the Admin bar. For example, to remove the dashboard menu, you will need to remove the following block:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
...
<container id="UserToolBarDashboardPortlet" template="system:/groovy/portal/webui/container/UIContainer.gtmpl">
  <portlet-application>
    <portlet>
      <application-ref>exoadmin</application-ref>
      <portlet-ref>UserToolbarDashboardPortlet</portlet-ref>
    </portlet>
    <access-permissions>Everyone</access-permissions>
    <show-info-bar>false</show-info-bar>
  </portlet-application>
</container>
...
]]></programlisting>
          </programlistingco>
        </section>
      </section>
    </section>
    <section id="DEV.CreateYourOwnPortal.AddJavaScriptToYourPortal">
      <title>Add JavaScript to your portal </title>
      <para>This can be done entirely within your extension by customizing the <emphasis role="italic">gatein-resources.xml</emphasis> configuration.</para>
      <para>To add a JavaScript library, for example jQuery, create the <emphasis role="italic">war:/WEB-INF/gatein-resources.xml_ file.</emphasis>
      </para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting language="xml"><![CDATA[
<javascript>
  <param>
    <js-module>jQuery</js-module>
    <js-path>/javascript/jQuery.js</js-path>
    <js-priority>0</js-priority>
  </param>
</javascript>
]]></programlisting>
      </programlistingco>
      <para>In which:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="italic">&lt;js-module&gt;</emphasis> is the namespace of your JavaScript.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="italic">&lt;js-path&gt;</emphasis> is the path to your JavaScript file.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="italic">&lt;js-priority&gt;</emphasis> is an optional tag. This tag is used to indicate the loading order of JavaScript files across all eXo Platform. Its value is of the integer type. If its value is not negative (&gt;=0), the loading priority is sorted by the descending order. If its value is negative (&lt;0), the loading priority of the JavaScript file depends on the loading order of the web app (.war file) containing the JavaScript file.</para>
        </listitem>
      </itemizedlist>
    </section>
  </chapter>
  <chapter id="DEV.WorkingwithContent">
    <title>Work with Content </title>
    <para>This chapter presents the issues related to the content in eXo Platform and you can know how to work with the content via the following topics:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithContent.DocumentTypes">Document types</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithContent.WCMTemplates">WCM templates</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithContent.DocumentType">Document type</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithContent.DialogSyntax">Dialog Syntax</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithContent.Taxonomies">Taxonomies</link>
        </para>
      </listitem>
    </itemizedlist>
    <section id="DEV.WorkWithContent.DocumentTypes">
      <title>Document types </title>
      <para>Each document type is represented by a node type in the JCR. Therefore, to create a new document type, you have to add a new node type. There are two ways to do this: through XML configuration files, or through the administration portlet.</para>
      <para>To learn more about how to use the administration portlet, refer to the <ulink url="http://platform.demo.exoplatform.org/docs/admin/html/index.html">Administration Guide</ulink>.</para>
      <para>Otherwise, you can create a new document type by configuring the file <emphasis role="italic">/nodetypes-configuration.xml</emphasis> in your extension.</para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting language="xml"><![CDATA[
<nodeType hasOrderableChildNodes="false" isMixin="true" name="exo:newnodetype" primaryItemName=""> 
  <supertypes>
    <supertype>exo:article</supertype>
  </supertypes>
  <propertyDefinitions>
    <propertyDefinition autoCreated="true" mandatory="true" multiple="false" name="text" onParentVersion="COPY" protected="false" requiredType="String">
      <valueConstraints/>
    </propertyDefinition>
    <propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="date" onParentVersion="COPY" protected="false" requiredType="Date">
      <valueConstraints/>
    </propertyDefinition>

  </propertyDefinitions>
</nodeType>
]]></programlisting>
      </programlistingco>
      <para>By defining a supertype, you can reuse other node types and extend them with more properties (just like inheritance in Object Oriented Programming).</para>
    </section>
    <section id="DEV.WorkWithContent.WCMTemplates">
      <title>WCM templates </title>
      <para>The templates are applied to a node type or a metadata mixin type. There are two types of templates, including:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">dialogs</emphasis> are html forms that enable you to create node instances.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">views</emphasis> are html fragments used to display nodes.</para>
        </listitem>
      </itemizedlist>
      <para>From the ECM admin portlet, <emphasis role="bold">Manage Template</emphasis> lists all existing node types that have been associated to Dialog and/or View templates. These templates can be attached to permissions (in the usual membership:group form), so that the specific one is displayed according to user rights (which can be useful in a content validation workflow activity).</para>
    </section>
    <section id="DEV.WorkWithContent.DocumentType">
      <title>Document type </title>
      <para>The checkbox 'Document Type' is to define if the node type should be a Document Type or not. If this checkbox is selected, the Site Explorer considers such nodes as user content and applies the following behavior:</para>
      <itemizedlist>
        <listitem>
          <para>The View template will be used to display the DocumentType nodes.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>The document types nodes can be created by the <emphasis role="bold">Add Document</emphasis> action. The forms shown in the <emphasis role="bold">Add Document</emphasis> action are the corresponding Dialog templates of each document type.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>Non-document types are hidden unless the 'Show non document types' option is checked.</para>
        </listitem>
      </itemizedlist>
      <para>Templates are written using Groovy Templates and will require some experiences with JCR API and HTML notions.</para>
    </section>
    <section id="DEV.WorkWithContent.DialogSyntax">
      <title>Dialog Syntax </title>
      <para>Dialogs are Groovy Templates that generate forms by mixing static HTML fragments and Groovy calls to the components responsible for building the UI at runtime. As a result, you will get a simple but powerful syntax.</para>
      <section id="DEV.WorkWithContent.Interceptors">
        <title>Interceptors </title>
        <para>By placing interceptors in your template, you will be able to execute a Groovy script just before and just after saving the node. Pre-save interceptors are mostly used to validate input values and their overall meaning while the post-save interceptor can be used to do some manipulations or references for the newly created node, such as binding it with a forum discussion or wiki space.</para>
        <para>To place interceptors, use the following fragment:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
<% uicomponent.addInterceptor("ecm-explorer/interceptor/PreNodeSaveInterceptor.groovy", "prev");%>
]]></programlisting>
        </programlistingco>
        <para>Interceptor Groovy scripts are managed in the 'Manage Script' section in the ECM admin portlet. They must implement the CmsScript interface. Pre-save interceptors obtain input values within the context:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
public class PreNodeSaveInterceptor implements CmsScript {

  public PreNodeSaveInterceptor() {
  }

  public void execute(Object context) {
    Map inputValues = (Map) context;
    Set keys = inputValues.keySet();
    for(String key : keys) {
      JcrInputProperty prop = (JcrInputProperty) inputValues.get(key);
      println("   --> "+prop.getJcrPath());
    }
  }

  public void setParams(String[] params) {
  }

}
]]></programlisting>
        </programlistingco>
        <para>Whereas the post-save interceptor is passed the path of the saved node in the context:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
<% uicomponent.addInterceptor("ecm-explorer/interceptor/PostNodeSaveInterceptor.groovy", "post");%>

public class PostNodeSaveInterceptor implements CmsScript {

  public PostNodeSaveInterceptor() {
  }

  public void execute(Object context) {
    String path = (String) context;

    println("Post node save interceptor, created node: "+path);
  }

  public void setParams(String[] params) {
  }
}
]]></programlisting>
        </programlistingco>
      </section>
      <section id="DEV.WorkWithContent.HiddenFields">
        <title>Hidden fields </title>
        <para>In the next code sample, each argument is composed of a set of keys and values. The order of arguments are not important and only the key matters. That example defines a field with the id as "hiddenField2", which will generate a hidden field. The value of this field will be automatically set to UTF-8 and no visible field will be printed on the form.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="java"><![CDATA[
String[] hiddenField2 = ["jcrPath=/node/jcr:content/jcr:encoding", "visible=false", "UTF-8"];
uicomponent.addHiddenField("hiddenInput2", hiddenField2);
]]></programlisting>
        </programlistingco>
        <para>Once the form has been saved, the date value will be saved under the relative JCR path ./exo:image/jcr:lastModified.</para>
        <section id="DEV.WorkWithContent.Non-ValueField">
          <title>Non-value field </title>
          <para>You cannot either see the non-value field on the form or input value for them. Its value will be automatically created or defined when you are managing templates.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] hiddenField1 = ["jcrPath=/node/jcr:content", "nodetype=nt:resource", "mixintype=dc:elementSet", "visible=false"] ;
uicomponent.addHiddenField("hiddenInput1", hiddenField1) ;
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.Non-EditableFields">
          <title>Non-editable fields </title>
          <para>It is possible to create widgets that are non-editable (and then only used to print some information).</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] fieldCategories = ["jcrPath=/node/exo:category", "multiValues=true", "reference=true", "editable=false"]; uicomponent.addTextField("categories", fieldCategories);
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.CreateNodeTypeOrMixinType">
          <title>Create node type or mixin type </title>
          <para>In many cases, when creating an instance where the node is out of form, you must still specify the CMS service about the node structure. Particularly, you must define if which node type is child of the newly created node or if the current node has any mixin type attributed.</para>
          <para>By defining these arguments, the node and its children are created with the correct node type and mixin type.</para>
          <para>See the following example:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] hiddenField = ["jcrPath=/node/jcrcontent", "nodetype=nt:resource", "mixintype=exo:rss-enable", "visible=false"] ;
uicomponent.addHiddenField("hiddenInput", hiddenField) ; 
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.HiddenFieldWithDefaultValue">
          <title>Hidden field with default value </title>
          <para>In the previous sample, the value was automatically created and set according to the current date. However, it is also possible to set a default value for a field.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] hiddenField = ["jcrPath=/node/jcrcontent/jcr:mimeType", "image/jpeg"] ;
uicomponent.addHiddenField("hiddenInput", hiddenField) ;
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.VisibleWithoutNullFields">
          <title>Visible without null fields </title>
          <para>It is possible to tell that a widget should be visible only if its value is not null or when the form is used to edit the node which has been existing.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String nameArgs[] = ["jcrPath=/node", "mixintype=mix:votable", "visible=if-not-null"];
uicomponent.addMixinField("name", nameArgs ) 
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.WYSIWYGWidget">
          <title>WYSIWYG widget </title>
          <para>Widgets are natively part of the Platform product to provide a simple and easy way for users to get information and notification on their application. They complete the portlet application that focuses on more transactional behaviors. </para>
          <para>The "What You See Is What You Get" widget is one of the most powerful tools. It renders an advanced JavaScript text editor with many functionalities, including the ability to dynamically upload images or flash assets into a JCR workspace and then to refer to them from the created HTML text.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] fieldSummary = ["jcrPath=/node/exo:summary", "options=basic"] ;
uicomponent.addWYSIWYGField("summary", fieldSummary) ;
]]></programlisting>
          </programlistingco>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] fieldContent = ["jcrPath=/node/exo:text", "options=toolbar:CompleteWCM,'height:410px'", ""] ;
uicomponent.addRichtextField("content", fieldContent)
]]></programlisting>
          </programlistingco>
          <para>The "options" argument is used to tell the component which toolbar should be used.</para>
          <para>By default, there are three options for the toolbar:</para>
          <itemizedlist>
            <listitem>
              <para>basic: a minimal set of tools is shown.</para>
            </listitem>
            <listitem>
              <para>default: a large set of tools is shown, no "options" argument is needed in that case.</para>
            </listitem>
            <listitem>
              <para>CompleteWCM: a full set of tools is shown.</para>
            </listitem>
          </itemizedlist>
          <para>There is also a simple text area widget, which has text-input area only: </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String [] descriptionArgs = ["jcrPath=/node/exo:title", "validate=empty"];
uicomponent.addTextAreaField("description", descriptionArgs) ;
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.SimpleSelectBoxWidget">
          <title>Simple select box widget </title>
          <para>The select box widget enables you to render a select box with static values. These values are enumerated in a comma-separated list in the "options" argument. The argument with no key (here "text/html") is selected by default.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] mimetype = ["jcrPath=/node/jcrcontent/jcr:mimeType", "text/html", "options=text/html,text/plain"] ;
uicomponent.addSelectBoxField("mimetype", mimetype) ;
]]></programlisting>
          </programlistingco>
          <para>As usual, the value will be stored at the relative path defined by the jcrPath directive argument.</para>
          <para>For more examples on how to create WCM templates, refer to <ulink url="http://platform.demo.exoplatform.org/docs/refguide/html/index.html">Reference Guide</ulink>.</para>
        </section>
        <section id="DEV.WorkWithContent.AdvancedDynamicSelectBox">
          <title>Advanced dynamic select box </title>
          <para>In many cases, the previous solution with static options is not good enough and one would like to have the select box checked dynamically.  That is what eXo Platform provide thanks to the introduction of a Groovy script as shown in the code fragment below.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] args = ["jcrPath=/node/exodestWorkspace", "script=ecm-explorer/widget/FillSelectBoxWithWorkspaces:groovy", "scriptParams=production"];
uicomponent.addSelectBoxField("destWorkspace", args) ;
]]></programlisting>
          </programlistingco>
          <para>The script itself implements the CMS Script interface and the cast is done to get the select box object as shown in the script code which fills the select box with the existing JCR workspaces.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
import java.util.List ;
import java.util.ArrayList ;

import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.core.ManageableRepository;

import org.exoplatform.webui.form.UIFormSelectBox;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.services.cms.scripts.CmsScript;

public class FillSelectBoxWithWorkspaces implements CmsScript {

  private RepositoryService repositoryService_;

  public FillSelectBoxWithWorkspaces(RepositoryService repositoryService) {
    repositoryService_ = repositoryService;
  }

  public void execute(Object context) {
    UIFormSelectBox selectBox = (UIFormSelectBox) context;

    ManageableRepository jcrRepository = repositoryService_.getRepository();
    List options = new ArrayList();
    String[] workspaceNames = jcrRepository.getWorkspaceNames();
    for(name in workspaceNames) {
      options.add(new SelectItem(name, name));
    }
    selectBox.setOptions(options);
  }

  public void setParams(String[] params) {
  }
}
]]></programlisting>
          </programlistingco>
          <note>
            <para>It is also possible to provide a parameter to the script by using the argument "scriptParams".</para>
          </note>
        </section>
        <section id="DEV.WorkWithContent.WidgetWithSelector">
          <title>Widget with selector </title>
          <para>One of the most advanced functionalities of this syntax is the ability to plug your own component that shows an interface, enabling you to select the value of the field.</para>
          <para>In the generated form, you will see an icon which is configurable thanks to the selectorIcon argument. The syntax is a bit more complex but not much.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
String[] groupArgs = ["jcrPath=/node/exogroup", "selectorClass=org:exoplatform:ecm:webui:selector:UIGroupMemberSelector"];
uicomponent.addActionField("group", groupArgs);
]]></programlisting>
          </programlistingco>
          <para>You can plug your own component using the selectorClass argument. It must follow the eXo UIComponent mechanism and implements the interface ComponentSelector:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="java"><![CDATA[
package org.exoplatform.ecm.webui.selector;

import org.exoplatform.webui.core.UIComponent;
public interface ComponentSelector {
  public UIComponent getSourceComponent() ;
  public void setSourceComponent(UIComponent uicomponent, String[] initParams) ;    
}

]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.WorkWithContent.Multi-valueWidget">
          <title>Multi-valued widget </title>
          <para>A widget can have multiple values if you add the argument "multiValues=true" to the directive.</para>
        </section>
      </section>
    </section>
    <section id="DEV.WorkWithContent.ManageTemplateService">
      <title>Manage template service </title>
      <para>The Template service enables you to create dialogs and view templates for each node type registered. Each node type may have many dialogs and view templates. The template will be used when creating or viewing nodes.</para>
      <para>
        <emphasis role="italic">.../webapps/portal/WEB-INF/conf/ecm/ecm-templates-configuration.xml</emphasis>
      </para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting language="xml"><![CDATA[
<component>
  <key>org.exoplatform.services.cms.templates.TemplateService</key>
  <type>org.exoplatform.services.cms.templates.impl.TemplateServiceImpl</type>
  ..............
</component>
]]></programlisting>
      </programlistingco>
      <para>As usual, one can register a plugin inside the service. This plugin initializes default dialogs and views template of any node type as nt:file, exo:article, exo:workflowAction, exo:sendMailAction, and more.</para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting language="xml"><![CDATA[
<component-plugins>
  <component-plugin>
    <name>addTemplates</name>
    <set-method>addTemplates</set-method>
    <type>org.exoplatform.services.cms.templates.impl.TemplatePlugin</type>
    .........
  </component-plugin>
</component-plugins>
]]></programlisting>
      </programlistingco>
      <para>With init-parameters as:</para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting language="xml"><![CDATA[
<init-params>
  <value-param>
    <name>autoCreateInNewRepository</name>
    <value>true</value>
  </value-param>
  <value-param>
    <name>storedLocation</name>
    <value>war:/conf/ecm/artifacts/templates</value>
  </value-param>
  <value-param>
    <name>repository</name>
    <value>repository</value>
  </value-param>
  <object-param>
    <name>template.configuration</name>
    <description>configuration for the localtion of templates to inject in jcr</description>
    <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig">
      <field name="nodeTypes">
        <collection type="java.util.ArrayList">
          <value>
            <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType">
              <field name="nodetypeName">
                <string>exo:article</string>
              </field>
              <field name="documentTemplate">
                <boolean>true</boolean>
              </field>
              <field name="label">
                <string>Article</string>
              </field>
              <field name="referencedView">
                <collection type="java.util.ArrayList">
                  <value>
                    <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                      <field name="templateFile">
                        <string>/article/views/view1.gtmpl</string>
                      </field>
                      <field name="roles">
                        <string>*</string>
                      </field>
                    </object>
                  </value>
                </collection>
              </field>
              <field name="referencedDialog">
                <collection type="java.util.ArrayList">
                  <value>
                    <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">
                      <field name="templateFile">
                        <string>/article/dialogs/dialog1.gtmpl</string>
                      </field>
                      <field name="roles">
                        <string>*</string>
                      </field>
                    </object>
                  </value>
                </collection>
              </field>
            </object>
          </value>
        </collection>
      </field>
    </object>
  </object-param>
</init-params>    
]]></programlisting>
      </programlistingco>
    </section>
    <section id="DEV.WorkWithContent.Taxonomies">
      <title>Taxonomies </title>
      <para>Taxonomy is a particular classification arranged in a hierarchical structure. Taxonomy trees in eXo Platform will help you organize your content into categories.</para>
      <para>When you create a new taxonomy tree, you will add a pre-configured <emphasis role="italic">exo:action</emphasis> (<emphasis role="italic">exo:scriptAction</emphasis> or <emphasis role="italic">exo:businessProcessAction</emphasis>) to the root node of the taxonomy tree. This action is triggered when a new document is added anywhere in the taxonomy tree. The default action moves the document to the physical storage location and replaces the document in the taxonomy tree with a symlink of the <emphasis role="italic">exo:taxonomyLink</emphasis> type pointing to it. The physical storage location is defined by a workspace name, a path and the current date and time.</para>
      <para>Like adding document types, taxonomy trees can be managed through the Administration portlet, or by adding XML files.</para>
      <para>To configure taxonomy trees by adding configuration files in the <emphasis role="italic">/webapp/WEB-INF/conf/acme-portal/wcm/taxonomy/</emphasis> directory, create a new file called <emphasis role="italic">$taxonomyName-taxonomies-configuration.xml</emphasis>. For example, if the name of your taxonomy tree is "acme", the file should be named <emphasis role="italic">acme-taxonomies-configuration.xml</emphasis>.</para>
      <para>You can view the file here: <emphasis role="italic">$PLF-HOME_/samples/acme-website/webapp/src/main/webapp/WEB-INF/conf/acme-portal/wcm/taxonomy/acme-taxonomies-configuration.xml</emphasis>.</para>
      <para>As you can see, the value-params enable you to define the repository, workspace, name of the tree and its JCR path. You can then configure  permissions for each group of users in the portal, and the triggered action when a new document is added to the taxonomy tree. Finally, you can describe the structure and names of the categories inside your taxonomy tree.</para>
    </section>
  </chapter>
  <chapter id="DEV.WorkingwithApplications">
    <title>Work with Applications </title>
    <para>Applications play an important role in each eXo service and so it is necessary for you to further understand about them.</para>
    <para>This chapter will help you know how to integrate an application into your portal and how to develop your own application:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithApplications.ApplicationIntergration">Application integration</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.WorkWithApplications.DevelopeYourOwnApplications">Develop your own applications</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.WorkWithContent.GadgetvsPortlet">Gadget vs Portlet</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.WorkWithApplications.PortletBridges">Portlet Bridges</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.WorkWithApplications.PortletBridges">Portlet Bridges</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
    </itemizedlist>
    <section id="DEV.WorkWithApplications.ApplicationIntergration">
      <title>Application integration </title>
      <para>To add a portlet to one of your portal's pages, you should configure the <emphasis role="italic">pages.xml</emphasis> file located at <emphasis role="italic">/war/src/main/webapp/WEB-INF/conf/sample-ext/portal/portal/classic</emphasis>/.</para>
      <para>Here is an example of the portlet configuration inside <emphasis role="italic">pages.xml</emphasis>:</para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting language="xml"><![CDATA[
<portlet-application>
  <portlet>
    <application-ref>presentation</application-ref>
    <portlet-ref>SingleContentViewer</portlet-ref>
    <preferences>
      <preference>
        <name>repository</name>
        <value>repository</value>
        <read-only>false</read-only>
      </preference>
      <preference>
        <name>workspace</name>
        <value>collaboration</value>
        <read-only>false</read-only>
      </preference>
      <preference>
        <name>nodeIdentifier</name>
        <value>/sites content/live/acme/web contents/site artifacts/Introduce</value>
        <read-only>false</read-only>
      </preference>
      <!-- ... -->
    </preferences>
  </portlet>
  <title>Homepage</title>
  <access-permissions>Everyone</access-permissions>
  <show-info-bar>false</show-info-bar>
  <show-application-state>false</show-application-state>
  <show-application-mode>false</show-application-mode>
</portlet-application>
]]></programlisting>
      </programlistingco>
      <para>Details:</para>
      <informaltable>
        <tgroup cols="2">
          <thead>
            <row>
              <entry> XML tag name </entry>
              <entry> Description </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry> <code>application-ref</code> </entry>
              <entry> The name of the webapp that contains the portlet. </entry>
            </row>
            <row>
              <entry> <code>portlet-ref</code> </entry>
              <entry> The name of the portlet. </entry>
            </row>
            <row>
              <entry> <code>title</code> </entry>
              <entry> The title of the page in HTML speaking. </entry>
            </row>
            <row>
              <entry> <code>access-permission</code> </entry>
              <entry> Define who can access the portlet. </entry>
            </row>
            <row>
              <entry> <code>show-info-bar</code> </entry>
              <entry> Show the top bar with the portlet title. </entry>
            </row>
            <row>
              <entry> <code>show-application-state</code> </entry>
              <entry> Show the collapse/expand icons. </entry>
            </row>
            <row>
              <entry> <code>show-application-mode</code> </entry>
              <entry> Show the change portlet mode icon. </entry>
            </row>
            <row>
              <entry> <code>preferences</code> </entry>
              <entry> Contain a list of <emphasis role="italic">preferences</emphasis> specific to each portlet. Each <emphasis role="italic">preference</emphasis> has a <emphasis role="italic">name</emphasis> and a <emphasis role="italic">value</emphasis>. You can also lock it by setting the <emphasis role="italic">read-only</emphasis> element to true. To learn more, refer to <ulink url="http://platform.demo.exoplatform.org/docs/refguide/html/jcr/index.html">eXo JCR and Extension Services Reference</ulink>. </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
    <section id="DEV.WorkWithApplications.DevelopeYourOwnApplications">
      <title>Develop your own applications </title>
      <section id="DEV.WorkWithContent.GadgetvsPortlet">
        <title>Gadget vs Portlet </title>
        <para>It is important to understand distinctions between gadgets and portlets. Portlets are user interface components that provide fragments of markup code from the server side, while gadgets generate dynamic web content on the client side. With Gadgets, small applications can be built quickly, and mashed up on the client side using the lightweight Web-Oriented Architecture (WOA) technologies, like REST or RSS.</para>
        <para>For more information on how to develop gadgets and portlets, see in the GateIn Reference Guide:</para>
        <itemizedlist>
          <listitem>
            <para>
              <ulink url="http://docs.jboss.com/gatein/portal/3.1.0-FINAL/reference-guide/en-US/html_single/index.html#chap-Reference_Guide-Portlet_development">Portlet development</ulink>
            </para>
          </listitem>
          <listitem>
            <para>
              <ulink url="http://docs.jboss.com/gatein/portal/3.1.0-FINAL/reference-guide/en-US/html_single/index.html#chap-Reference_Guide-Gadget_development">Gadget development</ulink>
            </para>
          </listitem>
        </itemizedlist>
      </section>
      <section id="DEV.WorkWithApplications">
        <title>Gadget development quickstart with eXo IDE </title>
        <para>eXo Platform facilitates easy gadget development, via its powerful, web-based IDE. You can learn more about the basic principles of gadget development <ulink url="http://code.google.com/apis/gadgets/docs/gs.html">here</ulink>.</para>
      </section>
      <section id="DEV.WorkWithApplications.PortletBridges">
        <title>Portlet Bridges </title>
        <para>The Portlet Bridge is an adapter for a web framework to the portlet container runtime. It works ideally with framework that does not expose the servlet container with the limited support for the full portlet API.</para>
        <para>The JavaTM Specification Request 168 Portlet Specification (JSR 168) standardizes how components for portal servers are developed. This standard has industry backing from major portal server vendors. A Portlet Bridge allows you to create a JSR-168 compliant portlet with very little change on your existing web application.</para>
        <para>For example, the JSF Bridge allows you to transparently deploy your existing JSF Applications as a Portlet Application or Web Application.</para>
        <para>
          <ulink url="http://wiki.apache.org/myfaces/PortletBridge">http://wiki.apache.org/myfaces/PortletBridge</ulink>
        </para>
        <para>The JBoss implementation of the Portlet Bridge has enhancements to support other web frameworks, such as RichFaces and Seam. </para>
        <para>
          <ulink url="http://jboss.org/portletbridge/docs.html">http://jboss.org/portletbridge/docs.html</ulink>
        </para>
      </section>
    </section>
  </chapter>
  <chapter id="DEV.SystemIntegration">
    <title>System Integration </title>
    <para>This chapter will show you how to integrate eXo Platform 3.5 into your information system through the specific topics below:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.SystemIntegration.Authentication">Authentication</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.SingleSignON">Single-Sign-On (SSO)</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.KerberosSSOOnActiveDirectory">Kerberos SSO on Active Directory</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.SystemIntegration.UserIntergration">Users integration</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.OrganizationService">Organization Service</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.MembershipsGroupsAndUsers">Memberships, Groups and Users</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.OrganizationAPI">Organization API</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.SystemIntegration.LDAPIntergration">LDAP Integration</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.ConnectionSettings">Connection Settings</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.ActiveDirectorySampleConfiguration">Active Directory sample configuration</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.SystemIntegration.ActiveDirectorySampleConfiguration">Active Directory sample configuration</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.SystemIntegration.Email">Email</link>
        </para>
      </listitem>
    </itemizedlist>
    <section id="DEV.SystemIntegration.Authentication">
      <title>Authentication </title>
      <section id="DEV.SystemIntegration.SingleSignON">
        <title>Single-Sign-On (SSO) </title>
        <para>When logging into the portal, you can gain access to many systems through portlets using a single identity. However, in many cases, the portal infrastructure must be integrated with other SSO-enabled systems. There are many different Identity Management solutions available. The GateIn documentation gives detailed configuration for different SSO implementation. For more details, see <ulink url="http://docs.jboss.com/gatein/portal/3.1.0-FINAL/reference-guide/en-US/html_single/index.html#chap-Reference_Guide-SSO_Single_Sign_On">Single Sign On</ulink>.</para>
      </section>
      <section id="DEV.SystemIntegration.CenterAuthenticationService">
        <title>Central Authentication Service (CAS) </title>
        <para>Central Authentication Service (CAS) is a Web Single-Sign-On (WebSSO), developed by JA-SIG as an open source project. CAS enables you to work on different applications to log in only once and to be recognized and authenticated by all applications. Details about CAS can be found <ulink url="http://www.ja-sig.org/products/cas/">here</ulink>.</para>
        <para>The CAS integration consists of two steps:</para>
        <itemizedlist>
          <listitem>
            <para>Installing or configuring the CAS server.</para>
          </listitem>
          <listitem>
            <para>Setting up the portal to use the CAS server.</para>
          </listitem>
        </itemizedlist>
        <para>For more information on CAS configuration, refer <ulink url="http://docs.jboss.com/gatein/portal/3.1.0-FINAL/reference-guide/en-US/html_single/index.html#sect-Reference_Guide-Single_Sign_On-CAS_Central_Authentication_Service">here</ulink>.</para>
      </section>
      <section id="DEV.SystemIntegration.KerberosSSOOnActiveDirectory">
        <title>Kerberos SSO on Active Directory </title>
        <para>eXo Portal 3.5 supports the Kerberos authentication on a Microsoft Active Directory. You will need to configure both your Active Directory server and the application server.</para>
        <para>The implementation makes possible to use SPNEGO or NTLM. The client will get two authentication headers, including <emphasis role="bold">Negotiate</emphasis> and <emphasis role="bold">NTLM</emphasis> and will use whichever supported by the browser. In Firefox, it is possible to manage authentication types, but it is not in Internet Explorer; therefore, SPNEGO will be used.</para>
        <para>To learn more about how to configure Kerberos SSO, see <ulink url="http://wiki.exoplatform.com/xwiki/bin/view/WS/Kerberos%20SSO%20on%20Active%20Directory">here</ulink>.</para>
      </section>
    </section>
    <section id="DEV.SystemIntegration.UserIntergration">
      <title>Users integration </title>
      <section id="DEV.SystemIntegration.OrganizationService">
        <title>Organization Service </title>
        <para>To specify the initial Organization configuration, the content of your extension.war in <emphasis role="italic">/WEB-INF/conf/organization/organization-configuration.xml</emphasis> should be edited. This file uses the portal XML configuration schema. It lists several configuration plugins.</para>
        <para>The plugin of <emphasis role="italic">org.exoplatform.services.organization.OrganizationDatabaseInitializer</emphasis> type is used to specify a list of membership types, groups, and users to be created.</para>
      </section>
      <section id="DEV.SystemIntegration.MembershipsGroupsAndUsers">
        <title>Memberships, Groups and Users </title>
        <para>The predefined membership types are specified in the <emphasis role="bold">membershipType</emphasis> field of the OrganizationConfig plugin parameter.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<field name="membershipType">
  <collection type="java.util.ArrayList">
    <value>
      <object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
        <field name="type">
          <string>member</string>
        </field>
        <field name="description">
          <string>member membership type</string>
        </field>
      </object>
    </value>
    <value>
      <object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType">
        <field name="type">
          <string>owner</string>
        </field>
        <field name="description">
          <string>owner membership type</string>
        </field>
      </object>
    </value>
  </collection>
</field>
]]></programlisting>
        </programlistingco>
        <para>The predefined groups are specified in the <emphasis role="bold">group</emphasis> field of the OrganizationConfig plugin parameter.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<field name="group">
  <collection type="java.util.ArrayList">
    <value>
      <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
        <field name="name">
          <string>portal</string>
        </field>
        <field name="parentId">
          <string/>
        </field>
        <field name="type">
          <string>hierachy</string>
        </field>
        <field name="description">
          <string>the /portal group</string>
        </field>
      </object>
    </value>
    <value>
      <object type="org.exoplatform.services.organization.OrganizationConfig$Group">
        <field name="name">
          <string>community</string>
        </field>
        <field name="parentId">
          <string>/portal</string>
        </field>
        <field name="type">
          <string>hierachy</string>
        </field>
        <field name="description">
          <string>the /portal/community group</string>
        </field>
      </object>
    </value>
    ...
  </collection>
</field>
]]></programlisting>
        </programlistingco>
        <para>The predefined users are specified in the <emphasis role="bold">membershipType</emphasis> field of the OrganizationConfig plugin parameter.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<field name="user">
  <collection type="java.util.ArrayList">
    <value>
      <object type="org.exoplatform.services.organization.OrganizationConfig$User">
        <field name="userName">
          <string>root</string>
        </field>
        <field name="password">
          <string>exo</string>
        </field>
        <field name="firstName">
          <string>root</string>
        </field>
        <field name="lastName">
          <string>root</string>
        </field>
        <field name="email">
          <string>exoadmin@localhost</string>
        </field>
        <field name="groups">
          <string>member:/admin,member:/user,owner:/portal/admin</string>
        </field>
      </object>
    </value>
    <value>
      <object type="org.exoplatform.services.organization.OrganizationConfig$User">
        <field name="userName">
          <string>exo</string>
        </field>
        <field name="password">
          <string>exo</string>
        </field>
        <field name="firstName">
          <string>site</string>
        </field>
        <field name="lastName">
          <string>site</string>
        </field>
        <field name="email">
          <string>exo@localhost</string>
        </field>
        <field name="groups">
          <string>member:/user</string>
        </field>
      </object>
    </value>
    ...
  </collection>
</field>
]]></programlisting>
        </programlistingco>
      </section>
      <section id="DEV.SystemIntegration.OrganizationAPI">
        <title>Organization API </title>
        <para>The <emphasis role="italic">exo.platform.services.organization</emphasis> package has five main components: user, user profile, group, membership type and membership. There is an additional component that serves as an entry point into Organization API - <emphasis role="italic">OrganizationService</emphasis> component which provides handling functionality for the five components. For more details, take a look at the <ulink url="http://docs.jboss.com/gatein/portal/3.1.0-FINAL/reference-guide/en-US/html/chap-Reference_Guide-Authentication_And_Identity.html#sect-Reference_Guide-APIs-Organization_API">GateIn documentation</ulink>.</para>
      </section>
    </section>
    <section id="DEV.SystemIntegration.LDAPIntergration">
      <title>LDAP Integration </title>
      <para>If you have an existing LDAP server, the eXo predefined settings will likely not match your directory structure. eXo LDAP organization service implementation was written with flexibility in mind and can certainly be configured to meet your requirements.</para>
      <para>The configuration is done in the <emphasis role="italic">ldap-configuration.xml</emphasis> file, and this part will explain the numerous parameters which it contains.</para>
      <section id="DEV.SystemIntegration.ConnectionSettings">
        <title>Connection Settings </title>
        <para>First, start by connection settings which will tell eXo how to connect to your directory server. These settings are very close to the <ulink url="http://java.sun.com/products/jndi">JNDI API</ulink> context parameters. This configuration is activated by the init-param <emphasis role="italic">ldap.config</emphasis> of service <emphasis role="italic">LDAPServiceImpl</emphasis>.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<component>
  <key>org.exoplatform.services.ldap.LDAPService</key>
  <type>org.exoplatform.services.ldap.impl.LDAPServiceImpl</type>
  <init-params>
    <object-param>
      <name>ldap.config</name>
      <description>Default ldap config</description>
      <object type="org.exoplatform.services.ldap.impl.LDAPConnectionConfig">
        <field name="providerURL">
          <string>ldap://127.0.0.1:389,10.0.0.1:389</string>
        </field>
        <field name="rootdn">
          <string>CN=Manager,DC=exoplatform,DC=org</string>
        </field>
        <field name="password">
          <string>secret</string>
        </field>
        <!-- field name="authenticationType"><string>simple</string></field -->
        <field name="version">
          <string>3</string>
        </field>
        <field name="referralMode">
          <string>follow</string>
        </field>
        <!-- field name="serverName"><string>active.directory</string></field -->
      </object>
    </object-param>
  </init-params>
</component>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">providerURL</emphasis>: LDAP server URL (see <ulink url="http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/Context.html#PROVIDER_URL">PROVIDER<emphasis role="italic">URL</emphasis>
              </ulink>). For multiple LDAP servers, use comma separated list of host:port (For example, <ulink url="ldap://127.0.0.1:389">ldap://127.0.0.1:389</ulink>,10.0.0.1:389).</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">rootdn</emphasis>: distinguished name of user that will be used by the service to authenticate on the server (see <ulink url="http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/Context.html#SECURITY_PRINCIPAL">SECURITY<emphasis role="italic">PRINCIPAL</emphasis>
              </ulink>).</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">password</emphasis>: password for user <emphasis role="italic">rootdn</emphasis> (see <ulink url="http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/Context.html#SECURITY_CREDENTIALS">SECURITY<emphasis role="italic">CREDENTIALS</emphasis>
              </ulink>).</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">authenticationType</emphasis>: type of authentication to be used (see <ulink url="http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/Context.html#SECURITY_AUTHENTICATION">SECURITY<emphasis role="italic">AUTHENTICATION</emphasis>
              </ulink>). Use one of <emphasis role="italic">none</emphasis>, <emphasis role="italic">simple</emphasis>, <emphasis role="italic">strong</emphasis>. Default is <emphasis role="italic">simple</emphasis>.</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">version</emphasis>: LDAP protocol version (see <ulink url="http://java.sun.com/products/jndi/tutorial/ldap/misc/version.html">java.naming.ldap.version</ulink>). Set to 3 if your server supports LDAP V3.</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">referalMode</emphasis>: one of <emphasis role="italic">follow</emphasis>, <emphasis role="italic">ignore</emphasis>, <emphasis role="italic">throw</emphasis> (see <ulink url="http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/Context.html#REFERRAL">REFERRAL</ulink>).</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">serverName</emphasis>: you will need to set this to <emphasis role="italic">active.directory</emphasis> to work with Active Directory servers. Any other value will be ignored and the service will act as on a standard LDAP.</para>
          </listitem>
        </itemizedlist>
      </section>
      <section id="DEV.SystemIntegration.OrganizationServiceConfiguration">
        <title>Organization Service Configuration </title>
        <para>Next, you need to configure the eXo <emphasis role="bold">OrganizationService</emphasis> to show how the directory is structured and how to interact with it. This is managed by a couple of init-params: <emphasis role="bold">ldap.userDN.key</emphasis> and <emphasis role="bold">ldap.attribute.mapping</emphasis> in file <emphasis role="bold">ldap-configuration.xml</emphasis> (by default located at <emphasis role="italic">portal.war/WEB-INF/conf/organization</emphasis>)</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<component>
  <key>org.exoplatform.services.organization.OrganizationService</key>
  <type>org.exoplatform.services.organization.ldap.OrganizationServiceImpl</type>
  [...]
  <init-params>
    <value-param>
      <name>ldap.userDN.key</name>
      <description>The key used to compose user DN</description>
      <value>cn</value>
    </value-param>
    <object-param>
      <name>ldap.attribute.mapping</name>
      <description>ldap attribute mapping</description>
      <object type="org.exoplatform.services.organization.ldap.LDAPAttributeMapping"/>
        [...]
    </object-param>
  </init-params>
  [...]
</component>
]]></programlisting>
        </programlistingco>
        <para>
          <emphasis role="bold">ldap.attribute.mapping</emphasis> maps your LDAP to eXo. At first, there are two main parameters to configure in it:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<field name="baseURL">
  <string>dc=exoplatform,dc=org</string>
</field>
<field name="ldapDescriptionAttr">
  <string>description</string>
</field>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">baseURL</emphasis>: root dn for eXo organizational entities. This entry cannot be created by eXo and must have existed in the directory already.</para>
          </listitem>
          <listitem>
            <para>
              <emphasis role="bold">ldapDescriptionAttr</emphasis>: Name of a common attribute that will be used as description for groups and membership types.</para>
          </listitem>
        </itemizedlist>
        <warning>
          <para>In Core, the ldapDesriptionAttr key is present but not consistently used everywhere in code. When using <emphasis role="bold">Core</emphasis>, consider that the description is always mapped to the 'description' attribute.</para>
        </warning>
        <para>Other parameters are discussed in the following sections.</para>
        <section id="DEV.SystemIntegration.Users">
          <title>Users </title>
          <section id="DEV.SystemIntegration.MainParameters">
            <title>Main parameters </title>
            <para>Here are the main parameters to map eXo users to your directory:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<field name="userURL">
  <string>ou=users,ou=portal,dc=exoplatform,dc=org</string>
</field>
<field name="userObjectClassFilter">
  <string>objectClass=person</string>
</field>
<field name="userLDAPClasses">
  <string>top,person,organizationalPerson,inetOrgPerson</string>
</field>
]]></programlisting>
            </programlistingco>
            <itemizedlist>
              <listitem>
                <para>
                  <emphasis role="bold">userURL</emphasis>: base dn for users. Users are created in a flat structure under this base with a <emphasis role="bold">dn</emphasis> of the form: <emphasis role="bold">ldap.userDN.key=username,userURL</emphasis>.</para>
              </listitem>
            </itemizedlist>
            <para>For example: <programlistingco>
                <areaspec units="linecolumn"/>
                <programlisting><![CDATA[uid=john,cn=People,o=MyCompany,c=com]]></programlisting>
              </programlistingco>
            </para>
            <para>However, if users exist deeply under <emphasis role="italic">userURL</emphasis>, eXo will be able to retrieve them.</para>
            <para>Example: <programlistingco>
                <areaspec units="linecolumn"/>
                <programlisting><![CDATA[uid=tom,ou=France,ou=EMEA,cn=People,o=MyCompany,c=com]]></programlisting>
              </programlistingco>
            </para>
            <itemizedlist>
              <listitem>
                <para>
                  <emphasis role="bold">userObjectClassFilter</emphasis>: Filter used under <emphasis role="italic">userURL</emphasis> branch to distinguish eXo user entries from others.</para>
              </listitem>
            </itemizedlist>
            <para>Example: <emphasis role="italic">john</emphasis> and <emphasis role="italic">tom</emphasis> will be recognized as valid eXo users but <emphasis role="italic">EMEA</emphasis> and <emphasis role="italic">France</emphasis> entries will be ignored in the following subtree:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
uid=john,cn=People,o=MyCompany,c=com
  objectClass: person
  ...
ou=EMEA,cn=People,o=MyCompany,c=com
  objectClass: organizationalUnit
  ...
    ou=France,ou=EMEA,cn=People,o=MyCompany,c=com
      objectClass: organizationalUnit
      ...
        uid=tom,ou=EMEA,cn=People,o=MyCompany,c=com
          objectClass: person
          ...
]]></programlisting>
            </programlistingco>
            <itemizedlist>
              <listitem>
                <para>
                  <emphasis role="bold">userLDAPClasses</emphasis>: commas are used to separate list of classes used for creating users. </para>
              </listitem>
            </itemizedlist>
            <para>When a new user is created, an entry will be created with the given <emphasis role="italic">objectClass</emphasis> attributes.  The classes must at least define <emphasis role="italic">cn</emphasis> and any attribute referenced in the user mapping.</para>
            <para>For example, adding the user <emphasis role="italic">Marry Simons</emphasis> could produce:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
uid=marry,cn=users,ou=portal,dc=exoplatform,dc=org
  objectclass: top
  objectClass: person
  objectClass: organizationalPerson
  objectClass: inetOrgPerson
  ...
]]></programlisting>
            </programlistingco>
          </section>
          <section id="DEV.SystemIntegration.UserMapping">
            <title>User mapping </title>
            <para>The following parameters maps LDAP attributes to eXo User Java objects attributes.</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting language="xml"><![CDATA[
<field name="userUsernameAttr">
  <string>uid</string>
</field>
<field name="userPassword">
  <string>userPassword</string>
</field>
<field name="userFirstNameAttr">
  <string>givenName</string>
</field>
<field name="userLastNameAttr">
  <string>sn</string>
</field>
<field name="userDisplayNameAttr">
  <string>displayName</string>
</field>
<field name="userMailAttr">
  <string>mail</string>
</field>
]]></programlisting>
            </programlistingco>
            <itemizedlist>
              <listitem>
                <para>
                  <emphasis role="bold">userUsernameAttr</emphasis>: username (login)</para>
              </listitem>
              <listitem>
                <para>
                  <emphasis role="bold">userPassword</emphasis>: password (used when the portal authentication is done by eXo login module)</para>
              </listitem>
              <listitem>
                <para>
                  <emphasis role="bold">userFirstNameAttr</emphasis>: first name</para>
              </listitem>
              <listitem>
                <para>
                  <emphasis role="bold">userLastNameAttr</emphasis>: last name</para>
              </listitem>
              <listitem>
                <para>
                  <emphasis role="bold">userDisplayNameAttr</emphasis>: display name</para>
              </listitem>
              <listitem>
                <para>
                  <emphasis role="bold">userMailAttr</emphasis>: email address</para>
              </listitem>
            </itemizedlist>
            <para>In the example above, the user <emphasis role="italic">Marry Simons</emphasis> could produce:</para>
            <programlistingco>
              <areaspec units="linecolumn"/>
              <programlisting><![CDATA[
uid=marry,cn=users,ou=portal,dc=exoplatform,dc=org
  userPassword: XXXX
  givenName: Marry
  sn: Simons
  displayName: Marry Simons
  mail: marry.simons@example.org
  uid: marry
  ...
]]></programlisting>
            </programlistingco>
          </section>
        </section>
        <section id="DEV.SystemIntegration.Groups">
          <title>Groups </title>
          <para>eXo Platform groups can be mapped to organizational or applicative groups defined in your directory.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<field name="groupsURL">
  <string>ou=groups,ou=portal,dc=exoplatform,dc=org</string>
</field>
<field name="groupLDAPClasses">
  <string>top,organizationalUnit</string>
</field>
<field name="groupObjectClassFilter">
  <string>objectClass=organizationalUnit</string>
</field>
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">groupsURL</emphasis>: base dn for eXo groups</para>
            </listitem>
          </itemizedlist>
          <para>Groups can be structured hierarchically under <emphasis role="italic">groupsURL</emphasis>.              For example, groups, including <emphasis role="italic">communication</emphasis>, <emphasis role="italic">communication/marketing</emphasis> and <emphasis role="italic">communication/press</emphasis>, would map to:             </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
ou=communication,ou=groups,ou=portal,dc=exoplatform,dc=org
...
  ou=marketing,ou=communication,ou=groups,ou=portal,dc=exoplatform,dc=org
  ...            
  ou=press,ou=communication,ou=groups,ou=portal,dc=exoplatform,dc=org                          
  ...
]]></programlisting>
          </programlistingco>
          <para>        </para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">groupLDAPClasses</emphasis>: commas are used to separate list of classes used for group creation. </para>
            </listitem>
          </itemizedlist>
          <para>When a new group is created, an entry will be also created with the given objectClass attributes. The classes must define at least the required attributes: <emphasis role="bold">ou</emphasis>, <emphasis role="bold">description</emphasis> and <emphasis role="bold">l</emphasis>.</para>
          <note>
            <para>The <emphasis role="bold">l</emphasis> attribute corresponds to the <emphasis role="bold">City</emphasis> property in OU property editor.</para>
          </note>
          <para>                         For example, adding the <emphasis role="italic">human-resources</emphasis> group could produce: </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[                       
ou=human-resources,ou=groups,ou=portal,dc=exoplatform,dc=org
  objectclass: top
  objectClass: organizationalunit
  ou: human-resources
  description: The human resources department
  l: Human Resources
  ...
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">groupObjectClassFilter</emphasis>: This filter is used under the <emphasis role="italic">groupsURL</emphasis> branch to distinguish eXo groups from other entries. You can also use a complex filter if you need.</para>
            </listitem>
          </itemizedlist>
          <para>             Example: groups <emphasis role="italic">WebDesign</emphasis>, <emphasis role="italic">WebDesign/Graphists</emphasis> and <emphasis role="italic">sales</emphasis> could be retrieved in:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[           
l=Paris,dc=sites,dc=mycompany,dc=com
  ...
  ou=WebDesign,l=Paris,dc=sites,dc=mycompany,dc=com
  ...
    ou=Graphists,WebDesign,l=Paris,dc=sites,dc=mycompany,dc=com
    ...
l=London,dc=sites,dc=mycompany,dc=com
  ...
  ou=Sales,l=London,dc=sites,dc=mycompany,dc=com
  ...
]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.SystemIntegration.MembershipTypes">
          <title>Membership types </title>
          <para>Membership types are the possible roles that can be assigned to users in groups.</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<field name="membershipTypeURL">
  <string>ou=memberships,ou=portal,dc=exoplatform,dc=org</string>
</field>
<field name="membershipTypeLDAPClasses">
  <string>top,organizationalRole</string>
</field>
<field name="membershipTypeNameAttr">
  <string>cn</string>
</field>
]]></programlisting>
          </programlistingco>
          <para>          </para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipTypeURL</emphasis>: base dn for membership types storage.</para>
            </listitem>
          </itemizedlist>
          <para>eXo stores membership types in a flat structure under <emphasis role="italic">membershipTypeURL</emphasis>. For example, roles, including <emphasis role="italic">manager</emphasis>, <emphasis role="italic">user</emphasis>, <emphasis role="italic">admin</emphasis> and <emphasis role="italic">editor</emphasis> could be defined by the subtree:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[           
ou=roles,ou=portal,dc=exoplatform,dc=org
...
  cn=manager,ou=roles,ou=portal,dc=exoplatform,dc=org
  ...
  cn=user,ou=roles,ou=portal,dc=exoplatform,dc=org
  ...
  cn=admin,ou=roles,ou=portal,dc=exoplatform,dc=org               
  ...
  cn=editor,ou=roles,ou=portal,dc=exoplatform,dc=org
  ...
]]></programlisting>
          </programlistingco>
          <para>             </para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipTypeLDAPClasses</emphasis>: commas are used to separat list of classes for creating membership types. </para>
            </listitem>
          </itemizedlist>
          <para>When a new membership type is created, an entry will be also created with the given <emphasis role="italic">objectClass</emphasis> attributes. The classes must define the required attributes: <emphasis role="bold">description</emphasis>, <emphasis role="bold">cn</emphasis>. </para>
          <para>For example, adding the membership type <emphasis role="italic">validator</emphasis> would produce: </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[          
cn=validator,ou=roles,ou=portal,dc=exoplatform,dc=org
  objectclass: top
  objectClass: organizationalRole
  ...                       
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipTypeNameAttr</emphasis>: Attribute will be used as the name of the role.</para>
            </listitem>
          </itemizedlist>
          <para>           For example, if <emphasis role="italic">membershipTypeNameAttr</emphasis> is <emphasis role="italic">cn</emphasis>, the role name will be <emphasis role="italic">manager</emphasis> for the following membership type entry: </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[cn=manager,ou=roles,ou=portal,dc=exoplatform,dc=org ]]></programlisting>
          </programlistingco>
        </section>
        <section id="DEV.SystemIntegration.Membership">
          <title>Memberships </title>
          <para>Memberships are used to assign a role within a group. They are entries that are placed under the group entry of their scope group. Users in this role are defined as attributes of the membership entry.             </para>
          <itemizedlist>
            <listitem>
              <para>For example, to designate <emphasis role="italic">tom</emphasis> as the <emphasis role="italic">manager</emphasis> of the group <emphasis role="italic">human-resources</emphasis>: </para>
            </listitem>
          </itemizedlist>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[          
ou=human-resources,ou=groups,ou=portal,dc=exoplatform,dc=org
  ...
  cn=manager,ou=human-resources,ou=groups,ou=portal,dc=exoplatform,dc=org
    member: uid=tom,ou=users,ou=portal,dc=exoplatform,dc=org
    ...                
]]></programlisting>
          </programlistingco>
          <para>The parameters to configure memberships are:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<field name="membershipLDAPClasses">
  <string>top,groupOfNames</string>
</field>
<field name="membershipTypeMemberValue">
  <string>member</string>
</field>
<field name="membershipTypeRoleNameAttr">
  <string>cn</string>
</field>
<field name="membershipTypeObjectClassFilter">
  <string>objectClass=organizationalRole</string>
</field>
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipLDAPClasses</emphasis>: the commas are used to separate the list of classes for creating memberships.</para>
            </listitem>
          </itemizedlist>
          <para>When a new membership is created, an entry will be also created with the given <emphasis role="italic">objectClass</emphasis> attributes. The classes must at least define the attribute designated by <emphasis role="italic">membershipTypeMemberValue</emphasis>.            Example: Adding membership <emphasis role="italic">validator</emphasis> would produce:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[           
cn=validator,ou=human-resources,ou=groups,ou=portal,dc=exoplatform,dc=org
  objectclass: top
  objectClass: groupOfNames
  ...
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipTypeMemberValue</emphasis>: Multi-valued attribute is used in memberships to reference users that have the role in the group. </para>
            </listitem>
          </itemizedlist>
          <para>Values should be a user dn.</para>
          <para>Example: <emphasis role="italic">james</emphasis> and <emphasis role="italic">root</emphasis>, who have <emphasis role="italic">admin</emphasis> role within the group <emphasis role="italic">human-resources</emphasis>, would give:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
cn=admin,ou=human-resources,ou=groups,ou=portal,dc=exoplatform,dc=org
  member: cn=james,ou=users,ou=portal,dc=exoplatform,dc=org
  member: cn=root,ou=users,ou=portal,dc=exoplatform,dc=org
  ...
]]></programlisting>
          </programlistingco>
          <para>                   </para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipTypeRoleNameAttr</emphasis>: Attribute of the membership entry whose value refers to the membership type.</para>
            </listitem>
          </itemizedlist>
          <para>             For example, in the following membership entry:             </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[
cn=manager,ou=human-resources,ou=groups,ou=portal,dc=exoplatform,dc=org
]]></programlisting>
          </programlistingco>
          <para>           The <emphasis role="italic">cn</emphasis> attribute is used to designate the <emphasis role="italic">manager</emphasis> membership type. In other words, the name of role is given by the 'cn' attribute.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">membershipTypeObjectClassFilter</emphasis>: Filter is used to distinguish membership entries under groups. You can use the more complex filters.</para>
            </listitem>
          </itemizedlist>
          <para>             For example, the following is a filter used for a customer that needs to trigger a dynlist overlay on openldap.            </para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting><![CDATA[(&amp;amp;(objectClass=ExoMembership)(membershipURL=&#42;)) ]]></programlisting>
          </programlistingco>
          <para>          </para>
          <note>
            <para>Please pay attention to the xml escaping of the '&amp;' (and) operator.</para>
          </note>
        </section>
        <section id="DEV.SystemIntegration.UserProfiles">
          <title>User profiles </title>
          <para>eXo User profiles also have entries in the LDAP but the actual storage is still done with the hibernate service. You will need the following parameters:</para>
          <programlistingco>
            <areaspec units="linecolumn"/>
            <programlisting language="xml"><![CDATA[
<field name="profileURL">
  <string>ou=profiles,ou=portal,dc=exoplatform,dc=org</string>
</field>
<field name="profileLDAPClasses">
  <string>top,organizationalPerson</string>
</field>
]]></programlisting>
          </programlistingco>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">profileURL</emphasis>: base dn to store user profiles</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">profileLDAPClasses</emphasis>: Classes used to when creating user profiles</para>
            </listitem>
          </itemizedlist>
        </section>
      </section>
      <section id="DEV.SystemIntegration.ActiveDirectorySampleConfiguration">
        <title>Active Directory sample configuration </title>
        <para>Here is an alternative configuration for active directory that you can find in <emphasis role="bold">activedirectory-configuration.xml</emphasis>.</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
[...]
<component>
  <key>org.exoplatform.services.ldap.LDAPService</key>
  [..]
  <object type="org.exoplatform.services.ldap.impl.LDAPConnectionConfig">         
  <!-- for multiple ldap servers, use comma seperated list of host:port (Ex. ldap://127.0.0.1:389,10.0.0.1:389) -->
  <!-- whether or not to enable ssl, if ssl is used ensure that the javax.net.ssl.keyStore & java.net.ssl.keyStorePassword properties are set -->
  <!-- exo portal default installed javax.net.ssl.trustStore with file is java.home/lib/security/cacerts-->
  <!-- ldap service will check protocol, if protocol is ldaps, ssl is enable (Ex. for enable ssl: ldaps://10.0.0.3:636 ;for disable ssl: ldap://10.0.0.3:389 ) -->
  <!-- when enable ssl, ensure server name is *.directory and port (Ex. active.directory) -->	  		 
    <field name="providerURL"><string>ldaps://10.0.0.3:636</string></field>
    <field name="rootdn"><string>CN=Administrator,CN=Users, DC=exoplatform,DC=org</string></field>
    <field name="password"><string>site</string></field> 		
    <field name="version"><string>3</string></field>	            
    <field name="referralMode"><string>ignore</string></field>     	       	       
    <field name="serverName"><string>active.directory</string></field>    	       	  
  </object>
  [..]
</component>
<component>
  <key>org.exoplatform.services.organization.OrganizationService</key>
  [...]
  <object type="org.exoplatform.services.organization.ldap.LDAPAttributeMapping">                
    [...]
    <field name="userAuthenticationAttr"><string>mail</string></field>
    <field name="userUsernameAttr"><string>sAMAccountName</string></field>
    <field name="userPassword"><string>unicodePwd</string></field> 
    <field name="userLastNameAttr"><string>sn</string></field>
    <field name="userDisplayNameAttr"><string>displayName</string></field>
    <field name="userMailAttr"><string>mail</string></field>
    [..]
    <field name="membershipTypeLDAPClasses"><string>top,group</string></field>
    <field name="membershipTypeObjectClassFilter"><string>objectClass=group</string></field>
    [..]
    <field name="membershipLDAPClasses"><string>top,group</string></field>
    <field name="membershipObjectClassFilter"><string>objectClass=group</string></field>
  </object>
  [...]  
</component>  
]]></programlisting>
        </programlistingco>
        <note>
          <para>There is a Microsoft limitation: the password cannot be set in AD via unsecured connection, you have to use the LDAPs protocol.</para>
        </note>
        <para>Here is how to use the LDAPs protocol with the Active Directory:</para>
        <para>
          <emphasis role="bold">1.</emphasis> Set up AD to use SSL:</para>
        <para>
          <emphasis role="bold">i.</emphasis> Add the Active Directory Certificate Services role.</para>
        <para>
          <emphasis role="bold">ii.</emphasis> Install the right certificate for the DC machine.</para>
        <para>
          <emphasis role="bold">2.</emphasis> Enable Java VM to use the certificate from AD:</para>
        <para>
          <emphasis role="bold">i.</emphasis> Import the root CA used in AD, to keystore, such as: keytool <emphasis role="strikethrough">importcert </emphasis>file 2008.cer <emphasis role="strikethrough">keypass changeit </emphasis>keystore /home/user/java/jdk1.6/jre/lib/security/cacerts.</para>
        <para>
          <emphasis role="bold">ii.</emphasis> Set the Java options as below:</para>
        <para>  <emphasis role="italic">JAVA_OPTS="${JAVA_OPTS} -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.ssl.trustStore=/home/user/java/jdk1.6/jre/lib/security/ca"</emphasis>
        </para>
      </section>
      <section id="DEV.SystemIntegration.PicketlinkIDM">
        <title>Picketlink IDM </title>
        <para>eXo Platform uses the PicketLink IDM component to keep the necessary identity information, such as users, groups, memberships. While the legacy interfaces are still used (org.exoplatform.services.organization) for the identity management, there is a wrapper implementation that delegates to the PicketLink IDM framework.  For further information, visit <ulink url="http://jboss.org/picketlink/IDM.html">here</ulink>.</para>
        <para>The project exo.core defines the API for Organization Service, and the eXo Platform implementation of API. For the Organization Service plugged in the eXo Platform product, you are flexible in switching between: eXo Organization Service, PicketLink and your own implementation. The configuration to switch between various Organization Service implementations can be found in <emphasis role="italic">portal.war/WEB-INF/conf/configuration.xml</emphasis>:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<!--PicketLink IDM integration -->
<import>war:/conf/organization/idm-configuration.xml</import>

<!--Former exo implementations -->
<!--<import>war:/conf/organization/exo/hibernate-configuration.xml</import> -->
<!-- <import>war:/conf/organization/exo/jdbc-configuration.xml</import> -->
<!--for organization service used active directory which is user lookup server -->
<!-- <import>war:/conf/organization/exoactivedirectory-configuration.xml</import> -->
<!--for organization service used ldap server which is user lookup server -->
<!-- <import>war:/conf/ldap-configuration.xml</import> -->
]]></programlisting>
        </programlistingco>
        <para>If you want to switch between different implementations, you just need to uncomment the corresponding &lt;import&gt; and leave others commented:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<!--PicketLink IDM integration -->
<import>war:/conf/ldap-configuration.xml</import>
<!-- <import>war:/conf/organization/idm-configuration.xml</import> -->
<!--Former exo implementations -->
<!--<import>war:/conf/organization/exo/hibernate-configuration.xml</import> -->
<!-- <import>war:/conf/organization/exo/jdbc-configuration.xml</import> -->
<!--for organization service used active directory which is user lookup server -->
<!-- <import>war:/conf/organization/exoactivedirectory-configuration.xml</import> -->
<!--for organization service used ldap server which is user lookup server -->
]]></programlisting>
        </programlistingco>
      </section>
    </section>
    <section id="DEV.SystemIntegration.Email">
      <title>Email </title>
      <para>The email service can use any SMTP account configured in <emphasis role="italic">$JBOSS_HOME/server/default/conf/gatein/configuration.properties</emphasis> or <emphasis role="italic">$TOMCAT_HOME/gatein/conf/configuration.properties</emphasis> if you are using Tomcat.</para>
      <para>The relevant section looks like:</para>
      <programlistingco>
        <areaspec units="linecolumn"/>
        <programlisting><![CDATA[
# EMail
gatein.email.smtp.username=
gatein.email.smtp.password=
gatein.email.smtp.host=smtp.gmail.com
gatein.email.smtp.port=465
gatein.email.smtp.starttls.enable=true
gatein.email.smtp.auth=true
gatein.email.smtp.socketFactory.port=465
gatein.email.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
]]></programlisting>
      </programlistingco>
      <para>It is pre-configured for Gmail, so any Gmail account can easily be used. You simply need to use the full Gmail address as username, and fill in the password.</para>
      <para>In corporate environments, you will want to use your corporate SMTP gateway. When using it over SSL, like in the default configuration, you may need to configure a certificate trust-store, containing your SMTP server's public certificate. Depending on the key sizes, you might also need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your Java Runtime Environment.</para>
    </section>
  </chapter>
  <chapter id="DEV.eXoPlatformAPIs">
    <title>eXo Platform 3.5 APIs </title>
    <para>This chapter presents the information about APIs that help you build your own applications from eXo services via the following topics:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.eXoPlatformSupportedAPIs.DefinitionsOfAPILevels">Definitions of API Levels</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.eXoPlatformSupportedAPIs.UseProvisionalOrExperimentalAPIs">Use Provisional or Experimental APIs</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoPlatformSupportedAPIs.PlatformAPIs">Platform APIs</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.eXoPlatformSupportedAPIs.JavaAPIs">Java APIs</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.eXoPlatformSupportedAPIs.JavaScriptAPIs">JavaScript APIs</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.eXoPlatformSupportedAPIs.WebServices">Web Services</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.eXoPlatformSupportedAPIs.ProvisionalAPIs}">Provisional APIs</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.eXoPlatformSupportedAPIs.ProvisionalAPIs.JavaAPIs">Java APIs</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
    </itemizedlist>
    <section id="DEV.eXoPlatformSupportedAPIs.DefinitionsOfAPILevels">
      <title>Definitions of API Levels </title>
      <para>APIs vary according to the maturity level. It is important to understand the eXo Platform's general approach to the API change management. The different levels of APIs are described in the following table:</para>
      <informaltable>
        <tgroup cols="7">
          <thead>
            <row>
              <entry> API Level </entry>
              <entry> Test Suite </entry>
              <entry> Clients </entry>
              <entry> Documentation </entry>
              <entry> Support </entry>
              <entry> Compatibility X.Y.Z(+1) </entry>
              <entry> Compatibility X.Y(+1) </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <emphasis role="bold">Platform API</emphasis>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
            </row>
            <row>
              <entry>
                <emphasis role="bold">Provisional API</emphasis>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
            </row>
            <row>
              <entry>
                <emphasis role="bold">Experimental API</emphasis>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/yes.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry> Best effort </entry>
              <entry> Best effort </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
            </row>
            <row>
              <entry>
                <emphasis role="bold">Unsupported API</emphasis>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
              <entry>
                <para> </para>
                <inlinemediaobject>
                  <imageobject role="fo">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                  <imageobject role="html">
                    <imagedata fileref="images/no.gif" format="GIF"/>
                  </imageobject>
                </inlinemediaobject>
                <para> </para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
      <para>
        <emphasis role="bold">Test Suite</emphasis>: A suite of tests that can be run against the API to detect changes.</para>
      <para>
        <emphasis role="bold">Clients</emphasis>: The API has been used successfully by at least 2 different teams, using the API Documentation only.</para>
      <para>
        <emphasis role="bold">Documentation</emphasis>: The API has a clean JavaDoc and reference documentation.</para>
      <para>
        <emphasis role="bold">Support</emphasis>: The eXo Support team provides help on the code that uses this API, and fixes any reported bugs.</para>
      <para>
        <emphasis role="bold">Compatibility X.Y.Z(+1)</emphasis>: The compatibility between maintenance versions (X.Y.Z and X.Y.Z+1) is guaranteed. If there is any change between X.Y and X.Y+1, the eXo Support team will help by upgrading the code.</para>
      <para>
        <emphasis role="bold">Compatibility X.Y(+1)</emphasis>: The compatibility between minor versions (X.Y and X.Y+1) is guaranteed. If there is any change between X and X+1, the eXo Support team will help by upgrading the code.</para>
      <para>
        <emphasis role="bold">Best Effort</emphasis>: You will receive assistance, but eXo Platform cannot guarantee any specific result.</para>
      <section id="DEV.eXoPlatformSupportedAPIs.UseProvisionalOrExperimentalAPIs">
        <title>Use Provisional or Experimental APIs </title>
        <para>These APIs are provided to give an "early look" at which will be available in upcoming versions of eXo Platform. These APIs are not final, but they can be used to start developing your application.</para>
        <para>
          <emphasis role="bold">Provisional APIs</emphasis> are APIs close to being frozen, but that need a last look from users. They can be used by third-party developers for their own apps, with the knowledge that only a limited compatibility guarantee is offered.</para>
        <para>
          <emphasis role="bold">Experimental APIs</emphasis> are APIs that are likely to change. They are published to get feedback from the community. These APIs have been tested successfully, but have not yet had enough feedback from developers.</para>
      </section>
    </section>
    <section id="DEV.eXoPlatformSupportedAPIs.PlatformAPIs">
      <title>Platform APIs </title>
      <section id="DEV.eXoPlatformSupportedAPIs.JavaAPIs">
        <title>Java APIs </title>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk02ch04.html#sect-Reference_Guide-Portlet_Primer">Portlet API:</ulink> (JSR 168 and JSR 286)</emphasis> A Java standard that defines how to write portlets. This is the way to develop Java applications that are integrated into eXo Platform.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk02ch07.html#wsrp-Introduction">WSRP 1.0 on JBoss:</ulink>
          </emphasis> A network protocol for integrating remote portlets into eXo Platform.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-introduction-to-rest.html#d0e17006">JAX-RS:</ulink> (JSR 311)</emphasis> A standard API that provides support for creating REST-like services.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-intro.html#d0e32">JCR (JSR 170):</ulink>
          </emphasis> A standard API that provides access to a content repository.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-jcr-extensions.html#d0e512">JCR Service Extensions:</ulink>
          </emphasis> A set of APIs that provide extended functionalities for the JCR, such as observation, permissions, and access to a repository.</para>
        <para>
          <emphasis role="bold">
            <ulink url="http://www.oracle.com/technetwork/java/javaee/overview/index.html">Java EE 6:</ulink>
          </emphasis> eXo Platform supports the Java EE 5 APIs, so you can develop applications using this standard.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-cache.html#d0e13710">Cache:</ulink>
          </emphasis> An API used for data caching.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-understanding-listeners-service.html#d0e13389">Event and Listener:</ulink>
          </emphasis> An API for listening and sending events within eXo Platform.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-organization-service.html#Overview">Organization:</ulink>
          </emphasis> An API and SPI for accessing user, group and membership information.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-service-configuration-for-beginners.html#d0e11071">Portal Container Definition:</ulink>
          </emphasis> This API is used to configure your portal.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch07.html#CONTref.JavaServices.TaxonomyService">Taxonomy:</ulink>
          </emphasis> An API that allows you to organize your content.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch07.html#CONTref.JavaServices.LinkManager">Link Management:</ulink>
          </emphasis> An API that provides a way to manage links when developing WCM features.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch07.html#CONTref.JavaServices.PublicationManager">Publication Management:</ulink>
          </emphasis> An API that provides different ways to manage the publication of content when developing WCM features.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch07.html#CONTref.JavaServices.WCMComposer">WCM Composer:</ulink>
          </emphasis> An API to get content shown in the website. The cache management is used in this service, and methods to update the content cache.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch03.html#CONTref.Configuration.Templates">Template WCM:</ulink>
          </emphasis> An API to provide views and dialogs to node types (system or document).</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-services-wiring.html#d0e13290">XML Configuration:</ulink>
          </emphasis> A set of DTD for configuring eXo Platform.</para>
      </section>
      <section id="DEV.eXoPlatformSupportedAPIs.JavaScriptAPIs">
        <title>JavaScript APIs </title>
        <para>
          <emphasis role="bold">
            <ulink url="http://www.opensocial.org/Technical-Resources/opensocial-spec-v08/opensocial-reference08">OpenSocial 0.8 Gadget Specification:</ulink>
          </emphasis> A standard that defines how to write gadgets and provide APIs. Gadgets are particularly useful for integrating external applications into eXo Platform.</para>
      </section>
      <section id="DEV.eXoPlatformSupportedAPIs.WebServices">
        <title>Web Services </title>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk05ch01.html#Adm_CMIS.Introduction">CMIS:</ulink>
          </emphasis> A standard API that gives access to the content repository via REST and SOAP Web services.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-ftp.html#d0e7058">FTP:</ulink>
          </emphasis> A standard protocol for exchanging documents.</para>
        <para>
          <emphasis role="bold">
            <ulink url="http://www.opensocial.org/Technical-Resources/opensocial-spec-v081/restful-protocol.html">OpenSocial 0.8 REST Protocol:</ulink>
          </emphasis> A standard API for accessing the social graph and activity streams.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/ch-webdav.html#d0e6836">WebDAV:</ulink>
          </emphasis> A standard protocol for exchanging document over HTTP.</para>
      </section>
    </section>
    <section id="DEV.eXoPlatformSupportedAPIs.ProvisionalAPIs">
      <title>Provisional APIs </title>
      <section id="DEV.eXoPlatformSupportedAPIs.ProvisionalAPIs.JavaAPIs">
        <title>Java APIs </title>
        <para>
          <emphasis role="bold">UI Extensions</emphasis>: An API to plug new actions into the eXo Platform UI.</para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch06.html#CONTref.Extensions.UIExtensions.AddOwnTabInECMAdministration.AddOwnUIAction">DocumentExplorer Toolbar</ulink>
          </emphasis>
        </para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk03ch06.html#CONTref.Extensions.UIExtensions.AddOwnTabInECMAdministration">ECM Admin</ulink>
          </emphasis>
        </para>
        <para>
          <emphasis role="bold">
            <ulink url="/docs/refguide/html/bk08ch03.html#Developer_document.Create the activity plug-in">Activity Sharing</ulink>
          </emphasis>
        </para>
      </section>
    </section>
  </chapter>
  <chapter id="DEV.Cookbook">
    <title>Cookbook </title>
    <section id="DEV.Cookbook.HowToCoppyASite">
      <title>How to Copy a Site </title>
      <para>This section describes how to copy a work done on the eXo Platform server, such as creating navigations, node types and templates, to another eXo Platform servers. To copy the whole site, you need to do the following actions:</para>
      <para>
        <emphasis role="bold">Step 1.</emphasis> Copy the site content folder with its version history by following the substeps: <anchor id="DEV.Cookbook.CopySitesContentFolderWithVersionHistory"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Sites Management</emphasis> drive.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Open the site node, for example "acme".</para>
      <para>
        <emphasis role="bold">3.</emphasis> Click <emphasis role="bold">Export Node</emphasis> to export the node with its version history as below:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_site_nodes2.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_site_nodes2.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">4.</emphasis> Select <emphasis role="bold">Export</emphasis> or <emphasis role="bold">Export version history</emphasis> to perform exporting.</para>
      <para>
        <emphasis role="bold">5.</emphasis> Click <emphasis role="bold">Import Node</emphasis> to open the <emphasis role="bold">Import Node</emphasis> form.</para>
      <para>
        <emphasis role="bold">6.</emphasis> Select the exported nodes and version history to be imported.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_site_nodes2.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_site_nodes2.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>One pop-up message will appear to inform that you have imported successfully as below:  <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_successfully.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_successfully.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">Step 2.</emphasis> Copy navigation nodes of sites as follows: <anchor id="DEV.Cookbook.CopyNavigationNodesOfSites"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Add a new drive to both target and source servers.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/add_portal_system_drive.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/add_portal_system_drive.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">2.</emphasis> Export the navigation node.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_site_navigations.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_site_navigations.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">3.</emphasis> Import the nodes navigation.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_site_navigations.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_site_navigations.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">Step 3.</emphasis> Copy the template of node type as follows: <anchor id="DEV.Cookbook.CopyTemplateOfNodeType"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Add the <emphasis role="bold">System</emphasis> drive to both servers.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/add_system_drive.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/add_system_drive.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">2.</emphasis> Open <emphasis role="italic">system:/jcr:system/exo:namespaces/{namespace_name}</emphasis>, and export it.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_namespace.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_namespace.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">3.</emphasis> Open <emphasis role="italic">system:/jcr:system/exo:namespaces/</emphasis>, and import the exported file as described in <emphasis role="bold">Step 2</emphasis>.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_namespace.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_namespace.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">4.</emphasis> Open <emphasis role="italic">system:/jcr:system/jcr:nodetypes/{node_type}</emphasis>, and export it.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_node_type.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_node_type.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">5.</emphasis> Open <emphasis role="italic">system:/jcr:system/jcr:nodetypes/</emphasis>, and import the exported file as described in <emphasis role="bold">Step 4</emphasis>.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_nodetype.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_nodetype.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <note>
        <para>If you have some specific JCR namespaces and node types, you need to import them into the new server.</para>
      </note>
      <para>
        <emphasis role="bold">Step 4.</emphasis> Copy the WCM templates as follows: <anchor id="DEV.Cookbook.CopyWCMTemplates"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the <emphasis role="bold">DMS Administration</emphasis> drive.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Open <emphasis role="italic">dms-system:/exo:ecm/templates/{node_type}</emphasis>, and export it.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_node_type_templates.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/export_node_type_templates.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">3.</emphasis> Open <emphasis role="italic">dms-system:/exo:ecm/templates/</emphasis>, and import the exported file.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_node_type_templates.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/import_node_type_templates.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>Also, for CLV/PCLV templates, you can find all template views defined in the <emphasis role="italic">dms-system:/exo:ecm/views</emphasis> path with:</para>
      <itemizedlist>
        <listitem>
          <para>userviews: this folder contains views of Sites Explorer with a set of actions.</para>
        </listitem>
        <listitem>
          <para>templates: where you can find all gtmpl templates of:</para>
          <itemizedlist>
            <listitem>
              <para>Category Navigation Portlet templates.</para>
            </listitem>
            <listitem>
              <para>Content List Viewer (CLV) templates and its paginator templates.</para>
            </listitem>
            <listitem>
              <para>content-browser templates (Deprecated Portlet).</para>
            </listitem>
            <listitem>
              <para>ecm-explorer templates define how to display nodes in the Sites Explorer portlet, such as CoverFlow template, IconView template.</para>
            </listitem>
            <listitem>
              <para>Parameterized Content List Viewer (PCLV) templates and its paginator templates.</para>
            </listitem>
            <listitem>
              <para>WCM Advanced Search is used in the WCM Search portlet to define the form, layout, result and result's paginator.</para>
            </listitem>
          </itemizedlist>
        </listitem>
      </itemizedlist>
      <para>If you want to reuse one of the non-predefined templates above, simply export and import it into the new server at the same place.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/WCM_templates.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/WCM_templates.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <note>
        <para>If you have some specific WCM (CLV/PCLV) views and/or templates of node types, you will need to import them into the new server.</para>
      </note>
      <para>
        <emphasis role="bold">Step 5.</emphasis> Copy a Taxonomy tree. <anchor id="DEV.Cookbook.CopyTaxonomyTree"/>
      </para>
      <para>By importing the whole site as described in the <emphasis role="bold">Copy the site content folder with its version history</emphasis> section, you will also have the Taxonomy tree imported. The default location where the site's Taxonomy is placed in a sub-folder named <emphasis role="bold">category</emphasis>. So, you do not need to export or import them because this step is automatically done. But the Taxonomy tree definition is still not fully imported in the new server. What you now need to do is to add this Taxonomy Tree definition by following those steps:</para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the <emphasis role="bold">DMS Administration</emphasis> drive in the new server.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Go to <emphasis role="italic">dms-system:/exo:ecm/exo:taxonomyTrees/definition/</emphasis>.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Add a symlink to the <emphasis role="bold">Taxonomy Tree Root Node</emphasis>, for example <emphasis role="italic">collaboration:/sites content/live/acme/categories/acme</emphasis>.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/select_TaxonomyTree_rootNode.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/select_TaxonomyTree_rootNode.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>The name of symlink is displayed as "acme".</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/select_TaxonomyTree_rootNode2.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/select_TaxonomyTree_rootNode2.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>The symlink will be generated as below:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/select_TaxonomyTree_rootNode3.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/select_TaxonomyTree_rootNode3.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>In some cases, to see changes, you need to clean cache by disconnecting or restarting the server.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/TaxonomyTree_added_successfully.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/TaxonomyTree_added_successfully.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">Step 6.</emphasis> Copy metadata templates as follows: <anchor id="DEV.Cookbook.CopyMetadataTemplates"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the <emphasis role="bold">DMS Administration</emphasis> drive in the new server.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Go to <emphasis role="italic">/exo:ecm/metadata/{meta_data_name}</emphasis>.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Export and import it in the same location in the new server again.</para>
      <para>
        <emphasis role="bold">Step 7.</emphasis> Copy queries via the following substeps: <anchor id="DEV.Cookbook.CopyQueries"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the <emphasis role="bold">DMS Administration</emphasis> drive in the new server.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Go to <emphasis role="italic">/exo:ecm/queries/{query_name}</emphasis>.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Export and import it in the same location in the new server again.</para>
      <para>
        <emphasis role="bold">Step 8.</emphasis> Copy scripts as follows: <anchor id="DEV.Cookbook.CopyScripts"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the <emphasis role="bold">DMS Administration</emphasis> drive in the new server.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Go to <emphasis role="italic">/exo:ecm/scripts/ecm-explorer</emphasis>.</para>
      <para>You will find three folders referring to the three types of groovy scripts in eXo Platform, including:</para>
      <itemizedlist>
        <listitem>
          <para>action: The action scripts are launched when an ECM action triggers them. For more information, refer to <emphasis role="bold">Actions Concept</emphasis>.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>interceptor: Interceptor scripts are triggered before and/or after the JCR node is saved, or when a node is created or edited. They are used to either validate the value entered in a form or to manipulate the newly created node, for example, to map the new node with a forum thread or any other type of discussion areas.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>widget: Widget scripts are used to fill widgets, such as a selectbox in a dynamic way.</para>
        </listitem>
      </itemizedlist>
      <para>
        <emphasis role="bold">3.</emphasis> Export your customized script in the same location in the new server.</para>
      <para>
        <emphasis role="bold">Step 9.</emphasis> Copy drive configurations as follows: <anchor id="DEV.Cookbook.CopyDriveConfigurations"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the <emphasis role="bold">DMS Administration</emphasis> drive in the new server.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Go to <emphasis role="italic">/exo:ecm/exo:drives/{drive_name}</emphasis>.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Export and import it in the same location in the new server again.</para>
      <para>
        <emphasis role="bold">Step 10.</emphasis> Copy gadgets as follows: <anchor id="DEV.Cookbook.CopyGadgets"/>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Open the drive that points into <emphasis role="bold">Portal-System</emphasis> Workspace.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Go to your gadget to <emphasis role="italic">portal-system:/production/app:gadgets/{gadget_namee}</emphasis>.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Export and import it in the same location in the new server again.</para>
      <para>
        <emphasis role="bold">Step 11.</emphasis> Restart the server. <anchor id="DEV.Cookbook.RestartServer"/>
      </para>
      <para>After importing the site navigation nodes, the site looks like:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/acme_site_after_import.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/acme_site_after_import.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>So, you need to restart the server first. The site looks like:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/how_to_copy_a_site/acme_site_after_import_and_restart.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/how_to_copy_a_site/acme_site_after_import_and_restart.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
    </section>
  </chapter>
  <chapter id="DEV.NewFeatures">
    <title>New Features </title>
    <para>This chapter presents new features added to eXo Platform 3.5.  At present, in this chapter, you will have opportunity to learn about one feature called <emphasis role="bold">Navigation By Content</emphasis> with the following specific topics:</para>
    <itemizedlist>
      <listitem>
        <para>
          <link linkend="DEV.NewFeatures.NavigationByContent.whatisNavigationByContent">What is Navigation By Content?</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.NewFeatures.NavigationByContent.ContentNavigation">Actual content navigation</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.NewFeatures.NavigationByContent.HowTo">How-To</link>
        </para>
      </listitem>
      <listitem>
        <para>
          <link linkend="DEV.NewFeatures.NavigationByContent.ActionsNavigationByContent">Actions on Navigation By Content</link>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <link linkend="DEV.NewFeatures.NavigationByContent.CreateNewProduct">Create a new product</link>
            </para>
          </listitem>
          <listitem>
            <para>
              <link linkend="DEV.NewFeatures.NavigationByContent.HowCreateNewProduct.DevelopProductContent">Develop product content</link>
            </para>
          </listitem>
        </itemizedlist>
      </listitem>
    </itemizedlist>
    <section id="DEV.Cookbook.NavigationByContent">
      <title>Navigation by content </title>
    </section>
    <section id="DEV.NewFeatures.NavigationByContent.whatisNavigationByContent">
      <title>What is Navigation By Content? </title>
      <para>
        <emphasis role="bold">Navigation By Content</emphasis> is a feature which allows users to browse content of each page easily.  With this feature, users experiencing eXo Platform can navigate from a page to another or browse site content inside one page directly from a contextual menu.</para>
    </section>
    <section id="DEV.NewFeatures.NavigationByContent.ContentNavigation">
      <title>Actual content navigation </title>
      <para>One of the powerful features of Enterprise Content Management System (ECMS) that comes out with eXo Platform 3.5 is the ability to navigate in site contents using taxonomies. This functionality can easily be added in a page with the help of two <emphasis role="bold">Content List Viewer</emphasis> (CLV) portlets. The pre-configured example can be found in the <emphasis role="bold">News</emphasis> page of the sample ACME website. In this example, the <emphasis role="italic">/site contents/live/acme/events/All</emphasis> node will be used.</para>
      <para>
        <emphasis role="bold">To add "Actual content navigation" to a page:</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Log in to the sample ACME website.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Add a new page, for example "Events".</para>
      <para>
        <emphasis role="bold">3.</emphasis> Parameterize this page with the two-column container.</para>
      <para>
        <emphasis role="bold">4.</emphasis> Add two content list portlets.</para>
      <para>
        <emphasis role="bold">i. First portlet:</emphasis>
      </para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/browseByCLV.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/browseByCLV.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>In which:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Folder path</emphasis> = <emphasis role="italic">/site contents/live/acme/events/All</emphasis>: The path to the location of a folder that contains the content.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Header</emphasis> = <emphasis role="italic">Browse by</emphasis>: The title of all contents that are listed in the content list viewer. </para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Template</emphasis> = <emphasis role="italic">CatgoryTree.gtmpl</emphasis>: The template is used to view content list.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Contextual Folder</emphasis> = <emphasis role="italic">Disabled</emphasis>: The Contextual Content property is set to "Disable", the Advanced pane is closed by default and a single content will be opened by an URL containing the content path. </para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Show in page</emphasis> =<emphasis role="italic">Events</emphasis>: A single content in CLV will be shown in the "Events" page.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">With</emphasis> = <emphasis role="italic">folder-id</emphasis>: The parameter containing the content path. </para>
        </listitem>
      </itemizedlist>
      <para>
        <emphasis role="bold">ii. Second portlet:</emphasis>
      </para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/showListCLV.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/showListCLV.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>In which:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Folder path</emphasis> = <emphasis role="italic">/site contents/live/acme/events/All</emphasis>: The path to the location of a folder that contains the content.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Template</emphasis> = <emphasis role="italic">OneColumnCLVTemplate.gtmpl</emphasis>: The template is used to view content list.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Contextual Folder</emphasis> = <emphasis role="italic">Enabled</emphasis>: The Contextual Content property is set to "Enable". This portlet is configured with the provided parameter (content-id by default).</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Show in page</emphasis> = <emphasis role="italic">Details</emphasis>: A single content in CLV will be shown in the "Details" page.</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">With</emphasis> = <emphasis role="italic">content-id</emphasis>: The parameter containing the content path.</para>
        </listitem>
      </itemizedlist>
      <para>As a result, the created "Events" page will look like:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/eventsPage.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/eventsPage.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>You can now navigate from the left portlet to see contents displayed in the right portlet.</para>
      <para>The new <emphasis role="bold">Navigation By Content</emphasis> feature will traduce this example in a contextual menu.</para>
    </section>
    <section id="DEV.NewFeatures.NavigationByContent.HowTo">
      <title>How-To </title>
      <para>
        <emphasis role="bold">You need to attach your root folder/node to some page nodes from the homepage (the drop-down menu holds your new contextual menu):</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Content Explorer</emphasis> page and navigate to <emphasis role="italic">/site contents/live/acme/events/All</emphasis>.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Click the <emphasis role="bold">Content Navigation</emphasis> button.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Fill values into the navigation form, including:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Visible</emphasis> = true. This node will be navigable.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Target parent navigation</emphasis> = Events. The contextual menu will be attached to the <emphasis role="bold">Events</emphasis> drop-down menu.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Clickable</emphasis> = false. This node will not be clickable.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Page for list</emphasis> = catalog. This page is a system page that contains a content list viewer portlet and will be used to display the list of child nodes.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Page for detail</emphasis> = detail. This page is a system page that contains a single content viewer portlet and will be used to display details of child nodes.</para>
        </listitem>
      </itemizedlist>
      <para>
        <emphasis role="bold">4.</emphasis> Save changes, then go back to the <emphasis role="bold">Acme/Overview</emphasis> homepage.</para>
      <para>You will see changes from the <emphasis role="bold">Events</emphasis> drop-down menu.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/contextualMenu.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/contextualMenu.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>In which:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Visible</emphasis>: The <emphasis role="italic">/site contents/live/acme/events/All</emphasis> node is navigable and its child nodes are rendered in the contextual menu.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Target parent navigation</emphasis>: The <emphasis role="italic">/site contents/live/acme/events/All</emphasis> node is attached to the site menu item called <emphasis role="bold">Events</emphasis>.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Clickable</emphasis>: The <emphasis role="italic">/site contents/live/acme/events/All</emphasis> node is not clickable but all its child nodes are clickable.</para>
        </listitem>
      </itemizedlist>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Page for list</emphasis>: The list of child nodes (if a child node is <emphasis role="bold">directory/folder</emphasis>) will be rendered in the following page.</para>
        </listitem>
      </itemizedlist>
      <para>Click the <emphasis role="bold">Earth</emphasis> menu item from the contextual menu and see that contents of the <emphasis role="italic">Earth</emphasis> directory are rendered in a separate page (catalog):</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/listEarth.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/listEarth.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Page for detail</emphasis>: The details of child nodes (if a child node is a sample content) will be rendered in this page:</para>
        </listitem>
      </itemizedlist>
      <para>Select the <emphasis role="bold">Power 1 - Fire</emphasis> menu item from the contextual menu to see the <emphasis role="bold">Fire</emphasis> content which is displayed in a separate page (details):</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/event1.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/event1.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
    </section>
    <section id="DEV.NewFeatures.NavigationByContent.ActionsNavigationByContent">
      <title>Actions on Navigation By Content </title>
      <para>
        <emphasis role="bold">To restrict the visibility of some contents:</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Content Explorer</emphasis> page and navigate under <emphasis role="italic">/site contents/live/acme/events/All/Fire</emphasis>.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Click the <emphasis role="bold">Content Navigation</emphasis> button.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Uncheck the field visible and save.</para>
      <para>
        <emphasis role="bold">4.</emphasis> Go back to the homepage and see that the Fire sub-menu is not displayed in the contextual menu.</para>
      <para>
        <emphasis role="bold">To sort elements of the contextual menu:</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Content Explorer</emphasis> page and navigate under <emphasis role="italic">/site contents/live/acme/events/All</emphasis>.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Select the <emphasis role="italic">/site contents/live/acme/events/All/Earth</emphasis> node.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Click the <emphasis role="bold">Content Navigation</emphasis> button.</para>
      <para>
        <emphasis role="bold">4.</emphasis> Set the <emphasis role="bold">Display order</emphasis> field to 1 and save.</para>
      <para>
        <emphasis role="bold">5.</emphasis> Select the <emphasis role="italic">/site contents/live/acme/events/All/Water</emphasis> node.</para>
      <para>
        <emphasis role="bold">6.</emphasis> Click the <emphasis role="bold">Content Navigation</emphasis> button.</para>
      <para>
        <emphasis role="bold">7.</emphasis> Set the <emphasis role="bold">Display order</emphasis> field to 2 and save.</para>
      <para>
        <emphasis role="bold">8.</emphasis> Select the <emphasis role="italic">/site contents/live/acme/events/All/Air</emphasis> node.</para>
      <para>
        <emphasis role="bold">9.</emphasis> Click the <emphasis role="bold">Content Navigation</emphasis> button.</para>
      <para>
        <emphasis role="bold">10.</emphasis> Set the <emphasis role="bold">Display order</emphasis> field to 3 and save.</para>
      <para>
        <emphasis role="bold">11.</emphasis> Go back to the homepage and see that the display order from the contextual menu is sorted to Earth, Water, Air. Note that the Fire sub-menu is not displayed because it is set to "invisible" in the previous example.</para>
      <para>
        <emphasis role="bold">To restore a node to the contextual menu (if you already removed it) and attach it to another page:</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Content Explorer</emphasis> page and navigate under <emphasis role="italic">/site contents/live/acme/events/All/Fire</emphasis>.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Click the <emphasis role="bold">Content Navigation</emphasis> button.</para>
      <para>
        <emphasis role="bold">3.</emphasis> Fill values into the navigation form fields, including:</para>
      <itemizedlist>
        <listitem>
          <para>
            <emphasis role="bold">Visible</emphasis> = true</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Target parent navigation</emphasis> = News</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Clickable</emphasis> = false</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Page for list</emphasis> = catalog</para>
        </listitem>
        <listitem>
          <para>
            <emphasis role="bold">Page for detail</emphasis> = detail</para>
        </listitem>
      </itemizedlist>
      <para>
        <emphasis role="bold">4.</emphasis> Save changes and go back to the <emphasis role="bold">Acme/Overview</emphasis> homepage and see that the Fire node is attached to the <emphasis role="bold">News</emphasis> drop-down menu from the site menu:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/fireNode.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/fireNode.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>However, if you want to add your newly created content directly to the contextual menu, you need to add the <emphasis role="bold">populateToMenu</emphasis> action first.</para>
      <para>
        <emphasis role="bold">To add your newly created contents to the contextual menu:</emphasis>
      </para>
      <para>
        <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Content Explorer</emphasis> page and navigate under <emphasis role="italic">/site contents/live/acme/events/All/Fire</emphasis>.</para>
      <para>
        <emphasis role="bold">2.</emphasis> Click the <emphasis role="bold">Manage Actions</emphasis> button and add the <emphasis role="bold">exo:populateToMenu</emphasis> action.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/populateToMenuAction.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/populateToMenuAction.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>
        <emphasis role="bold">3.</emphasis> Create a document under <emphasis role="italic">/site contents/live/acme/events/All/Fire</emphasis> (for example, uploading a file) and publish it.</para>
      <para>
        <emphasis role="bold">4.</emphasis> Go back to the homepage and see that your newly created document is added to the contextual menu.</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/docPDF.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/docPDF.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>The sample ACME website comes with a configured navigation by content menu:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/productsMenu.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/productsMenu.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>You can click the <emphasis role="bold">Vision</emphasis> sub-menu and see contents of vision directory rendered in the <emphasis role="bold">catalog</emphasis> page:</para>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/visionSubMenuList.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/visionSubMenuList.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <para>For example, select the X-Ray content and see the newly implemented content using new visual effects.</para>
      <itemizedlist>
        <listitem>
          <para>"Benefits" and "Features" tabs:</para>
        </listitem>
      </itemizedlist>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/benefits.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/benefits.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <itemizedlist>
        <listitem>
          <para>Coverflow section:</para>
        </listitem>
      </itemizedlist>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/coverflow.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/coverflow.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <itemizedlist>
        <listitem>
          <para>Related documents:</para>
        </listitem>
      </itemizedlist>
      <para>
        <inlinemediaobject>
          <imageobject role="fo">
            <imagedata align="center" fileref="images/navigation_by_content_feature/relatedDocuments.png" format="PNG"/>
          </imageobject>
          <imageobject role="html">
            <imagedata align="center" fileref="images/navigation_by_content_feature/relatedDocuments.png" format="PNG"/>
          </imageobject>
        </inlinemediaobject>
      </para>
      <section id="DEV.NewFeatures.NavigationByContent.CreateNewProduct">
        <title>Create a new product </title>
        <para>
          <emphasis role="bold">To create a new product:</emphasis>
        </para>
        <para>
          <emphasis role="bold">1.</emphasis> Go to the <emphasis role="bold">Content Explorer</emphasis> page and navigate under <emphasis role="italic">somePath/someDirectory</emphasis>.</para>
        <para>
          <emphasis role="bold">2.</emphasis> Click the <emphasis role="bold">Add Document</emphasis> button.</para>
        <para>
          <emphasis role="bold">3.</emphasis> Select <emphasis role="bold">Product</emphasis>.</para>
        <para>
          <emphasis role="bold">4.</emphasis> Fill the product dialog form.</para>
        <itemizedlist>
          <listitem>
            <para>Name: The name of the product.</para>
          </listitem>
          <listitem>
            <para>Title: The title of the product.</para>
          </listitem>
          <listitem>
            <para>Illustration Image: The image that is used as an illustration for the product.</para>
          </listitem>
          <listitem>
            <para>Summary: The summary about the product goes with the illustration.</para>
          </listitem>
          <listitem>
            <para>Benefits: The benefits of the product.</para>
          </listitem>
          <listitem>
            <para>Features: The features of the product.</para>
          </listitem>
        </itemizedlist>
        <para>
          <emphasis role="bold">5.</emphasis> Save changes.</para>
        <para>
          <emphasis role="bold">To improve your newly created product, for example "sampleProduct":</emphasis>
        </para>
        <para>
          <emphasis role="bold">1.</emphasis> Go under <emphasis role="italic">somePath/someDirectory/sampleProduct/medias/images</emphasis>.</para>
        <para>
          <emphasis role="bold">2.</emphasis> Upload some images and publish them.</para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductImages.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductImages.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
        <para>
          <emphasis role="bold">3.</emphasis> Go under <emphasis role="italic">somePath/someDirectory/sampleProduct/medias/videos</emphasis>.</para>
        <para>
          <emphasis role="bold">4.</emphasis> Upload a video and publish it.</para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductVideos.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductVideos.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
        <para>
          <emphasis role="bold">5.</emphasis> Go under <emphasis role="italic">somePath/someDirectory/sampleProduct/documents</emphasis>.</para>
        <para>
          <emphasis role="bold">6.</emphasis> Create two directories, including Sales materials and Technical documentation.</para>
        <para>
          <emphasis role="bold">7.</emphasis> Upload a PDF document and publish it under each sub-folder.</para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductDocuments.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductDocuments.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
        <para>
          <emphasis role="bold">8.</emphasis> Add <emphasis role="bold">sampleProduct</emphasis> to some categories or add it to <emphasis role="bold">Content List Portlet</emphasis>.</para>
        <para>Your newly created product is ready to be displayed in some pages. </para>
        <para>
          <emphasis role="bold">9.</emphasis> Publish your newly created product.</para>
        <para>Note that you can select this content from a CLV:</para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductCLV.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductCLV.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
        <para>As a result, the content will be displayed in a detailed page as follows:</para>
        <para>
          <inlinemediaobject>
            <imageobject role="fo">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductDetail.png" format="PNG"/>
            </imageobject>
            <imageobject role="html">
              <imagedata align="center" fileref="images/navigation_by_content_feature/sampleProductDetail.png" format="PNG"/>
            </imageobject>
          </inlinemediaobject>
        </para>
      </section>
      <section>
        <title>Develop your product content </title>
        <para>The product content is composed of fields and folders:</para>
        <itemizedlist>
          <listitem>
            <para>Fields: Name, Title, Illustration Image, Summary, Benefits, and Features.</para>
          </listitem>
        </itemizedlist>
        <itemizedlist>
          <listitem>
            <para>Folders: documents, medias/images, medias/videos.</para>
          </listitem>
        </itemizedlist>
        <para>Folders are created within the product content when the name field is created.</para>
        <para>
          <emphasis role="bold">This can be achieved (from the </emphasis>.gtmpl<emphasis role="bold"> product dialog) as follows:</emphasis>
        </para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<tr>
	<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.name")%></td>
	<td class="FieldComponent">
	<%
	String[] productFieldName = ["jcrPath=/node", "mixintype=mix:votable,mix:commentable","editable=if-null","validate=name,empty"] ;
	uicomponent.addTextField("name", productFieldName) ;
	String[] documentsFolder = ["jcrPath=/node/documents", "nodetype=nt:folder","mixintype=exo:documentFolder", "defaultValues=documents"] ;
	String[] mediasFolder = ["jcrPath=/node/medias", "nodetype=exo:multimediaFolder", "defaultValues=medias"] ;
	String[] imagesFolder = ["jcrPath=/node/medias/images", "nodetype=nt:folder", "defaultValues=images"] ;
	String[] videoFolder = ["jcrPath=/node/medias/videos", "nodetype=nt:folder", "defaultValues=videos"] ;
	uicomponent.addHiddenField("documentsFolder", documentsFolder);
	uicomponent.addHiddenField("mediasFolder", mediasFolder);
	uicomponent.addHiddenField("imagesFolder", imagesFolder);
	uicomponent.addHiddenField("videoFolder", videoFolder);
	%>
	</td>
</tr>
]]></programlisting>
        </programlistingco>
        <para>
          <emphasis role="bold">Other fields are created almost in the same way:</emphasis>
        </para>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Title:</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<tr>
	<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.title")%></td>
	<td class="FieldComponent">
	<%
		String[] productFieldTitle = ["jcrPath=/node/exo:title", "validate=empty", "editable=if-null"];
		uicomponent.addTextField("title", productFieldTitle) ;
	%>
	</td>
</tr>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Illustration Image:</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<%
private void setUploadFields(name) {
	String[] illustrationHiddenField1 = ["jcrPath=/node/medias/images/illustration", "nodetype=nt:file", "mixintype=mix:referenceable", "defaultValues=illustration"];
	String[] illustrationHiddenField2 = ["jcrPath=/node/medias/images/illustration/jcr:content", "nodetype=nt:resource", "mixintype=dc:elementSet", "visible=false"];
	String[] illustrationHiddenField3 = ["jcrPath=/node/medias/images/illustration/jcr:content/jcr:encoding", "visible=false", "UTF-8"];
	String[] illustrationHiddenField4 = ["jcrPath=/node/medias/images/illustration/jcr:content/jcr:lastModified", "visible=false"];
	String[] illustrationHiddenField5 = ["jcrPath=/node/medias/images/illustration/jcr:content/dc:date", "visible=false"];
	uicomponent.addHiddenField("illustrationHiddenField1", illustrationHiddenField1);
	uicomponent.addHiddenField("illustrationHiddenField2", illustrationHiddenField2);
	uicomponent.addHiddenField("illustrationHiddenField3", illustrationHiddenField3);
	uicomponent.addCalendarField("illustrationHiddenField4", illustrationHiddenField4);
	uicomponent.addCalendarField("illustrationHiddenField5", illustrationHiddenField5);
	String[] fieldImage = ["jcrPath=/node/medias/images/illustration/jcr:content/jcr:data"] ;
	uicomponent.addUploadField(name, fieldImage) ;
}
%>
<tr>
	<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.illustrationImage")%></td>
	<td class="FieldComponent">
		<%
			String illustration = "illustration";
			if(ProductNode != null && ProductNode.hasNode("medias/images/illustration") && (uicomponent.findComponentById(illustration) == null)) {
				def imageNode = ProductNode.getNode("medias/images/illustration") ;
				def resourceNode = imageNode.getNode("jcr:content");
				if(resourceNode.getProperty("jcr:data").getStream().available() > 0) {
					def imgSrc = uicomponent.getImage(imageNode, "jcr:content");
					def actionLink = uicomponent.event("RemoveData", "/medias/images/illustration/jcr:content");
					%>
						<div>
							<image src="$imgSrc" width="100px" height="80px"/>
							<a onclick="$actionLink">
								<img src="/eXoResources/skin/DefaultSkin/background/Blank.gif" class="ActionIcon Remove16x16Icon"/>
							</a>
						</div>
					<%
				} else {
					setUploadFields(illustration);
				}
			} else {
				setUploadFields(illustration);
			}
		%>
	</td>
</tr>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Summary:</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<tr>
	<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.summary")%></td>
	<td class="FieldComponent">
	<%
		String[] fieldSummary = ["jcrPath=/node/exo:summary", "options=Basic", ""] ;
		uicomponent.addRichtextField("summary", fieldSummary) ;
	%>
	</td>
</tr>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Benefits:</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<tr>
	<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.benefits")%></td>
	<td class="FieldComponent">
	<div class="UIFCKEditor">
	<%
		String[] productFieldBenefits = ["jcrPath=/node/exo:productBenefits", "options=toolbar:CompleteWCM", ""] ;
		uicomponent.addRichtextField("productBenefits", productFieldBenefits) ;
	%>
	</div>
	</td>
</tr>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Features:</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<tr>
	<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.features")%></td>
	<td class="FieldComponent">
	<div class="UIFCKEditor">
	<%
		String[] productFieldFeatures = ["jcrPath=/node/exo:productFeatures", "options=toolbar:CompleteWCM", ""] ;
		uicomponent.addRichtextField("productFeatures", productFieldFeatures) ;
	%>
	</div>
	</td>
</tr>
]]></programlisting>
        </programlistingco>
        <para>Now let's look at the product's view form.</para>
        <para>
          <emphasis role="bold">Illustration image, title and summary are grouped together:</emphasis>
        </para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<!-- Hot news -->
<div class="BigNews ClearFix">
	<!-- Begin illustrative image -->
		<%
		RESTImagesRendererService imagesRenderer = uicomponent.getApplicationComponent(RESTImagesRendererService.class);
		def imageURI = imagesRenderer.generateImageURI(currentNode.getNode("medias/images/illustration"),null);
		if (imageURI != null){
		%>
	<a class="Image"><img width="93" src="$imageURI" alt=""></a>
		<%
		}
		%>
	<div class="Content">
	<!-- Begin title -->
	<%
	  if(currentNode.hasProperty("exo:title")) {
		def title = currentNode.getProperty("exo:title").getString();
		%>
		<a href="#" class="Title">$title</a>
		<div class="Index1">$title</div>
		<%
	  }
	%>
	<!-- End title -->
	<!-- Begin summary -->
		<%
		if(currentNode.hasProperty("exo:summary")) {
		def summary = currentNode.getProperty("exo:summary").getString();
		%>
		<div class="Summary">$summary</div>
		<%
		}
		%>
	<!-- End summary -->
	</div>
</div>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Benefits and Features fields are rendered in two tabs. It uses the jQuery library (already integrated into eXo Platform 3.5).</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<div id="sectionsTabs" class="ui-tabs">
	<ul class="ui-tabs-nav ClearFix">
		<li class="ui-state-default">
			<!-- Begin Benefits head section -->
			<a class="ArrowCtrl" href="#tab-benefits"><%=_ctx.appRes("Product.view.label.benefits")%></a>
			<!-- End Benefits head section -->
		</li>
		<li class="ui-tabs-selected">
			<!-- Begin Features head section -->
			<a class="ArrowCtrl" href="#tab-features"><%=_ctx.appRes("Product.view.label.features")%></a>
			<!-- End Features head section -->
		</li>
	</ul>
	<div id="tab-benefits">
	  <%
		  if(currentNode.hasProperty("exo:productBenefits")) {
			def benefits = currentNode.getProperty("exo:productBenefits").getString();
			print benefits;
		  }
	  %>
	</div>
	<div id="tab-features">
	  <%
		  if(currentNode.hasProperty("exo:productFeatures")) {
			def features = currentNode.getProperty("exo:productFeatures").getString();
			print features;
		  }
	  %>
	</div>
</div>

<script type="text/javascript">
	jQuery.noConflict();
	jQuery(document).ready(function() {
		jQuery("#sectionsTabs").tabs();
	});
</script>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">The jQuery-based feature is display of the product's images (coverflow) from the images folder.</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<div class="jQProBoxC">
<!-- Begin jCarouselLite part -->
<button class="jQprev">&nbsp;</button>
<div class="jCarouselLite">
	<ul>
	   <%
             FOR IMAGE IN PRODUCT'S IMAGE FOLDER
		String imgSrc = "";
		/*
		GET THE IMAGE PATH
		imgSrc = GET THE IMAGE PATH;
		*/
		%>
		<li><img src="$imgSrc" width="204" height="200"/></li>
		<%
	    %>
	</ul>
</div>
<button class="jQnext">&nbsp;</button>
<!-- End jCarouselLite part -->
</div>
<script type="text/javascript">
jQuery.noConflict();
   jQuery(document).ready(function(){
  //jQuery.noConflict();
	jQuery(".jCarouselLite").jCarouselLite({
	btnNext: ".jQprev",
	btnPrev: ".jQnext",
	//auto: 500,
	//speed: 500
});
});
</script>
]]></programlisting>
        </programlistingco>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis role="bold">Documents and videos are simply displayed within the view form as follows:</emphasis>
            </para>
          </listitem>
        </itemizedlist>
        <para>
          <emphasis role="bold">1.</emphasis> Get the node path (document or video).</para>
        <para>
          <emphasis role="bold">2.</emphasis> Use some customized CSS classes to display a link for this node.</para>
        <para>Labels and/or messages displayed in the dialog and the view form are localized.</para>
        <para>Note the use of this instruction as below:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting><![CDATA[
<td class="FieldLabel"><%=_ctx.appRes("Product.dialog.label.summary")%></td>
[...]
<h1><%=_ctx.appRes("Product.view.label.seeItInAction")%></h1>
]]></programlisting>
        </programlistingco>
        <para>This is achieved by adding locale files. For example:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<Product>
  <view>
    <label>
      <benefits>Benefits</benefits>
      <features>Features</features>
      <seeItInAction>See it in action</seeItInAction>
      <resources>Resources</resources>
      <videos>Videos</videos>
    </label>
  </view>
</Product>
]]></programlisting>
        </programlistingco>
        <para>Make sure that locale files are added to the resource bundle configuration. If locale files (dialogs and views) are under the <emphasis role="italic">classes/locale/wcm</emphasis> directory, use the following code:</para>
        <programlistingco>
          <areaspec units="linecolumn"/>
          <programlisting language="xml"><![CDATA[
<value>locale.wcm.dialogs</value>
<value>locale.wcm.views</value>
]]></programlisting>
        </programlistingco>
      </section>
    </section>
  </chapter>
</book>
